use new utils::sfread() utility function in several classes

This commit is contained in:
Axel Kohlmeyer
2019-10-17 11:29:08 -04:00
parent 7d1cd63e1d
commit cad6293078
22 changed files with 169 additions and 127 deletions

View File

@ -26,6 +26,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
using namespace MathConst;
@ -248,7 +249,7 @@ void PairCoulWolf::read_restart(FILE *fp)
int me = comm->me;
for (i = 1; i <= atom->ntypes; i++)
for (j = i; j <= atom->ntypes; j++) {
if (me == 0) fread(&setflag[i][j],sizeof(int),1,fp);
if (me == 0) utils::sfread(FLERR,&setflag[i][j],sizeof(int),1,fp,NULL,error);
MPI_Bcast(&setflag[i][j],1,MPI_INT,0,world);
}
}
@ -272,10 +273,10 @@ void PairCoulWolf::write_restart_settings(FILE *fp)
void PairCoulWolf::read_restart_settings(FILE *fp)
{
if (comm->me == 0) {
fread(&alf,sizeof(double),1,fp);
fread(&cut_coul,sizeof(double),1,fp);
fread(&offset_flag,sizeof(int),1,fp);
fread(&mix_flag,sizeof(int),1,fp);
utils::sfread(FLERR,&alf,sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&cut_coul,sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&offset_flag,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&mix_flag,sizeof(int),1,fp,NULL,error);
}
MPI_Bcast(&alf,1,MPI_DOUBLE,0,world);
MPI_Bcast(&cut_coul,1,MPI_DOUBLE,0,world);