diff --git a/doc/src/fix_deform.rst b/doc/src/fix_deform.rst index 7a17f14fed..a4d449850e 100644 --- a/doc/src/fix_deform.rst +++ b/doc/src/fix_deform.rst @@ -98,6 +98,8 @@ Syntax Modifies the behavior of the *volume* option to try and balance pressures *max/rate* value = *rate* rate = maximum strain rate for pressure control + *normalize/pressure* value = *yes* or *no* + Modifies pressure controls such that the deviation in pressure is normalized by the target pressure Examples """""""" @@ -111,7 +113,6 @@ Examples fix 1 all deform 1 x pressure 2.0 0.1 normalize/pressure yes max/rate 0.001 fix 1 all deform 1 x trate 0.1 y volume z volume vol/balance/p yes fix 1 all deform 1 x trate 0.1 y pressure/mean 0.0 1.0 z pressure/mean 0.0 1.0 - fix 1 all deform 1 x trate 0.1 y trate -0.1 overlay/pressure/mean 1.0 0.1 Description """"""""""" @@ -346,12 +347,13 @@ applied strain using the :ref:`max/rate ` option and couple pressures in different dimensions using the :ref:`couple ` option. -The *pressure/mean* style is changes a dimension in order to maintain +The *pressure/mean* style changes a dimension's box length to maintain a constant mean pressure defined as the trace of the pressure tensor. This option is therefore very similar to the *pressure* style with identical arguments except the current and target pressures refer to the -mean trace of the pressure tensor. The same options also apply except -for the :ref:`couple ` option. +mean trace of the pressure tensor. All options for the *pressure* style +also apply to the *pressure/mean* style except for the +:ref:`couple ` option. ---------- diff --git a/src/fix_deform.cpp b/src/fix_deform.cpp index ff6caf5a1d..79f9b3a5ba 100644 --- a/src/fix_deform.cpp +++ b/src/fix_deform.cpp @@ -24,6 +24,7 @@ #include "domain.h" #include "error.h" #include "force.h" +#include "group.h" #include "input.h" #include "irregular.h" #include "kspace.h" @@ -1522,31 +1523,31 @@ double FixDeform::memory_usage() int FixDeform::modify_param(int narg, char **arg) { - if (!pressure_flag) error->all(FLERR,"Cannot modify fix deform without a pressure control"); if (strcmp(arg[0],"temp") == 0) { - if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify deform", error); + if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); if (tflag) { modify->delete_compute(id_temp); tflag = 0; } - delete [] id_temp; + delete[] id_temp; id_temp = utils::strdup(arg[1]); - int icompute = modify->find_compute(arg[1]); - if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(arg[1]); + if (!temperature) + error->all(FLERR,"Could not find fix_modify temperature compute ID: ", arg[1]); if (temperature->tempflag == 0) - error->all(FLERR,"Fix_modify temperature ID does not compute temperature"); + error->all(FLERR,"Fix_modify temperature compute {} does not compute temperature", arg[1]); if (temperature->igroup != 0 && comm->me == 0) - error->warning(FLERR,"Temperature for deform is not for group all"); + error->warning(FLERR,"Temperature compute {} for fix {} is not for group all: {}", + arg[1], style, group->names[temperature->igroup]); // reset id_temp of pressure to new temperature ID - icompute = modify->find_compute(id_press); - if (icompute < 0) - error->all(FLERR,"Pressure ID for fix deform does not exist"); - modify->compute[icompute]->reset_extra_compute_fix(id_temp); + auto icompute = modify->get_compute_by_id(id_press); + if (!icompute) + error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style); + icompute->reset_extra_compute_fix(id_temp); return 2; @@ -1556,15 +1557,13 @@ int FixDeform::modify_param(int narg, char **arg) modify->delete_compute(id_press); pflag = 0; } - delete [] id_press; + delete[] id_press; id_press = utils::strdup(arg[1]); - int icompute = modify->find_compute(arg[1]); - if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); - pressure = modify->compute[icompute]; - + pressure = modify->get_compute_by_id(arg[1]); + if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) - error->all(FLERR,"Fix_modify pressure ID does not compute pressure"); + error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2; } diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index 67802654ba..ee9a879616 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -491,7 +491,7 @@ int FixPressBerendsen::modify_param(int narg, char **arg) id_press = utils::strdup(arg[1]); pressure = modify->get_compute_by_id(arg[1]); - if (pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); + if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2;