<div dir="ltr">Hi,<div><br></div><div>There is nothing wrong shown in your clipped example output: the first index (pi in the code) is from the selection, and it is zero on all rows, so based on that, we cannot judge anything. But I assume that you are referring to the code returning 0, 1, 2, or 3 in pi. These are indexes to the positions in the selection. The code does not magically resolve these to atoms; your selection could also contain center-of-mass positions, and then there would not be an atom index to return. So the neighborhood search always returns indexes to the positions passed in, as it would be an array. It does not know whether the coordinates are atoms or something else.</div><div><br></div><div>Teemu</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Jul 23, 2017 at 9:15 PM David van der Spoel &lt;<a href="mailto:spoel@xray.bmc.uu.se">spoel@xray.bmc.uu.se</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Not sure what I&#39;m doing wrong. My selection consists of the OW atoms in<br>
water molecules, then I&#39;m trying to use the following code:<br>
<br>
// Use neighborsearching tools!<br>
AnalysisNeighborhoodSearch     nbsearch = nb_.initSearch(pbc, sel);<br>
AnalysisNeighborhoodPair       pair;<br>
AnalysisNeighborhoodPositions  positions(fr.x, fr.natoms);<br>
AnalysisNeighborhoodPairSearch pairSearch =<br>
     nbsearch.startPairSearch(positions);<br>
<br>
while (pairSearch.findNextPair(&amp;pair))<br>
{<br>
    int pi = pair.refIndex();<br>
    int pj = pair.testIndex();<br>
<br>
    printf(&quot;pi %d pj %d\n&quot;, pi, pj)<br>
....<br>
<br>
yields<br>
<br>
pi 0 pj 1<br>
pi 0 pj 2<br>
etc.<br>
----<br>
<br>
Note that &quot;sel&quot; just holds 0, 3, 6, 9, but the pairSearch algorithms<br>
gives atoms that are outside the selection. What is wrong?<br>
<br>
Cheers,<br>
--<br>
David van der Spoel, Ph.D., Professor of Biology<br>
Head of Department, Cell &amp; Molecular Biology, Uppsala University.<br>
Box 596, SE-75124 Uppsala, Sweden. Phone: <a href="tel:+46%2018%20471%2042%2005" value="+46184714205" target="_blank">+46184714205</a>.<br>
<a href="http://www.icm.uu.se" rel="noreferrer" target="_blank">http://www.icm.uu.se</a><br>
--<br>
Gromacs Developers mailing list<br>
<br>
* Please search the archive at <a href="http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List</a> before posting!<br>
<br>
* Can&#39;t post? Read <a href="http://www.gromacs.org/Support/Mailing_Lists" rel="noreferrer" target="_blank">http://www.gromacs.org/Support/Mailing_Lists</a><br>
<br>
* For (un)subscribe requests visit<br>
<a href="https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers" rel="noreferrer" target="_blank">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" target="_blank">gmx-developers-request@gromacs.org</a>.<br>
</blockquote></div>