root / src / ConvertZmat_cart_3.f90 @ 2
Historique | Voir | Annoter | Télécharger (2,26 ko)
| 1 | 1 | pfleura2 | !C================================================================ |
|---|---|---|---|
| 2 | 1 | pfleura2 | !C Converti les positions Zmat en coordonnes cartesiennes |
| 3 | 1 | pfleura2 | !C This version deals with the third atoms in A B C |
| 4 | 1 | pfleura2 | !C Used in Mix to Cart. |
| 5 | 1 | pfleura2 | !C================================================================ |
| 6 | 1 | pfleura2 | |
| 7 | 1 | pfleura2 | SUBROUTINE ConvertZmat_cart_3(iat,ind_zmat,d,a_val,x,y,z) |
| 8 | 1 | pfleura2 | |
| 9 | 1 | pfleura2 | use Path_module, only : Nat, KINT, KREAL |
| 10 | 1 | pfleura2 | |
| 11 | 1 | pfleura2 | IMPLICIT NONE |
| 12 | 1 | pfleura2 | |
| 13 | 2 | pfleura2 | integer(KINT) :: iat, n1, n2 |
| 14 | 1 | pfleura2 | real(KREAL) :: x(nat),y(nat),z(nat) |
| 15 | 1 | pfleura2 | real(KREAL) :: d,a_val |
| 16 | 1 | pfleura2 | integer(KINT) :: ind_zmat(Nat,5) |
| 17 | 1 | pfleura2 | |
| 18 | 1 | pfleura2 | real(KREAL) :: vx1,vy1,vz1,norm1 |
| 19 | 1 | pfleura2 | real(KREAL) :: vvx1,vvy1,vvz1,normv1 |
| 20 | 2 | pfleura2 | real(KREAL) :: vx4, vy4, vz4 |
| 21 | 1 | pfleura2 | real(KREAL) :: a11_z1,a12_z1 |
| 22 | 1 | pfleura2 | real(KREAL) :: a11_y,a12_y |
| 23 | 1 | pfleura2 | |
| 24 | 1 | pfleura2 | |
| 25 | 1 | pfleura2 | |
| 26 | 1 | pfleura2 | !C ind_zmat(1) contient le numero de l'atome, (2) celui par rapport auquel on definit la distance... |
| 27 | 1 | pfleura2 | |
| 28 | 1 | pfleura2 | n1=ind_zmat(iat,2) |
| 29 | 1 | pfleura2 | n2=ind_zmat(iat,3) |
| 30 | 1 | pfleura2 | |
| 31 | 1 | pfleura2 | ! WRITE(*,*) iat,n1,n2 |
| 32 | 1 | pfleura2 | |
| 33 | 1 | pfleura2 | ! WRITE(*,*) "d,val,di",d,a_val,a_dih,a_val*180./3.141592654 |
| 34 | 1 | pfleura2 | |
| 35 | 1 | pfleura2 | CALL vecteur(n1,n2,x,y,z,vx1,vy1,vz1,norm1) |
| 36 | 1 | pfleura2 | |
| 37 | 1 | pfleura2 | vvx1=vx1 |
| 38 | 1 | pfleura2 | vvy1=vy1 |
| 39 | 1 | pfleura2 | vvz1=vz1 |
| 40 | 1 | pfleura2 | |
| 41 | 1 | pfleura2 | !c rotation autour de z de v1 de phi (a11_z1=cos(phi) et a12_z1=sin(phi) ) tq |
| 42 | 1 | pfleura2 | !C v1 soit dans le plan xOz |
| 43 | 1 | pfleura2 | |
| 44 | 1 | pfleura2 | normv1=dsqrt(vvx1*vvx1+vvy1*vvy1) |
| 45 | 1 | pfleura2 | |
| 46 | 1 | pfleura2 | IF (normv1 .GE. 1.D-6) THEN |
| 47 | 1 | pfleura2 | a11_z1 = vvx1/normv1 |
| 48 | 1 | pfleura2 | a12_z1 = vvy1/normv1 |
| 49 | 1 | pfleura2 | ELSE |
| 50 | 1 | pfleura2 | a11_z1 = 1 |
| 51 | 1 | pfleura2 | a12_z1 = 0 |
| 52 | 1 | pfleura2 | END IF |
| 53 | 1 | pfleura2 | |
| 54 | 1 | pfleura2 | CALL rota_z(vx1,vy1,vz1,a11_z1,-a12_z1) |
| 55 | 1 | pfleura2 | |
| 56 | 1 | pfleura2 | !c rotation autour de y de v1 de theta (a11_y=cos(theta) et a12_y=sin(theta) ) tq |
| 57 | 1 | pfleura2 | !C v1 soit sur l'axe Ox |
| 58 | 1 | pfleura2 | |
| 59 | 1 | pfleura2 | |
| 60 | 1 | pfleura2 | IF (norm1 .GE. 1.D-8) THEN |
| 61 | 1 | pfleura2 | a11_y = vz1/norm1 |
| 62 | 1 | pfleura2 | a12_y = vx1/norm1 |
| 63 | 1 | pfleura2 | ELSE |
| 64 | 1 | pfleura2 | a11_y = 1 |
| 65 | 1 | pfleura2 | a12_y = 0 |
| 66 | 1 | pfleura2 | END IF |
| 67 | 1 | pfleura2 | |
| 68 | 1 | pfleura2 | CALL rota_y(vx1,vy1,vz1,a11_y,a12_y) |
| 69 | 1 | pfleura2 | |
| 70 | 1 | pfleura2 | |
| 71 | 1 | pfleura2 | !c calcul le vecteur de l atome dans la nouvelle orientation |
| 72 | 1 | pfleura2 | |
| 73 | 1 | pfleura2 | vx4=d*sin(a_val) |
| 74 | 1 | pfleura2 | vy4=0. |
| 75 | 1 | pfleura2 | vz4=d*cos(a_val) |
| 76 | 1 | pfleura2 | |
| 77 | 1 | pfleura2 | !c calcul le vecteur de l atome |
| 78 | 1 | pfleura2 | !c on tourne en sens invers |
| 79 | 1 | pfleura2 | CALL rota_y(vx4,vy4,vz4,a11_y ,-a12_y ) |
| 80 | 1 | pfleura2 | CALL rota_z(vx4,vy4,vz4,a11_z1, a12_z1) |
| 81 | 1 | pfleura2 | |
| 82 | 1 | pfleura2 | !c calcul l atome a partir de v4 |
| 83 | 1 | pfleura2 | x(iat)=vx4+x(n1) |
| 84 | 1 | pfleura2 | y(iat)=vy4+y(n1) |
| 85 | 1 | pfleura2 | z(iat)=vz4+z(n1) |
| 86 | 1 | pfleura2 | |
| 87 | 1 | pfleura2 | END |
| 88 | 1 | pfleura2 |