# Example of binding an oxygen molecule to a haem system
#
# Created by YL Oct 2021
# Revised by YL, KS, TWK Oct-Dec 2021

# Initialise ChemShell
from chemsh import *

# Read in the P450cam X-ray structure from disk
p450_original = Fragment(coords='1dz8.pdb')

# Add a title
p450_original.title = 'p450'

# Delete TRIS buffer
p450_original.delete(residues='TRS')

# Create a new Fragment containing only chain B
indices_chainB = p450_original.select(chainIDs='B')
p450_B = p450_original.getSelected(indices_chainB)

# Bind an O2 molecule to the cofactor's Fe and get a new fragment (enzyme+O2)
p450_O2 = p450_B.bind('O2', target='Fe', donor='O', distance=3.0, ijk=180.0, jkl=90.0, ijkl=180.0, jklm=90.0, unit='a.u.')

# NB: The bind method will save a new PDB file containing the above new fragment
