Statistiques
| Révision :

root / src / Std_ori.f90 @ 3

Historique | Voir | Annoter | Télécharger (3,26 ko)

1
subroutine Std_ori(natom,rx,ry,rz,a,b,c,rmass)
2
  !c
3
  !c      rotational constants for all replicas by inline diagonalization
4
  !c      of inertial tensor
5
  !c
6
!!!!!!! Input
7
! natom    : number of atoms
8
! rx,ry,rz : arrays natom with cartesian coordinates of natom particles
9
! rmass    : vector of length natom with particle masses
10
!
11
!!!!!!! Output
12
! a,b,c    : rotational constants a, b, and c
13
!
14
!!!!!! Dependencies
15
! tensor: calculate the inertial tensor
16
! Jacobi, trie : diaganalization subroutines
17

    
18
  implicit none
19

    
20
  INTEGER, PARAMETER :: KINT=KIND(1)
21
  INTEGER, PARAMETER :: KREAL=KIND(1.0D0)
22

    
23
  INTEGER(KINT), INTENT(IN) :: Natom
24
  REAL(KREAL), INTENT(INOUT) :: rx(Natom),ry(Natom),rz(Natom)
25
  REAL(KREAL), INTENT(IN) :: rmass(Natom)
26
  REAL(KREAL), INTENT(OUT) :: a,b,c
27

    
28
  real(KREAL) :: Tinert(3,3),D(3),V(3,3),CoordG(3)
29
  real(KREAL) :: ca,sa,na,cb,sb,nb
30

    
31
  INTEGER(KINT) :: I
32
  REAL(KREAL) :: Vt,Rxt,Ryt
33

    
34
  call tensor(natom,rx,ry,rz,Tinert,CoordG,rmass)
35
  call Jacobi(Tinert,3,D,V,3)
36
  call Trie(3,D,V,3)
37

    
38
!1000 FORMAT(3F15.3)
39
!1010 FORMAT(4F15.3)
40

    
41
  a=D(1)
42
!     WRITE(*,1010) a,(V(i,1),i=1,3)
43
  b=D(2)
44
!     WRITE(*,1010) b,(V(i,2),i=1,3)
45
  c=D(3)
46
!     WRITE(*,1010) c,(V(i,3),i=1,3)
47

    
48
!C On commence par mettre le centre de masse a l'origine
49

    
50
  Do I=1,natom
51
!     WRITE(*,*) 'DBG Tensor', I, rx(I),rY(I),rz(I)
52
     rx(i)=rx(i)-CoordG(1)
53
     ry(i)=ry(i)-CoordG(2)
54
     rz(i)=rz(i)-CoordG(3)
55
!     WRITE(*,*) 'DBG Tensor', I, rx(I),rY(I),rz(I)
56
  END DO
57

    
58
  ! C Ensuite, on va faire coincider les axes d'inertie avec x,y,z
59
  ! C Pour etre coherent, et bien que ce ne soit pas le plus logique,
60
  ! C on classe les vecteurs dans le sens croissant, et on fait coincider
61
  ! C les axes dans l'ordre x,y,z pour l'instant.
62

    
63
  ! C Coincidation du premier axe avec x
64
  ! C Rotation autour de z pour l'amener dans le plan xOz
65
  ! C puis Rotation autour de y pour l'amener suivant x
66
  na=sqrt(V(1,1)*V(1,1)+V(2,1)*V(2,1))
67
  nb=1
68
  if (na.gt.1D-10) then
69
     ca=V(1,1)/na
70
     sa=-V(2,1)/na
71
  else
72
     ca=1
73
     sa=0
74
  END IF
75
  cb=na/nb
76
  sb=-V(3,1)/nb
77
  DO I=1,natom
78
     rxt=rx(i)
79
     rx(i)=rx(i)*ca-ry(i)*sa
80
     ry(i)=rxt*sa+ry(i)*ca
81
     rxt=rx(i)
82
     rx(i)=rx(i)*cb-rz(i)*sb
83
     rz(i)=rxt*sb+rz(i)*cb
84
  END DO
85

    
86
  !C on applique aussi la rotation aux deux autres axes...
87
  Vt=V(1,2)
88
  V(1,2)=V(1,2)*ca-V(2,2)*sa
89
  V(2,2)=Vt*sa+V(2,2)*ca
90
  Vt=V(1,2)
91
  V(1,2)=V(1,2)*cb-V(3,2)*sb
92
  V(3,2)=Vt*sb+V(3,2)*cb
93

    
94
  !c     WRITE(IOOUT,1010) b,(V(i,2),i=1,3)
95

    
96
  !c      Vt=V(1,3)
97
  !c      V(1,3)=V(1,3)*ca-V(2,3)*sa
98
  !c      V(2,3)=Vt*sa+V(2,3)*ca
99
  !c      Vt=V(1,3)
100
  !c      V(1,3)=V(1,3)*cb-V(3,3)*sb
101
  !c      V(3,3)=Vt*sb+V(3,3)*cb
102
  !c     WRITE(IOOUT,1010) c,(V(i,3),i=1,3)
103

    
104
  !C et on repart pour le 2e axe sur y
105
  !C commes les vecteurs sont orthonormes, il est
106
  !C deja dans le plan yOz d'ou une seule rotation
107
  !c      na=sqrt(V(2,2)*V(2,2)+V(3,2)*V(3,2))
108
  na=1
109
  nb=1
110
  ca=V(2,2)/na
111
  sa=-V(3,2)/na
112
  !c      write(IOOUT,*) 'ca:',ca,sa,cb,sb,na
113
  DO I=1,natom
114
     ryt=ry(i)
115
     ry(i)=ry(i)*ca-rz(i)*sa
116
     rz(i)=ryt*sa+rz(i)*ca
117
  END DO
118
  !C on applique aussi la rotation au dernier axe...
119
  !c      Vt=V(2,3)
120
  !c      V(2,3)=V(2,3)*ca-V(3,3)*sa
121
  !c      V(3,3)=Vt*sa+V(3,3)*ca
122
  !c      WRITE(IOOUT,1010) c,(V(i,3),i=1,3)
123

    
124
  !C et le 3e axe est deja sur z car  ils sont orthogonaux...
125

    
126
  return
127
end subroutine Std_ori