'''newscf.chm example from old ChemShell'''

from chemsh       import *

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

# qm
qm = GAMESS_UK(electrons="10", newscf=True, frag=water,
              basis="nwchem\no S\n322.0370 0.0592394\n48.43080 0.351500\n10.42060 0.707658\no L\n7.402940 -0.404453 0.244586\n1.576200 1.221560 0.853955\no L\n0.373684 1.000000 1.000000\nh S\n5.447178 0.156285\n0.824547 0.904691\nh S\n0.183192 1.000000\nend\n",
              path="rungamess")

sp = SP(theory=qm, gradients=True)

sp.run()

sp_calc = sp.result.energy[0]

opt = Opt(theory=qm, algorithm="lbfgs", tolerance=0.0003, trust_radius="energy",maxcycle=50)

opt.run()

opt_calc = opt.result.energy[0]

print("Pre-optimisation, the energy is:\n",sp_calc)
print("Post-optimisation, the energy is:\n",opt_calc)

eref=-75.58595973




