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