adapt all users of FixStore to use FixStoreGlobal or FixStorePeratom

This commit is contained in:
Axel Kohlmeyer
2022-08-04 11:33:14 -04:00
parent 63fc9fcc62
commit 6c32058728
35 changed files with 203 additions and 214 deletions

View File

@ -20,7 +20,7 @@
#include "domain.h"
#include "error.h"
#include "fft3d_wrap.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "math_const.h"
#include "math_special.h"
#include "memory.h"

View File

@ -18,7 +18,7 @@
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "neigh_list.h"
#include <cmath>

View File

@ -21,7 +21,7 @@
#include "error.h"
#include "fft3d_wrap.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "gridcomm.h"
#include "group.h"
@ -783,8 +783,8 @@ void PairAmoeba::init_style()
Fix *myfix;
if (first_flag) {
id_pole = utils::strdup("AMOEBA_pole");
myfix = modify->add_fix(fmt::format("{} {} STORE peratom 1 13",id_pole,group->names[0]));
fixpole = dynamic_cast<FixStore *>(myfix);
myfix = modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 13",id_pole,group->names[0]));
fixpole = dynamic_cast<FixStorePeratom *>(myfix);
}
// creation of per-atom storage
@ -795,14 +795,14 @@ void PairAmoeba::init_style()
if (first_flag && use_pred) {
id_udalt = utils::strdup("AMOEBA_udalt");
myfix = modify->add_fix(fmt::format("{} {} STORE peratom 1 {} 3",
myfix = modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 {} 3",
id_udalt, group->names[0], maxualt));
fixudalt = dynamic_cast<FixStore *>(myfix);
fixudalt = dynamic_cast<FixStorePeratom *>(myfix);
id_upalt = utils::strdup("AMOEBA_upalt");
myfix = modify->add_fix(fmt::format("{} {} STORE peratom 1 {} 3",
myfix = modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 {} 3",
id_upalt, group->names[0], maxualt));
fixupalt = dynamic_cast<FixStore *>(myfix);
fixupalt = dynamic_cast<FixStorePeratom *>(myfix);
}
// create pages for storing pairwise data:
@ -916,19 +916,22 @@ void PairAmoeba::init_style()
if (id_pole) {
myfix = modify->get_fix_by_id(id_pole);
if (!myfix) error->all(FLERR,"Could not find internal pair amoeba fix STORE id {}", id_pole);
fixpole = dynamic_cast<FixStore *>(myfix);
if (!myfix)
error->all(FLERR,"Could not find internal pair amoeba fix STORE/PERATOM id {}", id_pole);
fixpole = dynamic_cast<FixStorePeratom *>(myfix);
}
if (id_udalt) {
myfix = modify->get_fix_by_id(id_udalt);
if (!myfix) error->all(FLERR,"Could not find internal pair amoeba fix STORE id {}", id_udalt);
fixudalt = dynamic_cast<FixStore *>(myfix);
if (!myfix)
error->all(FLERR,"Could not find internal pair amoeba fix STORE/PERATOM id {}", id_udalt);
fixudalt = dynamic_cast<FixStorePeratom *>(myfix);
myfix = modify->get_fix_by_id(id_upalt);
if (!myfix) error->all(FLERR,"Could not find internal pair amoeba fix STORE id {}", id_upalt);
fixupalt = dynamic_cast<FixStore *>(myfix);
if (!myfix)
error->all(FLERR,"Could not find internal pair amoeba fix STORE/PERATOM id {}", id_upalt);
fixupalt = dynamic_cast<FixStorePeratom *>(myfix);
}
// assign hydrogen neighbors (redID) to each owned atom

View File

@ -157,9 +157,9 @@ class PairAmoeba : public Pair {
int *amgroup; // AMOEBA polarization group, 1 to Ngroup
char *id_pole, *id_udalt, *id_upalt;
class FixStore *fixpole; // stores pole = multipole components
class FixStore *fixudalt; // stores udalt = induced dipole history
class FixStore *fixupalt; // stores upalt = induced dipole history
class FixStorePeratom *fixpole; // stores pole = multipole components
class FixStorePeratom *fixudalt; // stores udalt = induced dipole history
class FixStorePeratom *fixupalt; // stores upalt = induced dipole history
// static per-type properties defined in force-field file

View File

@ -24,7 +24,7 @@
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "group.h"
#include "memory.h"
@ -69,11 +69,9 @@ ComputeTempCS::ComputeTempCS(LAMMPS *lmp, int narg, char **arg) :
// create a new fix STORE style
// id = compute-ID + COMPUTE_STORE, fix group = compute group
std::string fixcmd = id + std::string("_COMPUTE_STORE");
id_fix = utils::strdup(fixcmd);
fixcmd += fmt::format(" {} STORE peratom 0 1", group->names[igroup]);
fix = dynamic_cast<FixStore *>(modify->add_fix(fixcmd));
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
fix = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 0 1", id_fix, group->names[igroup])));
// set fix store values = 0 for now
// fill them in via setup() once Comm::borders() has been called
@ -108,8 +106,8 @@ ComputeTempCS::~ComputeTempCS()
if (modify->nfix) modify->delete_fix(id_fix);
delete [] id_fix;
delete [] vector;
delete[] id_fix;
delete[] vector;
memory->destroy(vint);
}

