# Molpro NO2 doublet unrestricted DFT (BLYP) optimisation

from chemsh       import *
from chemsh.utils import testutils

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

# default functional is 'blyp'
molpro = Molpro(frag=no2, method="dft", basis="3-21g", scftype="uhf", mult=2)

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

ecalc = opt.result.energy

# Test result from Tcl-ChemShell/Molpro 2022.3
eref = -203.907951667796

testutils.validate(ecalc, eref)
