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

from chemsh       import *
from chemsh.utils import testutils

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

nwchem = NWChem(frag=water, method='dft', functional='blyp', basis='3-21g', dispersion='d3bj')

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

ecalc = opt.result.energy

# Test result
eref = -75.951968728


testutils.validate(ecalc, eref)
