import numpy
from chemsh import *

numpy.set_printoptions(threshold=10)

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

butanol.save('butanol_chemsh.pdb')

ff = DL_FIELD(ff='cvff',
              cutoff_vdw=20.0,
              pbc=None,
              # YL: this is currently necessary but can be removed later because we can distinguish Fragment and FragmentBio classes
              filename='_dl_field.xyz',
              field_by_chemsh=True, # toggle FIELD to be generated by ChemShell or DL_FIELD (default: True)
              run_only_once=True,   # run DL_FIELD only for the first cycle (default: True)
             )

#qm_theory = NWChem(method='hf', basis='3-21g', path='nwchem')
qm_theory = NWChem(method='hf', basis='3-21g')

mm_theory = DL_POLY(ff=ff)


qmmm = QMMM(qm=qm_theory,
            mm=mm_theory,
            qm_region=range(5),
            frag=butanol,
            embedding='electrostatic',
            coupling='covalent'
           )

opt = Opt(theory=qmmm, maxcycle=100, algorithm='cg').run(dryrun=False)
