! h2o_energy.inp - single-point energy of an isolated water molecule (PBE/DZVP)
! Tutorial: CP2K chapter 2, section 8.  Works with CP2K 2023.x - 2026.2.
! Run:   rm -f h2o_energy.out; cp2k.ssmp -i h2o_energy.inp -o h2o_energy.out
! Needs: h2o.xyz in the working directory.

&GLOBAL
  PROJECT h2o_energy          ! prefix of all files written by this run
  RUN_TYPE ENERGY             ! single point, no forces (default would be ENERGY_FORCE)
  PRINT_LEVEL MEDIUM          ! SILENT / LOW / MEDIUM / HIGH / DEBUG
&END GLOBAL

&FORCE_EVAL
  METHOD QS                   ! Quickstep (DFT)
  &DFT
    BASIS_SET_FILE_NAME BASIS_MOLOPT
    POTENTIAL_FILE_NAME GTH_POTENTIALS
    CHARGE 0                  ! default 0
    MULTIPLICITY 1            ! default 1 for an even number of electrons
    &MGRID
      CUTOFF 400              ! Ry, plane-wave cutoff of the finest grid
      REL_CUTOFF 50           ! Ry, controls the mapping of Gaussians to grid levels
    &END MGRID
    &QS
      EPS_DEFAULT 1.0E-12     ! overall integral/screening accuracy (default 1.0E-10)
    &END QS
    &POISSON
      PERIODIC NONE           ! isolated molecule: must match &CELL PERIODIC
      POISSON_SOLVER MT       ! Martyna-Tuckerman; box >= 2x the size of the charge density
    &END POISSON
    &SCF
      SCF_GUESS ATOMIC        ! superposition of atomic densities (default)
      EPS_SCF 1.0E-6          ! convergence threshold of the inner SCF loop
      MAX_SCF 30              ! inner OT iterations per outer cycle
      &OT ON                  ! orbital transformation: fast and robust for gapped systems
        MINIMIZER DIIS
        PRECONDITIONER FULL_SINGLE_INVERSE
      &END OT
      &OUTER_SCF ON           ! restarts the OT minimisation if not yet converged
        EPS_SCF 1.0E-6
        MAX_SCF 10
      &END OUTER_SCF
    &END SCF
    &XC
      &XC_FUNCTIONAL PBE
      &END XC_FUNCTIONAL
    &END XC
  &END DFT
  &SUBSYS
    &CELL
      ABC [angstrom] 10.0 10.0 10.0
      PERIODIC NONE
    &END CELL
    &TOPOLOGY
      COORD_FILE_NAME h2o.xyz
      COORD_FILE_FORMAT XYZ
      &CENTER_COORDINATES     ! shift the molecule to the centre of the box
      &END CENTER_COORDINATES
    &END TOPOLOGY
    &KIND O
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q6    ! 6 valence electrons: 2s2 2p4
    &END KIND
    &KIND H
      BASIS_SET DZVP-MOLOPT-GTH
      POTENTIAL GTH-PBE-q1
    &END KIND
  &END SUBSYS
&END FORCE_EVAL
