Re: [AMBER] Interplane angles using vector and vectormath in cpptraj

From: Wesley Michael Botello-Smith <wmsmith.uci.edu>
Date: Mon, 29 Oct 2018 17:45:48 -0700

I get a reasonable result using pytraj to compute the corrplanes and then
numpy to apply dot product based angle calculation:

----Python script (run in a jupyter notebook cell)----
import pytraj as pt
import numpy as np

iterTraj=pt.iterload('near_parallel_ringtest.pdb',top='near_parallel_ringtest.pdb')
iterTraja

mask1=':13.CG,ND1,CD2,CE1,NE2'
mask2=':14.CG,ND1,CD2,CE1,NE2'

p1=pt.vector.corrplane(iterTraj,mask1)
p2=pt.vector.corrplane(iterTraj,mask2)
print "plane 1:",
print p1
print "plane 2:",
print p2
#p1 and p2 are numpy.ndarray objects of dimension n_frames x 3
#we thus need to apply dot product and angle calculation to each frame
(outer dimension)
#this is easily accomplished with python list comprehension syntax as shown
below
print "Dot product:",
p1_dot_p2=np.array([np.sum(p1[iFrame]*p2[iFrame]) for iFrame in
np.arange(iterTraj.n_frames)])
print p1_dot_p2
#Note: corrplane gives unit normals of planes, so no need to divide by
vector magnitudes when
# calculating angle from dot product
print "Angle:",
ang_p1_p2=np.arccos([iDot for iDot in p1_dot_p2])
print ang_p1_p2*180/np.pi
---- ---- ----
---- Results ----
plane 1: [[ 0.87492987 0.33602417 -0.34869109]]
plane 2: [[ 0.76170574 0.6252502 -0.16990158]]
Dot product: [0.93578146]
Angle: [20.64523631]
---- ---- ----

On Mon, Oct 29, 2018 at 3:37 PM Matthew Turner <TurnerM13.cardiff.ac.uk>
wrote:

> Dear AMBER users,
>
> I'm looking to calculate the angle between the planes of aromatic residues
> over a trajectory using cpptraj.
> I've looked through the manual and the mailing list (particularly noting
> http://archive.ambermd.org/201512/0291.html) and found the commands
> needed:
>
> vector name1 corrplane <mask1>
> vector name2 corrplane <mask2>
>
> vectormath vec1 name1 vec2 name2 dotangle out name1_name2_angle.dat
>
> This calculates the vectors normal to the planes defined by <mask1> and
> <mask2> and then does the inverse cos of the dot product of those two
> vectors.
>
> However, the results are not what I expected. I have selected a single
> frame pdb file (attached, zipped) and was looking at the interplane angle
> between His13 and His14 as a test case. In this frame, the residues sit
> nearly parallel - max 20 degrees out of parallel, by eye.
> Using masks :13.CG,ND1,CD2,CE1,NE2 and :14.CG,ND1,CD2,CE1,NE2 to select
> the aromatic rings of His (rather than the whole residue) and running the
> above commands gives a dotangle value of 127.3200 degrees.
>
> Firstly, this is clearly not correct, so where have I gone wrong? And
> secondly, shouldn't the angle between planes should be between 0 and 90
> degrees (as simply explained here: https://youtu.be/C6ElQdRbHaE?t=287),
> or am I missing something? Calculating the dot product of name1 and name2
> above gives -0.6063. If I was to take the modulus of that, arccos(0.6063)
> = 52 degrees, still not the near zero value I expected.
>
> Any help appreciated!
>
> Kind regards,
> Matthew Turner
>
> _______________________________________________
> AMBER mailing list
> AMBER.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber
>
_______________________________________________
AMBER mailing list
AMBER.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber
Received on Mon Oct 29 2018 - 18:00:04 PDT
Custom Search