implement tweaks requested by steve. also do not enforce respa being active and an upper bound when level is set

This commit is contained in:
Axel Kohlmeyer
2016-06-15 06:57:46 -04:00
parent 957b77d213
commit 96f118ff6b
3 changed files with 26 additions and 36 deletions

View File

@ -14,17 +14,18 @@ fix_modify fix-ID keyword value ... :pre
fix-ID = ID of the fix to modify :ulb,l
one or more keyword/value pairs may be appended :l
keyword = {temp} or {press} or {energy} or {respa_level} :l
keyword = {temp} or {press} or {energy} or {respa} :l
{temp} value = compute ID that calculates a temperature
{press} value = compute ID that calculates a pressure
{energy} value = {yes} or {no}
{respa_level} value = {1} to {max respa level} or {-1} :pre
{respa} value = {1} to {max respa level} or {0} (= outmost level) :pre
:ule
[Examples:]
fix_modify 3 temp myTemp press myPress
fix_modify 1 energy yes :pre
fix_modify 1 energy yes
fix_modify tether respa 2 :pre
[Description:]
@ -61,12 +62,14 @@ minimization"_minimize.html and if you want the energy and forces it
produces to be part of the optimization criteria.
For fixes that set or modify forces, it may be possible to select at
which "r-RESPA"_run_style.html level the fix operates via the
{respa_level} keyword.
The level at which the fix is active can be selected. Default is the
outermost level. This default can be restored using a value of {-1}.
The affected fix has to be programmed to support this feature; if not,
{fix_modify} will report an error.
which "r-RESPA"_run_style.html level the fix operates via the {respa}
keyword. The RESPA level at which the fix is active can be selected.
This is a number ranging from 1 to the number of levels. Default setting
is the current outermost level. This default can be restored using
a value of {0}. The affected fix has to be programmed to support this
feature; if not, {fix_modify} will report an error. Active fixes with
custom RESPA level are reported with their specified level at the
beginning of a r-RESPA run.
[Restrictions:] none
@ -78,4 +81,4 @@ pressure"_compute_pressure.html, "thermo_style"_thermo_style.html
[Default:]
The option defaults are temp = ID defined by fix, press = ID defined
by fix, energy = no.
by fix, energy = no, respa = 0.

View File

@ -44,6 +44,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) :
global_freq = 1;
extvector = 1;
ilevel_respa = nlevels_respa = 0;
xstr = ystr = zstr = NULL;
if (strstr(arg[3],"v_") == arg[3]) {
@ -131,17 +132,11 @@ int FixSetForce::setmask()
int FixSetForce::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"respa_level") == 0) {
if (strcmp(arg[0],"respa") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
else
error->all(FLERR,"Trying to set r-RESPA level without using r-RESPA");
int lvl = force->inumeric(FLERR,arg[1]);
if ((lvl < -1) || (lvl == 0) || lvl > (nlevels_respa))
error->all(FLERR,"Illegal fix_modify command");
if (lvl < 0) error->all(FLERR,"Illegal fix_modify command");
respa_level = lvl-1;
return 2;
}
@ -196,10 +191,8 @@ void FixSetForce::init()
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
if (respa_level < 0)
ilevel_respa = nlevels_respa-1;
else
ilevel_respa = respa_level;
if (respa_level) ilevel_respa = (respa_level > nlevels_respa-1)
? nlevels_respa-1 : respa_level;
// cannot use non-zero forces for a minimization since no energy is integrated
// use fix addforce instead

View File

@ -118,17 +118,11 @@ int FixSpringSelf::setmask()
int FixSpringSelf::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"respa_level") == 0) {
if (strcmp(arg[0],"respa") == 0) {
if (narg < 2) error->all(FLERR,"Illegal fix_modify command");
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
else
error->all(FLERR,"Trying to set r-RESPA level without using r-RESPA");
int lvl = force->inumeric(FLERR,arg[1]);
if ((lvl < -1) || (lvl == 0) || lvl > (nlevels_respa))
error->all(FLERR,"Illegal fix_modify command");
if (lvl < 0) error->all(FLERR,"Illegal fix_modify command");
respa_level = lvl-1;
return 2;
}
@ -139,13 +133,13 @@ int FixSpringSelf::modify_param(int narg, char **arg)
void FixSpringSelf::init()
{
if (strstr(update->integrate_style,"respa"))
nlevels_respa = ((Respa *) update->integrate)->nlevels;
int max_respa = 0;
if (respa_level < 0)
ilevel_respa = nlevels_respa-1;
else
ilevel_respa = respa_level;
if (strstr(update->integrate_style,"respa"))
max_respa = ((Respa *) update->integrate)->nlevels - 1;
if (respa_level)
ilevel_respa = (respa_level > max_respa) ? max_respa : respa_level;
}
/* ---------------------------------------------------------------------- */