root / src / ZmatBuild.f90
Historique | Voir | Annoter | Télécharger (32,92 ko)
1 | 1 | pfleura2 | SUBROUTINE ZmatBuild(na,atome,ind_zmat,val_zmat,x,y,z,izm, & |
---|---|---|---|
2 | 1 | pfleura2 | Liaisons, LIes_CP,LIes_CF,ListAt,DejaFait,debug) |
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 | 1 | pfleura2 | ! 12.06.06 |
13 | 1 | pfleura2 | ! Small modification: there was an inconsistency: izm was increased |
14 | 1 | pfleura2 | ! after the atom was added to ind_zmat for the three first atoms, |
15 | 1 | pfleura2 | ! but before for all others. Now, it starts at zero and it |
16 | 1 | pfleura2 | ! is increased before the atom is added to ind_zmat |
17 | 12 | pfleura2 | !---------------------------------------------------------------------- |
18 | 12 | pfleura2 | ! Copyright 2003-2014 Ecole Normale Supérieure de Lyon, |
19 | 12 | pfleura2 | ! Centre National de la Recherche Scientifique, |
20 | 12 | pfleura2 | ! Université Claude Bernard Lyon 1. All rights reserved. |
21 | 12 | pfleura2 | ! |
22 | 12 | pfleura2 | ! This work is registered with the Agency for the Protection of Programs |
23 | 12 | pfleura2 | ! as IDDN.FR.001.100009.000.S.P.2014.000.30625 |
24 | 12 | pfleura2 | ! |
25 | 12 | pfleura2 | ! Authors: P. Fleurat-Lessard, P. Dayal |
26 | 12 | pfleura2 | ! Contact: optnpath@gmail.com |
27 | 12 | pfleura2 | ! |
28 | 12 | pfleura2 | ! This file is part of "Opt'n Path". |
29 | 12 | pfleura2 | ! |
30 | 12 | pfleura2 | ! "Opt'n Path" is free software: you can redistribute it and/or modify |
31 | 12 | pfleura2 | ! it under the terms of the GNU Affero General Public License as |
32 | 12 | pfleura2 | ! published by the Free Software Foundation, either version 3 of the License, |
33 | 12 | pfleura2 | ! or (at your option) any later version. |
34 | 12 | pfleura2 | ! |
35 | 12 | pfleura2 | ! "Opt'n Path" is distributed in the hope that it will be useful, |
36 | 12 | pfleura2 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
37 | 12 | pfleura2 | ! |
38 | 12 | pfleura2 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
39 | 12 | pfleura2 | ! GNU Affero General Public License for more details. |
40 | 12 | pfleura2 | ! |
41 | 12 | pfleura2 | ! You should have received a copy of the GNU Affero General Public License |
42 | 12 | pfleura2 | ! along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>. |
43 | 12 | pfleura2 | ! |
44 | 12 | pfleura2 | ! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr, |
45 | 12 | pfleura2 | ! for commercial licensing opportunities. |
46 | 12 | pfleura2 | !---------------------------------------------------------------------- |
47 | 1 | pfleura2 | |
48 | 12 | pfleura2 | use Path_module, only : Nat, NMaxL, KINT, KREAL,Pi |
49 | 2 | pfleura2 | use Io_module |
50 | 1 | pfleura2 | |
51 | 2 | pfleura2 | IMPLICIT NONE |
52 | 1 | pfleura2 | |
53 | 2 | pfleura2 | INTEGER(KINT) :: Izm,I,IAf,IAt,IAt0,J,Jat |
54 | 2 | pfleura2 | INTEGER(KINT) :: n1, NMaxCF, NMinCP, VCF |
55 | 2 | pfleura2 | INTEGER(KINT) :: IAta,IAtd,IAtDh,IAti,IAtv,ICat |
56 | 2 | pfleura2 | INTEGER(KINT) :: ICP0, IdAt0, IdAtl |
57 | 2 | pfleura2 | INTEGER(KINT) :: Idx, IIat, IIatDh, IndAFaire, IndFin |
58 | 2 | pfleura2 | INTEGER(KINT) :: IdxAt0 |
59 | 2 | pfleura2 | INTEGER(KINT) :: ITmp, IZm0, IZm1, IZm2, IZm3, IZm4, IzmTmp |
60 | 2 | pfleura2 | integer(KINT) :: na, atome(NAt), ind_zmat(NAt, 5) |
61 | 2 | pfleura2 | real(KREAL) :: x(NAt), y(NAt), z(NAt) |
62 | 1 | pfleura2 | real(KREAL) :: val_zmat(NAt,3) |
63 | 1 | pfleura2 | ! ListAt contains the indices of frozen atoms |
64 | 2 | pfleura2 | LOGICAL ListAT(NAt), FFirst |
65 | 1 | pfleura2 | INTEGER(KINT) :: Natreat |
66 | 1 | pfleura2 | |
67 | 2 | pfleura2 | real(KREAL) :: dist |
68 | 2 | pfleura2 | INTEGER(KINT) :: LIAISONS(NAt, 0:NMaxL) |
69 | 1 | pfleura2 | INTEGER(KINT) :: CAFaire(NAt) |
70 | 1 | pfleura2 | INTEGER(KINT) :: LieS_CP(NAt,0:NMaxL),LieS_CF(NAt,0:NMaxL) |
71 | 1 | pfleura2 | INTEGER(KINT) :: AtCP0(NAt),NbAt0,NbAt0r |
72 | 1 | pfleura2 | Integer(KINT) :: NbCycle |
73 | 1 | pfleura2 | real(KREAL) :: vx1,vy1,vz1,norm1 |
74 | 1 | pfleura2 | real(KREAL) :: vx2,vy2,vz2,norm2 |
75 | 2 | pfleura2 | real(KREAL) :: val |
76 | 2 | pfleura2 | Logical Debug, Done |
77 | 1 | pfleura2 | Logical DejaFait(NAt) |
78 | 1 | pfleura2 | |
79 | 2 | pfleura2 | |
80 | 2 | pfleura2 | INTERFACE |
81 | 2 | pfleura2 | FUNCTION angle(v1x,v1y,v1z,norm1,v2x,v2y,v2z,norm2) |
82 | 2 | pfleura2 | use Path_module, only : Pi,KINT, KREAL |
83 | 2 | pfleura2 | real(KREAL) :: v1x,v1y,v1z,norm1 |
84 | 2 | pfleura2 | real(KREAL) :: v2x,v2y,v2z,norm2 |
85 | 2 | pfleura2 | real(KREAL) :: angle |
86 | 2 | pfleura2 | END FUNCTION ANGLE |
87 | 2 | pfleura2 | END INTERFACE |
88 | 2 | pfleura2 | |
89 | 2 | pfleura2 | |
90 | 2 | pfleura2 | |
91 | 2 | pfleura2 | |
92 | 2 | pfleura2 | |
93 | 1 | pfleura2 | ! As we may have to treat only partial molecules, it may happen |
94 | 1 | pfleura2 | ! that there are no central atoms... so we first check this by looking |
95 | 1 | pfleura2 | ! for the least number of CP atoms |
96 | 1 | pfleura2 | FFirst=.TRUE. |
97 | 1 | pfleura2 | NMinCP=na |
98 | 1 | pfleura2 | NMaxCF=-1 |
99 | 1 | pfleura2 | NAtreat=0 |
100 | 1 | pfleura2 | Izm0=Izm+1 |
101 | 1 | pfleura2 | |
102 | 1 | pfleura2 | DO I=1,na |
103 | 1 | pfleura2 | if (DEBUG) WRITE(*,*) "DBG ZmatBuild i,listat",i,listAt(i) |
104 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.(DejaFait(I)))) THEN |
105 | 1 | pfleura2 | IF (Lies_CP(I,0).lt.NMinCP) NMinCP=Lies_CP(I,0) |
106 | 1 | pfleura2 | IF (Lies_CF(I,0).gt.NMaxCF) NMaxCF=Lies_CF(I,0) |
107 | 1 | pfleura2 | NATreat=NATreat+1 |
108 | 1 | pfleura2 | END IF |
109 | 1 | pfleura2 | END DO |
110 | 1 | pfleura2 | if (debug) WRITE(*,*) 'NMinCP=',NMinCP |
111 | 1 | pfleura2 | if (debug) WRITE(*,*) 'NMaxCF=',NMaxCF |
112 | 1 | pfleura2 | if (debug) WRITE(*,*) 'NATreat=',NAtreat |
113 | 1 | pfleura2 | |
114 | 1 | pfleura2 | |
115 | 1 | pfleura2 | IF (Debug) THEN |
116 | 1 | pfleura2 | WRITE(*,*) '------------------ Zmat Build -------------------' |
117 | 1 | pfleura2 | WRITE(*,*) 'LIAISONS' |
118 | 1 | pfleura2 | DO I=1,na |
119 | 1 | pfleura2 | WRITE(*,1003) i,(LIAISONS(I,J),J=0,NMaxL) |
120 | 1 | pfleura2 | END DO |
121 | 1 | pfleura2 | |
122 | 1 | pfleura2 | WRITE(*,*) 'LIes_CF' |
123 | 1 | pfleura2 | DO I=1,na |
124 | 1 | pfleura2 | WRITE(*,1003) i,(LIeS_CF(I,J),J=0,NMaxL) |
125 | 1 | pfleura2 | END DO |
126 | 1 | pfleura2 | |
127 | 1 | pfleura2 | WRITE(*,*) 'LIes_CP' |
128 | 1 | pfleura2 | DO I=1,na |
129 | 1 | pfleura2 | WRITE(*,1003) i,(LIeS_CP(I,J),J=0,NMaxL) |
130 | 1 | pfleura2 | END DO |
131 | 1 | pfleura2 | WRITE(*,*) '-- Zmat Build : only _To treat_ atoms------------' |
132 | 1 | pfleura2 | WRITE(*,*) 'LIAISONS' |
133 | 1 | pfleura2 | DO I=1,na |
134 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.DejaFait(I))) & |
135 | 1 | pfleura2 | WRITE(*,1003) i,(LIAISONS(I,J),J=0,NMaxL) |
136 | 1 | pfleura2 | END DO |
137 | 1 | pfleura2 | |
138 | 1 | pfleura2 | WRITE(*,*) 'LIes_CF' |
139 | 1 | pfleura2 | DO I=1,na |
140 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.DejaFait(I))) & |
141 | 1 | pfleura2 | WRITE(*,1003) i,(LIeS_CF(I,J),J=0,NMaxL) |
142 | 1 | pfleura2 | END DO |
143 | 1 | pfleura2 | |
144 | 1 | pfleura2 | WRITE(*,*) 'LIes_CP' |
145 | 1 | pfleura2 | DO I=1,na |
146 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.DejaFait(I))) & |
147 | 1 | pfleura2 | WRITE(*,1003) i,(LIeS_CP(I,J),J=0,NMaxL) |
148 | 1 | pfleura2 | END DO |
149 | 1 | pfleura2 | |
150 | 1 | pfleura2 | END IF |
151 | 1 | pfleura2 | |
152 | 1 | pfleura2 | |
153 | 1 | pfleura2 | if (NAtreat.EQ.0) THEN |
154 | 1 | pfleura2 | WRITE(*,*) "Foutage de gueule : NAtTreat=0" |
155 | 1 | pfleura2 | RETURN |
156 | 1 | pfleura2 | END IF |
157 | 1 | pfleura2 | |
158 | 1 | pfleura2 | if (debug) THEN |
159 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatBuil, izm=',izm |
160 | 1 | pfleura2 | DO I=1,na |
161 | 1 | pfleura2 | WRITE(*,'(1X,I5,1X,L4,1X,L4,12(1X,I4))') i,ListAt(I) & |
162 | 1 | pfleura2 | ,DejaFait(I), & |
163 | 1 | pfleura2 | (Liaisons(I,J),J=0,Liaisons(I,0)) |
164 | 1 | pfleura2 | END DO |
165 | 1 | pfleura2 | END IF |
166 | 1 | pfleura2 | |
167 | 1 | pfleura2 | !!! atraiter NMaxCF=0 :que des atomes separes... |
168 | 1 | pfleura2 | ! mais faut-il reellement faire un cas a part ? |
169 | 1 | pfleura2 | |
170 | 1 | pfleura2 | ! On compte le nb d'atomes sans atomes CP (centripetes) |
171 | 1 | pfleura2 | NbAt0=0 |
172 | 1 | pfleura2 | DO I=1,na |
173 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.DejaFait(I)).AND. & |
174 | 1 | pfleura2 | (Lies_CP(I,0).eq.NMinCP)) THEN |
175 | 1 | pfleura2 | NbAt0=NbAt0+1 |
176 | 1 | pfleura2 | AtCP0(NbAt0)=I |
177 | 1 | pfleura2 | IF (DEBUG) WRITE(*,*) "Center atom",NbAt0,I,Atome(I) |
178 | 1 | pfleura2 | END IF |
179 | 1 | pfleura2 | END DO |
180 | 1 | pfleura2 | AtCP0(NbAt0+1)=0 |
181 | 1 | pfleura2 | NbAt0r=NbAt0 |
182 | 1 | pfleura2 | |
183 | 1 | pfleura2 | IF (Debug) WRITE(*,*) 'DBG ZmatBuld - NCP0,AtCP0 ',NbAt0, & |
184 | 1 | pfleura2 | (AtCP0(i),i=1,NbAt0) |
185 | 1 | pfleura2 | |
186 | 1 | pfleura2 | ! On va les traiter tous en construisant les molecules en partant d'eux |
187 | 1 | pfleura2 | ! Le premier atome sans CP est different des autres car il fixe |
188 | 1 | pfleura2 | ! l'origine |
189 | 1 | pfleura2 | |
190 | 1 | pfleura2 | !First atom |
191 | 1 | pfleura2 | IF (Izm==0) THEN |
192 | 1 | pfleura2 | FFirst=.FALSE. |
193 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Treating Izm=1' |
194 | 1 | pfleura2 | ! IZm=1 |
195 | 1 | pfleura2 | ! Boucle pour trouver celui qui a le plus d'atomes CF |
196 | 1 | pfleura2 | IdAt0=0 |
197 | 1 | pfleura2 | VCF=-1 |
198 | 1 | pfleura2 | DO I=1,NbAt0 |
199 | 1 | pfleura2 | ! WRITE(*,*) 'DBG ZmatB',I,AtCP0(I) |
200 | 1 | pfleura2 | if (AtCP0(I).NE.0) THEN |
201 | 1 | pfleura2 | ICat=AtCP0(I) |
202 | 1 | pfleura2 | if (Lies_CF(ICAt,0).gt.VCF) THEN |
203 | 1 | pfleura2 | IdAt0=ICat |
204 | 1 | pfleura2 | IdxAt0=I |
205 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
206 | 1 | pfleura2 | END IF |
207 | 1 | pfleura2 | END IF |
208 | 1 | pfleura2 | END DO |
209 | 1 | pfleura2 | |
210 | 1 | pfleura2 | ! IF (debug) WRITE(*,*) 'DBG ZmatBuil - VCF, IdxAt0,IdAt0', |
211 | 1 | pfleura2 | ! & VCF, IdxAt0,IdAt0 |
212 | 1 | pfleura2 | ! all atoms with NMinCP CP links do not have CF links... not a good choice to start |
213 | 1 | pfleura2 | ! building the molecule(s) around them... we increase NMinCP |
214 | 1 | pfleura2 | AtCP0(IdxAt0)=0 |
215 | 1 | pfleura2 | NbAt0r=NbAt0r-1 |
216 | 1 | pfleura2 | |
217 | 1 | pfleura2 | ! WRITE(IOOUT,*) 'Atome 1', IdAt0, Nom(Atome(IdAt0)) |
218 | 1 | pfleura2 | Izm1=IdAt0 |
219 | 1 | pfleura2 | Izm=Izm+1 |
220 | 1 | pfleura2 | |
221 | 1 | pfleura2 | ind_zmat(izm,1)=Izm1 |
222 | 1 | pfleura2 | ind_zmat(izm,2)=0 |
223 | 1 | pfleura2 | ind_zmat(izm,3)=0 |
224 | 1 | pfleura2 | ind_zmat(izm,4)=0 |
225 | 1 | pfleura2 | ind_zmat(izm,5)=0 |
226 | 1 | pfleura2 | val_zmat(izm,1)=0.0 |
227 | 1 | pfleura2 | val_zmat(izm,2)=0.0 |
228 | 1 | pfleura2 | val_zmat(izm,3)=0.0 |
229 | 1 | pfleura2 | DejaFait(Izm1)=.True. |
230 | 1 | pfleura2 | |
231 | 1 | pfleura2 | END IF ! end of izm==1 test |
232 | 1 | pfleura2 | |
233 | 1 | pfleura2 | ! On construit la premiere couche qui est speciale car elle fixe les |
234 | 1 | pfleura2 | ! axes. |
235 | 1 | pfleura2 | ! Plusieurs cas sont possibles suivant le nb d'atomes CF |
236 | 1 | pfleura2 | IdAt0=ind_zmat(1,1) |
237 | 1 | pfleura2 | Izm1=IdAt0 |
238 | 1 | pfleura2 | |
239 | 1 | pfleura2 | !Second atom |
240 | 1 | pfleura2 | IF ((izm==1).AND.(NAtreat.ge.2)) THEN |
241 | 1 | pfleura2 | Done=.FALSE. |
242 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Treating Izm=2' |
243 | 1 | pfleura2 | ! Two cases: 1) We are constructing the first fragment: FIzm1=.T. |
244 | 1 | pfleura2 | ! 2) We are constructing the second fragment: FIzm1=.F. |
245 | 1 | pfleura2 | ! in this case, we select one CP0 atom to start with |
246 | 1 | pfleura2 | IF (FFirst) THEN |
247 | 1 | pfleura2 | FFirst=.FALSE. |
248 | 1 | pfleura2 | ! This is the first atom to be dealt with |
249 | 1 | pfleura2 | ! We look for a CP0 |
250 | 1 | pfleura2 | If (NbAt0r.ge.1) THEN |
251 | 1 | pfleura2 | IdAt0=0 |
252 | 1 | pfleura2 | VCF=-1 |
253 | 1 | pfleura2 | WRITE(*,*) 'DBG ZBuild Izm=2:AtCP0',(AtCP0(I),I=1,NbAt0) |
254 | 1 | pfleura2 | DO I=1,NbAt0 |
255 | 1 | pfleura2 | if (AtCP0(I).NE.0) THEN |
256 | 1 | pfleura2 | ICat=AtCP0(I) |
257 | 1 | pfleura2 | if (Lies_CF(I,0).gt.VCF) THEN |
258 | 1 | pfleura2 | Izm2=ICat |
259 | 1 | pfleura2 | IdxAt0=I |
260 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
261 | 1 | pfleura2 | END IF |
262 | 1 | pfleura2 | END IF |
263 | 1 | pfleura2 | END DO |
264 | 1 | pfleura2 | WRITE(*,*) 'DBG ZBuild Izm=2:izm2,IdxAt0,VCF,AtCP0(1)', & |
265 | 1 | pfleura2 | izm2,IdxAt0,VCF,AtCP0(1) |
266 | 1 | pfleura2 | NbAt0r=NbAt0r-1 |
267 | 1 | pfleura2 | Done=.TRUE. |
268 | 1 | pfleura2 | END IF |
269 | 1 | pfleura2 | |
270 | 1 | pfleura2 | ! If we do not have a CP0 available the other tests are identical |
271 | 1 | pfleura2 | ! for cases 1 and 2... |
272 | 1 | pfleura2 | END IF |
273 | 1 | pfleura2 | IF (.NOT.DONE) THEN |
274 | 1 | pfleura2 | IF (Lies_CF(IdAt0,0).ge.1) THEN |
275 | 1 | pfleura2 | IZm2=Lies_CF(IdAt0,1) |
276 | 1 | pfleura2 | WRITE(*,*) 'DBG ZBuild Lies_CF(IdAt0,0).ge.1', & |
277 | 1 | pfleura2 | Lies_CF(IdAt0,0),izm2 |
278 | 1 | pfleura2 | ELSE |
279 | 1 | pfleura2 | ! First atom is not linked to anything... we look for the second CP0 atom |
280 | 1 | pfleura2 | ! if we have one.. |
281 | 1 | pfleura2 | If (NbAt0r.ge.1) THEN |
282 | 1 | pfleura2 | IdAt0=0 |
283 | 1 | pfleura2 | VCF=-1 |
284 | 1 | pfleura2 | IF (DEBUG) WRITE(*,*) 'DBG ZBuild Izm=2:AtCP0', & |
285 | 1 | pfleura2 | (AtCP0(I),I=1,NbAt0) |
286 | 1 | pfleura2 | DO I=1,NbAt0 |
287 | 1 | pfleura2 | if (AtCP0(I).NE.0) THEN |
288 | 1 | pfleura2 | ICat=AtCP0(I) |
289 | 1 | pfleura2 | if (Lies_CF(I,0).gt.VCF) THEN |
290 | 1 | pfleura2 | Izm2=ICat |
291 | 1 | pfleura2 | IdxAt0=I |
292 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
293 | 1 | pfleura2 | END IF |
294 | 1 | pfleura2 | END IF |
295 | 1 | pfleura2 | END DO |
296 | 1 | pfleura2 | IF (DEBUG) WRITE(*,*) 'DBG ZBuild Izm=2:izm2,IdxAt0,VCF,AtCP0(1)', & |
297 | 1 | pfleura2 | izm2,IdxAt0,VCF,AtCP0(1) |
298 | 1 | pfleura2 | NbAt0r=NbAt0r-1 |
299 | 1 | pfleura2 | ELSE |
300 | 1 | pfleura2 | ! we do not have another CP0 atom... but we know that there |
301 | 1 | pfleura2 | ! is at least two atoms... we look for the closest atom to Izm1 |
302 | 1 | pfleura2 | Izm2=0 |
303 | 1 | pfleura2 | Dist=1.D99 |
304 | 1 | pfleura2 | DO I=1,Na |
305 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.Dejafait(I))) THEN |
306 | 1 | pfleura2 | CALL vecteur(IZm1,I,x,y,z,vx1,vy1,vz1,norm1) |
307 | 1 | pfleura2 | if (Norm1.lt.Dist) IZm2=I |
308 | 1 | pfleura2 | END IF |
309 | 1 | pfleura2 | END DO |
310 | 1 | pfleura2 | END IF |
311 | 1 | pfleura2 | END IF |
312 | 1 | pfleura2 | END IF |
313 | 1 | pfleura2 | CALL vecteur(IZm1,IZm2,x,y,z,vx1,vy1,vz1,norm1) |
314 | 1 | pfleura2 | |
315 | 1 | pfleura2 | Izm=Izm+1 |
316 | 1 | pfleura2 | |
317 | 1 | pfleura2 | ind_zmat(izm,1)=izm2 |
318 | 1 | pfleura2 | ind_zmat(izm,2)=izm1 |
319 | 1 | pfleura2 | ind_zmat(izm,3)=0 |
320 | 1 | pfleura2 | ind_zmat(izm,4)=0 |
321 | 1 | pfleura2 | ind_zmat(izm,5)=0 |
322 | 1 | pfleura2 | val_zmat(izm,1)=norm1 |
323 | 1 | pfleura2 | val_zmat(izm,2)=0.0 |
324 | 1 | pfleura2 | val_zmat(izm,3)=0.0 |
325 | 1 | pfleura2 | DejaFait(Izm2)=.TRUE. |
326 | 1 | pfleura2 | |
327 | 1 | pfleura2 | END IF ! end of izm==2 test |
328 | 1 | pfleura2 | |
329 | 1 | pfleura2 | Izm1=ind_zmat(1,1) |
330 | 1 | pfleura2 | Izm2=ind_zmat(2,1) |
331 | 1 | pfleura2 | |
332 | 1 | pfleura2 | ! Third atom |
333 | 1 | pfleura2 | |
334 | 1 | pfleura2 | IF ((Izm==2).AND.(NAtreat.ge.3)) THEN |
335 | 1 | pfleura2 | Done=.FALSE. |
336 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Treating Izm=3',FFirst |
337 | 1 | pfleura2 | ! Two cases: 1) We are constructing the first fragment: FIzm1=.T. |
338 | 1 | pfleura2 | ! 2) We are constructing the second fragment: FIzm1=.F. |
339 | 1 | pfleura2 | ! in this case, we select one CP0 atom to start with |
340 | 1 | pfleura2 | IF (FFirst) THEN |
341 | 1 | pfleura2 | FFirst=.FALSE. |
342 | 1 | pfleura2 | ! This is the first atom to be dealt with |
343 | 1 | pfleura2 | ! We look for a CP0 |
344 | 1 | pfleura2 | If (NbAt0r.ge.1) THEN |
345 | 1 | pfleura2 | IdAt0=0 |
346 | 1 | pfleura2 | VCF=-1 |
347 | 1 | pfleura2 | DO I=1,NbAt0 |
348 | 1 | pfleura2 | if (AtCP0(I).NE.0) THEN |
349 | 1 | pfleura2 | ICat=AtCP0(I) |
350 | 1 | pfleura2 | if (Lies_CF(I,0).gt.VCF) THEN |
351 | 1 | pfleura2 | Izm3=ICat |
352 | 1 | pfleura2 | IdxAt0=I |
353 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
354 | 1 | pfleura2 | END IF |
355 | 1 | pfleura2 | END IF |
356 | 1 | pfleura2 | END DO |
357 | 1 | pfleura2 | NbAt0r=NbAt0r-1 |
358 | 1 | pfleura2 | Done=.TRUE. |
359 | 1 | pfleura2 | END IF |
360 | 1 | pfleura2 | ! If we do not have a CP0 available the other tests are identical |
361 | 1 | pfleura2 | ! for cases 1 and 2... |
362 | 1 | pfleura2 | END IF |
363 | 1 | pfleura2 | IF (.NOT.Done) THEN |
364 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatBuild: Done false for izm=3' |
365 | 1 | pfleura2 | IF (Lies_CF(izm1,0).ge.2) THEN |
366 | 1 | pfleura2 | ! easiest case: the first atom is linked to at least 2 atoms. |
367 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmtB-izm3:Lies_CF(izm1,0)>=2 ' |
368 | 1 | pfleura2 | I=1 |
369 | 1 | pfleura2 | DO WHILE ((.NOT.ListAt(Lies_CF(izm1,I))) & |
370 | 1 | pfleura2 | .OR.(DejaFait(Lies_CF(izm1,I)))) |
371 | 1 | pfleura2 | I=I+1 |
372 | 1 | pfleura2 | END DO |
373 | 1 | pfleura2 | izm3=Lies_CF(Izm1,I) |
374 | 1 | pfleura2 | Done=.TRUE. |
375 | 1 | pfleura2 | ELSEIF (Lies_CF(Izm2,0).ge.1) THEN |
376 | 1 | pfleura2 | ! a bit more complex: first atom is linked to one atom (Izm2) |
377 | 1 | pfleura2 | ! but luckily 2nd atom is linked to at least one atom |
378 | 1 | pfleura2 | I=1 |
379 | 1 | pfleura2 | DO WHILE ((.NOT.ListAt(Lies_CF(izm2,I))) & |
380 | 1 | pfleura2 | .OR.(DejaFait(Lies_CF(izm2,I))).AND.(I.le.Lies_CF(Izm2,0))) |
381 | 1 | pfleura2 | I=I+1 |
382 | 1 | pfleura2 | END DO |
383 | 1 | pfleura2 | IF (I.LE.Lies_CF(Izm2,0)) THEN |
384 | 1 | pfleura2 | Izm3=Lies_CF(izm2,I) |
385 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmtB-izm3:Lies_CF(izm2,0)>=1 and ok ' |
386 | 1 | pfleura2 | ! We exchange Izm1 and Izm2 because the logical order is Izm3 linked |
387 | 1 | pfleura2 | ! to Izm2 and not to Izm1 as is the default later |
388 | 1 | pfleura2 | IzmTmp=Izm2 |
389 | 1 | pfleura2 | Izm2=Izm1 |
390 | 1 | pfleura2 | Izm1=IzmTmp |
391 | 1 | pfleura2 | Done=.TRUE. |
392 | 1 | pfleura2 | END IF |
393 | 1 | pfleura2 | END IF |
394 | 1 | pfleura2 | IF (.NOT.Done) THEN |
395 | 1 | pfleura2 | ! None of the first two atoms has links to a third atom... |
396 | 1 | pfleura2 | ! we take it from the CP0 if possible... |
397 | 1 | pfleura2 | If (NbAt0r.ge.1) THEN |
398 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatB izm=3',NbAt0r |
399 | 1 | pfleura2 | IdAt0=0 |
400 | 1 | pfleura2 | VCF=-1 |
401 | 1 | pfleura2 | DO I=1,NbAt0 |
402 | 1 | pfleura2 | if (AtCP0(I).NE.0) THEN |
403 | 1 | pfleura2 | ICat=AtCP0(I) |
404 | 1 | pfleura2 | if (Lies_CF(I,0).gt.VCF) THEN |
405 | 1 | pfleura2 | Izm3=ICat |
406 | 1 | pfleura2 | IdxAt0=I |
407 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
408 | 1 | pfleura2 | END IF |
409 | 1 | pfleura2 | END IF |
410 | 1 | pfleura2 | END DO |
411 | 1 | pfleura2 | NbAt0r=NbAt0r-1 |
412 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatB izm=3',NbAt0r,Izm3 |
413 | 1 | pfleura2 | ELSE |
414 | 1 | pfleura2 | ! Or the atom closest to 1 |
415 | 1 | pfleura2 | Izm3=0 |
416 | 1 | pfleura2 | Dist=1.D99 |
417 | 1 | pfleura2 | DO I=1,Na |
418 | 1 | pfleura2 | IF (ListAt(I).AND.(.NOT.Dejafait(I))) THEN |
419 | 1 | pfleura2 | CALL vecteur(IZm1,I,x,y,z,vx1,vy1,vz1,norm1) |
420 | 1 | pfleura2 | if (Norm1.lt.Dist) IZm3=I |
421 | 1 | pfleura2 | END IF |
422 | 1 | pfleura2 | END DO |
423 | 1 | pfleura2 | END IF |
424 | 1 | pfleura2 | END IF |
425 | 1 | pfleura2 | END IF |
426 | 1 | pfleura2 | |
427 | 1 | pfleura2 | CALL vecteur(IZm1,IZm2,x,y,z,vx1,vy1,vz1,norm1) |
428 | 1 | pfleura2 | CALL vecteur(izm1,izm3,x,y,z,vx2,vy2,vz2,norm2) |
429 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1,vx2,vy2,vz2,norm2) |
430 | 1 | pfleura2 | |
431 | 1 | pfleura2 | ! write(*,11) n1,n2,norm1,n3,val |
432 | 1 | pfleura2 | |
433 | 1 | pfleura2 | Izm=Izm+1 |
434 | 1 | pfleura2 | |
435 | 1 | pfleura2 | ind_zmat(izm,1)=izm3 |
436 | 1 | pfleura2 | ind_zmat(izm,2)=izm1 |
437 | 1 | pfleura2 | ind_zmat(izm,3)=izm2 |
438 | 1 | pfleura2 | ind_zmat(izm,4)=0 |
439 | 1 | pfleura2 | ind_zmat(izm,5)=0 |
440 | 1 | pfleura2 | val_zmat(izm,1)=norm2 |
441 | 1 | pfleura2 | val_zmat(izm,2)=val |
442 | 1 | pfleura2 | val_zmat(izm,3)=0.0 |
443 | 1 | pfleura2 | DejaFait(Izm3)=.TRUE. |
444 | 1 | pfleura2 | |
445 | 1 | pfleura2 | END IF ! end of test izm=3 |
446 | 1 | pfleura2 | |
447 | 1 | pfleura2 | ! We add all atoms CF atoms linked to the already present atoms in the zmat to |
448 | 1 | pfleura2 | ! the "to do" list: |
449 | 1 | pfleura2 | ! Les atomes CF lies a IdAt0 sont mis en attente pour |
450 | 1 | pfleura2 | ! etre traites |
451 | 1 | pfleura2 | |
452 | 1 | pfleura2 | ! For 'historical' reasons, the first atom links have to be dealt with |
453 | 1 | pfleura2 | ! in a special way... now ! |
454 | 1 | pfleura2 | |
455 | 1 | pfleura2 | if (Izm.ge.NaTreat) Return |
456 | 1 | pfleura2 | |
457 | 1 | pfleura2 | |
458 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatBuild Izm0',Izm0 |
459 | 1 | pfleura2 | |
460 | 1 | pfleura2 | if (debug) THEN |
461 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat' |
462 | 1 | pfleura2 | DO I=1,na |
463 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
464 | 1 | pfleura2 | END DO |
465 | 1 | pfleura2 | END IF |
466 | 1 | pfleura2 | |
467 | 1 | pfleura2 | IF (FFIrst) GOTO 9753 |
468 | 1 | pfleura2 | |
469 | 1 | pfleura2 | I=Ind_zmat(Izm0,1) |
470 | 1 | pfleura2 | DO IdAtl=1,Lies_CF(I,0) |
471 | 1 | pfleura2 | Izm4= Lies_CF(I,IdAtl) |
472 | 1 | pfleura2 | ! WRITE(IOOUT,*) 'Atome ',Izm+1,Izm4,Nom(Atome(Izm4)),Izm1, |
473 | 1 | pfleura2 | ! $Izm2,Izm3 |
474 | 1 | pfleura2 | IF (ListAt(Izm4).AND.(.NOT.DejaFait(Izm4))) THEN |
475 | 1 | pfleura2 | Izm=Izm+1 |
476 | 1 | pfleura2 | Call AddLigne(Izm,Izm4,Izm1,Izm2,Izm3,ind_zmat,val_zmat, & |
477 | 1 | pfleura2 | x,y,z) |
478 | 1 | pfleura2 | DejaFait(Izm4)=.TRUE. |
479 | 1 | pfleura2 | END IF |
480 | 1 | pfleura2 | END DO |
481 | 1 | pfleura2 | ! END IF |
482 | 1 | pfleura2 | |
483 | 1 | pfleura2 | if (debug) THEN |
484 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat' |
485 | 1 | pfleura2 | DO I=1,na |
486 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
487 | 1 | pfleura2 | END DO |
488 | 1 | pfleura2 | END IF |
489 | 1 | pfleura2 | |
490 | 1 | pfleura2 | if (Izm.ge.NaTreat) Return |
491 | 1 | pfleura2 | |
492 | 1 | pfleura2 | IndFin=1 |
493 | 1 | pfleura2 | DO I=Izm0,Izm |
494 | 1 | pfleura2 | Iat=ind_zmat(I,1) |
495 | 1 | pfleura2 | ! Do iaf=1,Lies_CF(Iat,0) |
496 | 1 | pfleura2 | !! if (ListAt(Lies_CF(IAt,iaf)).AND. |
497 | 1 | pfleura2 | !! & (.NOT.DejaFait(Lies_CF(IAt,iaf)))) THEN |
498 | 1 | pfleura2 | ! if (ListAt(Lies_CF(IAt,iaf))) THEN |
499 | 1 | pfleura2 | ! CAfaire(IndFin)=Lies_CF(IAt,Iaf) |
500 | 1 | pfleura2 | CaFaire(IndFin)=Iat |
501 | 1 | pfleura2 | IndFin=IndFin+1 |
502 | 1 | pfleura2 | ! END IF |
503 | 1 | pfleura2 | ! END DO |
504 | 1 | pfleura2 | END DO |
505 | 1 | pfleura2 | CAfaire(IndFin)=0 |
506 | 1 | pfleura2 | |
507 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
508 | 1 | pfleura2 | |
509 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Treating Izm=4' |
510 | 1 | pfleura2 | |
511 | 1 | pfleura2 | ! on a cree la premiere couche autour du premier centre |
512 | 1 | pfleura2 | ! reste a finir les autres couches |
513 | 1 | pfleura2 | IndAFaire=1 |
514 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
515 | 1 | pfleura2 | Do WHILE (Cafaire(IndAFaire).ne.0) |
516 | 1 | pfleura2 | IAt0=Cafaire(IndAfaire) |
517 | 1 | pfleura2 | if (debug) WRITE(*,*) "IndAFaire,IAt0,Lies_CF(IAt0,0)", & |
518 | 1 | pfleura2 | IndAFaire,IAt0,Lies_CF(IAt0,0) |
519 | 1 | pfleura2 | if (Lies_CF(IAt0,0).ge.1) THEN |
520 | 1 | pfleura2 | ! IAt0 est l'atome pour lequel on construit la couche suivante |
521 | 1 | pfleura2 | ! le premier atome lie est particulier car il definit l'orientation |
522 | 1 | pfleura2 | ! de ce fragment |
523 | 1 | pfleura2 | IAti=Lies_CF(IAt0,1) |
524 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAti:',IAti |
525 | 1 | pfleura2 | IAtd=IAt0 |
526 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtd:',IAtd |
527 | 1 | pfleura2 | IAtv=Lies_CP(IAt0,1) |
528 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtv:',IAtv |
529 | 1 | pfleura2 | IIAtdh=1 |
530 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
531 | 1 | pfleura2 | DO WHILE (Iatdh.eq.IAt0) |
532 | 1 | pfleura2 | IIatdh=IIatdh+1 |
533 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
534 | 1 | pfleura2 | END DO |
535 | 1 | pfleura2 | IF (IAtdh.eq.0) IAtdh=Lies_CP(IAtv,1) |
536 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtdh:',IAtdh |
537 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
538 | 1 | pfleura2 | Izm=Izm+1 |
539 | 1 | pfleura2 | if (debug) WRITE(*,*) 'izm,IAti,IAtd,IAtv,IAtdh', & |
540 | 1 | pfleura2 | izm,IAti,IAtd,IAtv,IAtdh |
541 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
542 | 1 | pfleura2 | ind_zmat,val_zmat ,x,y,z) |
543 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
544 | 1 | pfleura2 | END IF |
545 | 1 | pfleura2 | |
546 | 1 | pfleura2 | CAfaire(IndFin)=Lies_CF(IAt0,1) |
547 | 1 | pfleura2 | IndFin=IndFin+1 |
548 | 1 | pfleura2 | ! Le traitement des autres est plus facile |
549 | 1 | pfleura2 | IAtdh=Lies_CF(IAt0,1) |
550 | 1 | pfleura2 | DO IAta=2,Lies_CF(IAt0,0) |
551 | 1 | pfleura2 | IAtI=Lies_CF(IAt0,IAta) |
552 | 1 | pfleura2 | CAfaire(IndFin)=IAtI |
553 | 1 | pfleura2 | IndFin=IndFin+1 |
554 | 1 | pfleura2 | |
555 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
556 | 1 | pfleura2 | Izm=Izm+1 |
557 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh,ind_zmat & |
558 | 1 | pfleura2 | ,val_zmat,x,y,z) |
559 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
560 | 1 | pfleura2 | END IF |
561 | 1 | pfleura2 | END DO |
562 | 1 | pfleura2 | CAfaire(IndFin)=0 |
563 | 1 | pfleura2 | END IF |
564 | 1 | pfleura2 | IndAFaire=IndAFaire+1 |
565 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "IndAfaire,CaFaire:",IndAfaire, & |
566 | 1 | pfleura2 | CaFaire |
567 | 1 | pfleura2 | END DO |
568 | 1 | pfleura2 | |
569 | 1 | pfleura2 | IndFin=1 |
570 | 1 | pfleura2 | DO I=1,Izm0 |
571 | 1 | pfleura2 | Iat=ind_zmat(I,1) |
572 | 1 | pfleura2 | ! Do iaf=1,Lies_CF(Iat,0) |
573 | 1 | pfleura2 | if (ListAt(IAt).AND. & |
574 | 1 | pfleura2 | (.NOT.DejaFait(IAt))) THEN |
575 | 1 | pfleura2 | ! if (ListAt(Lies_CF(IAt,iaf))) THEN |
576 | 1 | pfleura2 | ! CAfaire(IndFin)=Lies_CF(IAt,Iaf) |
577 | 1 | pfleura2 | CaFaire(IndFin)=Iat |
578 | 1 | pfleura2 | IndFin=IndFin+1 |
579 | 1 | pfleura2 | END IF |
580 | 1 | pfleura2 | ! END DO |
581 | 1 | pfleura2 | END DO |
582 | 1 | pfleura2 | CAfaire(IndFin)=0 |
583 | 1 | pfleura2 | |
584 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
585 | 1 | pfleura2 | |
586 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Treating Izm=4' |
587 | 1 | pfleura2 | |
588 | 1 | pfleura2 | ! on a cree la premiere couche autour du premier centre |
589 | 1 | pfleura2 | ! reste a finir les autres couches |
590 | 1 | pfleura2 | IndAFaire=1 |
591 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
592 | 1 | pfleura2 | Do WHILE (Cafaire(IndAFaire).ne.0) |
593 | 1 | pfleura2 | IAt0=Cafaire(IndAfaire) |
594 | 1 | pfleura2 | if (debug) WRITE(*,*) "IndAFaire,IAt0,Lies_CF(IAt0,0)", & |
595 | 1 | pfleura2 | IndAFaire,IAt0,Lies_CF(IAt0,0) |
596 | 1 | pfleura2 | if (Lies_CF(IAt0,0).ge.1) THEN |
597 | 1 | pfleura2 | ! IAt0 est l'atome pour lequel on construit la couche suivante |
598 | 1 | pfleura2 | ! le premier atome lie est particulier car il definit l'orientation |
599 | 1 | pfleura2 | ! de ce fragment |
600 | 1 | pfleura2 | IAti=Lies_CF(IAt0,1) |
601 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAti:',IAti |
602 | 1 | pfleura2 | IAtd=IAt0 |
603 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtd:',IAtd |
604 | 1 | pfleura2 | IAtv=Lies_CP(IAt0,1) |
605 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtv:',IAtv |
606 | 1 | pfleura2 | IIAtdh=1 |
607 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
608 | 1 | pfleura2 | DO WHILE (Iatdh.eq.IAt0) |
609 | 1 | pfleura2 | IIatdh=IIatdh+1 |
610 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
611 | 1 | pfleura2 | END DO |
612 | 1 | pfleura2 | IF (IAtdh.eq.0) IAtdh=Lies_CP(IAtv,1) |
613 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtdh:',IAtdh |
614 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
615 | 1 | pfleura2 | Izm=Izm+1 |
616 | 1 | pfleura2 | if (debug) WRITE(*,*) 'izm,IAti,IAtd,IAtv,IAtdh', & |
617 | 1 | pfleura2 | izm,IAti,IAtd,IAtv,IAtdh |
618 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
619 | 1 | pfleura2 | ind_zmat,val_zmat ,x,y,z) |
620 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
621 | 1 | pfleura2 | END IF |
622 | 1 | pfleura2 | |
623 | 1 | pfleura2 | CAfaire(IndFin)=Lies_CF(IAt0,1) |
624 | 1 | pfleura2 | IndFin=IndFin+1 |
625 | 1 | pfleura2 | ! Le traitement des autres est plus facile |
626 | 1 | pfleura2 | IAtdh=Lies_CF(IAt0,1) |
627 | 1 | pfleura2 | DO IAta=2,Lies_CF(IAt0,0) |
628 | 1 | pfleura2 | IAtI=Lies_CF(IAt0,IAta) |
629 | 1 | pfleura2 | CAfaire(IndFin)=IAtI |
630 | 1 | pfleura2 | IndFin=IndFin+1 |
631 | 1 | pfleura2 | |
632 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
633 | 1 | pfleura2 | Izm=Izm+1 |
634 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh,ind_zmat & |
635 | 1 | pfleura2 | ,val_zmat,x,y,z) |
636 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
637 | 1 | pfleura2 | END IF |
638 | 1 | pfleura2 | END DO |
639 | 1 | pfleura2 | CAfaire(IndFin)=0 |
640 | 1 | pfleura2 | END IF |
641 | 1 | pfleura2 | IndAFaire=IndAFaire+1 |
642 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "IndAfaire,CaFaire:",IndAfaire, & |
643 | 1 | pfleura2 | CaFaire |
644 | 1 | pfleura2 | END DO |
645 | 1 | pfleura2 | |
646 | 1 | pfleura2 | |
647 | 1 | pfleura2 | ! On a fini de creer la molecule autour du premier atome 'centre' |
648 | 1 | pfleura2 | ! Pour les autres c'est presque id... sauf que les axes sont deja fixes |
649 | 1 | pfleura2 | ! On pourrait imaginer de mettre des atomes fictifs pour redefinir des axes |
650 | 1 | pfleura2 | ! locaux... dans une autre version |
651 | 1 | pfleura2 | ! V2.0 |
652 | 1 | pfleura2 | 9753 FFirst=.FALSE. |
653 | 1 | pfleura2 | if (debug) THEN |
654 | 1 | pfleura2 | WRITE(*,*) 'NbAt0r',NbAt0r,AtCP0 |
655 | 1 | pfleura2 | END IF |
656 | 1 | pfleura2 | DO I=1,NbAt0r |
657 | 1 | pfleura2 | ! Boucle pour trouver celui qui a le plus d'atomes CF |
658 | 1 | pfleura2 | IdAt0=0 |
659 | 1 | pfleura2 | VCF=-1 |
660 | 1 | pfleura2 | DO ICP0=1,NbAt0 |
661 | 1 | pfleura2 | if (AtCP0(ICP0).NE.0) THEN |
662 | 1 | pfleura2 | ICat=AtCP0(ICP0) |
663 | 1 | pfleura2 | if (Lies_CF(ICAt,0).gt.VCF) THEN |
664 | 1 | pfleura2 | IdAt0=ICat |
665 | 1 | pfleura2 | IdxAt0=ICP0 |
666 | 1 | pfleura2 | VCF=Lies_CF(ICAt,0) |
667 | 1 | pfleura2 | END IF |
668 | 1 | pfleura2 | END IF |
669 | 1 | pfleura2 | END DO |
670 | 1 | pfleura2 | AtCP0(IdxAt0)=0 |
671 | 1 | pfleura2 | |
672 | 1 | pfleura2 | IF (debug) WRITE(*,*) 'Adding fragment centered on ',IdAt0, & |
673 | 1 | pfleura2 | LIAISONS(IdAt0,0) |
674 | 1 | pfleura2 | IF (debug) WRITE(*,*) 'Center linked to ',Lies_CF(IdAt0,0), & |
675 | 1 | pfleura2 | ' atoms' |
676 | 1 | pfleura2 | ! if (LIAISONS(IdAt0,0).EQ.0) goto 12345 |
677 | 1 | pfleura2 | |
678 | 1 | pfleura2 | if (debug) THEN |
679 | 1 | pfleura2 | WRITE(IOOUT,*) 'LIAISONS tralala',nbcycle |
680 | 1 | pfleura2 | DO IAt=1,na |
681 | 1 | pfleura2 | WRITE(IOOUT,1003) iat,(LIAISONS(Iat,Jat),Jat=0,NMaxL) |
682 | 1 | pfleura2 | END DO |
683 | 1 | pfleura2 | END IF |
684 | 1 | pfleura2 | 1003 FORMAT(1X,I5,' - ',12(I5)) |
685 | 1 | pfleura2 | ! Boucle pour voir quel est l'atome du fragment precedent qui est le plus |
686 | 1 | pfleura2 | ! proche de celui ci |
687 | 1 | pfleura2 | ! Rq: si ce sont des cycles lies, il pourrait etre malin de rechercher |
688 | 1 | pfleura2 | ! a quoi il etait lie. |
689 | 1 | pfleura2 | norm2=1.e6 |
690 | 1 | pfleura2 | Idx=0 |
691 | 1 | pfleura2 | DO ICAt=1,Izm |
692 | 1 | pfleura2 | CALL vecteur(Idat0,ind_zmat(icat,1),x,y,z,vx1,vy1,vz1 & |
693 | 1 | pfleura2 | ,norm1) |
694 | 1 | pfleura2 | if (norm2.ge.norm1) THEN |
695 | 1 | pfleura2 | norm2=norm1 |
696 | 1 | pfleura2 | Idx=Icat |
697 | 1 | pfleura2 | END IF |
698 | 1 | pfleura2 | END DO |
699 | 1 | pfleura2 | IF (debug) WRITE(*,*) 'Link between fragments ',IdAt0, & |
700 | 1 | pfleura2 | ind_zmat(Idx,1), ' -- Idx=',Idx |
701 | 1 | pfleura2 | |
702 | 1 | pfleura2 | ! Despite the fact that this atom has officialy no CP atom |
703 | 1 | pfleura2 | ! we add one into its list; the one just found |
704 | 1 | pfleura2 | Lies_CP(IdAt0,0)=Lies_CP(IdAt0,0)+1 |
705 | 1 | pfleura2 | Lies_CP(Idat0,Lies_CP(IdAt0,0))= ind_zmat(Idx,1) |
706 | 1 | pfleura2 | Lies_CP(Idat0,Lies_CP(IdAt0,0)+1)=0 |
707 | 1 | pfleura2 | |
708 | 1 | pfleura2 | |
709 | 1 | pfleura2 | ! on a l'indice... on va rajouter cet atome a la liste ! |
710 | 1 | pfleura2 | izm=izm+1 |
711 | 1 | pfleura2 | n1=ind_zmat(Idx,1) |
712 | 1 | pfleura2 | ! Petit probleme si Idx<=2 |
713 | 1 | pfleura2 | IF (Idx.EQ.1) THEN |
714 | 1 | pfleura2 | ! Pb non negligeable ... |
715 | 1 | pfleura2 | IF (izm.ge.2) THEN |
716 | 1 | pfleura2 | IAtv=ind_zmat(2,1) |
717 | 1 | pfleura2 | IAtdh=ind_zmat(3,1) |
718 | 1 | pfleura2 | ELSE |
719 | 1 | pfleura2 | WRITE(*,*) '2 frag, le 1er a moins de 2 atomes..' |
720 | 1 | pfleura2 | WRITE(*,*) "J'ai merde... " |
721 | 1 | pfleura2 | STOP |
722 | 1 | pfleura2 | END IF |
723 | 1 | pfleura2 | ELSEIF (Idx.EQ.2) THEN |
724 | 1 | pfleura2 | IAtv=1 |
725 | 1 | pfleura2 | IF (izm.ge.2) THEN |
726 | 1 | pfleura2 | IAtdh=ind_zmat(3,1) |
727 | 1 | pfleura2 | ELSE |
728 | 1 | pfleura2 | WRITE(*,*) '2 frag, le 1er a moins de 2 atomes...' |
729 | 1 | pfleura2 | WRITE(*,*) "J'ai merde... " |
730 | 1 | pfleura2 | STOP |
731 | 1 | pfleura2 | END IF |
732 | 1 | pfleura2 | ELSE |
733 | 1 | pfleura2 | IAtv=ind_zmat(Idx,2) |
734 | 1 | pfleura2 | IAtdh=ind_zmat(Idx,3) |
735 | 1 | pfleura2 | END IF |
736 | 1 | pfleura2 | |
737 | 1 | pfleura2 | ! WRITE(*,*) "Outchilou IAtv, IAtdh", IAtv, IAtdh,n1 |
738 | 1 | pfleura2 | CALL vecteur(n1,IdAt0,x,y,z,vx1,vy1,vz1,norm1) |
739 | 1 | pfleura2 | CALL vecteur(n1,IAtv,x,y,z,vx2,vy2,vz2,norm2) |
740 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1, & |
741 | 1 | pfleura2 | vx2,vy2,vz2,norm2) |
742 | 1 | pfleura2 | if (debug) WRITE(*,*) 'Angle val:1',IdAt0,n1,IAtv,val |
743 | 1 | pfleura2 | if ((abs(val).LE.10.).OR.(abs(pi-val).le.10.)) THEN |
744 | 1 | pfleura2 | IAtv=IAtdh |
745 | 1 | pfleura2 | ! Ceci pose pb si Idx<=3... a traiter plus tard |
746 | 1 | pfleura2 | IF (Idx.ge.3) THEN |
747 | 1 | pfleura2 | IAtdh=ind_zmat(Idx,4) |
748 | 1 | pfleura2 | ELSE |
749 | 1 | pfleura2 | if (izm.ge.4) THEN |
750 | 1 | pfleura2 | IAtdh=4 |
751 | 1 | pfleura2 | ELSE |
752 | 1 | pfleura2 | WRITE(*,*) 'Pb Angle Val+idx=3+izm<=4' |
753 | 1 | pfleura2 | STOP |
754 | 1 | pfleura2 | END IF |
755 | 1 | pfleura2 | END IF |
756 | 1 | pfleura2 | END IF |
757 | 1 | pfleura2 | Call AddLigne(Izm,IdAt0,ind_zmat(Idx,1),IAtv,IAtdh, & |
758 | 1 | pfleura2 | ind_zmat,val_zmat,x,y,z) |
759 | 1 | pfleura2 | DejaFait(IdAt0)=.TRUE. |
760 | 1 | pfleura2 | |
761 | 1 | pfleura2 | IndFin=1 |
762 | 1 | pfleura2 | IAtd=IdAt0 |
763 | 1 | pfleura2 | n1=IAtdh |
764 | 1 | pfleura2 | IAtdh=IAtv |
765 | 1 | pfleura2 | IAtv=ind_zmat(Idx,1) |
766 | 1 | pfleura2 | ! On ajoute les atomes lies a cet atome dans la liste a faire |
767 | 1 | pfleura2 | Do iaf=1,Lies_CF(IdAt0,0) |
768 | 1 | pfleura2 | IatI=Lies_CF(IdAt0,Iaf) |
769 | 1 | pfleura2 | ! We check that this atom is not the one that is the closest to |
770 | 1 | pfleura2 | ! the center atom |
771 | 1 | pfleura2 | if (IAtv.Ne.IAtI) THEN |
772 | 1 | pfleura2 | IF (debug) WRITE(*,*) 'Adding atom',IAtI, & |
773 | 1 | pfleura2 | 'to CAFaire in pos',iaf |
774 | 1 | pfleura2 | CAfaire(IndFin)=IAtI |
775 | 1 | pfleura2 | IndFin=IndFin+1 |
776 | 1 | pfleura2 | ! On les ajoute aussi dans la zmat |
777 | 1 | pfleura2 | If (ListAt(IAtI).AND.(.NOT.DejaFait(IatI))) THEN |
778 | 1 | pfleura2 | izm=izm+1 |
779 | 1 | pfleura2 | WRITE(*,*) "Outchili IAtv, IAtdh,IAtI", IAtv, IAtdh,IAtI |
780 | 1 | pfleura2 | CALL vecteur(IAtI,IAtD,x,y,z,vx1,vy1,vz1,norm1) |
781 | 1 | pfleura2 | CALL vecteur(IAtI,IAtv,x,y,z,vx2,vy2,vz2,norm2) |
782 | 1 | pfleura2 | val=angle(vx1,vy1,vz1,norm1, vx2,vy2,vz2,norm2) |
783 | 1 | pfleura2 | if (debug) & |
784 | 1 | pfleura2 | WRITE(*,*) 'Angle val:2',IAtI,IAtD,IAtv,val |
785 | 1 | pfleura2 | if ((abs(val).LE.10.).OR. & |
786 | 1 | pfleura2 | (abs(180.-abs(val)).le.10.)) THEN |
787 | 1 | pfleura2 | Call AddLigne(Izm,IAtI,IAtv,IAtdh,n1, & |
788 | 1 | pfleura2 | ind_zmat,val_zmat,x,y,z) |
789 | 1 | pfleura2 | DejaFait(Iati)=.TRUE. |
790 | 1 | pfleura2 | ELSE |
791 | 1 | pfleura2 | Call AddLigne(Izm,IAtI,IAtD,IAtv,IAtdh, & |
792 | 1 | pfleura2 | ind_zmat,val_zmat,x,y,z) |
793 | 1 | pfleura2 | DejaFait(Iati)=.TRUE. |
794 | 1 | pfleura2 | END IF |
795 | 1 | pfleura2 | END IF |
796 | 1 | pfleura2 | END IF |
797 | 1 | pfleura2 | END DO |
798 | 1 | pfleura2 | CAfaire(IndFin)=0 |
799 | 1 | pfleura2 | |
800 | 1 | pfleura2 | ! On traite le reste de ce fragment !! |
801 | 1 | pfleura2 | IndAFaire=1 |
802 | 1 | pfleura2 | WRITE(IOOUT,*) CaFaire |
803 | 1 | pfleura2 | Do WHILE (Cafaire(IndAFaire).ne.0) |
804 | 1 | pfleura2 | IAt0=Cafaire(IndAfaire) |
805 | 1 | pfleura2 | if (Lies_CF(IAt0,0).ge.1) THEN |
806 | 1 | pfleura2 | ! IAt0 est l'atome pour lequel on construit la couche suivante |
807 | 1 | pfleura2 | ! le premier atome lie est particulier car il definit l'orientation |
808 | 1 | pfleura2 | ! de ce fragment |
809 | 1 | pfleura2 | Itmp=1 |
810 | 1 | pfleura2 | IAti=Lies_CF(IAt0,Itmp) |
811 | 1 | pfleura2 | DO WHILE (DejaFait(IAti).AND. & |
812 | 1 | pfleura2 | (Itmp.Le.Lies_CF(IAt0,0))) |
813 | 1 | pfleura2 | Itmp=Itmp+1 |
814 | 1 | pfleura2 | IAti=Lies_CF(IAt0,ITmp) |
815 | 1 | pfleura2 | END DO |
816 | 1 | pfleura2 | If (ListAt(IAtI).AND.(.NOT.DejaFait(IatI))) THEN |
817 | 1 | pfleura2 | IF (debug) WRITE(IOOUT,*) 'IAti:',IAti |
818 | 1 | pfleura2 | IAtd=IAt0 |
819 | 1 | pfleura2 | IF (debug) WRITE(IOOUT,*) 'IAtd:',IAtd |
820 | 1 | pfleura2 | IAtv=Lies_CP(IAt0,1) |
821 | 1 | pfleura2 | IF (debug) WRITE(IOOUT,*) 'IAtv:',IAtv |
822 | 1 | pfleura2 | IIAtdh=1 |
823 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
824 | 1 | pfleura2 | DO WHILE (Iatdh.eq.IAt0) |
825 | 1 | pfleura2 | IIatdh=IIatdh+1 |
826 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
827 | 1 | pfleura2 | END DO |
828 | 1 | pfleura2 | IF (IAtdh.eq.0) IAtdh=Lies_CP(IAtv,1) |
829 | 1 | pfleura2 | IF (debug) WRITE(IOOUT,*) 'IAtdh:',IAtdh |
830 | 1 | pfleura2 | Izm=Izm+1 |
831 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
832 | 1 | pfleura2 | ind_zmat,val_zmat,x,y,z) |
833 | 1 | pfleura2 | DejaFait(Iati)=.TRUE. |
834 | 1 | pfleura2 | ! Le traitement des autres est plus facile |
835 | 1 | pfleura2 | IAtdh=Lies_CF(IAt0,ITmp) |
836 | 1 | pfleura2 | DO IAta=ITmp+1,Lies_CF(IAt0,0) |
837 | 1 | pfleura2 | IAtI=Lies_CF(IAt0,IAta) |
838 | 1 | pfleura2 | If (ListAt(IAtI).AND.(.NOT.DejaFait(IatI))) & |
839 | 1 | pfleura2 | THEN |
840 | 1 | pfleura2 | Izm=Izm+1 |
841 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
842 | 1 | pfleura2 | ind_zmat,val_zmat,x,y,z) |
843 | 1 | pfleura2 | DejaFait(Iati)=.TRUE. |
844 | 1 | pfleura2 | END IF |
845 | 1 | pfleura2 | END DO |
846 | 1 | pfleura2 | END IF |
847 | 1 | pfleura2 | |
848 | 1 | pfleura2 | ! On ajoute les atomes lies a cet atome dans la liste a faire |
849 | 1 | pfleura2 | Do iaf=1,Lies_CF(IAt0,0) |
850 | 1 | pfleura2 | CAfaire(IndFin)=Lies_CF(IAt0,Iaf) |
851 | 1 | pfleura2 | IndFin=IndFin+1 |
852 | 1 | pfleura2 | END DO |
853 | 1 | pfleura2 | CAfaire(IndFin)=0 |
854 | 1 | pfleura2 | END IF |
855 | 1 | pfleura2 | IndAFaire=IndAFaire+1 |
856 | 1 | pfleura2 | END DO |
857 | 2 | pfleura2 | !12345 CONTINUE |
858 | 1 | pfleura2 | END DO |
859 | 1 | pfleura2 | |
860 | 1 | pfleura2 | WRITE(*,*) 'TOTOTOTOTOTOTOTOT' |
861 | 1 | pfleura2 | |
862 | 1 | pfleura2 | if (debug) THEN |
863 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat' |
864 | 1 | pfleura2 | DO I=1,na |
865 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
866 | 1 | pfleura2 | END DO |
867 | 1 | pfleura2 | END IF |
868 | 1 | pfleura2 | |
869 | 1 | pfleura2 | IndFin=1 |
870 | 1 | pfleura2 | DO I=1,Izm0 |
871 | 1 | pfleura2 | Iat=ind_zmat(I,1) |
872 | 1 | pfleura2 | Do iaf=1,Lies_CF(Iat,0) |
873 | 1 | pfleura2 | IIat=Lies_CF(Iat,iaf) |
874 | 1 | pfleura2 | if (ListAt(iIAt).AND. & |
875 | 1 | pfleura2 | (.NOT.DejaFait(iIAt))) THEN |
876 | 1 | pfleura2 | IAti=IIat |
877 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAti:',IAti |
878 | 1 | pfleura2 | IAtd=IAt0 |
879 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtd:',IAtd |
880 | 1 | pfleura2 | IAtv=Lies_CP(IAt0,1) |
881 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtv:',IAtv |
882 | 1 | pfleura2 | IIAtdh=1 |
883 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
884 | 1 | pfleura2 | DO WHILE (Iatdh.eq.IAt0) |
885 | 1 | pfleura2 | IIatdh=IIatdh+1 |
886 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
887 | 1 | pfleura2 | END DO |
888 | 1 | pfleura2 | IF (IAtdh.eq.0) IAtdh=Lies_CP(IAtv,1) |
889 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtdh:',IAtdh |
890 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
891 | 1 | pfleura2 | Izm=Izm+1 |
892 | 1 | pfleura2 | if (debug) WRITE(*,*) 'izm,IAti,IAtd,IAtv,IAtdh', & |
893 | 1 | pfleura2 | izm,IAti,IAtd,IAtv,IAtdh |
894 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
895 | 1 | pfleura2 | ind_zmat,val_zmat ,x,y,z) |
896 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
897 | 1 | pfleura2 | CaFaire(IndFin)=iIat |
898 | 1 | pfleura2 | IndFin=IndFin+1 |
899 | 1 | pfleura2 | END IF |
900 | 1 | pfleura2 | END IF |
901 | 1 | pfleura2 | END DO |
902 | 1 | pfleura2 | END DO |
903 | 1 | pfleura2 | CAfaire(IndFin)=0 |
904 | 1 | pfleura2 | |
905 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
906 | 1 | pfleura2 | |
907 | 1 | pfleura2 | if (debug) WRITE(*,*) 'DBG ZmatBuil - Toto' |
908 | 1 | pfleura2 | if (debug) THEN |
909 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat' |
910 | 1 | pfleura2 | DO I=1,na |
911 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
912 | 1 | pfleura2 | END DO |
913 | 1 | pfleura2 | END IF |
914 | 1 | pfleura2 | |
915 | 1 | pfleura2 | ! on a cree la premiere couche autour du premier centre |
916 | 1 | pfleura2 | ! reste a finir les autres couches |
917 | 1 | pfleura2 | IndAFaire=1 |
918 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "CaFaire:",CaFaire |
919 | 1 | pfleura2 | Do WHILE (Cafaire(IndAFaire).ne.0) |
920 | 1 | pfleura2 | IAt0=Cafaire(IndAfaire) |
921 | 1 | pfleura2 | if (debug) WRITE(*,*) "IndAFaire,IAt0,Lies_CF(IAt0,0)", & |
922 | 1 | pfleura2 | IndAFaire,IAt0,Lies_CF(IAt0,0) |
923 | 1 | pfleura2 | if (Lies_CF(IAt0,0).ge.1) THEN |
924 | 1 | pfleura2 | ! IAt0 est l'atome pour lequel on construit la couche suivante |
925 | 1 | pfleura2 | ! le premier atome lie est particulier car il definit l'orientation |
926 | 1 | pfleura2 | ! de ce fragment |
927 | 1 | pfleura2 | IAti=Lies_CF(IAt0,1) |
928 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAti:',IAti |
929 | 1 | pfleura2 | IAtd=IAt0 |
930 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtd:',IAtd |
931 | 1 | pfleura2 | IAtv=Lies_CP(IAt0,1) |
932 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtv:',IAtv |
933 | 1 | pfleura2 | IIAtdh=1 |
934 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
935 | 1 | pfleura2 | DO WHILE (Iatdh.eq.IAt0) |
936 | 1 | pfleura2 | IIatdh=IIatdh+1 |
937 | 1 | pfleura2 | IAtdh=Lies_CF(IAtv,IIatdh) |
938 | 1 | pfleura2 | END DO |
939 | 1 | pfleura2 | IF (IAtdh.eq.0) IAtdh=Lies_CP(IAtv,1) |
940 | 1 | pfleura2 | WRITE(IOOUT,*) 'IAtdh:',IAtdh |
941 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
942 | 1 | pfleura2 | Izm=Izm+1 |
943 | 1 | pfleura2 | if (debug) WRITE(*,*) 'izm,IAti,IAtd,IAtv,IAtdh', & |
944 | 1 | pfleura2 | izm,IAti,IAtd,IAtv,IAtdh |
945 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh, & |
946 | 1 | pfleura2 | ind_zmat,val_zmat ,x,y,z) |
947 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
948 | 1 | pfleura2 | END IF |
949 | 1 | pfleura2 | |
950 | 1 | pfleura2 | CAfaire(IndFin)=Lies_CF(IAt0,1) |
951 | 1 | pfleura2 | IndFin=IndFin+1 |
952 | 1 | pfleura2 | ! Le traitement des autres est plus facile |
953 | 1 | pfleura2 | IAtdh=Lies_CF(IAt0,1) |
954 | 1 | pfleura2 | DO IAta=2,Lies_CF(IAt0,0) |
955 | 1 | pfleura2 | IAtI=Lies_CF(IAt0,IAta) |
956 | 1 | pfleura2 | CAfaire(IndFin)=IAtI |
957 | 1 | pfleura2 | IndFin=IndFin+1 |
958 | 1 | pfleura2 | |
959 | 1 | pfleura2 | IF (ListAt(IAti).AND.(.NOT.DejaFait(IAti))) THEN |
960 | 1 | pfleura2 | IF (debug) & |
961 | 1 | pfleura2 | WRITE(*,*) 'DBG ZmatBuil Toto adding',Iati,Izm |
962 | 1 | pfleura2 | Izm=Izm+1 |
963 | 1 | pfleura2 | Call AddLigne(Izm,IAti,IAtd,IAtv,IAtdh,ind_zmat & |
964 | 1 | pfleura2 | ,val_zmat,x,y,z) |
965 | 1 | pfleura2 | DejaFait(IAti)=.TRUE. |
966 | 1 | pfleura2 | END IF |
967 | 1 | pfleura2 | END DO |
968 | 1 | pfleura2 | CAfaire(IndFin)=0 |
969 | 1 | pfleura2 | END IF |
970 | 1 | pfleura2 | IndAFaire=IndAFaire+1 |
971 | 1 | pfleura2 | if (debug) WRITE(IOOUT,*) "Toto IndAfaire,CaFaire:",IndAfaire, & |
972 | 1 | pfleura2 | CaFaire |
973 | 1 | pfleura2 | END DO |
974 | 1 | pfleura2 | |
975 | 1 | pfleura2 | |
976 | 1 | pfleura2 | if (debug) THEN |
977 | 1 | pfleura2 | WRITE(*,*) 'ind_zmat' |
978 | 1 | pfleura2 | DO I=1,na |
979 | 1 | pfleura2 | WRITE(*,'(1X,5I5)') (ind_zmat(i,j),j=1,5) |
980 | 1 | pfleura2 | END DO |
981 | 1 | pfleura2 | END IF |
982 | 1 | pfleura2 | |
983 | 1 | pfleura2 | END |