Statistics
| Revision:

root / src / ReadInput_siesta.F90 @ 5

History | View | Annotate | Download (2 kB)

1
 SUBROUTINE ReadInput_siesta
2

    
3
! This routine reads an input template for Siesta
4

    
5
  use VarTypes
6
  use Path_module
7
  use Io_module
8

    
9
  IMPLICIT NONE
10

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

    
18

    
19
  CHARACTER(132) ::  Line,LineUp,Line2
20
  INTEGER(KINT) :: LineL, Idx, Iat
21
  INTEGER(KINT) :: IoRead
22
  
23
  LOGICAL :: Debug
24
  LOGICAL :: FSpecies, FCoord
25

    
26

    
27
  Debug=Valid("readinput").OR.Valid("readinput_siesta")
28

    
29
 if (debug) Call Header("Entering ReadInput_Siesta")
30

    
31
  ! We read the Siesta input file
32
     ALLOCATE(Siesta_Input)
33
     NULLIFY(Siesta_Input%next)
34
     Current => Siesta_Input
35

    
36
     FSpecies=.FALSE.
37
     FCoord=.FALSE.
38

    
39
     READ(IOIN,'(A)',iostat=IoRead) Line
40
     DO WHILE (IoRead==0)
41
        Line=AdjustL(Line)
42
        LineL=len(Trim(Line))
43
        LineUp=Line
44
        Call UpCase(LineUp)
45

    
46
! We look for the NumberofAtoms
47
        Idx=INDEX(LineUp,"NUMBEROFATOMS")
48
        IF (Idx/=0) THEN
49
           Idx=Index(Line," ")
50
           Line2=Trim(AdjustL(Line(Idx+1:)))
51
           Read(Line2,*) IAt
52
           if (Iat/=Nat) THEN
53
              Call Die('ReadInput_siesta','Nat in FDF sample different from  Nat Path input', & 
54
                   __FILE__, __LINE__, IOOUT)
55
                   
56
           END IF
57
        END IF
58

    
59
! We look for the ChemicalSpeciesLabel block
60
        Idx=INDEX(LineUp,"CHEMICALSPECIESLABEL")
61
        IF (Idx/=0) THEN
62
           FSpecies=.TRUE.
63
        END IF
64

    
65
! We look for SystemLabel
66
        Idx=INDEX(LineUp,"SYSTEMLABEL")
67
        If (Idx/=0) THEN
68
           Idx=Index(Line," ")
69
           Siesta_Label=Trim(adjustl(Line(Idx+1:)))
70
        END IF
71

    
72
! We look for Coordinates
73

    
74
        IF ((LineL.NE.0).AND.(Idx.EQ.0)) THEN
75
           current%Line=TRIM(Line)
76
           ALLOCATE(current%next)
77
           Current => Current%next
78
           Nullify(Current%next)
79
        END IF
80
     END DO
81

    
82
     if (debug) Call Header("Exiting ReadInput_Siesta")
83

    
84
   END SUBROUTINE READINPUT_SIESTA