better align with LAMMPS' programming conventions

This commit is contained in:
Axel Kohlmeyer
2025-03-30 23:30:15 -04:00
parent 935e323d08
commit 6e395424bc
2 changed files with 11 additions and 11 deletions

View File

@ -191,7 +191,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
int iarg = 3;
stabilization_flag = 0;
molid_mode = Reset_mol_ids::Yes;
molid_mode = RESET_MOL_IDS::YES;
int num_common_keywords = 2;
for (int m = 0; m < num_common_keywords; m++) {
if (strcmp(arg[iarg],"stabilization") == 0) {
@ -209,9 +209,9 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
if (iarg+2 > narg) error->all(FLERR,"Illegal fix bond/react command: "
"'reset_mol_ids' keyword has too few arguments");
std::string str = arg[iarg+1];
if (str == "yes") molid_mode = Reset_mol_ids::Yes;
else if (str == "no") molid_mode = Reset_mol_ids::No;
else if (str == "molmap") molid_mode = Reset_mol_ids::Molmap;
if (str == "yes") molid_mode = RESET_MOL_IDS::YES;
else if (str == "no") molid_mode = RESET_MOL_IDS::NO;
else if (str == "molmap") molid_mode = RESET_MOL_IDS::MOLMAP;
else error->all(FLERR,"Unknown option for 'reset_mol_ids' keyword");
iarg += 2;
} else if (strcmp(arg[iarg],"react") == 0) {
@ -219,7 +219,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
} else error->all(FLERR,"Illegal fix bond/react command: unknown keyword");
}
if (molid_mode == Reset_mol_ids::Yes) {
if (molid_mode == RESET_MOL_IDS::YES) {
delete reset_mol_ids;
reset_mol_ids = new ResetAtomsMol(lmp);
reset_mol_ids->create_computes(id,group->names[igroup]);
@ -492,7 +492,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) :
}
}
if (molid_mode == Reset_mol_ids::Molmap) {
if (molid_mode == RESET_MOL_IDS::MOLMAP) {
for (int myrxn = 0; myrxn < nreacts; myrxn++) {
onemol = atom->molecules[unreacted_mol[myrxn]];
twomol = atom->molecules[reacted_mol[myrxn]];
@ -3152,7 +3152,7 @@ void FixBondReact::update_everything()
// find current max molecule ID and shift for each proc
tagint moloffset = 0;
if (molid_mode == Reset_mol_ids::Molmap) {
if (molid_mode == RESET_MOL_IDS::MOLMAP) {
tagint maxmol_all = 0;
for (int i = 0; i < atom->nlocal; i++) maxmol_all = MAX(maxmol_all, atom->molecule[i]);
MPI_Allreduce(MPI_IN_PLACE, &maxmol_all, 1, MPI_LMP_TAGINT, MPI_MAX, world);
@ -3175,7 +3175,7 @@ void FixBondReact::update_everything()
// assumes consistent molecule IDs in pre- and post-reaction template
// NOTE: all procs assumed to have same update_mega_glove for second pass
// NOTE: must be done before add atoms, because add_atoms deletes ghost info
if (molid_mode == Reset_mol_ids::Molmap) {
if (molid_mode == RESET_MOL_IDS::MOLMAP) {
for (int i = 0; i < update_num_mega; i++) {
rxnID = update_mega_glove[0][i];
onemol = atom->molecules[unreacted_mol[rxnID]];
@ -4506,7 +4506,7 @@ void FixBondReact::post_integrate_respa(int ilevel, int /*iloop*/)
void FixBondReact::post_force(int /*vflag*/)
{
if (molid_mode == Reset_mol_ids::Yes) reset_mol_ids->reset();
if (molid_mode == RESET_MOL_IDS::YES) reset_mol_ids->reset();
}
/* ---------------------------------------------------------------------- */

View File

@ -37,7 +37,7 @@ class FixBondReact : public Fix {
enum { MAXNAME = 256 }; // max character length of react-ID
enum { MAXCONIDS = 4 }; // max # of IDs used by any constraint
enum { MAXCONPAR = 5 }; // max # of constraint parameters
enum class Reset_mol_ids { Yes, No, Molmap }; // values for reset_mol_ids keyword
enum RESET_MOL_IDS { YES, NO, MOLMAP }; // values for reset_mol_ids keyword
FixBondReact(class LAMMPS *, int, char **);
~FixBondReact() override;
@ -67,7 +67,7 @@ class FixBondReact : public Fix {
int *max_rxn, *nlocalkeep, *nghostlykeep;
tagint lastcheck;
int stabilization_flag;
Reset_mol_ids molid_mode;
RESET_MOL_IDS molid_mode;
int custom_exclude_flag;
int **rate_limit;
int **store_rxn_count;