must not forget to generate compute ids and store them.

This commit is contained in:
Axel Kohlmeyer 2020-06-26 15:42:37 -04:00
parent 1ea0eca2a5
commit a5651acb49
No known key found for this signature in database
GPG Key ID: D9B44E93BF0C375A
8 changed files with 52 additions and 75 deletions

View File

@ -582,8 +582,12 @@ void ComputeChunkAtom::init()
// fixstore initializes all values to 0.0
if ((idsflag == ONCE || lockcount) && !fixstore) {
modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 1",
id,group->names[igroup]));
std::string cmd = id + std::string("_COMPUTE_STORE");
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];
}

View File

@ -73,8 +73,12 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
// create a new fix STORE style
// id = compute-ID + COMPUTE_STORE, fix group = compute group
modify->add_fix(fmt::format("{}_COMPUTE_STORE {} STORE peratom 1 3",
id,group->names[igroup]));
std::string cmd = id + std::string("_COMPUTE_STORE");
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];
// calculate xu,yu,zu for fix store array

View File

@ -55,17 +55,12 @@ FixNumDiff::FixNumDiff(LAMMPS *lmp, int narg, char **arg) :
if (nevery <= 0 || delta <= 0.0)
error->all(FLERR,"Illegal fix numdiff command");
int n = strlen(id) + 6;
id_pe = new char[n];
strcpy(id_pe,id);
strcat(id_pe,"_pe");
std::string cmd = id + std::string("_pe");
id_pe = new char[cmd.size()+1];
strcpy(id_pe,cmd.c_str());
char **newarg = new char*[3];
newarg[0] = id_pe;
newarg[1] = (char *) "all";
newarg[2] = (char *) "pe";
modify->add_compute(3,newarg);
delete [] newarg;
cmd += " all pe";
modify->add_compute(cmd);
maxatom = 0;

View File

@ -14,6 +14,7 @@
#include "fix_press_berendsen.h"
#include <cstring>
#include <cmath>
#include <string>
#include "atom.h"
#include "force.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)
// 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
// 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);
pflag = 1;
nrigid = 0;

View File

@ -13,6 +13,7 @@
#include "fix_temp_berendsen.h"
#include <cstring>
#include <string>
#include <cmath>
#include "atom.h"
#include "force.h"
@ -70,17 +71,12 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) :
// create a new compute temp style
// id = fix-ID + temp, compute group = fix group
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";
modify->add_compute(3,newarg);
delete [] newarg;
cmd += group->names[igroup] + std::string(" temp");
modify->add_compute(cmd);
tflag = 1;
energy = 0;

View File

@ -17,6 +17,7 @@
#include "fix_temp_csld.h"
#include <cstring>
#include <string>
#include <cmath>
#include "atom.h"
#include "force.h"
@ -79,17 +80,12 @@ FixTempCSLD::FixTempCSLD(LAMMPS *lmp, int narg, char **arg) :
// create a new compute temp style
// id = fix-ID + temp, compute group = fix group
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";
modify->add_compute(3,newarg);
delete [] newarg;
cmd += group->names[igroup] + std::string(" temp");
modify->add_compute(cmd);
tflag = 1;
vhold = NULL;

View File

@ -20,6 +20,7 @@
#include <mpi.h>
#include <cstring>
#include <cmath>
#include <string>
#include "atom.h"
#include "force.h"
#include "comm.h"
@ -156,17 +157,12 @@ FixTempCSVR::FixTempCSVR(LAMMPS *lmp, int narg, char **arg) :
// create a new compute temp style
// id = fix-ID + temp, compute group = fix group
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";
modify->add_compute(3,newarg);
delete [] newarg;
cmd += group->names[igroup] + std::string(" temp");
modify->add_compute(cmd);
tflag = 1;
nmax = -1;

View File

@ -13,6 +13,7 @@
#include "fix_temp_rescale.h"
#include <cstring>
#include <string>
#include <cmath>
#include "atom.h"
#include "force.h"
@ -66,17 +67,12 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) :
// create a new compute temp
// id = fix-ID + temp, compute group = fix group
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*[6];
newarg[0] = id_temp;
newarg[1] = group->names[igroup];
newarg[2] = (char *) "temp";
modify->add_compute(3,newarg);
delete [] newarg;
cmd += group->names[igroup] + std::string(" temp");
modify->add_compute(cmd);
tflag = 1;
energy = 0.0;