from chemsh       import *
from chemsh.utils import testutils
from chemsh.data  import unitconvert

# read in the Pd (nonprimitive) unit cell
pd = Fragment(coords='pd_unitcell.pun', connect_mode='ionic')

# save for visualising
pd.save('pd_unitcell.xyz')

my_mm = GULP(frag = pd,
             ff   = 'meam_2nn',
             path = 'gulp'
            )

# run geometry optimisation
my_cell_opt = Opt(theory=my_mm,
                  cell_only=True,
                  ndimensions=2).run(dryrun=False)


# lattice constant a calculated
acalc = pd.cell.a*unitconvert.au2unit['Angstrom']

# a (Ansgtrom) by standalone GULP 6.0
aref = 4.735953

testutils.validate(acalc, aref, tol=1E-5)
