<br><br><div class="gmail_quote">2009/2/23 Mark Abraham <span dir="ltr">&lt;<a href="mailto:Mark.Abraham@anu.edu.au">Mark.Abraham@anu.edu.au</a>&gt;</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&lt;mtop &lt;<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>&gt;-&gt;nmolblock;j++) ///enum all molecule types/<br>

<br>
    {<br>
     for(k=0;k&lt;mtop &lt;<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>&gt;-&gt;molblock &lt;<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>&gt;[j].nmol;k++) ///enum all instances of each molecule type/<br>

<br>
     {<br>
       for(l=0;l&lt;mtop &lt;<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>&gt;-&gt;moltype &lt;<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>&gt;[ mtop &lt;<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>&gt;-&gt;molblock &lt;<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>&gt;[j].type].<a href="http://atoms.nr" target="_blank">atoms.nr</a> &lt;<a href="http://atoms.nr" target="_blank">http://atoms.nr</a>&gt;;l++) ///enum atoms/<br>

<br>
       {<br>
         t_atom &lt;<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>&gt;* atom_info=&amp;mtop &lt;<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>&gt;-&gt;moltype &lt;<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>&gt;[ mtop &lt;<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>&gt;-&gt;molblock &lt;<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>&gt;[j].type].atoms.atom[l];<br>

<br>
         rvec* atom_position=&amp;state &lt;<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>&gt;-&gt;x &lt;<a href="http://wiki.gromacs.org/index.php/Gromacs_Intro#X" target="_blank">http://wiki.gromacs.org/index.php/Gromacs_Intro#X</a>&gt;[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&#39;s an ordered list of molecule types (with numbers of each type; &quot;molblock&quot; is roughly synonymous with &quot;molecule type&quot;), and for each molecule type an ordered list of atoms. Structure members fitting the pattern &quot;nxxx&quot; have the &quot;n&quot; abbreviating &quot;number&quot; 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&#39;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&#39;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>