View File

@ -54,7 +54,7 @@ class ComputeTempCS : public Compute {
double **vint;
char *id_fix;
class FixStore *fix;
class FixStorePeratom *fix;
void dof_compute();
void vcm_pairs();

View File

@ -54,7 +54,7 @@ https://doi.org/10.1103/PhysRevE.92.043303
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "group.h"
#include "improper.h"
@ -90,8 +90,8 @@ ComputeHMA::ComputeHMA(LAMMPS *lmp, int narg, char **arg) :
// our new fix's group = same as compute group
id_fix = utils::strdup(std::string(id)+"_COMPUTE_STORE");
fix = dynamic_cast<FixStore *>(modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
id_fix, group->names[igroup])));
fix = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 3", id_fix, group->names[igroup])));
// calculate xu,yu,zu for fix store array
// skip if reset from restart file
@ -196,9 +196,8 @@ void ComputeHMA::setup()
// set fix which stores original atom coords
int ifix2 = modify->find_fix(id_fix);
if (ifix2 < 0) error->all(FLERR,"Could not find hma store fix ID");
fix = dynamic_cast<FixStore *>( modify->fix[ifix2]);
fix = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix));
if (!fix) error->all(FLERR,"Could not find hma per-atom store fix ID {}", id_fix);
}
/* ---------------------------------------------------------------------- */

View File

