From fc9d7bc181b45c88fd87bfd4fd320cf474c6d912 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 29 Mar 2025 18:40:47 -0400 Subject: [PATCH] rename fix qeqr/reaxff to fix qeq/rel/reaxff --- doc/src/Commands_fix.rst | 2 +- doc/src/fix.rst | 2 +- doc/src/fix_acks2_reaxff.rst | 6 +- doc/src/fix_qeq_reaxff.rst | 2 +- doc/src/fix_qeq_rel_reaxff.rst | 195 +++++++++++++++++ doc/src/fix_qeqr_reaxff.rst | 198 ------------------ doc/src/fix_qtpie_reaxff.rst | 3 +- src/.gitignore | 4 +- ...qeqr_reaxff.cpp => fix_qeq_rel_reaxff.cpp} | 48 ++--- ...fix_qeqr_reaxff.h => fix_qeq_rel_reaxff.h} | 10 +- 10 files changed, 233 insertions(+), 237 deletions(-) create mode 100644 doc/src/fix_qeq_rel_reaxff.rst delete mode 100644 doc/src/fix_qeqr_reaxff.rst rename src/REAXFF/{fix_qeqr_reaxff.cpp => fix_qeq_rel_reaxff.cpp} (62%) rename src/REAXFF/{fix_qeqr_reaxff.h => fix_qeq_rel_reaxff.h} (80%) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 2e91d2ad11..35c3804969 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -186,7 +186,7 @@ OPT. * :doc:`qeq/fire ` * :doc:`qeq/point ` * :doc:`qeq/reaxff (ko) ` - * :doc:`qeqr/reaxff ` + * :doc:`qeq/rel/reaxff ` * :doc:`qeq/shielded ` * :doc:`qeq/slater ` * :doc:`qmmm ` diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 87d58a0dfb..3b1bc4a75c 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -365,7 +365,7 @@ accelerated styles exist. * :doc:`qeq/fire ` - charge equilibration via FIRE minimizer * :doc:`qeq/point ` - charge equilibration via point method * :doc:`qeq/reaxff ` - charge equilibration for ReaxFF potential -* :doc:`qeqr/reaxff ` - charge equilibration for ReaxFF potential with alternate efield implementation +* :doc:`qeq/rel/reaxff ` - charge equilibration for ReaxFF potential with alternate efield implementation * :doc:`qeq/shielded ` - charge equilibration via shielded method * :doc:`qeq/slater ` - charge equilibration via Slater method * :doc:`qmmm ` - functionality to enable a quantum mechanics/molecular mechanics coupling diff --git a/doc/src/fix_acks2_reaxff.rst b/doc/src/fix_acks2_reaxff.rst index 32a99eca2f..c198ae8a08 100644 --- a/doc/src/fix_acks2_reaxff.rst +++ b/doc/src/fix_acks2_reaxff.rst @@ -123,8 +123,10 @@ components in non-periodic directions. Related commands """""""""""""""" -:doc:`pair_style reaxff `, :doc:`fix qeq/reaxff `, -:doc:`fix qtpie/reaxff `, :doc:`fix qeqr/reaxff ` +:doc:`pair_style reaxff `, +:doc:`fix qeq/reaxff `, +:doc:`fix qtpie/reaxff `, +:doc:`fix qeq/rel/reaxff ` Default """"""" diff --git a/doc/src/fix_qeq_reaxff.rst b/doc/src/fix_qeq_reaxff.rst index c85e079e2b..7441138396 100644 --- a/doc/src/fix_qeq_reaxff.rst +++ b/doc/src/fix_qeq_reaxff.rst @@ -141,7 +141,7 @@ Related commands :doc:`pair_style reaxff `, :doc:`fix qeq/shielded `, :doc:`fix acks2/reaxff `, :doc:`fix qtpie/reaxff `, -:doc:`fix qeqr/reaxff ` +:doc:`fix qeq/rel/reaxff ` Default """"""" diff --git a/doc/src/fix_qeq_rel_reaxff.rst b/doc/src/fix_qeq_rel_reaxff.rst new file mode 100644 index 0000000000..37c0095a70 --- /dev/null +++ b/doc/src/fix_qeq_rel_reaxff.rst @@ -0,0 +1,195 @@ +.. index:: fix qaq/rel/reaxff + +fix qeq/rel/reaxff command +========================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID qeq/rel/reaxff Nevery cutlo cuthi tolerance params gfile args + +* ID, group-ID are documented in :doc:`fix ` command +* qeq/rel/reaxff = style name of this fix command +* Nevery = perform QEqR every this many steps +* cutlo,cuthi = lo and hi cutoff for Taper radius +* tolerance = precision to which charges will be equilibrated +* params = reaxff or a filename +* gfile = the name of a file containing Gaussian orbital exponents +* one or more keywords or keyword/value pairs may be appended + + .. parsed-literal:: + + keyword = *scale* or *maxiter* or *nowarn* + *scale* beta = set value of scaling factor *beta* (determines strength of electric polarization) + *maxiter* N = limit the number of iterations to *N* + *nowarn* = do not print a warning message if the maximum number of iterations is reached + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 1 all qeq/rel/reaxff 1 0.0 10.0 1.0e-6 reaxff exp.qeqr + fix 1 all qeq/rel/reaxff 1 0.0 10.0 1.0e-6 params.qeqr exp.qeqr scale 1.5 maxiter 500 nowarn + +Description +""""""""""" + +.. versionadded:: 19Nov2024 + +This fix implements the QEqR method for charge equilibration, which +differs from the QEq charge equilibration method :ref:`(Rappe and +Goddard) ` only in how external electric fields are accounted +for. This fix therefore raises a warning when used without :doc:`fix +efield ` since :doc:`fix qeq/reaxff ` should +be used without an external electric field. Charges are computed with +the QEqR method by minimizing the electrostatic energy of the system in +the same way as the QEq method but where the absolute electronegativity, +:math:`\chi_i`, of each atom in the QEq method is replaced with an +effective electronegativity given by + +.. math:: + \chi_{\mathrm{r}i} = \chi_i + \frac{\sum_{j=1}^{N} \beta(\phi_i - \phi_j) S_{ij}} + {\sum_{m=1}^{N}S_{im}}, + +where :math:`N` is the number of atoms in the system, :math:`\beta` is a +scaling factor, :math:`\phi_i` and :math:`\phi_j` are the electric +potentials at the positions of atoms :math:`i` and :math:`j` due to the +external electric field and :math:`S_{ij}` is the overlap integral +between atoms :math:`i` and :math:`j`. This formulation is advantageous +over the method used by :doc:`fix qeq/reaxff ` to +account for an external electric field in that it permits periodic +boundaries in the direction of an external electric field and in that it +does not worsen long-range charge transfer seen with QEq. + +This fix is typically used in conjunction with the ReaxFF force field +model as implemented in the :doc:`pair_style reaxff ` +command, but it can be used with any potential in LAMMPS, so long as it +defines and uses charges on each atom. For more technical details about +the charge equilibration performed by *fix qeq/rel/reaxff*, which is the +same as in :doc:`fix qeq/reaxff ` except for the use of +:math:`\chi_{\mathrm{r}i}`, please refer to :ref:`(Aktulga) +`. To be explicit, *fix qeq/rel/reaxff* replaces +:math:`\chi_k` of eq. 3 in :ref:`(Aktulga) ` with +:math:`\chi_{\mathrm{r}k}` when an external electric field is applied. + +This fix requires the absolute electronegativity, :math:`\chi`, in eV, +the self-Coulomb potential, :math:`\eta`, in eV, and the shielded +Coulomb constant, :math:`\gamma`, in :math:`\AA^{-1}`. If the *params* +setting above is the word "reaxff", then these are extracted from the +:doc:`pair_style reaxff ` command and the ReaxFF force +field file it reads in. If a file name is specified for *params*, then +the parameters are taken from the specified file and the file must +contain one line for each atom type. The latter form must be used when +using this fix with a non-ReaxFF potential. Each line should be +formatted as follows, ensuring that the parameters are given in units of +eV, eV, and :math:`\AA^{-1}`, respectively: + +.. parsed-literal:: + + itype chi eta gamma + +where *itype* is the atom type from 1 to Ntypes. Note that eta is +defined here as twice the eta value in the ReaxFF file. + +The overlap integrals :math:`S_{ij}` are computed by using normalized 1s +Gaussian type orbitals. The Gaussian orbital exponents, :math:`\alpha`, +that are needed to compute the overlap integrals are taken from the file +given by *gfile*. This file must contain one line for each atom type +and provide the Gaussian orbital exponent for each atom type in units of +inverse square Bohr radius. Each line should be formatted as follows: + +.. parsed-literal:: + + itype alpha + +Empty lines or any text following the pound sign (#) are ignored. An +example *gfile* for a system with two atom types is + +.. parsed-literal:: + + # An example gfile. Exponents are taken from Table 2.2 of Chen, J. (2009). + # Theory and applications of fluctuating-charge models. + # The units of the exponents are 1 / (Bohr radius)^2 . + 1 0.2240 # O + 2 0.5434 # H + +The optional *scale* keyword sets the value of :math:`\beta` in the +equation for :math:`\chi_{\mathrm{r}i}`. The default value is 1.0. + +The optional *maxiter* keyword allows changing the max number of +iterations in the linear solver. The default value is 200. + +The optional *nowarn* keyword silences the warning message printed when +the maximum number of iterations is reached. This can be useful for +comparing serial and parallel results where having the same fixed number +of iterations is desired, which can be achieved by using a very small +tolerance and setting *maxiter* to the desired number of iterations. + +.. note:: + + In order to solve the self-consistent equations for electronegativity + equalization, LAMMPS imposes the additional constraint that all the + charges in the fix group must add up to zero. The initial charge + assignments should also satisfy this constraint. LAMMPS will print a + warning if that is not the case. + +Restart, fix_modify, output, run start/stop, minimize info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +No information about this fix is written to :doc:`binary restart files +`. This fix computes a global scalar (the number of +iterations) and a per-atom vector (the effective electronegativity), +which can be accessed by various :doc:`output commands `. +No parameter of this fix can be used with the *start/stop* keywords of +the :doc:`run ` command. + +This fix is invoked during :doc:`energy minimization `. + +Restrictions +"""""""""""" + +This fix is part of the REAXFF package. It is only enabled if LAMMPS +was built with that package. See the :doc:`Build package +` page for more info. + +This fix does not correctly handle interactions involving multiple +periodic images of the same atom. Hence, it should not be used for +periodic cell dimensions smaller than the non-bonded cutoff radius, +which is typically :math:`10~\AA` for ReaxFF simulations. + +This fix may be used in combination with :doc:`fix efield ` +and will apply the external electric field during charge equilibration, +but there may be only one fix efield instance used and the electric +field must be applied to all atoms in the system. Consequently, `fix +efield` must be used with *group-ID* all and must not be used with the +keyword *region*. Equal-style variables can be used for electric field +vector components without any further settings. Atom-style variables can +be used for spatially-varying electric field vector components, but the +resulting electric potential must be specified as an atom-style variable +using the *potential* keyword for `fix efield`. + +Related commands +"""""""""""""""" + +:doc:`pair_style reaxff `, :doc:`fix qeq/reaxff `, +:doc:`fix acks2/reaxff `, :doc:`fix qtpie/reaxff ` + +Default +""""""" + +scale = 1.0 and maxiter = 200 + +---------- + +.. _Rappe4: + +**(Rappe)** Rappe and Goddard III, Journal of Physical Chemistry, 95, +3358-3363 (1991). + +.. _qeq-Aktulga3: + +**(Aktulga)** Aktulga, Fogarty, Pandit, Grama, Parallel Computing, 38, +245-259 (2012). diff --git a/doc/src/fix_qeqr_reaxff.rst b/doc/src/fix_qeqr_reaxff.rst deleted file mode 100644 index a89da15e3c..0000000000 --- a/doc/src/fix_qeqr_reaxff.rst +++ /dev/null @@ -1,198 +0,0 @@ -.. index:: fix qeqr/reaxff - -fix qeqr/reaxff command -======================== - -Syntax -"""""" - -.. code-block:: LAMMPS - - fix ID group-ID qeqr/reaxff Nevery cutlo cuthi tolerance params gfile args - -* ID, group-ID are documented in :doc:`fix ` command -* qeqr/reaxff = style name of this fix command -* Nevery = perform QEqR every this many steps -* cutlo,cuthi = lo and hi cutoff for Taper radius -* tolerance = precision to which charges will be equilibrated -* params = reaxff or a filename -* gfile = the name of a file containing Gaussian orbital exponents -* one or more keywords or keyword/value pairs may be appended - - .. parsed-literal:: - - keyword = *scale* or *maxiter* or *nowarn* - *scale* beta = set value of scaling factor *beta* (determines strength of electric polarization) - *maxiter* N = limit the number of iterations to *N* - *nowarn* = do not print a warning message if the maximum number of iterations is reached - -Examples -"""""""" - -.. code-block:: LAMMPS - - fix 1 all qeqr/reaxff 1 0.0 10.0 1.0e-6 reaxff exp.qeqr - fix 1 all qeqr/reaxff 1 0.0 10.0 1.0e-6 params.qeqr exp.qeqr scale 1.5 maxiter 500 nowarn - -Description -""""""""""" - -.. versionadded:: 19Nov2024 - -This fix implements QEqR, which only differs from the QEq charge equilibration -method :ref:`(Rappe and Goddard) ` in how external electric fields -are accounted for. This fix therefore raises a warning when used without -:doc:`fix efield ` informing the user to use -:doc:`fix qeq/reaxff ` instead since -:doc:`fix qeq/reaxff ` -leads to the same charges at slightly reduced computational cost. Charges are -computed with QEqR by minimizing the electrostatic energy of the system in the -same way as the QEq method but where the absolute electronegativity, -:math:`\chi_i`, of each atom in the QEq method is replaced with an effective -electronegativity given by - -.. math:: - \chi_{\mathrm{r}i} = \chi_i + \frac{\sum_{j=1}^{N} \beta(\phi_i - \phi_j) S_{ij}} - {\sum_{m=1}^{N}S_{im}}, - -where :math:`N` is the number of atoms in the system, :math:`\beta` is a scaling -factor, :math:`\phi_i` and :math:`\phi_j` are the electric potentials at the -positions of atoms :math:`i` and :math:`j` due to the external electric field -and :math:`S_{ij}` is the overlap integral between atoms :math:`i` and :math:`j`. -This formulation is advantageous over the method used by -:doc:`fix qeq/reaxff ` to account for an external electric -field in that it permits periodic boundaries in the direction of an external -electric field and in that it does not worsen long-range charge transfer seen -with QEq. - -This fix is typically used in conjunction with the ReaxFF force -field model as implemented in the :doc:`pair_style reaxff ` -command, but it can be used with any potential in LAMMPS, so long as it -defines and uses charges on each atom. For more technical details about the -charge equilibration performed by `fix qeqr/reaxff`, which is the same as in -:doc:`fix qeq/reaxff ` except for the use of -:math:`\chi_{\mathrm{r}i}`, please refer to :ref:`(Aktulga) `. -To be explicit, `fix qeqr/reaxff` replaces :math:`\chi_k` of eq. 3 in -:ref:`(Aktulga) ` with :math:`\chi_{\mathrm{r}k}` when an -external electric field is applied. - -This fix requires the absolute electronegativity, :math:`\chi`, in eV, the -self-Coulomb potential, :math:`\eta`, in eV, and the shielded Coulomb -constant, :math:`\gamma`, in :math:`\AA^{-1}`. If the *params* setting above -is the word "reaxff", then these are extracted from the -:doc:`pair_style reaxff ` command and the ReaxFF force field -file it reads in. If a file name is specified for *params*, then the -parameters are taken from the specified file and the file must contain -one line for each atom type. The latter form must be used when using this -fix with a non-ReaxFF potential. Each line should be formatted as follows, -ensuring that the parameters are given in units of eV, eV, and :math:`\AA^{-1}`, -respectively: - -.. parsed-literal:: - - itype chi eta gamma - -where *itype* is the atom type from 1 to Ntypes. Note that eta is -defined here as twice the eta value in the ReaxFF file. - -The overlap integrals :math:`S_{ij}` -are computed by using normalized 1s Gaussian type orbitals. The Gaussian -orbital exponents, :math:`\alpha`, that are needed to compute the overlap -integrals are taken from the file given by *gfile*. -This file must contain one line for each atom type and provide the Gaussian -orbital exponent for each atom type in units of inverse square Bohr radius. -Each line should be formatted as follows: - -.. parsed-literal:: - - itype alpha - -Empty lines or any text following the pound sign (#) are ignored. An example -*gfile* for a system with two atom types is - -.. parsed-literal:: - - # An example gfile. Exponents are taken from Table 2.2 of Chen, J. (2009). - # Theory and applications of fluctuating-charge models. - # The units of the exponents are 1 / (Bohr radius)^2 . - 1 0.2240 # O - 2 0.5434 # H - -The optional *scale* keyword sets the value of :math:`\beta` in the equation for -:math:`\chi_{\mathrm{r}i}`. The default value is 1.0. - -The optional *maxiter* keyword allows changing the max number -of iterations in the linear solver. The default value is 200. - -The optional *nowarn* keyword silences the warning message printed -when the maximum number of iterations is reached. This can be -useful for comparing serial and parallel results where having the -same fixed number of iterations is desired, which can be achieved -by using a very small tolerance and setting *maxiter* to the desired -number of iterations. - -.. note:: - - In order to solve the self-consistent equations for electronegativity - equalization, LAMMPS imposes the additional constraint that all the - charges in the fix group must add up to zero. The initial charge - assignments should also satisfy this constraint. LAMMPS will print a - warning if that is not the case. - -Restart, fix_modify, output, run start/stop, minimize info -""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -No information about this fix is written to :doc:`binary restart files -`. This fix computes a global scalar (the number of -iterations) and a per-atom vector (the effective electronegativity), which -can be accessed by various :doc:`output commands `. -No parameter of this fix can be used with the *start/stop* keywords of -the :doc:`run ` command. - -This fix is invoked during :doc:`energy minimization `. - -Restrictions -"""""""""""" - -This fix is part of the REAXFF package. It is only enabled if -LAMMPS was built with that package. See the :doc:`Build package -` page for more info. - -This fix does not correctly handle interactions involving multiple -periodic images of the same atom. Hence, it should not be used for -periodic cell dimensions smaller than the non-bonded cutoff radius, -which is typically :math:`10~\AA` for ReaxFF simulations. - -This fix may be used in combination with :doc:`fix efield ` -and will apply the external electric field during charge equilibration, -but there may be only one fix efield instance used and the electric field -must be applied to all atoms in the system. Consequently, `fix efield` must -be used with *group-ID* all and must not be used with the keyword *region*. -Equal-style variables can be used for electric field vector -components without any further settings. Atom-style variables can be used -for spatially-varying electric field vector components, but the resulting -electric potential must be specified as an atom-style variable using -the *potential* keyword for `fix efield`. - -Related commands -"""""""""""""""" - -:doc:`pair_style reaxff `, :doc:`fix qeq/reaxff `, -:doc:`fix acks2/reaxff `, :doc:`fix qtpie/reaxff ` - -Default -""""""" - -scale = 1.0 and maxiter = 200 - ----------- - -.. _Rappe4: - -**(Rappe)** Rappe and Goddard III, Journal of Physical Chemistry, 95, -3358-3363 (1991). - -.. _qeq-Aktulga3: - -**(Aktulga)** Aktulga, Fogarty, Pandit, Grama, Parallel Computing, 38, -245-259 (2012). diff --git a/doc/src/fix_qtpie_reaxff.rst b/doc/src/fix_qtpie_reaxff.rst index c3277af32c..08ae24e164 100644 --- a/doc/src/fix_qtpie_reaxff.rst +++ b/doc/src/fix_qtpie_reaxff.rst @@ -186,7 +186,8 @@ Related commands """""""""""""""" :doc:`pair_style reaxff `, :doc:`fix qeq/reaxff `, -:doc:`fix acks2/reaxff `, :doc:`fix qeqr/reaxff ` +:doc:`fix acks2/reaxff `, +:doc:`fix qeq/rel/reaxff ` Default """"""" diff --git a/src/.gitignore b/src/.gitignore index cdd3c99603..45e15e5c5e 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -996,8 +996,8 @@ /fix_qeq_fire.h /fix_qeq_reaxff.cpp /fix_qeq_reaxff.h -/fix_qeqr_reaxff.cpp -/fix_qeqr_reaxff.h +/fix_qeq_rel_reaxff.cpp +/fix_qeq_rel_reaxff.h /fix_qmmm.cpp /fix_qmmm.h /fix_qtpie_reaxff.cpp diff --git a/src/REAXFF/fix_qeqr_reaxff.cpp b/src/REAXFF/fix_qeq_rel_reaxff.cpp similarity index 62% rename from src/REAXFF/fix_qeqr_reaxff.cpp rename to src/REAXFF/fix_qeq_rel_reaxff.cpp index dd546b2c96..b635571ceb 100644 --- a/src/REAXFF/fix_qeqr_reaxff.cpp +++ b/src/REAXFF/fix_qeq_rel_reaxff.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -18,7 +17,7 @@ ------------------------------------------------------------------------- */ -#include "fix_qeqr_reaxff.h" +#include "fix_qeq_rel_reaxff.h" #include "atom.h" #include "comm.h" @@ -40,46 +39,45 @@ static constexpr double ANGSTROM_TO_BOHRRADIUS = 1.8897261259; /* ---------------------------------------------------------------------- */ -FixQEqrReaxFF::FixQEqrReaxFF(LAMMPS *lmp, int narg, char **arg) : - FixQtpieReaxFF(lmp, narg, arg) +FixQEqRelReaxFF::FixQEqRelReaxFF(LAMMPS *lmp, int narg, char **arg) : FixQtpieReaxFF(lmp, narg, arg) { } /* ---------------------------------------------------------------------- */ -void FixQEqrReaxFF::calc_chi_eff() +void FixQEqRelReaxFF::calc_chi_eff() { - memset(&chi_eff[0],0,atom->nmax*sizeof(double)); + memset(&chi_eff[0], 0, atom->nmax * sizeof(double)); - const auto x = (const double * const *)atom->x; + const auto x = (const double *const *) atom->x; const int *type = atom->type; - double dist,overlap,sum_n,sum_d,expa,expb,chia,phia,phib,p,m; - int i,j; + double dist, overlap, sum_n, sum_d, expa, expb, chia, phia, phib, p, m; + int i, j; // check ghost atoms are stored up to the distance cutoff for overlap integrals - const double comm_cutoff = MAX(neighbor->cutneighmax,comm->cutghostuser); - if(comm_cutoff < dist_cutoff/ANGSTROM_TO_BOHRRADIUS) { - error->all(FLERR,"comm cutoff = {} Angstrom is smaller than distance cutoff = {} Angstrom " - "for overlap integrals in {}. Increase comm cutoff with comm_modify", - comm_cutoff, dist_cutoff/ANGSTROM_TO_BOHRRADIUS, style); + const double comm_cutoff = MAX(neighbor->cutneighmax, comm->cutghostuser); + if (comm_cutoff < dist_cutoff / ANGSTROM_TO_BOHRRADIUS) { + error->all(FLERR, Error::NOLASTLINE, + "Comm cutoff {} is smaller than distance cutoff {} for overlap integrals in fix {}. " + "Increase accordingly using comm_modify cutoff", + comm_cutoff, dist_cutoff / ANGSTROM_TO_BOHRRADIUS, style); } // efield energy is in real units of kcal/mol, factor needed for conversion to eV const double qe2f = force->qe2f; - const double factor = 1.0/qe2f; + const double factor = 1.0 / qe2f; if (efield) { - if (efield->varflag != FixEfield::CONSTANT) - efield->update_efield_variables(); + if (efield->varflag != FixEfield::CONSTANT) efield->update_efield_variables(); // compute chi_eff for each local atom for (i = 0; i < nn; i++) { expa = gauss_exp[type[i]]; chia = chi[type[i]]; if (efield->varflag != FixEfield::ATOM) { - phia = -factor*(x[i][0]*efield->ex + x[i][1]*efield->ey + x[i][2]*efield->ez); - } else { // atom-style potential from FixEfield + phia = -factor * (x[i][0] * efield->ex + x[i][1] * efield->ey + x[i][2] * efield->ez); + } else { // atom-style potential from FixEfield phia = efield->efield[i][3]; } @@ -87,7 +85,7 @@ void FixQEqrReaxFF::calc_chi_eff() sum_d = 0.0; for (j = 0; j < nt; j++) { - dist = distance(x[i],x[j])*ANGSTROM_TO_BOHRRADIUS; // in atomic units + dist = distance(x[i], x[j]) * ANGSTROM_TO_BOHRRADIUS; // in atomic units if (dist < dist_cutoff) { expb = gauss_exp[type[j]]; @@ -95,11 +93,11 @@ void FixQEqrReaxFF::calc_chi_eff() // overlap integral of two normalised 1s Gaussian type orbitals p = expa + expb; m = expa * expb / p; - overlap = pow((4.0*m/p),0.75) * exp(-m*dist*dist); + overlap = pow((4.0 * m / p), 0.75) * exp(-m * dist * dist); if (efield->varflag != FixEfield::ATOM) { - phib = -factor*(x[j][0]*efield->ex + x[j][1]*efield->ey + x[j][2]*efield->ez); - } else { // atom-style potential from FixEfield + phib = -factor * (x[j][0] * efield->ex + x[j][1] * efield->ey + x[j][2] * efield->ez); + } else { // atom-style potential from FixEfield phib = efield->efield[j][3]; } sum_n += (chia + scale * (phia - phib)) * overlap; @@ -109,8 +107,6 @@ void FixQEqrReaxFF::calc_chi_eff() chi_eff[i] = sum_n / sum_d; } } else { - for (i = 0; i < nn; i++) { - chi_eff[i] = chi[type[i]]; - } + for (i = 0; i < nn; i++) { chi_eff[i] = chi[type[i]]; } } } diff --git a/src/REAXFF/fix_qeqr_reaxff.h b/src/REAXFF/fix_qeq_rel_reaxff.h similarity index 80% rename from src/REAXFF/fix_qeqr_reaxff.h rename to src/REAXFF/fix_qeq_rel_reaxff.h index a48a6ee632..56ebb8a951 100644 --- a/src/REAXFF/fix_qeqr_reaxff.h +++ b/src/REAXFF/fix_qeq_rel_reaxff.h @@ -13,20 +13,20 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(qeqr/reaxff,FixQEqrReaxFF); +FixStyle(qeq/rel/reaxff,FixQEqRelReaxFF); // clang-format on #else -#ifndef LMP_FIX_QEQR_REAXFF_H -#define LMP_FIX_QEQR_REAXFF_H +#ifndef LMP_FIX_QEQ_REL_REAXFF_H +#define LMP_FIX_QEQ_REL_REAXFF_H #include "fix_qtpie_reaxff.h" namespace LAMMPS_NS { -class FixQEqrReaxFF : public FixQtpieReaxFF { +class FixQEqRelReaxFF : public FixQtpieReaxFF { public: - FixQEqrReaxFF(class LAMMPS *, int, char **); + FixQEqRelReaxFF(class LAMMPS *, int, char **); protected: void calc_chi_eff() override;