# Gaussian DFT (BLYP) single point energy

from chemsh       import *
from chemsh.utils import testutils
from chemsh.data  import unitconvert

water = Fragment(coords='another_water.xyz')

# root state 1: the 1st excited state
orca = ORCA(frag=water, method='TDDFT',
            functional='CAM-B3LYP', basis='def2-TZVPP', ri='def2/J RIJCOSX', nstates=11, target_state=1)

sp = SP(theory=orca, gradients=False)

sp.run()

# energy of state of interest (target_state=1, namely iroot 1 in ORCA) in Hatree from standalone ORCA v5.0.3
eref_1 = -76.10439843
testutils.validate(sp.result.energy, eref_1)

# reference excitation energies in wavenumbers (cm**(-1)) from standalone ORCA v5.0.3
ecalc = (sp.result.excitations['energies'][:5]-sp.result.E0)*unitconvert.Ha2wavenumber
erefs = [61623,83784,91239.5,95169.3,118533.9]
testutils.validate(ecalc, erefs, tol=1.0)

#testutils.validate(sp.result.energy, eref_0)
#testutils.validate(fcalc_exc, fref_exc)
