<p dir="ltr"><br>
On Jan 31, 2014 4:22 AM, &quot;sryckbos&quot; &lt;<a href="mailto:sryckbos@stanford.edu">sryckbos@stanford.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; trjconv doesn&#39;t seem to check whether the .ndx file you specify corresponds<br>
&gt; at all with the .tpr and .xtc files you input.  </p>
<p dir="ltr">Hi, </p>
<p dir="ltr">Thanks for the report. As Tsjerk said, the only metadata in .xtc is the number of atoms, so only if an index group references out of those bounds is there a clear error that can be caught. We are aware of these and other deficiencies in the file formats; one advantage of the TNG trajectory format available in the upcoming GROMACS 5.0 is that it has embedded molecule information, which broadens the scope for such sanity checks. These kinds of checks are not implemented yet, because the scope and historical implementation of trajectory-file handling in GROMACS is mind-boggling.</p>

<p dir="ltr">&gt; I wrote a script that was<br>
&gt; using trjconv to remove the waters from many of my trajectories on several<br>
&gt; different systems.  I made an .ndx file for each of them, system1.ndx and<br>
&gt; system2.ndx, and planned to do something like this:<br>
&gt;<br>
&gt; echo Protein_ligand1|trjconv -s system1.tpr -f system1.xtc -o<br>
&gt; system1_dehyd.xtc -n system1.ndx<br>
&gt;<br>
&gt; and, separately, do<br>
&gt;<br>
&gt; echo Protein_ligand2|trjconv -s system2.tpr -f system2.xtc -o<br>
&gt; system2_dehyd.xtc -n system2.ndx<br>
&gt;<br>
&gt; Inadvertently, I forgot to change stuff in my second script, giving me a<br>
&gt; command like this<br>
&gt;<br>
&gt; echo Protein_ligand1|trjconv -s system2.tpr -f system2.xtc -o<br>
&gt; system2_dehyd.xtc -n system1.ndx<br>
&gt;<br>
&gt; Rather than flipping out and telling me that there isn&#39;t anything that<br>
&gt; corresponds to Protein_ligand1 in system2.tpr or system2.xtc, however, it<br>
&gt; gave me system2_dehyd.xtc as if nothing went wrong.  When I pulled<br>
&gt; coordinates from that xtc file, it just used the numbers that corresponded<br>
&gt; to Protein_ligand1 in the system2 files without looking at what it was<br>
&gt; actually pulling.</p>
<p dir="ltr">Indeed, but as the tool cannot parse the name of the index group, only if a group with that name was used in the .tpr could there be a basis for a warning. The best solution is to implement a command-line selection like</p>

<p dir="ltr">trjconv -s -f -o -select &quot;Protein and Ligand1&quot;</p>
<p dir="ltr">This kind of thing is available for a few tools in GROMACS 5.0, but more hands are needed to port the machinery to more tools. Contributions welcome!</p>
<p dir="ltr">That still won&#39;t prevent you from writing the wrong selection for the name of your -o file, though...</p>
<p dir="ltr">&gt; Next I tried to break it.  system1 has slightly more atoms than system2, and<br>
&gt; so I figured if trjconv just ran out of atoms, it&#39;d throw an error.  Not<br>
&gt; really.  If I did this:<br>
&gt;<br>
&gt; echo System|trjconv -s system2.tpr -f system2.xtc -o system2_dehyd.xtc -n<br>
&gt; system1.ndx<br>
&gt;<br>
&gt; All I got was:<br>
&gt;<br>
&gt; Select a group: Selected 0: &#39;System&#39;<br>
&gt; Segmentation fault</p>
<p dir="ltr">Thanks, that is bad - enough information exists to give a sensible error message.</p>
<p dir="ltr">&gt; Finally, I figured if there was no ndx file, I wouldn&#39;t get this problem.<br>
&gt; Not so.  If I did<br>
&gt;<br>
&gt; echo System|trjconv -s system2.tpr -f system1.xtc -o test.xtc<br>
&gt;<br>
&gt; This time, I did get the following error:<br>
&gt;<br>
&gt; -------------------------------------------------------<br>
&gt; Program trjconv, VERSION 4.6<br>
&gt; Source code file:<br>
&gt; /home/sryckbos/Downloads/gromacs-4.6/src/tools/gmx_trjconv.c, line: 1312<br>
&gt;<br>
&gt; Fatal error:<br>
&gt; Index[33820] 33821 is larger than the number of atoms in the<br>
&gt; trajectory file (33820). There is a mismatch in the contents<br>
&gt; of your -f, -s and/or -n files.<br>
&gt; For more information and tips for troubleshooting, please check the GROMACS<br>
&gt; website at <a href="http://www.gromacs.org/Documentation/Errors">http://www.gromacs.org/Documentation/Errors</a><br>
&gt; -------------------------------------------------------</p>
<p dir="ltr">Good</p>
<p dir="ltr">&gt; BUT, if I reversed it,<br>
&gt;<br>
&gt; echo System|trjconv -s system1.tpr -f system2.xtc -o test2.xtc<br>
&gt;<br>
&gt; There was no error, and I got test2.xtc out without any problems.</p>
<p dir="ltr">This &quot;supports&quot; the standard usage of .xtc to contain a subset of the .tpr atoms, as written from mdrun. But since it is a null operation, it should give an error. It doesn&#39;t do so because trjconv has too much functionality, which I am working on.</p>

<p dir="ltr">&gt; This seems like a pretty major bug to me, and presumably this isn&#39;t<br>
&gt; occurring because I&#39;m not up to date (didn&#39;t see anything about it in any of<br>
&gt; the release notes for the 4.6.x series, or on any of the mailing lists).<br>
&gt; Has anyone else experienced or noticed this issue?</p>
<p dir="ltr">Yes you&#39;re sufficiently up to date. Whether a problem gets fixed basically depends on whether it annoys a developer enough to provoke them to fix it. Unfortunately experience mitigates making this kind of mistake, and this particular group of problems is too large for a new developer to fix!</p>

<p dir="ltr">Mark</p>
<p dir="ltr">&gt; --<br>
&gt; View this message in context: <a href="http://gromacs.5086.x6.nabble.com/trjconv-doesn-t-check-if-the-tpr-xtc-and-ndx-files-provided-match-tp5014178.html">http://gromacs.5086.x6.nabble.com/trjconv-doesn-t-check-if-the-tpr-xtc-and-ndx-files-provided-match-tp5014178.html</a><br>

&gt; Sent from the GROMACS Developers Forum mailing list archive at Nabble.com.<br>
&gt; --<br>
&gt; Gromacs Developers mailing list<br>
&gt;<br>
&gt; * Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
&gt;<br>
&gt; * Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists">http://www.gromacs.org/Support/Mailing_Lists</a><br>
&gt;<br>
&gt; * For (un)subscribe requests visit<br>
&gt; <a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers">https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers</a> or send a mail to <a href="mailto:gmx-developers-request@gromacs.org">gmx-developers-request@gromacs.org</a>.<br>

</p>