Re: [AMBER] Working with pytraj

From: Hai Nguyen <>
Date: Mon, 16 May 2016 15:28:05 -0400


your syntax is not correct. (I admit that introducing `top=...` option will
mislead user). You only need to specify `top=` if `traj` does not have
Topology info.

Back to you example, should be

c_o_G = pt.center_of_geometry(traj, mask=...)
ring_plane_all=pt.vector.corrplane(traj, mask=...)
pt.vector.corrplane(traj, mask=...)

For example: c_o_G for first residue

# use all atoms in residue 1
c_o_G = pt.center_of_geometry(traj, mask=':1')

# or
# use given atoms in residue 1
c_o_G = pt.center_of_geometry(traj, mask=':1.C1,N6,C2,C4,N7')

pt.vector.corrplane(traj, mask=':1.C1,N6,C2,C4,N7')

So if you want to compute c_o_G for 500 residues, you need to write a loop
to repeat calculation for each residue.

Note: If your trajectory is not big and fit well to memory, you can you
`pt.load` method rather `pt.iterload` to load all data to memory for fast

Let me know if I understand your Q correctly.


On Mon, May 16, 2016 at 3:05 PM, MOHD HOMAIDUR RAHMAN <>

> Dear AmberTools developers
> In my MD simulations I have five member ring and now I want to calculate
> (1) No of residue within given cut-off distance (Geometrical center)
> between two residues.
> (2) Angle between two normal vectors (Geometrical center) of the five
> member ring
> For that, I used pytraj and able to print geometrical center of residue and
> the normal vector to the plane.
> But I am unable to generate over residue. I have total 512 no of residue in
> my system, so the output should be
> ndarray (total frame , total residue).
> import pytraj as pt
> traj = pt.iterload(trajectory,Topology)
>['.C1, @N6, @C2, @C4, @N7']
> c_o_G=pt.center_of_geometry(traj,top=ring_atoms)
> ring_plane_all=pt.vector.corrplane(traj, top=ring_atoms)
> Please guide us how to proceed furthers
> Thank you in advance for your help
> Regards
> Rahman
> _______________________________________________
> AMBER mailing list
AMBER mailing list
Received on Mon May 16 2016 - 12:30:05 PDT
Custom Search