'''Testing gamess-uk@ChemShell restart capability with a water system'''

from chemsh       import *

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

# qm
qm = GAMESS_UK(frag=water,
               direct=True,
               restart=False, maxiter=100,
               scftype='rhf', mult=1,
               method='dft', functional='b3lyp', basis='dzp',
               grid='medium',
               path='rungamess')

print('Running singlepoint energy with GAMESS-UK\n')
sp = SP(theory=qm, gradients='False')

sp.run()
print('The energy is ', sp.result.energy[0])

a = sp.result.energy[0]

# Restart qm
qm = GAMESS_UK(frag=water, direct=True,
      restart=True, maxiter=100,
      scftype='rhf', mult=1,
      method='dft', functional='b3lyp', basis='dzp',
      grid='medium',
      path='rungamess')

print('Running singlepoint energy with GAMESS-UK restart\n')
sp = SP(theory=qm, gradients='False')
sp.run()
print('The energy is ', sp.result.energy[0])

b = sp.result.energy[0]
tol = 1e-7


