diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 5017a949c1..defbe5f2b5 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -58,6 +58,7 @@ OPT. * :doc:`dt/reset (k) ` * :doc:`edpd/source ` * :doc:`efield (k) ` + * :doc:`efield/lepton ` * :doc:`efield/tip4p ` * :doc:`ehex ` * :doc:`electrode/conp (i) ` @@ -69,7 +70,6 @@ OPT. * :doc:`eos/cv ` * :doc:`eos/table ` * :doc:`eos/table/rx (k) ` - * :doc:`epot/lepton ` * :doc:`evaporate ` * :doc:`external ` * :doc:`ffl ` diff --git a/doc/src/fix.rst b/doc/src/fix.rst index bd89dd7f59..c23e541ba1 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -237,6 +237,7 @@ accelerated styles exist. * :doc:`dt/reset ` - reset the timestep based on velocity, forces * :doc:`edpd/source ` - add heat source to eDPD simulations * :doc:`efield ` - impose electric field on system +* :doc:`efield/lepton ` - impose electric field on system using a Lepton expression for the potential * :doc:`efield/tip4p ` - impose electric field on system with TIP4P molecules * :doc:`ehex ` - enhanced heat exchange algorithm * :doc:`electrode/conp ` - impose electric potential @@ -248,7 +249,6 @@ accelerated styles exist. * :doc:`eos/cv ` - applies a mesoparticle equation of state to relate the particle internal energy to the particle internal temperature * :doc:`eos/table ` - applies a tabulated mesoparticle equation of state to relate the particle internal energy to the particle internal temperature * :doc:`eos/table/rx ` - applies a tabulated mesoparticle equation of state to relate the concentration-dependent particle internal energy to the particle internal temperature -* :doc:`epot/lepton ` - apply electric potential on system using Lepton expression * :doc:`evaporate ` - remove atoms from simulation periodically * :doc:`external ` - callback to an external driver program * :doc:`ffl ` - apply a Fast-Forward Langevin equation thermostat diff --git a/doc/src/fix_efield.rst b/doc/src/fix_efield.rst index a870590856..ecdb25fca5 100644 --- a/doc/src/fix_efield.rst +++ b/doc/src/fix_efield.rst @@ -45,8 +45,9 @@ Description Add a force :math:`\vec{F} = q\vec{E}` to each charged atom in the group due to an external electric field being applied to the system. If the system -contains point-dipoles, also add a torque on the dipoles due to the -external electric field. +contains point-dipoles, also add a torque :math:`\vec{T} = \vec{p} \times \vec{E}` on the dipoles due to the +external electric field. This fix does not compute the dipole force :math:`\vec{F} = (\vec{p} \cdot \nabla) \vec{E}`, +and the :doc:`fix efield/lepton ` command should be used instead. .. versionadded:: 28Mar2023 @@ -68,6 +69,7 @@ For point-dipoles, equal-style variables can be used, but atom-style variables are not currently supported, since they imply a spatial gradient in the electric field which means additional terms with gradients of the field are required for the force and torque on dipoles. +The :doc:`fix efield/lepton ` command should be used instead. Equal-style variables can specify formulas with various mathematical functions, and include :doc:`thermo_style ` command @@ -229,7 +231,7 @@ Fix style *efield/tip4p* can only be used with tip4p pair styles. Related commands """""""""""""""" -:doc:`fix addforce ` +:doc:`fix addforce `, :doc:`fix efield/lepton ` Default """"""" diff --git a/doc/src/fix_epot_lepton.rst b/doc/src/fix_efield_lepton.rst similarity index 79% rename from doc/src/fix_epot_lepton.rst rename to doc/src/fix_efield_lepton.rst index 4a9b4a8669..607a2ec8c5 100644 --- a/doc/src/fix_epot_lepton.rst +++ b/doc/src/fix_efield_lepton.rst @@ -1,138 +1,143 @@ -.. index:: fix epot/lepton - -fix epot/lepton command -======================= - -Syntax -"""""" - -.. code-block:: LAMMPS - - fix ID group-ID epot/lepton V ... - -* ID, group-ID are documented in the :doc:`fix ` command -* style = *epot/lepton* -* V = electric potential (electric field * distance units) -* V must be a Lepton expression (see below) -* zero or more keyword/value pairs may be appended to args -* keyword = *region* or *step* - - .. parsed-literal:: - - *region* value = region-ID - region-ID = ID of region atoms must be in to have effect - *step* value = h - h = step size for numerical differentiation (distance units) - -Examples -"""""""" - -.. code-block:: LAMMPS - - fix ex all epot/lepton "-E*x; E=1" - fix dexx all epot/lepton "-0.5*x^2" step 1 - fix yukawa all epot/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" step 1e-6 - fix infp all epot/lepton "-abs(x)" step 1 - - variable th equal 2*PI*ramp(0,1) - fix erot all epot/lepton "-(x*cos(v_th)+y*sin(v_th))" - -Description -""""""""""" - -.. versionadded:: TBD - -Add an electric potential :math:`V` that applies to a group of charged atoms a force :math:`\vec{F} = q \vec{E}`, -and to dipoles a force :math:`\vec{F} = (\vec{p} \cdot \nabla) \vec{E}` and torque :math:`\vec{T} = \vec{p} \times \vec{E}`, -where :math:`\vec{E} = - \nabla V`. The fix also evaluates the electrostatic energy (:math:`U_{q} = q V` and :math:`U_{p} = - \vec{p} \cdot \vec{E}`) -due to this potential when the :doc:`fix_modify energy yes ` command is specified (see below). - -The `Lepton library `_, that the *epot/lepton* fix style interfaces with, evaluates -the expression string at run time to compute the energy, forces, and torques. It creates an analytical representation -of :math:`V` and :math:`\vec{E}`, while the gradient force is computed using a central difference scheme - -.. math:: - - \vec{F} = \frac{|\vec{p}|}{2h} \left[ \vec{E}(\vec{x} + h \hat{p}) - \vec{E}(\vec{x} - h \hat{p}) \right] . - -The Lepton expression must be either enclosed in quotes or must not contain any whitespace so that LAMMPS -recognizes it as a single keyword. More on valid Lepton expressions below. The final Lepton expression must -be a function of only :math:`x, y, z`, which refer to the current *unwrapped* coordinates of the atoms to ensure continuity. -Special care must be taken when using this fix with periodic boundary conditions or box-changing commands. - ----------- - -.. include:: lepton_expression.rst - ----------- - -If the *region* keyword is used, the atom must also be in the specified -geometric :doc:`region ` in order to be affected by the potential. - -The *step* keyword is required when :doc:`atom_style dipole ` is used and the electric field is non-uniform. -If you only want to apply a uniform electric field, the :doc:`fix efield ` command will be faster. - ----------- - -Restart, fix_modify, output, run start/stop, minimize info -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -No information about this fix is written to :doc:`binary restart files -`. - -The :doc:`fix_modify ` *energy* option is supported by this -fix to add the potential energy defined above to the global potential energy -of the system as part of :doc:`thermodynamic output `. -The default setting for this fix is :doc:`fix_modify energy no `. - -The :doc:`fix_modify ` *virial* option is supported by this -fix to add the contribution due to the added ***forces*** on charges and dipoles -to both the global pressure and per-atom stress of the system via the -:doc:`compute pressure ` and :doc:`compute stress/atom -` commands. The former can be accessed by -:doc:`thermodynamic output `. The default setting for -this fix is :doc:`fix_modify virial no `. - -The :doc:`fix_modify ` *respa* option is supported by this -fix. This allows to set at which level of the :doc:`r-RESPA ` -integrator the fix adding its forces. Default is the outermost level. - -This fix computes a global scalar and a global 3-vector of forces, -which can be accessed by various :doc:`output commands `. -The scalar is the potential energy discussed above. -The vector is the total force added to the group of atoms. -The scalar and vector values calculated by this fix are "extensive". - -This fix cannot be used with the *start/stop* keywords of -the :doc:`run ` command. - -The forces due to this fix are imposed during an energy minimization, -invoked by the :doc:`minimize ` command. You should not -specify force components with a variable that has time-dependence for -use with a minimizer, since the minimizer increments the timestep as -the iteration count during the minimization. - -.. note:: - - If you want the electric potential energy to be included in the - total potential energy of the system (the quantity being minimized), - you MUST enable the :doc:`fix_modify ` *energy* option for this fix. - ----------- - -Restrictions -"""""""""""" - -Fix style *epot/lepton* is part of the LEPTON package. It is only enabled if LAMMPS was built with that package. -See the :doc:`Build package ` page for more info. - - -Related commands -"""""""""""""""" - -:doc:`fix efield ` - -Default -""""""" - -none +.. index:: fix efield/lepton + +fix efield/lepton command +========================= + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID efield/lepton V ... + +* ID, group-ID are documented in the :doc:`fix ` command +* style = *efield/lepton* +* V = electric potential (electric field * distance units) +* V must be a Lepton expression (see below) +* zero or more keyword/value pairs may be appended to args +* keyword = *region* or *step* + + .. parsed-literal:: + + *region* value = region-ID + region-ID = ID of region atoms must be in to have effect + *step* value = h + h = step size for numerical differentiation (distance units) + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix ex all efield/lepton "-E*x; E=1" + fix dexx all efield/lepton "-0.5*x^2" step 1 + fix yukawa all efield/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" step 1e-6 + fix infp all efield/lepton "-abs(x)" step 1 + + variable th equal 2*PI*ramp(0,1) + fix erot all efield/lepton "-(x*cos(v_th)+y*sin(v_th))" + +Description +""""""""""" + +.. versionadded:: TBD + +Add an electric potential :math:`V` that applies to a group of charged atoms a force :math:`\vec{F} = q \vec{E}`, +and to dipoles a force :math:`\vec{F} = (\vec{p} \cdot \nabla) \vec{E}` and torque :math:`\vec{T} = \vec{p} \times \vec{E}`, +where :math:`\vec{E} = - \nabla V`. The fix also evaluates the electrostatic energy (:math:`U_{q} = q V` and :math:`U_{p} = - \vec{p} \cdot \vec{E}`) +due to this potential when the :doc:`fix_modify energy yes ` command is specified (see below). + +.. note:: + + This command should be used instead of :doc:`fix efield ` if you want to impose a non-uniform electric field on a system with dipoles + since the latter does not include the dipole force term. If you only have charges or if the electric field gradient is negligible, + :doc:`fix efield ` should be used since it is faster. + +The `Lepton library `_, that the *efield/lepton* fix style interfaces with, evaluates +the expression string at run time to compute the energy, forces, and torques. It creates an analytical representation +of :math:`V` and :math:`\vec{E}`, while the gradient force is computed using a central difference scheme + +.. math:: + + \vec{F} = \frac{|\vec{p}|}{2h} \left[ \vec{E}(\vec{x} + h \hat{p}) - \vec{E}(\vec{x} - h \hat{p}) \right] . + +The Lepton expression must be either enclosed in quotes or must not contain any whitespace so that LAMMPS +recognizes it as a single keyword. More on valid Lepton expressions below. The final Lepton expression must +be a function of only :math:`x, y, z`, which refer to the current *unwrapped* coordinates of the atoms to ensure continuity. +Special care must be taken when using this fix with periodic boundary conditions or box-changing commands. + +---------- + +.. include:: lepton_expression.rst + +---------- + +If the *region* keyword is used, the atom must also be in the specified +geometric :doc:`region ` in order to be affected by the potential. + +The *step* keyword is required when :doc:`atom_style dipole ` is used and the electric field is non-uniform. + +---------- + +Restart, fix_modify, output, run start/stop, minimize info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +No information about this fix is written to :doc:`binary restart files +`. + +The :doc:`fix_modify ` *energy* option is supported by this +fix to add the potential energy defined above to the global potential energy +of the system as part of :doc:`thermodynamic output `. +The default setting for this fix is :doc:`fix_modify energy no `. + +The :doc:`fix_modify ` *virial* option is supported by this +fix to add the contribution due to the added ***forces*** on charges and dipoles +to both the global pressure and per-atom stress of the system via the +:doc:`compute pressure ` and :doc:`compute stress/atom +` commands. The former can be accessed by +:doc:`thermodynamic output `. The default setting for +this fix is :doc:`fix_modify virial no `. + +The :doc:`fix_modify ` *respa* option is supported by this +fix. This allows to set at which level of the :doc:`r-RESPA ` +integrator the fix adding its forces. Default is the outermost level. + +This fix computes a global scalar and a global 3-vector of forces, +which can be accessed by various :doc:`output commands `. +The scalar is the potential energy discussed above. +The vector is the total force added to the group of atoms. +The scalar and vector values calculated by this fix are "extensive". + +This fix cannot be used with the *start/stop* keywords of +the :doc:`run ` command. + +The forces due to this fix are imposed during an energy minimization, +invoked by the :doc:`minimize ` command. You should not +specify force components with a variable that has time-dependence for +use with a minimizer, since the minimizer increments the timestep as +the iteration count during the minimization. + +.. note:: + + If you want the electric potential energy to be included in the + total potential energy of the system (the quantity being minimized), + you MUST enable the :doc:`fix_modify ` *energy* option for this fix. + +---------- + +Restrictions +"""""""""""" + +Fix style *efield/lepton* is part of the LEPTON package. It is only enabled if LAMMPS was built with that package. +See the :doc:`Build package ` page for more info. + + +Related commands +"""""""""""""""" + +:doc:`fix efield ` + +Default +""""""" + +none diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index ffbfecfef4..0708a14882 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1020,7 +1020,6 @@ eos epair epcc epl -epot Epp Epq eps diff --git a/examples/LEPTON/in.efield-lepton b/examples/LEPTON/in.efield-lepton new file mode 100644 index 0000000000..04ac5954ba --- /dev/null +++ b/examples/LEPTON/in.efield-lepton @@ -0,0 +1,49 @@ +# Point dipoles in a 3d box with an external potential (ignoring dipolar interactions) + +units lj +atom_style hybrid sphere dipole +dimension 3 +boundary s s s +region box block -2 2 -2 2 -2 2 + +create_box 1 box +create_atoms 1 random 100 12345 NULL + +# need both mass settings due to hybrid atom style +mass 1 1.0 +set group all mass 1.0 +set group all diameter 0.1 + +set group all dipole/random 98934 0.01 +pair_style none + +velocity all create 0.0 87287 mom yes rot yes + +fix 1 all nve/sphere update dipole + +############################################################################################################### +## Yukawa potential +#fix 2 all efield/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A = 0.1; B = 5" step 1e-8 + +## Gradually increasing uniform field +#variable E equal ramp(0,1) +#fix 2 all efield/lepton "-v_E*(x+y+z)" + +## Linear gradient field +fix 2 all efield/lepton "-1/6*x^3" step 1e-6 + +fix_modify 2 energy yes + +############################################################################################################### + +timestep 1e-3 + +compute erot all erotate/sphere +variable etotal equal "ke + c_erot + pe" # thermo etotal doesn't include erot +thermo_style custom step temp ke c_erot pe v_etotal +thermo 500 +thermo_modify norm no + +#dump 1 all custom 500 dump.dipole id x y z diameter mux muy muz fx fy fz tqx tqy tqz + +run 10000 diff --git a/src/.gitignore b/src/.gitignore index e476c5ecf4..a82d747fee 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -95,8 +95,8 @@ /angle_lepton.h /dihedral_lepton.cpp /dihedral_lepton.h -/fix_epot_lepton.cpp -/fix_epot_lepton.h +/fix_efield_lepton.cpp +/fix_efield_lepton.h /fix_wall_lepton.cpp /fix_wall_lepton.h /lepton_utils.cpp diff --git a/src/LEPTON/fix_epot_lepton.cpp b/src/LEPTON/fix_epot_lepton.cpp deleted file mode 100644 index f0ead28b7e..0000000000 --- a/src/LEPTON/fix_epot_lepton.cpp +++ /dev/null @@ -1,495 +0,0 @@ -/* ---------------------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- - Contributing author: Gabriel Alkuino (Syracuse University) - gsalkuin@syr.edu - Modified from fix_efield -------------------------------------------------------------------------- */ - -#include "fix_epot_lepton.h" - -#include "atom.h" -#include "comm.h" -#include "domain.h" -#include "error.h" -#include "force.h" -#include "input.h" -#include "modify.h" -#include "region.h" -#include "respa.h" -#include "update.h" - -#include - -#include "Lepton.h" -#include "lepton_utils.h" - -using namespace LAMMPS_NS; -using namespace FixConst; - -#define EPSILON 1.0e-10 - -/* ---------------------------------------------------------------------- */ - -FixEpotLepton::FixEpotLepton(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), idregion(nullptr), region(nullptr) -{ - if (domain->xperiodic || domain->yperiodic || domain->zperiodic) { - error->warning(FLERR, "Fix {} uses unwrapped coordinates", style); - } - if (narg < 4) utils::missing_cmd_args(FLERR, std::string("fix ") + style, error); - - scalar_flag = 1; - global_freq = 1; - extscalar = 1; - energy_global_flag = 1; - virial_global_flag = virial_peratom_flag = 1; - respa_level_support = 1; - ilevel_respa = 0; - - // optional args - int iarg = 4; - while (iarg < narg) { - if (strcmp(arg[iarg], "region") == 0) { - if (iarg + 2 > narg) - utils::missing_cmd_args(FLERR, std::string("fix ") + style + " region", error); - region = domain->get_region_by_id(arg[iarg + 1]); - if (!region) error->all(FLERR, "Region {} for fix {} does not exist", arg[iarg + 1], style); - idregion = utils::strdup(arg[iarg + 1]); - iarg += 2; - } else if (strcmp(arg[iarg], "step") == 0) { - if (iarg + 2 > narg) - utils::missing_cmd_args(FLERR, std::string("fix ") + style + "step", error); - h = utils::numeric(FLERR, arg[iarg+1], false, lmp); - iarg += 2; - } else { - error->all(FLERR, "Unknown keyword for fix {} command: {}", style, arg[iarg]); - } - } - - // check validity of Lepton expression - // remove whitespace and quotes from expression string and then - // check if the expression can be parsed without error - expr = LeptonUtils::condense(arg[3]); - try { - auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)); - auto phi = parsed.createCompiledExpression(); - } catch (std::exception &e) { - error->all(FLERR, e.what()); - } - - force_flag = 0; - fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; -} - -/* ---------------------------------------------------------------------- */ - -FixEpotLepton::~FixEpotLepton() -{ - delete[] idregion; -} - -/* ---------------------------------------------------------------------- */ - -int FixEpotLepton::setmask() -{ - int mask = 0; - mask |= POST_FORCE; - mask |= POST_FORCE_RESPA; - mask |= MIN_POST_FORCE; - return mask; -} - -/* ---------------------------------------------------------------------- */ - -void FixEpotLepton::init() -{ - if (!atom->q_flag && !atom->mu_flag) - error->all(FLERR, "Fix {} requires atom attribute q or mu", style); - if (atom->mu_flag && !atom->torque_flag) - error->all(FLERR, "Dipoles must be finite-sized to rotate", style); - - // set index and check validity of region - if (idregion) { - region = domain->get_region_by_id(idregion); - if (!region) error->all(FLERR, "Region {} for fix {} does not exist", idregion, style); - } - - if (utils::strmatch(update->integrate_style, "^respa")) { - ilevel_respa = (dynamic_cast(update->integrate))->nlevels - 1; - if (respa_level >= 0) ilevel_respa = MIN(respa_level, ilevel_respa); - } - - // unit conversion factors and restrictions (see issue #1377) - char *unit_style = update->unit_style; - qe2f = force->qe2f; - mue2e = qe2f; - if (strcmp(unit_style, "electron") == 0 || strcmp(unit_style, "micro") == 0 || strcmp(unit_style, "nano") == 0) { - error->all(FLERR, "Fix {} does not support {} units", style, unit_style); - } -} - -/* ---------------------------------------------------------------------- */ - -void FixEpotLepton::setup(int vflag) -{ - if (utils::strmatch(update->integrate_style, "^respa")) { - auto respa = dynamic_cast(update->integrate); - respa->copy_flevel_f(ilevel_respa); - post_force_respa(vflag, ilevel_respa, 0); - respa->copy_f_flevel(ilevel_respa); - } else { - post_force(vflag); - } -} - -/* ---------------------------------------------------------------------- */ - -void FixEpotLepton::min_setup(int vflag) -{ - post_force(vflag); -} - -/* ---------------------------------------------------------------------- - Apply F = qE, - F = (mu . D) E, - T = mu x E -------------------------------------------------------------------------- */ - -void FixEpotLepton::post_force(int vflag) -{ - double **f = atom->f; - double **x = atom->x; - int *mask = atom->mask; - imageint *image = atom->image; - int nlocal = atom->nlocal; - - auto parsed = Lepton::Parser::parse(LeptonUtils::substitute(expr, lmp)).optimize(); - Lepton::CompiledExpression phi; - auto dphi_x = parsed.differentiate("x").createCompiledExpression(); - auto dphi_y = parsed.differentiate("y").createCompiledExpression(); - auto dphi_z = parsed.differentiate("z").createCompiledExpression(); - std::vector dphis = {&dphi_x, &dphi_y, &dphi_z}; - - // check if reference to x, y, z exist - const std::array variableNames = {"x", "y", "z"}; - std::array phi_has_ref = {true, true, true}; - if (atom->q_flag){ - phi = parsed.createCompiledExpression(); - for (size_t i = 0; i < 3; i++) { - try { - phi.getVariableReference(variableNames[i]); - } - catch (Lepton::Exception &) { - phi_has_ref[i] = false; - } - } - } - std::vector> dphis_has_ref; - bool e_uniform = true; - for (auto &dphi : dphis) { - dphis_has_ref.push_back({false, false, false}); - for (size_t i = 0; i < 3; i++) { - try { - (*dphi).getVariableReference(variableNames[i]); - dphis_has_ref.back()[i] = true; - e_uniform = false; - } - catch (Lepton::Exception &) { - // do nothing - } - } - } - if (!e_uniform && atom->mu_flag && h < 0) { - error->all(FLERR, "Fix {} requires keyword `step' for dipoles in a non-uniform electric field", style); - } - - // virial setup - v_init(vflag); - - // update region if necessary - if (region) region->prematch(); - - // fsum[0] = "potential energy" for added force - // fsum[123] = extra force added to atoms - fsum[0] = fsum[1] = fsum[2] = fsum[3] = 0.0; - force_flag = 0; - - double ex, ey, ez; - double fx, fy, fz; - double v[6], unwrap[3]; - double xf, yf, zf, xb, yb, zb; - double exf, eyf, ezf, exb, eyb, ezb; - double tx, ty, tz; - double mu_norm, h_mu; - - if (atom->q_flag && atom->mu_flag) { - double *q = atom->q; - double **mu = atom->mu; - double **t = atom->torque; - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; - domain->unmap(x[i], image[i], unwrap); - - // evaluate e-field, used by q and mu - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = unwrap[0]; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = unwrap[1]; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = unwrap[2]; - } - ex = -dphi_x.evaluate(); - ey = -dphi_y.evaluate(); - ez = -dphi_z.evaluate(); - - if (phi_has_ref[0]) phi.getVariableReference("x") = unwrap[0]; - if (phi_has_ref[1]) phi.getVariableReference("y") = unwrap[1]; - if (phi_has_ref[2]) phi.getVariableReference("z") = unwrap[2]; - - // charges - // force = q E - fx = qe2f * q[i] * ex; - fy = qe2f * q[i] * ey; - fz = qe2f * q[i] * ez; - // potential energy = q phi - fsum[0] += qe2f * q[i] * phi.evaluate(); - - // dipoles - mu_norm = sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]); - if (mu_norm > EPSILON) { - // torque = mu cross E - t[i][0] += mue2e * (ez * mu[i][1] - ey * mu[i][2]); - t[i][1] += mue2e * (ex * mu[i][2] - ez * mu[i][0]); - t[i][2] += mue2e * (ey * mu[i][0] - ex * mu[i][1]); - // potential energy = - mu dot E - fsum[0] -= mue2e * (mu[i][0] * ex + mu[i][1] * ey + mu[i][2] * ez); - - // force = (mu dot D) E - // using central difference method - h_mu = h / mu_norm; - - xf = unwrap[0] + h_mu * mu[i][0]; - yf = unwrap[1] + h_mu * mu[i][1]; - zf = unwrap[2] + h_mu * mu[i][2]; - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = xf; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = yf; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = zf; - } - exf = -dphi_x.evaluate(); - eyf = -dphi_y.evaluate(); - ezf = -dphi_z.evaluate(); - - xb = unwrap[0] - h_mu * mu[i][0]; - yb = unwrap[1] - h_mu * mu[i][1]; - zb = unwrap[2] - h_mu * mu[i][2]; - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = xb; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = yb; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = zb; - } - exb = -dphi_x.evaluate(); - eyb = -dphi_y.evaluate(); - ezb = -dphi_z.evaluate(); - - fx += qe2f * (exf - exb) / 2.0 / h_mu; - fy += qe2f * (eyf - eyb) / 2.0 / h_mu; - fz += qe2f * (ezf - ezb) / 2.0 / h_mu; - } - - f[i][0] += fx; - f[i][1] += fy; - f[i][2] += fz; - - fsum[1] += fx; - fsum[2] += fy; - fsum[3] += fz; - - if (evflag) { - v[0] = fx * unwrap[0]; - v[1] = fy * unwrap[1]; - v[2] = fz * unwrap[2]; - v[3] = fx * unwrap[1]; - v[4] = fx * unwrap[2]; - v[5] = fy * unwrap[2]; - v_tally(i, v); - } - } - } - } else if (atom->q_flag && !atom->mu_flag) { - double *q = atom->q; - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; - domain->unmap(x[i], image[i], unwrap); - - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = unwrap[0]; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = unwrap[1]; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = unwrap[2]; - } - ex = -dphi_x.evaluate(); - ey = -dphi_y.evaluate(); - ez = -dphi_z.evaluate(); - - if (phi_has_ref[0]) phi.getVariableReference("x") = unwrap[0]; - if (phi_has_ref[1]) phi.getVariableReference("y") = unwrap[1]; - if (phi_has_ref[2]) phi.getVariableReference("z") = unwrap[2]; - - // force = q E - fx = qe2f * q[i] * ex; - fy = qe2f * q[i] * ey; - fz = qe2f * q[i] * ez; - // potential energy = q phi - fsum[0] += qe2f * q[i] * phi.evaluate(); - - f[i][0] += fx; - f[i][1] += fy; - f[i][2] += fz; - - fsum[1] += fx; - fsum[2] += fy; - fsum[3] += fz; - - if (evflag) { - v[0] = fx * unwrap[0]; - v[1] = fy * unwrap[1]; - v[2] = fz * unwrap[2]; - v[3] = fx * unwrap[1]; - v[4] = fx * unwrap[2]; - v[5] = fy * unwrap[2]; - v_tally(i, v); - } - } - } - } else if (!atom->q_flag && atom->mu_flag) { - double **mu = atom->mu; - double **t = atom->torque; - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - if (region && !region->match(x[i][0], x[i][1], x[i][2])) continue; - - mu_norm = sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]); - if (mu_norm > EPSILON) continue; - - domain->unmap(x[i], image[i], unwrap); - - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = unwrap[0]; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = unwrap[1]; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = unwrap[2]; - } - ex = -dphi_x.evaluate(); - ey = -dphi_y.evaluate(); - ez = -dphi_z.evaluate(); - - // torque = mu cross E - t[i][0] += mue2e * (ez * mu[i][1] - ey * mu[i][2]); - t[i][1] += mue2e * (ex * mu[i][2] - ez * mu[i][0]); - t[i][2] += mue2e * (ey * mu[i][0] - ex * mu[i][1]); - // potential energy = - mu dot E - fsum[0] -= mue2e * (mu[i][0] * ex + mu[i][1] * ey + mu[i][2] * ez); - - // force = (mu dot D) E - // using central difference method - h_mu = h / sqrt(mu[i][0]*mu[i][0] + mu[i][1]*mu[i][1] + mu[i][2]*mu[i][2]); - - xf = unwrap[0] + h_mu * mu[i][0]; - yf = unwrap[1] + h_mu * mu[i][1]; - zf = unwrap[2] + h_mu * mu[i][2]; - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = xf; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = yf; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = zf; - } - exf = -dphi_x.evaluate(); - eyf = -dphi_y.evaluate(); - ezf = -dphi_z.evaluate(); - - xb = unwrap[0] - h_mu * mu[i][0]; - yb = unwrap[1] - h_mu * mu[i][1]; - zb = unwrap[2] - h_mu * mu[i][2]; - for (size_t j = 0; j < 3; j++) { - if (dphis_has_ref[j][0]) (*dphis[j]).getVariableReference("x") = xb; - if (dphis_has_ref[j][1]) (*dphis[j]).getVariableReference("y") = yb; - if (dphis_has_ref[j][2]) (*dphis[j]).getVariableReference("z") = zb; - } - exb = -dphi_x.evaluate(); - eyb = -dphi_y.evaluate(); - ezb = -dphi_z.evaluate(); - - fx = qe2f * (exf - exb) / 2.0 / h_mu; - fy = qe2f * (eyf - eyb) / 2.0 / h_mu; - fz = qe2f * (ezf - ezb) / 2.0 / h_mu; - - f[i][0] += fx; - f[i][1] += fy; - f[i][2] += fz; - - fsum[1] += fx; - fsum[2] += fy; - fsum[3] += fz; - - if (evflag) { - v[0] = fx * unwrap[0]; - v[1] = fy * unwrap[1]; - v[2] = fz * unwrap[2]; - v[3] = fx * unwrap[1]; - v[4] = fx * unwrap[2]; - v[5] = fy * unwrap[2]; - v_tally(i, v); - } - } - } - } -} - -/* ---------------------------------------------------------------------- */ - -void FixEpotLepton::post_force_respa(int vflag, int ilevel, int /*iloop*/) -{ - if (ilevel == ilevel_respa) post_force(vflag); -} - -/* ---------------------------------------------------------------------- */ - -void FixEpotLepton::min_post_force(int vflag) -{ - post_force(vflag); -} - -/* ---------------------------------------------------------------------- - return energy added by fix -------------------------------------------------------------------------- */ - -double FixEpotLepton::compute_scalar() -{ - if (force_flag == 0) { - MPI_Allreduce(fsum, fsum_all, 4, MPI_DOUBLE, MPI_SUM, world); - force_flag = 1; - } - return fsum_all[0]; -} - -/* ---------------------------------------------------------------------- - return total extra force due to fix -------------------------------------------------------------------------- */ - -double FixEpotLepton::compute_vector(int n) -{ - if (force_flag == 0) { - MPI_Allreduce(fsum, fsum_all, 4, MPI_DOUBLE, MPI_SUM, world); - force_flag = 1; - } - return fsum_all[n + 1]; -} diff --git a/src/LEPTON/fix_epot_lepton.h b/src/LEPTON/fix_epot_lepton.h deleted file mode 100644 index d4f12915fa..0000000000 --- a/src/LEPTON/fix_epot_lepton.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- c++ -*- ---------------------------------------------------------- - LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator - https://www.lammps.org/, Sandia National Laboratories - LAMMPS development team: developers@lammps.org - - Copyright (2003) Sandia Corporation. Under the terms of Contract - DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains - certain rights in this software. This software is distributed under - the GNU General Public License. - - See the README file in the top-level LAMMPS directory. -------------------------------------------------------------------------- */ - -/* ---------------------------------------------------------------------- -Contributing author: Gabriel Alkuino (Syracuse University) - gsalkuin@syr.edu -Modified from fix_efield -------------------------------------------------------------------------- */ - -#ifdef FIX_CLASS -// clang-format off -FixStyle(epot/lepton,FixEpotLepton); -// clang-format on -#else - -#ifndef LMP_FIX_EPOT_LEPTON_H -#define LMP_FIX_EPOT_LEPTON_H - -#include "fix.h" - -namespace LAMMPS_NS { - -class FixEpotLepton : public Fix { - - public: - FixEpotLepton(class LAMMPS *, int, char **); - ~FixEpotLepton() override; - int setmask() override; - void init() override; - void setup(int) override; - void min_setup(int) override; - void post_force(int) override; - void post_force_respa(int, int, int) override; - void min_post_force(int) override; - double compute_scalar() override; - double compute_vector(int) override; - - protected: - char *idregion; - class Region *region; - int ilevel_respa; - std::string expr; - - int force_flag; - double h = -1.0; - double qe2f, mue2e; - double fsum[4], fsum_all[4]; -}; -} // namespace LAMMPS_NS -#endif -#endif diff --git a/unittest/force-styles/tests/fix-timestep-epot_lepton.yaml b/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml similarity index 95% rename from unittest/force-styles/tests/fix-timestep-epot_lepton.yaml rename to unittest/force-styles/tests/fix-timestep-efield_lepton.yaml index 0884ae895f..c6f80af274 100644 --- a/unittest/force-styles/tests/fix-timestep-epot_lepton.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_lepton.yaml @@ -1,77 +1,78 @@ ---- -lammps_version: 27 Jun 2024 -date_generated: Tue Sep 17 08:38:51 2024 -epsilon: 2e-13 -skip_tests: -prerequisites: ! | - atom full - fix efield -pre_commands: ! "" -post_commands: ! | - region half block 0 EDGE EDGE EDGE EDGE EDGE - fix move all nve - fix test solute epot/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" -input_file: in.fourmol -natoms: 29 -global_scalar: 1.6704454516566274 -run_pos: ! |2 - 1 -2.7045174040786113e-01 2.4911873718363386e+00 -1.6695654631491835e-01 - 2 3.1004221019407835e-01 2.9612623619618166e+00 -8.5467074498303619e-01 - 3 -7.0398277208953364e-01 1.2305442007296870e+00 -6.2777337959095758e-01 - 4 -1.5818277418447926e+00 1.4837528245352911e+00 -1.2538808796681880e+00 - 5 -9.0729118448236790e-01 9.2661863916543652e-01 3.9958383542336978e-01 - 6 2.4837968642651539e-01 2.8318965710323424e-01 -1.2316675533799510e+00 - 7 3.4143233737928985e-01 -2.2652080889821399e-02 -2.5292246648830696e+00 - 8 1.1742106633496632e+00 -4.8857819177533296e-01 -6.3774855832878818e-01 - 9 1.3804619006746952e+00 -2.5282186304504617e-01 2.8361638661486044e-01 - 10 2.0510714422715428e+00 -1.4603992238436605e+00 -9.8323613298241641e-01 - 11 1.7878067664442001e+00 -1.9921902225913919e+00 -1.8890639278278800e+00 - 12 3.0062962291402449e+00 -4.9013271581056822e-01 -1.6231874104184338e+00 - 13 4.0515414154880354e+00 -8.9202039400328714e-01 -1.6400010189207204e+00 - 14 2.6066986955414859e+00 -4.1789289874186603e-01 -2.6634027530740045e+00 - 15 2.9695346087268195e+00 5.5422728642528218e-01 -1.2342046800948778e+00 - 16 2.6747089246970055e+00 -2.4124172919180635e+00 -2.3435358040545039e-02 - 17 2.2153515161424591e+00 -2.0897925974376559e+00 1.1963115055447653e+00 - 18 2.1369701703995672e+00 3.0158507413483879e+00 -3.5179348337128169e+00 - 19 1.5355837136075503e+00 2.6255292355356850e+00 -4.2353987779858899e+00 - 20 2.7727573005675157e+00 3.6923910449606199e+00 -3.9330842459130921e+00 - 21 4.9040128073216458e+00 -4.0752348172972228e+00 -3.6210314709902178e+00 - 22 4.3582355554441330e+00 -4.2126119427287785e+00 -4.4612844196314905e+00 - 23 5.7439382849308398e+00 -3.5821957939275575e+00 -3.8766361295936442e+00 - 24 2.0689243582420707e+00 3.1513346907257525e+00 3.1550389754825381e+00 - 25 1.3045351331495809e+00 3.2665125705836533e+00 2.5111855257438469e+00 - 26 2.5809237402711407e+00 4.0117602605482343e+00 3.2212060529090203e+00 - 27 -1.9611343130355228e+00 -4.3563411931353464e+00 2.1098293115521636e+00 - 28 -2.7473562684513140e+00 -4.0200819932378886e+00 1.5830052163433823e+00 - 29 -1.3126000191359133e+00 -3.5962518039481126e+00 2.2746342468736911e+00 -run_vel: ! |2 - 1 8.1748902719248895e-03 1.6488825063890555e-02 4.7920575746796803e-03 - 2 5.4511084007743318e-03 5.2051261388670498e-03 -1.4434422725438370e-03 - 3 -8.2274804663814219e-03 -1.2934351097927732e-02 -4.0974640813287184e-03 - 4 -3.7810439919825625e-03 -6.5599673887508873e-03 -1.1281975069807595e-03 - 5 -1.1114610957297140e-02 -9.7941960094448405e-03 -2.8000606969231651e-03 - 6 -3.9614471141667384e-02 4.6885125158393097e-02 3.6916688468892268e-02 - 7 9.0823633550694307e-04 -1.0137209973964618e-02 -5.1576821598862101e-02 - 8 7.7662077312228937e-03 -3.3034358179113549e-03 3.4641870510036560e-02 - 9 1.9711566942801151e-03 3.6632927647716452e-03 1.5119486507285342e-02 - 10 2.9189761590759169e-02 -2.9234948386605512e-02 -1.5014329233453094e-02 - 11 -4.7800378310285741e-03 -3.7519133265433713e-03 -2.3499734597008941e-03 - 12 2.2651912734175032e-03 -3.4688766322378106e-04 -3.0617028612628929e-03 - 13 2.7541524307768692e-03 5.8168212242409026e-03 -7.9509320189794788e-04 - 14 3.5269195768251409e-03 -5.7943367272026312e-03 -3.9501557653067150e-03 - 15 -1.8489707819649144e-03 -5.8542853523402688e-03 6.2913780244787517e-03 - 16 1.8687298458400135e-02 -1.3267695591612149e-02 -4.5638131306342533e-02 - 17 -1.2902476276599238e-02 9.7586450769834993e-03 3.7292773489970149e-02 - 18 -8.0065797284243809e-04 -8.6270476160336701e-04 -1.4483040521307380e-03 - 19 1.2452390811276265e-03 -2.5061097157054544e-03 7.2998631050251199e-03 - 20 3.5930060220586732e-03 3.6938860299406654e-03 3.2322732694668697e-03 - 21 -1.4689220345082588e-03 -2.7352130061578030e-04 7.0581623990333337e-04 - 22 -7.0694199253619090e-03 -4.2577148926459460e-03 2.8079117595322244e-04 - 23 6.0446963119181341e-03 -1.4000131615895693e-03 2.5819754845648850e-03 - 24 3.1926367864219455e-04 -9.9445665025542493e-04 1.4999996888246658e-04 - 25 1.3789754587624503e-04 -4.4335894897561037e-03 -8.1808136628206090e-04 - 26 2.0485904035354775e-03 2.7813358632583834e-03 4.3245727149805969e-03 - 27 4.5604120337294426e-04 -1.0305523013893942e-03 2.1188058337867958e-04 - 28 -6.2544520861285771e-03 1.4127711177082084e-03 -1.8429821885090839e-03 - 29 6.4110631550796319e-04 3.1273432723457764e-03 3.7253671103666878e-03 -... +--- +lammps_version: 29 Aug 2024 +tags: generated +date_generated: Tue Nov 12 08:53:18 2024 +epsilon: 2e-13 +skip_tests: +prerequisites: ! | + atom full + fix efield +pre_commands: ! "" +post_commands: ! | + region half block 0 EDGE EDGE EDGE EDGE EDGE + fix move all nve + fix test solute efield/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" +input_file: in.fourmol +natoms: 29 +global_scalar: 1.6704454516566274 +run_pos: ! |2 + 1 -2.7045174040786113e-01 2.4911873718363386e+00 -1.6695654631491835e-01 + 2 3.1004221019407835e-01 2.9612623619618166e+00 -8.5467074498303619e-01 + 3 -7.0398277208953364e-01 1.2305442007296870e+00 -6.2777337959095758e-01 + 4 -1.5818277418447926e+00 1.4837528245352911e+00 -1.2538808796681880e+00 + 5 -9.0729118448236790e-01 9.2661863916543652e-01 3.9958383542336978e-01 + 6 2.4837968642651539e-01 2.8318965710323424e-01 -1.2316675533799510e+00 + 7 3.4143233737928985e-01 -2.2652080889821399e-02 -2.5292246648830696e+00 + 8 1.1742106633496632e+00 -4.8857819177533296e-01 -6.3774855832878818e-01 + 9 1.3804619006746952e+00 -2.5282186304504617e-01 2.8361638661486044e-01 + 10 2.0510714422715428e+00 -1.4603992238436605e+00 -9.8323613298241641e-01 + 11 1.7878067664442001e+00 -1.9921902225913919e+00 -1.8890639278278800e+00 + 12 3.0062962291402449e+00 -4.9013271581056822e-01 -1.6231874104184338e+00 + 13 4.0515414154880354e+00 -8.9202039400328714e-01 -1.6400010189207204e+00 + 14 2.6066986955414859e+00 -4.1789289874186603e-01 -2.6634027530740045e+00 + 15 2.9695346087268195e+00 5.5422728642528218e-01 -1.2342046800948778e+00 + 16 2.6747089246970055e+00 -2.4124172919180635e+00 -2.3435358040545039e-02 + 17 2.2153515161424591e+00 -2.0897925974376559e+00 1.1963115055447653e+00 + 18 2.1369701703995672e+00 3.0158507413483879e+00 -3.5179348337128169e+00 + 19 1.5355837136075503e+00 2.6255292355356850e+00 -4.2353987779858899e+00 + 20 2.7727573005675157e+00 3.6923910449606199e+00 -3.9330842459130921e+00 + 21 4.9040128073216458e+00 -4.0752348172972228e+00 -3.6210314709902178e+00 + 22 4.3582355554441330e+00 -4.2126119427287785e+00 -4.4612844196314905e+00 + 23 5.7439382849308398e+00 -3.5821957939275575e+00 -3.8766361295936442e+00 + 24 2.0689243582420707e+00 3.1513346907257525e+00 3.1550389754825381e+00 + 25 1.3045351331495809e+00 3.2665125705836533e+00 2.5111855257438469e+00 + 26 2.5809237402711407e+00 4.0117602605482343e+00 3.2212060529090203e+00 + 27 -1.9611343130355228e+00 -4.3563411931353464e+00 2.1098293115521636e+00 + 28 -2.7473562684513140e+00 -4.0200819932378886e+00 1.5830052163433823e+00 + 29 -1.3126000191359133e+00 -3.5962518039481126e+00 2.2746342468736911e+00 +run_vel: ! |2 + 1 8.1748902719248895e-03 1.6488825063890555e-02 4.7920575746796803e-03 + 2 5.4511084007743318e-03 5.2051261388670498e-03 -1.4434422725438370e-03 + 3 -8.2274804663814219e-03 -1.2934351097927732e-02 -4.0974640813287184e-03 + 4 -3.7810439919825625e-03 -6.5599673887508873e-03 -1.1281975069807595e-03 + 5 -1.1114610957297140e-02 -9.7941960094448405e-03 -2.8000606969231651e-03 + 6 -3.9614471141667384e-02 4.6885125158393097e-02 3.6916688468892268e-02 + 7 9.0823633550694307e-04 -1.0137209973964618e-02 -5.1576821598862101e-02 + 8 7.7662077312228937e-03 -3.3034358179113549e-03 3.4641870510036560e-02 + 9 1.9711566942801151e-03 3.6632927647716452e-03 1.5119486507285342e-02 + 10 2.9189761590759169e-02 -2.9234948386605512e-02 -1.5014329233453094e-02 + 11 -4.7800378310285741e-03 -3.7519133265433713e-03 -2.3499734597008941e-03 + 12 2.2651912734175032e-03 -3.4688766322378106e-04 -3.0617028612628929e-03 + 13 2.7541524307768692e-03 5.8168212242409026e-03 -7.9509320189794788e-04 + 14 3.5269195768251409e-03 -5.7943367272026312e-03 -3.9501557653067150e-03 + 15 -1.8489707819649144e-03 -5.8542853523402688e-03 6.2913780244787517e-03 + 16 1.8687298458400135e-02 -1.3267695591612149e-02 -4.5638131306342533e-02 + 17 -1.2902476276599238e-02 9.7586450769834993e-03 3.7292773489970149e-02 + 18 -8.0065797284243809e-04 -8.6270476160336701e-04 -1.4483040521307380e-03 + 19 1.2452390811276265e-03 -2.5061097157054544e-03 7.2998631050251199e-03 + 20 3.5930060220586732e-03 3.6938860299406654e-03 3.2322732694668697e-03 + 21 -1.4689220345082588e-03 -2.7352130061578030e-04 7.0581623990333337e-04 + 22 -7.0694199253619090e-03 -4.2577148926459460e-03 2.8079117595322244e-04 + 23 6.0446963119181341e-03 -1.4000131615895693e-03 2.5819754845648850e-03 + 24 3.1926367864219455e-04 -9.9445665025542493e-04 1.4999996888246658e-04 + 25 1.3789754587624503e-04 -4.4335894897561037e-03 -8.1808136628206090e-04 + 26 2.0485904035354775e-03 2.7813358632583834e-03 4.3245727149805969e-03 + 27 4.5604120337294426e-04 -1.0305523013893942e-03 2.1188058337867958e-04 + 28 -6.2544520861285771e-03 1.4127711177082084e-03 -1.8429821885090839e-03 + 29 6.4110631550796319e-04 3.1273432723457764e-03 3.7253671103666878e-03 +... diff --git a/unittest/force-styles/tests/fix-timestep-epot_lepton_region.yaml b/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml similarity index 94% rename from unittest/force-styles/tests/fix-timestep-epot_lepton_region.yaml rename to unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml index 5d7c95a0fd..b2275f047b 100644 --- a/unittest/force-styles/tests/fix-timestep-epot_lepton_region.yaml +++ b/unittest/force-styles/tests/fix-timestep-efield_lepton_region.yaml @@ -1,77 +1,78 @@ ---- -lammps_version: 27 Jun 2024 -date_generated: Tue Sep 17 08:42:57 2024 -epsilon: 2e-13 -skip_tests: -prerequisites: ! | - atom full - fix efield -pre_commands: ! "" -post_commands: ! | - region half block 0 EDGE EDGE EDGE EDGE EDGE - fix move all nve - fix test solute epot/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" region half -input_file: in.fourmol -natoms: 29 -global_scalar: 1.6224257709052041 -run_pos: ! |2 - 1 -2.7045550227503484e-01 2.4912161552650542e+00 -1.6695870672991683e-01 - 2 3.1004259198805995e-01 2.9612627263370541e+00 -8.5467109039916112e-01 - 3 -7.0398509489328243e-01 1.2305505728672561e+00 -6.2777617667397034e-01 - 4 -1.5818160259170788e+00 1.4837409852928742e+00 -1.2538708748776086e+00 - 5 -9.0719735527200218e-01 9.2652068440082169e-01 3.9954204708150570e-01 - 6 2.4837966543189102e-01 2.8318973351568738e-01 -1.2316676191454061e+00 - 7 3.4143233915513954e-01 -2.2652082568946554e-02 -2.5292246658165061e+00 - 8 1.1742106609334979e+00 -4.8857818923052260e-01 -6.3774855737315483e-01 - 9 1.3804619006758012e+00 -2.5282186302388332e-01 2.8361638664582128e-01 - 10 2.0510714422251031e+00 -1.4603992237831411e+00 -9.8323613295984091e-01 - 11 1.7878067664437562e+00 -1.9921902225910537e+00 -1.8890639278278771e+00 - 12 3.0062962291411979e+00 -4.9013271581129958e-01 -1.6231874104189474e+00 - 13 4.0515414154880700e+00 -8.9202039400332667e-01 -1.6400010189207255e+00 - 14 2.6066986955415903e+00 -4.1789289874193392e-01 -2.6634027530740991e+00 - 15 2.9695346087273786e+00 5.5422728642511987e-01 -1.2342046800950848e+00 - 16 2.6747089246973057e+00 -2.4124172919184503e+00 -2.3435358040670606e-02 - 17 2.2153515161430364e+00 -2.0897925974384783e+00 1.1963115055450686e+00 - 18 2.1369701703991302e+00 3.0158507413490390e+00 -3.5179348337124896e+00 - 19 1.5355837136075265e+00 2.6255292355357338e+00 -4.2353987779858606e+00 - 20 2.7727573005674877e+00 3.6923910449606310e+00 -3.9330842459130633e+00 - 21 4.9040128073216458e+00 -4.0752348172972228e+00 -3.6210314709902178e+00 - 22 4.3582355554441330e+00 -4.2126119427287785e+00 -4.4612844196314905e+00 - 23 5.7439382849308398e+00 -3.5821957939275575e+00 -3.8766361295936442e+00 - 24 2.0689243582419663e+00 3.1513346907264923e+00 3.1550389754824169e+00 - 25 1.3045351331492137e+00 3.2665125705841698e+00 2.5111855257432798e+00 - 26 2.5809237402711096e+00 4.0117602605482601e+00 3.2212060529089785e+00 - 27 -1.9611343130355403e+00 -4.3563411931354130e+00 2.1098293115521884e+00 - 28 -2.7473562684513166e+00 -4.0200819932378939e+00 1.5830052163433843e+00 - 29 -1.3126000191359157e+00 -3.5962518039481259e+00 2.2746342468736964e+00 -run_vel: ! |2 - 1 8.1707610252536762e-03 1.6516729522797459e-02 4.7898444127747793e-03 - 2 5.4518750405498674e-03 5.2058557730251687e-03 -1.4441331386370641e-03 - 3 -8.2289377254294322e-03 -1.2927459179389453e-02 -4.1002423460516626e-03 - 4 -3.7700883579582412e-03 -6.5718761179186279e-03 -1.1180449896675260e-03 - 5 -1.1021377362739846e-02 -9.8914014766124762e-03 -2.8411972311159365e-03 - 6 -3.9614514600574871e-02 4.6885283311817079e-02 3.6916556408268048e-02 - 7 9.0823995329068752e-04 -1.0137213428025349e-02 -5.1576824114592634e-02 - 8 7.7662014866174776e-03 -3.3034295723750589e-03 3.4641871541434638e-02 - 9 1.9711566911953310e-03 3.6632928332818136e-03 1.5119486593282045e-02 - 10 2.9189761435066477e-02 -2.9234948184549876e-02 -1.5014329155936850e-02 - 11 -4.7800378317950521e-03 -3.7519133256272356e-03 -2.3499734593625606e-03 - 12 2.2651912749160931e-03 -3.4688766464208300e-04 -3.0617028620660344e-03 - 13 2.7541524308356854e-03 5.8168212241007178e-03 -7.9509320188147147e-04 - 14 3.5269195770455336e-03 -5.7943367273509527e-03 -3.9501557655038776e-03 - 15 -1.8489707807796338e-03 -5.8542853526596435e-03 6.2913780240085072e-03 - 16 1.8687298458816809e-02 -1.3267695592172753e-02 -4.5638131306663686e-02 - 17 -1.2902476275417624e-02 9.7586450753110940e-03 3.7292773490567067e-02 - 18 -8.0065797374504898e-04 -8.6270476028742454e-04 -1.4483040514595652e-03 - 19 1.2452390810788788e-03 -2.5061097156065682e-03 7.2998631050903854e-03 - 20 3.5930060220034791e-03 3.6938860299639783e-03 3.2322732695251408e-03 - 21 -1.4689220345081530e-03 -2.7352130061585414e-04 7.0581623990322755e-04 - 22 -7.0694199253619021e-03 -4.2577148926459503e-03 2.8079117595321425e-04 - 23 6.0446963119181419e-03 -1.4000131615895712e-03 2.5819754845648798e-03 - 24 3.1926367843162763e-04 -9.9445664874966543e-04 1.4999996864545090e-04 - 25 1.3789754514824566e-04 -4.4335894886887352e-03 -8.1808136740210897e-04 - 26 2.0485904034778955e-03 2.7813358633230435e-03 4.3245727148973397e-03 - 27 4.5604120333659156e-04 -1.0305523015253445e-03 2.1188058342984497e-04 - 28 -6.2544520861335402e-03 1.4127711176935673e-03 -1.8429821885043371e-03 - 29 6.4110631550259628e-04 3.1273432723195943e-03 3.7253671103774067e-03 -... +--- +lammps_version: 29 Aug 2024 +tags: generated +date_generated: Tue Nov 12 08:53:32 2024 +epsilon: 2e-13 +skip_tests: +prerequisites: ! | + atom full + fix efield +pre_commands: ! "" +post_commands: ! | + region half block 0 EDGE EDGE EDGE EDGE EDGE + fix move all nve + fix test solute efield/lepton "A*exp(-B*r)/r; r=abs(sqrt(x^2+y^2+z^2)); A=1; B=1" region half +input_file: in.fourmol +natoms: 29 +global_scalar: 1.6224257709052041 +run_pos: ! |2 + 1 -2.7045550227503484e-01 2.4912161552650542e+00 -1.6695870672991683e-01 + 2 3.1004259198805995e-01 2.9612627263370541e+00 -8.5467109039916112e-01 + 3 -7.0398509489328243e-01 1.2305505728672561e+00 -6.2777617667397034e-01 + 4 -1.5818160259170788e+00 1.4837409852928742e+00 -1.2538708748776086e+00 + 5 -9.0719735527200218e-01 9.2652068440082169e-01 3.9954204708150570e-01 + 6 2.4837966543189102e-01 2.8318973351568738e-01 -1.2316676191454061e+00 + 7 3.4143233915513954e-01 -2.2652082568946554e-02 -2.5292246658165061e+00 + 8 1.1742106609334979e+00 -4.8857818923052260e-01 -6.3774855737315483e-01 + 9 1.3804619006758012e+00 -2.5282186302388332e-01 2.8361638664582128e-01 + 10 2.0510714422251031e+00 -1.4603992237831411e+00 -9.8323613295984091e-01 + 11 1.7878067664437562e+00 -1.9921902225910537e+00 -1.8890639278278771e+00 + 12 3.0062962291411979e+00 -4.9013271581129958e-01 -1.6231874104189474e+00 + 13 4.0515414154880700e+00 -8.9202039400332667e-01 -1.6400010189207255e+00 + 14 2.6066986955415903e+00 -4.1789289874193392e-01 -2.6634027530740991e+00 + 15 2.9695346087273786e+00 5.5422728642511987e-01 -1.2342046800950848e+00 + 16 2.6747089246973057e+00 -2.4124172919184503e+00 -2.3435358040670606e-02 + 17 2.2153515161430364e+00 -2.0897925974384783e+00 1.1963115055450686e+00 + 18 2.1369701703991302e+00 3.0158507413490390e+00 -3.5179348337124896e+00 + 19 1.5355837136075265e+00 2.6255292355357338e+00 -4.2353987779858606e+00 + 20 2.7727573005674877e+00 3.6923910449606310e+00 -3.9330842459130633e+00 + 21 4.9040128073216458e+00 -4.0752348172972228e+00 -3.6210314709902178e+00 + 22 4.3582355554441330e+00 -4.2126119427287785e+00 -4.4612844196314905e+00 + 23 5.7439382849308398e+00 -3.5821957939275575e+00 -3.8766361295936442e+00 + 24 2.0689243582419663e+00 3.1513346907264923e+00 3.1550389754824169e+00 + 25 1.3045351331492137e+00 3.2665125705841698e+00 2.5111855257432798e+00 + 26 2.5809237402711096e+00 4.0117602605482601e+00 3.2212060529089785e+00 + 27 -1.9611343130355403e+00 -4.3563411931354130e+00 2.1098293115521884e+00 + 28 -2.7473562684513166e+00 -4.0200819932378939e+00 1.5830052163433843e+00 + 29 -1.3126000191359157e+00 -3.5962518039481259e+00 2.2746342468736964e+00 +run_vel: ! |2 + 1 8.1707610252536762e-03 1.6516729522797459e-02 4.7898444127747793e-03 + 2 5.4518750405498674e-03 5.2058557730251687e-03 -1.4441331386370641e-03 + 3 -8.2289377254294322e-03 -1.2927459179389453e-02 -4.1002423460516626e-03 + 4 -3.7700883579582412e-03 -6.5718761179186279e-03 -1.1180449896675260e-03 + 5 -1.1021377362739846e-02 -9.8914014766124762e-03 -2.8411972311159365e-03 + 6 -3.9614514600574871e-02 4.6885283311817079e-02 3.6916556408268048e-02 + 7 9.0823995329068752e-04 -1.0137213428025349e-02 -5.1576824114592634e-02 + 8 7.7662014866174776e-03 -3.3034295723750589e-03 3.4641871541434638e-02 + 9 1.9711566911953310e-03 3.6632928332818136e-03 1.5119486593282045e-02 + 10 2.9189761435066477e-02 -2.9234948184549876e-02 -1.5014329155936850e-02 + 11 -4.7800378317950521e-03 -3.7519133256272356e-03 -2.3499734593625606e-03 + 12 2.2651912749160931e-03 -3.4688766464208300e-04 -3.0617028620660344e-03 + 13 2.7541524308356854e-03 5.8168212241007178e-03 -7.9509320188147147e-04 + 14 3.5269195770455336e-03 -5.7943367273509527e-03 -3.9501557655038776e-03 + 15 -1.8489707807796338e-03 -5.8542853526596435e-03 6.2913780240085072e-03 + 16 1.8687298458816809e-02 -1.3267695592172753e-02 -4.5638131306663686e-02 + 17 -1.2902476275417624e-02 9.7586450753110940e-03 3.7292773490567067e-02 + 18 -8.0065797374504898e-04 -8.6270476028742454e-04 -1.4483040514595652e-03 + 19 1.2452390810788788e-03 -2.5061097156065682e-03 7.2998631050903854e-03 + 20 3.5930060220034791e-03 3.6938860299639783e-03 3.2322732695251408e-03 + 21 -1.4689220345081530e-03 -2.7352130061585414e-04 7.0581623990322755e-04 + 22 -7.0694199253619021e-03 -4.2577148926459503e-03 2.8079117595321425e-04 + 23 6.0446963119181419e-03 -1.4000131615895712e-03 2.5819754845648798e-03 + 24 3.1926367843162763e-04 -9.9445664874966543e-04 1.4999996864545090e-04 + 25 1.3789754514824566e-04 -4.4335894886887352e-03 -8.1808136740210897e-04 + 26 2.0485904034778955e-03 2.7813358633230435e-03 4.3245727148973397e-03 + 27 4.5604120333659156e-04 -1.0305523015253445e-03 2.1188058342984497e-04 + 28 -6.2544520861335402e-03 1.4127711176935673e-03 -1.8429821885043371e-03 + 29 6.4110631550259628e-04 3.1273432723195943e-03 3.7253671103774067e-03 +...