MODULE Io_Module
! This module contains all variables related to IO

  use VarTypes

  IMPLICIT NONE

  SAVE

  INTEGER(KINT) :: IOIN=11, IOOUT=12, IOCART=14
  INTEGER(KINT), PARAMETER :: IOTMP=21,IOTMP2=22, IOTMP3=23

  TYPE Input_Line
     CHARACTER(LCHARS) :: Line
     TYPE (Input_Line), POINTER :: Next
  END TYPE Input_Line

  CHARACTER(SCHARS) :: RunMode

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 
!  Some parameters for unit conversion
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  REAL(KREAL), PARAMETER :: ev2au= 0.036749324445d0

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Variables for Gaussian input
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  TYPE (Input_line), POINTER :: Gauss_Root, Gauss_End, Gauss_Comment
  TYPE (Input_Line), POINTER :: Current, Previous

  CHARACTER(LCHARS) :: Gauss_Charge
  CHARACTER(LCHARS), ALLOCATABLE :: Gauss_paste(:)

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Variables for MOPAC input
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  TYPE (Input_line), POINTER :: Mopac_Root, Mopac_End, Mopac_Comment
  TYPE (Input_Line), POINTER :: CurCom
  CHARACTER(LCHARS) :: Mopac_EndGeom

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Variables for VASP input/output
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  CHARACTER(LCHARS) :: Vasp_Title, Vasp_Types, Vasp_comment, Vasp_direct
  REAL(KREAL) :: vasp_Param
  CHARACTER(4), ALLOCATABLE :: FFF(:,:) !(3,na)
  INTEGER(KINT) :: NbTypes
  INTEGER(KINT), PARAMETER :: MaxType=100
  CHARACTER(2) :: Attypes(MaxType)='  '
! WriteVasp controls the printing of the images coordinates in POSCAR files.
  LOGICAL :: WriteVasp


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! For debug
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  CHARACTER(132) :: DebugFile='Path.valid'

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! For Printing
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  CHARACTER(LCHARS) :: PathName

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! For Energy+Gradient calculations
!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! CalcName: Prefix for the files used for the energy and gradient calculations
  CHARACTER(LCHARS) :: CalcName

! ISuffix: Suffix for the input file
  CHARACTER(LCHARS) :: ISuffix
! OSuffix: suffix for the output file.
  CHARACTER(LCHARS) :: OSuffix


END MODULE IO_MODULE
