forked from lijiext/lammps
simplify code, make use of fmtlib and utils
This commit is contained in:
parent
a9271b6d9a
commit
508798ab2b
|
@ -700,11 +700,9 @@ int FixATC::size_restart(int /* nlocal */) {
|
||||||
|
|
||||||
void FixATC::write_restart(FILE * /* fp */) {
|
void FixATC::write_restart(FILE * /* fp */) {
|
||||||
|
|
||||||
char ** args = new char*[2];
|
char *args[2];
|
||||||
args[0] = new char[50];
|
args[0] = utils::strdup("write_restart");
|
||||||
args[1] = new char[50];
|
args[1] = utils::strdup("sprintf(args[1],"ATC.restart");
|
||||||
sprintf(args[0],"write_restart");
|
|
||||||
sprintf(args[1],"ATC.restart");
|
|
||||||
|
|
||||||
// Then call all objects I own to write their data
|
// Then call all objects I own to write their data
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
|
@ -713,7 +711,6 @@ void FixATC::write_restart(FILE * /* fp */) {
|
||||||
|
|
||||||
delete[] args[0];
|
delete[] args[0];
|
||||||
delete[] args[1];
|
delete[] args[1];
|
||||||
delete [] args;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
@ -722,11 +719,9 @@ void FixATC::write_restart(FILE * /* fp */) {
|
||||||
|
|
||||||
void FixATC::restart(char * /* buf */) {
|
void FixATC::restart(char * /* buf */) {
|
||||||
|
|
||||||
char ** args = new char*[2];
|
char *args[2];
|
||||||
args[0] = new char[50];
|
args[0] = utils::strdup("read_restart");
|
||||||
args[1] = new char[50];
|
args[1] = utils::strdup("ATC.restart");
|
||||||
sprintf(args[0],"read_restart");
|
|
||||||
sprintf(args[1],"ATC.restart");
|
|
||||||
|
|
||||||
// Then call all objects I own to write their data
|
// Then call all objects I own to write their data
|
||||||
if (comm->me == 0) {
|
if (comm->me == 0) {
|
||||||
|
@ -735,7 +730,6 @@ void FixATC::restart(char * /* buf */) {
|
||||||
|
|
||||||
delete[] args[0];
|
delete[] args[0];
|
||||||
delete[] args[1];
|
delete[] args[1];
|
||||||
delete [] args;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
|
|
@ -95,16 +95,15 @@ Scafacos::~Scafacos()
|
||||||
void Scafacos::init()
|
void Scafacos::init()
|
||||||
{
|
{
|
||||||
// error checks
|
// error checks
|
||||||
if (screen && me == 0) fprintf(screen,
|
if (me == 0) {
|
||||||
"Setting up ScaFaCoS with solver %s ...\n",method);
|
utils::logmesg(lmp,"Setting up ScaFaCoS with solver {} ...\n",method);
|
||||||
if (logfile && me == 0) fprintf(logfile,
|
|
||||||
"Setting up ScaFaCoS with solver %s ...\n",method);
|
|
||||||
|
|
||||||
if ((strcmp(method,"p3m") == 0) && (me == 0))
|
if (strcmp(method,"p3m") == 0)
|
||||||
error->warning(FLERR,"Virial computation for P3M not available");
|
error->warning(FLERR,"Virial computation for P3M not available");
|
||||||
|
|
||||||
if ((strcmp(method,"ewald") == 0) && (me == 0))
|
if (strcmp(method,"ewald") == 0)
|
||||||
error->warning(FLERR,"Virial computation for Ewald not available");
|
error->warning(FLERR,"Virial computation for Ewald not available");
|
||||||
|
}
|
||||||
|
|
||||||
if (!atom->q_flag)
|
if (!atom->q_flag)
|
||||||
error->all(FLERR,"Kspace style requires atom attribute q");
|
error->all(FLERR,"Kspace style requires atom attribute q");
|
||||||
|
@ -119,8 +118,7 @@ void Scafacos::init()
|
||||||
error->all(FLERR,"Scafacos atom count exceeds 2B");
|
error->all(FLERR,"Scafacos atom count exceeds 2B");
|
||||||
|
|
||||||
if (atom->molecular != Atom::ATOMIC)
|
if (atom->molecular != Atom::ATOMIC)
|
||||||
error->all(FLERR,
|
error->all(FLERR, "Cannot use Scafacos with molecular charged systems yet");
|
||||||
"Cannot use Scafacos with molecular charged systems yet");
|
|
||||||
|
|
||||||
FCSResult result;
|
FCSResult result;
|
||||||
|
|
||||||
|
@ -358,15 +356,13 @@ int Scafacos::modify_param(int narg, char **arg)
|
||||||
// value1 = 0, 1
|
// value1 = 0, 1
|
||||||
// 0 -> homogenous system (default)
|
// 0 -> homogenous system (default)
|
||||||
// 1 -> inhomogenous system (more internal tuning is provided (sequential!))
|
// 1 -> inhomogenous system (more internal tuning is provided (sequential!))
|
||||||
if (strcmp(arg[1],"fmm_tuning") == 0)
|
if (strcmp(arg[1],"fmm_tuning") == 0) {
|
||||||
{
|
if (me == 0)
|
||||||
if (screen && me == 0) fprintf(screen,
|
utils::logmesg(lmp, "ScaFaCoS setting fmm inhomogen tuning ...\n");
|
||||||
"ScaFaCoS setting fmm inhomogen tuning ...\n");
|
|
||||||
if (logfile && me == 0) fprintf(logfile,
|
|
||||||
"ScaFaCoS setting fmm inhomogen tuning ...\n");
|
|
||||||
if (narg < 3) error->all(FLERR,
|
if (narg < 3) error->all(FLERR,
|
||||||
"Illegal kspace_modify command (fmm_tuning)");
|
"Illegal kspace_modify command (fmm_tuning)");
|
||||||
fmm_tuning_flag = atoi(arg[2]);
|
fmm_tuning_flag = utils::inumeric(FLERR, arg[2], false, tmp);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue