[gmx-users] angle calculation

Mila Miletić milamiletich at gmail.com
Fri Jul 22 15:10:18 CEST 2016


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.

Thank you in advance.




2016-07-21 13:52 GMT+02:00 Justin Lemkul <jalemkul at vt.edu>:

>
>
> On 7/20/16 12:17 PM, Adamu, Aliyu wrote:
>
>> Hello Justin,
>>
>> Thanks a lot for your email. but I have no suitable vectors available in
>> my
>> .ndx file and I have no idea on how to write the simple script you
>> suggested.
>>
>
> Your index file won't contain vectors, it contains groups of atoms.  Those
> groups of atoms can be used to define vectors between them using selection
> syntax available in many GROMACS tools.  Please have a look at the gmx
> gangle help description for how to select them and "gmx help selections"
> for learning how to use the syntax.  I have not tried to do this exact
> calculation but it should be possible if properly specified.  If you have
> further questions about this, please post exactly what you have tried, what
> it returned (wrong result, error, etc) and we can advise further.
>
> Please can you please elaborate or give a template of the script?
>>
>>
> It's very simple.  One can easily calculate the vector between two
> points.  The angle between those vectors is obtained with simple
> mathematics.  Any scripting language like Python or Perl can be used to
> parse the file.  I strongly recommend learning at least one
> programming/scripting language for anyone in the field of computational
> chemistry.  If all the tools you need aren't available already, you'll have
> to create your own!
>
> -Justin
>
>
> Many thanks Aliyu Adamu ________________________________________ From:
>> gromacs.org_gmx-users-bounces at maillist.sys.kth.se
>> [gromacs.org_gmx-users-bounces at maillist.sys.kth.se] on behalf of Justin
>> Lemkul [jalemkul at vt.edu] Sent: Wednesday, July 20, 2016 1:40 PM To:
>> gmx-users at gromacs.org Subject: Re: [gmx-users] angle calculation
>>
>> On 7/20/16 3:58 AM, Adamu, Aliyu wrote:
>>
>>> Hello all,
>>>
>>> I am interested in calculating angle between 3 specific groups. Is it
>>> possible to generate the angle.ndx file for theses specific groups in
>>> GROMACS 4.6.7? If yes, please how? And if no is there any option?
>>>
>>> Please can any one help
>>>
>>>
>> gmx gangle with suitable vector selections may work, otherwise output the
>> COM coordinates of the three groups (gmx traj -ox -com) and write a simple
>> script to calculate the angle between those vectors.
>>
>> -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
>>
>> ================================================== -- Gromacs Users
>> mailing
>> list
>>
>> * Please search the archive at
>> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
>> posting!
>>
>> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>>
>> * For (un)subscribe requests visit
>> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
>> send a
>> mail to gmx-users-request at gromacs.org.
>>
>>
> --
> ==================================================
>
> 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
>
> ==================================================
> --
> Gromacs Users mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-Users_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-users or
> send a mail to gmx-users-request at gromacs.org.
>


More information about the gromacs.org_gmx-users mailing list