simplify by using utils::strdup() and reorder includes
This commit is contained in:
@ -12,10 +12,11 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_nph_sphere.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
#include "modify.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -35,21 +36,15 @@ FixNPHSphere::FixNPHSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
// compute group = all since pressure is always global (group all)
|
||||
// and thus its KE/temperature contribution should use group all
|
||||
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
modify->add_compute(tcmd + " all temp/sphere");
|
||||
id_temp = utils::strdup(std::string(id) + "_temp");
|
||||
modify->add_compute(fmt::format("{} all temp/sphere",id_temp));
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
modify->add_compute(pcmd + " all pressure " + std::string(id_temp));
|
||||
id_press = utils::strdup(std::string(id) + "_press");
|
||||
modify->add_compute(fmt::format("{} all pressure {}",id_press, id_temp));
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user