root / src / Write_path.f90 @ 2
Historique | Voir | Annoter | Télécharger (4,89 ko)
| 1 | 1 | pfleura2 | SUBROUTINE Write_path(Iopt) |
|---|---|---|---|
| 2 | 1 | pfleura2 | |
| 3 | 1 | pfleura2 | Use Path_module |
| 4 | 1 | pfleura2 | Use Io_module |
| 5 | 1 | pfleura2 | |
| 6 | 1 | pfleura2 | IMPLICIT NONE |
| 7 | 1 | pfleura2 | |
| 8 | 1 | pfleura2 | INTEGER(KINT), INTENT(IN) :: Iopt |
| 9 | 1 | pfleura2 | |
| 10 | 2 | pfleura2 | INTEGER(KINT) :: IGeom, Iat, I |
| 11 | 1 | pfleura2 | REAL(KREAL), ALLOCATABLE :: GeomTmpC(:), GeomTmp(:),GeomTmpC2(:,:) |
| 12 | 1 | pfleura2 | CHARACTER(SCHARS) :: Line |
| 13 | 1 | pfleura2 | CHARACTER(LCHARS) ::Title |
| 14 | 1 | pfleura2 | LOGICAL :: Debug |
| 15 | 1 | pfleura2 | |
| 16 | 1 | pfleura2 | INTERFACE |
| 17 | 1 | pfleura2 | function valid(string) result (isValid) |
| 18 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
| 19 | 1 | pfleura2 | logical :: isValid |
| 20 | 1 | pfleura2 | END function VALID |
| 21 | 1 | pfleura2 | END INTERFACE |
| 22 | 1 | pfleura2 | |
| 23 | 1 | pfleura2 | debug=valid('write_path').OR.valid('writepath')
|
| 24 | 1 | pfleura2 | if (debug) Call Header("Entering Write_PATH")
|
| 25 | 1 | pfleura2 | |
| 26 | 1 | pfleura2 | |
| 27 | 1 | pfleura2 | ALLOCATE(GeomTmpC(3*Nat), GeomTmp(NCoord),GeomTmpC2(Nat,3)) |
| 28 | 1 | pfleura2 | |
| 29 | 1 | pfleura2 | IF (IOpt.GE.0) THEN |
| 30 | 1 | pfleura2 | WRITE(Line,'(I5)') Iopt |
| 31 | 1 | pfleura2 | ELSE |
| 32 | 1 | pfleura2 | Line="Ini" |
| 33 | 1 | pfleura2 | Energies=0. |
| 34 | 1 | pfleura2 | END IF |
| 35 | 1 | pfleura2 | OPEN(IOTMP,File=Trim(PathName) // '.' // AdjustL(TRIM(Line))) |
| 36 | 1 | pfleura2 | IF ((COORD.EQ.'ZMAT').OR.(COORD.EQ.'MIXED').OR.(COORD.EQ.'BAKER')) & |
| 37 | 1 | pfleura2 | OPEN(IOCART,File=TRIM(PathName) // '_cart.' // AdjustL(TRIM(Line))) |
| 38 | 1 | pfleura2 | |
| 39 | 1 | pfleura2 | DO IGeom=1,NGeomF |
| 40 | 1 | pfleura2 | WRITE(Title,"('Geometry ',I3,'/',I3,' for iteration ',I3,' E=',F13.6)") Igeom,NgeomF,Iopt,Energies(IGeom)
|
| 41 | 1 | pfleura2 | SELECT CASE(Coord) |
| 42 | 1 | pfleura2 | CASE ('CART','HYBRID')
|
| 43 | 1 | pfleura2 | ! XyzGeomF is 3,Nat... but Printgeom expects Nat,3... |
| 44 | 1 | pfleura2 | ! this should really be rewritten !!!! |
| 45 | 1 | pfleura2 | GeomTmp=Reshape(reshape(XyzGeomF(IGeom,:,:),(/Nat,3/),ORDER=(/2,1/)),(/3*Nat/)) |
| 46 | 1 | pfleura2 | CASE ('ZMAT','MIXED','BAKER')
|
| 47 | 1 | pfleura2 | GeomTmp=IntCoordF(IGeom,:) |
| 48 | 1 | pfleura2 | CASE DEFAULT |
| 49 | 1 | pfleura2 | WRITE(*,*) "Coord=",TRIM(Coord)," not recognized in Write_path. L34.STOP" |
| 50 | 1 | pfleura2 | STOP |
| 51 | 1 | pfleura2 | END SELECT |
| 52 | 1 | pfleura2 | |
| 53 | 1 | pfleura2 | ! Nothing for the baker case. |
| 54 | 1 | pfleura2 | Call PrintGeom(Title,Nat,NCoord,GeomTmp,Coord,IoTmp,Atome,Order,OrderInv,IndZmat) |
| 55 | 1 | pfleura2 | |
| 56 | 1 | pfleura2 | IF (COORD.EQ.'ZMAT') THEN |
| 57 | 1 | pfleura2 | ! Writing the Cartesian coordinates |
| 58 | 1 | pfleura2 | WRITE(IOCART,'(1X,I5)') Nat |
| 59 | 1 | pfleura2 | WRITE(IOCART,'(1X,A)') Title |
| 60 | 1 | pfleura2 | ! we have to generate the cartesian coordinates from the internal coordinates |
| 61 | 1 | pfleura2 | Call Int2Cart(nat,indzmat,GeomTmp,GeomTmpC) |
| 62 | 1 | pfleura2 | GeomTmpC2=reshape(GeomTmpC,(/Nat,3/)) |
| 63 | 1 | pfleura2 | DO I=1,Nat |
| 64 | 1 | pfleura2 | IF (renum) THEN |
| 65 | 1 | pfleura2 | Iat=Order(I) |
| 66 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC(3*Iat-2:3*Iat) |
| 67 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC2(Iat,1:3) |
| 68 | 1 | pfleura2 | ELSE |
| 69 | 1 | pfleura2 | Iat=OrderInv(I) |
| 70 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC(3*I-2:3*I) |
| 71 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC2(I,1:3) |
| 72 | 1 | pfleura2 | END IF |
| 73 | 1 | pfleura2 | END DO |
| 74 | 1 | pfleura2 | END IF ! matches IF (COORD.EQ.'ZMAT') THEN |
| 75 | 1 | pfleura2 | |
| 76 | 1 | pfleura2 | IF (COORD.EQ.'BAKER') THEN |
| 77 | 1 | pfleura2 | ! Writing the Cartesian coordinates |
| 78 | 1 | pfleura2 | WRITE(IOCART,'(1X,I5)') Nat |
| 79 | 1 | pfleura2 | WRITE(IOCART,'(1X,A)') Title |
| 80 | 1 | pfleura2 | ! we have to generate the cartesian coordinates from the internal coordinates |
| 81 | 1 | pfleura2 | ! we can also print the cartesiann coordinates directly from XyzGeomF?? |
| 82 | 1 | pfleura2 | !Call ConvertBakerInternal_cart(InCoordF(IGeom-1,:),InCoordF(IGeom,:)) |
| 83 | 1 | pfleura2 | ! XyzGeomF(NGeomF,3,Nat), GeomTmpC(3*Nat),GeomTmpC2(Nat,3) |
| 84 | 1 | pfleura2 | !GeomTmpC2=reshape(GeomTmpC,(/Nat,3/)). XyzGeomF is already updated in |
| 85 | 1 | pfleura2 | ! EgradPath.f90 |
| 86 | 1 | pfleura2 | DO I =1, 3 |
| 87 | 1 | pfleura2 | GeomTmpC2(:,I)=XyzGeomF(IGeom,I,:) |
| 88 | 1 | pfleura2 | END DO |
| 89 | 1 | pfleura2 | DO I=1,Nat |
| 90 | 1 | pfleura2 | IF (renum) THEN |
| 91 | 1 | pfleura2 | Iat=Order(I) |
| 92 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC(3*Iat-2:3*Iat) |
| 93 | 1 | pfleura2 | !Print *, GeomTmpC2(Iat,1:3) |
| 94 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC2(Iat,1:3) |
| 95 | 1 | pfleura2 | ELSE |
| 96 | 1 | pfleura2 | Iat=OrderInv(I) |
| 97 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC(3*I-2:3*I) |
| 98 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC2(I,1:3) |
| 99 | 1 | pfleura2 | END IF |
| 100 | 1 | pfleura2 | END DO |
| 101 | 1 | pfleura2 | END IF ! matches IF (COORD.EQ.'BAKER') THEN |
| 102 | 1 | pfleura2 | |
| 103 | 1 | pfleura2 | IF (COORD.EQ.'MIXED') THEN |
| 104 | 1 | pfleura2 | ! Writing the Cartesian coordinates |
| 105 | 1 | pfleura2 | WRITE(IOCART,'(1X,I5)') Nat |
| 106 | 1 | pfleura2 | WRITE(IOCART,'(1X,A)') Title |
| 107 | 1 | pfleura2 | ! we have to generate the cartesian coordinates from the internal coordinates |
| 108 | 1 | pfleura2 | Call Mixed2Cart(nat,indzmat,geomtmp,GeomTmpC) |
| 109 | 1 | pfleura2 | GeomTmpC2=reshape(GeomTmpC,(/Nat,3/)) |
| 110 | 1 | pfleura2 | DO I=1,Nat |
| 111 | 1 | pfleura2 | IF (renum) THEN |
| 112 | 1 | pfleura2 | Iat=Order(I) |
| 113 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC(3*Iat-2:3*Iat) |
| 114 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8))') Trim(AtName(I)),GeomTmpC2(Iat,1:3) |
| 115 | 1 | pfleura2 | ELSE |
| 116 | 1 | pfleura2 | Iat=OrderInv(I) |
| 117 | 1 | pfleura2 | ! WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC(3*I-2:3*I) |
| 118 | 1 | pfleura2 | WRITE(IOCART,'(1X,A10,3(1X,F15.8),A)') Trim(AtName(Iat)),GeomTmpC2(I,1:3) |
| 119 | 1 | pfleura2 | END IF |
| 120 | 1 | pfleura2 | END DO |
| 121 | 1 | pfleura2 | END IF ! matches IF (COORD.EQ.'MIXED') THEN |
| 122 | 1 | pfleura2 | END DO ! matches DO IGeom=1,NGeomF |
| 123 | 1 | pfleura2 | CLOSE(IOTMP) |
| 124 | 1 | pfleura2 | IF ((COORD.EQ.'ZMAT').OR.(COORD.EQ.'MIXED').OR.(COORD.EQ.'BAKER')) CLOSE(IOCART) |
| 125 | 1 | pfleura2 | DEALLOCATE(GeomTmpC,GeomTmp) |
| 126 | 1 | pfleura2 | |
| 127 | 1 | pfleura2 | if (debug) Call Header('Exiting Write_PATH')
|
| 128 | 1 | pfleura2 | END SUBROUTINE Write_path |