# TURBOMOLE NO2 doublet unrestricted DFT (BLYP) single point energy

from chemsh       import *
from chemsh.utils import testutils

no2 = Fragment(coords="no2.cjson")

# default functional is 'blyp'
# default: convergence='tightscf'
turbomole = TURBOMOLE(frag=no2, method="dft", functional="b-lyp", use_ri=True, basis="SVP", scftype="uhf", mult=2)

sp = SP(theory=turbomole, gradients=True)
sp.run()

ecalc = sp.result.energy

fname = "no2_energy_ublyp_ri"
with open("./tcl_results.dat", "r") as tclres:
    for l in tclres:
        if fname + ".chm" in l:
            eref = float(l.split(":")[-1])

testutils.validate(ecalc, eref)
