root / src / CheckPeriodicBound.f90 @ 3
Historique | Voir | Annoter | Télécharger (2,51 ko)
| 1 | 1 | pfleura2 | SUBROUTINE CheckPeriodicBound |
|---|---|---|---|
| 2 | 1 | pfleura2 | ! This subroutine is only for periodic systems |
| 3 | 1 | pfleura2 | ! it checks that the atoms do not change their |
| 4 | 1 | pfleura2 | ! positions from one side to the other during the simulations. |
| 5 | 1 | pfleura2 | ! This would ruin the interpolation. |
| 6 | 1 | pfleura2 | |
| 7 | 1 | pfleura2 | |
| 8 | 1 | pfleura2 | Use Path_module |
| 9 | 1 | pfleura2 | Use Io_module |
| 10 | 1 | pfleura2 | |
| 11 | 1 | pfleura2 | IMPLICIT NONE |
| 12 | 1 | pfleura2 | |
| 13 | 1 | pfleura2 | |
| 14 | 1 | pfleura2 | INTEGER(KINT) :: IGeom, I,J,K |
| 15 | 1 | pfleura2 | REAL(KREAL), ALLOCATABLE :: GeomRef(:,:), GeomTmp(:,:) ! (3,Nat) |
| 16 | 1 | pfleura2 | |
| 17 | 1 | pfleura2 | REAL(KREAL) :: Latrloc(3,3),Bloc(3),Xt,Yt,Zt |
| 18 | 1 | pfleura2 | LOGICAL :: Debug |
| 19 | 1 | pfleura2 | |
| 20 | 1 | pfleura2 | INTERFACE |
| 21 | 1 | pfleura2 | function valid(string) result (isValid) |
| 22 | 1 | pfleura2 | CHARACTER(*), intent(in) :: string |
| 23 | 1 | pfleura2 | logical :: isValid |
| 24 | 1 | pfleura2 | END function VALID |
| 25 | 1 | pfleura2 | END INTERFACE |
| 26 | 1 | pfleura2 | |
| 27 | 1 | pfleura2 | debug=valid('checkperiodicbound')
|
| 28 | 1 | pfleura2 | if (debug) WRITE(*,*) "========================= Entering CheckPeriodicBound ===========" |
| 29 | 1 | pfleura2 | |
| 30 | 1 | pfleura2 | ALLOCATE(GeomRef(3,Nat), GeomTmp(3,Nat)) |
| 31 | 1 | pfleura2 | |
| 32 | 1 | pfleura2 | V_direct=adjustl(Vasp_direct) |
| 33 | 1 | pfleura2 | Call upcase(V_direct) |
| 34 | 1 | pfleura2 | |
| 35 | 1 | pfleura2 | ! The test is easy in DIRECT space, so we will convert the geometries |
| 36 | 1 | pfleura2 | ! into this space. |
| 37 | 1 | pfleura2 | ! We might optimize this as Read_geom converts geometries into NORMAL |
| 38 | 1 | pfleura2 | ! coordinates... so it might be that we are converting them back to direct here... |
| 39 | 1 | pfleura2 | |
| 40 | 1 | pfleura2 | Latrloc(1:3,1)=Lat_a |
| 41 | 1 | pfleura2 | Latrloc(1:3,2)=Lat_b |
| 42 | 1 | pfleura2 | Latrloc(1:3,3)=Lat_c |
| 43 | 1 | pfleura2 | Bloc=1. |
| 44 | 1 | pfleura2 | CALL Gaussj(Latrloc,3,3,Bloc,1,1) |
| 45 | 1 | pfleura2 | |
| 46 | 1 | pfleura2 | ! We put first geometry as the reference |
| 47 | 1 | pfleura2 | GeomRef=0. |
| 48 | 1 | pfleura2 | DO I=1,Nat |
| 49 | 1 | pfleura2 | DO K=1,3 |
| 50 | 1 | pfleura2 | DO J=1,3 |
| 51 | 1 | pfleura2 | GeomRef(K,I)=GeomRef(K,I)+XyzGeomI(1,J,I)*LatrLoc(K,J) |
| 52 | 1 | pfleura2 | END DO |
| 53 | 1 | pfleura2 | END DO |
| 54 | 1 | pfleura2 | END DO |
| 55 | 1 | pfleura2 | |
| 56 | 1 | pfleura2 | DO IGeom=2,NGeomI |
| 57 | 1 | pfleura2 | GeomTmp=0. |
| 58 | 1 | pfleura2 | DO I=1,Nat |
| 59 | 1 | pfleura2 | DO K=1,3 |
| 60 | 1 | pfleura2 | DO J=1,3 |
| 61 | 1 | pfleura2 | GeomTmp(K,I)=GeomTmp(K,I)+XyzGeomI(IGeom,J,I)*LatrLoc(K,J) |
| 62 | 1 | pfleura2 | END DO |
| 63 | 1 | pfleura2 | if (abs(GeomTmp(K,I)-GeomRef(K,I)).GE.BoxTol) THEN |
| 64 | 1 | pfleura2 | If (debug) & |
| 65 | 1 | pfleura2 | WRITE(*,'("Coord ",I1," has been changed for atom ",I5," by ",F4.0," ref:",F9.6," old:",F9.6," new:",F9.6)') &
|
| 66 | 1 | pfleura2 | K,I,Sign(1.d0,GeomRef(K,I)-GeomTmp(K,I)),& |
| 67 | 1 | pfleura2 | GeomRef(K,I),GeomTmp(K,I), & |
| 68 | 1 | pfleura2 | GeomTmp(K,I)+Sign(1.d0,GeomRef(K,I)-GeomTmp(K,I)) |
| 69 | 1 | pfleura2 | GeomTmp(K,I)=GeomTmp(K,I)+Sign(1.d0,GeomRef(K,I)-GeomTmp(K,I)) |
| 70 | 1 | pfleura2 | END IF |
| 71 | 1 | pfleura2 | END DO |
| 72 | 1 | pfleura2 | Xt=GeomTmp(1,I) |
| 73 | 1 | pfleura2 | Yt=GeomTmp(2,I) |
| 74 | 1 | pfleura2 | Zt=GeomTmp(3,I) |
| 75 | 1 | pfleura2 | XyzGeomI(IGeom,1,I)=Xt*lat_a(1)+Yt*lat_b(1)+Zt*lat_c(1) |
| 76 | 1 | pfleura2 | XyzGeomI(IGeom,2,I)=Xt*lat_a(2)+Yt*lat_b(2)+Zt*lat_c(2) |
| 77 | 1 | pfleura2 | XyzGeomI(IGeom,3,I)=Xt*lat_a(3)+Yt*lat_b(3)+Zt*lat_c(3) |
| 78 | 1 | pfleura2 | END DO |
| 79 | 1 | pfleura2 | END DO |
| 80 | 1 | pfleura2 | |
| 81 | 1 | pfleura2 | if (debug) WRITE(*,*) "========================= Exiting CheckPeriodicBound ===========" |
| 82 | 1 | pfleura2 | END SUBROUTINE CheckPeriodicBound |
| 83 | 1 | pfleura2 | |
| 84 | 1 | pfleura2 | |
| 85 | 1 | pfleura2 | |
| 86 | 1 | pfleura2 | |
| 87 | 1 | pfleura2 |