[gmx-developers] Questions regarding neighbor searching (nsgrid_core function)

Albert Hartono albert.hartono at gmail.com
Fri Oct 10 22:08:55 CEST 2014


Hello,

I'm trying to understand Gromacs' nsgrid_core function.

This function performs data insertions into 2D arrays nl_sr, nl_lr_ljc,
nl_lr_one (code given below).

if (r2 < rs2) {
  if (nsr[jgid] >= MAX_CG) {
    put_in_list(...);
    nsr[jgid] = 0;
  }
  *nl_sr[jgid][nsr[jgid]++] = jjcg;*
} else if (r2 < rm2) {
  if (nlr_ljc[jgid] >= MAX_CG) {
    put_in_list(...);
    nlr_ljc[jgid] = 0;
  }
 * nl_lr_ljc[jgid][nlr_ljc[jgid]++] = jjcg;*
} else {
  if (nlr_one[jgid] >= MAX_CG) {
    put_in_list(...);
    nlr_one[jgid] = 0;
  }
  *nl_lr_one[jgid][nlr_one[jgid]++] = jjcg;*
}

My questions are as follows:

1. Profiling of single-core execution shows the length of the first
dimension of these arrays is always one (i.e., jgid is always 1). In what
case does the length of the first dimension become more than one? Is it
true when there are more than one cores used?

2. I can see when the buffer gets full, its content is copied to other
container. But what does this function actually do (in high level)? I'm a
computer scientist and have no background in molecular dynamics.

Any kind help on understanding this code is highly appreciated. Thank you
much!

Best,
Albert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20141010/5d393ab4/attachment-0001.html>


More information about the gromacs.org_gmx-developers mailing list