residue_ids = np.arange(0, 1024, 2)
residues = traj.atoms.residues[residue_ids]
pi_angle = []
for res in residues:
C1_C = traj.select_atoms("name C1").center_of_mass()
C2_B = traj.select_atoms("name C2").center_of_mass()
C3_A = traj.select_atoms("name C4").center_of_mass()
BA = C3_A - C2_B
BC = C1_C - C2_B
pi_angle.append(np.cross(BA , BC))
pi_angle = np.array(pi_angle)
theta = []
k=0
for i in range(5):
for j in range(i+1, 512):
k +=1
theta.append(np.arccos(np.dot(pi_angle[i],pi_angle[j])/(norm(pi_angle[i])*norm(pi_angle[j]))))
So I think I am doing some mistake in selections of atoms. I have total 5 ring atoms name are C1 , N6 , C2 , C4 , N7 .
Please guide me to resolve this issue or if any module is there in MDAnalysis pakage to direct print corrplane of selected molecules or groups of atoms.
Thank you in advance
Regards
Rahman
cog=[]
For res in resid:
ring = res.atoms.select_atoms(“name C1 N6 C2 C4 N7 ”).center_of_geometry
cog.append(ring)
from MDAnalysis.lib.distances import distance_array
# your above code to calculate the CoG of each ring
cog = np.array(cog, dtype=np.float32)
# pass in Universe.dimensions as the box kwarg to use box information
# alternatively, you can just pass in box=np.array([10, 10, 10, 90, 90, 90]) for a 10x10x10 cubic box
dist_matrix = distance_array(cog, cog, box=u.dimensions)
C1 N6 C2 C4 N7 by center of geometry.