<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hi,<br>
<br>
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?<br>
<br>
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.<br>
<br>
Note that since the ga2la_get calls are expensive, such an
approach is only efficient when you have only few atoms / atom
pairs.<br>
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.<br>
<br>
Cheers,<br>
<br>
Berk<br>
<br>
On 2015-08-28 06:35, Xingcheng Lin wrote:<br>
</div>
<blockquote
cite="mid:CAPugp-HQjXb8hYKJO9i-1fMSfpzQxe=qZCOo8tPwPQrFraKEmw@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<div dir="ltr">
<div>
<div>
<div>Hi,<br>
<br>
</div>
I am trying to encode a "on the fly" calculation for the
number of atom pairs within some distance (for example here,
6 angstroms).<br>
<br>
</div>
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: <br>
<br>
// NP is number of tested pairs recorded in an array;<br>
</div>
<div>// If atom ai is one of the home atoms in a node, we start
testing if aj is available by the same node;<br>
</div>
<div>// rlist = 1.0nm, Coulombtype = Cut-off, cutoff-scheme =
Verlet, ns_type = grid, pbc = xyz;<br>
</div>
<div><br>
int Npairs = 0;<br>
for (i=0; i<NP; ++i)<br>
{<br>
int ai = datai[i] ;<br>
</div>
<div> int localai;<br>
</div>
<div> // Examine if ai it is within the home atoms index;<br>
if (ga2la_get_home(cr->dd->ga2la, ai,
&localai))<br>
{<br>
aj = dataj[i] ;<br>
// Examine if aj is available by local node;;<br>
if (ga2la_get(cr->dd->ga2la, aj, &localaj,
&localcell))<br>
{ <br>
FILE *fp;<br>
fp = fopen("pairs.dat","a");<br>
<br>
fprintf(fp, "%d\t%d\n", ai, aj);<br>
fclose(fp);<br>
<br>
r_N = 0.6 ;<br>
pbc_dx(&pbc, x[localai], x[localaj], dx) ;<br>
dr2 = iprod( dx, dx ) ;<br>
dr = sqrt( dr2 ) ;<br>
if (dr < r_N)<br>
{<br>
Npairs += 1;<br>
}<br>
}<br>
}<br>
}<br>
<br>
</div>
<div>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?<br>
<br>
</div>
<div>Or are there any mistakes out of my notice in this code?<br>
<br>
</div>
<div>Thank you,<br>
</div>
<div>Xingcheng<br>
<br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>