can only set respa_level for fix if r-RESPA active. fix off-by-one error

This commit is contained in:
Axel Kohlmeyer
2016-06-13 16:07:51 -04:00
parent efb32612f9
commit ef4e0d163a
2 changed files with 14 additions and 2 deletions

View File

@ -120,10 +120,16 @@ int FixSpringSelf::modify_param(int narg, char **arg)
{
if (strcmp(arg[0],"respa_level") == 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");
respa_level = lvl;
respa_level = lvl-1;
return 2;
}
return 0;