@ -43,7 +43,7 @@ class ComputeHMA : public Compute {
char *id_fix;
char *id_temp;
double finaltemp;
class FixStore *fix;
class FixStorePeratom *fix;
double boltz, nktv2p, inv_volume;
double deltaPcap;
double virial_compute(int);

View File

@ -19,7 +19,7 @@
#include "atom.h"
#include "domain.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "update.h"

View File

@ -24,7 +24,7 @@
#include "domain.h"
#include "error.h"
#include "fix_deform.h"
#include "fix_store.h"
#include "fix_store_global.h"
#include "force.h"
#include "group.h"
#include "irregular.h"
@ -59,7 +59,7 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) :
id_temp(nullptr), id_press(nullptr),
eta(nullptr), eta_dot(nullptr), eta_dotdot(nullptr),
eta_mass(nullptr), etap(nullptr), etap_dot(nullptr), etap_dotdot(nullptr),
etap_mass(nullptr), id_store(nullptr),init_store(nullptr)
etap_mass(nullptr), id_store(nullptr), init_store(nullptr)
{
if (narg < 4) error->all(FLERR,"Illegal fix npt/cauchy command");
@ -78,7 +78,6 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) :
initRUN = 0;
restartPK = 0;
restart_global = 1;
restart_stored = 0;
// default values
@ -275,7 +274,7 @@ FixNPTCauchy::FixNPTCauchy(LAMMPS *lmp, int narg, char **arg) :
if (strcmp(arg[iarg+1],"all") == 0) allremap = 1;
else {
allremap = 0;
delete [] id_dilate;
delete[] id_dilate;
id_dilate = utils::strdup(arg[iarg+1]);
int idilate = group->find(id_dilate);
if (idilate == -1)
@ -619,32 +618,32 @@ FixNPTCauchy::~FixNPTCauchy()
{
if (copymode) return;
delete [] id_dilate;
delete [] rfix;
delete[] id_dilate;
delete[] rfix;
delete [] id_store;
delete[] id_store;
delete irregular;
// delete temperature and pressure if fix created them
if (tcomputeflag) modify->delete_compute(id_temp);
delete [] id_temp;
delete[] id_temp;
if (tstat_flag) {
delete [] eta;
delete [] eta_dot;
delete [] eta_dotdot;
delete [] eta_mass;
delete[] eta;
delete[] eta_dot;
delete[] eta_dotdot;
delete[] eta_mass;
}
if (pstat_flag) {
if (pcomputeflag) modify->delete_compute(id_press);
delete [] id_press;
delete[] id_press;
if (mpchain) {
delete [] etap;
delete [] etap_dot;
delete [] etap_dotdot;
delete [] etap_mass;
delete[] etap;
delete[] etap_dot;
delete[] etap_dotdot;
delete[] etap_mass;
}
}
}
@ -762,7 +761,7 @@ void FixNPTCauchy::init()
// detect if any rigid fixes exist so rigid bodies move when box is remapped
// rfix[] = indices to each fix rigid
delete [] rfix;
delete[] rfix;
nrigid = 0;
rfix = nullptr;
@ -1430,7 +1429,7 @@ int FixNPTCauchy::modify_param(int narg, char **arg)
modify->delete_compute(id_temp);
tcomputeflag = 0;
}
delete [] id_temp;
delete[] id_temp;
id_temp = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]);
@ -1439,8 +1438,7 @@ int FixNPTCauchy::modify_param(int narg, char **arg)
temperature = modify->compute[icompute];
if (temperature->tempflag == 0)
error->all(FLERR,
"Fix_modify temperature ID does not compute temperature");
error->all(FLERR,"Fix_modify temperature ID does not compute temperature");
if (temperature->igroup != 0 && comm->me == 0)
error->warning(FLERR,"Temperature for fix modify is not for group all");
@ -1462,7 +1460,7 @@ int FixNPTCauchy::modify_param(int narg, char **arg)
modify->delete_compute(id_press);
pcomputeflag = 0;
}
delete [] id_press;
delete[] id_press;
id_press = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]);
@ -2451,22 +2449,19 @@ void FixNPTCauchy::CauchyStat_init()
utils::logmesg(lmp, mesg);
}
if (!id_store)
id_store = utils::strdup(std::string(id) + "_FIX_NH_STORE");
restart_stored = modify->find_fix(id_store);
if (!id_store) id_store = utils::strdup(std::string(id) + "_FIX_NH_STORE");
init_store = dynamic_cast<FixStoreGlobal *>(modify->get_fix_by_id(id_store));
if (restartPK==1 && restart_stored < 0)
error->all(FLERR,"Illegal npt/cauchy command. Continuation run"
if ((restartPK == 1) && !init_store)
error->all(FLERR,"Illegal fix npt/cauchy command. Continuation run"
" must follow a previously equilibrated npt/cauchy run");
if (alpha<=0.0)
error->all(FLERR,"Illegal fix npt/cauchy command: Alpha cannot be zero or negative.");
if (restart_stored < 0) {
modify->add_fix(std::string(id_store) + " all STORE global 1 6");
restart_stored = modify->find_fix(id_store);
}
init_store = dynamic_cast<FixStore *>(modify->fix[restart_stored]);
if (!init_store)
init_store = dynamic_cast<FixStoreGlobal *>(
modify->add_fix(std::string(id_store) + " all STORE global 1 6"));
initRUN = 0;
initPK = 1;

View File

@ -149,24 +149,23 @@ class FixNPTCauchy : public Fix {
void nh_omega_dot();
// Implementation of CauchyStat
char *id_store; // fix id of the STORE fix for retaining data
class FixStore *init_store; // fix pointer to STORE fix
double H0[3][3]; // shape matrix for the undeformed cell
double h_old[6]; // previous time step shape matrix for
// the undeformed cell
double invH0[3][3]; // inverse of H0;
double CSvol0; // volume of undeformed cell
double setPK[3][3]; // current set values of the PK stress
// (this is modified until the cauchy
// stress converges)
double alpha; // integration parameter for the cauchystat
int initPK; // 1 if setPK needs to be initialized either
// from cauchy or restart, else 0
int restartPK; // Read PK stress from the previous run
int restart_stored; // values of PK stress from the previous step stored
int initRUN; // 0 if run not initialized
// (pressure->vector not computed yet),
// else 1 (pressure->vector available)
char *id_store; // fix id of the STORE fix for retaining data
class FixStoreGlobal *init_store; // fix pointer to STORE fix
double H0[3][3]; // shape matrix for the undeformed cell
double h_old[6]; // previous time step shape matrix for
// the undeformed cell
double invH0[3][3]; // inverse of H0;
double CSvol0; // volume of undeformed cell
double setPK[3][3]; // current set values of the PK stress
// (this is modified until the cauchy
// stress converges)
double alpha; // integration parameter for the cauchystat
int initPK; // 1 if setPK needs to be initialized either
// from cauchy or restart, else 0
int restartPK; // Read PK stress from the previous run
int initRUN; // 0 if run not initialized
// (pressure->vector not computed yet),
// else 1 (pressure->vector available)
void CauchyStat_init();
void CauchyStat_cleanup();

View File

@ -20,7 +20,7 @@
#include "atom.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "group.h"
#include "input.h"
@ -210,9 +210,9 @@ void FixAdaptFEP::post_constructor()
id_fix_chg = nullptr;
if (diamflag) {
auto cmd = fmt::format("{}_FIX_STORE_DIAM {} STORE peratom 1 1", group->names[igroup]);
fix_diam = dynamic_cast<FixStore *>( modify->add_fix(cmd));
id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM"));
fix_diam = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1", id_fix_diam,group->names[igroup])));
if (fix_diam->restart_reset) fix_diam->restart_reset = 0;
else {
double *vec = fix_diam->vstore;
@ -228,9 +228,9 @@ void FixAdaptFEP::post_constructor()
}
if (chgflag) {
auto cmd = fmt::format("{}_FIX_STORE_CHG {} STORE peratom 1 1", group->names[igroup]);
fix_chg = dynamic_cast<FixStore *>( modify->add_fix(cmd));
id_fix_chg = utils::strdup(id + std::string("_FIX_STORE_CHG"));
fix_chg = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1",id_fix_chg,group->names[igroup])));
if (fix_chg->restart_reset) fix_chg->restart_reset = 0;
else {
double *vec = fix_chg->vstore;
@ -333,18 +333,16 @@ void FixAdaptFEP::init()
// fixes that store initial per-atom values
if (id_fix_diam) {
int ifix = modify->find_fix(id_fix_diam);
if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID");
fix_diam = dynamic_cast<FixStore *>( modify->fix[ifix]);
fix_diam = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix_diam));
if (!fix_diam) error->all(FLERR,"Could not find fix adapt/fep storage fix ID {}", id_fix_diam);
}
if (id_fix_chg) {
int ifix = modify->find_fix(id_fix_chg);
if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID");
fix_chg = dynamic_cast<FixStore *>( modify->fix[ifix]);
fix_chg = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix_chg));
if (!fix_chg) error->all(FLERR,"Could not find fix adapt/fep storage fix ID {}", id_fix_chg);
}
if (utils::strmatch(update->integrate_style,"^respa"))
nlevels_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels;
nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
}
/* ---------------------------------------------------------------------- */

