Merge branch 'master' into symbolic-atom-constants

This commit is contained in:
Axel Kohlmeyer
2020-09-15 17:44:31 -04:00
1186 changed files with 8448 additions and 8360 deletions

View File

@ -108,7 +108,7 @@ void ReadRestart::command(int narg, char **arg)
hfile.replace(hfile.find("%"),1,"base");
}
fp = fopen(hfile.c_str(),"rb");
if (fp == NULL)
if (fp == nullptr)
error->one(FLERR,fmt::format("Cannot open restart file {}: {}",
hfile, utils::getsyserror()));
}
@ -166,7 +166,7 @@ void ReadRestart::command(int narg, char **arg)
if (multiproc && me == 0) {
fclose(fp);
fp = NULL;
fp = nullptr;
}
// read per-proc info
@ -174,7 +174,7 @@ void ReadRestart::command(int narg, char **arg)
AtomVec *avec = atom->avec;
int maxbuf = 0;
double *buf = NULL;
double *buf = nullptr;
int m,flag;
// MPI-IO input from single file
@ -255,7 +255,7 @@ void ReadRestart::command(int narg, char **arg)
if (me == 0) {
fclose(fp);
fp = NULL;
fp = nullptr;
}
}
@ -270,34 +270,34 @@ void ReadRestart::command(int narg, char **arg)
std::string procfile = file;
procfile.replace(procfile.find("%"),1,fmt::format("{}",iproc));
fp = fopen(procfile.c_str(),"rb");
if (fp == NULL)
if (fp == nullptr)
error->one(FLERR,fmt::format("Cannot open restart file {}: {}",
procfile, utils::getsyserror()));
utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error);
if (flag != PROCSPERFILE)
error->one(FLERR,"Invalid flag in peratom section of restart file");
int procsperfile;
utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error);
for (int i = 0; i < procsperfile; i++) {
utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error);
if (flag != PERPROC)
error->one(FLERR,"Invalid flag in peratom section of restart file");
utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error);
if (n > maxbuf) {
maxbuf = n;
memory->destroy(buf);
memory->create(buf,maxbuf,"read_restart:buf");
}
utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error);
utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error);
m = 0;
while (m < n) m += avec->unpack_restart(&buf[m]);
}
fclose(fp);
fp = NULL;
fp = nullptr;
}
}
@ -334,7 +334,7 @@ void ReadRestart::command(int narg, char **arg)
std::string procfile = file;
procfile.replace(procfile.find("%"),1,fmt::format("{}",icluster));
fp = fopen(procfile.c_str(),"rb");
if (fp == NULL)
if (fp == nullptr)
error->one(FLERR,fmt::format("Cannot open restart file {}: {}",
procfile, utils::getsyserror()));
}
@ -342,10 +342,10 @@ void ReadRestart::command(int narg, char **arg)
int flag,procsperfile;
if (filereader) {
utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error);
if (flag != PROCSPERFILE)
error->one(FLERR,"Invalid flag in peratom section of restart file");
utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&procsperfile,sizeof(int),1,fp,nullptr,error);
}
MPI_Bcast(&procsperfile,1,MPI_INT,0,clustercomm);
@ -354,17 +354,17 @@ void ReadRestart::command(int narg, char **arg)
for (int i = 0; i < procsperfile; i++) {
if (filereader) {
utils::sfread(FLERR,&flag,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&flag,sizeof(int),1,fp,nullptr,error);
if (flag != PERPROC)
error->one(FLERR,"Invalid flag in peratom section of restart file");
utils::sfread(FLERR,&n,sizeof(int),1,fp,NULL,error);
utils::sfread(FLERR,&n,sizeof(int),1,fp,nullptr,error);
if (n > maxbuf) {
maxbuf = n;
memory->destroy(buf);
memory->create(buf,maxbuf,"read_restart:buf");
}
utils::sfread(FLERR,buf,sizeof(double),n,fp,NULL,error);
utils::sfread(FLERR,buf,sizeof(double),n,fp,nullptr,error);
if (i % nclusterprocs) {
iproc = me + (i % nclusterprocs);
@ -391,9 +391,9 @@ void ReadRestart::command(int narg, char **arg)
}
}
if (filereader && fp != NULL) {
if (filereader && fp != nullptr) {
fclose(fp);
fp = NULL;
fp = nullptr;
}
MPI_Comm_free(&clustercomm);
}
@ -570,11 +570,11 @@ void ReadRestart::file_search(char *inpfile, char *outfile)
struct dirent *ep;
DIR *dp = opendir(dirname);
if (dp == NULL)
if (dp == nullptr)
error->one(FLERR,"Cannot open dir to search for restart file");
while ((ep = readdir(dp))) {
if (strstr(ep->d_name,begin) != ep->d_name) continue;
if ((ptr = strstr(&ep->d_name[nbegin],end)) == NULL) continue;
if ((ptr = strstr(&ep->d_name[nbegin],end)) == nullptr) continue;
if (strlen(end) == 0) ptr = ep->d_name + strlen(ep->d_name);
*ptr = '\0';
if ((int)strlen(&ep->d_name[nbegin]) < n) {
@ -1034,7 +1034,7 @@ void ReadRestart::file_layout()
memory->create(nproc_chunk_number,nprocs,
"write_restart:nproc_chunk_number");
utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,NULL,error);
utils::sfread(FLERR,all_written_send_sizes,sizeof(int),nprocs_file,fp,nullptr,error);
if ((nprocs != nprocs_file) && !(atom->nextra_store)) {
// nprocs differ, but atom sizes are fixed length, yeah!
@ -1232,7 +1232,7 @@ double ReadRestart::read_double()
}
/* ----------------------------------------------------------------------
read a char string (including NULL) and bcast it
read a char string (including nullptr) and bcast it
str is allocated here, ptr is returned, caller must deallocate
------------------------------------------------------------------------- */
@ -1241,7 +1241,7 @@ char *ReadRestart::read_string()
int n = read_int();
if (n < 0) error->all(FLERR,"Illegal size string or corrupt restart");
char *value = new char[n];
if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,NULL,error);
if (me == 0) utils::sfread(FLERR,value,sizeof(char),n,fp,nullptr,error);
MPI_Bcast(value,n,MPI_CHAR,0,world);
return value;
}
@ -1253,7 +1253,7 @@ char *ReadRestart::read_string()
void ReadRestart::read_int_vec(int n, int *vec)
{
if (n < 0) error->all(FLERR,"Illegal size integer vector read requested");
if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,NULL,error);
if (me == 0) utils::sfread(FLERR,vec,sizeof(int),n,fp,nullptr,error);
MPI_Bcast(vec,n,MPI_INT,0,world);
}
@ -1264,6 +1264,6 @@ void ReadRestart::read_int_vec(int n, int *vec)
void ReadRestart::read_double_vec(int n, double *vec)
{
if (n < 0) error->all(FLERR,"Illegal size double vector read requested");
if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,NULL,error);
if (me == 0) utils::sfread(FLERR,vec,sizeof(double),n,fp,nullptr,error);
MPI_Bcast(vec,n,MPI_DOUBLE,0,world);
}