remove sphere_flag and replace with radius_flag and omega_flag as needed

This commit is contained in:
Axel Kohlmeyer
2024-01-19 12:50:31 -05:00
parent 54794a45de
commit 0d8f549e33
37 changed files with 80 additions and 72 deletions

View File

@ -35,7 +35,6 @@ AtomVecBPMSphere::AtomVecBPMSphere(LAMMPS *_lmp) : AtomVec(_lmp)
radvary = 0;
atom->molecule_flag = 1;
atom->sphere_flag = 1;
atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = atom->quat_flag = 1;
// strings with peratom variables to include in each AtomVec method

View File

@ -645,7 +645,7 @@ void BondBPMRotational::init_style()
{
BondBPM::init_style();
if (!atom->quat_flag || !atom->sphere_flag)
if (!atom->quat_flag || !atom->radius_flag || !atom->omega_flag)
error->all(FLERR, "Bond bpm/rotational requires atom style bpm/sphere");
if (comm->ghost_velocity == 0)
error->all(FLERR, "Bond bpm/rotational requires ghost atoms store velocity");

View File

@ -52,7 +52,7 @@ FixNVEBPMSphere::FixNVEBPMSphere(LAMMPS *_lmp, int narg, char **arg) : FixNVE(_l
// error checks
if (!atom->quat_flag || !atom->sphere_flag)
if (!atom->quat_flag || !atom->radius_flag || !atom->omega_flag)
error->all(FLERR, "Fix nve/bpm/sphere requires atom style bpm/sphere");
}

View File

@ -41,7 +41,6 @@ FixBrownianSphere::FixBrownianSphere(LAMMPS *lmp, int narg, char **arg) :
if (!gamma_t_flag || !gamma_r_flag) { error->all(FLERR, "Illegal fix brownian command."); }
if (!atom->mu_flag) error->all(FLERR, "Fix brownian/sphere requires atom attribute mu");
if (!atom->sphere_flag) error->all(FLERR, "Fix brownian/sphere requires atom style sphere");
}
/* ---------------------------------------------------------------------- */

View File

