shift settings check from angleoffset to base LJ

This commit is contained in:
megmcca
2025-01-15 10:24:25 -07:00
parent 66ffb1c39e
commit 7fa1bf39f3
6 changed files with 11 additions and 42 deletions

View File

@ -46,23 +46,6 @@ PairHbondDreidingLJAngleoffset::PairHbondDreidingLJAngleoffset(LAMMPS *lmp)
: PairHbondDreidingLJ(lmp) {
angle_offset_flag = 1;
angle_offset_global = 0.0;
}
/* ----------------------------------------------------------------------
global settings
------------------------------------------------------------------------- */
void PairHbondDreidingLJAngleoffset::settings(int narg, char **arg)
{
if (narg != 5) error->all(FLERR,"Illegal pair_style command");
// use first four settings args in parent method to update other variables
PairHbondDreidingLJ::settings(4,arg);
angle_offset_global = (180.0 - utils::numeric(FLERR, arg[4], false, lmp)) * MY_PI/180.0;
}
/* ----------------------------------------------------------------------

View File

@ -28,11 +28,8 @@ class PairHbondDreidingLJAngleoffset : public PairHbondDreidingLJ {
public:
PairHbondDreidingLJAngleoffset(class LAMMPS *);
void settings(int, char **) override;
void coeff(int, char **) override;
protected:
double angle_offset_global;
};
} // namespace LAMMPS_NS

View File

@ -47,23 +47,6 @@ PairHbondDreidingMorseAngleoffset::PairHbondDreidingMorseAngleoffset(LAMMPS *lmp
angle_offset_global = 0.0;
}
/* ----------------------------------------------------------------------
global settings
------------------------------------------------------------------------- */
void PairHbondDreidingMorseAngleoffset::settings(int narg, char **arg)
{
if (narg != 5) error->all(FLERR,"Illegal pair_style command");
// use first four settings args in parent method to update other variables
PairHbondDreidingMorse::settings(4,arg);
angle_offset_global = (180.0 - utils::numeric(FLERR, arg[4], false, lmp)) * MY_PI/180.0;
}
// /* ----------------------------------------------------------------------
// set coeffs for one or more type pairs
// ------------------------------------------------------------------------- */

View File

@ -28,11 +28,8 @@ class PairHbondDreidingMorseAngleoffset : public PairHbondDreidingMorse {
public:
PairHbondDreidingMorseAngleoffset(class LAMMPS *);
void settings(int, char **) override;
void coeff(int, char **) override;
protected:
double angle_offset_global;
};
} // namespace LAMMPS_NS

View File

@ -57,6 +57,7 @@ PairHbondDreidingLJ::PairHbondDreidingLJ(LAMMPS *lmp) : Pair(lmp)
pvector = new double[2];
angle_offset_flag = 0;
angle_offset_global = 0.0;
}
/* ---------------------------------------------------------------------- */
@ -309,12 +310,19 @@ void PairHbondDreidingLJ::allocate()
void PairHbondDreidingLJ::settings(int narg, char **arg)
{
if (narg != 4) error->all(FLERR,"Illegal pair_style command");
// narg = 4 for standard form and narg = 5 if angleoffset variant (from EXTRA-MOLECULE)
if (narg != 4 && narg != 5) error->all(FLERR,"Illegal pair_style command");
ap_global = utils::inumeric(FLERR,arg[0],false,lmp);
cut_inner_global = utils::numeric(FLERR,arg[1],false,lmp);
cut_outer_global = utils::numeric(FLERR,arg[2],false,lmp);
cut_angle_global = utils::numeric(FLERR,arg[3],false,lmp) * MY_PI/180.0;
// update when using angleoffset variant
if (angle_offset_flag) {
angle_offset_global = (180.0 - utils::numeric(FLERR, arg[4], false, lmp)) * MY_PI/180.0;
}
}
/* ----------------------------------------------------------------------

View File

@ -40,6 +40,7 @@ class PairHbondDreidingLJ : public Pair {
double cut_inner_global, cut_outer_global, cut_angle_global;
int ap_global;
int angle_offset_flag; // 1 if angle offset variant used
double angle_offset_global; // updated if angle offset variant used
struct Param {
double epsilon, sigma;