Statistiques
| Révision :

root / src / ReadAnaList.f90 @ 8

Historique | Voir | Annoter | Télécharger (4,17 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
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,F8.3'
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
           FormAna=TRIM(FormAna) //',1X,F7.2'
114
           Allocate(CurVar%Next)
115
           CurVar => CurVar%Next
116
           Nullify(CurVar%Next)
117
        CASE ('C') 
118
           NbCom=NbCom+1
119
           Idx=Index(Line," ")
120
           Line=Line(Idx+1:)
121
           READ(Line,*) At1
122
           Allocate(CurBary%ListAtoms(0:At1))
123
           Allocate(CurBary%Weights(1:At1))
124
           CurBary%Weights=1.
125
           CurBary%ListAtoms(0)=At1
126
           Idx=Index(Line," ")
127
           Line=Line(Idx+1:)
128
           READ(Line,*) CurBary%ListAtoms(1:At1)
129
           if (debug) THEN
130
              WRITE(*,'("# c ",I4,20(I3))') At1, &
131
                   (CurBary%ListAtoms(j),j=1,At1)
132
           END IF
133
           Allocate(CurBary%Next)
134
           CurBary => CurBary%Next
135
           Nullify(CurBary%Next)
136

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

    
141
  END DO
142

    
143
  NbVar=Nb-NbCom
144

    
145
  CurVar => GeomList
146
  I=0
147

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

    
162

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

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

    
167
END SUBROUTINE ReadAnaList