root / src / PrintGeomVasp.f90 @ 2
Historique | Voir | Annoter | Télécharger (2,87 ko)
| 1 | 1 | pfleura2 | SUBROUTINE PrintGeomVasp(Title,geom,LatrLoc,FrozAt,IoUnit) |
|---|---|---|---|
| 2 | 1 | pfleura2 | |
| 3 | 1 | pfleura2 | ! this subroutine prints a cartesian geometry in the VASP POSCAR format |
| 4 | 1 | pfleura2 | |
| 5 | 1 | pfleura2 | Use Path_module |
| 6 | 1 | pfleura2 | Use Io_module |
| 7 | 1 | pfleura2 | |
| 8 | 1 | pfleura2 | IMPLICIT NONE |
| 9 | 1 | pfleura2 | |
| 10 | 1 | pfleura2 | CHARACTER(*), INTENT(IN) :: TITLE |
| 11 | 1 | pfleura2 | REAL(KREAL),INTENT(IN) :: LatrLoc(3,3),Geom(3*Nat) |
| 12 | 1 | pfleura2 | LOGICAL, INTENT(IN) :: FrozAt(Nat) |
| 13 | 1 | pfleura2 | INTEGER(KINT), INTENT(IN) :: IoUnit |
| 14 | 1 | pfleura2 | |
| 15 | 2 | pfleura2 | INTEGER(KINT) :: Iat, I, J |
| 16 | 1 | pfleura2 | REAL(KREAL), ALLOCATABLE :: GeomTmpC2(:,:),GeomTmpC(:,:) |
| 17 | 1 | pfleura2 | REAL(KREAL) :: MRot(3,3) |
| 18 | 1 | pfleura2 | |
| 19 | 1 | pfleura2 | REAL(KREAL) :: X,Y,Z |
| 20 | 1 | pfleura2 | |
| 21 | 1 | pfleura2 | LOGICAL :: Debug |
| 22 | 1 | pfleura2 | |
| 23 | 1 | pfleura2 | INTERFACE |
| 24 | 1 | pfleura2 | function valid(string) result (isValid) |
| 25 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
| 26 | 1 | pfleura2 | logical :: isValid |
| 27 | 1 | pfleura2 | END function VALID |
| 28 | 1 | pfleura2 | END INTERFACE |
| 29 | 1 | pfleura2 | |
| 30 | 1 | pfleura2 | debug=valid('printgeomvasp')
|
| 31 | 1 | pfleura2 | if (debug) WRITE(*,*) '================ Entering PrintGeomVasp ====================' |
| 32 | 1 | pfleura2 | |
| 33 | 1 | pfleura2 | ALLOCATE(GeomTmpC2(Nat,3),GeomTmpC(3,Nat)) |
| 34 | 1 | pfleura2 | |
| 35 | 1 | pfleura2 | GeomTmpC=reshape(Geom,SHAPE=(/3,Nat/),ORDER=(/2,1/)) |
| 36 | 1 | pfleura2 | |
| 37 | 1 | pfleura2 | DO I=1,Nat |
| 38 | 1 | pfleura2 | Iat=Order(I) |
| 39 | 1 | pfleura2 | ! if (debug) WRITE(*,*) "WriteVASP I,Order(I)",I,Iat |
| 40 | 1 | pfleura2 | GeomTmpC2(I,1:3)=GeomTmpC(1:3,Iat) |
| 41 | 1 | pfleura2 | END DO |
| 42 | 1 | pfleura2 | |
| 43 | 1 | pfleura2 | if (debug) THEN |
| 44 | 1 | pfleura2 | WRITe(*,*) Nat |
| 45 | 1 | pfleura2 | WRITe(*,*) "Original" |
| 46 | 1 | pfleura2 | DO I=1,Nat |
| 47 | 1 | pfleura2 | WRITE(*,'(1X,A4,3(1X,F12.6))') AtName(I), & |
| 48 | 1 | pfleura2 | x0_vasp(I),Y0_vasp(I),z0_vasp(I) |
| 49 | 1 | pfleura2 | END DO |
| 50 | 1 | pfleura2 | WRITE(*,*) Nat |
| 51 | 1 | pfleura2 | WRITe(*,*) "Before align" |
| 52 | 1 | pfleura2 | DO I=1,Nat |
| 53 | 1 | pfleura2 | WRITE(*,'(1X,A4,3(1X,F12.6))') AtName(I), & |
| 54 | 1 | pfleura2 | GeomTmpC2(I,1), GeomTmpC2(I,2), GeomTmpC2(I,3) |
| 55 | 1 | pfleura2 | END DO |
| 56 | 1 | pfleura2 | ENDIF |
| 57 | 1 | pfleura2 | |
| 58 | 1 | pfleura2 | |
| 59 | 1 | pfleura2 | IF ((COORD.EQ.'ZMAT').AND.(Nat.GE.4)) THEN |
| 60 | 1 | pfleura2 | Call AlignPartial(Nat,x0_vasp,y0_vasp,z0_vasp, & |
| 61 | 1 | pfleura2 | GeomTmpC2(1,1),GeomTmpC2(1,2),GeomTMPC2(1,3), & |
| 62 | 1 | pfleura2 | FrozAt,MRot) |
| 63 | 1 | pfleura2 | if (debug) THEN |
| 64 | 1 | pfleura2 | WRITE(*,*) NAt |
| 65 | 1 | pfleura2 | WRITe(*,*) "Aligned ?" |
| 66 | 1 | pfleura2 | DO I=1,Nat |
| 67 | 1 | pfleura2 | WRITE(*,'(1X,A4,3(1X,F12.6))') AtName(I), & |
| 68 | 1 | pfleura2 | GeomTmpC2(I,1), GeomTmpC2(I,2), GeomTmpC2(I,3) |
| 69 | 1 | pfleura2 | END DO |
| 70 | 1 | pfleura2 | ENDIF |
| 71 | 1 | pfleura2 | END IF |
| 72 | 1 | pfleura2 | |
| 73 | 1 | pfleura2 | ! We print the corresponding file |
| 74 | 1 | pfleura2 | WRITE(IOUNIT,'(A)') Trim(Title) |
| 75 | 1 | pfleura2 | WRITE(IOUNIT,'(1X,F18.14)') Vasp_Param |
| 76 | 1 | pfleura2 | WRITE(IOUNIT,'(3(1X,F21.16))') Lat_a(1)/Vasp_param,Lat_a(2)/Vasp_param,Lat_a(3)/Vasp_param |
| 77 | 1 | pfleura2 | WRITE(IOUNIT,'(3(1X,F21.16))') Lat_b(1)/Vasp_param,Lat_b(2)/Vasp_param,Lat_b(3)/Vasp_param |
| 78 | 1 | pfleura2 | WRITE(IOUNIT,'(3(1X,F21.16))') Lat_c(1)/Vasp_param,Lat_c(2)/Vasp_param,Lat_c(3)/Vasp_param |
| 79 | 1 | pfleura2 | WRITE(IOUNIT,'(A)') TRIM(Vasp_Types) |
| 80 | 1 | pfleura2 | WRITE(IOUNIT,'(A)') TRIM(Vasp_comment) |
| 81 | 1 | pfleura2 | WRITE(IOUNIT,'(A)') TRIM(Vasp_direct) |
| 82 | 1 | pfleura2 | DO I=1,Nat |
| 83 | 1 | pfleura2 | X=0. |
| 84 | 1 | pfleura2 | Y=0. |
| 85 | 1 | pfleura2 | Z=0. |
| 86 | 1 | pfleura2 | DO J=1,3 |
| 87 | 1 | pfleura2 | X=X+GeomTmpC2(I,J)*LatrLoc(1,J) |
| 88 | 1 | pfleura2 | Y=Y+GeomTmpC2(I,J)*LatrLoc(2,J) |
| 89 | 1 | pfleura2 | Z=Z+GeomTmpC2(I,J)*LatrLoc(3,J) |
| 90 | 1 | pfleura2 | END DO |
| 91 | 1 | pfleura2 | WRITE(IOUNIT,'(3F20.16,1X,3A4)') X,Y,Z,FFF(1:3,I) |
| 92 | 1 | pfleura2 | END DO |
| 93 | 1 | pfleura2 | |
| 94 | 1 | pfleura2 | DeALLOCATE(GeomTmpC2) |
| 95 | 1 | pfleura2 | if (debug) WRITE(*,*) '================ PrintGeomVasp OVER ====================' |
| 96 | 1 | pfleura2 | |
| 97 | 1 | pfleura2 | END SUBROUTINE PrintGeomVasp |