## This script contructs the solid-state MgO cluster
## Note - this script is adapted from the equivalent script in the 'mgo_surface' tutorial folder

# Initialise ChemShell
from chemsh import *
from chemsh.io.tools import convert_atoms_to_frag
from sys import stdout

# NB this example requires ASE to be installed
from ase.io import read

# Read in CIF data and convert to a ChemShell Fragment
mgo = convert_atoms_to_frag(read('mgo_shells_periodic.cif'), connect_mode='ionic')
mgo.addCharges({'O' :-2.0,
                'Mg':2.0})
mgo.addShells('O', displace=0.0, charges={'O':-2.792547})

# Constructs cluster
cluster=mgo.construct_cluster(origin=0, radius_cluster=20.0, adjust_charge='coordination_scaled', radius_active=12.0, bq_margin=1.5, bq_density=8)

# Save the resulting cluster in punch and .xyz format
cluster.save('ss-mgo_shells_cluster_cif.pun', 'pun')
cluster.save('ss-mgo_shells_cluster_cif.xyz', 'xyz')




