[gmx-users] angle calculation

Justin Lemkul jalemkul at vt.edu
Fri Jul 22 15:58:14 CEST 2016



On 7/22/16 9:10 AM, Mila Miletić wrote:
> Hello,
>
> I have recently tried to compute an angle between the COMs of three
> specific groups,
> so what I have done is:
> 1. I used 'gmx gangle' program with a following command: gmx gangle -f
> *.xtc -s  *.tpr -n index.ndx -g1 vector -group1 "com of group "g1" plus com
> of group "g2"" -g2 vector -group2 "com of group "g2" plus com of group
> "g3"" -oav  "output.xvg".
> 2. To check the obtained result, I also tried the other way: I got the COM
> coordinates for three specific groups using 'gmx traj' program, then I used
> a written script to calculate the angle between the vectors that are
> connecting these 'COM points'. So I was going with: if you have coordinates
> for three points A, B, C (your COMs), you need to find an angle formed by A→
> B→C. The script looked like this:
>
> paste group1_com.xvg group2_com.xvg >  group12_com.xvg
> paste group2_com.xvg group3_com.xvg >  group23_com.xvg
> awk '{ print $6-$2, $7-$3, $8-$4 }' group12_cm.xvg > AB.dat
> awk '{ print $6-$2, $7-$3, $8-$4 }' group23_cm.xvg > BC.dat
> paste AB.dat BC.dat > abbc_paste.dat
> awk '{rez+=$1*$4 + $2*$5 + $3*$6; n++} END {print rez/n}' abbc_paste.dat >
> AB_times_BC.dat
> awk '{length1+=(sqrt($1*$1+$2*$2+$3*$3)); n++} END {print length1/n}'
> AB.dat > AB_length.dat
> awk '{length2+=(sqrt($1*$1+$2*$2+$3*$3)); n++} END {print length2/n}'
> BC.dat > BC_length.dat
> paste AB_length.dat BC_length.dat AB_times_BC.dat > angle_result.dat
> awk '{ print $3/$1*$2}' angle_result.dat
>
> So in the first case I've got an angle about 8 degrees, and in other case
> about 78 degrees. So I would also be grateful to hear some oppinion on this.
> The molecule in my case is p-Sexiphenyl at T=1K, so the first result for
> smaller angle could be more probable to be correct in my case.
> I am pretty new in this so this is just an idea how this issue may be
> solved.
>

Write the COM coordinates to a PDB file, load it in VMD, and have it calculate 
the angle.  If it checks out with your calculation, it's correct.

-Justin

-- 
==================================================

Justin A. Lemkul, Ph.D.
Ruth L. Kirschstein NRSA Postdoctoral Fellow

Department of Pharmaceutical Sciences
School of Pharmacy
Health Sciences Facility II, Room 629
University of Maryland, Baltimore
20 Penn St.
Baltimore, MD 21201

jalemkul at outerbanks.umaryland.edu | (410) 706-7441
http://mackerell.umaryland.edu/~jalemkul

==================================================


More information about the gromacs.org_gmx-users mailing list