# Partition the MgO cluster into regions

# Initialise ChemShell
from chemsh import *

# Load the MgO cluster constructed in the previous script
mgo = Fragment(coords='mgo_shells_cluster.pun', connect_mode='ionic')

# Specify the origin for partitioning
# This will always be atom 0 for any atom-centred cluster
origin = 0  

# Define the atoms to have in the QM region. 
# Here we choose atoms 0-13 inclusive.
qm_region=range(14)

# Partition the cluster
regions = mgo.partition(qm_region=qm_region, cutoff_boundary=6.0, 
                        radius_active=24.0, origin=origin,
                        qmmm_interface='explicit', interface_exclude=["O"])

# Save the partitioned cluster
regions.save('mgo_shells_regions.pun', 'pun')
