Merge pull request #2129 from akohlmey/collected-small-changes

Collected small changes for the next patch release
This commit is contained in:
Axel Kohlmeyer
2020-06-05 18:49:47 -04:00
committed by GitHub
11 changed files with 46 additions and 33 deletions

View File

@ -4,7 +4,11 @@
ifndef KOKKOS_PATH ifndef KOKKOS_PATH
KOKKOS_PATH=../../lib/kokkos KOKKOS_PATH=../../lib/kokkos
endif endif
CXXFLAGS=$(CCFLAGS) CXXFLAGS=$(CCFLAGS)
ifeq ($(mode),shared)
CXXFLAGS += $(SHFLAGS)
endif
KOKKOS_VERSION_MAJOR = 3 KOKKOS_VERSION_MAJOR = 3
KOKKOS_VERSION_MINOR = 1 KOKKOS_VERSION_MINOR = 1

View File

@ -51,7 +51,8 @@ struct DoCoul<1> {
//Specialisation for Neighborlist types Half, HalfThread, Full //Specialisation for Neighborlist types Half, HalfThread, Full
template <class PairStyle, int NEIGHFLAG, bool STACKPARAMS, class Specialisation = void> template <class PairStyle, int NEIGHFLAG, bool STACKPARAMS, class Specialisation = void>
struct PairComputeFunctor { class PairComputeFunctor {
public:
typedef typename PairStyle::device_type device_type ; typedef typename PairStyle::device_type device_type ;
typedef ArrayTypes<device_type> AT; typedef ArrayTypes<device_type> AT;

View File

@ -5183,11 +5183,13 @@ void _noopt PairBOP::read_table(char *filename)
if(rcut3[i]>rcutall) if(rcut3[i]>rcutall)
rcutall=rcut3[i]; rcutall=rcut3[i];
rcutsq[i]=rcut[i]*rcut[i]; rcutsq[i]=rcut[i]*rcut[i];
rcutsq3[i]=rcut3[i]*rcut3[i];
dr[i]=rcut[i]/((double)nr-1.0); dr[i]=rcut[i]/((double)nr-1.0);
rdr[i]=1.0/dr[i]; rdr[i]=1.0/dr[i];
dr3[i]=rcut3[i]/((double)nr-1.0); if (nws==3) {
rdr3[i]=1.0/dr3[i]; rcutsq3[i]=rcut3[i]*rcut3[i];
dr3[i]=rcut3[i]/((double)nr-1.0);
rdr3[i]=1.0/dr3[i];
}
} }
rctroot=rcutall; rctroot=rcutall;
dtheta=2.0/((double)ntheta-1.0); dtheta=2.0/((double)ntheta-1.0);
@ -5273,9 +5275,11 @@ void _noopt PairBOP::read_table(char *filename)
pRepul4[i][k]=pRepul1[i][k]/dr[i]; pRepul4[i][k]=pRepul1[i][k]/dr[i];
pRepul5[i][k]=2.0*pRepul2[i][k]/dr[i]; pRepul5[i][k]=2.0*pRepul2[i][k]/dr[i];
pRepul6[i][k]=3.0*pRepul3[i][k]/dr[i]; pRepul6[i][k]=3.0*pRepul3[i][k]/dr[i];
pLong4[i][k]=pLong1[i][k]/dr3[i]; if (nws==3) {
pLong5[i][k]=2.0*pLong2[i][k]/dr3[i]; pLong4[i][k]=pLong1[i][k]/dr3[i];
pLong6[i][k]=3.0*pLong3[i][k]/dr3[i]; pLong5[i][k]=2.0*pLong2[i][k]/dr3[i];
pLong6[i][k]=3.0*pLong3[i][k]/dr3[i];
}
} }
for(k=0;k<nBOt;k++) { for(k=0;k<nBOt;k++) {
FsigBO4[i][k]=FsigBO1[i][k]/dBO; FsigBO4[i][k]=FsigBO1[i][k]/dBO;

View File

@ -524,10 +524,14 @@ void PairTersoff::setup_params()
params[m].cut = params[m].bigr + params[m].bigd; params[m].cut = params[m].bigr + params[m].bigd;
params[m].cutsq = params[m].cut*params[m].cut; params[m].cutsq = params[m].cut*params[m].cut;
params[m].c1 = pow(2.0*params[m].powern*1.0e-16,-1.0/params[m].powern); if (params[m].powern > 0.0) {
params[m].c2 = pow(2.0*params[m].powern*1.0e-8,-1.0/params[m].powern); params[m].c1 = pow(2.0*params[m].powern*1.0e-16,-1.0/params[m].powern);
params[m].c3 = 1.0/params[m].c2; params[m].c2 = pow(2.0*params[m].powern*1.0e-8,-1.0/params[m].powern);
params[m].c4 = 1.0/params[m].c1; params[m].c3 = 1.0/params[m].c2;
params[m].c4 = 1.0/params[m].c1;
} else {
params[m].c1 = params[m].c2 = params[m].c3 = params[m].c4 = 0.0;
}
} }
// set cutmax to max of all params // set cutmax to max of all params

