diff --git a/src/fix_temp_csld.cpp b/src/fix_temp_csld.cpp index 48c18c4e4f..3b522c185f 100644 --- a/src/fix_temp_csld.cpp +++ b/src/fix_temp_csld.cpp @@ -305,16 +305,17 @@ double FixTempCSLD::compute_scalar() void FixTempCSLD::write_restart(FILE *fp) { - int nsize = (98+2+3)*comm->nprocs+2; // pRNG state per proc + nprocs + energy + const int PRNGSIZE = 98+2+3; + int nsize = PRNGSIZE*comm->nprocs+2; // pRNG state per proc + nprocs + energy double *list = nullptr; if (comm->me == 0) { list = new double[nsize]; list[0] = energy; list[1] = comm->nprocs; } - double state[103]; + double state[PRNGSIZE]; random->get_state(state); - MPI_Gather(state,103,MPI_DOUBLE,list+2,103,MPI_DOUBLE,0,world); + MPI_Gather(state,PRNGSIZE,MPI_DOUBLE,list+2,PRNGSIZE,MPI_DOUBLE,0,world); if (comm->me == 0) { int size = nsize * sizeof(double); diff --git a/src/fix_temp_csvr.cpp b/src/fix_temp_csvr.cpp index e3fdb7fc80..674c436e9d 100644 --- a/src/fix_temp_csvr.cpp +++ b/src/fix_temp_csvr.cpp @@ -338,16 +338,17 @@ double FixTempCSVR::compute_scalar() void FixTempCSVR::write_restart(FILE *fp) { - int nsize = (98+2+3)*comm->nprocs+2; // pRNG state per proc + nprocs + energy + const int PRNGSIZE = 98+2+3; + int nsize = PRNGSIZE*comm->nprocs+2; // pRNG state per proc + nprocs + energy double *list = nullptr; if (comm->me == 0) { list = new double[nsize]; list[0] = energy; list[1] = comm->nprocs; } - double state[103]; + double state[PRNGSIZE]; random->get_state(state); - MPI_Gather(state,103,MPI_DOUBLE,list+2,103,MPI_DOUBLE,0,world); + MPI_Gather(state,PRNGSIZE,MPI_DOUBLE,list+2,PRNGSIZE,MPI_DOUBLE,0,world); if (comm->me == 0) { int size = nsize * sizeof(double);