update temp and press compute creation in temperature and similar fixes
This commit is contained in:
@ -18,6 +18,7 @@
|
||||
#include "fix_box_relax.h"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "atom.h"
|
||||
#include "domain.h"
|
||||
#include "update.h"
|
||||
@ -28,6 +29,7 @@
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "math_extra.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -317,36 +319,24 @@ FixBoxRelax::FixBoxRelax(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
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp";
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += " all temp";
|
||||
modify->add_compute(tcmd);
|
||||
tflag = 1;
|
||||
|
||||
// create a new compute pressure style (virial only)
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
newarg = new char*[5];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
newarg[4] = (char *) "virial";
|
||||
modify->add_compute(5,newarg);
|
||||
delete [] newarg;
|
||||
pcmd += " all pressure " + std::string(id_temp) + " virial";
|
||||
modify->add_compute(pcmd);
|
||||
pflag = 1;
|
||||
|
||||
dimension = domain->dimension;
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include "fix_nph.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
@ -34,35 +35,23 @@ FixNPH::FixNPH(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
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += " all temp";
|
||||
modify->add_compute(tcmd);
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcmd += " all pressure " + std::string(id_temp);
|
||||
modify->add_compute(pcmd);
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include "fix_nph_sphere.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
@ -34,35 +35,23 @@ 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
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp/sphere";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += " all temp/sphere";
|
||||
modify->add_compute(tcmd);
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcmd += " all pressure " + std::string(id_temp);
|
||||
modify->add_compute(pcmd);
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include "fix_npt.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
@ -34,35 +35,23 @@ FixNPT::FixNPT(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
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += " all temp";
|
||||
modify->add_compute(tcmd);
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcmd += " all pressure " + std::string(id_temp);
|
||||
modify->add_compute(pcmd);
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
|
||||
#include "fix_npt_sphere.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
|
||||
@ -34,35 +35,23 @@ FixNPTSphere::FixNPTSphere(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
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "temp/sphere";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += " all temp/sphere";
|
||||
modify->add_compute(tcmd);
|
||||
tcomputeflag = 1;
|
||||
|
||||
// create a new compute pressure style
|
||||
// id = fix-ID + press, compute group = all
|
||||
// pass id_temp as 4th arg to pressure constructor
|
||||
|
||||
n = strlen(id) + 7;
|
||||
id_press = new char[n];
|
||||
strcpy(id_press,id);
|
||||
strcat(id_press,"_press");
|
||||
std::string pcmd = id + std::string("_press");
|
||||
id_press = new char[pcmd.size()+1];
|
||||
strcpy(id_press,pcmd.c_str());
|
||||
|
||||
newarg = new char*[4];
|
||||
newarg[0] = id_press;
|
||||
newarg[1] = (char *) "all";
|
||||
newarg[2] = (char *) "pressure";
|
||||
newarg[3] = id_temp;
|
||||
modify->add_compute(4,newarg);
|
||||
delete [] newarg;
|
||||
pcmd += " all pressure " + std::string(id_temp);
|
||||
modify->add_compute(pcmd);
|
||||
pcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -13,9 +13,11 @@
|
||||
|
||||
#include "fix_nvt.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include "group.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -33,17 +35,11 @@ FixNVT::FixNVT(LAMMPS *lmp, int narg, char **arg) :
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string tcmd = id + std::string("_temp");
|
||||
id_temp = new char[tcmd.size()+1];
|
||||
strcpy(id_temp,tcmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = group->names[igroup];
|
||||
newarg[2] = (char *) "temp";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
tcmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(tcmd);
|
||||
tcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "fix_deform.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -48,18 +49,12 @@ FixNVTSllod::FixNVTSllod(LAMMPS *lmp, int narg, char **arg) :
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = group->names[igroup];
|
||||
newarg[2] = (char *) "temp/deform";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
cmd += fmt::format(" {} temp/deform",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tcomputeflag = 1;
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include "group.h"
|
||||
#include "modify.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -33,17 +34,11 @@ FixNVTSphere::FixNVTSphere(LAMMPS *lmp, int narg, char **arg) :
|
||||
// create a new compute temp style
|
||||
// id = fix-ID + temp
|
||||
|
||||
int n = strlen(id) + 6;
|
||||
id_temp = new char[n];
|
||||
strcpy(id_temp,id);
|
||||
strcat(id_temp,"_temp");
|
||||
std::string cmd = id + std::string("_temp");
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
char **newarg = new char*[3];
|
||||
newarg[0] = id_temp;
|
||||
newarg[1] = group->names[igroup];
|
||||
newarg[2] = (char *) "temp/sphere";
|
||||
|
||||
modify->add_compute(3,newarg);
|
||||
delete [] newarg;
|
||||
cmd += fmt::format(" {} temp/sphere",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tcomputeflag = 1;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "modify.h"
|
||||
#include "compute.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -75,7 +76,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
cmd += group->names[igroup] + std::string(" temp");
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@
|
||||
#include "compute.h"
|
||||
#include "random_mars.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -84,7 +85,7 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
cmd += group->names[igroup] + std::string(" temp");
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "compute.h"
|
||||
#include "random_mars.h"
|
||||
#include "error.h"
|
||||
#include "fmt/format.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace FixConst;
|
||||
@ -161,7 +162,7 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||
id_temp = new char[cmd.size()+1];
|
||||
strcpy(id_temp,cmd.c_str());
|
||||
|
||||
cmd += group->names[igroup] + std::string(" temp");
|
||||
cmd += fmt::format(" {} temp",group->names[igroup]);
|
||||
modify->add_compute(cmd);
|
||||
tflag = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user