View File

@ -46,7 +46,7 @@ class FixAdaptFEP : public Fix {
int anypair;
int nlevels_respa;
char *id_fix_diam, *id_fix_chg;
class FixStore *fix_diam, *fix_chg;
class FixStorePeratom *fix_diam, *fix_chg;
struct Adapt {
int which, ivar;

View File

@ -24,7 +24,7 @@
#include "error.h"
#include "finish.h"
#include "fix_event_tad.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "integrate.h"
#include "memory.h"
@ -54,9 +54,9 @@ TAD::TAD(LAMMPS *lmp) : Command(lmp)
TAD::~TAD()
{
memory->sfree(fix_event_list);
if (neb_logfilename != nullptr) delete [] neb_logfilename;
delete [] min_style;
delete [] min_style_neb;
if (neb_logfilename != nullptr) delete[] neb_logfilename;
delete[] min_style;
delete[] min_style_neb;
}
/* ----------------------------------------------------------------------
@ -131,11 +131,11 @@ void TAD::command(int narg, char **arg)
// create FixEventTAD object to store last event
fix_event = dynamic_cast<FixEventTAD *>( modify->add_fix("tad_event all EVENT/TAD"));
fix_event = dynamic_cast<FixEventTAD *>(modify->add_fix("tad_event all EVENT/TAD"));
// create FixStore object to store revert state
// create FixStorePeratom object to store revert state
fix_revert = dynamic_cast<FixStore *>( modify->add_fix("tad_revert all STORE peratom 0 7"));
fix_revert = dynamic_cast<FixStorePeratom *>(modify->add_fix("tad_revert all STORE/PERATOM 0 7"));
// create Finish for timing output
@ -388,7 +388,7 @@ void TAD::command(int narg, char **arg)
neighbor->dist_check = neigh_dist_check;
delete [] id_compute;
delete[] id_compute;
delete finish;
modify->delete_fix("tad_event");
modify->delete_fix("tad_revert");
@ -578,7 +578,7 @@ void TAD::options(int narg, char **arg)
} else if (strcmp(arg[iarg],"neb_style") == 0) {
if (iarg+2 > narg) error->all(FLERR,"Illegal tad command");
delete [] min_style_neb;
delete[] min_style_neb;
min_style_neb = utils::strdup(arg[iarg+1]);
iarg += 2;
@ -589,7 +589,7 @@ void TAD::options(int narg, char **arg)
iarg += 2;
} else if (strcmp(arg[iarg],"neb_log") == 0) {
delete [] neb_logfilename;
delete[] neb_logfilename;
if (iarg+2 > narg) error->all(FLERR,"Illegal tad command");
if (strcmp(arg[iarg+1],"none") == 0) neb_logfilename = nullptr;
else {

View File

@ -48,15 +48,15 @@ class TAD : public Command {
double time_dynamics, time_quench, time_neb, time_comm, time_output;
double time_start;
class NEB *neb; // NEB object
class Fix *fix_neb; // FixNEB object
class Compute *compute_event; // compute to detect event
class FixEventTAD *fix_event; // current event/state
class FixStore *fix_revert; // revert state
FixEventTAD **fix_event_list; // list of possible events
int n_event_list; // number of events
int nmax_event_list; // allocated events
int nmin_event_list; // minimum allocation
class NEB *neb; // NEB object
class Fix *fix_neb; // FixNEB object
class Compute *compute_event; // compute to detect event
class FixEventTAD *fix_event; // current event/state
class FixStorePeratom *fix_revert; // revert state
FixEventTAD **fix_event_list; // list of possible events
int n_event_list; // number of events
int nmax_event_list; // allocated events
int nmin_event_list; // minimum allocation
char *neb_logfilename; // filename for ulogfile_neb
FILE *uscreen_neb; // neb universe screen output

View File

@ -31,7 +31,7 @@
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "group.h"
#include "input.h"
@ -2357,16 +2357,16 @@ int DumpVTK::modify_param(int narg, char **arg)
thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp);
thresh_last[nthresh] = -1;
} else {
thresh_fix = (FixStore **)
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStore *),"dump:thresh_fix");
thresh_fix = (FixStorePeratom **)
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStorePeratom *),"dump:thresh_fix");
thresh_fixID = (char **)
memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),"dump:thresh_fixID");
memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first");
std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast);
thresh_fixID[nthreshlast] = utils::strdup(threshid);
threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
thresh_fix[nthreshlast] = (FixStore *) modify->add_fix(threshid);
threshid += fmt::format(" {} STORE/PERATOM 1 1", group->names[igroup]);
thresh_fix[nthreshlast] = dynamic_cast<FixStorePeratom *>(modify->add_fix(threshid));
thresh_last[nthreshlast] = nthreshlast;
thresh_first[nthreshlast] = 1;

View File

@ -26,7 +26,7 @@
#include "neighbor.h"
#include "comm.h"
#include "domain.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "imbalance.h"
#include "imbalance_group.h"
#include "imbalance_neigh.h"
@ -78,26 +78,26 @@ Balance::~Balance()
memory->destroy(proccost);
memory->destroy(allproccost);
delete [] user_xsplit;
delete [] user_ysplit;
delete [] user_zsplit;
delete[] user_xsplit;
delete[] user_ysplit;
delete[] user_zsplit;
if (shift_allocate) {
delete [] bdim;
delete [] onecost;
delete [] allcost;
delete [] sum;
delete [] target;
delete [] lo;
delete [] hi;
delete [] losum;
delete [] hisum;
delete[] bdim;
delete[] onecost;
delete[] allcost;
delete[] sum;
delete[] target;
delete[] lo;
delete[] hi;
delete[] losum;
delete[] hisum;
}
delete rcb;
for (int i = 0; i < nimbalance; i++) delete imbalances[i];
delete [] imbalances;
delete[] imbalances;
// check nfix in case all fixes have already been deleted
@ -143,7 +143,7 @@ void Balance::command(int narg, char **arg)
if (1 + procgrid[0]-1 > narg)
error->all(FLERR,"Illegal balance command");
xflag = USER;
delete [] user_xsplit;
delete[] user_xsplit;
user_xsplit = new double[procgrid[0]+1];
user_xsplit[0] = 0.0;
iarg++;
@ -163,7 +163,7 @@ void Balance::command(int narg, char **arg)
if (1 + procgrid[1]-1 > narg)
error->all(FLERR,"Illegal balance command");
yflag = USER;
delete [] user_ysplit;
delete[] user_ysplit;
user_ysplit = new double[procgrid[1]+1];
user_ysplit[0] = 0.0;
iarg++;
@ -183,7 +183,7 @@ void Balance::command(int narg, char **arg)
if (1 + procgrid[2]-1 > narg)
error->all(FLERR,"Illegal balance command");
zflag = USER;
delete [] user_zsplit;
delete[] user_zsplit;
user_zsplit = new double[procgrid[2]+1];
user_zsplit[0] = 0.0;
iarg++;
@ -496,8 +496,9 @@ void Balance::weight_storage(char *prefix)
if (prefix) cmd = prefix;
cmd += "IMBALANCE_WEIGHTS";
fixstore = dynamic_cast<FixStore *>( modify->get_fix_by_id(cmd));
if (!fixstore) fixstore = dynamic_cast<FixStore *>( modify->add_fix(cmd + " all STORE peratom 0 1"));
fixstore = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(cmd));
if (!fixstore)
fixstore = dynamic_cast<FixStorePeratom *>(modify->add_fix(cmd + " all STORE/PERATOM 0 1"));
// do not carry weights with atoms during normal atom migration

View File

@ -27,10 +27,10 @@ namespace LAMMPS_NS {
class Balance : public Command {
public:
class RCB *rcb;
class FixStore *fixstore; // per-atom weights stored in FixStore
int wtflag; // 1 if particle weighting is used
int varflag; // 1 if weight style var(iable) is used
int outflag; // 1 for output of balance results to file
class FixStorePeratom *fixstore; // per-atom weights stored in FixStorePeratom
int wtflag; // 1 if particle weighting is used
int varflag; // 1 if weight style var(iable) is used
int outflag; // 1 for output of balance results to file
Balance(class LAMMPS *);
~Balance() override;
@ -90,8 +90,6 @@ class Balance : public Command {
void debug_shift_output(int, int, int, double *);
#endif
};
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -21,7 +21,7 @@
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "input.h"
#include "lattice.h"
@ -571,8 +571,8 @@ void ComputeChunkAtom::init()
if ((idsflag == ONCE || lockcount) && !fixstore) {
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
fixstore = dynamic_cast<FixStore *>(
modify->add_fix(fmt::format("{} {} STORE peratom 1 1", id_fix, group->names[igroup])));
fixstore = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1", id_fix, group->names[igroup])));
}
if ((idsflag != ONCE && !lockcount) && fixstore) {

View File

@ -93,7 +93,7 @@ class ComputeChunkAtom : public Compute {
double *varatom;
char *id_fix;
class FixStore *fixstore;
class FixStorePeratom *fixstore;
class Fix *lockfix; // ptr to FixAveChunk that is locking out setups
// null pointer if no lock currently in place

View File

@ -17,7 +17,7 @@
#include "atom.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "input.h"
#include "memory.h"
@ -74,8 +74,8 @@ ComputeDisplaceAtom::ComputeDisplaceAtom(LAMMPS *lmp, int narg, char **arg) :
// id = compute-ID + COMPUTE_STORE, fix group = compute group
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
fix = dynamic_cast<FixStore *>( modify->add_fix(fmt::format("{} {} STORE peratom 1 3",
id_fix, group->names[igroup])));
fix = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 3", id_fix, group->names[igroup])));
// calculate xu,yu,zu for fix store array
// skip if reset from restart file
@ -120,7 +120,7 @@ void ComputeDisplaceAtom::init()
{
// set fix which stores original atom coords
fix = dynamic_cast<FixStore *>( modify->get_fix_by_id(id_fix));
fix = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix));
if (!fix) error->all(FLERR,"Could not find compute displace/atom fix with ID {}", id_fix);
if (refreshflag) {

View File

@ -38,7 +38,7 @@ class ComputeDisplaceAtom : public Compute {
int nmax;
double **displace;
char *id_fix;
class FixStore *fix;
class FixStorePeratom *fix;
int refreshflag, ivar, nvmax; // refresh option is enabled
char *rvar; // for incremental dumps

View File

@ -16,7 +16,7 @@
#include "atom.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "modify.h"
#include "update.h"
@ -27,7 +27,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, arg), id_fix(nullptr)
ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg)
: Compute(lmp, narg, arg), id_fix(nullptr)
{
if (narg < 3) error->all(FLERR, "Illegal compute msd command");
@ -63,8 +64,8 @@ ComputeMSD::ComputeMSD(LAMMPS *lmp, int narg, char **arg) : Compute(lmp, narg, a
// id = compute-ID + COMPUTE_STORE, fix group = compute group
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
fix = dynamic_cast<FixStore *>(
modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup])));
fix = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 3", id_fix, group->names[igroup])));
// calculate xu,yu,zu for fix store array
// skip if reset from restart file
@ -127,7 +128,7 @@ void ComputeMSD::init()
{
// set fix which stores reference atom coords
fix = dynamic_cast<FixStore *>(modify->get_fix_by_id(id_fix));
fix = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix));
if (!fix) error->all(FLERR, "Could not find compute msd fix with ID {}", id_fix);
// nmsd = # of atoms in group

View File

@ -39,7 +39,7 @@ class ComputeMSD : public Compute {
bigint nmsd;
double masstotal;
char *id_fix;
class FixStore *fix;
class FixStorePeratom *fix;
};
} // namespace LAMMPS_NS

View File

@ -18,7 +18,7 @@
#include "compute_chunk_atom.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_global.h"
#include "group.h"
#include "memory.h"
#include "modify.h"
@ -31,8 +31,8 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
idchunk(nullptr), id_fix(nullptr), massproc(nullptr), masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr)
Compute(lmp, narg, arg), idchunk(nullptr), id_fix(nullptr), massproc(nullptr),
masstotal(nullptr), com(nullptr), comall(nullptr), msd(nullptr)
{
if (narg != 4) error->all(FLERR,"Illegal compute msd/chunk command");
@ -57,8 +57,8 @@ ComputeMSDChunk::ComputeMSDChunk(LAMMPS *lmp, int narg, char **arg) :
// otherwise size reset and init will be done in setup()
id_fix = utils::strdup(std::string(id) + "_COMPUTE_STORE");
fix = dynamic_cast<FixStore *>( modify->add_fix(fmt::format("{} {} STORE global 1 1",
id_fix,group->names[igroup])));
fix = dynamic_cast<FixStoreGlobal *>(
modify->add_fix(fmt::format("{} {} STORE/GLOBAL 1 1", id_fix,group->names[igroup])));
}
/* ---------------------------------------------------------------------- */
@ -93,7 +93,7 @@ void ComputeMSDChunk::init()
// if firstflag, will be created in setup()
if (!firstflag) {
fix = dynamic_cast<FixStore *>( modify->get_fix_by_id(id_fix));
fix = dynamic_cast<FixStoreGlobal *>(modify->get_fix_by_id(id_fix));
if (!fix) error->all(FLERR,"Could not find compute msd/chunk fix with ID {}", id_fix);
}
}

View File

@ -45,7 +45,7 @@ class ComputeMSDChunk : public Compute {
char *idchunk;
class ComputeChunkAtom *cchunk;
char *id_fix;
class FixStore *fix;
class FixStoreGlobal *fix;
int firstflag;
double *massproc, *masstotal;
@ -54,8 +54,6 @@ class ComputeMSDChunk : public Compute {
void allocate();
};
} // namespace LAMMPS_NS
#endif
#endif

View File

@ -18,7 +18,7 @@
#include "update.h"
#include "group.h"
#include "modify.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "error.h"
using namespace LAMMPS_NS;
@ -26,8 +26,7 @@ using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
Compute(lmp, narg, arg),
id_fix(nullptr)
Compute(lmp, narg, arg), id_fix(nullptr)
{
if (narg < 3) error->all(FLERR,"Illegal compute vacf command");
@ -40,7 +39,8 @@ ComputeVACF::ComputeVACF(LAMMPS *lmp, int narg, char **arg) :
// id = compute-ID + COMPUTE_STORE, fix group = compute group
id_fix = utils::strdup(id + std::string("_COMPUTE_STORE"));
fix = dynamic_cast<FixStore *>( modify->add_fix(fmt::format("{} {} STORE peratom 1 3", id_fix, group->names[igroup])));
fix = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 3", id_fix, group->names[igroup])));
// store current velocities in fix store array
// skip if reset from restart file
@ -84,7 +84,7 @@ void ComputeVACF::init()
{
// set fix which stores original atom velocities
fix = dynamic_cast<FixStore *>( modify->get_fix_by_id(id_fix));
fix = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix));
if (!fix) error->all(FLERR,"Could not find compute vacf fix ID {}", id_fix);
// nvacf = # of atoms in group

View File

@ -35,7 +35,7 @@ class ComputeVACF : public Compute {
protected:
bigint nvacf;
char *id_fix;
class FixStore *fix;
class FixStorePeratom *fix;
};
} // namespace LAMMPS_NS

