More updates for oxidation, more doc pages

This commit is contained in:
jtclemm
2024-03-31 21:40:34 -06:00
parent 7ea0dc3996
commit 08db64c27f
14 changed files with 188 additions and 79 deletions

View File

@ -8,10 +8,17 @@ Syntax
.. code-block:: LAMMPS .. code-block:: LAMMPS
compute ID group-ID nbond/atom compute ID group-ID nbond/atom keyword value
* ID, group-ID are documented in :doc:`compute <compute>` command * ID, group-ID are documented in :doc:`compute <compute>` command
* nbond/atom = style name of this compute command * nbond/atom = style name of this compute command
* zero or more keyword/value pairs may be appended
* keyword = *bond/type*
.. parsed-literal::
*bond/type* value = *btype*
*btype* = bond type included in count
Examples Examples
"""""""" """"""""
@ -19,6 +26,7 @@ Examples
.. code-block:: LAMMPS .. code-block:: LAMMPS
compute 1 all nbond/atom compute 1 all nbond/atom
compute 1 all nbond/atom bond/type 2
Description Description
""""""""""" """""""""""
@ -31,6 +39,9 @@ the :doc:`Howto broken bonds <Howto_bpm>` page for more information.
The number of bonds will be zero for atoms not in the specified The number of bonds will be zero for atoms not in the specified
compute group. This compute does not depend on Newton bond settings. compute group. This compute does not depend on Newton bond settings.
If the keyword *bond/type* is specified, only bonds of *btype* are
counted.
Output info Output info
""""""""""" """""""""""

View File

