more use of utils::sfread()

This commit is contained in:
Axel Kohlmeyer
2019-10-17 13:18:02 -04:00
parent 63cb0775ef
commit fe20490891
53 changed files with 544 additions and 495 deletions

View File

@ -30,6 +30,7 @@
#include "math_const.h"
#include "memory.h"
#include "error.h"
#include "utils.h"
using namespace LAMMPS_NS;
using namespace MathConst;
@ -626,15 +627,15 @@ void PairMIECut::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);
if (setflag[i][j]) {
if (me == 0) {
fread(&epsilon[i][j],sizeof(double),1,fp);
fread(&sigma[i][j],sizeof(double),1,fp);
fread(&gamR[i][j],sizeof(double),1,fp);
fread(&gamA[i][j],sizeof(double),1,fp);
fread(&cut[i][j],sizeof(double),1,fp);
utils::sfread(FLERR,&epsilon[i][j],sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&sigma[i][j],sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&gamR[i][j],sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&gamA[i][j],sizeof(double),1,fp,NULL,error);
utils::sfread(FLERR,&cut[i][j],sizeof(double),1,fp,NULL,error);
}
MPI_Bcast(&epsilon[i][j],1,MPI_DOUBLE,0,world);
MPI_Bcast(&sigma[i][j],1,MPI_DOUBLE,0,world);
@ -665,10 +666,10 @@ void PairMIECut::read_restart_settings(FILE *fp)
{
int me = comm->me;
if (me == 0) {
fread(&cut_global,sizeof(double),1,fp);
fread(&offset_flag,sizeof(int),1,fp);
fread(&mix_flag,sizeof(int),1,fp);
fread(&tail_flag,sizeof(int),1,fp);
utils::sfread(FLERR,&cut_global,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);
utils::sfread(FLERR,&tail_flag,sizeof(int),1,fp,NULL,error);
}
MPI_Bcast(&cut_global,1,MPI_DOUBLE,0,world);
MPI_Bcast(&offset_flag,1,MPI_INT,0,world);