From a051d61e1fe382ff7cead7d4619e38713e1f277e Mon Sep 17 00:00:00 2001 From: Gareth Tribello <gareth.tribello@gmail.com> Date: Sun, 4 Nov 2018 11:24:01 +0000 Subject: [PATCH] Added functionality to support fix modify for fix plumed --- src/USER-PLUMED/fix_plumed.cpp | 38 ++++++++++++++++++++++++++++++++++ src/USER-PLUMED/fix_plumed.h | 1 + 2 files changed, 39 insertions(+) diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 8569a1dd4a..57cd2b0fef 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -456,4 +456,42 @@ double FixPlumed::compute_scalar() return bias; } +int FixPlumed::modify_param(int narg, char **arg) +{ + if (strcmp(arg[0],"pe") == 0) { + if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + modify->delete_compute(id_pe); delete [] id_pe; + int n = strlen(arg[1]) + 1; + id_pe = new char[n]; + strcpy(id_pe,arg[1]); + + int icompute = modify->find_compute(arg[1]); + if (icompute < 0) error->all(FLERR,"Could not find fix_modify potential energy ID"); + c_pe = modify->compute[icompute]; + + if (c_pe->peflag == 0) + error->all(FLERR,"Fix_modify plmd_pe ID does not compute potential energy"); + if (c_pe->igroup != 0 && comm->me == 0) + error->warning(FLERR,"Potential for fix PLUMED is not for group all"); + + return 2; + + } else if (strcmp(arg[0],"press") == 0) { + if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + modify->delete_compute(id_press); delete [] id_press; + int n = strlen(arg[1]) + 1; + id_press = new char[n]; + strcpy(id_press,arg[1]); + + int icompute = modify->find_compute(arg[1]); + if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); + c_press = modify->compute[icompute]; + + if (c_press->pressflag == 0) + error->all(FLERR,"Fix_modify pressure ID does not compute pressure"); + + return 2; + } + return 0; +} diff --git a/src/USER-PLUMED/fix_plumed.h b/src/USER-PLUMED/fix_plumed.h index fda14606bf..cd101c3ac5 100644 --- a/src/USER-PLUMED/fix_plumed.h +++ b/src/USER-PLUMED/fix_plumed.h @@ -42,6 +42,7 @@ class FixPlumed : public Fix { void min_post_force(int); double compute_scalar(); void reset_dt(); + int modify_param(int narg, char **arg); private: -- GitLab