@SET SCCS on
@SET DM cd5
@SET OT 0
@SET TD 1

&GLOBAL
 PROJECT H2O_sccs_td_cd5_fg
 RUN_TYPE energy
 PRINT_LEVEL medium
&END GLOBAL

&DEBUG
 DEBUG_FORCES yes
 DEBUG_STRESS_TENSOR no
 EPS_NO_ERROR_CHECK 1.0E-5
 STOP_ON_MISMATCH off
&END DEBUG

&MOTION
 &GEO_OPT
  OPTIMIZER BFGS
  MAX_ITER  200
  MAX_DR    0.0001
  RMS_DR    0.00003
  MAX_FORCE 0.00001
  RMS_FORCE 0.000003
 &END GEO_OPT
 &PRINT
  &RESTART
   BACKUP_COPIES 0
  &END RESTART
  &STRUCTURE_DATA
   DISTANCE 1 2
   DISTANCE 1 3
   DISTANCE 2 3
   ANGLE 1 2 3
  &END STRUCTURE_DATA
 &END PRINT
&END MOTION

&FORCE_EVAL
 METHOD Quickstep
 # STRESS_TENSOR analytical
 &DFT
  BASIS_SET_FILE_NAME ../../../data/BASIS_MOLOPT
  POTENTIAL_FILE_NAME ../../../data/GTH_POTENTIALS
  &MGRID
   CUTOFF 280
   NGRIDS 4
   &RS_GRID
    DISTRIBUTION_TYPE distributed
   &END RS_GRID
  &END MGRID
  &PRINT
   &SCCS ${SCCS}
    &EACH
     QS_SCF 1
    &END EACH
    &DENSITY_GRADIENT off
     &EACH
      QS_SCF 0
     &END EACH
    &END DENSITY_GRADIENT
    &DIELECTRIC_FUNCTION off
     &EACH
      QS_SCF 0
     &END EACH
    &END DIELECTRIC_FUNCTION
    &POLARISATION_POTENTIAL off
     &EACH
      QS_SCF 0
     &END EACH
    &END POLARISATION_POTENTIAL
   &END SCCS
  &END PRINT
  &QS
   EPS_DEFAULT 1.0E-10
  &END QS
  &SCCS ${SCCS}
   ALPHA [N*m^-1] 0.0
   BETA [kbar] 0.0
   DELTA_RHO 2.0E-5
   DERIVATIVE_METHOD ${DM}
   DIELECTRIC_CONSTANT 78.36
   EPS_SCCS 1.0E-6
   GAMMA [mN/m] 0.0
   @IF ${OT}
    EPS_SCF 0.03
   @ENDIF
   @IF ${TD}
    EPS_SCF 0.3
   @ENDIF
   MAX_ITER 100
   # METHOD Andreussi
   METHOD Fattebert-Gygi
   MIXING 0.6
   &ANDREUSSI
    RHO_MAX 0.001
    RHO_MIN 0.0001
   &END ANDREUSSI
   &FATTEBERT-GYGI
    BETA 1.3
    RHO_ZERO 0.0004
   &END FATTEBERT-GYGI
  &END SCCS
  &SCF
   @IF ${TD}
    EPS_SCF 1.0E-5
    MAX_SCF 300
    SCF_GUESS atomic
    &MIXING on
     ALPHA 0.2
    &END MIXING
   @ENDIF
   @IF ${OT}
    EPS_SCF 1.0E-6
    MAX_SCF 31
    SCF_GUESS atomic
    &OT on
     MINIMIZER DIIS
     PRECONDITIONER FULL_SINGLE_INVERSE
    &END OT
    &OUTER_SCF on
     EPS_SCF 1.0E-6
     MAX_SCF 50
    &END OUTER_SCF
   @ENDIF
   &PRINT
    &RESTART
     BACKUP_COPIES 0
     &EACH
      QS_SCF 10
     &END EACH
    &END RESTART
   &END PRINT
  &END SCF
  &XC
   &XC_FUNCTIONAL PBE
   &END XC_FUNCTIONAL
  &END XC
 &END DFT
 &SUBSYS
  &CELL
   ABC 8.0 8.0 8.0
  &END CELL
  &COORD
   O         4.9999870401        4.5606769781        4.5606769833
   H         5.0000000491        4.4536015938        5.5327585878
   H         5.0000000214        5.5327585972        4.4536017371
  &END COORD
  &KIND H
   BASIS_SET DZVP-MOLOPT-SR-GTH
   POTENTIAL GTH-PBE-q1
  &END KIND
  &KIND O
   BASIS_SET DZVP-MOLOPT-SR-GTH
   POTENTIAL GTH-PBE-q6
  &END KIND
 &END SUBSYS
&END FORCE_EVAL
