root / src / Std_ori.f90 @ 3
Historique | Voir | Annoter | Télécharger (3,26 ko)
| 1 | 1 | pfleura2 | subroutine Std_ori(natom,rx,ry,rz,a,b,c,rmass) |
|---|---|---|---|
| 2 | 1 | pfleura2 | !c |
| 3 | 1 | pfleura2 | !c rotational constants for all replicas by inline diagonalization |
| 4 | 1 | pfleura2 | !c of inertial tensor |
| 5 | 1 | pfleura2 | !c |
| 6 | 1 | pfleura2 | !!!!!!! Input |
| 7 | 1 | pfleura2 | ! natom : number of atoms |
| 8 | 1 | pfleura2 | ! rx,ry,rz : arrays natom with cartesian coordinates of natom particles |
| 9 | 1 | pfleura2 | ! rmass : vector of length natom with particle masses |
| 10 | 1 | pfleura2 | ! |
| 11 | 1 | pfleura2 | !!!!!!! Output |
| 12 | 1 | pfleura2 | ! a,b,c : rotational constants a, b, and c |
| 13 | 1 | pfleura2 | ! |
| 14 | 1 | pfleura2 | !!!!!! Dependencies |
| 15 | 1 | pfleura2 | ! tensor: calculate the inertial tensor |
| 16 | 1 | pfleura2 | ! Jacobi, trie : diaganalization subroutines |
| 17 | 1 | pfleura2 | |
| 18 | 1 | pfleura2 | implicit none |
| 19 | 1 | pfleura2 | |
| 20 | 1 | pfleura2 | INTEGER, PARAMETER :: KINT=KIND(1) |
| 21 | 1 | pfleura2 | INTEGER, PARAMETER :: KREAL=KIND(1.0D0) |
| 22 | 1 | pfleura2 | |
| 23 | 1 | pfleura2 | INTEGER(KINT), INTENT(IN) :: Natom |
| 24 | 1 | pfleura2 | REAL(KREAL), INTENT(INOUT) :: rx(Natom),ry(Natom),rz(Natom) |
| 25 | 1 | pfleura2 | REAL(KREAL), INTENT(IN) :: rmass(Natom) |
| 26 | 1 | pfleura2 | REAL(KREAL), INTENT(OUT) :: a,b,c |
| 27 | 1 | pfleura2 | |
| 28 | 1 | pfleura2 | real(KREAL) :: Tinert(3,3),D(3),V(3,3),CoordG(3) |
| 29 | 1 | pfleura2 | real(KREAL) :: ca,sa,na,cb,sb,nb |
| 30 | 1 | pfleura2 | |
| 31 | 1 | pfleura2 | INTEGER(KINT) :: I |
| 32 | 1 | pfleura2 | REAL(KREAL) :: Vt,Rxt,Ryt |
| 33 | 1 | pfleura2 | |
| 34 | 1 | pfleura2 | call tensor(natom,rx,ry,rz,Tinert,CoordG,rmass) |
| 35 | 1 | pfleura2 | call Jacobi(Tinert,3,D,V,3) |
| 36 | 1 | pfleura2 | call Trie(3,D,V,3) |
| 37 | 1 | pfleura2 | |
| 38 | 1 | pfleura2 | !1000 FORMAT(3F15.3) |
| 39 | 1 | pfleura2 | !1010 FORMAT(4F15.3) |
| 40 | 1 | pfleura2 | |
| 41 | 1 | pfleura2 | a=D(1) |
| 42 | 1 | pfleura2 | ! WRITE(*,1010) a,(V(i,1),i=1,3) |
| 43 | 1 | pfleura2 | b=D(2) |
| 44 | 1 | pfleura2 | ! WRITE(*,1010) b,(V(i,2),i=1,3) |
| 45 | 1 | pfleura2 | c=D(3) |
| 46 | 1 | pfleura2 | ! WRITE(*,1010) c,(V(i,3),i=1,3) |
| 47 | 1 | pfleura2 | |
| 48 | 1 | pfleura2 | !C On commence par mettre le centre de masse a l'origine |
| 49 | 1 | pfleura2 | |
| 50 | 1 | pfleura2 | Do I=1,natom |
| 51 | 1 | pfleura2 | ! WRITE(*,*) 'DBG Tensor', I, rx(I),rY(I),rz(I) |
| 52 | 1 | pfleura2 | rx(i)=rx(i)-CoordG(1) |
| 53 | 1 | pfleura2 | ry(i)=ry(i)-CoordG(2) |
| 54 | 1 | pfleura2 | rz(i)=rz(i)-CoordG(3) |
| 55 | 1 | pfleura2 | ! WRITE(*,*) 'DBG Tensor', I, rx(I),rY(I),rz(I) |
| 56 | 1 | pfleura2 | END DO |
| 57 | 1 | pfleura2 | |
| 58 | 1 | pfleura2 | ! C Ensuite, on va faire coincider les axes d'inertie avec x,y,z |
| 59 | 1 | pfleura2 | ! C Pour etre coherent, et bien que ce ne soit pas le plus logique, |
| 60 | 1 | pfleura2 | ! C on classe les vecteurs dans le sens croissant, et on fait coincider |
| 61 | 1 | pfleura2 | ! C les axes dans l'ordre x,y,z pour l'instant. |
| 62 | 1 | pfleura2 | |
| 63 | 1 | pfleura2 | ! C Coincidation du premier axe avec x |
| 64 | 1 | pfleura2 | ! C Rotation autour de z pour l'amener dans le plan xOz |
| 65 | 1 | pfleura2 | ! C puis Rotation autour de y pour l'amener suivant x |
| 66 | 1 | pfleura2 | na=sqrt(V(1,1)*V(1,1)+V(2,1)*V(2,1)) |
| 67 | 1 | pfleura2 | nb=1 |
| 68 | 1 | pfleura2 | if (na.gt.1D-10) then |
| 69 | 1 | pfleura2 | ca=V(1,1)/na |
| 70 | 1 | pfleura2 | sa=-V(2,1)/na |
| 71 | 1 | pfleura2 | else |
| 72 | 1 | pfleura2 | ca=1 |
| 73 | 1 | pfleura2 | sa=0 |
| 74 | 1 | pfleura2 | END IF |
| 75 | 1 | pfleura2 | cb=na/nb |
| 76 | 1 | pfleura2 | sb=-V(3,1)/nb |
| 77 | 1 | pfleura2 | DO I=1,natom |
| 78 | 1 | pfleura2 | rxt=rx(i) |
| 79 | 1 | pfleura2 | rx(i)=rx(i)*ca-ry(i)*sa |
| 80 | 1 | pfleura2 | ry(i)=rxt*sa+ry(i)*ca |
| 81 | 1 | pfleura2 | rxt=rx(i) |
| 82 | 1 | pfleura2 | rx(i)=rx(i)*cb-rz(i)*sb |
| 83 | 1 | pfleura2 | rz(i)=rxt*sb+rz(i)*cb |
| 84 | 1 | pfleura2 | END DO |
| 85 | 1 | pfleura2 | |
| 86 | 1 | pfleura2 | !C on applique aussi la rotation aux deux autres axes... |
| 87 | 1 | pfleura2 | Vt=V(1,2) |
| 88 | 1 | pfleura2 | V(1,2)=V(1,2)*ca-V(2,2)*sa |
| 89 | 1 | pfleura2 | V(2,2)=Vt*sa+V(2,2)*ca |
| 90 | 1 | pfleura2 | Vt=V(1,2) |
| 91 | 1 | pfleura2 | V(1,2)=V(1,2)*cb-V(3,2)*sb |
| 92 | 1 | pfleura2 | V(3,2)=Vt*sb+V(3,2)*cb |
| 93 | 1 | pfleura2 | |
| 94 | 1 | pfleura2 | !c WRITE(IOOUT,1010) b,(V(i,2),i=1,3) |
| 95 | 1 | pfleura2 | |
| 96 | 1 | pfleura2 | !c Vt=V(1,3) |
| 97 | 1 | pfleura2 | !c V(1,3)=V(1,3)*ca-V(2,3)*sa |
| 98 | 1 | pfleura2 | !c V(2,3)=Vt*sa+V(2,3)*ca |
| 99 | 1 | pfleura2 | !c Vt=V(1,3) |
| 100 | 1 | pfleura2 | !c V(1,3)=V(1,3)*cb-V(3,3)*sb |
| 101 | 1 | pfleura2 | !c V(3,3)=Vt*sb+V(3,3)*cb |
| 102 | 1 | pfleura2 | !c WRITE(IOOUT,1010) c,(V(i,3),i=1,3) |
| 103 | 1 | pfleura2 | |
| 104 | 1 | pfleura2 | !C et on repart pour le 2e axe sur y |
| 105 | 1 | pfleura2 | !C commes les vecteurs sont orthonormes, il est |
| 106 | 1 | pfleura2 | !C deja dans le plan yOz d'ou une seule rotation |
| 107 | 1 | pfleura2 | !c na=sqrt(V(2,2)*V(2,2)+V(3,2)*V(3,2)) |
| 108 | 1 | pfleura2 | na=1 |
| 109 | 1 | pfleura2 | nb=1 |
| 110 | 1 | pfleura2 | ca=V(2,2)/na |
| 111 | 1 | pfleura2 | sa=-V(3,2)/na |
| 112 | 1 | pfleura2 | !c write(IOOUT,*) 'ca:',ca,sa,cb,sb,na |
| 113 | 1 | pfleura2 | DO I=1,natom |
| 114 | 1 | pfleura2 | ryt=ry(i) |
| 115 | 1 | pfleura2 | ry(i)=ry(i)*ca-rz(i)*sa |
| 116 | 1 | pfleura2 | rz(i)=ryt*sa+rz(i)*ca |
| 117 | 1 | pfleura2 | END DO |
| 118 | 1 | pfleura2 | !C on applique aussi la rotation au dernier axe... |
| 119 | 1 | pfleura2 | !c Vt=V(2,3) |
| 120 | 1 | pfleura2 | !c V(2,3)=V(2,3)*ca-V(3,3)*sa |
| 121 | 1 | pfleura2 | !c V(3,3)=Vt*sa+V(3,3)*ca |
| 122 | 1 | pfleura2 | !c WRITE(IOOUT,1010) c,(V(i,3),i=1,3) |
| 123 | 1 | pfleura2 | |
| 124 | 1 | pfleura2 | !C et le 3e axe est deja sur z car ils sont orthogonaux... |
| 125 | 1 | pfleura2 | |
| 126 | 1 | pfleura2 | return |
| 127 | 1 | pfleura2 | end subroutine Std_ori |