forked from lijiext/lammps
must not forget to generate compute ids and store them.
This commit is contained in:
parent
1ea0eca2a5
commit
a5651acb49
|
@ -582,8 +582,12 @@ void ComputeChunkAtom::init()
|
||||||
// fixstore initializes all values to 0.0
|
// fixstore initializes all values to 0.0
|
||||||
|
|
||||||
if ((idsflag == ONCE || lockcount) && !fixstore) {
|
if ((idsflag == ONCE || lockcount) && !fixstore) {
|
||||||
modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 1",
|
std::string cmd = id + std::string("_COMPUTE_STORE");
|
||||||
id,group->names[igroup]));
|
id_fix = new char[cmd.size()+1];
|
||||||
|
strcpy(id_fix,cmd.c_str());
|
||||||
|
|
||||||
|
cmd += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
|
||||||
|
modify->add_fix(cmd);
|
||||||
fixstore = (FixStore *) modify->fix[modify->nfix-1];
|
fixstore = (FixStore *) modify->fix[modify->nfix-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,12 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new fix STORE style
|
// create a new fix STORE style
|
||||||
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
// id = compute-ID + COMPUTE_STORE, fix group = compute group
|
||||||
|
|
||||||
modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 3",
|
std::string cmd = id + std::string("_COMPUTE_STORE");
|
||||||
id,group->names[igroup]));
|
id_fix = new char[cmd.size()+1];
|
||||||
|
strcpy(id_fix,cmd.c_str());
|
||||||
|
|
||||||
|
cmd += fmt::format(" {} STORE peratom 1 3", group->names[igroup]);
|
||||||
|
modify->add_fix(cmd);
|
||||||
fix = (FixStore *) modify->fix[modify->nfix-1];
|
fix = (FixStore *) modify->fix[modify->nfix-1];
|
||||||
|
|
||||||
// calculate xu,yu,zu for fix store array
|
// calculate xu,yu,zu for fix store array
|
||||||
|
|
|
@ -55,17 +55,12 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
|
||||||
if (nevery <= 0 || delta <= 0.0)
|
if (nevery <= 0 || delta <= 0.0)
|
||||||
error->all(FLERR,"Illegal fix numdiff command");
|
error->all(FLERR,"Illegal fix numdiff command");
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string cmd = id + std::string("_pe");
|
||||||
id_pe = new char[n];
|
id_pe = new char[cmd.size()+1];
|
||||||
strcpy(id_pe,id);
|
strcpy(id_pe,cmd.c_str());
|
||||||
strcat(id_pe,"_pe");
|
|
||||||
|
|
||||||
char **newarg = new char*[3];
|
cmd += " all pe";
|
||||||
newarg[0] = id_pe;
|
modify->add_compute(cmd);
|
||||||
newarg[1] = (char *) "all";
|
|
||||||
newarg[2] = (char *) "pe";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
|
|
||||||
maxatom = 0;
|
maxatom = 0;
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "fix_press_berendsen.h"
|
#include "fix_press_berendsen.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <string>
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
@ -217,35 +218,24 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// compute group = all since pressure is always global (group all)
|
// compute group = all since pressure is always global (group all)
|
||||||
// and thus its KE/temperature contribution should use group all
|
// and thus its KE/temperature contribution should use group all
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string tcmd = id + std::string("_temp");
|
||||||
id_temp = new char[n];
|
id_temp = new char[tcmd.size()+1];
|
||||||
strcpy(id_temp,id);
|
strcpy(id_temp,tcmd.c_str());
|
||||||
strcat(id_temp,"_temp");
|
|
||||||
|
|
||||||
char **newarg = new char*[3];
|
tcmd += " all temp";
|
||||||
newarg[0] = id_temp;
|
modify->add_compute(tcmd);
|
||||||
newarg[1] = (char *) "all";
|
|
||||||
newarg[2] = (char *) "temp";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
|
|
||||||
// create a new compute pressure style
|
// create a new compute pressure style
|
||||||
// id = fix-ID + press, compute group = all
|
// id = fix-ID + press, compute group = all
|
||||||
// pass id_temp as 4th arg to pressure constructor
|
// pass id_temp as 4th arg to pressure constructor
|
||||||
|
|
||||||
n = strlen(id) + 7;
|
std::string pcmd = id + std::string("_press");
|
||||||
id_press = new char[n];
|
id_press = new char[pcmd.size()+1];
|
||||||
strcpy(id_press,id);
|
strcpy(id_press,pcmd.c_str());
|
||||||
strcat(id_press,"_press");
|
|
||||||
|
|
||||||
newarg = new char*[4];
|
pcmd += " all pressure " + std::string(id_temp);
|
||||||
newarg[0] = id_press;
|
modify->add_compute(pcmd);
|
||||||
newarg[1] = (char *) "all";
|
|
||||||
newarg[2] = (char *) "pressure";
|
|
||||||
newarg[3] = id_temp;
|
|
||||||
modify->add_compute(4,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
pflag = 1;
|
pflag = 1;
|
||||||
|
|
||||||
nrigid = 0;
|
nrigid = 0;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "fix_temp_berendsen.h"
|
#include "fix_temp_berendsen.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
|
@ -70,17 +71,12 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new compute temp style
|
// create a new compute temp style
|
||||||
// id = fix-ID + temp, compute group = fix group
|
// id = fix-ID + temp, compute group = fix group
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string cmd = id + std::string("_temp");
|
||||||
id_temp = new char[n];
|
id_temp = new char[cmd.size()+1];
|
||||||
strcpy(id_temp,id);
|
strcpy(id_temp,cmd.c_str());
|
||||||
strcat(id_temp,"_temp");
|
|
||||||
|
|
||||||
char **newarg = new char*[3];
|
cmd += group->names[igroup] + std::string(" temp");
|
||||||
newarg[0] = id_temp;
|
modify->add_compute(cmd);
|
||||||
newarg[1] = group->names[igroup];
|
|
||||||
newarg[2] = (char *) "temp";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
|
|
||||||
energy = 0;
|
energy = 0;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "fix_temp_csld.h"
|
#include "fix_temp_csld.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
|
@ -79,17 +80,12 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new compute temp style
|
// create a new compute temp style
|
||||||
// id = fix-ID + temp, compute group = fix group
|
// id = fix-ID + temp, compute group = fix group
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string cmd = id + std::string("_temp");
|
||||||
id_temp = new char[n];
|
id_temp = new char[cmd.size()+1];
|
||||||
strcpy(id_temp,id);
|
strcpy(id_temp,cmd.c_str());
|
||||||
strcat(id_temp,"_temp");
|
|
||||||
|
|
||||||
char **newarg = new char*[3];
|
cmd += group->names[igroup] + std::string(" temp");
|
||||||
newarg[0] = id_temp;
|
modify->add_compute(cmd);
|
||||||
newarg[1] = group->names[igroup];
|
|
||||||
newarg[2] = (char *) "temp";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
|
|
||||||
vhold = NULL;
|
vhold = NULL;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <mpi.h>
|
#include <mpi.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <string>
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
@ -156,17 +157,12 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new compute temp style
|
// create a new compute temp style
|
||||||
// id = fix-ID + temp, compute group = fix group
|
// id = fix-ID + temp, compute group = fix group
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string cmd = id + std::string("_temp");
|
||||||
id_temp = new char[n];
|
id_temp = new char[cmd.size()+1];
|
||||||
strcpy(id_temp,id);
|
strcpy(id_temp,cmd.c_str());
|
||||||
strcat(id_temp,"_temp");
|
|
||||||
|
|
||||||
char **newarg = new char*[3];
|
cmd += group->names[igroup] + std::string(" temp");
|
||||||
newarg[0] = id_temp;
|
modify->add_compute(cmd);
|
||||||
newarg[1] = group->names[igroup];
|
|
||||||
newarg[2] = (char *) "temp";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
|
|
||||||
nmax = -1;
|
nmax = -1;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "fix_temp_rescale.h"
|
#include "fix_temp_rescale.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "atom.h"
|
#include "atom.h"
|
||||||
#include "force.h"
|
#include "force.h"
|
||||||
|
@ -66,17 +67,12 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
|
||||||
// create a new compute temp
|
// create a new compute temp
|
||||||
// id = fix-ID + temp, compute group = fix group
|
// id = fix-ID + temp, compute group = fix group
|
||||||
|
|
||||||
int n = strlen(id) + 6;
|
std::string cmd = id + std::string("_temp");
|
||||||
id_temp = new char[n];
|
id_temp = new char[cmd.size()+1];
|
||||||
strcpy(id_temp,id);
|
strcpy(id_temp,cmd.c_str());
|
||||||
strcat(id_temp,"_temp");
|
|
||||||
|
|
||||||
char **newarg = new char*[6];
|
cmd += group->names[igroup] + std::string(" temp");
|
||||||
newarg[0] = id_temp;
|
modify->add_compute(cmd);
|
||||||
newarg[1] = group->names[igroup];
|
|
||||||
newarg[2] = (char *) "temp";
|
|
||||||
modify->add_compute(3,newarg);
|
|
||||||
delete [] newarg;
|
|
||||||
tflag = 1;
|
tflag = 1;
|
||||||
|
|
||||||
energy = 0.0;
|
energy = 0.0;
|
||||||
|
|
Loading…
Reference in New Issue