[gmx-developers] mtop structure

Alexander Malafeev malafeev.a at gmail.com
Tue Feb 24 20:01:38 CET 2009


2009/2/23 Mark Abraham <Mark.Abraham at anu.edu.au>

> Alexander Malafeev wrote:
>
>> Hello, please tell me how to read mtop structure?
>>
>>    int index=0;
>>    for(j=0;j<mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->nmolblock;j++)
>> ///enum all molecule types/
>>
>>    {
>>     for(k=0;k<mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->molblock <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t>[j].nmol;k++)
>> ///enum all instances of each molecule type/
>>
>>     {
>>       for(l=0;l<mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->moltype <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t>[ mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->molblock <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t>[j].type].
>> atoms.nr <http://atoms.nr>;l++) ///enum atoms/
>>
>>       {
>>         t_atom <http://wiki.gromacs.org/index.php/Gromacs_Intro#t_atom>*
>> atom_info=&mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->moltype <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t>[ mtop <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t>->molblock <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t
>> >[j].type].atoms.atom[l];
>>
>>         rvec* atom_position=&state <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#t_state>->x <
>> http://wiki.gromacs.org/index.php/Gromacs_Intro#X>[index];
>>         index++;
>>
>>       }
>>     }
>>    }
>>
>
> That fragment strikes me as close to self-documenting :-P
>
> This data structure corresponds to the [ molecules ] entry in your
> topology. There's an ordered list of molecule types (with numbers of each
> type; "molblock" is roughly synonymous with "molecule type"), and for each
> molecule type an ordered list of atoms. Structure members fitting the
> pattern "nxxx" have the "n" abbreviating "number" and tend to refer to the
> length of a corresponding ordered list - hence their use as the control
> variable in the for loops.
>
> If you follow the links in the original fragment (
> http://wiki.gromacs.org/index.php/Gromacs_Intro#global_index) you'll get
> most of this information laid out.
>
> Mark
> _______________________________________________
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://www.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the www interface
> or send it to gmx-developers-request at gromacs.org.

I am uderstand how to use fields in this structure and what it means, but I
am not understand how to initialize and read this structure from trajectory.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20090224/d3d5bf4a/attachment.html>


More information about the gromacs.org_gmx-developers mailing list