more use of utils::sfread()
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
#include "memory.h"
|
||||
#include "error.h"
|
||||
#include "respa.h"
|
||||
#include "utils.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
@ -681,7 +682,7 @@ void PairHybrid::write_restart(FILE *fp)
|
||||
void PairHybrid::read_restart(FILE *fp)
|
||||
{
|
||||
int me = comm->me;
|
||||
if (me == 0) fread(&nstyles,sizeof(int),1,fp);
|
||||
if (me == 0) utils::sfread(FLERR,&nstyles,sizeof(int),1,fp,NULL,error);
|
||||
MPI_Bcast(&nstyles,1,MPI_INT,0,world);
|
||||
|
||||
// allocate list of sub-styles
|
||||
@ -704,32 +705,32 @@ void PairHybrid::read_restart(FILE *fp)
|
||||
// each sub-style is created via new_pair()
|
||||
// each reads its settings, but no coeff info
|
||||
|
||||
if (me == 0) fread(compute_tally,sizeof(int),nstyles,fp);
|
||||
if (me == 0) utils::sfread(FLERR,compute_tally,sizeof(int),nstyles,fp,NULL,error);
|
||||
MPI_Bcast(compute_tally,nstyles,MPI_INT,0,world);
|
||||
|
||||
int n,dummy;
|
||||
for (int m = 0; m < nstyles; m++) {
|
||||
if (me == 0) fread(&n,sizeof(int),1,fp);
|
||||
if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error);
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
keywords[m] = new char[n];
|
||||
if (me == 0) fread(keywords[m],sizeof(char),n,fp);
|
||||
if (me == 0) utils::sfread(FLERR,keywords[m],sizeof(char),n,fp,NULL,error);
|
||||
MPI_Bcast(keywords[m],n,MPI_CHAR,0,world);
|
||||
styles[m] = force->new_pair(keywords[m],0,dummy);
|
||||
styles[m]->read_restart_settings(fp);
|
||||
// read back per style special settings, if present
|
||||
special_lj[m] = special_coul[m] = NULL;
|
||||
if (me == 0) fread(&n,sizeof(int),1,fp);
|
||||
if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error);
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
if (n > 0 ) {
|
||||
special_lj[m] = new double[4];
|
||||
if (me == 0) fread(special_lj[m],sizeof(double),4,fp);
|
||||
if (me == 0) utils::sfread(FLERR,special_lj[m],sizeof(double),4,fp,NULL,error);
|
||||
MPI_Bcast(special_lj[m],4,MPI_DOUBLE,0,world);
|
||||
}
|
||||
if (me == 0) fread(&n,sizeof(int),1,fp);
|
||||
if (me == 0) utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error);
|
||||
MPI_Bcast(&n,1,MPI_INT,0,world);
|
||||
if (n > 0 ) {
|
||||
special_coul[m] = new double[4];
|
||||
if (me == 0) fread(special_coul[m],sizeof(double),4,fp);
|
||||
if (me == 0) utils::sfread(FLERR,special_coul[m],sizeof(double),4,fp,NULL,error);
|
||||
MPI_Bcast(special_coul[m],4,MPI_DOUBLE,0,world);
|
||||
}
|
||||
}
|
||||
@ -766,7 +767,6 @@ double PairHybrid::single(int i, int j, int itype, int jtype,
|
||||
double fone;
|
||||
fforce = 0.0;
|
||||
double esum = 0.0;
|
||||
int n = 0;
|
||||
|
||||
for (int m = 0; m < nmap[itype][jtype]; m++) {
|
||||
if (rsq < styles[map[itype][jtype][m]]->cutsq[itype][jtype]) {
|
||||
|
||||
Reference in New Issue
Block a user