View File

@ -20,7 +20,7 @@
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "input.h"
#include "memory.h"
@ -2000,16 +2000,16 @@ int DumpCustom::modify_param(int narg, char **arg)
thresh_value[nthresh] = utils::numeric(FLERR,arg[3],false,lmp);
thresh_last[nthresh] = -1;
} else {
thresh_fix = (FixStore **)
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStore *),"dump:thresh_fix");
thresh_fix = (FixStorePeratom **)
memory->srealloc(thresh_fix,(nthreshlast+1)*sizeof(FixStorePeratom *),"dump:thresh_fix");
thresh_fixID = (char **)
memory->srealloc(thresh_fixID,(nthreshlast+1)*sizeof(char *),"dump:thresh_fixID");
memory->grow(thresh_first,(nthreshlast+1),"dump:thresh_first");
std::string threshid = fmt::format("{}{}_DUMP_STORE",id,nthreshlast);
thresh_fixID[nthreshlast] = utils::strdup(threshid);
threshid += fmt::format(" {} STORE peratom 1 1", group->names[igroup]);
thresh_fix[nthreshlast] = dynamic_cast<FixStore *>( modify->add_fix(threshid));
threshid += fmt::format(" {} STORE/PERATOM 1 1", group->names[igroup]);
thresh_fix[nthreshlast] = dynamic_cast<FixStorePeratom *>(modify->add_fix(threshid));
thresh_last[nthreshlast] = nthreshlast;
thresh_first[nthreshlast] = 1;

