root / src / Write_vasp.f90 @ 2
Historique | Voir | Annoter | Télécharger (2,45 ko)
| 1 | 1 | pfleura2 | SUBROUTINE Write_vasp(poscar) |
|---|---|---|---|
| 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 | CHARACTER(SCHARS), INTENT(IN) :: poscar |
| 9 | 1 | pfleura2 | |
| 10 | 2 | pfleura2 | INTEGER(KINT) :: IGeom, Idx |
| 11 | 1 | pfleura2 | REAL(KREAL), ALLOCATABLE :: GeomTmpC(:), GeomTmp(:) |
| 12 | 1 | pfleura2 | CHARACTER(SCHARS) :: Line,Line2 |
| 13 | 1 | pfleura2 | |
| 14 | 1 | pfleura2 | ! For VMD printing |
| 15 | 1 | pfleura2 | CHARACTER(SCHARS), PARAMETER :: FirstWord="mol " |
| 16 | 1 | pfleura2 | CHARACTER(LCHARS), PARAMETER :: LastWords=" type POSCAR first 0 last -1 step 1 filebonds 1 autobonds 1 waitfor all" |
| 17 | 1 | pfleura2 | |
| 18 | 1 | pfleura2 | CHARACTER(LCHARS) :: TITLE |
| 19 | 1 | pfleura2 | LOGICAL :: Debug |
| 20 | 1 | pfleura2 | |
| 21 | 1 | pfleura2 | INTERFACE |
| 22 | 1 | pfleura2 | function valid(string) result (isValid) |
| 23 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
| 24 | 1 | pfleura2 | logical :: isValid |
| 25 | 1 | pfleura2 | END function VALID |
| 26 | 1 | pfleura2 | END INTERFACE |
| 27 | 1 | pfleura2 | |
| 28 | 1 | pfleura2 | debug=valid('write_vasp')
|
| 29 | 1 | pfleura2 | if (debug) WRITE(*,*) '================ Entering Write_VASP ====================' |
| 30 | 1 | pfleura2 | |
| 31 | 1 | pfleura2 | ALLOCATE(GeomTmpC(3*Nat), GeomTmp(NCoord)) |
| 32 | 1 | pfleura2 | |
| 33 | 1 | pfleura2 | Line2="00" |
| 34 | 1 | pfleura2 | DO IGeom=1,NGeomF |
| 35 | 1 | pfleura2 | WRITE(Line,'(I5)') IGeom-1 |
| 36 | 1 | pfleura2 | Idx=2-Len_TRIM(ADJUSTL(Line)) |
| 37 | 1 | pfleura2 | OPEN(IOTMP,File=TRIM(POSCAR) // "_" // Line2(1:Idx) // AdjustL(TRIM(Line))) |
| 38 | 1 | pfleura2 | ! we convert the coordinates into Cartesian coordinates |
| 39 | 1 | pfleura2 | SELECT CASE (Coord) |
| 40 | 1 | pfleura2 | CASE ('CART','HYBRID')
|
| 41 | 1 | pfleura2 | GeomTmpC=Reshape(reshape(XyzGeomF(IGeom,:,:),(/Nat,3/),ORDER=(/2,1/)),(/3*Nat/)) |
| 42 | 1 | pfleura2 | CASE ('ZMAT')
|
| 43 | 1 | pfleura2 | GeomTmp=IntCoordF(IGeom,:) |
| 44 | 1 | pfleura2 | ! we have to generate the cartesian coordinates from the internal coordinates |
| 45 | 1 | pfleura2 | CAll Int2Cart(nat,indzmat,geomtmp,GeomTmpC) |
| 46 | 1 | pfleura2 | CASE ('MIXED')
|
| 47 | 1 | pfleura2 | GeomTmp=IntCoordF(IGeom,:) |
| 48 | 1 | pfleura2 | CAll Mixed2Cart(nat,indzmat,geomtmp,GeomTmpC) |
| 49 | 1 | pfleura2 | END SELECT |
| 50 | 1 | pfleura2 | |
| 51 | 1 | pfleura2 | if (debug) WRITE(*,*) "Converting geom ",IGeom," into file ",Trim(POSCAR) // "_" // Line2(1:Idx) // AdjustL(TRIM(Line)) |
| 52 | 1 | pfleura2 | |
| 53 | 1 | pfleura2 | WRITE(Title,'(A,I2,"/",I2)') Trim(Vasp_Title) // " - Geom ",IGeom-1,NGeomF-1 |
| 54 | 1 | pfleura2 | |
| 55 | 1 | pfleura2 | Call PrintGeomVasp(Title,geomTmpC,Latr,FrozAtoms,IoTmp) |
| 56 | 1 | pfleura2 | |
| 57 | 1 | pfleura2 | CLOSE(IOTMP) |
| 58 | 1 | pfleura2 | END DO |
| 59 | 1 | pfleura2 | |
| 60 | 1 | pfleura2 | if (Vmd) THEN |
| 61 | 1 | pfleura2 | WRITE(IOOUT,*) "## Insert the following list into the Test_NEB_example.vmd file for an easy VMD use" |
| 62 | 1 | pfleura2 | |
| 63 | 1 | pfleura2 | Line2="00" |
| 64 | 1 | pfleura2 | WRITE(IOOUT,'(A)') TRIM(FirstWord) // " new " // TRIM(POSCAR) // "_00" // TRIM(LastWords) |
| 65 | 1 | pfleura2 | DO IGeom=2,NGeomF |
| 66 | 1 | pfleura2 | WRITE(Line,'(I5)') IGeom-1 |
| 67 | 1 | pfleura2 | Idx=2-Len_TRIM(ADJUSTL(Line)) |
| 68 | 1 | pfleura2 | WRITE(IOOUT,'(A)') TRIM(FirstWord) // " addfile " // TRIM(POSCAR) // & |
| 69 | 1 | pfleura2 | "_" // Line2(1:Idx) // TRIM(ADJUSTL(Line)) // TRIM(LastWords) |
| 70 | 1 | pfleura2 | END DO |
| 71 | 1 | pfleura2 | WRITE(IOOUT,*) "## End of List" |
| 72 | 1 | pfleura2 | END IF |
| 73 | 1 | pfleura2 | |
| 74 | 1 | pfleura2 | if (debug) WRITE(*,*) '================ Write_VASP OVER ====================' |
| 75 | 1 | pfleura2 | DeALLOCATE(GeomTmpC, GeomTmp) |
| 76 | 1 | pfleura2 | |
| 77 | 1 | pfleura2 | END SUBROUTINE Write_vasp |