[gmx-developers] AnalysisNeighborhoodSearch and Selections
Teemu Murtola
teemu.murtola at gmail.com
Sun Jul 23 20:51:27 CEST 2017
Hi,
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.
Teemu
On Sun, Jul 23, 2017 at 9:15 PM David van der Spoel <spoel at xray.bmc.uu.se>
wrote:
> Not sure what I'm doing wrong. My selection consists of the OW atoms in
> water molecules, then I'm trying to use the following code:
>
> // Use neighborsearching tools!
> AnalysisNeighborhoodSearch nbsearch = nb_.initSearch(pbc, sel);
> AnalysisNeighborhoodPair pair;
> AnalysisNeighborhoodPositions positions(fr.x, fr.natoms);
> AnalysisNeighborhoodPairSearch pairSearch =
> nbsearch.startPairSearch(positions);
>
> while (pairSearch.findNextPair(&pair))
> {
> int pi = pair.refIndex();
> int pj = pair.testIndex();
>
> printf("pi %d pj %d\n", pi, pj)
> ....
>
> yields
>
> pi 0 pj 1
> pi 0 pj 2
> etc.
> ----
>
> Note that "sel" just holds 0, 3, 6, 9, but the pairSearch algorithms
> gives atoms that are outside the selection. What is wrong?
>
> Cheers,
> --
> David van der Spoel, Ph.D., Professor of Biology
> Head of Department, Cell & Molecular Biology, Uppsala University.
> Box 596, SE-75124 Uppsala, Sweden. Phone: +46184714205
> <+46%2018%20471%2042%2005>.
> http://www.icm.uu.se
> --
> Gromacs Developers mailing list
>
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/GMX-developers_List before
> posting!
>
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>
> * For (un)subscribe requests visit
> https://maillist.sys.kth.se/mailman/listinfo/gromacs.org_gmx-developers
> or send a mail to gmx-developers-request at gromacs.org.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20170723/d336fd9b/attachment.html>
More information about the gromacs.org_gmx-developers
mailing list