# ORCA DFT (BLYP) optimisation including D3 dispersion correction with Becke-Johnson damping

from chemsh       import *
from chemsh.utils import testutils

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

# default: convergence='tightscf'
orca = ORCA(frag=water, method='dft', functional='blyp', basis='3-21g', dispersion='d3bj')

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

ecalc = opt.result.energy

# ORCA 5.0.3
eref = -75.951971075


testutils.validate(ecalc, eref)
