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
*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 <deform_max_rate>` option and couple
pressures in different dimensions using the :ref:`couple <deform_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 <deform_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 <deform_couple>` option.
----------

View File

@ -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,9 +1523,8 @@ 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;
@ -1532,21 +1532,22 @@ int FixDeform::modify_param(int narg, char **arg)
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;
@ -1559,12 +1560,10 @@ int FixDeform::modify_param(int narg, char **arg)
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;
}

View File

@ -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;