root / src / Calc_mixed_frag.f90 @ 12
Historique | Voir | Annoter | Télécharger (36,11 ko)
1 | 1 | pfleura2 | SUBROUTINE Calc_mixed_frag(na,atome,ind_zmat,val_zmat,x,y,z, & |
---|---|---|---|
2 | 1 | pfleura2 | r_cov,fact,frozen,cart,ncart) |
3 | 1 | pfleura2 | |
4 | 1 | pfleura2 | ! |
5 | 1 | pfleura2 | ! This second version enables the user to freeze some atoms |
6 | 1 | pfleura2 | ! the frozen atoms indices are listed in the frozen array. |
7 | 1 | pfleura2 | ! |
8 | 1 | pfleura2 | ! The idea is surely too stupid to work all the time... but here it is |
9 | 1 | pfleura2 | ! we first construct the zmat using only the frozen atoms, and then |
10 | 1 | pfleura2 | ! we add the other atoms on top of the first ones... |
11 | 1 | pfleura2 | ! |
12 | 12 | pfleura2 | |
13 | 12 | pfleura2 | !---------------------------------------------------------------------- |
14 | 12 | pfleura2 | ! Copyright 2003-2014 Ecole Normale Supérieure de Lyon, |
15 | 12 | pfleura2 | ! Centre National de la Recherche Scientifique, |
16 | 12 | pfleura2 | ! Université Claude Bernard Lyon 1. All rights reserved. |
17 | 12 | pfleura2 | ! |
18 | 12 | pfleura2 | ! This work is registered with the Agency for the Protection of Programs |
19 | 12 | pfleura2 | ! as IDDN.FR.001.100009.000.S.P.2014.000.30625 |
20 | 12 | pfleura2 | ! |
21 | 12 | pfleura2 | ! Authors: P. Fleurat-Lessard, P. Dayal |
22 | 12 | pfleura2 | ! Contact: optnpath@gmail.com |
23 | 12 | pfleura2 | ! |
24 | 12 | pfleura2 | ! This file is part of "Opt'n Path". |
25 | 12 | pfleura2 | ! |
26 | 12 | pfleura2 | ! "Opt'n Path" is free software: you can redistribute it and/or modify |
27 | 12 | pfleura2 | ! it under the terms of the GNU Affero General Public License as |
28 | 12 | pfleura2 | ! published by the Free Software Foundation, either version 3 of the License, |
29 | 12 | pfleura2 | ! or (at your option) any later version. |
30 | 12 | pfleura2 | ! |
31 | 12 | pfleura2 | ! "Opt'n Path" is distributed in the hope that it will be useful, |
32 | 12 | pfleura2 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
33 | 12 | pfleura2 | ! |
34 | 12 | pfleura2 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
35 | 12 | pfleura2 | ! GNU Affero General Public License for more details. |
36 | 12 | pfleura2 | ! |
37 | 12 | pfleura2 | ! You should have received a copy of the GNU Affero General Public License |
38 | 12 | pfleura2 | ! along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>. |
39 | 12 | pfleura2 | ! |
40 | 12 | pfleura2 | ! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr, |
41 | 12 | pfleura2 | ! for commercial licensing opportunities. |
42 | 12 | pfleura2 | !---------------------------------------------------------------------- |
43 | 12 | pfleura2 | |
44 | 8 | pfleura2 | Use Path_module, only : max_Z, NMaxL, Nom |
45 | 1 | pfleura2 | Use Io_module |
46 | 1 | pfleura2 | |
47 | 1 | pfleura2 | IMPLICIT NONE |
48 | 1 | pfleura2 | |
49 | 5 | pfleura2 | ! Parameters of the subroutine |
50 | 5 | pfleura2 | ! na: number of atoms in the system |
51 | 5 | pfleura2 | integer(KINT) :: na |
52 | 5 | pfleura2 | ! atome: Mass number of the atoms of the system |
53 | 5 | pfleura2 | integer(KINT) :: atome(na) |
54 | 5 | pfleura2 | ! ind_zmat: for "zmat" atoms contains the indices of reference atoms |
55 | 5 | pfleura2 | integer(KINT) :: ind_zmat(Na,5) |
56 | 1 | pfleura2 | INTEGER(KINT) :: idx_zmat(NA) |
57 | 1 | pfleura2 | real(KREAL) :: x(Na),y(Na),z(Na),fact |
58 | 1 | pfleura2 | real(KREAL) :: val_zmat(Na,3) |
59 | 1 | pfleura2 | real(KREAL) :: r_cov(0:Max_Z) |
60 | 1 | pfleura2 | |
61 | 5 | pfleura2 | CHARACTER(5) :: AtName |
62 | 5 | pfleura2 | |
63 | 1 | pfleura2 | ! Frozen contains the indices of frozen atoms |
64 | 1 | pfleura2 | INTEGER(KINT) Frozen(*),Cart(*),NFroz,NCart |
65 | 1 | pfleura2 | LOGICAL, ALLOCATABLE :: FCart(:) ! Na |
66 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: AtCart(:) !Na |
67 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: FrozDist(:) ! na |
68 | 1 | pfleura2 | INTEGER(KINT) NbFrag,IdxFrag |
69 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: Fragment(:),NbAtFrag(:) !na |
70 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: FragAt(:,:) !na,na |
71 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: FrozFrag(:,:) !na,3 |
72 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: FrozBlock(:,:) !(na,0:na) |
73 | 1 | pfleura2 | REAL(KREAL), ALLOCATABLE :: DistFroz(:) !na |
74 | 1 | pfleura2 | |
75 | 1 | pfleura2 | INTEGER(KINT) :: IdxCaFaire, IAfaire |
76 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: LIAISONS(:,:) ! (Na,0:NMaxL) |
77 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: LiaisonsBis(:,:) ! (Na,0:NMaxL) |
78 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: LiaisonsIni(:,:) ! (Na,0:NMaxL) |
79 | 1 | pfleura2 | INTEGER(KINT), ALLOCATABLE :: CAFaire(:) ! (Na) |
80 | 1 | pfleura2 | |
81 | 1 | pfleura2 | |
82 | 1 | pfleura2 | real(KREAL) :: vx1,vy1,vz1,norm1 |
83 | 1 | pfleura2 | real(KREAL) :: vx2,vy2,vz2,norm2 |
84 | 1 | pfleura2 | real(KREAL) :: vx3,vy3,vz3,norm3 |
85 | 1 | pfleura2 | real(KREAL) :: vx4,vy4,vz4,norm4 |
86 | 1 | pfleura2 | real(KREAL) :: vx5,vy5,vz5,norm5 |
87 | 2 | pfleura2 | real(KREAL) :: val, val_d, d |
88 | 5 | pfleura2 | Logical Debug,DebugGaussian |
89 | 1 | pfleura2 | LOGICAL, ALLOCATABLE :: DejaFait(:),FCaf(:) !(na) |
90 | 1 | pfleura2 | Logical, ALLOCATABLE :: FrozAt(:) !T if this atom is frozen |
91 | 1 | pfleura2 | |
92 | 1 | pfleura2 | |
93 | 2 | pfleura2 | |
94 | 2 | pfleura2 | INTEGER(KINT) :: I, J, n1, n2, n3, n4, IAt, IL, JL, IFrag, ITmp |
95 | 2 | pfleura2 | INTEGER(KINT) :: I3, I1, Ip, IFragFroz, IBeg |
96 | 1 | pfleura2 | INTEGER(KINT) :: I0, Izm, JAt,Izm0,Idx |
97 | 1 | pfleura2 | |
98 | 2 | pfleura2 | REAL(KREAL) :: Pi, Sang |
99 | 1 | pfleura2 | |
100 | 1 | pfleura2 | INTERFACE |
101 | 1 | pfleura2 | function valid(string) result (isValid) |
102 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
103 | 1 | pfleura2 | logical :: isValid |
104 | 1 | pfleura2 | END function VALID |
105 | 1 | pfleura2 | |
106 | 1 | pfleura2 | FUNCTION angle(v1x,v1y,v1z,norm1,v2x,v2y,v2z,norm2) |
107 | 1 | pfleura2 | use Path_module, only : Pi,KINT, KREAL |
108 | 1 | pfleura2 | real(KREAL) :: v1x,v1y,v1z,norm1 |
109 | 1 | pfleura2 | real(KREAL) :: v2x,v2y,v2z,norm2 |
110 | 1 | pfleura2 | real(KREAL) :: angle |
111 | 1 | pfleura2 | END FUNCTION ANGLE |
112 | 1 | pfleura2 | |
113 | 1 | pfleura2 | FUNCTION SinAngle(v1x,v1y,v1z,norm1,v2x,v2y,v2z,norm2) |
114 | 1 | pfleura2 | use Path_module, only : Pi,KINT, KREAL |
115 | 1 | pfleura2 | real(KREAL) :: v1x,v1y,v1z,norm1 |
116 | 1 | pfleura2 | real(KREAL) :: v2x,v2y,v2z,norm2 |
117 | 1 | pfleura2 | real(KREAL) :: SinAngle |
118 | 1 | pfleura2 | END FUNCTION SINANGLE |
119 | 1 | pfleura2 | |
120 | 1 | pfleura2 | |
121 | 1 | pfleura2 | FUNCTION angle_d(v1x,v1y,v1z,norm1,v2x,v2y,v2z,norm2,v3x,v3y,v3z,norm3) |
122 | 1 | pfleura2 | use Path_module, only : Pi,KINT, KREAL |
123 | 1 | pfleura2 | real(KREAL) :: v1x,v1y,v1z,norm1 |
124 | 1 | pfleura2 | real(KREAL) :: v2x,v2y,v2z,norm2 |
125 | 1 | pfleura2 | real(KREAL) :: v3x,v3y,v3z,norm3 |
126 | 1 | pfleura2 | real(KREAL) :: angle_d,ca,sa |
127 | 1 | pfleura2 | END FUNCTION ANGLE_D |
128 | 1 | pfleura2 | |
129 | 1 | pfleura2 | END INTERFACE |
130 | 1 | pfleura2 | |
131 | 1 | pfleura2 | Pi=dacos(-1.d0) |
132 | 1 | pfleura2 | debug=valid("calc_mixed_frag") |
133 | 5 | pfleura2 | debugGaussian=valid("zmat_gaussian") |
134 | 5 | pfleura2 | |
135 | 1 | pfleura2 | if (debug) Call Header("Entering Calc_mixed_frag") |
136 | 1 | pfleura2 | if (na.le.2) THEN |
137 | 1 | pfleura2 | WRITE(*,*) "I do not work for less than 2 atoms :-p" |
138 | 1 | pfleura2 | RETURN |
139 | 1 | pfleura2 | END IF |
140 | 1 | pfleura2 | |
141 | 1 | pfleura2 | ALLOCATE(FrozDist(Na),Fragment(na), NbAtFrag(na),FragAt(na,na)) |
142 | 1 | pfleura2 | ALLOCATE(FCart(Na),AtCart(Na)) |
143 | 1 | pfleura2 | ALLOCATE(FrozFrag(na,3), FrozBlock(na,0:na)) |
144 | 1 | pfleura2 | ALLOCATE(DistFroz(na),Liaisons(na,0:NMaxL)) |
145 | 1 | pfleura2 | ALLOCATE(LiaisonsBis(na,0:NMaxL),LiaisonsIni(na,0:NMaxL)) |
146 | 1 | pfleura2 | ALLOCATE(CaFaire(na+1),DejaFait(Na),FCaf(na),FrozAt(na)) |
147 | 1 | pfleura2 | |
148 | 1 | pfleura2 | Ind_Zmat=0 |
149 | 1 | pfleura2 | |
150 | 1 | pfleura2 | ! Putting cart+frozen atoms into cart array |
151 | 1 | pfleura2 | FCart=.FALSE. |
152 | 1 | pfleura2 | NCart=0 |
153 | 1 | pfleura2 | Idx=1 |
154 | 1 | pfleura2 | DO WHILE (Frozen(Idx).NE.0) |
155 | 1 | pfleura2 | If (Frozen(Idx).LT.0) THEN |
156 | 1 | pfleura2 | DO I=Frozen(Idx-1),abs(Frozen(Idx)) |
157 | 1 | pfleura2 | IF (.NOT.FCart(I)) THEN |
158 | 1 | pfleura2 | NCart=NCart+1 |
159 | 1 | pfleura2 | AtCart(NCart)=I |
160 | 1 | pfleura2 | FCart(I)=.TRUE. |
161 | 1 | pfleura2 | END IF |
162 | 1 | pfleura2 | END DO |
163 | 1 | pfleura2 | ELSEIF (.NOT.FCart(Frozen(Idx))) THEN |
164 | 1 | pfleura2 | FCart(Frozen(Idx))=.TRUE. |
165 | 1 | pfleura2 | NCart=NCart+1 |
166 | 1 | pfleura2 | AtCart(NCart)=Frozen(Idx) |
167 | 1 | pfleura2 | END IF |
168 | 1 | pfleura2 | Idx=Idx+1 |
169 | 1 | pfleura2 | END DO |
170 | 1 | pfleura2 | NFroz=NCart |
171 | 1 | pfleura2 | Idx=1 |
172 | 1 | pfleura2 | DO WHILE (Cart(Idx).NE.0) |
173 | 1 | pfleura2 | If (Cart(Idx).LT.0) THEN |
174 | 1 | pfleura2 | DO I=Cart(Idx-1),abs(Cart(Idx)) |
175 | 1 | pfleura2 | IF (.NOT.FCart(I)) THEN |
176 | 1 | pfleura2 | NCart=NCart+1 |
177 | 1 | pfleura2 | AtCart(NCart)=I |
178 | 1 | pfleura2 | FCart(I)=.TRUE. |
179 | 1 | pfleura2 | END IF |
180 | 1 | pfleura2 | END DO |
181 | 1 | pfleura2 | ELSEIF (.NOT.FCart(Cart(Idx))) THEN |
182 | 1 | pfleura2 | FCart(Cart(Idx))=.TRUE. |
183 | 1 | pfleura2 | NCart=NCart+1 |
184 | 1 | pfleura2 | AtCart(NCart)=Cart(Idx) |
185 | 1 | pfleura2 | END IF |
186 | 1 | pfleura2 | Idx=Idx+1 |
187 | 1 | pfleura2 | END DO |
188 | 1 | pfleura2 | |
189 | 1 | pfleura2 | if (debug) THEN |
190 | 1 | pfleura2 | WRITE(*,'(1X,A,I4,A,I4,A)') "Found ",NFroz," frozen atoms, and a total of ",NCart," atoms described in cartesian coordinates" |
191 | 1 | pfleura2 | WRITE(*,*) "AtCart:",AtCart(1:NCart) |
192 | 1 | pfleura2 | END IF |
193 | 1 | pfleura2 | |
194 | 1 | pfleura2 | DejaFait=.FALSE. |
195 | 1 | pfleura2 | |
196 | 1 | pfleura2 | ! We cheat a lot: we will use ind_zmat et val_zmat to store |
197 | 1 | pfleura2 | ! the cartesian coordinates of the NCart atoms :-p |
198 | 1 | pfleura2 | DO I=1,NCart |
199 | 1 | pfleura2 | Iat=AtCart(I) |
200 | 1 | pfleura2 | ind_zmat(I,1)=Iat |
201 | 1 | pfleura2 | ind_zmat(I,2:5)=-1 |
202 | 1 | pfleura2 | val_zmat(I,1)=X(Iat) |
203 | 1 | pfleura2 | val_zmat(I,2)=Y(Iat) |
204 | 1 | pfleura2 | val_zmat(I,3)=Z(Iat) |
205 | 1 | pfleura2 | DejaFait(Iat)=.TRUE. |
206 | 1 | pfleura2 | idx_zmat(Iat)=I |
207 | 1 | pfleura2 | END DO |
208 | 1 | pfleura2 | |
209 | 1 | pfleura2 | |
210 | 1 | pfleura2 | izm=NCart |
211 | 1 | pfleura2 | |
212 | 1 | pfleura2 | ! We now calculate the connections |
213 | 1 | pfleura2 | Liaisons=0 |
214 | 1 | pfleura2 | LiaisonsBis=0 |
215 | 1 | pfleura2 | |
216 | 1 | pfleura2 | if (debug) THEN |
217 | 1 | pfleura2 | WRITE(*,*) "Liaisons initialized" |
218 | 1 | pfleura2 | ! WRITE(*,*) 'Covalent radii used' |
219 | 1 | pfleura2 | ! DO iat=1,na |
220 | 1 | pfleura2 | ! i=atome(iat) |
221 | 1 | pfleura2 | ! WRITE(*,*) Nom(I),Iat,r_cov(i),r_cov(i)*fact |
222 | 1 | pfleura2 | ! END DO |
223 | 1 | pfleura2 | END IF |
224 | 1 | pfleura2 | |
225 | 1 | pfleura2 | 1003 FORMAT(1X,I4,' - ',25(I5)) |
226 | 1 | pfleura2 | |
227 | 1 | pfleura2 | Call CalcCnct(na,atome,x,y,z,LIAISONS,r_cov,fact) |
228 | 1 | pfleura2 | |
229 | 1 | pfleura2 | if (debug) THEN |
230 | 1 | pfleura2 | WRITE(*,*) "Connections calculated" |
231 | 1 | pfleura2 | DO IL=1,na |
232 | 1 | pfleura2 | WRITE(IOOUT,1003) Il,(LIAISONS(IL,JL),JL=0,NMaxL) |
233 | 1 | pfleura2 | END DO |
234 | 1 | pfleura2 | END IF |
235 | 1 | pfleura2 | |
236 | 1 | pfleura2 | ! We get rid of bonds between cart atoms |
237 | 1 | pfleura2 | ! the trick is to do this on liaisons while keeping LiaisonsBis ok. |
238 | 1 | pfleura2 | |
239 | 1 | pfleura2 | LiaisonsIni=Liaisons |
240 | 1 | pfleura2 | LiaisonsBis=Liaisons |
241 | 1 | pfleura2 | |
242 | 1 | pfleura2 | DO I=1,NCart |
243 | 1 | pfleura2 | Iat=AtCart(I) |
244 | 1 | pfleura2 | if (debug) WRITE(*,'(20(1X,I3))') I,Iat, & |
245 | 1 | pfleura2 | (LiaisonsIni(Iat,Itmp),ITmp=0,LiaisonsIni(Iat,0)) |
246 | 1 | pfleura2 | DO J=1,LiaisonsIni(Iat,0) |
247 | 1 | pfleura2 | Jat=LiaisonsIni(Iat,J) |
248 | 1 | pfleura2 | IF (FCart(Jat)) THEN |
249 | 1 | pfleura2 | Call Annul(Liaisons,Iat,Jat) |
250 | 1 | pfleura2 | Call Annul(Liaisons,Jat,Iat) |
251 | 1 | pfleura2 | Call Annul(LiaisonsIni,Jat,Iat) |
252 | 1 | pfleura2 | Liaisons(Iat,0)=Liaisons(Iat,0)-1 |
253 | 1 | pfleura2 | Liaisons(Jat,0)=Liaisons(Jat,0)-1 |
254 | 1 | pfleura2 | LiaisonsIni(Jat,0)=LiaisonsIni(Jat,0)-1 |
255 | 1 | pfleura2 | END IF |
256 | 1 | pfleura2 | END DO |
257 | 1 | pfleura2 | END DO |
258 | 1 | pfleura2 | |
259 | 1 | pfleura2 | if (debug) THEN |
260 | 1 | pfleura2 | WRITE(*,*) "Connections omitting bonds between cart atoms" |
261 | 1 | pfleura2 | DO IL=1,na |
262 | 1 | pfleura2 | WRITE(IOOUT,1003) Il,(LIAISONS(IL,JL),JL=0,NMaxL) |
263 | 1 | pfleura2 | END DO |
264 | 1 | pfleura2 | END IF |
265 | 1 | pfleura2 | |
266 | 1 | pfleura2 | ! We decompose the system into fragments, but we omit on purpuse |
267 | 1 | pfleura2 | ! fragments consisting only of frozen atoms |
268 | 1 | pfleura2 | ! Now, frozblock will contain the frozen atom indices in a given fragment |
269 | 1 | pfleura2 | Fragment=0 |
270 | 1 | pfleura2 | NbAtFrag=0 |
271 | 1 | pfleura2 | FrozBlock=0 |
272 | 1 | pfleura2 | |
273 | 1 | pfleura2 | IdxFrag=0 |
274 | 1 | pfleura2 | NbFrag=0 |
275 | 1 | pfleura2 | |
276 | 1 | pfleura2 | Call Decomp_frag(na,liaisons,.NOT.Fcart,nbfrag,Fragment,NbAtFrag,FragAt) |
277 | 1 | pfleura2 | |
278 | 1 | pfleura2 | ! We compute FrozBlock now |
279 | 1 | pfleura2 | DO IFrag=1,NbFrag |
280 | 1 | pfleura2 | DO I=1,NbAtFrag(IFrag) |
281 | 1 | pfleura2 | Iat=FragAt(IFrag,I) |
282 | 1 | pfleura2 | IF (FCart(Iat)) THEN |
283 | 1 | pfleura2 | FrozBlock(IFrag,0)=FrozBlock(IFrag,0)+1 |
284 | 1 | pfleura2 | FrozBlock(IFrag,FrozBlock(IFrag,0))=IAt |
285 | 1 | pfleura2 | END IF |
286 | 1 | pfleura2 | END DO |
287 | 1 | pfleura2 | END DO |
288 | 1 | pfleura2 | |
289 | 1 | pfleura2 | if (debug) THEN |
290 | 1 | pfleura2 | WRITE(*,*) 'I found ',NbFrag, 'fragments with respectively ' |
291 | 1 | pfleura2 | WRITE(*,*) (NbAtFrag(I),I=1,NbFrag), 'atoms' |
292 | 1 | pfleura2 | WRITE(*,*) "Fragments atoms are now listed as F in the following" |
293 | 1 | pfleura2 | DO I=1,NbFrag |
294 | 1 | pfleura2 | WRITE(*,*) Na |
295 | 1 | pfleura2 | WRITE(*,*) 'Fragment ', i |
296 | 1 | pfleura2 | DO J=1,Na |
297 | 1 | pfleura2 | AtName=Nom(Atome(J)) |
298 | 1 | pfleura2 | IF (Fragment(J).EQ.I) AtName='F' |
299 | 1 | pfleura2 | WRITE(*,'(1X,A5,3(1X,F10.6))') AtName,X(J),Y(J),Z(J) |
300 | 1 | pfleura2 | END DO |
301 | 1 | pfleura2 | ! WRITE(*,*) "FragAt:",(FragAt(I,j),j=1,NbAtFrag(I)) |
302 | 1 | pfleura2 | END DO |
303 | 1 | pfleura2 | |
304 | 1 | pfleura2 | DO I=1,NbFrag |
305 | 1 | pfleura2 | WRITE(*,*) 'Fragment ', i |
306 | 1 | pfleura2 | WRITE(*,'(A,20(1X,I3))') "FragAt:",(FragAt(I,j),j=1,NbAtFrag(I)) |
307 | 1 | pfleura2 | WRITE(*,'(A,20(1X,I3))') "FrozBlock:",(FrozBlock(I,j),j=0,FrozBlock(I,0)) |
308 | 1 | pfleura2 | END DO |
309 | 1 | pfleura2 | END IF |
310 | 1 | pfleura2 | |
311 | 1 | pfleura2 | NFroz=0 |
312 | 1 | pfleura2 | DO IFrag=1,NbFrag |
313 | 1 | pfleura2 | If (FrozBlock(IFrag,0).NE.0) NFroz=NFroz+1 |
314 | 1 | pfleura2 | END DO |
315 | 1 | pfleura2 | |
316 | 1 | pfleura2 | IF (DEBUG) WRITE(*,'(1X,A,I4,A,I4,A)') "Found ",NFroz," fragment(s) with cart atoms, out of",NbFrag," fragment(s)" |
317 | 1 | pfleura2 | |
318 | 1 | pfleura2 | |
319 | 1 | pfleura2 | if (debug) THEN |
320 | 1 | pfleura2 | WRITE(*,*) "Connections before adding fragments" |
321 | 1 | pfleura2 | DO IL=1,na |
322 | 1 | pfleura2 | IF (Liaisons(IL,0).NE.0) WRITE(IOOUT,1003) Il,(LIAISONS(IL,JL),JL=0,NMaxL) |
323 | 1 | pfleura2 | END DO |
324 | 1 | pfleura2 | END IF |
325 | 1 | pfleura2 | |
326 | 1 | pfleura2 | ! We will now add the fragments containing non cart atoms. |
327 | 1 | pfleura2 | ! I am not sure that there is a best strategy to add them... |
328 | 1 | pfleura2 | ! so we add them in the order they were created :-( |
329 | 1 | pfleura2 | ! First only block with frozen atoms are added |
330 | 1 | pfleura2 | izm0=-1 |
331 | 1 | pfleura2 | IFrag=1 |
332 | 1 | pfleura2 | IZm=NCart |
333 | 1 | pfleura2 | FCaf=.FALSE. |
334 | 1 | pfleura2 | DO IFragFroz=1,NFroz |
335 | 1 | pfleura2 | DO WHILE (FrozBlock(IFrag,0).EQ.0) |
336 | 1 | pfleura2 | IFrag=IFrag+1 |
337 | 1 | pfleura2 | END DO |
338 | 1 | pfleura2 | ! each atom has at least one frozen atom that will serve as the seed |
339 | 1 | pfleura2 | ! of this fragment. |
340 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Adding fragment :', ifrag,'with',FrozBlock(IFrag,0),' frozen atoms' |
341 | 1 | pfleura2 | IF (FrozBlock(IFrag,0).EQ.1) THEN |
342 | 1 | pfleura2 | ! There is only one frozen atom, easy case ... |
343 | 1 | pfleura2 | Iat=FrozBlock(IFrag,1) |
344 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Only frozen atom of frag',iat |
345 | 1 | pfleura2 | DejaFait(iat)=.TRUE. |
346 | 1 | pfleura2 | IdxCaFaire=2 |
347 | 1 | pfleura2 | CaFaire(1)=iat |
348 | 1 | pfleura2 | CaFaire(2)=0 |
349 | 1 | pfleura2 | IaFaire=1 |
350 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
351 | 1 | pfleura2 | DO WHILE (CaFaire(IaFaire).NE.0) |
352 | 1 | pfleura2 | n1=CaFaire(IaFaire) |
353 | 1 | pfleura2 | I1=idx_zmat(n1) |
354 | 1 | pfleura2 | n2=ind_zmat(I1,2) |
355 | 1 | pfleura2 | n3=ind_zmat(I1,3) |
356 | 1 | pfleura2 | |
357 | 1 | pfleura2 | if (debug) WRITE(*,1003) n1,(LIAISONS(n1,JL),JL=0,NMaxL) |
358 | 1 | pfleura2 | DO I3=1,Liaisons(n1,0) |
359 | 1 | pfleura2 | IAt=Liaisons(n1,I3) |
360 | 1 | pfleura2 | ! PFL 2007.Apr.16 -> |
361 | 1 | pfleura2 | ! We add ALL atoms linked to n1 to CaFaire |
362 | 1 | pfleura2 | ! But we delete their link to n1 |
363 | 1 | pfleura2 | !! PFL 2007.Aug.28 -> |
364 | 1 | pfleura2 | ! re-add the test on FCaf in order not to put the same atom more than once in |
365 | 1 | pfleura2 | ! CaFaire array. |
366 | 1 | pfleura2 | IF (.NOT.FCaf(Iat)) THEN |
367 | 1 | pfleura2 | CaFaire(IdxCaFaire)=Iat |
368 | 1 | pfleura2 | IdxCaFaire=IdxCaFaire+1 |
369 | 1 | pfleura2 | CaFaire(IdxCaFaire)=0 |
370 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
371 | 1 | pfleura2 | END IF |
372 | 1 | pfleura2 | !! <-- PFL 2007.Aug.28 |
373 | 1 | pfleura2 | if (debug) WRITE(*,1003) Iat,(LIAISONS(Iat,JL),JL=0,NMaxL) |
374 | 1 | pfleura2 | Call Annul(Liaisons,Iat,n1) |
375 | 1 | pfleura2 | if (debug) WRITE(*,1003) Iat,(LIAISONS(Iat,JL),JL=0,NMaxL) |
376 | 1 | pfleura2 | Liaisons(iat,0)=Liaisons(Iat,0)-1 |
377 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Iafaire,n1,DejaFait,idxzmat,n2,n3',IaFaire,n1, & |
378 | 1 | pfleura2 | DejaFait(n1),idx_zmat(n1),n2,3 |
379 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Cafaire - 0', & |
380 | 1 | pfleura2 | (CaFaire(J),J=Iafaire,IdxCAfaire) |
381 | 1 | pfleura2 | |
382 | 1 | pfleura2 | |
383 | 1 | pfleura2 | ! <- PFL 2007.Apr.16 |
384 | 1 | pfleura2 | IF (.NOT.DejaFait(Iat)) THEN |
385 | 1 | pfleura2 | ! we add it to the Zmat |
386 | 1 | pfleura2 | ! WRITE(*,*) "coucou" |
387 | 1 | pfleura2 | call vecteur(n1,iat,x,y,z,vx1,vy1,vz1,norm1) |
388 | 1 | pfleura2 | ! WRITE(*,*) "coucou 2" |
389 | 1 | pfleura2 | izm=izm+1 |
390 | 1 | pfleura2 | IF (izm.EQ.2) THEN |
391 | 1 | pfleura2 | ! WRITE(*,*) "coucou 3" |
392 | 1 | pfleura2 | ind_zmat(izm,1)=IAt |
393 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
394 | 1 | pfleura2 | ind_zmat(izm,3:5)=0 |
395 | 1 | pfleura2 | if (n2.EQ.-1) n2=Iat |
396 | 1 | pfleura2 | END IF |
397 | 1 | pfleura2 | |
398 | 1 | pfleura2 | ! WRITE(*,*) "coucou 4" |
399 | 1 | pfleura2 | if ((izm.GE.3).AND.(n2.EQ.-1)) THEN |
400 | 1 | pfleura2 | ! WRITE(*,*) "coucou 5" |
401 | 1 | pfleura2 | ! WRITE(*,*) "coucou 3 bis" |
402 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
403 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
404 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
405 | 1 | pfleura2 | ! already stored in ind_zmat |
406 | 1 | pfleura2 | d=1e9 |
407 | 1 | pfleura2 | JAt=-1 |
408 | 1 | pfleura2 | DO I=1,NCart |
409 | 1 | pfleura2 | If (ind_zmat(I,1).NE.n1) THEN |
410 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx2,vy2,vz2,norm2) |
411 | 1 | pfleura2 | SAng=Sinangle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
412 | 1 | pfleura2 | ! we take only atoms that are not aligned |
413 | 1 | pfleura2 | if ((norm2<=d).AND.(SAng.GT.0.09d0)) THEN |
414 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
415 | 1 | pfleura2 | d=norm2 |
416 | 1 | pfleura2 | END IF |
417 | 1 | pfleura2 | END IF |
418 | 1 | pfleura2 | END DO |
419 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
420 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
421 | 1 | pfleura2 | STOP |
422 | 1 | pfleura2 | END IF |
423 | 1 | pfleura2 | n2=JAt |
424 | 1 | pfleura2 | END IF! izm>=3 and n2.eq.-1 |
425 | 1 | pfleura2 | |
426 | 1 | pfleura2 | IF (izm.eq.3) THEN |
427 | 1 | pfleura2 | ind_zmat(izm,1)=Iat |
428 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
429 | 1 | pfleura2 | ind_zmat(izm,3)=n2 |
430 | 1 | pfleura2 | END IF ! izm=3 |
431 | 1 | pfleura2 | |
432 | 1 | pfleura2 | IF (izm.GE.4) THEN |
433 | 1 | pfleura2 | ! WRITE(*,*) "coucou 5 bis" |
434 | 1 | pfleura2 | IF (n3.EQ.-1) THEN |
435 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
436 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
437 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
438 | 1 | pfleura2 | ! already stored in ind_zmat |
439 | 1 | pfleura2 | call vecteur(n1,n2,x,y,z,vx2,vy2,vz2,norm2) |
440 | 1 | pfleura2 | d=1e9 |
441 | 1 | pfleura2 | JAt=-1 |
442 | 1 | pfleura2 | DO I=1,NCart |
443 | 1 | pfleura2 | If ((ind_zmat(I,1).NE.n1).AND.(ind_zmat(I,1).NE.n2)) THEN |
444 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx3,vy3,vz3,norm3) |
445 | 1 | pfleura2 | SAng=Sinangle(vx3,vy3,vz3,norm3,vx2,vy2,vz2,norm2) |
446 | 1 | pfleura2 | if (debug) WRITE(*,*) "1-Trying izm,iat,n1,n2,n3,sang,d,norm3", & |
447 | 1 | pfleura2 | izm,iat,n1,n2,ind_zmat(I,1),sang,d,norm3 |
448 | 1 | pfleura2 | ! we take only atoms that are not aligned |
449 | 1 | pfleura2 | if ((norm3<=d).AND.(SAng.GT.0.09d0)) THEN |
450 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
451 | 1 | pfleura2 | d=norm3 |
452 | 1 | pfleura2 | END IF |
453 | 1 | pfleura2 | END IF |
454 | 1 | pfleura2 | END DO |
455 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
456 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
457 | 1 | pfleura2 | STOP |
458 | 1 | pfleura2 | END IF |
459 | 1 | pfleura2 | n3=JAt |
460 | 1 | pfleura2 | END IF |
461 | 1 | pfleura2 | ! ind_zmat(I1,3)=n3 |
462 | 1 | pfleura2 | Call add2indzmat(na,izm,Iat,n1,n2,n3,ind_zmat,x,y,z) |
463 | 1 | pfleura2 | END IF ! izm>=4 |
464 | 1 | pfleura2 | ! WRITE(*,*) "coucou 6" |
465 | 1 | pfleura2 | if (debug) THEN |
466 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat 0',izm |
467 | 1 | pfleura2 | DO Ip=1,NCart |
468 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(ip,1:4) |
469 | 1 | pfleura2 | END DO |
470 | 1 | pfleura2 | SELECT CASE (NCart) |
471 | 1 | pfleura2 | CASE (1) |
472 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(2,1), ind_zmat(2,2) |
473 | 1 | pfleura2 | if (izm.GE.3) & |
474 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(3,1), ind_zmat(3,2), ind_zmat(3,3) |
475 | 1 | pfleura2 | Ibeg=4 |
476 | 1 | pfleura2 | CASE (2) |
477 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(3,1), ind_zmat(3,2), ind_zmat(3,3) |
478 | 1 | pfleura2 | Ibeg=4 |
479 | 1 | pfleura2 | CASE DEFAULT |
480 | 1 | pfleura2 | IBeg=NCart+1 |
481 | 1 | pfleura2 | END SELECT |
482 | 1 | pfleura2 | DO Ip=IBeg,izm |
483 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(Ip,1), & |
484 | 1 | pfleura2 | ind_zmat(Ip,2),ind_zmat(Ip,3), ind_zmat(Ip,4) |
485 | 1 | pfleura2 | END DO |
486 | 1 | pfleura2 | END IF |
487 | 1 | pfleura2 | |
488 | 1 | pfleura2 | idx_zmat(iat)=izm |
489 | 1 | pfleura2 | ! Call Annul(Liaisons,iat,n1) |
490 | 1 | pfleura2 | ! Liaisons(iat,0)=Liaisons(Iat,0)-1 |
491 | 1 | pfleura2 | ! Call Annul(Liaisons,n1,iat) |
492 | 1 | pfleura2 | n3=iat |
493 | 1 | pfleura2 | DejaFait(Iat)=.TRUE. |
494 | 1 | pfleura2 | END IF |
495 | 1 | pfleura2 | END DO |
496 | 1 | pfleura2 | IaFaire=IaFaire+1 |
497 | 1 | pfleura2 | |
498 | 1 | pfleura2 | if (debug) THEN |
499 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat 5' |
500 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(1,1) |
501 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(2,1), ind_zmat(2,2) |
502 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(3,1), ind_zmat(3,2), ind_zmat(3,3) |
503 | 1 | pfleura2 | DO Ip=4,izm |
504 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(Ip,1), & |
505 | 1 | pfleura2 | ind_zmat(Ip,2),ind_zmat(Ip,3), ind_zmat(Ip,4) |
506 | 1 | pfleura2 | END DO |
507 | 1 | pfleura2 | END IF |
508 | 1 | pfleura2 | |
509 | 1 | pfleura2 | END Do ! DO WHILE CaFaire |
510 | 1 | pfleura2 | |
511 | 1 | pfleura2 | |
512 | 1 | pfleura2 | ELSE ! FrozBlock(I,0)==1 |
513 | 1 | pfleura2 | if (debug) WRITE(*,*) 'IFrag=',IFrag,'Frozblock(I,0)>1',Frozblock(IFrag,0) |
514 | 1 | pfleura2 | ! We have many frozen atoms for one fragment. We will have to choose |
515 | 1 | pfleura2 | ! the first one, and then to decide when to swich... |
516 | 1 | pfleura2 | Iat=0 |
517 | 1 | pfleura2 | I0=-1 |
518 | 1 | pfleura2 | DO I=1,FrozBlock(IFrag,0) |
519 | 1 | pfleura2 | JAt=FrozBlock(IFrag,I) |
520 | 1 | pfleura2 | if (debug) WRITE(*,*) Jat, & |
521 | 1 | pfleura2 | (LiaisonsBis(Jat,Itmp),Itmp=0,LiaisonsBis(Jat,0)) |
522 | 1 | pfleura2 | IF (LiaisonsBis(Jat,0).GT.I0) THEN |
523 | 1 | pfleura2 | I0=LiaisonsBis(Jat,0) |
524 | 1 | pfleura2 | Iat=Jat |
525 | 1 | pfleura2 | END IF |
526 | 1 | pfleura2 | END DO |
527 | 1 | pfleura2 | ! Iat is the starting frozen atom |
528 | 1 | pfleura2 | IF (debug) WRITE(*,*) 'Choosing atom ',iat,'as a starting atom for frag',ifrag |
529 | 1 | pfleura2 | DejaFait(iat)=.TRUE. |
530 | 1 | pfleura2 | IdxCaFaire=2 |
531 | 1 | pfleura2 | CaFaire(1)=iat |
532 | 1 | pfleura2 | CaFaire(2)=0 |
533 | 1 | pfleura2 | IaFaire=1 |
534 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
535 | 1 | pfleura2 | DO WHILE (CaFaire(IaFaire).NE.0) |
536 | 1 | pfleura2 | n1=CaFaire(IaFaire) |
537 | 1 | pfleura2 | I1=idx_zmat(n1) |
538 | 1 | pfleura2 | n2=ind_zmat(I1,2) |
539 | 1 | pfleura2 | n3=ind_zmat(I1,3) |
540 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Iafaire,n1,DejaFait,idxzmat,n2,n3',IaFaire,n1, & |
541 | 1 | pfleura2 | DejaFait(n1),idx_zmat(n1),n2,3 |
542 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Cafaire', & |
543 | 1 | pfleura2 | (CaFaire(J),J=Iafaire,IdxCAfaire) |
544 | 1 | pfleura2 | |
545 | 1 | pfleura2 | |
546 | 1 | pfleura2 | DO I3=1,Liaisons(n1,0) |
547 | 1 | pfleura2 | if (debug) WRITE(*,*) "Here, I3=",I3 |
548 | 1 | pfleura2 | IAt=Liaisons(n1,I3) |
549 | 1 | pfleura2 | ! PFL 2007.Apr.16 -> |
550 | 1 | pfleura2 | ! We add ALL atoms linked to n1 to CaFaire |
551 | 1 | pfleura2 | ! But we delete their link to n1 |
552 | 1 | pfleura2 | !! PFL 2007.Aug.28 -> |
553 | 1 | pfleura2 | ! re-add the test on FCaf in order not to put the same atom more than once in |
554 | 1 | pfleura2 | ! CaFaire array. |
555 | 1 | pfleura2 | IF (.NOT.FCaf(Iat)) THEN |
556 | 1 | pfleura2 | CaFaire(IdxCaFaire)=Iat |
557 | 1 | pfleura2 | IdxCaFaire=IdxCaFaire+1 |
558 | 1 | pfleura2 | CaFaire(IdxCaFaire)=0 |
559 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
560 | 1 | pfleura2 | END IF |
561 | 1 | pfleura2 | !! <-- PFL 2007.Aug.28 |
562 | 1 | pfleura2 | Call Annul(Liaisons,Iat,n1) |
563 | 1 | pfleura2 | Liaisons(iat,0)=Liaisons(Iat,0)-1 |
564 | 1 | pfleura2 | ! <- PFL 2007.Apr.16 |
565 | 1 | pfleura2 | IF (.NOT.DejaFait(Iat)) THEN |
566 | 1 | pfleura2 | ! we add it to the Zmat |
567 | 1 | pfleura2 | call vecteur(n1,iat,x,y,z,vx1,vy1,vz1,norm1) |
568 | 1 | pfleura2 | izm=izm+1 |
569 | 1 | pfleura2 | IF (izm.EQ.2) THEN |
570 | 1 | pfleura2 | ind_zmat(izm,1)=IAt |
571 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
572 | 1 | pfleura2 | ind_zmat(izm,3:5)=0 |
573 | 1 | pfleura2 | ELSE |
574 | 1 | pfleura2 | IF (n2.EQ.-1) THEN |
575 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
576 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
577 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
578 | 1 | pfleura2 | ! already stored in ind_zmat |
579 | 1 | pfleura2 | d=1e9 |
580 | 1 | pfleura2 | JAt=-1 |
581 | 1 | pfleura2 | DO I=1,NCart |
582 | 1 | pfleura2 | If (ind_zmat(I,1).NE.n1) THEN |
583 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx2,vy2,vz2,norm2) |
584 | 1 | pfleura2 | SAng=Sinangle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
585 | 1 | pfleura2 | ! we take only atoms that are not aligned |
586 | 1 | pfleura2 | if ((norm2<=d).AND.(SAng.GT.0.09d0)) THEN |
587 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
588 | 1 | pfleura2 | d=norm2 |
589 | 1 | pfleura2 | END IF |
590 | 1 | pfleura2 | END IF |
591 | 1 | pfleura2 | END DO |
592 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
593 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
594 | 1 | pfleura2 | STOP |
595 | 1 | pfleura2 | END IF |
596 | 1 | pfleura2 | n2=JAt |
597 | 1 | pfleura2 | END IF |
598 | 1 | pfleura2 | ! ind_zmat(I1,2)=n2 |
599 | 1 | pfleura2 | if (izm.EQ.3) THEN |
600 | 1 | pfleura2 | ind_zmat(izm,1)=Iat |
601 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
602 | 1 | pfleura2 | ind_zmat(izm,3)=n2 |
603 | 1 | pfleura2 | ELSE |
604 | 1 | pfleura2 | IF (n3.EQ.-1) THEN |
605 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
606 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
607 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
608 | 1 | pfleura2 | ! already stored in ind_zmat |
609 | 1 | pfleura2 | call vecteur(n1,n2,x,y,z,vx2,vy2,vz2,norm2) |
610 | 1 | pfleura2 | d=1e9 |
611 | 1 | pfleura2 | JAt=-1 |
612 | 1 | pfleura2 | DO I=1,NCart |
613 | 1 | pfleura2 | If ((ind_zmat(I,1).NE.n1).AND.(ind_zmat(I,1).NE.n2)) THEN |
614 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx3,vy3,vz3,norm3) |
615 | 1 | pfleura2 | SAng=Sinangle(vx3,vy3,vz3,norm3,vx2,vy2,vz2,norm2) |
616 | 1 | pfleura2 | if (debug) WRITE(*,*) "2-Trying izm,iat,n1,n2,n3,sang,d,norm3", & |
617 | 1 | pfleura2 | izm,iat,n1,n2,ind_zmat(I,1),sang,d,norm3 |
618 | 1 | pfleura2 | |
619 | 1 | pfleura2 | ! we take only atoms that are not aligned |
620 | 1 | pfleura2 | if ((norm3<=d).AND.(SAng.GT.0.09d0)) THEN |
621 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
622 | 1 | pfleura2 | d=norm3 |
623 | 1 | pfleura2 | END IF |
624 | 1 | pfleura2 | END IF |
625 | 1 | pfleura2 | END DO |
626 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
627 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
628 | 1 | pfleura2 | STOP |
629 | 1 | pfleura2 | END IF |
630 | 1 | pfleura2 | n3=JAt |
631 | 1 | pfleura2 | END IF |
632 | 1 | pfleura2 | ! ind_zmat(I1,3)=n3 |
633 | 1 | pfleura2 | Call add2indzmat(na,izm,Iat,n1,n2,n3,ind_zmat,x,y,z) |
634 | 1 | pfleura2 | END IF |
635 | 1 | pfleura2 | END IF |
636 | 1 | pfleura2 | idx_zmat(iat)=izm |
637 | 1 | pfleura2 | ! Call Annul(Liaisons,n1,iat) |
638 | 1 | pfleura2 | n3=iat |
639 | 1 | pfleura2 | DejaFait(Iat)=.TRUE. |
640 | 1 | pfleura2 | if (debug) WRITE(*,*) "For no reason, I3=",I3 |
641 | 1 | pfleura2 | END IF |
642 | 1 | pfleura2 | END DO |
643 | 1 | pfleura2 | IaFaire=IaFaire+1 |
644 | 1 | pfleura2 | |
645 | 1 | pfleura2 | if (debug) THEN |
646 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat 6',izm |
647 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(1,1) |
648 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(2,1), ind_zmat(2,2) |
649 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(3,1), ind_zmat(3,2), ind_zmat(3,3) |
650 | 1 | pfleura2 | DO Ip=4,izm |
651 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(Ip,1), & |
652 | 1 | pfleura2 | ind_zmat(Ip,2),ind_zmat(Ip,3), ind_zmat(Ip,4) |
653 | 1 | pfleura2 | END DO |
654 | 1 | pfleura2 | END IF |
655 | 1 | pfleura2 | |
656 | 1 | pfleura2 | |
657 | 1 | pfleura2 | END Do ! DO WHILE CaFaire |
658 | 1 | pfleura2 | |
659 | 1 | pfleura2 | |
660 | 1 | pfleura2 | END IF ! FrozBlock(I,0)==1 |
661 | 1 | pfleura2 | |
662 | 1 | pfleura2 | IFrag=IFrag+1 |
663 | 1 | pfleura2 | |
664 | 1 | pfleura2 | END DO ! Loop on all fragments |
665 | 1 | pfleura2 | |
666 | 1 | pfleura2 | |
667 | 1 | pfleura2 | DO IFrag=1,NbFrag |
668 | 1 | pfleura2 | IF (FrozBlock(IFrag,0).EQ.0) THEN |
669 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Adding fragment :', ifrag,'with no frozen atoms' |
670 | 1 | pfleura2 | ! We have no frozen atoms for this fragment. We will have to choose |
671 | 1 | pfleura2 | ! the first atom to put. |
672 | 1 | pfleura2 | ! For now, we do not care of the 'central' atom (ie the one with |
673 | 1 | pfleura2 | ! no CP atoms...) |
674 | 1 | pfleura2 | ! We just take the atom that is the closest to the already placed |
675 | 1 | pfleura2 | ! atoms ! |
676 | 1 | pfleura2 | |
677 | 1 | pfleura2 | I0=0 |
678 | 1 | pfleura2 | I1=0 |
679 | 1 | pfleura2 | d=1e9 |
680 | 1 | pfleura2 | DO J=1,izm |
681 | 1 | pfleura2 | Jat=ind_zmat(J,1) |
682 | 1 | pfleura2 | DO I=1,NbAtfrag(IFrag) |
683 | 1 | pfleura2 | IAt=FragAt(IFrag,I) |
684 | 1 | pfleura2 | IF (.NOT.DejaFait(Iat)) THEN |
685 | 1 | pfleura2 | Call vecteur(Iat,Jat,x,y,z,vx1,vy1,vz1,norm1) |
686 | 1 | pfleura2 | IF (norm1.LT.d) THEN |
687 | 1 | pfleura2 | I1=Jat |
688 | 1 | pfleura2 | I0=Iat |
689 | 1 | pfleura2 | d=Norm1 |
690 | 1 | pfleura2 | END IF |
691 | 1 | pfleura2 | END IF |
692 | 1 | pfleura2 | END DO |
693 | 1 | pfleura2 | END DO |
694 | 1 | pfleura2 | |
695 | 1 | pfleura2 | Iat=I0 |
696 | 1 | pfleura2 | n1=I1 |
697 | 1 | pfleura2 | I1=idx_zmat(n1) |
698 | 1 | pfleura2 | n2=ind_zmat(I1,2) |
699 | 1 | pfleura2 | n3=ind_zmat(I1,3) |
700 | 1 | pfleura2 | |
701 | 1 | pfleura2 | IF (debug) WRITE(*,*) Iat,' starting atom for frag',ifrag |
702 | 1 | pfleura2 | |
703 | 1 | pfleura2 | |
704 | 1 | pfleura2 | call vecteur(n1,iat,x,y,z,vx1,vy1,vz1,norm1) |
705 | 1 | pfleura2 | izm=izm+1 |
706 | 1 | pfleura2 | IF (izm.EQ.2) THEN |
707 | 1 | pfleura2 | ind_zmat(izm,1)=IAt |
708 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
709 | 1 | pfleura2 | ind_zmat(izm,3:5)=0 |
710 | 1 | pfleura2 | ELSE |
711 | 1 | pfleura2 | IF (n2.EQ.-1) THEN |
712 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
713 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
714 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
715 | 1 | pfleura2 | ! already stored in ind_zmat |
716 | 1 | pfleura2 | d=1e9 |
717 | 1 | pfleura2 | JAt=-1 |
718 | 1 | pfleura2 | DO I=1,NCart |
719 | 1 | pfleura2 | If (ind_zmat(I,1).NE.n1) THEN |
720 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx2,vy2,vz2,norm2) |
721 | 1 | pfleura2 | SAng=Sinangle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
722 | 1 | pfleura2 | ! we take only atoms that are not aligned |
723 | 1 | pfleura2 | if ((norm2<=d).AND.(SAng.GT.0.09d0)) THEN |
724 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
725 | 1 | pfleura2 | d=norm2 |
726 | 1 | pfleura2 | END IF |
727 | 1 | pfleura2 | END IF |
728 | 1 | pfleura2 | END DO |
729 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
730 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
731 | 1 | pfleura2 | STOP |
732 | 1 | pfleura2 | END IF |
733 | 1 | pfleura2 | n2=JAt |
734 | 1 | pfleura2 | END IF |
735 | 1 | pfleura2 | ! ind_zmat(I1,2)=n2 |
736 | 1 | pfleura2 | END IF |
737 | 1 | pfleura2 | if (izm.EQ.3) THEN |
738 | 1 | pfleura2 | ind_zmat(izm,1)=Iat |
739 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
740 | 1 | pfleura2 | ind_zmat(izm,3)=n2 |
741 | 1 | pfleura2 | ELSE |
742 | 1 | pfleura2 | IF (n3.EQ.-1) THEN |
743 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
744 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
745 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
746 | 1 | pfleura2 | ! already stored in ind_zmat |
747 | 1 | pfleura2 | call vecteur(n1,n2,x,y,z,vx2,vy2,vz2,norm2) |
748 | 1 | pfleura2 | d=1e9 |
749 | 1 | pfleura2 | JAt=-1 |
750 | 1 | pfleura2 | DO I=1,NCart |
751 | 1 | pfleura2 | If ((ind_zmat(I,1).NE.n1).AND.(ind_zmat(I,1).NE.n2)) THEN |
752 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx3,vy3,vz3,norm3) |
753 | 1 | pfleura2 | SAng=Sinangle(vx3,vy3,vz3,norm3,vx2,vy2,vz2,norm2) |
754 | 1 | pfleura2 | if (debug) WRITE(*,*) "3-Trying izm,iat,n1,n2,n3,sang,d,norm3", & |
755 | 1 | pfleura2 | izm,iat,n1,n2,ind_zmat(I,1),sang,d,norm3 |
756 | 1 | pfleura2 | |
757 | 1 | pfleura2 | ! we take only atoms that are not aligned |
758 | 1 | pfleura2 | if ((norm3<=d).AND.(SAng.GT.0.09d0)) THEN |
759 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
760 | 1 | pfleura2 | d=norm3 |
761 | 1 | pfleura2 | END IF |
762 | 1 | pfleura2 | END IF |
763 | 1 | pfleura2 | END DO |
764 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
765 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
766 | 1 | pfleura2 | STOP |
767 | 1 | pfleura2 | END IF |
768 | 1 | pfleura2 | n3=JAt |
769 | 1 | pfleura2 | END IF |
770 | 1 | pfleura2 | ! ind_zmat(I1,3)=n3 |
771 | 1 | pfleura2 | Call add2indzmat(na,izm,Iat,n1,n2,n3,ind_zmat,x,y,z) |
772 | 1 | pfleura2 | END IF |
773 | 1 | pfleura2 | idx_zmat(iat)=izm |
774 | 1 | pfleura2 | |
775 | 1 | pfleura2 | |
776 | 1 | pfleura2 | DejaFait(iat)=.TRUE. |
777 | 1 | pfleura2 | IdxCaFaire=2 |
778 | 1 | pfleura2 | CaFaire(1)=iat |
779 | 1 | pfleura2 | CaFaire(2)=0 |
780 | 1 | pfleura2 | IaFaire=1 |
781 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
782 | 1 | pfleura2 | DO WHILE (CaFaire(IaFaire).NE.0) |
783 | 1 | pfleura2 | n1=CaFaire(IaFaire) |
784 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Iafaire,n1',IaFaire,n1, & |
785 | 1 | pfleura2 | DejaFait(n1),idx_zmat(n1) |
786 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Cafaire', & |
787 | 1 | pfleura2 | (CaFaire(J),J=Iafaire,IdxCAfaire) |
788 | 1 | pfleura2 | I1=idx_zmat(n1) |
789 | 1 | pfleura2 | n2=ind_zmat(I1,2) |
790 | 1 | pfleura2 | n3=ind_zmat(I1,3) |
791 | 1 | pfleura2 | |
792 | 1 | pfleura2 | DO I3=1,Liaisons(n1,0) |
793 | 1 | pfleura2 | IAt=Liaisons(n1,I3) |
794 | 1 | pfleura2 | ! PFL 2007.Apr.16 -> |
795 | 1 | pfleura2 | ! We add ALL atoms linked to n1 to CaFaire |
796 | 1 | pfleura2 | ! But we delete their link to n1 |
797 | 1 | pfleura2 | !! PFL 2007.Aug.28 -> |
798 | 1 | pfleura2 | ! re-add the test on FCaf in order not to put the same atom more than once in |
799 | 1 | pfleura2 | ! CaFaire array. |
800 | 1 | pfleura2 | IF (.NOT.FCaf(Iat)) THEN |
801 | 1 | pfleura2 | CaFaire(IdxCaFaire)=Iat |
802 | 1 | pfleura2 | IdxCaFaire=IdxCaFaire+1 |
803 | 1 | pfleura2 | CaFaire(IdxCaFaire)=0 |
804 | 1 | pfleura2 | FCaf(Iat)=.TRUE. |
805 | 1 | pfleura2 | END IF |
806 | 1 | pfleura2 | !! <-- PFL 2007.Aug.28 |
807 | 1 | pfleura2 | Call Annul(Liaisons,Iat,n1) |
808 | 1 | pfleura2 | Liaisons(iat,0)=Liaisons(Iat,0)-1 |
809 | 1 | pfleura2 | ! <- PFL 2007.Apr.16 |
810 | 1 | pfleura2 | IF (.NOT.DejaFait(Iat)) THEN |
811 | 1 | pfleura2 | ! we add it to the Zmat |
812 | 1 | pfleura2 | call vecteur(n1,iat,x,y,z,vx1,vy1,vz1,norm1) |
813 | 1 | pfleura2 | izm=izm+1 |
814 | 1 | pfleura2 | IF (izm.EQ.2) THEN |
815 | 1 | pfleura2 | ind_zmat(izm,1)=IAt |
816 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
817 | 1 | pfleura2 | ind_zmat(izm,3:5)=0 |
818 | 1 | pfleura2 | ELSE |
819 | 1 | pfleura2 | IF (n2.EQ.-1) THEN |
820 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
821 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
822 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
823 | 1 | pfleura2 | ! already stored in ind_zmat |
824 | 1 | pfleura2 | d=1e9 |
825 | 1 | pfleura2 | JAt=-1 |
826 | 1 | pfleura2 | DO I=1,NCart |
827 | 1 | pfleura2 | If (ind_zmat(I,1).NE.n1) THEN |
828 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx2,vy2,vz2,norm2) |
829 | 1 | pfleura2 | SAng=Sinangle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
830 | 1 | pfleura2 | ! we take only atoms that are not aligned |
831 | 1 | pfleura2 | if ((norm2<=d).AND.(SAng.GT.0.09d0)) THEN |
832 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
833 | 1 | pfleura2 | d=norm2 |
834 | 1 | pfleura2 | END IF |
835 | 1 | pfleura2 | END IF |
836 | 1 | pfleura2 | END DO |
837 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
838 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
839 | 1 | pfleura2 | STOP |
840 | 1 | pfleura2 | END IF |
841 | 1 | pfleura2 | n2=JAt |
842 | 1 | pfleura2 | END IF |
843 | 1 | pfleura2 | ! ind_zmat(I1,2)=n2 |
844 | 1 | pfleura2 | END IF |
845 | 1 | pfleura2 | if (izm.EQ.3) THEN |
846 | 1 | pfleura2 | ind_zmat(izm,1)=Iat |
847 | 1 | pfleura2 | ind_zmat(izm,2)=n1 |
848 | 1 | pfleura2 | ind_zmat(izm,3)=n2 |
849 | 1 | pfleura2 | ELSE |
850 | 1 | pfleura2 | IF (n3.EQ.-1) THEN |
851 | 1 | pfleura2 | ! This atom is defined in cartesian coordinates |
852 | 1 | pfleura2 | ! and has not been used to put a non cart atom. |
853 | 1 | pfleura2 | ! we will find the closest atom linked to this one amongst the atoms |
854 | 1 | pfleura2 | ! already stored in ind_zmat |
855 | 1 | pfleura2 | call vecteur(n1,n2,x,y,z,vx2,vy2,vz2,norm2) |
856 | 1 | pfleura2 | d=1e9 |
857 | 1 | pfleura2 | JAt=-1 |
858 | 1 | pfleura2 | DO I=1,NCart |
859 | 1 | pfleura2 | If ((ind_zmat(I,1).NE.n1).AND.(ind_zmat(I,1).NE.n2)) THEN |
860 | 1 | pfleura2 | call vecteur(n1,ind_zmat(I,1),x,y,z,vx3,vy3,vz3,norm3) |
861 | 1 | pfleura2 | SAng=Sinangle(vx3,vy3,vz3,norm3,vx2,vy2,vz2,norm2) |
862 | 1 | pfleura2 | if (debug) WRITE(*,*) "4-Trying izm,iat,n1,n2,n3,sang,d,norm3", & |
863 | 1 | pfleura2 | izm,iat,n1,n2,ind_zmat(I,1),sang,d,norm3 |
864 | 1 | pfleura2 | |
865 | 1 | pfleura2 | ! we take only atoms that are not aligned |
866 | 1 | pfleura2 | if ((norm3<=d).AND.(SAng.GT.0.09d0)) THEN |
867 | 1 | pfleura2 | Jat=ind_zmat(I,1) |
868 | 1 | pfleura2 | d=norm3 |
869 | 1 | pfleura2 | END IF |
870 | 1 | pfleura2 | END IF |
871 | 1 | pfleura2 | END DO |
872 | 1 | pfleura2 | if (JAt.EQ.-1) THEN |
873 | 1 | pfleura2 | WRITE(*,*) "All cart atoms are aligned. Case non treated for now. Contact PFL" |
874 | 1 | pfleura2 | STOP |
875 | 1 | pfleura2 | END IF |
876 | 1 | pfleura2 | n3=JAt |
877 | 1 | pfleura2 | END IF |
878 | 1 | pfleura2 | ! ind_zmat(I1,3)=n3 |
879 | 1 | pfleura2 | Call add2indzmat(na,izm,Iat,n1,n2,n3,ind_zmat,x,y,z) |
880 | 1 | pfleura2 | END IF |
881 | 1 | pfleura2 | idx_zmat(iat)=izm |
882 | 1 | pfleura2 | n3=iat |
883 | 1 | pfleura2 | DejaFait(Iat)=.TRUE. |
884 | 1 | pfleura2 | END IF |
885 | 1 | pfleura2 | END DO |
886 | 1 | pfleura2 | IaFaire=IaFaire+1 |
887 | 1 | pfleura2 | |
888 | 1 | pfleura2 | if (debug) THEN |
889 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat 7',izm |
890 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(1,1) |
891 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(2,1), ind_zmat(2,2) |
892 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(3,1), ind_zmat(3,2), ind_zmat(3,3) |
893 | 1 | pfleura2 | DO Ip=4,izm |
894 | 1 | pfleura2 | WRITE(*,'(1X,4(1X,I5))') ind_zmat(Ip,1), & |
895 | 1 | pfleura2 | ind_zmat(Ip,2),ind_zmat(Ip,3), ind_zmat(Ip,4) |
896 | 1 | pfleura2 | END DO |
897 | 1 | pfleura2 | END IF |
898 | 1 | pfleura2 | |
899 | 1 | pfleura2 | |
900 | 1 | pfleura2 | END Do ! DO WHILE CaFaire |
901 | 1 | pfleura2 | END IF ! FrozBlock(IFrag,0).EQ.0 |
902 | 1 | pfleura2 | |
903 | 1 | pfleura2 | END DO ! Loop on all fragments without frozen atoms |
904 | 1 | pfleura2 | |
905 | 1 | pfleura2 | if (debug) THEN |
906 | 1 | pfleura2 | WRITE(*,*) Na+Izm |
907 | 1 | pfleura2 | WRITE(*,*) 'Done... :-(', izm |
908 | 1 | pfleura2 | DO J=1,Na |
909 | 1 | pfleura2 | WRITE(*,'(1X,A5,3(1X,F10.6))') Nom(Atome(J)),X(J),Y(J),Z(J) |
910 | 1 | pfleura2 | END DO |
911 | 1 | pfleura2 | DO I=1,Izm |
912 | 1 | pfleura2 | J=ind_zmat(I,1) |
913 | 1 | pfleura2 | WRITE(*,'(1X,A5,3(1X,F10.6))') 'X ',X(J),Y(J),Z(J) |
914 | 1 | pfleura2 | END DO |
915 | 1 | pfleura2 | IF (izm.NE.Na) THEN |
916 | 1 | pfleura2 | WRITE(*,*) "Atoms not done:" |
917 | 1 | pfleura2 | DO I=1,Na |
918 | 1 | pfleura2 | IF (.NOT.DejaFait(I)) WRITE(*,'(I5)',ADVANCE='NO') I |
919 | 1 | pfleura2 | END DO |
920 | 1 | pfleura2 | END IF |
921 | 1 | pfleura2 | |
922 | 1 | pfleura2 | END IF |
923 | 1 | pfleura2 | |
924 | 1 | pfleura2 | |
925 | 1 | pfleura2 | ! We have ind_zmat. We calculate val_zmat :-) |
926 | 1 | pfleura2 | if (debug) WRITE(*,*) "Calculating val_zmat" |
927 | 1 | pfleura2 | |
928 | 1 | pfleura2 | SELECT CASE (NCart) |
929 | 1 | pfleura2 | CASE (1) |
930 | 1 | pfleura2 | val_zmat(2,2)=0.d0 |
931 | 1 | pfleura2 | val_zmat(2,3)=0.d0 |
932 | 1 | pfleura2 | val_zmat(3,3)=0.d0 |
933 | 1 | pfleura2 | n1=ind_zmat(2,1) |
934 | 1 | pfleura2 | n2=ind_zmat(2,2) |
935 | 1 | pfleura2 | CALL vecteur(n2,n1,x,y,z,vx1,vy1,vz1,norm1) |
936 | 1 | pfleura2 | val_zmat(2,1)=norm1 |
937 | 1 | pfleura2 | |
938 | 1 | pfleura2 | n1=ind_zmat(3,1) |
939 | 1 | pfleura2 | n2=ind_zmat(3,2) |
940 | 1 | pfleura2 | n3=ind_zmat(3,3) |
941 | 1 | pfleura2 | CALL vecteur(n2,n1,x,y,z,vx1,vy1,vz1,norm1) |
942 | 1 | pfleura2 | val_zmat(3,1)=norm1 |
943 | 1 | pfleura2 | |
944 | 1 | pfleura2 | CALL vecteur(n2,n3,x,y,z,vx2,vy2,vz2,norm2) |
945 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
946 | 1 | pfleura2 | val_zmat(3,2)=val |
947 | 1 | pfleura2 | IBeg=4 |
948 | 1 | pfleura2 | |
949 | 1 | pfleura2 | CASE (2) |
950 | 1 | pfleura2 | val_zmat(3,3)=0.d0 |
951 | 1 | pfleura2 | |
952 | 1 | pfleura2 | n1=ind_zmat(3,1) |
953 | 1 | pfleura2 | n2=ind_zmat(3,2) |
954 | 1 | pfleura2 | n3=ind_zmat(3,3) |
955 | 1 | pfleura2 | CALL vecteur(n2,n1,x,y,z,vx1,vy1,vz1,norm1) |
956 | 1 | pfleura2 | val_zmat(3,1)=norm1 |
957 | 1 | pfleura2 | |
958 | 1 | pfleura2 | CALL vecteur(n2,n3,x,y,z,vx2,vy2,vz2,norm2) |
959 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
960 | 1 | pfleura2 | val_zmat(3,2)=val |
961 | 1 | pfleura2 | IBeg=4 |
962 | 1 | pfleura2 | CASE DEFAULT |
963 | 1 | pfleura2 | Ibeg=NCart+1 |
964 | 1 | pfleura2 | END SELECT |
965 | 1 | pfleura2 | |
966 | 1 | pfleura2 | |
967 | 1 | pfleura2 | DO i=IBeg,na |
968 | 1 | pfleura2 | |
969 | 1 | pfleura2 | n1=ind_zmat(i,1) |
970 | 1 | pfleura2 | n2=ind_zmat(i,2) |
971 | 1 | pfleura2 | n3=ind_zmat(i,3) |
972 | 1 | pfleura2 | n4=ind_zmat(i,4) |
973 | 1 | pfleura2 | |
974 | 1 | pfleura2 | if (debug) WRITE(*,*) "Doing i,n1,n2,n3,n4",i,n1,n2,n3,n4 |
975 | 1 | pfleura2 | CALL vecteur(n2,n1,x,y,z,vx1,vy1,vz1,norm1) |
976 | 1 | pfleura2 | |
977 | 1 | pfleura2 | CALL vecteur(n2,n3,x,y,z,vx2,vy2,vz2,norm2) |
978 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
979 | 1 | pfleura2 | |
980 | 1 | pfleura2 | CALL vecteur(n3,n4,x,y,z,vx3,vy3,vz3,norm3) |
981 | 2 | pfleura2 | CALL produit_vect(vx1,vy1,vz1,vx2,vy2,vz2, & |
982 | 1 | pfleura2 | vx4,vy4,vz4,norm4) |
983 | 2 | pfleura2 | CALL produit_vect(vx3,vy3,vz3,vx2,vy2,vz2, & |
984 | 1 | pfleura2 | vx5,vy5,vz5,norm5) |
985 | 1 | pfleura2 | |
986 | 1 | pfleura2 | val_d=angle_d(vx4,vy4,vz4,norm4, vx5,vy5,vz5,norm5, & |
987 | 1 | pfleura2 | vx2,vy2,vz2,norm2) |
988 | 1 | pfleura2 | |
989 | 1 | pfleura2 | ! write(*,11) n1,n2,norm1,n3,val,n4,val_d |
990 | 1 | pfleura2 | !11 format (2(1x,i3),1x,f8.4,2(1x,i3,1x,f8.3)) |
991 | 1 | pfleura2 | |
992 | 1 | pfleura2 | val_zmat(i,1)=norm1 |
993 | 1 | pfleura2 | val_zmat(i,2)=val |
994 | 1 | pfleura2 | val_zmat(i,3)=val_d |
995 | 1 | pfleura2 | |
996 | 1 | pfleura2 | END DO |
997 | 1 | pfleura2 | |
998 | 1 | pfleura2 | if (debug) THEN |
999 | 1 | pfleura2 | WRITE(*,*) 'DBG Cre_Zmat_Constr: ind_zmat' |
1000 | 1 | pfleura2 | DO I=1,na |
1001 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
1002 | 1 | pfleura2 | END DO |
1003 | 1 | pfleura2 | |
1004 | 1 | pfleura2 | WRITE(*,*) 'DBG Cre_Zmat_Constr: Full zmat' |
1005 | 1 | pfleura2 | DO I=1,NCart |
1006 | 1 | pfleura2 | WRITE(*,'(1X,I5,3(1X,F11.6))') ind_zmat(i,1),(val_zmat(i,j),j=1,3) |
1007 | 1 | pfleura2 | END DO |
1008 | 1 | pfleura2 | DO I=NCart+1,Na |
1009 | 1 | pfleura2 | WRITE(*,'(1X,I5,1X,I5,F8.4,2(1X,I5,1X,F7.2))') ind_zmat(i,1),(ind_zmat(i,j+1),val_zmat(i,j),j=1,3) |
1010 | 1 | pfleura2 | END DO |
1011 | 1 | pfleura2 | |
1012 | 1 | pfleura2 | END IF |
1013 | 1 | pfleura2 | |
1014 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate (FrozDist,Fragment, NbAtFrag,FragAt)" |
1015 | 1 | pfleura2 | DEALLOCATE(FrozDist,Fragment, NbAtFrag,FragAt) |
1016 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate FrozFrag, IdxFragAt, FrozBlock" |
1017 | 1 | pfleura2 | ! DEALLOCATE(FrozFrag, IdxFragAt, FrozBlock) |
1018 | 1 | pfleura2 | DEALLOCATE(FrozFrag,FrozBlock) |
1019 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate (DistFroz,Liaisons)" |
1020 | 1 | pfleura2 | DEALLOCATE(DistFroz,Liaisons) |
1021 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate (LiaisonsIni)" |
1022 | 1 | pfleura2 | DEALLOCATE(LiaisonsIni) |
1023 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate(CaFaire,DejaFait,FrozAt)" |
1024 | 1 | pfleura2 | DEALLOCATE(CaFaire,DejaFait,FrozAt) |
1025 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate LiaisonsBis" |
1026 | 1 | pfleura2 | DEALLOCATE(LiaisonsBis) |
1027 | 1 | pfleura2 | if (debug) WRITE(*,*) "Deallocate FCart,AtCart,FCaf" |
1028 | 1 | pfleura2 | DEALLOCATE(FCart,AtCart,FCaf) |
1029 | 1 | pfleura2 | |
1030 | 5 | pfleura2 | if (debugGaussian) THEN |
1031 | 5 | pfleura2 | WRITE(*,*) 'DBG Cre_Zmat_Frag: Gaussian Zmat - START' |
1032 | 5 | pfleura2 | Call WriteMixed_Gaussian(na,atome,NCart,ind_zmat,val_zmat) |
1033 | 5 | pfleura2 | WRITE(*,*) 'DBG Cre_Zmat_Frag: Gaussian Zmat - END' |
1034 | 5 | pfleura2 | END IF |
1035 | 5 | pfleura2 | |
1036 | 5 | pfleura2 | |
1037 | 1 | pfleura2 | if (debug) Call Header("Exiting Calc_mixed_frag") |
1038 | 1 | pfleura2 | |
1039 | 1 | pfleura2 | END SUBROUTINE Calc_mixed_frag |