fix buffer size and format bugs in atom_vec_tri.cpp

This commit is contained in:
Axel Kohlmeyer 2020-07-12 15:46:56 -04:00
parent 5f14d5c87f
commit 60f078a8f9
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
3 changed files with 3 additions and 6 deletions

View File

@ -490,7 +490,6 @@ int AtomVecLine::pack_data_bonus(double *buf, int /*flag*/)
buf[m++] = y2;
} else m += size_data_bonus;
}
return m;
}

View File

@ -724,10 +724,8 @@ int AtomVecTri::pack_data_bonus(double *buf, int /*flag*/)
buf[m++] = xc + dc3[0];
buf[m++] = yc + dc3[1];
buf[m++] = zc + dc3[2];
}
m++;
} else m += size_data_bonus;
}
return m;
}
@ -739,7 +737,7 @@ void AtomVecTri::write_data_bonus(FILE *fp, int n, double *buf, int /*flag*/)
{
int i = 0;
while (i < n) {
fmt::print(fp,"{} {} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i,
fmt::print(fp,"{} {} {} {} {} {} {} {} {} {}\n", ubuf(buf[i]).i,
buf[i+1],buf[i+2],buf[i+3],buf[i+4],buf[i+5],buf[i+6],
buf[i+7],buf[i+8],buf[i+9]);
i += size_data_bonus;

View File

@ -669,7 +669,7 @@ void WriteData::bonus(int flag)
int maxvalues;
MPI_Allreduce(&nvalues,&maxvalues,1,MPI_INT,MPI_MAX,world);
double *buf;
double *buf = nullptr;
if (me == 0) memory->create(buf,MAX(1,maxvalues),"write_data:buf");
else memory->create(buf,MAX(1,nvalues),"write_data:buf");