root / src / Tensor.f90 @ 3
Historique | Voir | Annoter | Télécharger (2,8 ko)
| 1 | 1 | pfleura2 | subroutine tensor(natom,rx,ry,rz,Tinert,CoordG,rmass) |
|---|---|---|---|
| 2 | 1 | pfleura2 | ! c |
| 3 | 1 | pfleura2 | ! c elements of inertial tensor for a set of atomic systems. |
| 4 | 1 | pfleura2 | ! c |
| 5 | 1 | pfleura2 | ! c rx,ry,rz : arrays natom with cartesian coordinates of natom particles; input |
| 6 | 1 | pfleura2 | ! c txx,tyy,tzz,txy,txz,tyz: elements of inertial tensors ; output |
| 7 | 1 | pfleura2 | ! c a,b,c : returning center of mass coordinates. |
| 8 | 1 | pfleura2 | ! c rmass : vector of length natom with particle masses; input |
| 9 | 1 | pfleura2 | ! c natom : number of particles per system; input |
| 10 | 1 | pfleura2 | ! c IOOUT : unit number for messages, silent for IOOUT.le.0; input |
| 11 | 1 | pfleura2 | ! c subroutines called: cmshft m. lewerenz jul/92 |
| 12 | 1 | pfleura2 | ! c |
| 13 | 1 | pfleura2 | |
| 14 | 1 | pfleura2 | use Io_module |
| 15 | 1 | pfleura2 | |
| 16 | 1 | pfleura2 | IMPLICIT NONE |
| 17 | 1 | pfleura2 | |
| 18 | 2 | pfleura2 | REAL(KREAL), parameter :: zero=0.d0 |
| 19 | 1 | pfleura2 | |
| 20 | 1 | pfleura2 | INTEGER(KINT), INTENT(IN) :: Natom |
| 21 | 1 | pfleura2 | real(KREAL) :: rx(Natom),ry(Natom),rz(Natom),rmass(Natom) |
| 22 | 1 | pfleura2 | real(KREAL) :: a,b,c,Tinert(3,3),CoordG(3) |
| 23 | 1 | pfleura2 | |
| 24 | 2 | pfleura2 | INTEGER(KINT) :: jover, J |
| 25 | 1 | pfleura2 | REAL(KREAL) :: Txx, Tyy, Tzz, Txy, Txz, Tyz, Txxi |
| 26 | 1 | pfleura2 | REAL(KREAL) :: Ryb, Rzc, Rxa, Rmj2, ryb2, rzc2, rxa2, Rmj |
| 27 | 1 | pfleura2 | |
| 28 | 1 | pfleura2 | |
| 29 | 1 | pfleura2 | if(natom.le.0) then |
| 30 | 1 | pfleura2 | if(IOOUT.gt.0) write(IOOUT,'(/2a/)') & |
| 31 | 1 | pfleura2 | ' *** error, illegal array dimension(s) in tensor,', & |
| 32 | 1 | pfleura2 | ' return without action ***' |
| 33 | 1 | pfleura2 | else if(natom.eq.1) then |
| 34 | 1 | pfleura2 | a=rx(1) |
| 35 | 1 | pfleura2 | b=ry(1) |
| 36 | 1 | pfleura2 | c=rz(1) |
| 37 | 1 | pfleura2 | txx=zero |
| 38 | 1 | pfleura2 | tyy=zero |
| 39 | 1 | pfleura2 | tzz=zero |
| 40 | 1 | pfleura2 | txy=zero |
| 41 | 1 | pfleura2 | txz=zero |
| 42 | 1 | pfleura2 | tyz=zero |
| 43 | 1 | pfleura2 | else |
| 44 | 1 | pfleura2 | !c |
| 45 | 1 | pfleura2 | !c first center of mass coordinates, then tensor elements |
| 46 | 1 | pfleura2 | !c |
| 47 | 1 | pfleura2 | call cmshft(natom,rx,ry,rz,rmass,a,b,c,0) |
| 48 | 1 | pfleura2 | CoordG(1)=a |
| 49 | 1 | pfleura2 | CoordG(2)=b |
| 50 | 1 | pfleura2 | CoordG(3)=c |
| 51 | 2 | pfleura2 | |
| 52 | 1 | pfleura2 | jover=mod(natom,2) |
| 53 | 1 | pfleura2 | if(jover.eq.0) then |
| 54 | 1 | pfleura2 | txx=zero |
| 55 | 1 | pfleura2 | tyy=zero |
| 56 | 1 | pfleura2 | tzz=zero |
| 57 | 1 | pfleura2 | txy=zero |
| 58 | 1 | pfleura2 | txz=zero |
| 59 | 1 | pfleura2 | tyz=zero |
| 60 | 1 | pfleura2 | else |
| 61 | 1 | pfleura2 | rmj=rmass(1) |
| 62 | 1 | pfleura2 | ryb=b-ry(1) |
| 63 | 1 | pfleura2 | rzc=c-rz(1) |
| 64 | 1 | pfleura2 | tyz=-rmj*ryb*rzc |
| 65 | 1 | pfleura2 | rxa=a-rx(1) |
| 66 | 1 | pfleura2 | txz=(-rmj*rxa)*rzc |
| 67 | 1 | pfleura2 | txy=(-rmj*rxa)*ryb |
| 68 | 1 | pfleura2 | txx=rmj*((ryb*ryb)+(rzc*rzc)) |
| 69 | 1 | pfleura2 | tyy=rmj*((rxa*rxa)+(rzc*rzc)) |
| 70 | 1 | pfleura2 | tzz=rmj*((rxa*rxa)+(ryb*ryb)) |
| 71 | 1 | pfleura2 | end if |
| 72 | 1 | pfleura2 | !c |
| 73 | 1 | pfleura2 | !c force vectorization of inner loop if necessary (ibm-3090) |
| 74 | 1 | pfleura2 | !c |
| 75 | 1 | pfleura2 | do j=jover+1,natom,2 |
| 76 | 1 | pfleura2 | rmj=rmass(j) |
| 77 | 1 | pfleura2 | rmj2=rmass(j+1) |
| 78 | 1 | pfleura2 | ryb=b-ry(j) |
| 79 | 1 | pfleura2 | rzc=c-rz(j) |
| 80 | 1 | pfleura2 | txxi=txx+rmj*((ryb*ryb)+(rzc*rzc)) |
| 81 | 1 | pfleura2 | ryb2=b-ry(j+1) |
| 82 | 1 | pfleura2 | rzc2=c-rz(j+1) |
| 83 | 1 | pfleura2 | txx=txxi+rmj2*((ryb2*ryb2)+(rzc2*rzc2)) |
| 84 | 1 | pfleura2 | tyz=tyz-rmj*ryb*rzc-rmj2*ryb2*rzc2 |
| 85 | 1 | pfleura2 | rxa=a-rx(j) |
| 86 | 1 | pfleura2 | rxa2=a-rx(j+1) |
| 87 | 1 | pfleura2 | txy=txy-(rmj*rxa)*ryb-(rmj2*rxa2)*ryb2 |
| 88 | 1 | pfleura2 | txz=txz-(rmj*rxa)*rzc-(rmj2*rxa2)*rzc2 |
| 89 | 1 | pfleura2 | tyy=tyy+rmj*((rxa*rxa)+(rzc*rzc)) & |
| 90 | 1 | pfleura2 | +rmj2*((rxa2*rxa2)+(rzc2*rzc2)) |
| 91 | 1 | pfleura2 | tzz=tzz+rmj*((rxa*rxa)+(ryb*ryb)) & |
| 92 | 1 | pfleura2 | +rmj2*((rxa2*rxa2)+(ryb2*ryb2)) |
| 93 | 1 | pfleura2 | END DO |
| 94 | 1 | pfleura2 | end if |
| 95 | 1 | pfleura2 | Tinert(1,1)=txx |
| 96 | 1 | pfleura2 | Tinert(1,2)=txy |
| 97 | 1 | pfleura2 | Tinert(1,3)=txz |
| 98 | 1 | pfleura2 | Tinert(2,1)=txy |
| 99 | 1 | pfleura2 | Tinert(2,2)=tyy |
| 100 | 1 | pfleura2 | Tinert(2,3)=tyz |
| 101 | 1 | pfleura2 | Tinert(3,1)=txz |
| 102 | 1 | pfleura2 | Tinert(3,2)=tyz |
| 103 | 1 | pfleura2 | Tinert(3,3)=tzz |
| 104 | 1 | pfleura2 | return |
| 105 | 1 | pfleura2 | end subroutine tensor |