@ -34,7 +34,7 @@ FixWallColloid::FixWallColloid(LAMMPS *lmp, int narg, char **arg) : FixWall(lmp,
void FixWallColloid::init()
{
if (!atom->sphere_flag) error->all(FLERR, "Fix wall/colloid requires atom style sphere");
if (!atom->radius_flag) error->all(FLERR, "Fix wall/colloid requires atom attribute radius");
// ensure all particles in group are extended particles

View File

@ -439,7 +439,7 @@ void PairBrownian::coeff(int narg, char **arg)
void PairBrownian::init_style()
{
if (!atom->sphere_flag) error->all(FLERR, "Pair brownian requires atom style sphere");
if (!atom->radius_flag) error->all(FLERR, "Pair brownian requires atom attribute radius");
// if newton off, forces between atoms ij will be double computed
// using different random numbers

View File

@ -322,8 +322,8 @@ void PairBrownianPoly::init_style()
{
if (force->newton_pair == 1)
error->all(FLERR,"Pair brownian/poly requires newton pair off");
if (!atom->sphere_flag)
error->all(FLERR,"Pair brownian/poly requires atom style sphere");
if (!atom->radius_flag)
error->all(FLERR,"Pair brownian/poly requires atom attribute radius");
// ensure all particles are finite-size
// for pair hybrid, should limit test to types using the pair style

View File

@ -531,8 +531,10 @@ void PairLubricate::coeff(int narg, char **arg)
void PairLubricate::init_style()
{
if (!atom->sphere_flag)
error->all(FLERR,"Pair lubricate requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Pair lubricate requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR,"Pair lubricate requires atom attribute radius");
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair lubricate requires ghost atoms store velocity");

View File

@ -1764,8 +1764,10 @@ void PairLubricateU::coeff(int narg, char **arg)
void PairLubricateU::init_style()
{
if (!atom->sphere_flag)
error->all(FLERR,"Pair lubricateU requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Pair lubricateU requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR,"Pair lubricateU requires atom attribute radius");
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair lubricateU requires ghost atoms store velocity");

View File

@ -1126,12 +1126,13 @@ void PairLubricateUPoly::settings(int narg, char **arg)
void PairLubricateUPoly::init_style()
{
if (force->newton_pair == 1)
error->all(FLERR,"Pair lubricateU/poly requires newton pair off");
error->all(FLERR, "Pair lubricateU/poly requires newton pair off");
if (comm->ghost_velocity == 0)
error->all(FLERR,
"Pair lubricateU/poly requires ghost atoms store velocity");
if (!atom->sphere_flag)
error->all(FLERR,"Pair lubricate/poly requires atom style sphere");
error->all(FLERR, "Pair lubricateU/poly requires ghost atoms store velocity");
if (!atom->omega_flag)
error->all(FLERR, "Pair lubricateU/poly requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR, "Pair lubricateU/poly requires atom attribute radius");
// ensure all particles are finite-size
// for pair hybrid, should limit test to types using the pair style
@ -1141,7 +1142,7 @@ void PairLubricateUPoly::init_style()
for (int i = 0; i < nlocal; i++)
if (radius[i] == 0.0)
error->one(FLERR,"Pair lubricate/poly requires extended particles");
error->one(FLERR,"Pair lubricateU/poly requires extended particles");
// Set the isotropic constants depending on the volume fraction

View File

@ -428,12 +428,13 @@ void PairLubricatePoly::compute(int eflag, int vflag)
void PairLubricatePoly::init_style()
{
if (force->newton_pair == 1)
error->all(FLERR,"Pair lubricate/poly requires newton pair off");
error->all(FLERR, "Pair lubricate/poly requires newton pair off");
if (comm->ghost_velocity == 0)
error->all(FLERR,
"Pair lubricate/poly requires ghost atoms store velocity");
if (!atom->sphere_flag)
error->all(FLERR,"Pair lubricate/poly requires atom style sphere");
error->all(FLERR, "Pair lubricate/poly requires ghost atoms store velocity");
if (!atom->omega_flag)
error->all(FLERR, "Pair lubricate/poly requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR, "Pair lubricate/poly requires atom attribute radius");
// ensure all particles are finite-size
// for pair hybrid, should limit test to types using the pair style
@ -443,7 +444,7 @@ void PairLubricatePoly::init_style()
for (int i = 0; i < nlocal; i++)
if (radius[i] == 0.0)
error->one(FLERR,"Pair lubricate/poly requires extended particles");
error->one(FLERR,"Pair lubricate/poly requires only extended particles");
neighbor->add_request(this, NeighConst::REQ_FULL);

View File

@ -121,8 +121,8 @@ void PairYukawaColloid::compute(int eflag, int vflag)
void PairYukawaColloid::init_style()
{
if (!atom->sphere_flag)
error->all(FLERR,"Pair yukawa/colloid requires atom style sphere");
if (!atom->radius_flag)
error->all(FLERR,"Pair yukawa/colloid requires atom attribute radius");
neighbor->add_request(this);

View File

@ -38,7 +38,7 @@ FixViscousSphere::FixViscousSphere(LAMMPS *_lmp, int narg, char **arg) :
{
dynamic_group_allow = 1;
if (!atom->sphere_flag) error->all(FLERR, "Fix viscous/sphere requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR, "Fix viscous/sphere requires atom attribute omega");
if (narg < 4) error->all(FLERR, "Illegal fix viscous/sphere command");

View File

@ -123,7 +123,7 @@ void PairYukawaColloidGPU::compute(int eflag, int vflag)
void PairYukawaColloidGPU::init_style()
{
if (!atom->sphere_flag) error->all(FLERR, "Pair yukawa/colloid/gpu requires atom style sphere");
if (!atom->radius_flag) error->all(FLERR, "Pair style yukawa/colloid/gpu requires atom attribute radius");
// Repeat cutsq calculation because done after call to init_style
double maxcut = -1.0;

View File

@ -51,7 +51,7 @@ ComputeContactAtom::ComputeContactAtom(LAMMPS *lmp, int narg, char **arg) :
// error checks
if (!atom->sphere_flag) error->all(FLERR, "Compute contact/atom requires atom style sphere");
if (!atom->radius_flag) error->all(FLERR, "Compute contact/atom requires atom attribute radius");
}
/* ---------------------------------------------------------------------- */

View File

@ -40,7 +40,7 @@ FixDampingCundall::FixDampingCundall(LAMMPS *_lmp, int narg, char **arg) :
{
dynamic_group_allow = 1;
if (!atom->sphere_flag) error->all(FLERR, "Fix damping/cundall requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR, "Fix damping/cundall requires atom attribute omega");
if (narg < 5) error->all(FLERR, "Illegal fix damping/cundall command");

View File

@ -57,8 +57,8 @@ FixWallGran::FixWallGran(LAMMPS *lmp, int narg, char **arg) :
{
if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command");
if (!atom->sphere_flag)
error->all(FLERR,"Fix wall/gran requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR,"Fix wall/gran requires atom attribute omega");
if (!atom->radius_flag) error->all(FLERR,"Fix wall/gran requires atom attribute radius");
create_attribute = 1;

View File

@ -435,10 +435,10 @@ void PairGranHookeHistory::init_style()
// error and warning checks
if (!atom->radius_flag || !atom->rmass_flag)
error->all(FLERR, "Pair granular requires atom attributes radius, rmass");
if (!atom->radius_flag || !atom->rmass_flag || !atom->omega_flag)
error->all(FLERR, "Pair gran/h* requires atom attributes radius, rmass, omega");
if (comm->ghost_velocity == 0)
error->all(FLERR, "Pair granular requires ghost atoms store velocity");
error->all(FLERR, "Pair gran/h* requires ghost atoms store velocity");
// need a granular neighbor list

View File

@ -401,8 +401,8 @@ void PairGranular::init_style()
{
// error and warning checks
if (!atom->radius_flag || !atom->rmass_flag)
error->all(FLERR,"Pair granular requires atom attributes radius, rmass");
if (!atom->radius_flag || !atom->rmass_flag || !atom->omega_flag)
error->all(FLERR,"Pair granular requires atom attributes radius, rmass, omega");
if (comm->ghost_velocity == 0)
error->all(FLERR,"Pair granular requires ghost atoms store velocity");

View File

@ -68,8 +68,8 @@ FixWallGranOld::FixWallGranOld(LAMMPS *lmp, int narg, char **arg) :
{
if (narg < 4) error->all(FLERR,"Illegal fix wall/gran command");
if (!atom->sphere_flag)
error->all(FLERR,"Fix wall/gran requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR,"Fix {} requires atom attribute omega", style);
if (!atom->radius_flag) error->all(FLERR,"Fix {} requires atom attribute radius", style);
create_attribute = 1;
limit_damping = 0;

View File

@ -37,8 +37,8 @@ typedef struct { double x,y,z; } dbl3_t;
FixNHSphereOMP::FixNHSphereOMP(LAMMPS *lmp, int narg, char **arg) :
FixNHOMP(lmp, narg, arg)
{
if (!atom->sphere_flag)
error->all(FLERR,"Fix nvt/nph/npt sphere requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR,"Fix {} requires atom attribute omega", style);
if (!atom->radius_flag) error->all(FLERR,"Fix {} requires atom attribute radius", style);
}
/* ---------------------------------------------------------------------- */

View File

@ -619,7 +619,7 @@ void Atom::set_atomflag_defaults()
// identical list as 2nd customization in atom.h
labelmapflag = 0;
sphere_flag = ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
ellipsoid_flag = line_flag = tri_flag = body_flag = 0;
quat_flag = 0;
peri_flag = electron_flag = 0;
wavepacket_flag = sph_flag = 0;

View File

@ -180,7 +180,7 @@ class Atom : protected Pointers {
// 1 if variable is used, 0 if not
int labelmapflag, types_style;
int sphere_flag, ellipsoid_flag, line_flag, tri_flag, body_flag;
int ellipsoid_flag, line_flag, tri_flag, body_flag;
int peri_flag, electron_flag;
int wavepacket_flag, sph_flag;

View File

@ -44,7 +44,6 @@ AtomVecLine::AtomVecLine(LAMMPS *lmp) : AtomVec(lmp)
atom->line_flag = 1;
atom->molecule_flag = atom->rmass_flag = 1;
atom->radius_flag = atom->omega_flag = atom->torque_flag = 1;
atom->sphere_flag = 1;
nlocal_bonus = nghost_bonus = nmax_bonus = 0;
bonus = nullptr;

View File

@ -32,7 +32,6 @@ AtomVecSphere::AtomVecSphere(LAMMPS *lmp) : AtomVec(lmp)
molecular = Atom::ATOMIC;
radvary = 0;
atom->sphere_flag = 1;
atom->radius_flag = atom->rmass_flag = atom->omega_flag = atom->torque_flag = 1;
// strings with peratom variables to include in each AtomVec method

View File

@ -47,7 +47,6 @@ AtomVecTri::AtomVecTri(LAMMPS *lmp) : AtomVec(lmp)
atom->molecule_flag = atom->rmass_flag = 1;
atom->radius_flag = atom->omega_flag = atom->angmom_flag = 1;
atom->torque_flag = 1;
atom->sphere_flag = 1;
nlocal_bonus = nghost_bonus = nmax_bonus = 0;
bonus = nullptr;

View File

@ -34,7 +34,7 @@ ComputeERotateSphere::ComputeERotateSphere(LAMMPS *lmp, int narg, char **arg) :
// error check
if (!atom->sphere_flag) error->all(FLERR, "Compute erotate/sphere requires atom style sphere");
if (!atom->omega_flag) error->all(FLERR, "Compute erotate/sphere requires atom attribute omega");
}
/* ---------------------------------------------------------------------- */

View File

@ -40,8 +40,10 @@ ComputeErotateSphereAtom(LAMMPS *lmp, int narg, char **arg) :
// error check
if (!atom->sphere_flag)
error->all(FLERR,"Compute erotate/sphere/atom requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Compute erotate/sphere/atom requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR,"Compute erotate/sphere/atom requires atom attribute radius");
nmax = 0;
}

View File

@ -73,8 +73,10 @@ ComputeTempSphere::ComputeTempSphere(LAMMPS *lmp, int narg, char **arg) :
// error checks
if (!atom->sphere_flag)
error->all(FLERR,"Compute temp/sphere requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Compute temp/sphere requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR,"Compute temp/sphere requires atom attribute radius");
}
/* ---------------------------------------------------------------------- */

View File

@ -240,8 +240,10 @@ void FixLangevin::init()
if (flag) error->all(FLERR, "Fix langevin gjf should come before fix nve");
}
if (oflag && !atom->sphere_flag)
error->all(FLERR, "Fix langevin omega requires atom style sphere");
if (oflag && !atom->omega_flag)
error->all(FLERR, "Fix langevin omega requires atom attribute omega");
if (oflag && !atom->radius_flag)
error->all(FLERR, "Fix langevin omega requires atom attribute radius");
if (ascale && !atom->ellipsoid_flag)
error->all(FLERR, "Fix langevin angmom requires atom style ellipsoid");

View File

@ -442,10 +442,16 @@ FixNH::FixNH(LAMMPS *lmp, int narg, char **arg) :
error->all(FLERR,"Invalid fix {} pressure settings", style);
if (dipole_flag) {
if (!atom->sphere_flag)
error->all(FLERR,"Using update dipole flag requires atom style sphere");
if (!atom->mu_flag)
error->all(FLERR,"Using update dipole flag requires atom attribute mu");
if (strstr(style, "/sphere")) {
if (!atom->omega_flag)
error->all(FLERR,"Using update dipole flag requires atom attribute omega");
if (!atom->radius_flag)
error->all(FLERR,"Using update dipole flag requires atom attribute radius");
if (!atom->mu_flag)
error->all(FLERR,"Using update dipole flag requires atom attribute mu");
} else {
error->all(FLERR, "Must use a '/sphere' Nose-Hoover fix style for updating dipoles");
}
}
if ((tstat_flag && t_period <= 0.0) ||

View File

@ -36,8 +36,10 @@ using namespace MathExtra;
FixNHSphere::FixNHSphere(LAMMPS *lmp, int narg, char **arg) :
FixNH(lmp, narg, arg)
{
if (!atom->sphere_flag)
error->all(FLERR,"Fix nvt/nph/npt sphere requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Fix {} requires atom attribute omega", style);
if (!atom->radius_flag)
error->all(FLERR,"Fix {} requires atom attribute radius", style);
// inertia = moment of inertia prefactor for sphere or disc

View File

@ -68,8 +68,8 @@ FixNVESphere::FixNVESphere(LAMMPS *lmp, int narg, char **arg) :
// error checks
if (!atom->sphere_flag)
error->all(FLERR,"Fix nve/sphere requires atom style sphere");
if (!atom->omega_flag)
error->all(FLERR,"Fix nve/sphere requires atom attribute omega");
if (extra == DIPOLE && !atom->mu_flag)
error->all(FLERR,"Fix nve/sphere update dipole requires atom attribute mu");
}

View File

@ -127,7 +127,7 @@ void FixWallRegion::init()
// ensure all particles in group are extended particles
if (style == COLLOID) {
if (!atom->sphere_flag) error->all(FLERR, "Fix wall/region colloid requires atom style sphere");
if (!atom->radius_flag) error->all(FLERR, "Fix wall/region colloid requires atom attribute radius");
double *radius = atom->radius;
int *mask = atom->mask;
@ -140,7 +140,7 @@ void FixWallRegion::init()
int flagall;
MPI_Allreduce(&flag, &flagall, 1, MPI_INT, MPI_SUM, world);
if (flagall) error->all(FLERR, "Fix wall/region colloid requires extended particles");
if (flagall) error->all(FLERR, "Fix wall/region colloid requires only extended particles");
}
// setup coefficients for each style

View File

@ -1265,8 +1265,6 @@ internally by the :doc:`Fortran interface <Fortran>` and are not likely to be us
- 1 if the atom style includes per-atom masses, 0 if there are per-type masses. See :doc:`atom_style`.
* - radius_flag
- 1 if the atom style includes a per-atom radius. See :doc:`atom_style`.
* - sphere_flag
- 1 if the atom style describes extended particles that can rotate. See :doc:`atom_style`.
* - ellipsoid_flag
- 1 if the atom style describes extended particles that may be ellipsoidal. See :doc:`atom_style`.
* - omega_flag
@ -1333,7 +1331,7 @@ int lammps_extract_setting(void *handle, const char *keyword)
if (strcmp(keyword,"mu_flag") == 0) return lmp->atom->mu_flag;
if (strcmp(keyword,"rmass_flag") == 0) return lmp->atom->rmass_flag;
if (strcmp(keyword,"radius_flag") == 0) return lmp->atom->radius_flag;
if (strcmp(keyword,"sphere_flag") == 0) return lmp->atom->sphere_flag;
if (strcmp(keyword,"ellipsoid_flag") == 0) return lmp->atom->ellipsoid_flag;
if (strcmp(keyword,"omega_flag") == 0) return lmp->atom->omega_flag;
if (strcmp(keyword,"torque_flag") == 0) return lmp->atom->torque_flag;

View File

@ -335,7 +335,7 @@ TEST_F(LibraryProperties, setting)
EXPECT_EQ(lammps_extract_setting(lmp, "mu_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "rmass_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "radius_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "sphere_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "sphere_flag"), -1);
EXPECT_EQ(lammps_extract_setting(lmp, "ellipsoid_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "omega_flag"), 0);
EXPECT_EQ(lammps_extract_setting(lmp, "torque_flag"), 0);

View File

@ -156,7 +156,6 @@ struct AtomState {
int extra_dihedral_per_atom = 0;
int extra_improper_per_atom = 0;
int sphere_flag = 0;
int ellipsoid_flag = 0;
int line_flag = 0;
int tri_flag = 0;
@ -293,7 +292,6 @@ void ASSERT_ATOM_STATE_EQ(Atom *atom, const AtomState &expected)
ASSERT_EQ(atom->extra_dihedral_per_atom, expected.extra_dihedral_per_atom);
ASSERT_EQ(atom->extra_improper_per_atom, expected.extra_improper_per_atom);
ASSERT_EQ(atom->sphere_flag, expected.sphere_flag);
ASSERT_EQ(atom->ellipsoid_flag, expected.ellipsoid_flag);
ASSERT_EQ(atom->line_flag, expected.line_flag);
ASSERT_EQ(atom->tri_flag, expected.tri_flag);
@ -882,7 +880,6 @@ TEST_F(AtomStyleTest, sphere)
expected.atom_style = "sphere";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.rmass_flag = 1;
expected.radius_flag = 1;
expected.omega_flag = 1;
@ -1391,7 +1388,6 @@ TEST_F(AtomStyleTest, line)
expected.atom_style = "line";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.molecule_flag = 1;
expected.line_flag = 1;
expected.rmass_flag = 1;
@ -1661,7 +1657,6 @@ TEST_F(AtomStyleTest, tri)
expected.atom_style = "tri";
expected.molecular = Atom::ATOMIC;
expected.tag_enable = 1;
expected.sphere_flag = 1;
expected.molecule_flag = 1;
expected.tri_flag = 1;
expected.rmass_flag = 1;