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

# read in the P450 structure from a PDB file
p450 = Fragment(coords='p450_wo_water.pdb')


# bind an NO to Fe with the N atom (i:O,j:N,k:Fe,l:NB,m:C1A)
p450_no = p450.bind('NO', target='Fe', donor='N', distance=3.0, ijk=120.0, jkl=90.0, ijkl=90.0, jklm=91.65515, unit='a.u.')
# load the reference array of coordinates
reference_p450_no = load('p450_no.coords.npz')['coords']
# validate the result
testutils.validate(p450_no.coords, reference_p450_no)




# bind an NO to Fe with the O atom (i:N,j:O,k:Fe,l:NB,m:C1A)
p450_on = p450.bind('NO', target='Fe', donor='O', distance=1.62, ijk=150.0, jkl=90.0, ijkl=180.0001, jklm=91.65515, unit='Angstrom')
# load the reference array of coordinates
reference_p450_on = load('p450_on.coords.npz')['coords']
# validate the result
testutils.validate(p450_on.coords, reference_p450_on)


