root / utils / Xyz2Scan.f90 @ 9
Historique | Voir | Annoter | Télécharger (19,06 ko)
| 1 | 1 | pfleura2 | program Xyz2irc |
|---|---|---|---|
| 2 | 1 | pfleura2 | ! This programs reads a XYZ file and converts it into distances, |
| 3 | 1 | pfleura2 | ! valence angle and dihedral angles. |
| 4 | 1 | pfleura2 | ! It prints them as a function of the irc distance... |
| 5 | 1 | pfleura2 | !----------------------------------------------- |
| 6 | 1 | pfleura2 | ! Input: name of the ROOT file of PAW |
| 7 | 1 | pfleura2 | ! it also needs a file call list which has the following structure: |
| 8 | 1 | pfleura2 | ! the first line gives the time when you want to start your analysis |
| 9 | 1 | pfleura2 | ! one line contains the type of the value you want to follow, it can be |
| 10 | 1 | pfleura2 | ! b for a Bond distance |
| 11 | 1 | pfleura2 | ! a for an angle |
| 12 | 1 | pfleura2 | ! d for a dihedral |
| 13 | 1 | pfleura2 | ! this descriptor is followed by the number of the atoms involved ! |
| 14 | 1 | pfleura2 | ! a typical file can be: |
| 15 | 1 | pfleura2 | ! 3. |
| 16 | 1 | pfleura2 | ! b 1 2 |
| 17 | 1 | pfleura2 | ! b 2 3 |
| 18 | 1 | pfleura2 | ! a 1 2 3 |
| 19 | 1 | pfleura2 | !---------------------------------------------- |
| 20 | 1 | pfleura2 | ! Ouput: A files call Scan.dat |
| 21 | 1 | pfleura2 | ! wich contains in the first lines the input file (as a reminder) |
| 22 | 1 | pfleura2 | ! and then for each step the wanted values |
| 23 | 1 | pfleura2 | !------------------------------------------------ |
| 24 | 1 | pfleura2 | ! Second version also reads the energy (as to be written after E= on |
| 25 | 1 | pfleura2 | ! the comment line) |
| 26 | 1 | pfleura2 | !------------------------------------------------ |
| 27 | 1 | pfleura2 | ! Third version contains a new command: c for Center of Mass |
| 28 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 29 | 1 | pfleura2 | ! v 3.1 the c command now creates the center of mass... and allows |
| 30 | 1 | pfleura2 | ! people to do whatever they want with it... |
| 31 | 1 | pfleura2 | ! Syntax: c NbAt ListAt |
| 32 | 1 | pfleura2 | !! |
| 33 | 1 | pfleura2 | ! v 3.2 |
| 34 | 1 | pfleura2 | ! Added the p command that gives the oriented angle between two planes |
| 35 | 1 | pfleura2 | ! Syntax: p At1 At2 At3 At4 At5 At6 |
| 36 | 1 | pfleura2 | ! At1, At2, At3 define the first plane |
| 37 | 1 | pfleura2 | ! At4, At5, At6 define the second plane |
| 38 | 1 | pfleura2 | ! How it works: gives the angles between the normal of the two planes, defined by |
| 39 | 1 | pfleura2 | ! the cross produc At2-At1 x At2-At3 etc. |
| 40 | 1 | pfleura2 | !!!! |
| 41 | 1 | pfleura2 | |
| 42 | 1 | pfleura2 | |
| 43 | 1 | pfleura2 | IMPLICIT NONE |
| 44 | 1 | pfleura2 | INTEGER(4), PARAMETER :: maxnat=10000,MaxList=100 |
| 45 | 1 | pfleura2 | |
| 46 | 1 | pfleura2 | CHARACTER(120) :: f1 |
| 47 | 1 | pfleura2 | REAL(8) :: geos(3,maxnat) |
| 48 | 1 | pfleura2 | CHARACTER(33) :: fmt |
| 49 | 1 | pfleura2 | CHARACTER(3) :: atoms(maxnat) |
| 50 | 1 | pfleura2 | character(5) :: Type |
| 51 | 1 | pfleura2 | CHARACTER(120) :: line |
| 52 | 1 | pfleura2 | INTEGER(4) :: NbPrint |
| 53 | 1 | pfleura2 | REAL(8) :: AU2PS,Pi |
| 54 | 1 | pfleura2 | ! Mass is not used for now. |
| 55 | 1 | pfleura2 | ! REAL(8) :: Mass(MaxNat) |
| 56 | 1 | pfleura2 | REAL(8) :: Ener, Conv |
| 57 | 1 | pfleura2 | INTEGER(4) :: At1,At2,At3,At4,At5,At6,IOOUT |
| 58 | 1 | pfleura2 | INTEGER(4) :: IArg, I, NNN, Ng, J |
| 59 | 1 | pfleura2 | |
| 60 | 1 | pfleura2 | INTEGER(4) :: Nat,NbDist, NbAngle, NbDie,NbP,NbCOM |
| 61 | 1 | pfleura2 | INTEGER(4) :: At1B(MaxList),At2B(MaxList) |
| 62 | 1 | pfleura2 | INTEGER(4) :: At1A(MaxList),At2A(MaxList),At3A(MaxList) |
| 63 | 1 | pfleura2 | INTEGER(4) :: At1D(MaxList),At2D(MaxList),At3D(MaxList),At4D(MaxList) |
| 64 | 1 | pfleura2 | INTEGER(4) :: At1p(MaxList),At2p(MaxList),At3p(MaxList), & |
| 65 | 1 | pfleura2 | At4p(MaxList),At5p(MaxList),At6p(MaxList) |
| 66 | 1 | pfleura2 | INTEGER(4) :: AtCom(0:MaxList,MaxList) |
| 67 | 1 | pfleura2 | REAL(8) :: VB(MaxList),VA(MaxList),VD(MaxList),VCOM(MaxList) |
| 68 | 1 | pfleura2 | REAL(8) :: Vp(MaxList) |
| 69 | 1 | pfleura2 | LOGICAL FExist |
| 70 | 1 | pfleura2 | |
| 71 | 1 | pfleura2 | COMMON /Indices/Nat,NbDist,NbAngle,NbDie,NbP,NbCom, At1B,At2B, & |
| 72 | 1 | pfleura2 | At1A,At2A,At3A,At1D,At2D,At3D,At4D,AtCom, & |
| 73 | 1 | pfleura2 | At1p,At2p,At3p,At4p,At5p,At6p |
| 74 | 1 | pfleura2 | COMMON /Values/VB,VA,VD,Vp,VCom |
| 75 | 1 | pfleura2 | COMMON /Const/AU2ps,Pi |
| 76 | 1 | pfleura2 | |
| 77 | 1 | pfleura2 | AU2PS=1./41341.37 |
| 78 | 1 | pfleura2 | NbPrint=100 |
| 79 | 1 | pfleura2 | Pi=dacos(-1.d0) |
| 80 | 1 | pfleura2 | IOOUT=13 |
| 81 | 1 | pfleura2 | Conv=1. |
| 82 | 1 | pfleura2 | iarg=iargc() |
| 83 | 1 | pfleura2 | if (iarg.lt.1) then |
| 84 | 1 | pfleura2 | WRITE(*,*) "==============================================" |
| 85 | 1 | pfleura2 | WRITE(*,*) "== ==" |
| 86 | 1 | pfleura2 | WRITE(*,*) "== Xyz2Scan: Xyz file to scan file ==" |
| 87 | 1 | pfleura2 | WRITE(*,*) "== ==" |
| 88 | 1 | pfleura2 | WRITE(*,*) "==============================================" |
| 89 | 1 | pfleura2 | WRITE(*,*) "Usage: xyz2scan XYZ_file " |
| 90 | 1 | pfleura2 | WRITE(*,*) "The XYZ file should follow the 'usual' format:" |
| 91 | 1 | pfleura2 | WRITE(*,*) "Number of atoms on the first line " |
| 92 | 1 | pfleura2 | WRITE(*,*) "Comment on the second line" |
| 93 | 1 | pfleura2 | WRITE(*,*) "The geometry is given in cartesian coordinates" |
| 94 | 1 | pfleura2 | WRITE(*,*) "with atom symbol and three coordinates:" |
| 95 | 1 | pfleura2 | WRITE(*,*) " C 0. 1. 0." |
| 96 | 1 | pfleura2 | WRITE(*,*) "" |
| 97 | 1 | pfleura2 | WRITE(*,*) " xyz2scan also needs a file called 'list' " |
| 98 | 1 | pfleura2 | WRITE(*,*) "which has the following structure:" |
| 99 | 1 | pfleura2 | WRITE(*,*) "Each line contains the type of the value you" |
| 100 | 1 | pfleura2 | WRITE(*,*) "want to follow, it can be:" |
| 101 | 1 | pfleura2 | WRITE(*,*) " - b for a Bond distance" |
| 102 | 1 | pfleura2 | WRITE(*,*) " - a for an angle" |
| 103 | 1 | pfleura2 | WRITE(*,*) " - d for a dihedral" |
| 104 | 1 | pfleura2 | WRITE(*,*) " - p for the oriented angle between two planes" |
| 105 | 1 | pfleura2 | WRITE(*,*) "This descriptor is followed by the number of" |
| 106 | 1 | pfleura2 | WRITE(*,*) "the atoms involved" |
| 107 | 1 | pfleura2 | WRITE(*,*) "One can also create 'barycenter' atoms that" |
| 108 | 1 | pfleura2 | WRITE(*,*) "can then be used as normal atoms." |
| 109 | 1 | pfleura2 | WRITE(*,*) "the descriptor is 'c' followed by the number" |
| 110 | 1 | pfleura2 | WRITE(*,*) "of atoms and the list of atoms:" |
| 111 | 1 | pfleura2 | WRITE(*,*) " c 2 1 5" |
| 112 | 1 | pfleura2 | WRITE(*,*) "A typical file can be:" |
| 113 | 1 | pfleura2 | WRITE(*,*) " b 1 2" |
| 114 | 1 | pfleura2 | WRITE(*,*) " b 2 3" |
| 115 | 1 | pfleura2 | WRITE(*,*) " a 1 2 3" |
| 116 | 1 | pfleura2 | WRITE(*,*) " " |
| 117 | 1 | pfleura2 | WRITE(*,*) "==============================================" |
| 118 | 1 | pfleura2 | write(*,*) 'XYZ filename:' |
| 119 | 1 | pfleura2 | read(*,'(a)') f1 |
| 120 | 1 | pfleura2 | else |
| 121 | 1 | pfleura2 | call getarg(1,f1) |
| 122 | 1 | pfleura2 | endif |
| 123 | 1 | pfleura2 | |
| 124 | 1 | pfleura2 | open(13,file='Scan.dat') |
| 125 | 1 | pfleura2 | |
| 126 | 1 | pfleura2 | INQUIRE(File='list',Exist=FExist) |
| 127 | 1 | pfleura2 | if (.NOT.FExist) THEN |
| 128 | 1 | pfleura2 | WRITE(*,*) "File *list* is missing" |
| 129 | 1 | pfleura2 | STOP |
| 130 | 1 | pfleura2 | END IF |
| 131 | 1 | pfleura2 | |
| 132 | 1 | pfleura2 | open(11,file=f1) |
| 133 | 1 | pfleura2 | READ(11,*) nnn |
| 134 | 1 | pfleura2 | close(11) |
| 135 | 1 | pfleura2 | |
| 136 | 1 | pfleura2 | |
| 137 | 1 | pfleura2 | if (nnn.GT.MaxNat) THEN |
| 138 | 1 | pfleura2 | WRITE(*,*) "Sorry but your system has too many atoms" |
| 139 | 1 | pfleura2 | WRITE(*,*) "Change the value of MaxNat in the source file" |
| 140 | 1 | pfleura2 | WRITE(*,*) "and then recompile." |
| 141 | 1 | pfleura2 | WRITE(*,*) "For information, now MaxNat=",MaxNat |
| 142 | 1 | pfleura2 | WRITE(*,*) "and you have ",nnn," atoms." |
| 143 | 1 | pfleura2 | STOP |
| 144 | 1 | pfleura2 | END IF |
| 145 | 1 | pfleura2 | |
| 146 | 1 | pfleura2 | Nat=nnn |
| 147 | 1 | pfleura2 | |
| 148 | 1 | pfleura2 | open(14,file='list') |
| 149 | 1 | pfleura2 | Type="d" |
| 150 | 1 | pfleura2 | DO WHILE (Type.ne."E") |
| 151 | 1 | pfleura2 | CALL READLINE(14,Type,Line) |
| 152 | 1 | pfleura2 | ! WRITE(*,*) Line,Type |
| 153 | 1 | pfleura2 | if (Type.eq."b") THEN |
| 154 | 1 | pfleura2 | NbDist=NbDist+1 |
| 155 | 1 | pfleura2 | READ(Line,*) At1,At2 |
| 156 | 1 | pfleura2 | At1B(NbDist)=At1 |
| 157 | 1 | pfleura2 | At2B(NbDist)=At2 |
| 158 | 1 | pfleura2 | END IF |
| 159 | 1 | pfleura2 | if (Type.eq."a") THEN |
| 160 | 1 | pfleura2 | NbAngle=NbAngle+1 |
| 161 | 1 | pfleura2 | READ(Line,*) At1,At2,At3 |
| 162 | 1 | pfleura2 | At1A(NbAngle)=At1 |
| 163 | 1 | pfleura2 | At2A(NbAngle)=At2 |
| 164 | 1 | pfleura2 | At3A(NbAngle)=At3 |
| 165 | 1 | pfleura2 | END IF |
| 166 | 1 | pfleura2 | if (Type.eq."d") THEN |
| 167 | 1 | pfleura2 | NbDie=NbDie+1 |
| 168 | 1 | pfleura2 | READ(Line,*) At1,At2,At3,At4 |
| 169 | 1 | pfleura2 | At1D(NbDie)=At1 |
| 170 | 1 | pfleura2 | At2D(NbDie)=At2 |
| 171 | 1 | pfleura2 | At3D(NbDie)=At3 |
| 172 | 1 | pfleura2 | At4D(NbDie)=At4 |
| 173 | 1 | pfleura2 | ! WRITE(13,'("# d ",4(A3,I3))') Atoms(At1),At1,Atoms(At2),At2,
|
| 174 | 1 | pfleura2 | ! & Atoms(At3),At3,Atoms(At4),At4 |
| 175 | 1 | pfleura2 | ! WRITE(*,'("# d ",4(A3,I3))') Atoms(At1),At1,Atoms(At2),At2,
|
| 176 | 1 | pfleura2 | ! & Atoms(At3),At3,Atoms(At4),At4 |
| 177 | 1 | pfleura2 | |
| 178 | 1 | pfleura2 | END IF |
| 179 | 1 | pfleura2 | if (Type.eq."p") THEN |
| 180 | 1 | pfleura2 | NbP=NbP+1 |
| 181 | 1 | pfleura2 | READ(Line,*) At1,At2,At3,At4,At5,At6 |
| 182 | 1 | pfleura2 | At1p(NbP)=At1 |
| 183 | 1 | pfleura2 | At2p(NbP)=At2 |
| 184 | 1 | pfleura2 | At3p(NbP)=At3 |
| 185 | 1 | pfleura2 | At4p(NbP)=At4 |
| 186 | 1 | pfleura2 | At5p(NbP)=At5 |
| 187 | 1 | pfleura2 | At6p(NbP)=At6 |
| 188 | 1 | pfleura2 | END IF |
| 189 | 1 | pfleura2 | |
| 190 | 1 | pfleura2 | if (Type.eq."c") THEN |
| 191 | 1 | pfleura2 | NbCOM=NbCOM+1 |
| 192 | 1 | pfleura2 | READ(Line,*) At1,(AtCom(j,NbCOM),j=1,At1) |
| 193 | 1 | pfleura2 | AtCom(0,NbCOM)=At1 |
| 194 | 1 | pfleura2 | Atoms(nat+NbCom)="G" |
| 195 | 1 | pfleura2 | END IF |
| 196 | 1 | pfleura2 | |
| 197 | 1 | pfleura2 | END DO |
| 198 | 1 | pfleura2 | |
| 199 | 1 | pfleura2 | CLOSE(14) |
| 200 | 1 | pfleura2 | |
| 201 | 1 | pfleura2 | ! We read one geoetry to get the atoms name |
| 202 | 1 | pfleura2 | open(11,file=f1) |
| 203 | 1 | pfleura2 | call rtraitem(11,nnn,ener,geos,atoms) |
| 204 | 1 | pfleura2 | close(11) |
| 205 | 1 | pfleura2 | |
| 206 | 1 | pfleura2 | |
| 207 | 1 | pfleura2 | ! We write things |
| 208 | 1 | pfleura2 | ! First NbCom |
| 209 | 1 | pfleura2 | if (NbCom.GE.1) THEN |
| 210 | 1 | pfleura2 | WRITE(*,*) "# Added center of mass" |
| 211 | 1 | pfleura2 | WRITE(IOOUT,*) "# Added center of mass" |
| 212 | 1 | pfleura2 | DO J=1,NbCom |
| 213 | 1 | pfleura2 | WRITE(IOOUT,'("# c ",I4,20(A3,I3))') AtCom(0,J), &
|
| 214 | 1 | pfleura2 | (Atoms(AtCom(i,J)),AtCom(i,J),i=1,At1) |
| 215 | 1 | pfleura2 | WRITE(*,'("# c ",I4,20(A3,I3))') AtCom(0,J), &
|
| 216 | 1 | pfleura2 | (Atoms(AtCom(i,J)),AtCom(i,J),i=1,At1) |
| 217 | 1 | pfleura2 | END DO |
| 218 | 1 | pfleura2 | END IF |
| 219 | 1 | pfleura2 | |
| 220 | 1 | pfleura2 | ! Distances |
| 221 | 1 | pfleura2 | if (NbDist.GE.1) THEN |
| 222 | 1 | pfleura2 | WRITE(*,*) "# Bonds" |
| 223 | 1 | pfleura2 | WRITE(IOOUT,*) "# Bonds" |
| 224 | 1 | pfleura2 | DO J=1,NbDist |
| 225 | 1 | pfleura2 | At1= At1B(J) |
| 226 | 1 | pfleura2 | At2=At2B(J) |
| 227 | 1 | pfleura2 | WRITE(IOOUT,'("# b ",2(A3,I3))') Atoms(At1),At1, &
|
| 228 | 1 | pfleura2 | Atoms(At2),At2 |
| 229 | 1 | pfleura2 | WRITE(*,'("# b ",2(A3,I3))') Atoms(At1),At1,Atoms(At2),At2
|
| 230 | 1 | pfleura2 | END DO |
| 231 | 1 | pfleura2 | END IF |
| 232 | 1 | pfleura2 | |
| 233 | 1 | pfleura2 | ! Angles |
| 234 | 1 | pfleura2 | if (NbAngle.GE.1) THEN |
| 235 | 1 | pfleura2 | WRITE(*,*) "# Angles" |
| 236 | 1 | pfleura2 | WRITE(IOOUT,*) "# Angles" |
| 237 | 1 | pfleura2 | DO J=1,NbAngle |
| 238 | 1 | pfleura2 | At1= At1A(J) |
| 239 | 1 | pfleura2 | At2= At2A(J) |
| 240 | 1 | pfleura2 | At3= At3A(J) |
| 241 | 1 | pfleura2 | WRITE(IOOUT,'("# a ",3(A3,I3))') Atoms(At1),At1,Atoms(At2), &
|
| 242 | 1 | pfleura2 | At2, Atoms(At3),At3 |
| 243 | 1 | pfleura2 | WRITE(*,'("# a ",3(A3,I3))') Atoms(At1),At1,Atoms(At2), &
|
| 244 | 1 | pfleura2 | At2, Atoms(At3),At3 |
| 245 | 1 | pfleura2 | |
| 246 | 1 | pfleura2 | END DO |
| 247 | 1 | pfleura2 | END IF |
| 248 | 1 | pfleura2 | |
| 249 | 1 | pfleura2 | |
| 250 | 1 | pfleura2 | ! Dihedrals |
| 251 | 1 | pfleura2 | if (NbDie.GE.1) THEN |
| 252 | 1 | pfleura2 | WRITE(*,*) "# Dihedrals" |
| 253 | 1 | pfleura2 | WRITE(IOOUT,*) "# Dihedrals" |
| 254 | 1 | pfleura2 | DO J=1,NbDie |
| 255 | 1 | pfleura2 | At1= At1D(J) |
| 256 | 1 | pfleura2 | At2= At2D(J) |
| 257 | 1 | pfleura2 | At3= At3D(J) |
| 258 | 1 | pfleura2 | At4= At4D(J) |
| 259 | 1 | pfleura2 | WRITE(IOOUT,'("# d ",4(A3,I3))') Atoms(At1),At1,Atoms(At2) &
|
| 260 | 1 | pfleura2 | ,At2,Atoms(At3),At3,Atoms(At4),At4 |
| 261 | 1 | pfleura2 | WRITE(*,'("# d ",4(A3,I3))') Atoms(At1),At1,Atoms(At2),At2, &
|
| 262 | 1 | pfleura2 | Atoms(At3),At3,Atoms(At4),At4 |
| 263 | 1 | pfleura2 | END DO |
| 264 | 1 | pfleura2 | END IF |
| 265 | 1 | pfleura2 | |
| 266 | 1 | pfleura2 | ! Planar angles |
| 267 | 1 | pfleura2 | if (NbP.GE.1) THEN |
| 268 | 1 | pfleura2 | WRITE(*,*) "# Planes angles" |
| 269 | 1 | pfleura2 | WRITE(IOOUT,*) "# Planes angles" |
| 270 | 1 | pfleura2 | DO J=1,NbP |
| 271 | 1 | pfleura2 | At1= At1p(J) |
| 272 | 1 | pfleura2 | At2= At2p(J) |
| 273 | 1 | pfleura2 | At3= At3p(J) |
| 274 | 1 | pfleura2 | At4= At4p(J) |
| 275 | 1 | pfleura2 | At5= At5p(J) |
| 276 | 1 | pfleura2 | At6= At6p(J) |
| 277 | 1 | pfleura2 | WRITE(IOOUT,'("# p ",8(A3,I3))') Atoms(At1),At1,Atoms(At2) &
|
| 278 | 1 | pfleura2 | ,At2,Atoms(At3),At3,Atoms(At4),At4 & |
| 279 | 1 | pfleura2 | ,Atoms(At5),At5,Atoms(At6),At6 |
| 280 | 1 | pfleura2 | WRITE(*,'("# p ",8(A3,I3))') Atoms(At1),At1,Atoms(At2),At2, &
|
| 281 | 1 | pfleura2 | Atoms(At3),At3,Atoms(At4),At4 & |
| 282 | 1 | pfleura2 | ,Atoms(At5),At5,Atoms(At6),At6 |
| 283 | 1 | pfleura2 | END DO |
| 284 | 1 | pfleura2 | END IF |
| 285 | 1 | pfleura2 | |
| 286 | 1 | pfleura2 | |
| 287 | 1 | pfleura2 | fmt='( (1X,F12.5),1X,F15.6)' |
| 288 | 1 | pfleura2 | write(fmt(2:4),'(i3)') NbDist+NbAngle+NbDie+NbP |
| 289 | 1 | pfleura2 | ! write(*,*) nat3 |
| 290 | 1 | pfleura2 | ! write(*,*) 'fmt:',fmt |
| 291 | 1 | pfleura2 | |
| 292 | 1 | pfleura2 | ng=1 |
| 293 | 1 | pfleura2 | |
| 294 | 1 | pfleura2 | open(11,file=f1) |
| 295 | 1 | pfleura2 | |
| 296 | 1 | pfleura2 | 10 call rtraitem(11,nnn,ener,geos,atoms) |
| 297 | 1 | pfleura2 | ! WRITE(*,*) nnn |
| 298 | 1 | pfleura2 | |
| 299 | 1 | pfleura2 | if (nnn.gt.0) then |
| 300 | 1 | pfleura2 | ! We convert coordinates in a0 into Angstroem |
| 301 | 1 | pfleura2 | ! write(*,*) "Analyse !" |
| 302 | 1 | pfleura2 | Call Analyse(geos) |
| 303 | 1 | pfleura2 | |
| 304 | 1 | pfleura2 | write(IOOUT,fmt) (VB(j)/Conv,j=1,NbDist), & |
| 305 | 1 | pfleura2 | (VA(j),j=1,NbAngle), & |
| 306 | 1 | pfleura2 | (VD(j),j=1,NbDie),(Vp(j),j=1,NbP),ener |
| 307 | 1 | pfleura2 | write(*,fmt) (VB(j)/Conv,j=1,NbDist), & |
| 308 | 1 | pfleura2 | (VA(j),j=1,NbAngle), & |
| 309 | 1 | pfleura2 | (VD(j),j=1,NbDie),(Vp(j),j=1,NbP),ener |
| 310 | 1 | pfleura2 | |
| 311 | 1 | pfleura2 | ng=ng+1 |
| 312 | 1 | pfleura2 | goto 10 |
| 313 | 1 | pfleura2 | endif |
| 314 | 1 | pfleura2 | WRITE(*,*) 'Found ',ng-1,' geometries' |
| 315 | 1 | pfleura2 | close(11) |
| 316 | 1 | pfleura2 | end |
| 317 | 1 | pfleura2 | |
| 318 | 1 | pfleura2 | !-------------------------------------------------------------- |
| 319 | 1 | pfleura2 | subroutine rtraitem(ifil,nnn,E,tab,atoms) |
| 320 | 1 | pfleura2 | ! implicit REAL(8) :: (a-h,o-z) |
| 321 | 1 | pfleura2 | IMPLICIT NONE |
| 322 | 1 | pfleura2 | CHARACTER(120) :: line |
| 323 | 1 | pfleura2 | CHARACTER(3) :: Atoms(*) |
| 324 | 1 | pfleura2 | INTEGER(4) :: nnn, IFil, Idx, I, J |
| 325 | 1 | pfleura2 | REAL(8) :: Tab(3,*), E |
| 326 | 1 | pfleura2 | |
| 327 | 1 | pfleura2 | |
| 328 | 1 | pfleura2 | read(ifil,*,err=99,end=99) nnn |
| 329 | 1 | pfleura2 | read(ifil,'(A)') line |
| 330 | 1 | pfleura2 | idx=index(line,'E') |
| 331 | 1 | pfleura2 | ! WRITE(*,*) 'idx,line',idx,line |
| 332 | 1 | pfleura2 | if (idx/=0) THEN |
| 333 | 1 | pfleura2 | line=line(idx+2:) |
| 334 | 1 | pfleura2 | idx=index(line,"=") |
| 335 | 1 | pfleura2 | if (idx/=0) line=line(idx+1:) |
| 336 | 1 | pfleura2 | idx=index(line,":") |
| 337 | 1 | pfleura2 | if (idx/=0) line=line(idx+1:) |
| 338 | 1 | pfleura2 | read(line,*) E |
| 339 | 1 | pfleura2 | ELSE |
| 340 | 1 | pfleura2 | E=0. |
| 341 | 1 | pfleura2 | END IF |
| 342 | 1 | pfleura2 | |
| 343 | 1 | pfleura2 | ! write(*,*) 'coucou',line |
| 344 | 1 | pfleura2 | do i=1,nnn |
| 345 | 1 | pfleura2 | read(ifil,'(A)',err=99,end=99) Line |
| 346 | 1 | pfleura2 | do while (line(1:1)==' ') |
| 347 | 1 | pfleura2 | line=line(2:) |
| 348 | 1 | pfleura2 | end do |
| 349 | 1 | pfleura2 | atoms(i)=line(1:3) |
| 350 | 1 | pfleura2 | ! write(*,*) 'coucou atoms',atoms(i) |
| 351 | 1 | pfleura2 | do while (line(1:1).ne.' ') |
| 352 | 1 | pfleura2 | line=line(2:) |
| 353 | 1 | pfleura2 | end do |
| 354 | 1 | pfleura2 | ! WRITE(*,*) 'coucou2:',i,line |
| 355 | 1 | pfleura2 | read(line,*) (tab(j,i),j=1,3) |
| 356 | 1 | pfleura2 | end do |
| 357 | 1 | pfleura2 | ! WRITE(*,*) 'coucou:',nnn,tab(1,1) |
| 358 | 1 | pfleura2 | return |
| 359 | 1 | pfleura2 | 99 nnn=0 |
| 360 | 1 | pfleura2 | ! WRITE(*,*) 'Erreur lecture',ifil,nnn |
| 361 | 1 | pfleura2 | return |
| 362 | 1 | pfleura2 | end subroutine rtraitem |
| 363 | 1 | pfleura2 | |
| 364 | 1 | pfleura2 | !-------------------------------------------------------------- |
| 365 | 1 | pfleura2 | |
| 366 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 367 | 1 | pfleura2 | ! READLINE |
| 368 | 1 | pfleura2 | ! This subroutine reads a line for a file, and converts |
| 369 | 1 | pfleura2 | ! the first field into a character variable, and the rest into 4 integers |
| 370 | 1 | pfleura2 | !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 371 | 1 | pfleura2 | |
| 372 | 1 | pfleura2 | SUBROUTINE READLINE(IOIN,Type,Line) |
| 373 | 1 | pfleura2 | |
| 374 | 1 | pfleura2 | IMPLICIT NONE |
| 375 | 1 | pfleura2 | CHARACTER(5) :: Type |
| 376 | 1 | pfleura2 | CHARACTER(120) :: LINE |
| 377 | 1 | pfleura2 | INTEGER(4) :: i,IOIN |
| 378 | 1 | pfleura2 | READ(IOIN,'(A120)',ERR=999,END=999) LINE |
| 379 | 1 | pfleura2 | ! WRITE(*,*) Line |
| 380 | 1 | pfleura2 | DO WHILE (LINE(1:1).eq.' ') |
| 381 | 1 | pfleura2 | LINE=LINE(2:) |
| 382 | 1 | pfleura2 | END DO |
| 383 | 1 | pfleura2 | |
| 384 | 1 | pfleura2 | i=1 |
| 385 | 1 | pfleura2 | DO WHILE (LINE(i:i).ne.' ') |
| 386 | 1 | pfleura2 | i=i+1 |
| 387 | 1 | pfleura2 | END DO |
| 388 | 1 | pfleura2 | |
| 389 | 1 | pfleura2 | if (i.ge.6) THEN |
| 390 | 1 | pfleura2 | WRITE(*,*) 'Pb with READLINE:',LINE |
| 391 | 1 | pfleura2 | GOTO 999 |
| 392 | 1 | pfleura2 | END IF |
| 393 | 1 | pfleura2 | Type=LINE(1:i-1) |
| 394 | 1 | pfleura2 | LINE=LINE(i:120) // " 0 0 0 0" |
| 395 | 1 | pfleura2 | |
| 396 | 1 | pfleura2 | RETURN |
| 397 | 1 | pfleura2 | 999 Type="E" |
| 398 | 1 | pfleura2 | END SUBROUTINE READLINE |
| 399 | 1 | pfleura2 | |
| 400 | 1 | pfleura2 | |
| 401 | 1 | pfleura2 | |
| 402 | 1 | pfleura2 | SUBROUTINE Analyse(geos) |
| 403 | 1 | pfleura2 | |
| 404 | 1 | pfleura2 | IMPLICIT NONE |
| 405 | 1 | pfleura2 | INTEGER(4),PARAMETER :: MaxNat=10000,MaxList=100 |
| 406 | 1 | pfleura2 | |
| 407 | 1 | pfleura2 | REAL(8) :: geos(3,maxnat) |
| 408 | 1 | pfleura2 | REAL(8) :: AU2PS,Pi |
| 409 | 1 | pfleura2 | INTEGER(4) :: i,j,k |
| 410 | 1 | pfleura2 | REAL(8) :: V1x,V1y,V1z,V2x,V2y,V2z,V3x,V3y,V3z |
| 411 | 1 | pfleura2 | REAL(8) :: d1,d2,ca,sa |
| 412 | 1 | pfleura2 | REAL(8) :: V4x,v4y,v4z,v5x,v5y,v5z |
| 413 | 1 | pfleura2 | REAL(8) :: COG(3) |
| 414 | 1 | pfleura2 | |
| 415 | 1 | pfleura2 | INTEGER(4) :: Nat,NbDist, NbAngle, NbDie,NbP,NbCOM |
| 416 | 1 | pfleura2 | INTEGER(4) :: At1B(MaxList),At2B(MaxList) |
| 417 | 1 | pfleura2 | INTEGER(4) :: At1A(MaxList),At2A(MaxList),At3A(MaxList) |
| 418 | 1 | pfleura2 | INTEGER(4) :: At1D(MaxList),At2D(MaxList),At3D(MaxList), & |
| 419 | 1 | pfleura2 | At4D(MaxList) |
| 420 | 1 | pfleura2 | INTEGER(4) :: At1p(MaxList),At2p(MaxList),At3p(MaxList), & |
| 421 | 1 | pfleura2 | At4p(MaxList),At5p(MaxList),At6p(MaxList) |
| 422 | 1 | pfleura2 | INTEGER(4) :: AtCom(0:MaxList,MaxList) |
| 423 | 1 | pfleura2 | REAL(8) :: VB(MaxList),VA(MaxList),VD(MaxList),VCOM(MaxList) |
| 424 | 1 | pfleura2 | REAL(8) :: Vp(MaxList) |
| 425 | 1 | pfleura2 | |
| 426 | 1 | pfleura2 | LOGICAL :: Debug=.FALSE. |
| 427 | 1 | pfleura2 | |
| 428 | 1 | pfleura2 | COMMON /Indices/Nat,NbDist,NbAngle,NbDie,NbP,NbCom, At1B,At2B, & |
| 429 | 1 | pfleura2 | At1A,At2A,At3A,At1D,At2D,At3D,At4D,AtCom, & |
| 430 | 1 | pfleura2 | At1p,At2p,At3p,At4p,At5p,At6p |
| 431 | 1 | pfleura2 | COMMON /Values/VB,VA,VD,Vp,VCom |
| 432 | 1 | pfleura2 | COMMON /Const/AU2ps,Pi |
| 433 | 1 | pfleura2 | |
| 434 | 1 | pfleura2 | if (Debug) THEN |
| 435 | 1 | pfleura2 | DO I=1,Nat |
| 436 | 1 | pfleura2 | WRITE(*,'(1X,I3,3(1X,F15.6))') i,(geos(j,i),j=1,3) |
| 437 | 1 | pfleura2 | END DO |
| 438 | 1 | pfleura2 | END IF |
| 439 | 1 | pfleura2 | ! First, we create the Centre of Mass atoms |
| 440 | 1 | pfleura2 | DO i=1,NbCOM |
| 441 | 1 | pfleura2 | COG(1)=0. |
| 442 | 1 | pfleura2 | COG(2)=0. |
| 443 | 1 | pfleura2 | COG(3)=0. |
| 444 | 1 | pfleura2 | DO j=1,AtCOm(0,i) |
| 445 | 1 | pfleura2 | DO k=1,3 |
| 446 | 1 | pfleura2 | COG(k)=COG(k)+geos(k,AtCom(j,i)) |
| 447 | 1 | pfleura2 | END DO |
| 448 | 1 | pfleura2 | DO k=1,3 |
| 449 | 1 | pfleura2 | COG(k)=COG(k)/AtCOM(0,i) |
| 450 | 1 | pfleura2 | geos(k,Nat+i)=COG(k) |
| 451 | 1 | pfleura2 | END DO |
| 452 | 1 | pfleura2 | END DO |
| 453 | 1 | pfleura2 | END DO |
| 454 | 1 | pfleura2 | |
| 455 | 1 | pfleura2 | DO i=1,NbDist |
| 456 | 1 | pfleura2 | VB(i)=sqrt((geos(1,At1B(i))-geos(1,At2B(i)))**2+ & |
| 457 | 1 | pfleura2 | (geos(2,At1B(i))-geos(2,At2B(i)))**2+ & |
| 458 | 1 | pfleura2 | (geos(3,At1B(i))-geos(3,At2B(i)))**2) |
| 459 | 1 | pfleura2 | END DO |
| 460 | 1 | pfleura2 | DO i=1,NbAngle |
| 461 | 1 | pfleura2 | v1x=geos(1,At1A(i))-geos(1,At2A(i)) |
| 462 | 1 | pfleura2 | v1y=geos(2,At1A(i))-geos(2,At2A(i)) |
| 463 | 1 | pfleura2 | v1z=geos(3,At1A(i))-geos(3,At2A(i)) |
| 464 | 1 | pfleura2 | d1=sqrt(v1x**2+v1y**2+v1z**2) |
| 465 | 1 | pfleura2 | v2x=geos(1,At3A(i))-geos(1,At2A(i)) |
| 466 | 1 | pfleura2 | v2y=geos(2,At3A(i))-geos(2,At2A(i)) |
| 467 | 1 | pfleura2 | v2z=geos(3,At3A(i))-geos(3,At2A(i)) |
| 468 | 1 | pfleura2 | d2=sqrt(v2x**2+v2y**2+v2z**2) |
| 469 | 1 | pfleura2 | VA(i)=acos((v1x*v2x+v1y*v2y+v1z*v2z)/(d1*d2))*180./Pi |
| 470 | 1 | pfleura2 | END DO |
| 471 | 1 | pfleura2 | DO i=1,NbDie |
| 472 | 1 | pfleura2 | ! WRITE(*,*) At1D(i),At2D(i),At3D(i),At4D(i) |
| 473 | 1 | pfleura2 | ! WRITE(*,*) geos(1,At1D(i)),geos(2,At1D(i)),geos(3,At1D(i)) |
| 474 | 1 | pfleura2 | ! WRITE(*,*) geos(1,At2D(i)),geos(2,At2D(i)),geos(3,At2D(i)) |
| 475 | 1 | pfleura2 | v1x=geos(1,At1D(i))-geos(1,At2D(i)) |
| 476 | 1 | pfleura2 | v1y=geos(2,At1D(i))-geos(2,At2D(i)) |
| 477 | 1 | pfleura2 | v1z=geos(3,At1D(i))-geos(3,At2D(i)) |
| 478 | 1 | pfleura2 | v2x=geos(1,At3D(i))-geos(1,At2D(i)) |
| 479 | 1 | pfleura2 | v2y=geos(2,At3D(i))-geos(2,At2D(i)) |
| 480 | 1 | pfleura2 | v2z=geos(3,At3D(i))-geos(3,At2D(i)) |
| 481 | 1 | pfleura2 | v3x=geos(1,At4D(i))-geos(1,At3D(i)) |
| 482 | 1 | pfleura2 | v3y=geos(2,At4D(i))-geos(2,At3D(i)) |
| 483 | 1 | pfleura2 | v3z=geos(3,At4D(i))-geos(3,At3D(i)) |
| 484 | 1 | pfleura2 | |
| 485 | 1 | pfleura2 | v4x=v1y*v2z-v1z*v2y |
| 486 | 1 | pfleura2 | v4y=v1z*v2x-v1x*v2z |
| 487 | 1 | pfleura2 | v4z=v1x*v2y-v1y*v2x |
| 488 | 1 | pfleura2 | d1=sqrt(v4x**2+v4y**2+v4z**2) |
| 489 | 1 | pfleura2 | v5x=-v2y*v3z+v2z*v3y |
| 490 | 1 | pfleura2 | v5y=-v2z*v3x+v2x*v3z |
| 491 | 1 | pfleura2 | v5z=-v2x*v3y+v2y*v3x |
| 492 | 1 | pfleura2 | d2=sqrt(v5x**2+v5y**2+v5z**2) |
| 493 | 1 | pfleura2 | if (d1<=1e-12) THEN |
| 494 | 1 | pfleura2 | WRITE(*,*) "WARNING: Dihedral, d1=0" |
| 495 | 1 | pfleura2 | ca=-1. |
| 496 | 1 | pfleura2 | sa=0. |
| 497 | 1 | pfleura2 | END IF |
| 498 | 1 | pfleura2 | if (d2<=1e-12) THEN |
| 499 | 1 | pfleura2 | WRITE(*,*) "WARNING: Dihedral, d2=0" |
| 500 | 1 | pfleura2 | ca=-1. |
| 501 | 1 | pfleura2 | sa=0. |
| 502 | 1 | pfleura2 | END IF |
| 503 | 1 | pfleura2 | ca=(v4x*v5x+v4y*v5y+v4z*v5z)/(d1*d2) |
| 504 | 1 | pfleura2 | sa=v1x*v5x+v1y*v5y+v1z*v5z |
| 505 | 1 | pfleura2 | if (abs(ca)>1.) ca=sign(1.d0,ca) |
| 506 | 1 | pfleura2 | VD(i)=acos(ca)*180./Pi |
| 507 | 1 | pfleura2 | if (sa<0.) VD(i)=-VD(i) |
| 508 | 1 | pfleura2 | ! WRITE(*,*) "Dihe",v5x,v5y,v5z,v4x,v4y,v4z,d1,d2, |
| 509 | 1 | pfleura2 | ! &(v4x*v5x+v4y*v5y+v4z*v5z)/(d1*d2),pi |
| 510 | 1 | pfleura2 | ! WRITE(*,*) "Dihe ca,sa,d1,d2",ca,sa,d1,d2,acos(ca) |
| 511 | 1 | pfleura2 | |
| 512 | 1 | pfleura2 | |
| 513 | 1 | pfleura2 | !!!!!!!!! Another solution, more elegant ? |
| 514 | 1 | pfleura2 | ! norm2=sqrt(v2x**2+v2y**2+v2z**2) |
| 515 | 1 | pfleura2 | ! sa=(v4x*(v5y*v2z-v5z*v2y) |
| 516 | 1 | pfleura2 | ! * -v4y*(v5x*v2z-v5z*v2x) |
| 517 | 1 | pfleura2 | ! * +v4z*(v5x*v2y-v5y*v2x)) |
| 518 | 1 | pfleura2 | ! * /(d1*norm2*d2) |
| 519 | 1 | pfleura2 | ! angle_d=datan2(sa,ca)*180./Pi |
| 520 | 1 | pfleura2 | ! WRITE(*,*) sa,ca,angle_d,d1,d2,norm2 |
| 521 | 1 | pfleura2 | ! WRITE(*,*) VD(i),angle_d |
| 522 | 1 | pfleura2 | END DO |
| 523 | 1 | pfleura2 | |
| 524 | 1 | pfleura2 | DO i=1,NbP |
| 525 | 1 | pfleura2 | ! v1= At2-At1 |
| 526 | 1 | pfleura2 | v1x=geos(1,At1p(i))-geos(1,At2p(i)) |
| 527 | 1 | pfleura2 | v1y=geos(2,At1p(i))-geos(2,At2p(i)) |
| 528 | 1 | pfleura2 | v1z=geos(3,At1p(i))-geos(3,At2p(i)) |
| 529 | 1 | pfleura2 | ! v2=At2-At3 |
| 530 | 1 | pfleura2 | v2x=geos(1,At3p(i))-geos(1,At2p(i)) |
| 531 | 1 | pfleura2 | v2y=geos(2,At3p(i))-geos(2,At2p(i)) |
| 532 | 1 | pfleura2 | v2z=geos(3,At3p(i))-geos(3,At2p(i)) |
| 533 | 1 | pfleura2 | ! v4 = v1 x v2 |
| 534 | 1 | pfleura2 | v4x=v1y*v2z-v1z*v2y |
| 535 | 1 | pfleura2 | v4y=v1z*v2x-v1x*v2z |
| 536 | 1 | pfleura2 | v4z=v1x*v2y-v1y*v2x |
| 537 | 1 | pfleura2 | d1=sqrt(v4x**2+v4y**2+v4z**2) |
| 538 | 1 | pfleura2 | |
| 539 | 1 | pfleura2 | ! v3= At5-At4 |
| 540 | 1 | pfleura2 | v3x=geos(1,At4p(i))-geos(1,At5p(i)) |
| 541 | 1 | pfleura2 | v3y=geos(2,At4p(i))-geos(2,At5p(i)) |
| 542 | 1 | pfleura2 | v3z=geos(3,At4p(i))-geos(3,At5p(i)) |
| 543 | 1 | pfleura2 | ! v2=At5-At6 |
| 544 | 1 | pfleura2 | v2x=geos(1,At6p(i))-geos(1,At5p(i)) |
| 545 | 1 | pfleura2 | v2y=geos(2,At6p(i))-geos(2,At5p(i)) |
| 546 | 1 | pfleura2 | v2z=geos(3,At6p(i))-geos(3,At5p(i)) |
| 547 | 1 | pfleura2 | |
| 548 | 1 | pfleura2 | ! v5 = v3 x v2 |
| 549 | 1 | pfleura2 | v5x=v3y*v2z-v3z*v2y |
| 550 | 1 | pfleura2 | v5y=v3z*v2x-v3x*v2z |
| 551 | 1 | pfleura2 | v5z=v3x*v2y-v3y*v2x |
| 552 | 1 | pfleura2 | d2=sqrt(v5x**2+v5y**2+v5z**2) |
| 553 | 1 | pfleura2 | |
| 554 | 1 | pfleura2 | ca=(v4x*v5x+v4y*v5y+v4z*v5z)/(d1*d2) |
| 555 | 1 | pfleura2 | sa=v1x*v5x+v1y*v5y+v1z*v5z |
| 556 | 1 | pfleura2 | Vp(i)=acos(ca)*180./Pi |
| 557 | 1 | pfleura2 | if (sa<0.) Vp(i)=-Vp(i) |
| 558 | 1 | pfleura2 | ! WRITE(*,*) "Dihe",v5x,v5y,v5z,v4x,v4y,v4z,d1,d2, |
| 559 | 1 | pfleura2 | ! &(v4x*v5x+v4y*v5y+v4z*v5z)/(d1*d2),pi |
| 560 | 1 | pfleura2 | !!!!!!!!! Another solution, more elegant ? |
| 561 | 1 | pfleura2 | ! See Dihedral routine |
| 562 | 1 | pfleura2 | END DO |
| 563 | 1 | pfleura2 | |
| 564 | 1 | pfleura2 | |
| 565 | 1 | pfleura2 | END SUBROUTINE Analyse |