Revision 10 src/ReadInput_mopac.f90

ReadInput_mopac.f90 (revision 10)
13 13
       CHARACTER(*), intent(in) :: string
14 14
       logical                  :: isValid
15 15
     END function VALID
16

  
17
    SUBROUTINE die(routine, msg, file, line, unit)
18

  
19
      Use VarTypes
20
      Use io_module
21

  
22
      implicit none
23
      character(len=*), intent(in)           :: routine, msg
24
      character(len=*), intent(in), optional :: file
25
      integer(KINT), intent(in), optional      :: line, unit
26

  
27
    END SUBROUTINE die
28

  
29

  
16 30
  END INTERFACE
17 31

  
18 32

  
19
  CHARACTER(132) ::  Line,Line2
33
  CHARACTER(LCHARS) ::  Line,LineUp
20 34
  INTEGER(KINT) :: LineL, Idx, NTmp
35
  INTEGER(KINT) :: NatMopac
36
  REAL(KREAL) :: Lat(3,3)
21 37
  
22 38
  LOGICAL :: Debug
23 39

  
......
50 66
     LineL=len(Trim(Line))
51 67
     IF (Line(1:1)/="*") THEN
52 68
        IF (NTmp==0) THEN
53
           Line2=Line
54
           Call UpCase(Line2)
55
           Idx=Index(Line2,'GRADIENTS')
69
           LineUp=Line
70
           Call UpCase(LineUp)
71
           Idx=Index(LineUp,'GRADIENTS')
56 72
           If (Idx==0) Line=TRIM(Line) // " GRADIENTS"
57
           Idx=Index(Line2,'1SCF')
73
           Idx=Index(LineUp,'1SCF')
58 74
           If (Idx==0) Line=TRIM(Line) // " 1SCF"
59 75
        END IF
60 76
        current%Line=TRIM(Line)
......
77 93
!     END DO
78 94

  
79 95
! Now the geometry... that we just skip :)
96
! PFL 2013 Apr 
97
! We take care that there is no Translation vectors...
98
! We also check that the number of atoms is ok
80 99
  IF (DEBUG) WRITE(*,*) "Reading Mopac Geometry"
81 100
  Mopac_EndGeom=""
82 101
  LineL=1
102
  NatMopac=0
103
  Lat=0.d0
104
  IPer=0
105
  FPBC=.FALSE.
83 106
  DO WHILE (LineL.NE.0)
84 107
     READ(IOIN,'(A)',END=989) Line
85 108
     Line=AdjustL(Line)
86 109
     LineL=len(Trim(Line))
87 110
     ! The last line might be either blank or filled with 0
88
     IF (Line(1:1)=="0") THEN
89
        LineL=0
90
        Mopac_EndGeom=Trim(Line)
111
     If (LineL>0) THEN
112
        SELECT CASE (Line(1:1))
113
          CASE ("0") 
114
             LineL=0
115
             Mopac_EndGeom=Trim(Line)
116
          CASE("*") 
117
             CurCom%Line=TRIM(LINE)
118
             ALLOCATE(CurCom%Next)
119
             CurCom => CurCom%Next
120
             NULLIFY(CurCom%Next)
121
          CASE DEFAULT
122
             LineUp=Line
123
             Call UpCase(LineUp)
124
             If (LineUp(1:2)=="TV") THEN
125
                FPBC=.TRUE.
126
                IPer=IPer+1
127
                If (Iper>3) THEN
128
                   Call Die("ReadInput Mopac","Iper>3",Unit=IOOUT)
129
                END IF
130
                NTmp=Index(LineUp," ")
131
                LineUp=LineUp(NTmp:)
132
                Read(LineUp,*) Lat(IPer,1:3)
133
             ELSE
134
                NatMopac=NatMopac+1
135
             END IF
136
         END SELECT
137
      END IF
138
     
139
   END DO
140

  
141
!  WRITE(*,*) "NatMopac,Nat:",NAtMopac,Nat
142
  IF (NatMopac/=Nat) Call Die("ReadInput_mopac","Nat read does not mat nat",Unit=IOOUT)
143
  IF (FPBC) THEN
144
     Lat_a(1:3)=Lat(1,1:3)
145
     Lat_b(1:3)=Lat(2,1:3)
146
     Lat_c(1:3)=Lat(3,1:3)
147
     If (IPer>=1) THEN
148
        kaBeg=-1
149
        kaEnd=1
91 150
     END IF
92
     IF (Line(1:1)=="*") THEN
93
        CurCom%Line=TRIM(LINE)
94
        ALLOCATE(CurCom%Next)
95
        CurCom => CurCom%Next
96
        NULLIFY(CurCom%Next)
151
     If (IPer>=2) THEN
152
        kbBeg=-1
153
        kbEnd=1
97 154
     END IF
98
  END DO
155
     If (IPer==3) THEN
156
        kcBeg=-1
157
        kcEnd=1
158
     END IF
159
     If (IPer>3) THEN
160
        Call Die("Readinput_mopac","Found too many Tv lines !",Unit=IOOUT)
161
     END IF
162
  END IF
99 163

  
100 164
! If we are here, there might be something else to read: Mopac_end
101 165

  

Also available in: Unified diff