simplify by using utils::strdup() fmt::format() and reorder includes
This commit is contained in:
@ -1525,9 +1525,7 @@ int FixBocs::modify_param(int narg, char **arg)
|
|||||||
tcomputeflag = 0;
|
tcomputeflag = 0;
|
||||||
}
|
}
|
||||||
delete [] id_temp;
|
delete [] id_temp;
|
||||||
int n = strlen(arg[1]) + 1;
|
id_temp = utils::strdup(arg[1]);
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[1]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(arg[1]);
|
int icompute = modify->find_compute(arg[1]);
|
||||||
if (icompute < 0)
|
if (icompute < 0)
|
||||||
@ -1559,9 +1557,7 @@ int FixBocs::modify_param(int narg, char **arg)
|
|||||||
pcomputeflag = 0;
|
pcomputeflag = 0;
|
||||||
}
|
}
|
||||||
delete [] id_press;
|
delete [] id_press;
|
||||||
int n = strlen(arg[1]) + 1;
|
id_press = utils::strdup(arg[1]);
|
||||||
id_press = new char[n];
|
|
||||||
strcpy(id_press,arg[1]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(arg[1]);
|
int icompute = modify->find_compute(arg[1]);
|
||||||
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID");
|
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID");
|
||||||
|
|||||||
@ -17,16 +17,15 @@
|
|||||||
|
|
||||||
#include "fix_eos_table_rx.h"
|
#include "fix_eos_table_rx.h"
|
||||||
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cmath>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
|
#include "comm.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "comm.h"
|
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#define MAXLINE 1024
|
#define MAXLINE 1024
|
||||||
|
|
||||||
|
|||||||
@ -13,28 +13,26 @@
|
|||||||
|
|
||||||
#include "fix_rx.h"
|
#include "fix_rx.h"
|
||||||
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cmath>
|
|
||||||
#include <cfloat> // DBL_EPSILON
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "error.h"
|
|
||||||
#include "group.h"
|
|
||||||
#include "modify.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "update.h"
|
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "neighbor.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "group.h"
|
||||||
|
#include "math_special.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "modify.h"
|
||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#include "math_special.h"
|
#include "neighbor.h"
|
||||||
#include "pair_dpd_fdt_energy.h"
|
#include "pair_dpd_fdt_energy.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
|
|
||||||
#include <vector> // std::vector<>
|
|
||||||
#include <algorithm> // std::max
|
#include <algorithm> // std::max
|
||||||
|
#include <cfloat> // DBL_EPSILON
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
#include <vector> // std::vector<>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
|
|||||||
@ -13,20 +13,19 @@
|
|||||||
|
|
||||||
#include "pair_exp6_rx.h"
|
#include "pair_exp6_rx.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cfloat>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "fix.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "neigh_list.h"
|
|
||||||
#include "math_special.h"
|
#include "math_special.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "fix.h"
|
#include "neigh_list.h"
|
||||||
|
|
||||||
|
#include <cfloat>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace MathSpecial;
|
using namespace MathSpecial;
|
||||||
|
|||||||
@ -21,21 +21,19 @@
|
|||||||
The Journal of Chemical Physics, 2016, 144, 104501.
|
The Journal of Chemical Physics, 2016, 144, 104501.
|
||||||
------------------------------------------------------------------------------------------- */
|
------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "pair_multi_lucy.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "citeme.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_const.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "math_const.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "pair_multi_lucy.h"
|
|
||||||
#include "atom.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "comm.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
#include "citeme.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|||||||
@ -21,23 +21,21 @@
|
|||||||
The Journal of Chemical Physics, 2016, 144, 104501.
|
The Journal of Chemical Physics, 2016, 144, 104501.
|
||||||
------------------------------------------------------------------------------------------- */
|
------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "pair_multi_lucy_rx.h"
|
||||||
|
|
||||||
|
#include "atom.h"
|
||||||
|
#include "citeme.h"
|
||||||
|
#include "comm.h"
|
||||||
|
#include "error.h"
|
||||||
|
#include "fix.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "math_const.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "neigh_list.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "math_const.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "pair_multi_lucy_rx.h"
|
|
||||||
#include "atom.h"
|
|
||||||
#include "force.h"
|
|
||||||
#include "comm.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
#include "citeme.h"
|
|
||||||
#include "modify.h"
|
|
||||||
#include "fix.h"
|
|
||||||
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|||||||
@ -165,9 +165,7 @@ int FixTempRescaleEff::modify_param(int narg, char **arg)
|
|||||||
tflag = 0;
|
tflag = 0;
|
||||||
}
|
}
|
||||||
delete [] id_temp;
|
delete [] id_temp;
|
||||||
int n = strlen(arg[1]) + 1;
|
id_temp = utils::strdup(arg[1]);
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[1]);
|
|
||||||
|
|
||||||
int icompute = modify->find_compute(id_temp);
|
int icompute = modify->find_compute(id_temp);
|
||||||
if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID");
|
if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID");
|
||||||
|
|||||||
@ -31,10 +31,8 @@
|
|||||||
|
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#include "fix_nve_manifold_rattle.h"
|
#include "fix_nve_manifold_rattle.h"
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
@ -44,18 +42,17 @@
|
|||||||
#include "citeme.h"
|
#include "citeme.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include "manifold_factory.h"
|
#include "manifold_factory.h"
|
||||||
#include "manifold.h"
|
#include "manifold.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
using namespace FixConst;
|
using namespace FixConst;
|
||||||
using namespace user_manifold;
|
using namespace user_manifold;
|
||||||
|
|
||||||
|
|
||||||
enum { CONST, EQUAL }; // For treating the variables.
|
enum { CONST, EQUAL }; // For treating the variables.
|
||||||
|
|
||||||
|
|
||||||
static const char* cite_fix_nve_manifold_rattle =
|
static const char* cite_fix_nve_manifold_rattle =
|
||||||
"fix nve/manifold/rattle command:\n\n"
|
"fix nve/manifold/rattle command:\n\n"
|
||||||
"@article{paquay-2016,\n"
|
"@article{paquay-2016,\n"
|
||||||
|
|||||||
@ -23,20 +23,18 @@
|
|||||||
|
|
||||||
#include "pair_mgpt.h"
|
#include "pair_mgpt.h"
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
#include "neighbor.h"
|
#include "error.h"
|
||||||
|
#include "force.h"
|
||||||
|
#include "memory.h"
|
||||||
#include "neigh_list.h"
|
#include "neigh_list.h"
|
||||||
#include "neigh_request.h"
|
#include "neigh_request.h"
|
||||||
#include "memory.h"
|
#include "neighbor.h"
|
||||||
#include "error.h"
|
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
|
|||||||
@ -15,17 +15,18 @@
|
|||||||
* Contributing author: Evangelos Voyiatzis (Royal DSM)
|
* Contributing author: Evangelos Voyiatzis (Royal DSM)
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#include "compute_gyration_shape.h"
|
#include "compute_gyration_shape.h"
|
||||||
#include <cmath>
|
|
||||||
#include <cstring>
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "math_extra.h"
|
|
||||||
#include "math_eigen.h"
|
#include "math_eigen.h"
|
||||||
|
#include "math_extra.h"
|
||||||
#include "math_special.h"
|
#include "math_special.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
@ -41,9 +42,7 @@ ComputeGyrationShape::ComputeGyrationShape(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
extvector = 0;
|
extvector = 0;
|
||||||
|
|
||||||
// ID of compute gyration
|
// ID of compute gyration
|
||||||
int n = strlen(arg[3]) + 1;
|
id_gyration = utils::strdup(arg[3]);
|
||||||
id_gyration = new char[n];
|
|
||||||
strcpy(id_gyration,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -15,17 +15,18 @@
|
|||||||
* Contributing author: Evangelos Voyiatzis (Royal DSM)
|
* Contributing author: Evangelos Voyiatzis (Royal DSM)
|
||||||
* ------------------------------------------------------------------------- */
|
* ------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
||||||
#include "compute_gyration_shape_chunk.h"
|
#include "compute_gyration_shape_chunk.h"
|
||||||
|
|
||||||
|
#include "error.h"
|
||||||
|
#include "math_eigen.h"
|
||||||
|
#include "math_extra.h"
|
||||||
|
#include "math_special.h"
|
||||||
|
#include "memory.h"
|
||||||
|
#include "modify.h"
|
||||||
|
#include "update.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "error.h"
|
|
||||||
#include "math_extra.h"
|
|
||||||
#include "math_eigen.h"
|
|
||||||
#include "math_special.h"
|
|
||||||
#include "modify.h"
|
|
||||||
#include "memory.h"
|
|
||||||
#include "update.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
@ -37,9 +38,7 @@ ComputeGyrationShapeChunk::ComputeGyrationShapeChunk(LAMMPS *lmp, int narg, char
|
|||||||
if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command");
|
if (narg != 4) error->all(FLERR,"Illegal compute gyration/shape/chunk command");
|
||||||
|
|
||||||
// ID of compute gyration
|
// ID of compute gyration
|
||||||
int n = strlen(arg[3]) + 1;
|
id_gyration_chunk = utils::strdup(arg[3]);
|
||||||
id_gyration_chunk = new char[n];
|
|
||||||
strcpy(id_gyration_chunk,arg[3]);
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
|||||||
@ -78,11 +78,7 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
if (narg < 4) error->all(FLERR,"Illegal compute hma command");
|
if (narg < 4) error->all(FLERR,"Illegal compute hma command");
|
||||||
if (igroup) error->all(FLERR,"Compute hma must use group all");
|
if (igroup) error->all(FLERR,"Compute hma must use group all");
|
||||||
if (strcmp(arg[3],"NULL") == 0) {error->all(FLERR,"fix ID specifying the set temperature of canonical simulation is required");}
|
if (strcmp(arg[3],"NULL") == 0) {error->all(FLERR,"fix ID specifying the set temperature of canonical simulation is required");}
|
||||||
else {
|
else id_temp = utils::strdup(arg[3]);
|
||||||
int n = strlen(arg[3]) + 1;
|
|
||||||
id_temp = new char[n];
|
|
||||||
strcpy(id_temp,arg[3]);
|
|
||||||
}
|
|
||||||
|
|
||||||
create_attribute = 1;
|
create_attribute = 1;
|
||||||
extscalar = 1;
|
extscalar = 1;
|
||||||
@ -92,23 +88,11 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
// our new fix's id (id_fix)= compute-ID + COMPUTE_STORE
|
// our new fix's id (id_fix)= compute-ID + COMPUTE_STORE
|
||||||
// our new fix's group = same as compute group
|
// our new fix's group = same as compute group
|
||||||
|
|
||||||
int n = strlen(id) + strlen("_COMPUTE_STORE") + 1;
|
id_fix = utils::strdup(std::string(id)+"_COMPUTE_STORE");
|
||||||
id_fix = new char[n];
|
modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
|
||||||
strcpy(id_fix,id);
|
id_fix, group->names[igroup]));
|
||||||
strcat(id_fix,"_COMPUTE_STORE");
|
|
||||||
|
|
||||||
char **newarg = new char*[6];
|
|
||||||
newarg[0] = id_fix;
|
|
||||||
newarg[1] = group->names[igroup];
|
|
||||||
newarg[2] = (char *) "STORE";
|
|
||||||
newarg[3] = (char *) "peratom";
|
|
||||||
newarg[4] = (char *) "1";
|
|
||||||
newarg[5] = (char *) "3";
|
|
||||||
modify->add_fix(6,newarg);
|
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
fix = (FixStore *) modify->fix[modify->nfix-1];
|
||||||
|
|
||||||
delete [] newarg;
|
|
||||||
|
|
||||||
// calculate xu,yu,zu for fix store array
|
// calculate xu,yu,zu for fix store array
|
||||||
// skip if reset from restart file
|
// skip if reset from restart file
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "compute_pressure_grem.h"
|
#include "compute_pressure_grem.h"
|
||||||
#include <cstring>
|
|
||||||
#include "update.h"
|
#include "update.h"
|
||||||
#include "domain.h"
|
#include "domain.h"
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
@ -21,6 +21,8 @@
|
|||||||
#include "kspace.h"
|
#include "kspace.h"
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
|
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
using namespace LAMMPS_NS;
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -30,9 +32,7 @@ using namespace LAMMPS_NS;
|
|||||||
ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) :
|
ComputePressureGrem::ComputePressureGrem(LAMMPS *lmp, int narg, char **arg) :
|
||||||
ComputePressure(lmp, narg-1, arg)
|
ComputePressure(lmp, narg-1, arg)
|
||||||
{
|
{
|
||||||
int len = strlen(arg[narg-1])+1;
|
fix_grem = utils::strdup(arg[narg-1]);
|
||||||
fix_grem = new char[len];
|
|
||||||
strcpy(fix_grem,arg[narg-1]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|||||||
Reference in New Issue
Block a user