from chemsh import *
from chemsh.utils import testutils

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

pyscf = PySCF(frag=water, method="dft", functional="blyp", basis="3-21g")

opt = Opt(
    theory=pyscf,
    algorithm="lbfgs",
    tolerance=0.0003,
    trust_radius="energy",
    maxcycle=100,
    maxene=100,
    maxstep=1.0,
)

opt.run()

ecalc = opt.result.energy

# Tcl-ChemShell 3.7.1/ORCA 4.2.1 result
# convergence=normalscf
# eref = -75.951263039661
# convergence=tightscf
# eref = -75.951263002720
# ORCA 5.0.3
#eref = -75.95125134

#pyscf reference
eref = -75.951248411

testutils.validate(ecalc, eref)
