simplify by using utils::strdup() and reorder includes

This commit is contained in:
Axel Kohlmeyer
2021-03-28 17:02:49 -04:00
parent 31726f56e6
commit b32570c15e
70 changed files with 447 additions and 1009 deletions

View File

@ -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;
}