[gmx-developers] AnalysisNeighborhoodSearch and Selections

David van der Spoel spoel at xray.bmc.uu.se
Sun Jul 23 20:14:47 CEST 2017


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.
http://www.icm.uu.se


More information about the gromacs.org_gmx-developers mailing list