[lammps-users] lammps-users Digest, Vol 36, Issue 54

Dear Lammps developers,

Help is needed to clarify the following points:

I would like to define a 2D array with the same size as the number of atoms owned each processor (no ghost atoms). Would the following be correct?

double **r;
r = memory->create_2d_double_array(atom->nlocal,3,“rdf:r”);

Now I would like to copy the initial positions of atoms owned by the processor to this array. Here I am bit confused between nlocal and inum. Which of the following options are correct, if any?

Option #1:

int inum;
int *ilist;

inum = list->inum;
ilist = list->ilist;

for (i=0; i<inum; i++) {
ii = ilist[i];
r[i][0] = x[ii][0];
}

Option #2:

int *ilist;
ilist = list->ilist;
for (i=0; inlocal; i++) {
ii = ilist[i];
r[i][0] = x[ii][0];
}

Thank you, Javier

Use nlocal.

Steve