Statistiques
| Révision :

root / src / ReadAnaList.f90

Historique | Voir | Annoter | Télécharger (5,47 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
!  Copyright 2003-2014 Ecole Normale Supérieure de Lyon, 
7
!  Centre National de la Recherche Scientifique,
8
!  Université Claude Bernard Lyon 1. All rights reserved.
9
!
10
!  This work is registered with the Agency for the Protection of Programs 
11
!  as IDDN.FR.001.100009.000.S.P.2014.000.30625
12
!
13
!  Authors: P. Fleurat-Lessard, P. Dayal
14
!  Contact: optnpath@gmail.com
15
!
16
! This file is part of "Opt'n Path".
17
!
18
!  "Opt'n Path" is free software: you can redistribute it and/or modify
19
!  it under the terms of the GNU Affero General Public License as
20
!  published by the Free Software Foundation, either version 3 of the License,
21
!  or (at your option) any later version.
22
!
23
!  "Opt'n Path" is distributed in the hope that it will be useful,
24
!  but WITHOUT ANY WARRANTY; without even the implied warranty of
25
!
26
!  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
!  GNU Affero General Public License for more details.
28
!
29
!  You should have received a copy of the GNU Affero General Public License
30
!  along with "Opt'n Path". If not, see <http://www.gnu.org/licenses/>.
31
!
32
! Contact The Office of Technology Licensing, valorisation@ens-lyon.fr,
33
! for commercial licensing opportunities.
34
!----------------------------------------------------------------------
35

    
36

    
37
  use VarTypes
38
  use Path_module
39
  use Io_module
40

    
41
  IMPLICIT NONE
42

    
43

    
44
  INTERFACE
45
     function valid(string) result (isValid)
46
       CHARACTER(*), intent(in) :: string
47
       logical                  :: isValid
48
     END function VALID
49

    
50
     SUBROUTINE die(routine, msg, file, line, unit)
51

    
52
       Use VarTypes
53
       Use io_module
54

    
55
       implicit none
56

    
57
       character(len=*), intent(in)           :: routine, msg
58
       character(len=*), intent(in), optional :: file
59
       integer(KINT), intent(in), optional      :: line, unit
60

    
61
     END SUBROUTINE die
62

    
63
  END INTERFACE
64

    
65
  LOGICAL :: Debug
66
  INTEGER(KINT) :: At1,At2,At3,At4
67
  INTEGER(KINT) :: I,Idx,J
68

    
69
  CHARACTER(LCHARS) :: Line
70

    
71
  Debug=Valid('ReadAnaList')
72
  If (Debug) Call Header("Entering ReadAnaList")
73

    
74
  Allocate(Bary)
75
  Nullify(Bary%Next)
76
  CurBary => Bary
77

    
78
  ALLOCATE(GeomList)
79
  Nullify(GeomList%Next)
80
  CurVar => GeomList
81

    
82
  NbCom=0
83
  NbVar=0
84
  FormAna='(1X,F8.3'
85
  DO I=1, Nb
86
     READ(IOIN,'(A)') Line
87
     Line=AdjustL(Line)
88
     Call Upcase(Line)
89

    
90
     SELECT CASE (Line(1:1))
91
        CASE ('B') 
92
! this is a bond
93
           CurVar%Type="BOND"
94
           Idx=Index(Line," ")
95
           Line=Line(Idx+1:)
96
           Read(Line,*) At1, At2
97
           CurVar%At1=At1
98
           CurVar%At2=At2
99
           CurVar%Value=0.
100
!           CurVar%PrintFactor=1.
101
           Curvar%SignDihedral=1
102
           if (debug) THEN
103
              WRITE(*,'("# b ",2I3)') At1,At2
104
           END IF
105
           FormAna=TRIM(FormAna) //',1X,F7.3'
106
           Allocate(CurVar%Next)
107
           CurVar => CurVar%Next
108
           Nullify(CurVar%Next)
109
        CASE ('A') 
110
! this is a valence angle
111
           CurVar%Type="ANGLE"
112
           Idx=Index(Line," ")
113
           Line=Line(Idx+1:)
114
           Read(Line,*) At1, At2,At3
115
           CurVar%At1=At1
116
           CurVar%At2=At2
117
           CurVar%At3=At3
118
           CurVar%Value=0.
119
!           CurVar%PrintFactor=180./Pi
120
           Curvar%SignDihedral=1
121
           if (debug) THEN
122
              WRITE(*,'("# a ",4(I3))') At1,At2,At3
123
           END IF
124
           FormAna=TRIM(FormAna) //',1X,F7.2'
125
           Allocate(CurVar%Next)
126
           CurVar => CurVar%Next
127
           Nullify(CurVar%Next)
128
        CASE ('D') 
129
! this is a dihedral
130
           CurVar%Type="DIHEDRAL"
131
           Idx=Index(Line," ")
132
           Line=Line(Idx+1:)
133
           Read(Line,*) At1, At2,At3,At4
134
           CurVar%At1=At1
135
           CurVar%At2=At2
136
           CurVar%At3=At3
137
           CurVar%At4=At4
138
           CurVar%Value=0.
139
!           CurVar%PrintFactor=180./Pi
140
           Curvar%SignDihedral=1
141
           if (debug) THEN
142
              WRITE(*,'("# d ",4(I3))') At1,At2,At3,At4
143
           END IF
144
           FormAna=TRIM(FormAna) //',1X,F7.2'
145
           Allocate(CurVar%Next)
146
           CurVar => CurVar%Next
147
           Nullify(CurVar%Next)
148
        CASE ('C') 
149
           NbCom=NbCom+1
150
           Idx=Index(Line," ")
151
           Line=Line(Idx+1:)
152
           READ(Line,*) At1
153
           Allocate(CurBary%ListAtoms(0:At1))
154
           Allocate(CurBary%Weights(1:At1))
155
           CurBary%Weights=1.
156
           CurBary%ListAtoms(0)=At1
157
           Idx=Index(Line," ")
158
           Line=Line(Idx+1:)
159
           READ(Line,*) CurBary%ListAtoms(1:At1)
160
           if (debug) THEN
161
              WRITE(*,'("# c ",I4,20(I3))') At1, &
162
                   (CurBary%ListAtoms(j),j=1,At1)
163
           END IF
164
           Allocate(CurBary%Next)
165
           CurBary => CurBary%Next
166
           Nullify(CurBary%Next)
167

    
168
        CASE Default
169
           Call Die('ReadAnaList','Variable not recognized: ' //Line, Unit=IOOUT)
170
     END SELECT
171

    
172
  END DO
173

    
174
  NbVar=Nb-NbCom
175

    
176
  CurVar => GeomList
177
  I=0
178

    
179
  Allocate(PrintGeomFactor(NbVar))
180
  DO WHILE (associated(CurVar%Next))
181
     I=I+1
182
     SELECT CASE (CurVar%TYPE)
183
        CASE ('ANGLE','DIHEDRAL')
184
           PrintGeomFactor(I)=180./pi
185
        CASE DEFAULT
186
           PrintGeomFactor(I)=1.
187
     END SELECT
188
     CurVar => CurVar%Next
189
  END DO
190
  
191
  FormAna=Trim(FormAna) // ',1X,F7.2,1X,F15.6)'
192

    
193

    
194
!  if (debug) WRITE(*,*) "NbVar, NbCom,Nb",NbVar,NbCom,Nb
195

    
196
  if (debug) Call Header(" Exiting ReadAnaList")
197

    
198
END SUBROUTINE ReadAnaList