# Molpro DFT (BLYP) optimisation

from chemsh       import *
from chemsh.utils import testutils

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

molpro = Molpro(frag=water, method='dft', functional='blyp', basis='3-21g')

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 = -75.951248802619


testutils.validate(ecalc, eref)