View File

@ -178,8 +178,10 @@ void PairTersoffMOD::setup_params()
params[m].cut = params[m].bigr + params[m].bigd; params[m].cut = params[m].bigr + params[m].bigd;
params[m].cutsq = params[m].cut*params[m].cut; params[m].cutsq = params[m].cut*params[m].cut;
params[m].ca1 = pow(2.0*params[m].powern_del*1.0e-16,-1.0/params[m].powern); if (params[m].powern > 0.0) {
params[m].ca4 = 1.0/params[m].ca1; params[m].ca1 = pow(2.0*params[m].powern_del*1.0e-16,-1.0/params[m].powern);
params[m].ca4 = 1.0/params[m].ca1;
} else params[m].ca1 = params[m].ca4 = 0.0;
} }
// set cutmax to max of all params // set cutmax to max of all params

View File

@ -137,7 +137,7 @@ void lammps_open(int argc, char **argv, MPI_Comm communicator, void **ptr)
*ptr = (void *) lmp; *ptr = (void *) lmp;
} }
catch(LAMMPSException & e) { catch(LAMMPSException & e) {
fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str()); fmt::print(stderr, "LAMMPS Exception: {}", e.message);
*ptr = (void *) NULL; *ptr = (void *) NULL;
} }
#else #else
@ -172,7 +172,7 @@ void lammps_open_no_mpi(int argc, char **argv, void **ptr)
*ptr = (void *) lmp; *ptr = (void *) lmp;
} }
catch(LAMMPSException & e) { catch(LAMMPSException & e) {
fprintf(stderr, "LAMMPS Exception: %s", e.message.c_str()); fmt::print(stderr, "LAMMPS Exception: {}", e.message);
*ptr = (void*) NULL; *ptr = (void*) NULL;
} }
#else #else

View File