View File

@ -37,19 +37,19 @@ class DumpCustom : public Dump {
int nevery; // dump frequency for output
char *idregion; // region ID, nullptr if no region
int nthresh; // # of defined thresholds
int nthreshlast; // # of defined thresholds with value = LAST
//
int *thresh_array; // array to threshold on for each nthresh
int *thresh_op; // threshold operation for each nthresh
double *thresh_value; // threshold value for each nthresh
int *thresh_last; // for threshold value = LAST,
// index into thresh_fix
// -1 if not LAST, value is numeric
//
class FixStore **thresh_fix; // stores values for each threshold LAST
char **thresh_fixID; // IDs of thresh_fixes
int *thresh_first; // 1 the first time a FixStore values accessed
int nthresh; // # of defined thresholds
int nthreshlast; // # of defined thresholds with value = LAST
//
int *thresh_array; // array to threshold on for each nthresh
int *thresh_op; // threshold operation for each nthresh
double *thresh_value; // threshold value for each nthresh
int *thresh_last; // for threshold value = LAST,
// index into thresh_fix
// -1 if not LAST, value is numeric
//
class FixStorePeratom **thresh_fix; // stores values for each threshold LAST
char **thresh_fixID; // IDs of thresh_fixes
int *thresh_first; // 1 the first time a FixStore values accessed
int expand; // flag for whether field args were expanded
char **earg; // field names with wildcard expansion

View File

@ -19,7 +19,7 @@
#include "bond.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "group.h"
#include "input.h"
@ -278,8 +278,8 @@ void FixAdapt::post_constructor()
if (diamflag && atom->radius_flag) {
id_fix_diam = utils::strdup(id + std::string("_FIX_STORE_DIAM"));
fix_diam = dynamic_cast<FixStore *>( modify->add_fix(fmt::format("{} {} STORE peratom 1 1",
id_fix_diam,group->names[igroup])));
fix_diam = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1", id_fix_diam,group->names[igroup])));
if (fix_diam->restart_reset) fix_diam->restart_reset = 0;
else {
double *vec = fix_diam->vstore;
@ -296,8 +296,8 @@ void FixAdapt::post_constructor()
if (chgflag && atom->q_flag) {
id_fix_chg = utils::strdup(id + std::string("_FIX_STORE_CHG"));
fix_chg = dynamic_cast<FixStore *>( modify->add_fix(fmt::format("{} {} STORE peratom 1 1",
id_fix_chg,group->names[igroup])));
fix_chg = dynamic_cast<FixStorePeratom *>(
modify->add_fix(fmt::format("{} {} STORE/PERATOM 1 1",id_fix_chg,group->names[igroup])));
if (fix_chg->restart_reset) fix_chg->restart_reset = 0;
else {
double *vec = fix_chg->vstore;
@ -492,18 +492,16 @@ void FixAdapt::init()
// fixes that store initial per-atom values
if (id_fix_diam) {
int ifix = modify->find_fix(id_fix_diam);
if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID");
fix_diam = dynamic_cast<FixStore *>( modify->fix[ifix]);
fix_diam = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix_diam));
if (!fix_diam) error->all(FLERR,"Could not find fix adapt storage fix ID {}", id_fix_diam);
}
if (id_fix_chg) {
int ifix = modify->find_fix(id_fix_chg);
if (ifix < 0) error->all(FLERR,"Could not find fix adapt storage fix ID");
fix_chg = dynamic_cast<FixStore *>( modify->fix[ifix]);
fix_chg = dynamic_cast<FixStorePeratom *>(modify->get_fix_by_id(id_fix_chg));
if (!fix_chg) error->all(FLERR,"Could not find fix adapt storage fix ID {}", id_fix_chg);
}
if (utils::strmatch(update->integrate_style,"^respa"))
nlevels_respa = (dynamic_cast<Respa *>( update->integrate))->nlevels;
nlevels_respa = (dynamic_cast<Respa *>(update->integrate))->nlevels;
}
/* ---------------------------------------------------------------------- */

View File

@ -48,7 +48,7 @@ class FixAdapt : public Fix {
int anypair, anybond, anyangle;
int nlevels_respa;
char *id_fix_diam, *id_fix_chg;
class FixStore *fix_diam, *fix_chg;
class FixStorePeratom *fix_diam, *fix_chg;
double previous_diam_scale, previous_chg_scale;
int discflag;

View File

@ -19,7 +19,7 @@
#include "comm.h"
#include "domain.h"
#include "error.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "force.h"
#include "irregular.h"
#include "kspace.h"

View File

@ -20,7 +20,7 @@
#include "domain.h"
#include "error.h"
#include "fix.h"
#include "fix_store.h"
#include "fix_store_peratom.h"
#include "group.h"
#include "info.h"
#include "input.h"
@ -4911,7 +4911,8 @@ VarReader::VarReader(LAMMPS *lmp, char *name, char *file, int flag) :
error->all(FLERR,"Cannot use atomfile-style variable unless an atom map exists");
id_fix = utils::strdup(std::string(name) + "_VARIABLE_STORE");
fixstore = dynamic_cast<FixStore *>( modify->add_fix(std::string(id_fix) + " all STORE peratom 0 1"));
fixstore = dynamic_cast<FixStorePeratom *>(
modify->add_fix(std::string(id_fix) + " all STORE/PERATOM 0 1"));
buffer = new char[CHUNK*MAXLINE];
}
}

View File

@ -151,7 +151,7 @@ class Variable : protected Pointers {
class VarReader : protected Pointers {
public:
class FixStore *fixstore;
class FixStorePeratom *fixstore;
char *id_fix;
VarReader(class LAMMPS *, char *, char *, int);