<br><br><div class="gmail_quote">2009/2/23 Mark Abraham <span dir="ltr"><<a href="mailto:Mark.Abraham@anu.edu.au">Mark.Abraham@anu.edu.au</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Alexander Malafeev wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Hello, please tell me how to read mtop structure?<br>
<br>
int index=0;<br></div>
for(j=0;j<mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->nmolblock;j++) ///enum all molecule types/<br>
<br>
{<br>
for(k=0;k<mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->molblock <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t</a>>[j].nmol;k++) ///enum all instances of each molecule type/<br>
<br>
{<br>
for(l=0;l<mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->moltype <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t</a>>[ mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->molblock <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t</a>>[j].type].<a href="http://atoms.nr" target="_blank">atoms.nr</a> <<a href="http://atoms.nr" target="_blank">http://atoms.nr</a>>;l++) ///enum atoms/<br>
<br>
{<br>
t_atom <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#t_atom" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#t_atom</a>>* atom_info=&mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->moltype <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_moltype_t</a>>[ mtop <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_mtop_t</a>>->molblock <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#gmx_molblock_t</a>>[j].type].atoms.atom[l];<br>
<br>
rvec* atom_position=&state <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#t_state" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#t_state</a>>->x <<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#X" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#X</a>>[index];<br>
index++;<br>
<br>
}<br>
}<br>
}<br>
</blockquote>
<br>
That fragment strikes me as close to self-documenting :-P<br>
<br>
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.<br>
<br>
If you follow the links in the original fragment (<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#global_index" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#global_index</a>) you'll get most of this information laid out.<br>
<br>
Mark<br>
_______________________________________________<br>
gmx-developers mailing list<br>
<a href="mailto:gmx-developers@gromacs.org" target="_blank">gmx-developers@gromacs.org</a><br>
<a href="http://www.gromacs.org/mailman/listinfo/gmx-developers" target="_blank">http://www.gromacs.org/mailman/listinfo/gmx-developers</a><br>
Please don't post (un)subscribe requests to the list. Use the www interface or send it to <a href="mailto:gmx-developers-request@gromacs.org" target="_blank">gmx-developers-request@gromacs.org</a>.</blockquote><div>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. <br>
</div></div><br>