Statistiques
| Révision :

root / src / ReadAnaList.f90 @ 7

Historique | Voir | Annoter | Télécharger (4,18 ko)

1
 SUBROUTINE ReadAnaList
2
! This routines read a list of geometrical variables to monitor
3
! This is inspired from Xyz2Path (that was inspired by Xyz2scan ...)
4

    
5

    
6
  use VarTypes
7
  use Path_module
8
  use Io_module
9

    
10
  IMPLICIT NONE
11

    
12

    
13
  INTERFACE
14
     function valid(string) result (isValid)
15
       CHARACTER(*), intent(in) :: string
16
       logical                  :: isValid
17
     END function VALID
18

    
19
     SUBROUTINE die(routine, msg, file, line, unit)
20

    
21
       Use VarTypes
22
       Use io_module
23

    
24
       implicit none
25

    
26
       character(len=*), intent(in)           :: routine, msg
27
       character(len=*), intent(in), optional :: file
28
       integer(KINT), intent(in), optional      :: line, unit
29

    
30
     END SUBROUTINE die
31

    
32
  END INTERFACE
33

    
34
  LOGICAL :: Debug,FirstVar,FirstCom
35
  INTEGER(KINT) :: At1,At2,At3,At4
36
  INTEGER(KINT) :: I,Idx,J
37

    
38
  CHARACTER(LCHARS) :: Line
39

    
40
  Debug=Valid('ReadAnaList')
41
  If (Debug) Call Header("Entering ReadAnaList")
42

    
43
  Allocate(Bary)
44
  Nullify(Bary%Next)
45
  CurBary => Bary
46

    
47
  ALLOCATE(GeomList)
48
  Nullify(GeomList%Next)
49
  CurVar => GeomList
50

    
51
  NbCom=0
52
  NbVar=0
53
  FormAna='(1X'
54
  DO I=1, Nb
55
     READ(IOIN,'(A)') Line
56
     Line=AdjustL(Line)
57
     Call Upcase(Line)
58

    
59
     SELECT CASE (Line(1:1))
60
        CASE ('B') 
61
! this is a bond
62
           CurVar%Type="BOND"
63
           Idx=Index(Line," ")
64
           Line=Line(Idx+1:)
65
           Read(Line,*) At1, At2
66
           CurVar%At1=At1
67
           CurVar%At2=At2
68
           CurVar%Value=0.
69
!           CurVar%PrintFactor=1.
70
           Curvar%SignDihedral=1
71
           if (debug) THEN
72
              WRITE(*,'("# b ",2I3)') At1,At2
73
           END IF
74
           FormAna=TRIM(FormAna) //',1X,F7.3'
75
           Allocate(CurVar%Next)
76
           CurVar => CurVar%Next
77
           Nullify(CurVar%Next)
78
        CASE ('A') 
79
! this is a valence angle
80
           CurVar%Type="ANGLE"
81
           Idx=Index(Line," ")
82
           Line=Line(Idx+1:)
83
           Read(Line,*) At1, At2,At3
84
           CurVar%At1=At1
85
           CurVar%At2=At2
86
           CurVar%At3=At3
87
           CurVar%Value=0.
88
!           CurVar%PrintFactor=180./Pi
89
           Curvar%SignDihedral=1
90
           if (debug) THEN
91
              WRITE(*,'("# a ",4(I3))') At1,At2,At3
92
           END IF
93
           FormAna=TRIM(FormAna) //',1X,F7.2'
94
           Allocate(CurVar%Next)
95
           CurVar => CurVar%Next
96
           Nullify(CurVar%Next)
97
        CASE ('D') 
98
! this is a dihedral
99
           CurVar%Type="DIHEDRAL"
100
           Idx=Index(Line," ")
101
           Line=Line(Idx+1:)
102
           Read(Line,*) At1, At2,At3,At4
103
           CurVar%At1=At1
104
           CurVar%At2=At2
105
           CurVar%At3=At3
106
           CurVar%At4=At4
107
           CurVar%Value=0.
108
!           CurVar%PrintFactor=180./Pi
109
           Curvar%SignDihedral=1
110
           if (debug) THEN
111
              WRITE(*,'("# d ",4(I3))') At1,At2,At3,At4
112
           END IF
113
           Allocate(CurVar%Next)
114
           CurVar => CurVar%Next
115
           Nullify(CurVar%Next)
116
        CASE ('C') 
117
           NbCom=NbCom+1
118
           Idx=Index(Line," ")
119
           Line=Line(Idx+1:)
120
           READ(Line,*) At1
121
           Allocate(CurBary%ListAtoms(0:At1))
122
           Allocate(CurBary%Weights(1:At1))
123
           CurBary%Weights=1.
124
           CurBary%ListAtoms(0)=At1
125
           Idx=Index(Line," ")
126
           Line=Line(Idx+1:)
127
           READ(Line,*) CurBary%ListAtoms(1:At1)
128
           if (debug) THEN
129
              WRITE(*,'("# c ",I4,20(I3))') At1, &
130
                   (CurBary%ListAtoms(j),j=1,At1)
131
           END IF
132
           FormAna=Trim(FormAna) //',1X,F7.2'
133

    
134
           Allocate(CurBary%Next)
135
           CurBary => CurBary%Next
136
           Nullify(CurBary%Next)
137

    
138
        CASE Default
139
           Call Die('ReadAnaList','Variable not recognized: ' //Line, Unit=IOOUT)
140
     END SELECT
141

    
142
  END DO
143

    
144
  NbVar=Nb-NbCom
145

    
146
  CurVar => GeomList
147
  I=0
148

    
149
  Allocate(PrintGeomFactor(NbVar))
150
  DO WHILE (associated(CurVar%Next))
151
     I=I+1
152
     SELECT CASE (CurVar%TYPE)
153
        CASE ('ANGLE','DIHEDRAL')
154
           PrintGeomFactor(I)=180./pi
155
        CASE DEFAULT
156
           PrintGeomFactor(I)=1.
157
     END SELECT
158
     CurVar => CurVar%Next
159
  END DO
160
  
161
  FormAna=Trim(FormAna) // ',1X,F7.2,1X,F15.6)'
162

    
163

    
164
!  if (debug) WRITE(*,*) "NbVar, NbCom,Nb",NbVar,NbCom,Nb
165

    
166
  if (debug) Call Header(" Exiting ReadAnaList")
167

    
168
END SUBROUTINE ReadAnaList