@ -8,12 +8,13 @@ Syntax
.. parsed-literal:: .. parsed-literal::
fix ID group-ID rheo/pressure style args fix ID group-ID rheo/pressure type1 pstyle1 args1 ... typeN pstyleN argsN
* ID, group-ID are documented in :doc:`fix <fix>` command * ID, group-ID are documented in :doc:`fix <fix>` command
* rheo/pressure = style name of this fix command * rheo/pressure = style name of this fix command
* one or more types and pressure styles must be appended
* types = lists of types (see below) * types = lists of types (see below)
* style = *linear* or *taitwater* or *cubic* * pstyle = *linear* or *taitwater* or *cubic*
.. parsed-literal:: .. parsed-literal::
@ -32,10 +33,41 @@ Examples
Description Description
""""""""""" """""""""""
This fix... This fix defines a pressure equation of state for RHEO particles. One can
define different equations of state for different atom types, but an
equation must be specified for every atom type.
Only one instance of fix rheo/pressure can be defined and the fix group must be set to all. One first defines the atom *types*. A wild-card asterisk can be used in place
of or in conjunction with the *types* argument to set the coefficients for
multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*"
or "m\*n". If :math:`N` is the number of atom types, then an asterisk with
no numeric values means all types from 1 to :math:`N`. A leading asterisk
means all types from 1 to n (inclusive). A trailing asterisk means all types
from m to :math:`N` (inclusive). A middle asterisk means all types from m to n
(inclusive).
The *types* definition is followed by the pressure style, *pstyle*. Current
options *linear*, *taitwater*, and *cubic*. Style *linear* is a linear
equation of state with a particle pressure :math:`P` calculated as
.. math::
P = c (\rho - \rho_0)
where :math:`c` is the speed of sound, :math:`\rho_0` is the equilibrium density,
and :math:`\rho` is the current density of a particle. The numerical values of
:math:`c` and :math:`\rho_0` are set in :doc:`fix rheo <fix_rheo>`. Style *cubic*
is a cubic equation of state which has an extra argument :math:`A_3`,
.. math::
P = c ((\rho - \rho_0) + A_3 (\rho - \rho_0)^3) .
Style *taitwater* is Tait's equation of state:
.. math::
P = \frac{c^2 \rho_0}{7} \biggl[\left(\frac{\rho}{\rho_0}\right)^{7} - 1\biggr].
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -52,7 +84,7 @@ Restrictions
This fix must be used with an atom style that includes density This fix must be used with an atom style that includes density
such as atom_style rheo or rheo/thermal. This fix must be used in such as atom_style rheo or rheo/thermal. This fix must be used in
conjuction with :doc:`fix rheo <fix_rheo>`. The fix group must be conjuction with :doc:`fix rheo <fix_rheo>`. The fix group must be
set to all. set to all. Only one instance of fix rheo/pressure can be defined.
This fix is part of the RHEO package. It is only enabled if This fix is part of the RHEO package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info. LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
@ -60,8 +92,7 @@ LAMMPS was built with that package. See the :doc:`Build package <Build_package>
Related commands Related commands
"""""""""""""""" """"""""""""""""
:doc:`fix rheo/viscosity <fix_rheo_viscosity>`, :doc:`fix rheo <fix_rheo>`,
:doc:`fix rheo/thermal <fix_rheo_thermal>`,
:doc:`pair rheo <pair_rheo>`, :doc:`pair rheo <pair_rheo>`,
:doc:`compute rheo/property/atom <compute_rheo_property_atom>` :doc:`compute rheo/property/atom <compute_rheo_property_atom>`

View File

@ -48,26 +48,38 @@ Examples
Description Description
""""""""""" """""""""""
This fix... This fix performs time integration of temperature evolution for atom style
rheo/thermal. In addition, it defines multiple thermal properties of
particles and handles melting/solidification, if applicable. For more details
on phase transitions in RHEO, see :doc:`the RHEO howto <Howto_rheo>`.
Each list consists of a series of type For each atom type, one can define attributes for the *conductivity*,
ranges separated by commas. The range can be specified as a *specific/heat*, *latent/heat*, and critical temperature (*Tfreeze*).
single numeric value, or a wildcard asterisk can be used to specify a range The conductivity and specific heat must be defined for all atom types.
of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For The latent heat and critical temperature are optional. However, a
example, if M = the number of atom types, then an asterisk with no numeric critical temperature must be defined to specify a latent heat.
values means all types from 1 to M. A leading asterisk means all types
from 1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n (inclusive).
Note that all atom types must be included in exactly one of the N collections.
While the *Tfreeze* keyword is optional, the *conductivity* and For each property, one must first define a list of atom types. A wild-card
*specific/heat* keywords are mandatory. asterisk can be used in place of or in conjunction with the *types* argument
to set the coefficients for multiple pairs of atom types. This takes the
form "\*" or "\*n" or "m\*" or "m\*n". If :math:`N` is the number of atom
types, then an asterisk with no numeric values means all types from 1 to
:math:`N`. A leading asterisk means all types from 1 to n (inclusive).
A trailing asterisk means all types from m to :math:`N` (inclusive). A
middle asterisk means all types from m to n (inclusive).
Multiple instances of this fix may be defined to apply different The *types* definition for each property is followed by the style. Currently,
properties to different groups. However, the union of fix groups the only option is *constant*. Style *constant* simply applies a constant value
across all instances of fix rheo/thermal must cover all atoms. of respective property to each particle of the assigned type.
If there are multiple instances of this fix, any intersections in
the fix groups will lead to incorrect thermal integration. The *react* keyword controls whether bonds are created/deleted when particles
transition between a fluid and solid state. This option only applies to atom
types that have a defined value of *Tfreeze*. When a fluid particle's
temperature drops below *Tfreeze*, bonds of type *btype* are created between
nearby solid particles within a distance of *cut*. The particle's status also
swaps to a solid state. When a solid particle's temperature rises above
*Tfreeze*, all bonds of type *btype* are broken and the particle's tatus swaps
to a fluid state.
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -84,7 +96,8 @@ Restrictions
This fix must be used with an atom style that includes temperature, This fix must be used with an atom style that includes temperature,
heatflow, and conductivity such as atom_tyle rheo/thermal This fix heatflow, and conductivity such as atom_tyle rheo/thermal This fix
must be used in conjuction with :doc:`fix rheo <fix_rheo>` with the must be used in conjuction with :doc:`fix rheo <fix_rheo>` with the
*thermal* setting. *thermal* setting. The fix group must be set to all. Only one
instance of fix rheo/pressure can be defined.
This fix is part of the RHEO package. It is only enabled if This fix is part of the RHEO package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info. LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
@ -93,8 +106,6 @@ Related commands
"""""""""""""""" """"""""""""""""
:doc:`fix rheo <fix_rheo>`, :doc:`fix rheo <fix_rheo>`,
:doc:`fix rheo/viscosity <fix_rheo_viscosity>`,
:doc:`fix rheo/pressure <fix_rheo_pressure>`,
:doc:`pair rheo <pair_rheo>`, :doc:`pair rheo <pair_rheo>`,
:doc:`compute rheo/property/atom <compute_rheo_property_atom>` :doc:`compute rheo/property/atom <compute_rheo_property_atom>`

View File

@ -8,22 +8,18 @@ Syntax
.. parsed-literal:: .. parsed-literal::
fix ID group-ID rheo/viscosity types style args ... fix ID group-ID rheo/viscosity type1 pstyle1 args1 ... typeN pstyleN argsN
* ID, group-ID are documented in :doc:`fix <fix>` command * ID, group-ID are documented in :doc:`fix <fix>` command
* rheo/viscosity = style name of this fix command * rheo/viscosity = style name of this fix command
* one or more types and viscosity styles must be appended
* types = lists of types (see below) * types = lists of types (see below)
* style = *constant* or *power* * vstyle = *constant*
.. parsed-literal:: .. parsed-literal::
*constant* args = viscosity (mass/(length*time)) *constant* args = *eta*
*power* args = *eta* *gd0* *K* *npow* *tau0* *eta* = viscosity
*eta* = (units)
*gd0* = (units)
*K* = (units)
*npow* = (units)
*tau0* = (units)
Examples Examples
"""""""" """"""""
@ -31,20 +27,27 @@ Examples
.. code-block:: LAMMPS .. code-block:: LAMMPS
fix 1 all rheo/viscosity * constant 1.0 fix 1 all rheo/viscosity * constant 1.0
fix 1 all rheo/viscosity 1 constant 1.0 2 power 0.1 1e-2 0.5 0.01 fix 1 all rheo/viscosity 1 constant 1.0 2 constant 2.0
Description Description
""""""""""" """""""""""
This fix... This fix defines a viscosity for RHEO particles. One can define different
viscosities for different atom types, but a viscosity must be specified for
every atom type.
Multiple instances of this fix may be defined to apply different One first defines the atom *types*. A wild-card asterisk can be used in place
properties to different groups. However, the union of fix groups of or in conjunction with the *types* argument to set the coefficients for
across all instances of fix rheo/viscosity must cover all atoms. multiple pairs of atom types. This takes the form "\*" or "\*n" or "m\*"
If there are multiple instances of this fix, any intersection or "m\*n". If :math:`N` is the number of atom types, then an asterisk with
between fix groups will cause the viscosity for the affected atoms no numeric values means all types from 1 to :math:`N`. A leading asterisk
to be calculated multiple times. Any such affected atoms will enabled means all types from 1 to n (inclusive). A trailing asterisk means all types
up with a viscosity calculated by the latest defined fix. from m to :math:`N` (inclusive). A middle asterisk means all types from m to n
(inclusive).
The *types* definition is followed by the viscosity style, *vstyle*. Currently,
the only option is *constant*. Style *constant* simply applies a constant value
of the viscosity *eta* to each particle of the assigned type.
Restart, fix_modify, output, run start/stop, minimize info Restart, fix_modify, output, run start/stop, minimize info
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" """""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@ -60,7 +63,8 @@ Restrictions
This fix must be used with an atom style that includes viscosity This fix must be used with an atom style that includes viscosity
such as atom_style rheo or rheo/thermal. This fix must be used in such as atom_style rheo or rheo/thermal. This fix must be used in
conjuction with :doc:`fix rheo <fix_rheo>`. conjuction with :doc:`fix rheo <fix_rheo>`. The fix group must be
set to all. Only one instance of fix rheo/viscosity can be defined.
This fix is part of the RHEO package. It is only enabled if This fix is part of the RHEO package. It is only enabled if
LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info. LAMMPS was built with that package. See the :doc:`Build package <Build_package>` page for more info.
@ -69,8 +73,6 @@ Related commands
"""""""""""""""" """"""""""""""""
:doc:`fix rheo <fix_rheo>`, :doc:`fix rheo <fix_rheo>`,
:doc:`fix rheo/pressure <fix_rheo_pressure>`,
:doc:`fix rheo/thermal <fix_rheo_thermal>`,
:doc:`pair rheo <pair_rheo>`, :doc:`pair rheo <pair_rheo>`,
:doc:`compute rheo/property/atom <compute_rheo_property_atom>` :doc:`compute rheo/property/atom <compute_rheo_property_atom>`

View File

@ -25,7 +25,20 @@ using namespace LAMMPS_NS;
ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) : ComputeNBondAtom::ComputeNBondAtom(LAMMPS *_lmp, int narg, char **arg) :
Compute(_lmp, narg, arg), nbond(nullptr) Compute(_lmp, narg, arg), nbond(nullptr)
{ {
if (narg < 3) utils::missing_cmd_args(FLERR, "compute nbond/atom", error); if (narg < 4) utils::missing_cmd_args(FLERR, "compute nbond/atom", error);
btype = -1;
iarg = 3;
while (iarg < narg) {
if (strcmp(arg[iarg], "bond/type") == 0) {
if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "compute nbond/atom bond/type", error);
btype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp);
iarg += 2;
} else {
error->all(FLERR, "Unknown compute nbond/type command {}", arg[iarg]);
}
}
peratom_flag = 1; peratom_flag = 1;
size_peratom_cols = 0; size_peratom_cols = 0;
@ -78,6 +91,7 @@ void ComputeNBondAtom::compute_peratom()
for (i = 0; i < nlocal; i++) { for (i = 0; i < nlocal; i++) {
for (j = 0; j < num_bond[i]; j++) { for (j = 0; j < num_bond[i]; j++) {
if (bond_type[i][j] <= 0) continue; if (bond_type[i][j] <= 0) continue;
if (btype != -1 && bond_type[i][j] != btype) continue;
k = atom->map(bond_atom[i][j]); k = atom->map(bond_atom[i][j]);
if (k < 0) continue; if (k < 0) continue;

View File

@ -35,7 +35,7 @@ class ComputeNBondAtom : public Compute {
double memory_usage() override; double memory_usage() override;
private: private:
int nmax; int nmax, btype;
double *nbond; double *nbond;
}; };

View File

@ -20,6 +20,7 @@
#include "atom.h" #include "atom.h"
#include "comm.h" #include "comm.h"
#include "compute_rheo_surface.h"
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fix_bond_history.h" #include "fix_bond_history.h"
@ -42,7 +43,7 @@ using namespace RHEO_NS;
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) : BondRHEOShell::BondRHEOShell(LAMMPS *_lmp) :
BondBPM(_lmp), k(nullptr), ecrit(nullptr), gamma(nullptr) BondBPM(_lmp), compute_surface(nullptr), k(nullptr), ecrit(nullptr), gamma(nullptr)
{ {
partial_flag = 1; partial_flag = 1;
comm_reverse = 1; comm_reverse = 1;
@ -279,7 +280,7 @@ void BondRHEOShell::compute(int eflag, int vflag)
// Communicate changes in nbond // Communicate changes in nbond
if (newton_bond) comm->reverse_comm(this); if (newton_bond) comm->reverse_comm(this);
for(i = 0; i < nlocal; i++) { for(int i = 0; i < nlocal; i++) {
nbond[i] += dbond[i]; nbond[i] += dbond[i];
// If it has bonds, no shifting // If it has bonds, no shifting
@ -341,6 +342,18 @@ void BondRHEOShell::init_style()
if (comm->ghost_velocity == 0) if (comm->ghost_velocity == 0)
error->all(FLERR, "Bond rheo/shell requires ghost atoms store velocity"); error->all(FLERR, "Bond rheo/shell requires ghost atoms store velocity");
auto fixes = modify->get_fix_by_style("^rheo$");
if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use bond rheo/shell");
class FixRHEO *fix_rheo = dynamic_cast<FixRHEO *>(fixes[0]);
if (!fix_rheo->surface_flag) error->all(FLERR,
"Bond rheo/shell requires surface calculation in fix rheo");
compute_surface = fix_rheo->compute_surface;
if (fix_rheo->oxidation_fix_defined != 1)
error->all(FLERR, "Need to define fix rheo/oxdiation to use bond rheo/shell");
// check consistency in values (copy?), swap conditions to rsurf
if (!id_fix_bond_history) { if (!id_fix_bond_history) {
id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL"); id_fix_bond_history = utils::strdup("HISTORY_RHEO_SHELL");
fix_bond_history = dynamic_cast<FixBondHistory *>(modify->replace_fix( fix_bond_history = dynamic_cast<FixBondHistory *>(modify->replace_fix(

View File

@ -49,6 +49,8 @@ class BondRHEOShell : public BondBPM {
int index_nb, nmax_store; int index_nb, nmax_store;
char *id_fix; char *id_fix;
class ComputeRHEOSurface *compute_surface;
void process_ineligibility(int, int); void process_ineligibility(int, int);
void allocate(); void allocate();
void store_data(); void store_data();

View File

@ -29,6 +29,7 @@
#include "domain.h" #include "domain.h"
#include "error.h" #include "error.h"
#include "fix_rheo.h" #include "fix_rheo.h"
#include "fix_rheo_oxidation.h"
#include "fix_rheo_pressure.h" #include "fix_rheo_pressure.h"
#include "fix_rheo_thermal.h" #include "fix_rheo_thermal.h"
#include "memory.h" #include "memory.h"
@ -177,6 +178,11 @@ void ComputeRHEOPropertyAtom::init()
fixes = modify->get_fix_by_style("rheo/pressure"); fixes = modify->get_fix_by_style("rheo/pressure");
fix_pressure = dynamic_cast<FixRHEOPressure *>(fixes[0]); fix_pressure = dynamic_cast<FixRHEOPressure *>(fixes[0]);
} }
if (shell_flag) {
fixes = modify->get_fix_by_style("rheo/oxidation");
fix_oxidation = dynamic_cast<FixRHEOOxidation *>(fixes[0]);
}
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
@ -381,6 +387,21 @@ void ComputeRHEOPropertyAtom::pack_pressure(int n)
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void ComputeRHEOPropertyAtom::pack_nbond_shell(int n)
{
int *nbond = fix_oxidation->nbond;
int *mask = atom->mask;
int nlocal = atom->nlocal;
for (int i = 0; i < nlocal; i++) {
if (mask[i] & groupbit) buf[n] = nbond[i];
else buf[n] = 0.0;
n += nvalues;
}
}
/* ---------------------------------------------------------------------- */
void ComputeRHEOPropertyAtom::pack_shift_v(int n) void ComputeRHEOPropertyAtom::pack_shift_v(int n)
{ {
double **vshift = compute_vshift->vshift; double **vshift = compute_vshift->vshift;

View File

@ -63,6 +63,7 @@ class ComputeRHEOPropertyAtom : public Compute {
class FixRHEO *fix_rheo; class FixRHEO *fix_rheo;
class FixRHEOPressure *fix_pressure; class FixRHEOPressure *fix_pressure;
class FixRHEOThermal *fix_thermal; class FixRHEOThermal *fix_thermal;
class FixRHEOOxidation *fix_oxidation;
class ComputeRHEOInterface *compute_interface; class ComputeRHEOInterface *compute_interface;
class ComputeRHEOKernel *compute_kernel; class ComputeRHEOKernel *compute_kernel;
class ComputeRHEOSurface *compute_surface; class ComputeRHEOSurface *compute_surface;

View File

@ -48,12 +48,14 @@ FixRHEO::FixRHEO(LAMMPS *lmp, int narg, char **arg) :
viscosity_fix_defined = 0; viscosity_fix_defined = 0;
pressure_fix_defined = 0; pressure_fix_defined = 0;
thermal_fix_defined = 0; thermal_fix_defined = 0;
oxidation_fix_defined = 0;
thermal_flag = 0; thermal_flag = 0;
rhosum_flag = 0; rhosum_flag = 0;
shift_flag = 0; shift_flag = 0;
interface_flag = 0; interface_flag = 0;
surface_flag = 0; surface_flag = 0;
oxidation_flag = 0;
int i; int i;
int n = atom->ntypes; int n = atom->ntypes;
@ -252,6 +254,7 @@ void FixRHEO::setup(int /*vflag*/)
thermal_fix_defined = 0; thermal_fix_defined = 0;
viscosity_fix_defined = 0; viscosity_fix_defined = 0;
pressure_fix_defined = 0; pressure_fix_defined = 0;
oxidation_fix_defined = 0;
// Check fixes cover all atoms (may still fail if atoms are created) // Check fixes cover all atoms (may still fail if atoms are created)
// FixRHEOPressure currently requires group all // FixRHEOPressure currently requires group all

View File

@ -51,6 +51,7 @@ class FixRHEO : public Fix {
int shift_flag; int shift_flag;
int interface_flag; int interface_flag;
int surface_flag; int surface_flag;
int oxidation_flag;
int viscosity_fix_defined; int viscosity_fix_defined;
int pressure_fix_defined; int pressure_fix_defined;

View File

@ -20,6 +20,7 @@
#include "atom.h" #include "atom.h"
#include "atom_vec.h" #include "atom_vec.h"
#include "compute_rheo_surface.h"
#include "error.h" #include "error.h"
#include "fix_rheo.h" #include "fix_rheo.h"
#include "force.h" #include "force.h"
@ -36,9 +37,9 @@ enum {NONE, CONSTANT};
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) : FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) :
Fix(lmp, narg, arg) //, fix_bond_history(nullptr) Fix(lmp, narg, arg), compute_surface(nullptr), fix_rheo(nullptr)
{ {
if (narg != 5) error->all(FLERR,"Illegal fix command"); if (narg != 6) error->all(FLERR,"Illegal fix command");
cut = utils::numeric(FLERR, arg[3], false, lmp); cut = utils::numeric(FLERR, arg[3], false, lmp);
if (cut <= 0.0) error->all(FLERR, "Illegal bond cutoff {} in fix rheo/oxidation", cut); if (cut <= 0.0) error->all(FLERR, "Illegal bond cutoff {} in fix rheo/oxidation", cut);
@ -46,6 +47,9 @@ FixRHEOOxidation::FixRHEOOxidation(LAMMPS *lmp, int narg, char **arg) :
btype = utils::inumeric(FLERR, arg[4], false, lmp); btype = utils::inumeric(FLERR, arg[4], false, lmp);
if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value {} for bond type in fix rheo/oxidation", btype); if (btype < 1 || btype > atom->nbondtypes) error->all(FLERR, "Illegal value {} for bond type in fix rheo/oxidation", btype);
rsurf = utils::numeric(FLERR, arg[5], false, lmp);
if (rsurf <= 0.0) error->all(FLERR, "Illegal surface distance {} in fix rheo/oxidation", cut);
cutsq = cut * cut; cutsq = cut * cut;
} }
@ -72,22 +76,21 @@ void FixRHEOOxidation::init()
auto fixes = modify->get_fix_by_style("^rheo$"); auto fixes = modify->get_fix_by_style("^rheo$");
if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation"); if (fixes.size() == 0) error->all(FLERR, "Need to define fix rheo to use fix rheo/oxidation");
fix_rheo = dynamic_cast<FixRHEO *>(fixes[0]); fix_rheo = dynamic_cast<FixRHEO *>(fixes[0]);
double cut_kernel = fix_rheo->h;
if (cut > cut_kernel) if (cut > fix_rheo->h)
error->all(FLERR, "Bonding length exceeds kernel cutoff"); error->all(FLERR, "Bonding length exceeds kernel cutoff");
if (rsurf >= fix_rheo->h)
error->all(FLERR, "Surface distance must be less than kernel cutoff");
if (!force->bond) error->all(FLERR, "Must define a bond style with fix rheo/oxidation"); if (!force->bond) error->all(FLERR, "Must define a bond style with fix rheo/oxidation");
if (!atom->avec->bonds_allow) error->all(FLERR, "Fix rheo/oxidation requires atom bonds"); if (!atom->avec->bonds_allow) error->all(FLERR, "Fix rheo/oxidation requires atom bonds");
//// find instances of bond history to delete data int tmp1, tmp2;
//histories = modify->get_fix_by_style("BOND_HISTORY"); index_nb = atom->find_custom("shell_nbond", tmp1, tmp2);
//for (auto &ihistory: histories) if (index_nb == -1)
// if (strcmp(histories[i]->id, "HISTORY_RHEO_SHELL") == 0) error->all(FLERR, "Must use bond style rheo/shell to use fix rheo/oxidation");
// fix_bond_history = dynamic_cast<FixBondHistory *>(ihistory); nbond = atom->ivector[index_nb];
//
//if (!fix_bond_history)
// error->all(FLERR, "Must define bond style rheo/shell to use fix rheo/oxidation");
// need a half neighbor list // need a half neighbor list
auto req = neighbor->add_request(this, NeighConst::REQ_DEFAULT); auto req = neighbor->add_request(this, NeighConst::REQ_DEFAULT);
@ -111,13 +114,14 @@ void FixRHEOOxidation::setup_pre_force(int /*vflag*/)
if (!fix_rheo->surface_flag) error->all(FLERR, if (!fix_rheo->surface_flag) error->all(FLERR,
"fix rheo/oxidation requires surface calculation in fix rheo"); "fix rheo/oxidation requires surface calculation in fix rheo");
compute_surface = fix_rheo->compute_surface;
pre_force(0); pre_force(0);
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
void FixRHEOThermal::pre_force(int /*vflag*/) void FixRHEOOxidation::pre_force(int /*vflag*/)
{ {
} }
@ -135,9 +139,9 @@ void FixRHEOOxidation::post_integrate()
tagint *tag = atom->tag; tagint *tag = atom->tag;
tagint **bond_atom = atom->bond_atom; tagint **bond_atom = atom->bond_atom;
int *status = atom->status;
int **bond_type = atom->bond_type; int **bond_type = atom->bond_type;
int *num_bond = atom->num_bond; int *num_bond = atom->num_bond;
double *rsurface = compute_surface->rsurface;
double **x = atom->x; double **x = atom->x;
inum = list->inum; inum = list->inum;
@ -148,7 +152,7 @@ void FixRHEOOxidation::post_integrate()
// loop over neighbors of my atoms // loop over neighbors of my atoms
for (ii = 0; ii < inum; ii++) { for (ii = 0; ii < inum; ii++) {
i = ilist[ii]; i = ilist[ii];
if (!(status[i] & STATUS_SURFACE)) continue; if (rsurface[i] > rsurf) continue;
tagi = tag[i]; tagi = tag[i];
xtmp = x[i][0]; xtmp = x[i][0];
@ -162,7 +166,7 @@ void FixRHEOOxidation::post_integrate()
j = jlist[jj]; j = jlist[jj];
j &= NEIGHMASK; j &= NEIGHMASK;
if (!(status[j] & STATUS_SURFACE)) continue; if (rsurface[j] > rsurf) continue;
tagj = tag[j]; tagj = tag[j];
delx = xtmp - x[j][0]; delx = xtmp - x[j][0];
@ -208,10 +212,4 @@ void FixRHEOOxidation::post_integrate()
} }
} }
} }
//todo:
// allow option to create near-surface bonds
// extract # of bonds in property/atom
// check bond style shell used, get index to bonds, share with compute property atom
// add type option to compute nbond/atom
} }

View File

@ -36,14 +36,15 @@ class FixRHEOOxidation : public Fix {
void setup_pre_force(int) override; void setup_pre_force(int) override;
void pre_force(int) override; void pre_force(int) override;
void post_integrate() override; void post_integrate() override;
int *nbond;
private: private:
int btype; int btype, index_nb;
double cut, cutsq; double rsurf, cut, cutsq;
class NeighList *list; class NeighList *list;
class ComputeRHEOSurface *compute_surface;
class FixRHEO *fix_rheo; class FixRHEO *fix_rheo;
//class FixBondHistory *fix_bond_history;
}; };
} // namespace LAMMPS_NS } // namespace LAMMPS_NS