root / src / AnalyzeGeom.f90 @ 10
Historique | Voir | Annoter | Télécharger (2,64 ko)
1 | 7 | pfleura2 | SUBROUTINE AnalyzeGeom(GeomCart,Values) |
---|---|---|---|
2 | 7 | pfleura2 | ! This routines read a list of geometrical variables to monitor |
3 | 7 | pfleura2 | ! This is inspired from Xyz2Path (that was inspired by Xyz2scan ...) |
4 | 7 | pfleura2 | |
5 | 7 | pfleura2 | |
6 | 7 | pfleura2 | use VarTypes |
7 | 7 | pfleura2 | use Path_module |
8 | 7 | pfleura2 | use Io_module |
9 | 7 | pfleura2 | |
10 | 7 | pfleura2 | IMPLICIT NONE |
11 | 7 | pfleura2 | |
12 | 7 | pfleura2 | |
13 | 7 | pfleura2 | INTERFACE |
14 | 7 | pfleura2 | function valid(string) result (isValid) |
15 | 7 | pfleura2 | CHARACTER(*), intent(in) :: string |
16 | 7 | pfleura2 | logical :: isValid |
17 | 7 | pfleura2 | END function VALID |
18 | 7 | pfleura2 | |
19 | 7 | pfleura2 | SUBROUTINE die(routine, msg, file, line, unit) |
20 | 7 | pfleura2 | |
21 | 7 | pfleura2 | Use VarTypes |
22 | 7 | pfleura2 | Use io_module |
23 | 7 | pfleura2 | |
24 | 7 | pfleura2 | implicit none |
25 | 7 | pfleura2 | |
26 | 7 | pfleura2 | character(len=*), intent(in) :: routine, msg |
27 | 7 | pfleura2 | character(len=*), intent(in), optional :: file |
28 | 7 | pfleura2 | integer(KINT), intent(in), optional :: line, unit |
29 | 7 | pfleura2 | |
30 | 7 | pfleura2 | END SUBROUTINE die |
31 | 7 | pfleura2 | |
32 | 7 | pfleura2 | |
33 | 7 | pfleura2 | SUBROUTINE Calc_Xprim(nat,x,y,z,Coordinate,NPrim,XPrimitive,XPrimRef) |
34 | 7 | pfleura2 | |
35 | 7 | pfleura2 | Use VarTypes |
36 | 7 | pfleura2 | Use Io_module |
37 | 7 | pfleura2 | Use Path_module, only : pi |
38 | 7 | pfleura2 | |
39 | 7 | pfleura2 | IMPLICIT NONE |
40 | 7 | pfleura2 | |
41 | 7 | pfleura2 | Type (ListCoord), POINTER :: Coordinate |
42 | 7 | pfleura2 | INTEGER(KINT), INTENT(IN) :: Nat,NPrim |
43 | 7 | pfleura2 | REAL(KREAL), INTENT(IN) :: x(Nat), y(Nat), z(Nat) |
44 | 7 | pfleura2 | REAL(KREAL), INTENT(IN), OPTIONAL :: XPrimRef(NPrim) |
45 | 7 | pfleura2 | REAL(KREAL), INTENT(OUT) :: XPrimitive(NPrim) |
46 | 7 | pfleura2 | |
47 | 7 | pfleura2 | END SUBROUTINE CALC_XPRIM |
48 | 7 | pfleura2 | |
49 | 7 | pfleura2 | END INTERFACE |
50 | 7 | pfleura2 | |
51 | 7 | pfleura2 | ! Input |
52 | 7 | pfleura2 | REAL(KREAL),INTENT(IN) :: GeomCart(Nat,3) |
53 | 7 | pfleura2 | REAL(KREAL), INTENT(OUT) :: Values(NbVar) |
54 | 7 | pfleura2 | |
55 | 7 | pfleura2 | LOGICAL :: Debug |
56 | 7 | pfleura2 | INTEGER(KINT) :: I,J,K,NatT |
57 | 7 | pfleura2 | REAL(KREAL), ALLOCATABLE :: GeoCartLoc(:,:) ! (Nat+NbCom,3) |
58 | 7 | pfleura2 | REAL(KREAL), ALLOCATABLE :: x(:),y(:),z(:) ! Nat+NbCom |
59 | 7 | pfleura2 | REAL(KREAL) :: COG(3),Weight |
60 | 7 | pfleura2 | |
61 | 7 | pfleura2 | |
62 | 7 | pfleura2 | |
63 | 7 | pfleura2 | Debug=Valid('AnaGeom') |
64 | 7 | pfleura2 | |
65 | 7 | pfleura2 | If (Debug) Call Header("Entering AnalyzeGeom") |
66 | 7 | pfleura2 | |
67 | 7 | pfleura2 | if (debug) THEN |
68 | 7 | pfleura2 | WRITE(*,*) "AnalyzeGeom - GeomCart" |
69 | 7 | pfleura2 | DO K=1,Nat |
70 | 7 | pfleura2 | WRITE(*,'(1X,I5,3(1X,F15.8))') K,GeomCart(K,1:3) |
71 | 7 | pfleura2 | END DO |
72 | 7 | pfleura2 | END IF |
73 | 7 | pfleura2 | |
74 | 7 | pfleura2 | NAtt=Nat+NbCom |
75 | 7 | pfleura2 | ALLOCATE(GeoCartLoc(Natt,3),x(Natt),y(Natt),z(Natt)) |
76 | 7 | pfleura2 | GeoCartLoc(1:Nat,:)=GeomCart(:,:) |
77 | 7 | pfleura2 | CurBary => Bary |
78 | 7 | pfleura2 | |
79 | 7 | pfleura2 | DO I=1, NbCom |
80 | 7 | pfleura2 | COG=0. |
81 | 7 | pfleura2 | Weight=0. |
82 | 7 | pfleura2 | DO j=1,CurBary%ListAtoms(0) |
83 | 7 | pfleura2 | DO k=1,3 |
84 | 7 | pfleura2 | COG(k)=COG(k)+GeomCart(CurBary%ListAtoms(j),k)*CurBary%Weights(j) |
85 | 7 | pfleura2 | END DO |
86 | 7 | pfleura2 | Weight=Weight+CurBary%Weights(j) |
87 | 7 | pfleura2 | END DO |
88 | 7 | pfleura2 | COG=COG/Weight |
89 | 7 | pfleura2 | DO k=1,3 |
90 | 7 | pfleura2 | GeoCartLoc(Nat+i,k)=COG(k) |
91 | 7 | pfleura2 | END DO |
92 | 7 | pfleura2 | END DO |
93 | 7 | pfleura2 | |
94 | 7 | pfleura2 | Values=0. |
95 | 7 | pfleura2 | |
96 | 7 | pfleura2 | if (debug) THEN |
97 | 7 | pfleura2 | WRITE(*,*) "AnalyzeGeom before Calc_Xprim - GeomCartLoc" |
98 | 7 | pfleura2 | DO K=1,Nat+NbCom |
99 | 7 | pfleura2 | WRITE(*,*) K,GeoCartLoc(K,1:3) |
100 | 7 | pfleura2 | END DO |
101 | 7 | pfleura2 | END IF |
102 | 7 | pfleura2 | |
103 | 7 | pfleura2 | x = GeoCartLoc(:,1) |
104 | 7 | pfleura2 | y = GeoCartLoc(:,2) |
105 | 7 | pfleura2 | z = GeoCartLoc(:,3) |
106 | 7 | pfleura2 | |
107 | 7 | pfleura2 | Call Calc_XPrim(Natt,x,y,z,GeomList,NbVar,Values) |
108 | 7 | pfleura2 | |
109 | 7 | pfleura2 | DeALLOCATE(GeoCartLoc,x,y,z) |
110 | 7 | pfleura2 | |
111 | 7 | pfleura2 | if (debug) THEN |
112 | 7 | pfleura2 | WRITE(*,*) 'AnalyzeGeom: NbVar,Values',NbVar,Values |
113 | 7 | pfleura2 | END IF |
114 | 7 | pfleura2 | |
115 | 7 | pfleura2 | If (Debug) Call Header("Exiting AnalizeGeom") |
116 | 7 | pfleura2 | |
117 | 7 | pfleura2 | END SUBROUTINE AnalyzeGeom |