[gmx-developers] Increase the scope of dd domains

Berk Hess hess at kth.se
Fri Aug 28 09:22:43 CEST 2015


Hi,

Gromacs uses a neutral-territory eighth-shell domain decomposition 
method. So you can get all pairs by only looking at home-atoms for the 
i-atoms. You code should work though for 1D decomposition, is that the case?

To get this to work with 2D or 3D decomposition, you need to replace 
ga2la_get_home by ga2la_get and then only consider i-j pairs where the 
cell values are in the cell pair list given by dd->comm->zones. cell_i 
should be < zones->nizone and zones->izone[cell_i].j0 <= cell_j < 
zones->izone[cell_j].j1 When the DD cells get smaller than the cutoff, 
you need to use cell % zones->n.

Note that since the ga2la_get calls are expensive, such an approach is 
only efficient when you have only few atoms / atom pairs.
For improving performance, it can help to first lookup locala and cell 
for all atoms and store them and then do the pair double loop after 
that. And instead of using sqrt, check dr2 < r_N*r_N.

Cheers,

Berk

On 2015-08-28 06:35, Xingcheng Lin wrote:
> Hi,
>
> I am trying to encode a "on the fly" calculation for the number of 
> atom pairs within some distance (for example here, 6 angstroms).
>
> The problem happens when doing parallel domain decomposition. 
> Specifically, when two particles reside in different domains, gromacs 
> is not able to recognize this pair. I am trying to use ga2la_get_home 
> and ga2la_get for calculation, here is the code:
>
> // NP is number of tested pairs recorded in an array;
> // If atom ai is one of the home atoms in a node, we start testing if 
> aj is available by the same node;
> // rlist = 1.0nm, Coulombtype  =  Cut-off, cutoff-scheme = Verlet, 
> ns_type  = grid, pbc = xyz;
>
> int Npairs = 0;
> for (i=0; i<NP; ++i)
> {
>      int ai = datai[i] ;
>      int localai;
>      // Examine if ai it is within the home atoms index;
>      if (ga2la_get_home(cr->dd->ga2la, ai, &localai))
>      {
>         aj = dataj[i] ;
>         // Examine if aj is available by local node;;
>         if (ga2la_get(cr->dd->ga2la, aj, &localaj, &localcell))
>         {
>            FILE *fp;
>            fp = fopen("pairs.dat","a");
>
>            fprintf(fp, "%d\t%d\n", ai, aj);
>            fclose(fp);
>
>            r_N = 0.6 ;
>            pbc_dx(&pbc, x[localai], x[localaj], dx) ;
>            dr2 = iprod( dx, dx ) ;
>            dr  = sqrt( dr2 ) ;
>            if (dr < r_N)
>            {
>                Npairs += 1;
>            }
>         }
>      }
>  }
>
> The results show some atom pairs, while atoms less than 6 angstroms 
> apart, are missing here. I increase rlist, but it doesn't help. Is 
> there any way to increase the scope of atoms available in each domain 
> so that the missing atoms can be detected?
>
> Or are there any mistakes out of my notice in this code?
>
> Thank you,
> Xingcheng
>
>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://maillist.sys.kth.se/pipermail/gromacs.org_gmx-developers/attachments/20150828/682fbb3e/attachment-0001.html>


More information about the gromacs.org_gmx-developers mailing list