Hi,
I need to get the center of mass (COM) of each half of the ligand shown in the
figure (https://i.stack.imgur.com/dtdul.png). I get the main COM all the
ligand, lets say it is close to C1 atom. In addition to the main COM of all the
ligand, I need to find the COM of each half of the ligand. The atoms of the
first part/half according to the main COM of the ligand are C2, C7, C8 and C9.
As for the second part they are C3, C4, C5 and C6 atoms. The question is how
can I divide the ligand in two parts according to the main COM and calculate
the COM of each divided part (except for the atom closest to the main COM, C1)?
By the way I have multiple ligands. The code should be user firendly.
A short part of the input file is here:
1LIG C1 1 4.434 5.366 1.780
1LIG C2 2 4.317 5.301 1.940
1LIG C3 3 4.430 5.286 1.888
1LIG C4 4 4.380 4.942 2.467
1LIG C5 5 4.148 4.929 2.443
A short snippet of the code used to get the main COM is here:
def heavy_atoms(atoms, xyz, ligand="LIG"):
ids = np.arange(len(atoms))
names = [(i[10:15].strip(),i[5:10].strip()) for i,j in atoms]
# Ligand atoms
lig_atoms = np.array([ rname == ligand and not aname.startswith('H') for
aname,rname in names ])
lig_xyz = xyz[lig_atoms,:]
# The main COM
lig_com = xyz[lig_atoms, :].mean(axis=0)
--
https://mail.python.org/mailman/listinfo/python-list