Thanks for the replies. Now I’m trying to use the pack and unpack_exchange. I’ve added a few lines on the code, like these bellow
/* ----------------------------------------------------------------------
allocate atom-based array
------------------------------------------------------------------------- */
void FixQuantumBath::grow_arrays(int nmax)
{ //nmaxim = atom->nmax;
noisex = memory->grow_2d_double_array( noisex, nmax, noisesize,“fix_quantumbath:noisex”);
noisey = memory->grow_2d_double_array( noisey, nmax, noisesize,“fix_quantumbath:noisey”);
noisez = memory->grow_2d_double_array( noisez, nmax, noisesize,“fix_quantumbath:noisez”);
}
/* ----------------------------------------------------------------------
copy values within local atom-based arrays
------------------------------------------------------------------------- */
void FixQuantumBath::copy_arrays(int i, int j)
{
for (int t = 0; t < noisesize; t++) {
noisex[j][t] = noisex[i][t];
noisey[j][t] = noisey[i][t];
noisez[j][t] = noisez[i][t];
}
}
/* ----------------------------------------------------------------------
pack values in local atom-based arrays for exchange with another proc
------------------------------------------------------------------------- */
int FixQuantumBath::pack_exchange(int i, double *buf)
{
int m = 0;
for (int t = 0; t < noisesize; t++) {
buf[m++] = noisex[i][t];
buf[m++] = noisey[i][t];
buf[m++] = noisez[i][t];
}
return m;
}
/* ----------------------------------------------------------------------
unpack values in local atom-based arrays from exchange with another proc
------------------------------------------------------------------------- */
int FixQuantumBath::unpack_exchange(int nlocal, double *buf)
{
int m = 0;
for (int t = 0; t < noisesize; t++) {
noisex[nlocal][t] = buf[m++];
noisey[nlocal][t] = buf[m++];
noisez[nlocal][t] = buf[m++];
}
return m;
}
However, an error occurs on the “copy_arrays” function, when it tries to access the “noise” string (it tries to access unallocated place). Even though I allocate enough space for all the strings, which I didn’t wanted to, the error I had described on my second email occurs in the same way (problem with an atom changing between processors). Am I forgetting something?
Thanks,
Alexandre
2011/2/16 Steve Plimpton <sjplimp@…24…>