Cleaning up files, fixing bug in berendsen

This commit is contained in:
jtclemm
2023-07-18 09:25:22 -06:00
parent 2ef326273d
commit ec65fc48ad
3 changed files with 24 additions and 23 deletions

View File

@ -98,6 +98,8 @@ Syntax
Modifies the behavior of the *volume* option to try and balance pressures Modifies the behavior of the *volume* option to try and balance pressures
*max/rate* value = *rate* *max/rate* value = *rate*
rate = maximum strain rate for pressure control 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 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 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 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 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 Description
""""""""""" """""""""""
@ -346,12 +347,13 @@ applied strain using the :ref:`max/rate <deform_max_rate>` option and couple
pressures in different dimensions using the :ref:`couple <deform_couple>` pressures in different dimensions using the :ref:`couple <deform_couple>`
option. 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. a constant mean pressure defined as the trace of the pressure tensor.
This option is therefore very similar to the *pressure* style with This option is therefore very similar to the *pressure* style with
identical arguments except the current and target pressures refer to the identical arguments except the current and target pressures refer to the
mean trace of the pressure tensor. The same options also apply except mean trace of the pressure tensor. All options for the *pressure* style
for the :ref:`couple <deform_couple>` option. also apply to the *pressure/mean* style except for the
:ref:`couple <deform_couple>` option.
---------- ----------

View File

@ -24,6 +24,7 @@
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "force.h" #include "force.h"
#include "group.h"
#include "input.h" #include "input.h"
#include "irregular.h" #include "irregular.h"
#include "kspace.h" #include "kspace.h"
@ -1522,31 +1523,31 @@ double FixDeform::memory_usage()
int FixDeform::modify_param(int narg, char **arg) 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 (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) { if (tflag) {
modify->delete_compute(id_temp); modify->delete_compute(id_temp);
tflag = 0; tflag = 0;
} }
delete [] id_temp; delete[] id_temp;
id_temp = utils::strdup(arg[1]); id_temp = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]); temperature = modify->get_compute_by_id(arg[1]);
if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); if (!temperature)
temperature = modify->compute[icompute]; error->all(FLERR,"Could not find fix_modify temperature compute ID: ", arg[1]);
if (temperature->tempflag == 0) 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) 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 // reset id_temp of pressure to new temperature ID
icompute = modify->find_compute(id_press); auto icompute = modify->get_compute_by_id(id_press);
if (icompute < 0) if (!icompute)
error->all(FLERR,"Pressure ID for fix deform does not exist"); error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style);
modify->compute[icompute]->reset_extra_compute_fix(id_temp); icompute->reset_extra_compute_fix(id_temp);
return 2; return 2;
@ -1556,15 +1557,13 @@ int FixDeform::modify_param(int narg, char **arg)
modify->delete_compute(id_press); modify->delete_compute(id_press);
pflag = 0; pflag = 0;
} }
delete [] id_press; delete[] id_press;
id_press = utils::strdup(arg[1]); id_press = utils::strdup(arg[1]);
int icompute = modify->find_compute(arg[1]); pressure = modify->get_compute_by_id(arg[1]);
if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); if (!pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]);
pressure = modify->compute[icompute];
if (pressure->pressflag == 0) 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; return 2;
} }

View File

@ -491,7 +491,7 @@ int FixPressBerendsen::modify_param(int narg, char **arg)
id_press = utils::strdup(arg[1]); id_press = utils::strdup(arg[1]);
pressure = modify->get_compute_by_id(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) if (pressure->pressflag == 0)
error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]);
return 2; return 2;