Skip to content

Commit

Permalink
Merge pull request lammps#4034 from jorge-ramirez-upm/correct-fix-ave…
Browse files Browse the repository at this point in the history
…-correlate-long

Small correction to fix/ave/correlate/long to show the right output after a restart
  • Loading branch information
akohlmey authored Jan 8, 2024
2 parents 1e9eb93 + 1b6dc1f commit 7ca2dca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/EXTRA-FIX/fix_ave_correlate_long.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ void FixAveCorrelateLong::end_of_step()
if (overwrite) {
bigint fileend = platform::ftell(fp);
if ((fileend > 0) && (platform::ftruncate(fp,fileend)))
error->warning(FLERR,"Error while tuncating output: {}", utils::getsyserror());
error->warning(FLERR,"Error while truncating output: {}", utils::getsyserror());
}
}
}
Expand Down Expand Up @@ -728,14 +728,15 @@ double FixAveCorrelateLong::memory_usage() {
void FixAveCorrelateLong::write_restart(FILE *fp) {
if (comm->me == 0) {
int nsize = 3*npair*numcorrelators*p + 2*npair*numcorrelators
+ numcorrelators*p + 2*numcorrelators + 6;
+ numcorrelators*p + 2*numcorrelators + 7;
int n=0;
double *list;
memory->create(list,nsize,"correlator:list");
list[n++] = npair;
list[n++] = numcorrelators;
list[n++] = p;
list[n++] = m;
list[n++] = kmax;
list[n++] = last_accumulated_step;
for (int i=0; i < npair; i++)
for (int j=0; j < numcorrelators; j++) {
Expand Down Expand Up @@ -771,6 +772,7 @@ void FixAveCorrelateLong::restart(char *buf)
int numcorrelatorsin = static_cast<int> (list[n++]);
int pin = static_cast<int>(list[n++]);
int min = static_cast<int>(list[n++]);
kmax = static_cast<int>(list[n++]);
last_accumulated_step = static_cast<int>(list[n++]);

if ((npairin!=npair) || (numcorrelatorsin!=numcorrelators) || (pin!=(int)p) || (min!=(int)m))
Expand Down

0 comments on commit 7ca2dca

Please sign in to comment.