Skip to content

Commit

Permalink
Fix private variables in Atom::pack/unpack
Browse files Browse the repository at this point in the history
j should be private, not shared.
Missed in Mantevo#2.
  • Loading branch information
Pennycook authored and nmm0 committed Dec 17, 2020
1 parent 10539ff commit 23c2295
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions target/atom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,12 @@ void Atom::copy(int i, int j)

void Atom::pack_comm(int n, int *list, MMD_float *buf, int *pbc_flags)
{
int i, j;

if(pbc_flags[0] == 0)
{

#pragma omp parallel for
for(i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
j = list[i];
int j = list[i];

buf[3 * i] = x[j * PAD + 0];
buf[3 * i + 1] = x[j * PAD + 1];
Expand All @@ -189,11 +186,10 @@ void Atom::pack_comm(int n, int *list, MMD_float *buf, int *pbc_flags)
}
else
{

#pragma omp parallel for
for(i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
j = list[i];
int j = list[i];

buf[3 * i] = x[j * PAD + 0] + pbc_flags[1] * box.xprd;
buf[3 * i + 1] = x[j * PAD + 1] + pbc_flags[2] * box.yprd;
Expand All @@ -204,10 +200,8 @@ void Atom::pack_comm(int n, int *list, MMD_float *buf, int *pbc_flags)

void Atom::unpack_comm(int n, int first, MMD_float *buf)
{
int i;

#pragma omp parallel for
for(i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
x[(first + i) * PAD + 0] = buf[3 * i];
x[(first + i) * PAD + 1] = buf[3 * i + 1];
Expand All @@ -217,10 +211,8 @@ void Atom::unpack_comm(int n, int first, MMD_float *buf)

void Atom::pack_reverse(int n, int first, MMD_float *buf)
{
int i;

#pragma omp parallel for
for(i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
buf[3 * i] = f[(first + i) * PAD + 0];
buf[3 * i + 1] = f[(first + i) * PAD + 1];
Expand All @@ -230,12 +222,10 @@ void Atom::pack_reverse(int n, int first, MMD_float *buf)

void Atom::unpack_reverse(int n, int *list, MMD_float *buf)
{
int i, j;

#pragma omp parallel for
for(i = 0; i < n; i++)
for(int i = 0; i < n; i++)
{
j = list[i];
int j = list[i];

f[j * PAD + 0] += buf[3 * i];
f[j * PAD + 1] += buf[3 * i + 1];
Expand Down

0 comments on commit 23c2295

Please sign in to comment.