make using energy and potential keyword at the same time an error
This commit is contained in:
@ -58,7 +58,7 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
virial_global_flag = virial_peratom_flag = 1;
|
virial_global_flag = virial_peratom_flag = 1;
|
||||||
|
|
||||||
qe2f = force->qe2f;
|
qe2f = force->qe2f;
|
||||||
xstr = ystr = zstr = nullptr;
|
xstyle = ystyle = zstyle = estyle = pstyle = NONE;
|
||||||
|
|
||||||
if (utils::strmatch(arg[3], "^v_")) {
|
if (utils::strmatch(arg[3], "^v_")) {
|
||||||
xstr = utils::strdup(arg[3] + 2);
|
xstr = utils::strdup(arg[3] + 2);
|
||||||
@ -113,6 +113,9 @@ FixEfield::FixEfield(LAMMPS *lmp, int narg, char **arg) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (estr && pstr)
|
||||||
|
error->all(FLERR, "Must not use energy and potential keywords at the same time with fix efield");
|
||||||
|
|
||||||
force_flag = 0;
|
force_flag = 0;
|
||||||
fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0;
|
fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0;
|
||||||
|
|
||||||
@ -174,6 +177,7 @@ void FixEfield::init()
|
|||||||
else
|
else
|
||||||
error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style);
|
error->all(FLERR, "Variable {} for x-field in fix {} is invalid style", xstr, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ystr) {
|
if (ystr) {
|
||||||
yvar = input->variable->find(ystr);
|
yvar = input->variable->find(ystr);
|
||||||
if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style);
|
if (yvar < 0) error->all(FLERR, "Variable {} for y-field in fix {} does not exist", ystr, style);
|
||||||
@ -184,6 +188,7 @@ void FixEfield::init()
|
|||||||
else
|
else
|
||||||
error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style);
|
error->all(FLERR, "Variable {} for y-field in fix {} is invalid style", ystr, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zstr) {
|
if (zstr) {
|
||||||
zvar = input->variable->find(zstr);
|
zvar = input->variable->find(zstr);
|
||||||
if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style);
|
if (zvar < 0) error->all(FLERR, "Variable {} for z-field in fix {} does not exist", zstr, style);
|
||||||
@ -194,6 +199,7 @@ void FixEfield::init()
|
|||||||
else
|
else
|
||||||
error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style);
|
error->all(FLERR, "Variable {} for z-field in fix {} is invalid style", zstr, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (estr) {
|
if (estr) {
|
||||||
evar = input->variable->find(estr);
|
evar = input->variable->find(estr);
|
||||||
if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style);
|
if (evar < 0) error->all(FLERR, "Variable {} for energy in fix {} does not exist", estr, style);
|
||||||
@ -201,8 +207,8 @@ void FixEfield::init()
|
|||||||
estyle = ATOM;
|
estyle = ATOM;
|
||||||
else
|
else
|
||||||
error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style);
|
error->all(FLERR, "Variable {} for energy in fix {} must be atom-style", estr, style);
|
||||||
} else
|
}
|
||||||
estyle = NONE;
|
|
||||||
if (pstr) {
|
if (pstr) {
|
||||||
pvar = input->variable->find(pstr);
|
pvar = input->variable->find(pstr);
|
||||||
if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style);
|
if (pvar < 0) error->all(FLERR, "Variable {} for potential in fix {} does not exist", pstr, style);
|
||||||
@ -210,11 +216,7 @@ void FixEfield::init()
|
|||||||
pstyle = ATOM;
|
pstyle = ATOM;
|
||||||
else
|
else
|
||||||
error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style);
|
error->all(FLERR, "Variable {} for potential in fix {} must be atom-style", pstr, style);
|
||||||
if (estyle != NONE)
|
}
|
||||||
error->warning(FLERR, "fix {} will ignore variable {} for energy "
|
|
||||||
"because atom-style potential has been specified", estr, style);
|
|
||||||
} else
|
|
||||||
pstyle = NONE;
|
|
||||||
|
|
||||||
// set index and check validity of region
|
// set index and check validity of region
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user