three more

This commit is contained in:
Axel Kohlmeyer
2025-01-09 21:23:56 -05:00
parent 5419fe0925
commit ac68f70e20
3 changed files with 11 additions and 22 deletions

View File

@ -271,7 +271,7 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
delete[] id_dilate; delete[] id_dilate;
id_dilate = utils::strdup(arg[iarg+1]); id_dilate = utils::strdup(arg[iarg+1]);
int idilate = group->find(id_dilate); int idilate = group->find(id_dilate);
if (idilate == -1) if (idilate < 0)
error->all(FLERR,"Fix {} dilate group ID {} does not exist", style, id_dilate); error->all(FLERR,"Fix {} dilate group ID {} does not exist", style, id_dilate);
} }
iarg += 2; iarg += 2;
@ -629,12 +629,8 @@ void FixNH::init()
{ {
// recheck that dilate group has not been deleted // recheck that dilate group has not been deleted
if (allremap == 0) { if (allremap == 0)
int idilate = group->find(id_dilate); dilate_group_bit = group->get_bitmask_by_id(FLERR, id_dilate, fmt::format("fix {}", style));
if (idilate == -1)
error->all(FLERR,"Fix {} dilate group ID {} does not exist", style, id_dilate);
dilate_group_bit = group->bitmask[idilate];
}
// ensure no conflict with fix deform // ensure no conflict with fix deform

View File

@ -41,7 +41,7 @@ enum{BOX,LATTICE,FRACTION};
FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) : FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg) Fix(lmp, narg, arg)
{ {
if (narg < 6) error->all(FLERR,"Illegal fix recenter command"); if (narg < 6) utils::missing_cmd_args(FLERR,"fix recenter", error);
xcom = ycom = zcom = 0.0; xcom = ycom = zcom = 0.0;
xflag = yflag = zflag = 1; xflag = yflag = zflag = 1;
@ -74,17 +74,15 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
int iarg = 6; int iarg = 6;
while (iarg < narg) { while (iarg < narg) {
if (strcmp(arg[iarg],"shift") == 0) { if (strcmp(arg[iarg],"shift") == 0) {
int igroup2 = group->find(arg[iarg+1]); group2bit = group->get_bitmask_by_id(FLERR, arg[iarg+1], "fix recenter");
if (igroup2 < 0) error->all(FLERR,"Could not find fix recenter group ID");
group2bit = group->bitmask[igroup2];
iarg += 2; iarg += 2;
} else if (strcmp(arg[iarg],"units") == 0) { } else if (strcmp(arg[iarg],"units") == 0) {
if (strcmp(arg[iarg+1],"box") == 0) scaleflag = BOX; if (strcmp(arg[iarg+1],"box") == 0) scaleflag = BOX;
else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = LATTICE; else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = LATTICE;
else if (strcmp(arg[iarg+1],"fraction") == 0) scaleflag = FRACTION; else if (strcmp(arg[iarg+1],"fraction") == 0) scaleflag = FRACTION;
else error->all(FLERR,"Illegal fix recenter command"); else error->all(FLERR,"Unknown fix recenter units argument {}", arg[iarg+1]);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal fix recenter command"); } else error->all(FLERR,"Unknown fix recenter keyword {}", arg[iarg]);
} }
// scale xcom,ycom,zcom // scale xcom,ycom,zcom
@ -103,8 +101,7 @@ FixRecenter::FixRecenter(LAMMPS *lmp, int narg, char **arg) :
// cannot have 0 atoms in group // cannot have 0 atoms in group
if (group->count(igroup) == 0) if (group->count(igroup) == 0) error->all(FLERR,"Fix recenter group {} has no atoms", arg[1]);
error->all(FLERR,"Fix recenter group has no atoms");
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */

View File

@ -73,11 +73,9 @@ FixSpring::FixSpring(LAMMPS *lmp, int narg, char **arg) :
group2 = utils::strdup(arg[4]); group2 = utils::strdup(arg[4]);
igroup2 = group->find(arg[4]); igroup2 = group->find(arg[4]);
if (igroup2 == -1)
error->all(FLERR,"Fix spring couple group ID does not exist");
if (igroup2 == igroup) if (igroup2 == igroup)
error->all(FLERR,"Two groups cannot be the same in fix spring couple"); error->all(FLERR,"The two groups cannot be the same in fix spring couple");
group2bit = group->bitmask[igroup2]; group2bit = group->get_bitmask_by_id(FLERR, arg[4], "fix spring");
k_spring = utils::numeric(FLERR,arg[5],false,lmp); k_spring = utils::numeric(FLERR,arg[5],false,lmp);
xflag = yflag = zflag = 1; xflag = yflag = zflag = 1;
@ -121,9 +119,7 @@ void FixSpring::init()
if (group2) { if (group2) {
igroup2 = group->find(group2); igroup2 = group->find(group2);
if (igroup2 == -1) group2bit = group->get_bitmask_by_id(FLERR, group2, "fix spring");
error->all(FLERR,"Fix spring couple group ID does not exist");
group2bit = group->bitmask[igroup2];
} }
masstotal = group->mass(igroup); masstotal = group->mass(igroup);