Statistiques
| Révision :

root / src / CalcCnct.f90

Historique | Voir | Annoter | Télécharger (5,16 ko)

1 1 pfleura2
!================================================================
2 1 pfleura2
! Calculation of the connectivity.
3 1 pfleura2
!
4 1 pfleura2
! Input:
5 1 pfleura2
! Na: (INTEGER) Number of atoms in the system
6 1 pfleura2
! Atome: (INTEGER) Number of mass of the atoms.
7 1 pfleura2
!                  Needed to find their covalent raii.
8 1 pfleura2
!  x(Nat), y(nat), z(nat) : (REAL) Cartesian coordinates of the system.
9 1 pfleura2
!  LIAISONS: (INTEGER Na,0:NMaxL) Array containing the connectivity.
10 1 pfleura2
!            That is Liaisons(i,:) contains the atoms linked to i.
11 1 pfleura2
!            Liaisons(i,0) contains the number of atoms linked to i.
12 1 pfleura2
! r_cov(0:Max_Z) (REAL) Covalent radii
13 1 pfleura2
! Fact (REAL) Factor used to determined if two atoms are linked :
14 1 pfleura2
!            i and j are linked if (dist(i,j)*fact <= rcov(i)+rcov(j)
15 1 pfleura2
!
16 1 pfleura2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
17 1 pfleura2
! Taken from Path_Module
18 1 pfleura2
! NMaxL (INTEGER): Maximum number of bonds for one atome
19 1 pfleura2
! Max_Z (INTEGER): Last atom for which I have the atomic of mass and covalent radii.
20 1 pfleura2
! Nom(Nat) (STRING): Name of the atoms.
21 1 pfleura2
! Prog (SCHARS): Name of the program used to calculate energies and gradients
22 1 pfleura2
!
23 1 pfleura2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
24 1 pfleura2
! v1.0 (c) PFL
25 1 pfleura2
! v1.1 (c) PFL 11.2007
26 1 pfleura2
! A test has been added for periodic system, ie the linked test
27 1 pfleura2
! is done between i in the central cell, and j in all surrounding cells.
28 1 pfleura2
!
29 1 pfleura2
!================================================================
30 1 pfleura2
31 1 pfleura2
SUBROUTINE CalcCnct(na,atome,x,y,z,LIAISONS,r_cov,fact)
32 1 pfleura2
33 12 pfleura2
!----------------------------------------------------------------------
34 12 pfleura2
!  Copyright 2003-2014 Ecole Normale Supérieure de Lyon,
35 12 pfleura2
!  Centre National de la Recherche Scientifique,
36 12 pfleura2
!  Université Claude Bernard Lyon 1. All rights reserved.
37 12 pfleura2
!
38 12 pfleura2
!  This work is registered with the Agency for the Protection of Programs
39 12 pfleura2
!  as IDDN.FR.001.100009.000.S.P.2014.000.30625
40 12 pfleura2
!
41 12 pfleura2
!  Authors: P. Fleurat-Lessard, P. Dayal
42 12 pfleura2
!  Contact: optnpath@gmail.com
43 12 pfleura2
!
44 12 pfleura2
! This file is part of "Opt'n Path".
45 12 pfleura2
!
46 12 pfleura2
!  "Opt'n Path" is free software: you can redistribute it and/or modify
47 12 pfleura2
!  it under the terms of the GNU Affero General Public License as
48 12 pfleura2
!  published by the Free Software Foundation, either version 3 of the License,
49 12 pfleura2
!  or (at your option) any later version.
50 12 pfleura2
!
51 12 pfleura2
!  "Opt'n Path" is distributed in the hope that it will be useful,
52 12 pfleura2
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
53 12 pfleura2
!
54 12 pfleura2
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
55 12 pfleura2
!  GNU Affero General Public License for more details.
56 12 pfleura2
!
57 12 pfleura2
!  You should have received a copy of the GNU Affero General Public License
58 12 pfleura2
!  along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>.
59 12 pfleura2
!
60 12 pfleura2
! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr,
61 12 pfleura2
! for commercial licensing opportunities.
62 12 pfleura2
!----------------------------------------------------------------------
63 12 pfleura2
64 12 pfleura2
  use Path_module, only : NMaxL, max_Z,Nom, KINT, KREAL, FPBC, &
65 10 pfleura2
       kaBeg,kaEnd,kbBeg,kbEnd,kcBeg,kcEnd
66 8 pfleura2
67 8 pfleura2
  IMPLICIT NONE
68 1 pfleura2
69 2 pfleura2
  integer(KINT) :: na, atome(Na)
70 1 pfleura2
  real(KREAL) ::  x(Na),y(Na),z(Na),fact
71 1 pfleura2
  real(KREAL) :: vx,vy,vz,dist
72 1 pfleura2
  REAL(KREAL) :: r_cov(0:Max_Z)
73 1 pfleura2
  INTEGER(KINT) :: LIAISONS(Na,0:NMaxL),Nbli,Nblj
74 1 pfleura2
75 1 pfleura2
  ! For periodic systems
76 1 pfleura2
  INTEGER(KINT) :: Ka,Kb,Kc
77 1 pfleura2
  LOGICAL   :: Bound
78 1 pfleura2
79 1 pfleura2
  ! Internals
80 1 pfleura2
  logical(KREAL) ::debug
81 8 pfleura2
  REAL(KREAL) :: DistTh
82 8 pfleura2
  INTEGER(KINT) :: I,j,iat
83 1 pfleura2
84 1 pfleura2
  INTERFACE
85 1 pfleura2
     function valid(string) result (isValid)
86 1 pfleura2
       CHARACTER(*), intent(in) :: string
87 1 pfleura2
       logical                  :: isValid
88 1 pfleura2
     END function VALID
89 1 pfleura2
  END INTERFACE
90 1 pfleura2
91 1 pfleura2
  debug=valid('calccnct')
92 8 pfleura2
  if (debug)  Call Header (" Entering CalcCnct ")
93 1 pfleura2
94 1 pfleura2
  DO i=1,na
95 1 pfleura2
     Liaisons(i,0)=0
96 1 pfleura2
  END DO
97 1 pfleura2
98 1 pfleura2
  if (debug) THEN
99 10 pfleura2
     WRITE(*,*) 'CalcCnct : covalent radii used'
100 1 pfleura2
     DO iat=1,na
101 1 pfleura2
        i=atome(iat)
102 10 pfleura2
        WRITE(*,*) Nom(I),I,r_cov(i)*fact
103 1 pfleura2
     END DO
104 10 pfleura2
     WRITE(*,*) 'Coordinates'
105 10 pfleura2
     DO iat=1,na
106 10 pfleura2
        i=atome(iat)
107 10 pfleura2
        WRITE(*,*) Nom(I),x(iat),y(iat),z(iat)
108 10 pfleura2
     END DO
109 1 pfleura2
  END IF
110 1 pfleura2
111 10 pfleura2
  IF (FPBC) THEN
112 1 pfleura2
     DO i=1,na
113 1 pfleura2
        NbLi=LIAISONS(i,0)
114 1 pfleura2
        DO j=i+1,na
115 10 pfleura2
           Bound=.FALSE.
116 10 pfleura2
           DO ka=kaBeg,kaEnd
117 10 pfleura2
              DO Kb=kbBeg,kbEnd
118 10 pfleura2
                 DO Kc=kcBeg,kcEnd
119 10 pfleura2
                    CALL VectorPer(j,i,ka,kb,kc,x,y,z,vx,vy,vz,dist)
120 10 pfleura2
                    dist=dist/fact
121 10 pfleura2
                    distth=(r_cov(atome(i))+r_cov(atome(j)))/100.
122 10 pfleura2
!                    if (debug) WRITE(*,*) atome(i),atome(j),dist,distth
123 10 pfleura2
                    if (dist.le.distth) Bound=.TRUE.
124 10 pfleura2
                 END DO
125 10 pfleura2
              END DO
126 10 pfleura2
           END DO
127 10 pfleura2
           IF (Bound) THEN
128 10 pfleura2
              if (debug) WRITE(*,*) "Adding a bond between:",i,j
129 1 pfleura2
              NbLi=NbLi+1
130 1 pfleura2
              LIAISONS(i,NbLi)=j;
131 1 pfleura2
              NBlj=LIAISONS(j,0)+1
132 1 pfleura2
              LIAISONS(j,Nblj)=i;
133 1 pfleura2
              LIAISONS(j,0)=Nblj
134 1 pfleura2
           END IF
135 1 pfleura2
        END DO
136 1 pfleura2
        LIAISONS(i,0)=Nbli
137 1 pfleura2
     END DO
138 1 pfleura2
  ELSE
139 1 pfleura2
     DO i=1,na
140 1 pfleura2
        NbLi=LIAISONS(i,0)
141 1 pfleura2
        DO j=i+1,na
142 10 pfleura2
           CALL vecteur(j,i,x,y,z,vx,vy,vz,dist)
143 10 pfleura2
           dist=dist/fact
144 10 pfleura2
           distth=(r_cov(atome(i))+r_cov(atome(j)))/100.
145 10 pfleura2
!           if (debug) WRITE(*,*) atome(i),atome(j),dist,distth
146 10 pfleura2
           if (dist.le.distth) THEN
147 1 pfleura2
              NbLi=NbLi+1
148 1 pfleura2
              LIAISONS(i,NbLi)=j;
149 1 pfleura2
              NBlj=LIAISONS(j,0)+1
150 1 pfleura2
              LIAISONS(j,Nblj)=i;
151 1 pfleura2
              LIAISONS(j,0)=Nblj
152 1 pfleura2
           END IF
153 1 pfleura2
        END DO
154 1 pfleura2
        LIAISONS(i,0)=Nbli
155 1 pfleura2
     END DO
156 1 pfleura2
  END IF
157 8 pfleura2
  if (debug) Call Header (" CalcCnct over ")
158 1 pfleura2
END SUBROUTINE CalcCnct