added Compute::modify_param() function.

This way individual computes can add custom keywords to compute_modify in
a similar fashion as fixes
This commit is contained in:
Axel Kohlmeyer
2025-01-23 04:51:12 -05:00
parent 3412c4744d
commit b016b135fa
3 changed files with 9 additions and 1 deletions

View File

@ -45,6 +45,8 @@ class. See compute.h for details.
+-----------------------+------------------------------------------------------------------+ +-----------------------+------------------------------------------------------------------+
| pair_tally_callback | callback function for *tally*\ -style computes (optional). | | pair_tally_callback | callback function for *tally*\ -style computes (optional). |
+-----------------------+------------------------------------------------------------------+ +-----------------------+------------------------------------------------------------------+
| modify_param | called when a compute_modify request is executed (optional) |
+-----------------------+------------------------------------------------------------------+
| memory_usage | tally memory usage (optional) | | memory_usage | tally memory usage (optional) |
+-----------------------+------------------------------------------------------------------+ +-----------------------+------------------------------------------------------------------+

View File

@ -149,7 +149,12 @@ void Compute::modify_params(int narg, char **arg)
if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command"); if (iarg+2 > narg) error->all(FLERR,"Illegal compute_modify command");
dynamic_user = utils::logical(FLERR,arg[iarg+1],false,lmp); dynamic_user = utils::logical(FLERR,arg[iarg+1],false,lmp);
iarg += 2; iarg += 2;
} else error->all(FLERR,"Illegal compute_modify command"); } else {
int n = modify_param(narg-iarg, &arg[iarg]);
if (n== 0)
error->all(FLERR, iarg + 1, "Compute {} {} does not support compute_modify {} command",
id, style, arg[iarg]);
}
} }
} }

View File

@ -113,6 +113,7 @@ class Compute : protected Pointers {
Compute(class LAMMPS *, int, char **); Compute(class LAMMPS *, int, char **);
~Compute() override; ~Compute() override;
void modify_params(int, char **); void modify_params(int, char **);
virtual int modify_param(int, char **) { return 0; }
virtual void reset_extra_dof(); virtual void reset_extra_dof();
void init_flags(); void init_flags();