# Construct an MgO surface cluster

# Initialise ChemShell
from chemsh import *

# Import periodic MgO slab geometry
mgo = Fragment(coords='mgo_shells_periodic.pun', connect_mode='ionic')
 
# Cut out cluster from periodic fragment
# Note distances are in bohr and python counts atoms from zero
cluster = mgo.construct_cluster(origin=40, radius_cluster=40.0,
                                adjust_charge='coordination_scaled',
                                radius_active=24.0, bq_margin=2.0, 
                                bq_density=5, bq_layer=12.0)

# Save the resulting cluster in ChemShell punch format
cluster.save('mgo_shells_cluster.pun', 'pun')
