from chemsh import *
from chemsh.utils import testutils

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

pyscf = PySCF(frag=no2, method="hf", basis="3-21g", charge=1)

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 from Tcl-ChemShell
# eref = -202.460059935835
# convergence=tightscf
# eref = -202.460060038752
# ORCA 5.0.3
#eref = -202.46006004

#pyscf reference 
eref = -202.460060020878

testutils.validate(ecalc, eref)
