error out when a bond/angle/dihedral/improper substyle is not used

this implements the same behavior as for pair style hybrid
This commit is contained in:
Axel Kohlmeyer
2022-11-30 08:09:51 -05:00
parent 5f3b719a7d
commit c11eabddc0
4 changed files with 40 additions and 0 deletions

View File

@ -306,6 +306,16 @@ void AngleHybrid::coeff(int narg, char **arg)
void AngleHybrid::init_style()
{
// error if sub-style is not used
int used;
for (int istyle = 0; istyle < nstyles; ++istyle) {
used = 0;
for (int itype = 1; itype <= atom->nangletypes; ++itype)
if (map[itype] == istyle) used = 1;
if (used == 0) error->all(FLERR, "Angle hybrid sub-style {} is not used", keywords[istyle]);
}
for (int m = 0; m < nstyles; m++)
if (styles[m]) styles[m]->init_style();
}

View File

@ -334,6 +334,16 @@ void BondHybrid::coeff(int narg, char **arg)
void BondHybrid::init_style()
{
// error if sub-style is not used
int used;
for (int istyle = 0; istyle < nstyles; ++istyle) {
used = 0;
for (int itype = 1; itype <= atom->nbondtypes; ++itype)
if (map[itype] == istyle) used = 1;
if (used == 0) error->all(FLERR, "Bond hybrid sub-style {} is not used", keywords[istyle]);
}
for (int m = 0; m < nstyles; m++)
if (styles[m]) styles[m]->init_style();

View File

@ -313,6 +313,16 @@ void DihedralHybrid::coeff(int narg, char **arg)
void DihedralHybrid::init_style()
{
// error if sub-style is not used
int used;
for (int istyle = 0; istyle < nstyles; ++istyle) {
used = 0;
for (int itype = 1; itype <= atom->ndihedraltypes; ++itype)
if (map[itype] == istyle) used = 1;
if (used == 0) error->all(FLERR, "Dihedral hybrid sub-style {} is not used", keywords[istyle]);
}
for (int m = 0; m < nstyles; m++)
if (styles[m]) styles[m]->init_style();
}

View File

@ -305,6 +305,16 @@ void ImproperHybrid::coeff(int narg, char **arg)
void ImproperHybrid::init_style()
{
// error if sub-style is not used
int used;
for (int istyle = 0; istyle < nstyles; ++istyle) {
used = 0;
for (int itype = 1; itype <= atom->nimpropertypes; ++itype)
if (map[itype] == istyle) used = 1;
if (used == 0) error->all(FLERR, "Improper hybrid sub-style {} is not used", keywords[istyle]);
}
for (int m = 0; m < nstyles; m++)
if (styles[m]) styles[m]->init_style();
}