[gmx-users] Calculated bonded interactions - number of bonds- bondfree.c

Justin Lemkul jalemkul at vt.edu
Thu Oct 26 20:07:33 CEST 2017



On 10/26/17 1:58 PM, Hoa Trinh wrote:
> Dear Mark & Justin,
> Thank you very much. Hum, the name of variable nbonds is a bit misleading.

Well, you'll find many of those in every software package, and 
n_elements_of_type_and_atom_index is harder to type than nbonds :)

An explanation of how things are laid out is in topology/ifunc.h:

/*
  * The struct t_ilist defines a list of atoms with their interactions.
  * General field description:
  *   int nr
  *      the size (nr elements) of the interactions array (iatoms[]).
  *   t_iatom *iatoms
  *  specifies which atoms are involved in an interaction of a certain
  *       type. The layout of this array is as follows:
  *
  * +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
  * |type1|at1|at2|at3|type2|at1|at2|type1|at1|at2|at3|type3|at1|at2|
  * +-----+---+---+---+-----+---+---+-----+---+---+---+-----+---+---+...
  *
  *  So for interaction type type1 3 atoms are needed, and for type2 and
  *      type3 only 2. The type identifier is used to select the function to
  *      calculate the interaction and its actual parameters. This type
  *      identifier is an index in a params[] and functype[] array.
  */

-Justin

> *Lan Hoa*
>
> 2017-10-26 6:10 GMT-05:00 Justin Lemkul <jalemkul at vt.edu>:
>
>>
>> On 10/26/17 1:56 AM, Hoa Trinh wrote:
>>
>>> Hi all,
>>> I am trying to look into the source code of Gromacs 5.0.7 to see how
>>> Gromacs calculate bonded interactions. For example, to calculate bond
>>> interaction between 2 atoms, there is the function (gmxlib/bondfree.c):
>>> real bonds(int nbonds, ...)
>>> {
>>>     ....
>>>     for (i = 0; (i < nbonds); )
>>>       {
>>>           type = forceatoms[i++];
>>>           ai   = forceatoms[i++];
>>>           aj   = forceatoms[i++];
>>> ....
>>> }
>>> Is "nbonds" the total number of bond interactions? In my topology file, I
>>> have 126 pairs in the [ bonds ] section. However, when I printf the
>>> variable nbonds, it appears to be 378. I have no idea why. Can anyone
>>> please help me to explain what is nbonds?
>>>
>> 378 = 126 * 3
>>
>> nbonds here indicates the size of the array, which holds (type, ai, aj)
>> for each bond in the system.
>>
>> -Justin
>>
>> --
>> ==================================================
>>
>> 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
>> http://www.biochem.vt.edu/people/faculty/JustinLemkul.html
>>
>> ==================================================
>>
>>
>> --
>> 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.
Assistant Professor
Virginia Tech Department of Biochemistry

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

jalemkul at vt.edu | (540) 231-3129
http://www.biochem.vt.edu/people/faculty/JustinLemkul.html

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



More information about the gromacs.org_gmx-users mailing list