[gmx-users] gangle for a plane and z axis

Justin Lemkul jalemkul at vt.edu
Wed Jan 24 13:52:04 CET 2018

On 1/23/18 7:20 PM, Mohsen Ramezanpour wrote:
> Hi Gromacs users,
> I would like to calculate the angle distribution between a plane and z
> axis using gangle.
> In a 5-member ring, there are three atoms of O1-C-O2 which form an angle.
> So, I will choose these three atom names to define the plane.
> I am not sure how the g_angle makes the vector normal for this plane,
> though. I know that it first make two vectors, and then does a cross
> product of these two initial vectors to make the normal vector to the
> plane. But, what is the direction of the vector normal to this plane?
> Looking at the calc_vec function (lines 652 to 690) code from:
> https://github.com/gromacs/gromacs/blob/master/src/gromacs/trajectoryanalysis/modules/angle.cpp
> It is using functions cprod and rvec_sub.
> I found cprod definition here:
> http://manual.gromacs.org/documentation/2018-beta3/doxygen/html-lib/group__module__simd.xhtml#ga54124af0ff118d3f171b0eef07105c76
> cprod (v1,v2,xout) means C = v1 * v2 (so the Right Hand Rule can be used to
> get the direction)
> I could not find rvec_sub function, though. However, I think:
> rvec_sub(x[1], x[0], v1) gives the v1 as v1= x[1]-x[0]. i.e. a vector
> starting from x[0] and ending on x[1].
> Are these correct?

Yes. rvec_sub() is in src/gromacs/math/vec.h



Justin A. Lemkul, Ph.D.
Assistant Professor
Virginia Tech Department of Biochemistry

303 Engel Hall
340 West Campus Dr.
Blacksburg, VA 24061

jalemkul at vt.edu | (540) 231-3129


More information about the gromacs.org_gmx-users mailing list