simplify by using utils::strdup() and reorder includes
This commit is contained in:
@ -12,12 +12,10 @@
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "fix_nvt_sphere.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "error.h"
|
||||
#include "group.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -35,11 +33,8 @@ FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
cmd += fmt::format(" {} temp/sphere",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
id_temp = utils::strdup(std::string(id) + "_temp");
|
||||
modify->add_compute(fmt::format("{} {} temp/sphere",
|
||||
id_temp,group->names[igroup]));
|
||||
tcomputeflag = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user