diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 8152343f4b..90ade71ed7 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -133,10 +133,16 @@ int FixSetForce::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; diff --git a/src/fix_spring_self.cpp b/src/fix_spring_self.cpp index 281287f84f..a6e9e42c64 100644 --- a/src/fix_spring_self.cpp +++ b/src/fix_spring_self.cpp @@ -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;