@ -65,7 +65,7 @@ void PairCoulDSF::compute(int eflag, int vflag)
{ {
int i,j,ii,jj,inum,jnum; int i,j,ii,jj,inum,jnum;
double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,ecoul,fpair;
double r,rsq,r2inv,forcecoul,factor_coul; double r,rsq,forcecoul,factor_coul;
double prefactor,erfcc,erfcd,t; double prefactor,erfcc,erfcd,t;
int *ilist,*jlist,*numneigh,**firstneigh; int *ilist,*jlist,*numneigh,**firstneigh;

View File

@ -155,7 +155,7 @@ void utils::sfgets(const char *srcname, int srcline, char *s, int size,
errmsg += filename; errmsg += filename;
errmsg += "'"; errmsg += "'";
if (error) error->one(srcname,srcline,errmsg.c_str()); if (error) error->one(srcname,srcline,errmsg);
if (s) *s = '\0'; // truncate string to empty in case error is NULL if (s) *s = '\0'; // truncate string to empty in case error is NULL
} }
return; return;
@ -184,7 +184,7 @@ void utils::sfread(const char *srcname, int srcline, void *s, size_t size,
errmsg += filename; errmsg += filename;
errmsg += "'"; errmsg += "'";
if (error) error->one(srcname,srcline,errmsg.c_str()); if (error) error->one(srcname,srcline,errmsg);
} }
return; return;
} }
@ -238,9 +238,9 @@ double utils::numeric(const char *file, int line, const char *str,
msg += str; msg += str;
msg += "' in input script or data file"; msg += "' in input script or data file";
if (do_abort) if (do_abort)
lmp->error->one(file,line,msg.c_str()); lmp->error->one(file,line,msg);
else else
lmp->error->all(file,line,msg.c_str()); lmp->error->all(file,line,msg);
} }
return atof(str); return atof(str);
@ -273,9 +273,9 @@ int utils::inumeric(const char *file, int line, const char *str,
msg += str; msg += str;
msg += "' in input script or data file"; msg += "' in input script or data file";
if (do_abort) if (do_abort)
lmp->error->one(file,line,msg.c_str()); lmp->error->one(file,line,msg);
else else
lmp->error->all(file,line,msg.c_str()); lmp->error->all(file,line,msg);
} }
return atoi(str); return atoi(str);
@ -308,9 +308,9 @@ bigint utils::bnumeric(const char *file, int line, const char *str,
msg += str; msg += str;
msg += "' in input script or data file"; msg += "' in input script or data file";
if (do_abort) if (do_abort)
lmp->error->one(file,line,msg.c_str()); lmp->error->one(file,line,msg);
else else
lmp->error->all(file,line,msg.c_str()); lmp->error->all(file,line,msg);
} }
return ATOBIGINT(str); return ATOBIGINT(str);
@ -343,9 +343,9 @@ tagint utils::tnumeric(const char *file, int line, const char *str,
msg += str; msg += str;
msg += "' in input script or data file"; msg += "' in input script or data file";
if (do_abort) if (do_abort)
lmp->error->one(file,line,msg.c_str()); lmp->error->one(file,line,msg);
else else
lmp->error->all(file,line,msg.c_str()); lmp->error->all(file,line,msg);
} }
return ATOTAGINT(str); return ATOTAGINT(str);

View File

@ -123,7 +123,7 @@ void WriteData::command(int narg, char **arg)
if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost); if (domain->triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
} }
write(file.c_str()); write(file);
} }
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
@ -131,7 +131,7 @@ void WriteData::command(int narg, char **arg)
might later let it be directly called within run/minimize loop might later let it be directly called within run/minimize loop
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */
void WriteData::write(const char *file) void WriteData::write(const std::string &file)
{ {
// special case where reneighboring is not done in integrator // special case where reneighboring is not done in integrator
// on timestep data file is written (due to build_once being set) // on timestep data file is written (due to build_once being set)
@ -187,7 +187,7 @@ void WriteData::write(const char *file)
// open data file // open data file
if (me == 0) { if (me == 0) {
fp = fopen(file,"w"); fp = fopen(file.c_str(),"w");
if (fp == NULL) if (fp == NULL)
error->one(FLERR,fmt::format("Cannot open data file {}: {}", error->one(FLERR,fmt::format("Cannot open data file {}: {}",
file, utils::getsyserror())); file, utils::getsyserror()));

View File

@ -21,6 +21,7 @@ CommandStyle(write_data,WriteData)
#define LMP_WRITE_DATA_H #define LMP_WRITE_DATA_H
#include "pointers.h" #include "pointers.h"
#include <string>
namespace LAMMPS_NS { namespace LAMMPS_NS {
@ -28,7 +29,7 @@ class WriteData : protected Pointers {
public: public:
WriteData(class LAMMPS *); WriteData(class LAMMPS *);
void command(int, char **); void command(int, char **);
void write(const char *); void write(const std::string &);
private: private:
int me,nprocs; int me,nprocs;

View File

@ -293,9 +293,6 @@ void WriteRestart::write(std::string file)
std::string multiname = file; std::string multiname = file;
multiname.replace(multiname.find("%"),1,fmt::format("{}",icluster)); multiname.replace(multiname.find("%"),1,fmt::format("{}",icluster));
fp = fopen(multiname.c_str(),"wb");
if (fp == NULL)
error->one(FLERR,fmt::format("Cannot open restart file {}",multiname).c_str());
if (filewriter) { if (filewriter) {
fp = fopen(multiname.c_str(),"wb"); fp = fopen(multiname.c_str(),"wb");