From 3aeb64de89a936bfd693cdcfd16b77647da99dac Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 11 Dec 2024 15:32:25 -0500 Subject: [PATCH] rename pair style and fully integrate into build and manual --- doc/src/Commands_pair.rst | 1 + .../{pair_d3.rst => pair_dispersion_d3.rst} | 88 +++++----- doc/src/pair_style.rst | 1 + src/.gitignore | 3 + .../{pair_d3_pars.h => d3_parameters.h} | 25 ++- .../{pair_d3.cpp => pair_dispersion_d3.cpp} | 129 +++++++-------- .../{pair_d3.h => pair_dispersion_d3.h} | 23 +-- .../force-styles/tests/manybody-pair-d3.yaml | 155 ------------------ .../tests/manybody-pair-dispersion_d3.yaml | 154 +++++++++++++++++ 9 files changed, 297 insertions(+), 282 deletions(-) rename doc/src/{pair_d3.rst => pair_dispersion_d3.rst} (63%) rename src/EXTRA-PAIR/{pair_d3_pars.h => d3_parameters.h} (99%) rename src/EXTRA-PAIR/{pair_d3.cpp => pair_dispersion_d3.cpp} (93%) rename src/EXTRA-PAIR/{pair_d3.h => pair_dispersion_d3.h} (85%) delete mode 100644 unittest/force-styles/tests/manybody-pair-d3.yaml create mode 100644 unittest/force-styles/tests/manybody-pair-dispersion_d3.yaml diff --git a/doc/src/Commands_pair.rst b/doc/src/Commands_pair.rst index 5f42f53bd5..75a7bb83cb 100644 --- a/doc/src/Commands_pair.rst +++ b/doc/src/Commands_pair.rst @@ -80,6 +80,7 @@ OPT. * :doc:`coul/tt ` * :doc:`coul/wolf (ko) ` * :doc:`coul/wolf/cs ` + * :doc:`dispersion/d3 ` * :doc:`dpd (giko) ` * :doc:`dpd/coul/slater/long (g) ` * :doc:`dpd/ext (ko) ` diff --git a/doc/src/pair_d3.rst b/doc/src/pair_dispersion_d3.rst similarity index 63% rename from doc/src/pair_d3.rst rename to doc/src/pair_dispersion_d3.rst index 6b5d0325df..5b245be57c 100644 --- a/doc/src/pair_d3.rst +++ b/doc/src/pair_dispersion_d3.rst @@ -1,21 +1,17 @@ -.. index:: pair_style d3 -.. - .. index:: pair_style d3/kk +.. index:: pair_style dispersion/d3 -pair_style d3 command -===================== -.. - Accelerator Variants: *d3/kk* +pair_style dispersion/d3 command +================================ Syntax """""" .. code-block:: LAMMPS - pair_style d3 damping functional cutoff cn_cutoff + pair_style dispersion/d3 damping functional cutoff cn_cutoff * damping = damping function: *zero*, *zerom*, *bj*, or *bjm* -* functional = XC functional form: *pbe*, *pbe0*, etc. +* functional = XC functional form: *pbe*, *pbe0*, ... (see list below) * cutoff = global cutoff (distance units) * cn_cutoff = coordination number cutoff (distance units) @@ -24,14 +20,19 @@ Examples .. code-block:: LAMMPS - pair_style d3 zero pbe 30.0 20.0 + pair_style dispersion/d3 zero pbe 30.0 20.0 pair_coeff * * C Description """"""""""" -Style *d3* computes the dispersion energy-correction used in the DFT-D3 -method of Grimme :ref:`(Grimme1) `. +.. versionadded:: TBD + +Style *dispersion/d3* computes the dispersion energy-correction used in +the DFT-D3 method of Grimme :ref:`(Grimme1) `. It would +typically be used with a machine learning potential that was trained +with results from plain DFT calculations without the dispersion +correction through pair_style hybrid/overlay. The energy contribution :math:`E_i` for an atom :math:`i` is given by: @@ -41,19 +42,22 @@ The energy contribution :math:`E_i` for an atom :math:`i` is given by: s_6 \frac{C_{6,ij}}{r^6_{ij}} f_6^{damp}(r_{ij}) + s_8 \frac{C_{8,ij}}{r^8_{ij}} f_8^{damp}(r_{ij}) \big) -where :math:`C_n` is the averaged, geometry-dependent nth-order dispersion -coefficient for atom pair :math:`ij`, :math:`r_{ij}` their internuclear distance, +where :math:`C_n` is the averaged, geometry-dependent nth-order dispersion +coefficient for atom pair :math:`ij`, :math:`r_{ij}` their internuclear distance, :math:`s_n` are XC functional-dependent scaling factor, and :math:`f_n^{damp}` are damping functions. -N.B.: in the current version of the code, it is *not* possible to calculate three-body -dispersion contributions, according for example to the Axilrod-Teller-Muto model. +.. note:: -Available damping functions are the original "zero-damping" :ref:`(Grimme1) `, -Becke-Johnson damping :ref:`(Grimme2) `, and their revised forms :ref:`(Sherrill) `. + It is currently *not* possible to calculate three-body dispersion + contributions, according for example to the Axilrod-Teller-Muto model. -Available XC functional scaling factors are listed in the table below, and depend on -the selected damping function. +Available damping functions are the original "zero-damping" +:ref:`(Grimme1) `, Becke-Johnson damping :ref:`(Grimme2) +`, and their revised forms :ref:`(Sherrill) `. + +Available XC functional scaling factors are listed in the table below, +and depend on the selected damping function. +------------------+--------------------------------------------------------------------------------+ | Damping function | XC functional | @@ -77,39 +81,45 @@ the selected damping function. +------------------+--------------------------------------------------------------------------------+ -This style is primarly supposed to be used combined with a machine-learned -interatomic potential trained on a DFT dataset (the selected XC functional -should be chosen accordingly) via the *pair_style hybrid* command. +This style is primarly supposed to be used combined with a +machine-learned interatomic potential trained on a DFT dataset (the +selected XC functional should be chosen accordingly) via the *pair_style +hybrid* command. Coefficients """""""""""" -All the required coefficients are already stored internally, in the pair_d3_pars.h file. -The only information to provide are the chemical symbols of the atoms. -The number of chemical symbols given must be equal to the number of atom types -used and should match their ordering. +All the required coefficients are already stored internally, in the +d3_paramerters.h file. The only information to provide are the chemical +symbols of the atoms. The number of chemical symbols given must be +equal to the number of atom types used and should match their ordering. Mixing, shift, table, tail correction, restart, rRESPA info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -This pair style does not support mixing since all parameters are explicit for each pair. +This pair style does not support mixing since all parameters are +explicit for each pair of atom types. -This pair style does not support the :doc:`pair_modify` shift, table, and tail options. +This pair style does not support the :doc:`pair_modify` shift, table, +and tail options. -This pair style does not write its information to :doc:`binary restart files `. +This pair style does not write its information to :doc:`binary restart +files `. This pair style can only be used via the *pair* keyword of the :doc:`run_style respa ` command. It does not support the *inner*, *middle*, *outer* keywords. - Restrictions """""""""""" -Style *d3* is part of the EXTRA-PAIR package. It is only enabled if LAMMPS -was built with that package. -See the :doc:`Build package ` page for more info. +Style *dispersion/d3* is part of the EXTRA-PAIR package. It is only +enabled if LAMMPS was built with that package. See the :doc:`Build +package ` page for more info. + +It is currently *not* possible to calculate three-body dispersion +contributions, ccording for example to the Axilrod-Teller-Muto model. Related commands """""""""""""""" @@ -125,16 +135,12 @@ none .. _Grimme1: -**(Grimme1)** S. Grimme, J. Antony, S. Ehrlich, and H. Krieg, -J. Chem. Phys. 132, 154104 (2010). -. +**(Grimme1)** S. Grimme, J. Antony, S. Ehrlich, and H. Krieg, J. Chem. Phys. 132, 154104 (2010). .. _Grimme2: -**(Grimme2)** S. Grimme, S. Ehrlich and L. Goerigk, -J. Comput. Chem. 32, 1456 (2011); DOI:10.1002/jcc.21759. +**(Grimme2)** S. Grimme, S. Ehrlich and L. Goerigk, J. Comput. Chem. 32, 1456 (2011); DOI:10.1002/jcc.21759. .. _Sherrill: -**(Sherrill)** D. G. A. Smith, L. A. Burns, K. Patkowski, and C. D. Sherrill, -J. Phys. Chem. Lett., 7, 2197, (2016); DOI: 10.1021/acs.jpclett.6b00780. +**(Sherrill)** D. G. A. Smith, L. A. Burns, K. Patkowski, and C. D. Sherrill, J. Phys. Chem. Lett., 7, 2197, (2016); DOI: 10.1021/acs.jpclett.6b00780. diff --git a/doc/src/pair_style.rst b/doc/src/pair_style.rst index fc2ed2b9a9..93e02422d2 100644 --- a/doc/src/pair_style.rst +++ b/doc/src/pair_style.rst @@ -172,6 +172,7 @@ accelerated styles exist. * :doc:`coul/tt ` - damped charge-dipole Coulomb for Drude dipoles * :doc:`coul/wolf ` - Coulomb via Wolf potential * :doc:`coul/wolf/cs ` - Coulomb via Wolf potential with core/shell adjustments +* :doc:`dispersion/d3 ` - Dispersion correction for potentials derived from DFT functionals * :doc:`dpd ` - dissipative particle dynamics (DPD) * :doc:`dpd/coul/slater/long ` - dissipative particle dynamics (DPD) with electrostatic interactions * :doc:`dpd/ext ` - generalized force field for DPD diff --git a/src/.gitignore b/src/.gitignore index f0554e3bfe..7208988bd4 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -1217,6 +1217,9 @@ /pair_dipole_cut.h /pair_dipole_sf.cpp /pair_dipole_sf.h +/d3_parameters.h +/pair_dispersion_d3.h +/pair_dispersion_d3.cpp /pair_dsmc.cpp /pair_dsmc.h /pair_e3b.cpp diff --git a/src/EXTRA-PAIR/pair_d3_pars.h b/src/EXTRA-PAIR/d3_parameters.h similarity index 99% rename from src/EXTRA-PAIR/pair_d3_pars.h rename to src/EXTRA-PAIR/d3_parameters.h index ffe9357bc1..3ff9dc6ea3 100644 --- a/src/EXTRA-PAIR/pair_d3_pars.h +++ b/src/EXTRA-PAIR/d3_parameters.h @@ -1,4 +1,26 @@ -#define R0AB_TABLE { \ +/* -*- 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 authors: + Sonia Salomoni^1,^2 + Arthur France-Lanord^1 + + ^1: IMPMC, CNRS, Sorbonne Universite, Paris, France + ^2: SCAI, Sorbonne Universite, Paris, France +------------------------------------------------------------------------- */ +#ifndef LMP_D3_PARAMETERS_H +#define LMP_D3_PARAMETERS_H + +#define R0AB_TABLE { \ {2.18230000E+00, 1.85470000E+00, 2.90860000E+00, 2.35500000E+00, 2.51410000E+00, 2.44920000E+00, 2.36670000E+00, 2.17680000E+00, 2.06460000E+00, 1.98920000E+00, 2.98980000E+00, 2.51290000E+00, 2.87660000E+00, 2.88840000E+00, 2.83040000E+00, 2.61900000E+00, 2.47570000E+00, 2.37250000E+00, 3.21470000E+00, 2.75970000E+00, 2.73610000E+00, 2.68320000E+00, 2.63790000E+00, 2.92300000E+00, 2.54900000E+00, 2.49260000E+00, 2.46670000E+00, 2.45150000E+00, 2.44130000E+00, 2.43180000E+00, 2.85020000E+00, 2.92260000E+00, 2.91400000E+00, 2.73000000E+00, 2.60260000E+00, 2.50870000E+00, 3.28930000E+00, 2.87860000E+00, 2.89970000E+00, 2.85350000E+00, 3.09050000E+00, 3.03010000E+00, 2.91890000E+00, 2.85780000E+00, 2.82400000E+00, 2.80040000E+00, 2.78460000E+00, 2.54240000E+00, 2.97430000E+00, 3.07750000E+00, 3.08930000E+00, 2.90910000E+00, 2.78060000E+00, 2.68480000E+00, 3.39680000E+00, 3.06300000E+00, 3.06320000E+00, 2.94550000E+00, 2.92440000E+00, 2.90460000E+00, 2.88780000E+00, 2.87090000E+00, 2.85680000E+00, 2.67980000E+00, 2.51890000E+00, 3.04810000E+00, 2.81360000E+00, 2.80320000E+00, 2.79670000E+00, 2.78970000E+00, 2.83950000E+00, 2.90070000E+00, 2.85590000E+00, 2.81100000E+00, 2.76760000E+00, 2.69120000E+00, 2.78950000E+00, 2.75220000E+00, 2.72020000E+00, 2.53150000E+00, 2.98520000E+00, 3.11600000E+00, 3.14160000E+00, 2.96640000E+00, 2.83880000E+00, 2.74120000E+00, 3.41550000E+00, 3.05480000E+00, 3.38500000E+00, 3.09420000E+00, 3.01870000E+00, 2.98750000E+00, 2.96590000E+00, 2.87630000E+00}, \ {1.85470000E+00, 1.73470000E+00, 2.57320000E+00, 2.50950000E+00, 2.39170000E+00, 2.25270000E+00, 2.13280000E+00, 2.06250000E+00, 1.98910000E+00, 1.92510000E+00, 2.63970000E+00, 2.73210000E+00, 2.74270000E+00, 2.66050000E+00, 2.55380000E+00, 2.47970000E+00, 2.40190000E+00, 2.32890000E+00, 2.83150000E+00, 3.05880000E+00, 2.97650000E+00, 2.90600000E+00, 2.84940000E+00, 2.62230000E+00, 2.76230000E+00, 2.71360000E+00, 2.67090000E+00, 2.63380000E+00, 2.60060000E+00, 2.57290000E+00, 2.69340000E+00, 2.68380000E+00, 2.62710000E+00, 2.58700000E+00, 2.53550000E+00, 2.48140000E+00, 2.89910000E+00, 3.16580000E+00, 3.09530000E+00, 3.01670000E+00, 2.79980000E+00, 2.73120000E+00, 2.67770000E+00, 2.63340000E+00, 2.59600000E+00, 2.56210000E+00, 2.53240000E+00, 2.66010000E+00, 2.80580000E+00, 2.82750000E+00, 2.79170000E+00, 2.76380000E+00, 2.72090000E+00, 2.67400000E+00, 3.01220000E+00, 3.32710000E+00, 3.26620000E+00, 3.24700000E+00, 3.22410000E+00, 3.20440000E+00, 3.18900000E+00, 3.17370000E+00, 3.16080000E+00, 3.01510000E+00, 2.97030000E+00, 2.95840000E+00, 3.09510000E+00, 3.08050000E+00, 3.06890000E+00, 3.06360000E+00, 3.00810000E+00, 2.96740000E+00, 2.90500000E+00, 2.85200000E+00, 2.80780000E+00, 2.76040000E+00, 2.58490000E+00, 2.55240000E+00, 2.51830000E+00, 2.61040000E+00, 2.78810000E+00, 2.84820000E+00, 2.83250000E+00, 2.82090000E+00, 2.78900000E+00, 2.74890000E+00, 3.05220000E+00, 3.32060000E+00, 3.42080000E+00, 3.20750000E+00, 3.19180000E+00, 3.16740000E+00, 3.14420000E+00, 3.12940000E+00}, \ {2.90860000E+00, 2.57320000E+00, 3.49560000E+00, 2.98020000E+00, 2.99770000E+00, 3.19330000E+00, 2.87840000E+00, 2.63950000E+00, 2.50860000E+00, 2.41900000E+00, 3.60310000E+00, 3.10520000E+00, 3.27760000E+00, 3.75130000E+00, 3.39320000E+00, 3.13310000E+00, 2.97890000E+00, 2.87600000E+00, 3.87240000E+00, 3.34740000E+00, 3.24750000E+00, 3.26130000E+00, 3.18400000E+00, 3.41610000E+00, 3.09910000E+00, 3.06930000E+00, 3.05750000E+00, 3.05110000E+00, 3.05400000E+00, 3.04160000E+00, 3.24670000E+00, 3.78670000E+00, 3.47710000E+00, 3.24710000E+00, 3.11290000E+00, 3.02390000E+00, 4.03880000E+00, 3.58230000E+00, 3.45240000E+00, 3.39780000E+00, 3.64480000E+00, 3.58210000E+00, 3.49250000E+00, 3.46730000E+00, 3.46350000E+00, 3.46170000E+00, 3.46520000E+00, 3.25550000E+00, 3.48300000E+00, 4.01810000E+00, 3.72620000E+00, 3.50660000E+00, 3.38120000E+00, 3.29250000E+00, 4.22410000E+00, 4.04320000E+00, 3.64320000E+00, 3.61080000E+00, 3.58480000E+00, 3.56210000E+00, 3.54120000E+00, 3.51990000E+00, 3.50500000E+00, 3.25860000E+00, 3.30630000E+00, 3.69190000E+00, 3.46350000E+00, 3.45190000E+00, 3.44450000E+00, 3.43440000E+00, 3.31710000E+00, 3.81740000E+00, 3.83250000E+00, 3.74800000E+00, 3.67250000E+00, 3.60370000E+00, 3.64840000E+00, 3.57420000E+00, 3.49470000E+00, 3.27340000E+00, 3.52840000E+00, 4.07390000E+00, 3.77350000E+00, 3.55470000E+00, 3.43290000E+00, 3.33740000E+00, 4.25410000E+00, 3.81320000E+00, 3.70040000E+00, 3.51520000E+00, 3.51270000E+00, 3.49710000E+00, 3.47950000E+00, 3.55980000E+00}, \ @@ -32481,3 +32503,4 @@ {3.91125000E+02, 4.82000000E+02, 4.50000000E+02, 3.90980000E+00, 3.91230000E+00}, \ {4.55285400E+02, 4.82000000E+02, 4.82000000E+02, 3.90980000E+00, 3.90980000E+00} \ } +#endif diff --git a/src/EXTRA-PAIR/pair_d3.cpp b/src/EXTRA-PAIR/pair_dispersion_d3.cpp similarity index 93% rename from src/EXTRA-PAIR/pair_d3.cpp rename to src/EXTRA-PAIR/pair_dispersion_d3.cpp index d73f5724cc..9db3423f50 100644 --- a/src/EXTRA-PAIR/pair_d3.cpp +++ b/src/EXTRA-PAIR/pair_dispersion_d3.cpp @@ -12,7 +12,7 @@ ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- - Contributing authors: + Contributing authors: Sonia Salomoni^1,^2 Arthur France-Lanord^1 @@ -20,14 +20,8 @@ ^2: SCAI, Sorbonne Universite, Paris, France ------------------------------------------------------------------------- */ -#include "pair_d3.h" -#include "pair_d3_pars.h" - -#include -#include -#include -#include -#include +#include "pair_dispersion_d3.h" +#include "d3_parameters.h" #include "atom.h" #include "comm.h" @@ -37,11 +31,14 @@ #include "neigh_list.h" #include "neighbor.h" +#include +#include +#include + using namespace LAMMPS_NS; // global ad hoc parameters static constexpr double K1 = 16.0; -static constexpr double K2 = 4.0/3.0; static constexpr double K3 = -4.0; /* reasonable choices for k3 are between 3 and 5 : @@ -56,7 +53,6 @@ static constexpr double K3 = -4.0; static constexpr int NUM_ELEMENTS = 94; // maximum element number static constexpr int N_PARS_COLS = 5; // number of columns in C6 table static constexpr int N_PARS_ROWS = 32385; // number of rows in C6 table -static constexpr int MAX_CN_ELEM = 5; // maximun coordination number for each element static constexpr double autoang = 0.52917725 ; // atomic units (Bohr) to Angstrom static constexpr double autoev = 27.21140795 ; // atomic units (Hartree) to eV @@ -65,7 +61,7 @@ static constexpr double autoev = 27.21140795 ; // atomic units (Hartree) to eV Constructor (Required) ------------------------------------------------------------------------- */ -PairD3::PairD3(LAMMPS *lmp) : Pair(lmp) +PairDispersionD3::PairDispersionD3(LAMMPS *lmp) : Pair(lmp) { nmax = 0; comm_forward = 2; @@ -74,13 +70,14 @@ PairD3::PairD3(LAMMPS *lmp) : Pair(lmp) restartinfo = 0; manybody_flag = 1; one_coeff = 1; + single_enable = 0; } /* ---------------------------------------------------------------------- Destructor (Required) ------------------------------------------------------------------------- */ -PairD3::~PairD3() +PairDispersionD3::~PairDispersionD3() { if (allocated) { memory->destroy(setflag); @@ -103,7 +100,7 @@ PairD3::~PairD3() Allocate all arrays (Required) ------------------------------------------------------------------------- */ -void PairD3::allocate() +void PairDispersionD3::allocate() { allocated = 1; int n = atom->ntypes; @@ -128,17 +125,9 @@ void PairD3::allocate() pair_style d3 rthr cn_thr damping_type ------------------------------------------------------------------------- */ -void PairD3::settings(int narg, char **arg) { +void PairDispersionD3::settings(int narg, char **arg) { - if (narg != 4) { - error->all(FLERR, - "Pair_style d3 needs 4 arguments:\n" - "\t damping_type : type of the damping\n" - "\t functional_name : name of the functional\n" - "\t rthr : threshold for dispersion interaction\n" - "\t cn_thr : threshold for coordination number calculation\n" - ); - } + if (narg != 4) error->all(FLERR, "Pair_style dispersion/d3 needs 4 arguments"); damping_type = arg[0]; std::string functional_name = arg[1]; @@ -154,10 +143,10 @@ void PairD3::settings(int narg, char **arg) { } /* ---------------------------------------------------------------------- - finds atomic number (used in PairD3::coeff) + finds atomic number (used in PairDispersionD3::coeff) ------------------------------------------------------------------------- */ -int PairD3::find_atomic_number(std::string& key) { +int PairDispersionD3::find_atomic_number(std::string& key) { std::transform(key.begin(), key.end(), key.begin(), ::tolower); if (key.length() == 1) { key += " "; } @@ -189,10 +178,10 @@ int PairD3::find_atomic_number(std::string& key) { } /* ---------------------------------------------------------------------- - Check whether an integer value in an integer array (used in PairD3::coeff) + Check whether an integer value in an integer array (used in PairDispersionD3::coeff) ------------------------------------------------------------------------- */ -std::vector PairD3::is_int_in_array(int array[], int size, int value) { +std::vector PairDispersionD3::is_int_in_array(int array[], int size, int value) { std::vector indices; for (int i = 0; i < size; ++i) { if (array[i] == value) { @@ -204,11 +193,11 @@ std::vector PairD3::is_int_in_array(int array[], int size, int value) { /* ---------------------------------------------------------------------- - Read r0ab values from r0ab.csv (used in PairD3::coeff) + Read r0ab values from r0ab.csv (used in PairDispersionD3::coeff) ------------------------------------------------------------------------- */ -void PairD3::read_r0ab(int* atomic_numbers, int ntypes) { - +void PairDispersionD3::read_r0ab(int* atomic_numbers, int ntypes) { + const double r0ab_table[NUM_ELEMENTS][NUM_ELEMENTS] = R0AB_TABLE; for (int i = 1; i <= ntypes; i++) { @@ -219,10 +208,10 @@ void PairD3::read_r0ab(int* atomic_numbers, int ntypes) { } /* ---------------------------------------------------------------------- - Get atom pair indices and grid indices (used in PairD3::read_c6ab) + Get atom pair indices and grid indices (used in PairDispersionD3::read_c6ab) ------------------------------------------------------------------------- */ -void PairD3::set_limit_in_pars_array(int& idx_atom_1, int& idx_atom_2, int& idx_i, int& idx_j) { +void PairDispersionD3::set_limit_in_pars_array(int& idx_atom_1, int& idx_atom_2, int& idx_i, int& idx_j) { idx_i = 0; idx_j = 0; @@ -240,10 +229,10 @@ void PairD3::set_limit_in_pars_array(int& idx_atom_1, int& idx_atom_2, int& idx_ } /* ---------------------------------------------------------------------- - Read c6ab values from c6ab.csv (used in PairD3::coeff) + Read c6ab values from c6ab.csv (used in PairDispersionD3::coeff) ------------------------------------------------------------------------- */ -void PairD3::read_c6ab(int* atomic_numbers, int ntypes) { +void PairDispersionD3::read_c6ab(int* atomic_numbers, int ntypes) { for (int i = 0; i <= ntypes; i++) { mxci[i] = 0; } int grid_i = 0, grid_j = 0; @@ -292,7 +281,7 @@ void PairD3::read_c6ab(int* atomic_numbers, int ntypes) { pair_coeff * * path_r0ab.csv path_c6ab.csv functional element1 element2 ... ------------------------------------------------------------------------- */ -void PairD3::coeff(int narg, char **arg) { +void PairDispersionD3::coeff(int narg, char **arg) { int ntypes = atom->ntypes; if (narg != ntypes + 2) { error->all(FLERR, "Pair_coeff * * needs: element1 element2 ..."); } @@ -391,7 +380,7 @@ void PairD3::coeff(int narg, char **arg) { Calculate coordination number of atoms ------------------------------------------------------------------------- */ -void PairD3::calc_coordination_number() { +void PairDispersionD3::calc_coordination_number() { double **x = atom->x; int *type = atom->type; @@ -433,14 +422,14 @@ void PairD3::calc_coordination_number() { delrj[0] = x[i][0] - x[j][0]; delrj[1] = x[i][1] - x[j][1]; delrj[2] = x[i][2] - x[j][2]; - + double rsq = delrj[0]*delrj[0] + delrj[1]*delrj[1] + delrj[2]*delrj[2]; // if the atoms are too far away don't consider the contribution if (rsq > cn_thr) continue; double rr = sqrt(rsq); - double rcov_ij = (rcov[itype] + rcov[jtype]) * autoang; + double rcov_ij = (rcov[itype] + rcov[jtype]) * autoang; double cn_ij = 1.0f / (1.0f + expf(-K1*((rcov_ij/rr)-1.0f))); // update coordination number @@ -460,18 +449,18 @@ void PairD3::calc_coordination_number() { Get derivative of C6 ------------------------------------------------------------------------- */ -double* PairD3::get_dC6(int iat, int jat, double cni, double cnj){ +double* PairDispersionD3::get_dC6(int iat, int jat, double cni, double cnj){ static double c6_res[3] = {}; - double c6_ref, itype, jtype, cni_ref, cnj_ref; + double c6_ref, cni_ref, cnj_ref; double c6mem, r_save, r; double expterm, term; double num, den, d_num_i, d_num_j, d_den_i, d_den_j; c6mem = -1.0e20f, r_save = 1.0e20f; - num = 0 ; den = 0 ; d_num_i = 0 ; d_num_j = 0; d_den_i = 0; d_den_j = 0; + num = 0 ; den = 0 ; d_num_i = 0 ; d_num_j = 0; d_den_i = 0; d_den_j = 0; - for (int ci = 0; ci <= mxci[iat]; ci++){ + for (int ci = 0; ci <= mxci[iat]; ci++){ for (int cj = 0; cj <= mxci[jat]; cj++){ c6_ref = c6ab[iat][jat][ci][cj][0]; @@ -489,7 +478,7 @@ double* PairD3::get_dC6(int iat, int jat, double cni, double cnj){ } expterm = exp(static_cast(K3) * static_cast(r)); - + num += c6_ref*expterm; den += expterm; @@ -512,7 +501,7 @@ double* PairD3::get_dC6(int iat, int jat, double cni, double cnj){ c6_res[2] = ((d_num_j*den)-(d_den_j*num)) / (den*den); } else { c6_res[0] = c6mem; c6_res[1] = 0; c6_res[2] = 0; - } + } return c6_res; } @@ -520,7 +509,7 @@ double* PairD3::get_dC6(int iat, int jat, double cni, double cnj){ Compute : energy, force, and stress (Required) ------------------------------------------------------------------------- */ -void PairD3::compute(int eflag, int vflag) { +void PairDispersionD3::compute(int eflag, int vflag) { std::unordered_map dampingMap = { {"zero", 1}, {"zerom", 2}, {"bj", 3}, {"bjm", 4} @@ -537,10 +526,10 @@ void PairD3::compute(int eflag, int vflag) { int *type = atom->type; int nlocal = atom->nlocal; - double *special_lj = force->special_lj; + double *special_lj = force->special_lj; int newton_pair = force->newton_pair; - int inum = list->inum; + int inum = list->inum; int* ilist = list->ilist; int* numneigh = list->numneigh; int** firstneigh = list->firstneigh; @@ -556,7 +545,7 @@ void PairD3::compute(int eflag, int vflag) { int jnum = numneigh[i]; int* jlist = firstneigh[i]; - + // fprintf(stderr, "> i, type[i], CN[i], C6[i,i] : %d, %d, %f, %f\n", atom->tag[i], type[i], cn[i], get_dC6(type[i],type[i],cn[i],cn[i])[0]/(autoev*pow(autoang,6))); for (int jj = 0; jj < jnum; jj++) { @@ -570,7 +559,7 @@ void PairD3::compute(int eflag, int vflag) { double delz = ztmp - x[j][2]; double rsq = delx*delx + dely*dely + delz*delz; - + if (rsq < cutsq[type[i]][type[j]]) { double r = sqrt(rsq); @@ -650,7 +639,7 @@ void PairD3::compute(int eflag, int vflag) { t6 = r6+pow((a1*r0+a2),6); t8 = r8+pow((a1*r0+a2),8); - e6 = C6/t6; + e6 = C6/t6; e8 = C8/t8; tmp6 = 6.0*s6*C6*r4/(t6*t6); @@ -658,7 +647,7 @@ void PairD3::compute(int eflag, int vflag) { fpair = -(tmp6+tmp8) ; fpair *= factor_lj; - } + } break; case 4:{ // bjm @@ -671,7 +660,7 @@ void PairD3::compute(int eflag, int vflag) { t6 = r6+pow((a1*r0+a2),6); t8 = r8+pow((a1*r0+a2),8); - e6 = C6/t6; + e6 = C6/t6; e8 = C8/t8; tmp6 = 6.0*s6*C6*r4/(t6*t6); @@ -701,7 +690,7 @@ void PairD3::compute(int eflag, int vflag) { f[j][2] -= delz*fpair; } - if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); + if (evflag) ev_tally(i,j,nlocal,newton_pair,evdwl,0.0,fpair,delx,dely,delz); } } } @@ -712,7 +701,7 @@ void PairD3::compute(int eflag, int vflag) { comm->forward_comm(this); // After calculating all derivatives dE/dr_ij w.r.t. distances, - // the grad w.r.t. the coordinates is calculated dE/dr_ij * dr_ij/dxyz_i + // the grad w.r.t. the coordinates is calculated dE/dr_ij * dr_ij/dxyz_i for (int ii = 0; ii < inum; ii++) { int i = ilist[ii]; @@ -720,10 +709,10 @@ void PairD3::compute(int eflag, int vflag) { double xtmp = x[i][0]; double ytmp = x[i][1]; double ztmp = x[i][2]; - + int jnum = numneigh[i]; int* jlist = firstneigh[i]; - + for (int jj = 0; jj < jnum; jj++) { int j = jlist[jj]; @@ -735,7 +724,7 @@ void PairD3::compute(int eflag, int vflag) { double delz = ztmp - x[j][2]; double rsq = delx*delx + dely*dely + delz*delz; - + if (rsq < cutsq[type[i]][type[j]]) { double r = sqrt(rsq); @@ -762,7 +751,7 @@ void PairD3::compute(int eflag, int vflag) { f[j][1] -= dely*fpair; f[j][2] -= delz*fpair; } - if (evflag) ev_tally(i,j,nlocal,newton_pair,0.0,0.0,fpair,delx,dely,delz); + if (evflag) ev_tally(i,j,nlocal,newton_pair,0.0,0.0,fpair,delx,dely,delz); } } } @@ -770,7 +759,7 @@ void PairD3::compute(int eflag, int vflag) { } -void PairD3::set_funcpar(std::string& functional_name) { +void PairDispersionD3::set_funcpar(std::string& functional_name) { std::unordered_map dampingMap = { {"zero", 1}, {"zerom", 2}, {"bj", 3}, {"bjm", 4} @@ -882,7 +871,7 @@ void PairD3::set_funcpar(std::string& functional_name) { case 3: rs6 = 1.151808; s8 = 1.020078; rs8 = 0.035964; break; case 4: rs6 = 1.279637; s8 = 1.841686; rs8 = 0.014370; break; case 5: rs6 = 1.233460; s8 = 1.945174; rs8 = 0.000000; break; - case 6: rs6 = 2.340218; s8 = 0.000000; rs8 = 0.129434; break; + case 6: rs6 = 2.340218; s8 = 0.000000; rs8 = 0.129434; break; case 7: rs6 = 2.077949; s8 = 0.000081; rs8 = 0.116755; break; case 8: rs6 = 1.366361; s8 = 1.280619; rs8 = 0.003160; break; default: @@ -993,7 +982,7 @@ void PairD3::set_funcpar(std::string& functional_name) { //fprintf(stderr,"alpha : %f\n", alpha); a2 = a2*autoang; - } + } break; case 4:{ // bjm @@ -1041,7 +1030,7 @@ void PairD3::set_funcpar(std::string& functional_name) { init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ -double PairD3::init_one(int i, int j) { +double PairDispersionD3::init_one(int i, int j) { if (setflag[i][j] == 0) error->all(FLERR, "All pair coeffs are not set"); @@ -1050,7 +1039,7 @@ double PairD3::init_one(int i, int j) { return std::sqrt(rthr); } -void PairD3::init_style() +void PairDispersionD3::init_style() { if (atom->tag_enable == 0) error->all(FLERR,"Pair style D3 requires atom IDs"); @@ -1065,7 +1054,7 @@ void PairD3::init_style() Communication ------------------------------------------------------------------------- */ -int PairD3::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) +int PairDispersionD3::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, int * /*pbc*/) { int i,j,m; @@ -1079,14 +1068,14 @@ int PairD3::pack_forward_comm(int n, int *list, double *buf, int /*pbc_flag*/, i if (communicationStage == 2) { for (i = 0; i < n; i ++) { j = list[i]; - buf[m++] = dc6[j]; + buf[m++] = dc6[j]; } } return m; } -void PairD3::unpack_forward_comm(int n, int first, double *buf) +void PairDispersionD3::unpack_forward_comm(int n, int first, double *buf) { int i,m,last; @@ -1104,7 +1093,7 @@ void PairD3::unpack_forward_comm(int n, int first, double *buf) } } -int PairD3::pack_reverse_comm(int n, int first, double *buf) +int PairDispersionD3::pack_reverse_comm(int n, int first, double *buf) { int i,m,last; @@ -1123,7 +1112,7 @@ int PairD3::pack_reverse_comm(int n, int first, double *buf) return m; } -void PairD3::unpack_reverse_comm(int n, int *list, double *buf) +void PairDispersionD3::unpack_reverse_comm(int n, int *list, double *buf) { int i,j,m; @@ -1139,5 +1128,5 @@ void PairD3::unpack_reverse_comm(int n, int *list, double *buf) j = list[i]; dc6[j] += buf[m++]; } - } + } } diff --git a/src/EXTRA-PAIR/pair_d3.h b/src/EXTRA-PAIR/pair_dispersion_d3.h similarity index 85% rename from src/EXTRA-PAIR/pair_d3.h rename to src/EXTRA-PAIR/pair_dispersion_d3.h index ae6d749dd2..58575c8a2e 100644 --- a/src/EXTRA-PAIR/pair_d3.h +++ b/src/EXTRA-PAIR/pair_dispersion_d3.h @@ -9,34 +9,27 @@ the GNU General Public License. See the README file in the top-level LAMMPS directory. - ------------------------------------------------------------------------- - Contributing authors: - Sonia Salomoni^1,^2 - Arthur France-Lanord^1 - - ^1: IMPMC, CNRS, Sorbonne Universite, Paris, France - ^2: SCAI, Sorbonne Universite, Paris, France ------------------------------------------------------------------------- */ #ifdef PAIR_CLASS // clang-format off -PairStyle(d3,PairD3); +PairStyle(dispersion/d3,PairDispersionD3); // clang-format on #else -#ifndef LMP_PAIR_D3_H -#define LMP_PAIR_D3_H +#ifndef LMP_PAIR_DISPERSION_D3_H +#define LMP_PAIR_DISPERSION_D3_H #include "pair.h" namespace LAMMPS_NS { -class PairD3 : public Pair { +class PairDispersionD3 : public Pair { public: - PairD3(class LAMMPS *); - ~PairD3() override; + PairDispersionD3(class LAMMPS *); + ~PairDispersionD3() override; void compute(int, int) override; @@ -74,7 +67,7 @@ class PairD3 : public Pair { double* dc6 = nullptr; // dC6i(iat) saves dE_dsp/dCN(iat) int communicationStage; // communication stage - + void allocate(); virtual void set_funcpar(std::string&); @@ -82,7 +75,7 @@ class PairD3 : public Pair { int find_atomic_number(std::string&); std::vector is_int_in_array(int*, int, int); - + void read_r0ab(int*, int); void set_limit_in_pars_array(int&, int&, int&, int&); void read_c6ab(int*, int); diff --git a/unittest/force-styles/tests/manybody-pair-d3.yaml b/unittest/force-styles/tests/manybody-pair-d3.yaml deleted file mode 100644 index c080247b89..0000000000 --- a/unittest/force-styles/tests/manybody-pair-d3.yaml +++ /dev/null @@ -1,155 +0,0 @@ ---- -lammps_version: 17 Apr 2024 -tags: generated -date_generated: Mon Dec 9 17:36:37 2024 -epsilon: 1e-11 -skip_tests: single -prerequisites: ! | - pair d3 -pre_commands: ! "" -post_commands: ! "" -input_file: in.manybody -pair_style: d3 zero pbe 12.0 12.0 -pair_coeff: ! | - * * Si Si Si Si Si Si Si Si -extract: ! "" -natoms: 64 -init_vdwl: -9.262365243925203 -init_coul: 0 -init_stress: ! |- - -1.8070680187151131e+00 -1.8151671933941584e+00 -1.9214651828014326e+00 -4.1552461934576006e-02 -7.1708481007728198e-01 -1.3638435806044302e-01 -init_forces: ! |2 - 1 4.5901745485403295e-04 -5.8645004074280530e-03 -2.6408414312694140e-03 - 2 4.1982212100084848e-02 7.7916988681057701e-03 4.1558505657116980e-03 - 3 -1.0599537920220059e-03 -1.5284351930588387e-03 1.3250226337933743e-03 - 4 1.2952849248662775e-02 -1.2730397233111836e-02 6.4718612422628536e-03 - 5 1.9307066713768282e-03 3.1031437418921910e-03 3.5451961493820740e-03 - 6 6.0636534459212882e-03 -3.4538157278896163e-02 -1.5549038115507513e-02 - 7 -5.5478612765789935e-03 9.7600792853363150e-03 -2.1450928858953930e-02 - 8 1.7128888892908867e-05 -1.3865910341446424e-04 8.9170060388590313e-04 - 9 -5.8527207667384923e-02 8.5011601448529789e-02 7.9837310968768324e-02 - 10 -9.9174557740649288e-03 1.3163286903593812e-02 1.2367199081011528e-02 - 11 -2.0922976094767239e-02 1.7815876096389776e-02 -3.2459912597209782e-02 - 12 9.4039240797152590e-02 3.7466484050302624e-02 -9.4966824527940915e-03 - 13 -4.3611820849020655e-02 -7.5650463282748284e-02 4.1545920231526583e-02 - 14 1.3914348002543740e-02 -9.8186445921730793e-03 -1.5039026972733623e-02 - 15 9.8798529625617471e-02 -9.6939234781371439e-02 -3.5897115913423899e-02 - 16 -1.8828449808052237e-02 1.0084992428372604e-02 -1.6621409829588641e-02 - 17 1.8867454991507823e-02 -3.3410341394944157e-02 5.8649656809196309e-02 - 18 -5.7757244225337357e-03 3.7525864843647697e-03 -1.7465564584510023e-02 - 19 7.3146350316925512e-03 -5.0979152014509572e-03 -5.7918363022845080e-03 - 20 1.2526948567372337e-01 3.4964179752050586e-02 -4.0345565596353550e-02 - 21 -7.9108983380917194e-02 -7.4234491595904575e-02 7.8298798238034567e-02 - 22 3.3256958028948028e-02 -3.5876634770494304e-03 -5.5658445829460078e-03 - 23 -9.4983041889442843e-02 -1.6190744701130849e-01 6.5979264487847342e-02 - 24 -3.9837469553195448e-02 2.5364084068168865e-02 -2.8343465970054268e-02 - 25 -7.3424056488810893e-03 -1.1672660197222877e-02 -4.2413533422096137e-03 - 26 7.1482435753173978e-02 7.9794866671089565e-02 -1.2051822894855302e-01 - 27 -1.2443813759872715e-02 -4.4129787717125659e-03 -4.9977234669242657e-03 - 28 -5.0454676860651063e-03 -4.8367643809983244e-03 -9.7359590837120241e-03 - 29 5.0973790723890279e-02 -3.5296812999801377e-02 -1.5607922719867863e-02 - 30 6.9152527688984819e-02 -1.5810831588146963e-03 3.8412598769159367e-02 - 31 2.4462929866513206e-02 -3.5045453885110815e-02 -1.9154039469347770e-02 - 32 2.9037764603397378e-02 -6.8595457740301298e-03 -3.2736895683665988e-03 - 33 -2.3571014332676696e-02 7.4043101417658073e-03 -2.8705289221235150e-02 - 34 -1.4606618276415169e-02 -9.1068958189810610e-04 -8.5624378212242527e-03 - 35 -3.2510043399847137e-02 -2.8006234735108673e-02 -4.6845303267092589e-02 - 36 6.2991561292220326e-03 2.3238393611931946e-02 -5.8116057373416774e-03 - 37 2.6891579367550652e-02 -1.3896976667148994e-02 3.1371675516263159e-02 - 38 2.0868635137082342e-02 5.0357172401113842e-03 -5.3296214166774630e-03 - 39 -8.0127916540051650e-02 -3.7084303700723187e-02 1.2218320413894672e-01 - 40 -3.9584086175377592e-02 1.4186027995495971e-02 -1.1786983668096024e-02 - 41 -2.4078556291313152e-02 2.3979806393375630e-02 3.9808779679609198e-02 - 42 1.2092253594061965e-01 7.0237820535165529e-02 -6.7634093707697934e-02 - 43 -4.7905857362083089e-02 1.7234517679588787e-01 6.1081728343859443e-02 - 44 -8.9268222626455868e-02 1.0935256562868768e-01 4.9391188697389531e-02 - 45 -1.0932468616629654e-02 -1.1437973175510943e-02 2.2070666035021818e-02 - 46 -3.6031863619124846e-02 2.6734739237702171e-02 -3.3611450622333013e-02 - 47 1.4499510937770043e-03 -1.4213296755659972e-02 -2.3112798778515177e-04 - 48 -1.3767091667320651e-02 -3.0136222295009791e-03 1.3113656018437793e-02 - 49 -9.7091853089158325e-03 3.6127847100198028e-02 1.4509648101942035e-02 - 50 8.4557962872537848e-02 -1.0736631874106438e-01 9.9597088995020677e-02 - 51 -1.0386138512337374e-02 -2.0257306344291497e-02 -3.3076970021155658e-02 - 52 -4.6611247598267555e-02 6.5689772896870391e-02 1.9370639128294540e-02 - 53 -5.5610674299579610e-03 -1.4027210047753987e-02 8.7210863654412565e-03 - 54 -4.3167807436909698e-02 5.3419018642258016e-02 -1.5968205469941175e-02 - 55 2.1005445039043447e-03 1.5540888556331189e-02 3.0653660866053294e-02 - 56 -2.0590128155749919e-04 -4.1762635052692443e-03 1.7714423658216408e-02 - 57 1.0284475500160662e-02 4.9815307652019795e-03 1.2436353037813486e-02 - 58 -1.0342665677846569e-01 -1.9280058549113892e-02 -7.4866501787840767e-02 - 59 -2.3544588144277776e-03 3.6121601436188973e-03 -4.6871795309287806e-03 - 60 -5.4150709547244186e-03 5.8612714168733107e-02 1.4839344483422201e-02 - 61 2.7954413595536829e-03 -5.0942788273584158e-02 7.2754423090722080e-03 - 62 1.1252409113821953e-01 -8.8720719845166385e-02 5.4683231088491491e-02 - 63 -3.1773161310039773e-02 3.6061405688573842e-02 -3.8399113603086052e-02 - 64 -1.4722975703867254e-02 -2.6147363467761031e-02 -2.1059016257482918e-01 -run_vdwl: -9.262826276442015 -run_coul: 0 -run_stress: ! |- - -1.8014717164118095e+00 -1.8087390491573838e+00 -1.9142638713109481e+00 -3.9974176680151442e-02 -7.1417886608373016e-01 -1.3759726037342584e-01 -run_forces: ! |2 - 1 4.7667962897357161e-04 -5.8467702637711484e-03 -2.6991867527471512e-03 - 2 4.1869408756652363e-02 8.4979875395407335e-03 3.4984717622547718e-03 - 3 -9.9160928359434165e-04 -1.4869879159063026e-03 1.2223462368831279e-03 - 4 1.3147106330966834e-02 -1.2926544725178195e-02 6.7789603915220410e-03 - 5 1.9770775494690725e-03 3.1765296745866244e-03 3.5629842560420720e-03 - 6 5.7506960289548086e-03 -3.4699407410875724e-02 -1.5506043491316254e-02 - 7 -5.3406567968898640e-03 9.4551314879620617e-03 -2.0752905865024943e-02 - 8 8.7145147977422260e-05 -2.8842759092264801e-05 8.0207322297105345e-04 - 9 -5.8415508752186096e-02 8.4979266053546693e-02 7.9622715915771303e-02 - 10 -9.9578406937796439e-03 1.3145690562643045e-02 1.2350278010619288e-02 - 11 -2.0970548283965822e-02 1.7641558318643526e-02 -3.3050100269831226e-02 - 12 9.5891788552647905e-02 3.8024542707268488e-02 -9.8061835208236598e-03 - 13 -4.4952222762057452e-02 -7.6842596097771221e-02 4.2613909344784678e-02 - 14 1.4295961616915508e-02 -1.0328974978549363e-02 -1.5428512523395358e-02 - 15 9.9943438549559324e-02 -9.7907452663447983e-02 -3.6257259204324190e-02 - 16 -1.8390119036231254e-02 9.7159754167479712e-03 -1.6211888958432827e-02 - 17 1.8981263201349942e-02 -3.3819017834167138e-02 5.9290153984855036e-02 - 18 -5.6513870203370861e-03 3.7641108670888137e-03 -1.7558647302694921e-02 - 19 7.4901241602777988e-03 -4.9270563652220887e-03 -5.9132694166840003e-03 - 20 1.2404887106132249e-01 3.4634285209304783e-02 -4.0135253432049663e-02 - 21 -7.8277898322380690e-02 -7.3279299053891203e-02 7.8010388044320325e-02 - 22 3.3238064217446656e-02 -3.5092881124568851e-03 -5.5130499474961214e-03 - 23 -9.5777464813086854e-02 -1.6270801791195924e-01 6.6577987309083805e-02 - 24 -4.0548984396490580e-02 2.6001318437117903e-02 -2.8710977732994785e-02 - 25 -7.2079783094212008e-03 -1.1551923848041689e-02 -3.9390884716931050e-03 - 26 7.2339414718789685e-02 7.9165643726239313e-02 -1.2169899192698079e-01 - 27 -1.2311213314223447e-02 -4.3068558469614186e-03 -4.9048891096525275e-03 - 28 -5.1134183165409582e-03 -4.9743298117876514e-03 -9.7660849582700982e-03 - 29 5.0646655326840248e-02 -3.5366362317264768e-02 -1.5821692477208313e-02 - 30 6.8872718304629946e-02 -2.6404120131308211e-04 3.9973810776214556e-02 - 31 2.4365821184347394e-02 -3.5211120753030921e-02 -1.9277907381945410e-02 - 32 2.9047476663902016e-02 -6.6602395044956511e-03 -3.0527687948843541e-03 - 33 -2.3100260653032955e-02 7.7806328406423821e-03 -2.8840665483715618e-02 - 34 -1.4082353101335789e-02 -1.2664441844283637e-03 -8.7897343649273926e-03 - 35 -3.2837748483424821e-02 -2.8259033655048716e-02 -4.7109045095735221e-02 - 36 6.3043838063683473e-03 2.2728472759162045e-02 -5.6021644135329923e-03 - 37 2.6212204686130034e-02 -1.3029975561842381e-02 3.1750286301194183e-02 - 38 2.0139944495106622e-02 4.3293211982739187e-03 -6.1649221929395912e-03 - 39 -7.8960492061368320e-02 -3.6406243903921401e-02 1.2184492984680016e-01 - 40 -3.9632145335340999e-02 1.3535049462025148e-02 -1.1321798674348533e-02 - 41 -2.4388307314468449e-02 2.3366329744906832e-02 3.8928089365769816e-02 - 42 1.1996964454673913e-01 6.9851097788973082e-02 -6.7069886963212297e-02 - 43 -4.8078980460622062e-02 1.7214309659743252e-01 6.1467794063077237e-02 - 44 -9.0284549182458221e-02 1.1015441455438249e-01 5.0331470972200497e-02 - 45 -1.0780088805510608e-02 -1.1270483123892882e-02 2.2080179359507665e-02 - 46 -3.6837588908592935e-02 2.7230340588058007e-02 -3.4349458876726219e-02 - 47 1.9027883758890351e-03 -1.3952420712156162e-02 -8.4498460315278066e-04 - 48 -1.3553909305246262e-02 -3.5297267660297201e-03 1.3635814385290735e-02 - 49 -9.5576836166616046e-03 3.6186064165354859e-02 1.4320944961491736e-02 - 50 8.5217870424105446e-02 -1.0799325877459537e-01 1.0051859972453785e-01 - 51 -1.0113063819708310e-02 -2.0226413845647481e-02 -3.3234528125131467e-02 - 52 -4.6943693419275380e-02 6.5649633276221267e-02 1.9270389824586502e-02 - 53 -5.4874429234138388e-03 -1.4030397181841880e-02 8.5032803277714855e-03 - 54 -4.2513762110625415e-02 5.3134910653632295e-02 -1.5583625457217259e-02 - 55 2.2355622337947943e-03 1.5758808063886333e-02 3.0512038080609420e-02 - 56 2.6470325853502827e-04 -3.6590608029393578e-03 1.7588493434887068e-02 - 57 1.0304091828004703e-02 5.7001837787072690e-03 1.2617318639445109e-02 - 58 -1.0367740873897520e-01 -1.9270956096739674e-02 -7.4383753859322305e-02 - 59 -2.4598814289387631e-03 3.6232140002483829e-03 -4.7141806923593913e-03 - 60 -5.0750993143057026e-03 5.8880547695610790e-02 1.4800121802056596e-02 - 61 2.7189101908894160e-03 -5.1306885575781225e-02 7.3310325603516196e-03 - 62 1.1256471950631124e-01 -8.8211823459006702e-02 5.4263270936498222e-02 - 63 -3.2228752476757563e-02 3.6691295193583467e-02 -3.8707049961821866e-02 - 64 -1.5804472791648257e-02 -2.5887199342735968e-02 -2.1134763353880526e-01 -... diff --git a/unittest/force-styles/tests/manybody-pair-dispersion_d3.yaml b/unittest/force-styles/tests/manybody-pair-dispersion_d3.yaml new file mode 100644 index 0000000000..dee89ae2dd --- /dev/null +++ b/unittest/force-styles/tests/manybody-pair-dispersion_d3.yaml @@ -0,0 +1,154 @@ +--- +lammps_version: 19 Nov 2024 +date_generated: Wed Dec 11 15:29:39 2024 +epsilon: 1e-10 +skip_tests: +prerequisites: ! | + pair dispersion/d3 +pre_commands: ! "" +post_commands: ! "" +input_file: in.manybody +pair_style: dispersion/d3 zero pbe 12.0 12.0 +pair_coeff: ! | + * * Si Si Si Si Si Si Si Si +extract: ! "" +natoms: 64 +init_vdwl: -9.262365244070887 +init_coul: 0 +init_stress: ! |- + -1.8070680161672350e+00 -1.8151671910236220e+00 -1.9214651805560712e+00 -4.1552461721989307e-02 -7.1708481048125128e-01 -1.3638435843456306e-01 +init_forces: ! |2 + 1 4.5901744149339814e-04 -5.8645004258887296e-03 -2.6408414442435817e-03 + 2 4.1982212100397494e-02 7.7916988680959785e-03 4.1558505642265483e-03 + 3 -1.0599537919974110e-03 -1.5284351857714875e-03 1.3250226437598804e-03 + 4 1.2952849248980391e-02 -1.2730397232186651e-02 6.4718612421368858e-03 + 5 1.9307066949767124e-03 3.1031437654175332e-03 3.5451961708816851e-03 + 6 6.0636534612296018e-03 -3.4538157294514024e-02 -1.5549038123319472e-02 + 7 -5.5478612773693318e-03 9.7600792842619001e-03 -2.1450928859339292e-02 + 8 1.7128887807534021e-05 -1.3865910298862735e-04 8.9170060304616253e-04 + 9 -5.8527207660040638e-02 8.5011601463707259e-02 7.9837310973084497e-02 + 10 -9.9174557760647319e-03 1.3163286906290764e-02 1.2367199083459195e-02 + 11 -2.0922976098149738e-02 1.7815876096333588e-02 -3.2459912594439561e-02 + 12 9.4039240797013243e-02 3.7466484052249387e-02 -9.4966824523796730e-03 + 13 -4.3611820846840114e-02 -7.5650463287387754e-02 4.1545920229193796e-02 + 14 1.3914347992697577e-02 -9.8186446053987742e-03 -1.5039026985332828e-02 + 15 9.8798529628413748e-02 -9.6939234786348333e-02 -3.5897115916559530e-02 + 16 -1.8828449808127548e-02 1.0084992417269656e-02 -1.6621409840469250e-02 + 17 1.8867454988099414e-02 -3.3410341395584034e-02 5.8649656805337354e-02 + 18 -5.7757243295743490e-03 3.7525865932555918e-03 -1.7465564682291646e-02 + 19 7.3146350339646261e-03 -5.0979152089016683e-03 -5.7918362966919833e-03 + 20 1.2526948607359642e-01 3.4964179836823706e-02 -4.0345565678621194e-02 + 21 -7.9108983611317768e-02 -7.4234491850519224e-02 7.8298798433197120e-02 + 22 3.3256958035759267e-02 -3.5876634662328263e-03 -5.5658445807261810e-03 + 23 -9.4983041888941230e-02 -1.6190744700903256e-01 6.5979264480813399e-02 + 24 -3.9837469539795965e-02 2.5364084079376788e-02 -2.8343465953968475e-02 + 25 -7.3424056398832139e-03 -1.1672660207324508e-02 -4.2413533423389452e-03 + 26 7.1482435767536698e-02 7.9794866672039319e-02 -1.2051822893472583e-01 + 27 -1.2443813900029382e-02 -4.4129788887813590e-03 -4.9977235842165457e-03 + 28 -5.0454676878239251e-03 -4.8367643826771898e-03 -9.7359590852317181e-03 + 29 5.0973790709941257e-02 -3.5296812997722318e-02 -1.5607922729704526e-02 + 30 6.9152527680774289e-02 -1.5810831557831798e-03 3.8412598766233222e-02 + 31 2.4462930027397904e-02 -3.5045454052408158e-02 -1.9154039485981871e-02 + 32 2.9037764598216036e-02 -6.8595457693026449e-03 -3.2736895722578810e-03 + 33 -2.3571014326886783e-02 7.4043101437256172e-03 -2.8705289218120600e-02 + 34 -1.4606618211317998e-02 -9.1068965341847558e-04 -8.5624377570787912e-03 + 35 -3.2510043401035402e-02 -2.8006234725365901e-02 -4.6845303279608771e-02 + 36 6.2991561249353990e-03 2.3238393607814253e-02 -5.8116057369683007e-03 + 37 2.6891579366883651e-02 -1.3896976671852732e-02 3.1371675512071220e-02 + 38 2.0868635140715318e-02 5.0357172404813764e-03 -5.3296214134632008e-03 + 39 -8.0127916540111269e-02 -3.7084303697709070e-02 1.2218320413943409e-01 + 40 -3.9584086191698675e-02 1.4186027994256518e-02 -1.1786983662869569e-02 + 41 -2.4078556290238202e-02 2.3979806392354495e-02 3.9808779679712705e-02 + 42 1.2092253594807115e-01 7.0237820528219294e-02 -6.7634093701619297e-02 + 43 -4.7905857363210326e-02 1.7234517679973846e-01 6.1081728342102619e-02 + 44 -8.9268222669576444e-02 1.0935256558697629e-01 4.9391188655423857e-02 + 45 -1.0932468625449131e-02 -1.1437973186082834e-02 2.2070666035756106e-02 + 46 -3.6031863627779687e-02 2.6734739238025461e-02 -3.3611450612771009e-02 + 47 1.4499510792417522e-03 -1.4213296744594713e-02 -2.3112799817407201e-04 + 48 -1.3767091755648294e-02 -3.0136222933599762e-03 1.3113656065372467e-02 + 49 -9.7091851340953099e-03 3.6127847173236860e-02 1.4509648044635070e-02 + 50 8.4557962865172906e-02 -1.0736631874343017e-01 9.9597088988686328e-02 + 51 -1.0386138512718579e-02 -2.0257306348498042e-02 -3.3076970024004795e-02 + 52 -4.6611247598798901e-02 6.5689772901113247e-02 1.9370639130365311e-02 + 53 -5.5610674070546090e-03 -1.4027210037762585e-02 8.7210863818644770e-03 + 54 -4.3167807623476724e-02 5.3419018792160038e-02 -1.5968205606008208e-02 + 55 2.1005445106472131e-03 1.5540888545067990e-02 3.0653660856435228e-02 + 56 -2.0590128088026315e-04 -4.1762635041913861e-03 1.7714423656329605e-02 + 57 1.0284475505097292e-02 4.9815307763691908e-03 1.2436353033202291e-02 + 58 -1.0342665676627626e-01 -1.9280058551284476e-02 -7.4866501808988087e-02 + 59 -2.3544588605186314e-03 3.6121601861319316e-03 -4.6871794758065605e-03 + 60 -5.4150711425366791e-03 5.8612714396504555e-02 1.4839344681837788e-02 + 61 2.7954413433097583e-03 -5.0942788256137531e-02 7.2754423172912289e-03 + 62 1.1252409114510897e-01 -8.8720719849435095e-02 5.4683231090040328e-02 + 63 -3.1773161308752101e-02 3.6061405691521872e-02 -3.8399113596128895e-02 + 64 -1.4722975703463983e-02 -2.6147363460941667e-02 -2.1059016257148011e-01 +run_vdwl: -9.262826276539041 +run_coul: 0 +run_stress: ! |- + -1.8014717148220629e+00 -1.8087390477796537e+00 -1.9142638698777830e+00 -3.9974176411585433e-02 -7.1417886625446692e-01 -1.3759726065342742e-01 +run_forces: ! |2 + 1 4.7667962871302064e-04 -5.8467702639815730e-03 -2.6991867530137183e-03 + 2 4.1869408756196061e-02 8.4979875396755736e-03 3.4984717617200642e-03 + 3 -9.9160928389676294e-04 -1.4869879157543243e-03 1.2223462368121266e-03 + 4 1.3147106326425097e-02 -1.2926544726456277e-02 6.7789603977131685e-03 + 5 1.9770775501047611e-03 3.1765296749256397e-03 3.5629842559820419e-03 + 6 5.7506960260337615e-03 -3.4699407409212034e-02 -1.5506043496333955e-02 + 7 -5.3406567846472110e-03 9.4551314732373871e-03 -2.0752905880674206e-02 + 8 8.7145147942647994e-05 -2.8842758704853994e-05 8.0207322231987555e-04 + 9 -5.8415508752920696e-02 8.4979266050254798e-02 7.9622715923589979e-02 + 10 -9.9578406934257829e-03 1.3145690562371913e-02 1.2350278008781093e-02 + 11 -2.0970548283900613e-02 1.7641558319062160e-02 -3.3050100269910745e-02 + 12 9.5891788559756261e-02 3.8024542707650773e-02 -9.8061835139289615e-03 + 13 -4.4952222762277574e-02 -7.6842596098760999e-02 4.2613909344851382e-02 + 14 1.4295961622308551e-02 -1.0328974985624625e-02 -1.5428512528767140e-02 + 15 9.9943438550046268e-02 -9.7907452664271769e-02 -3.6257259204378979e-02 + 16 -1.8390119036246416e-02 9.7159754168328807e-03 -1.6211888959160415e-02 + 17 1.8981263199444591e-02 -3.3819017834561864e-02 5.9290153986863804e-02 + 18 -5.6513870204191862e-03 3.7641108672139441e-03 -1.7558647302488333e-02 + 19 7.4901241599460017e-03 -4.9270563654430326e-03 -5.9132694173721096e-03 + 20 1.2404887106966292e-01 3.4634285214608047e-02 -4.0135253428616791e-02 + 21 -7.8277898329671802e-02 -7.3279299061393410e-02 7.8010388051092297e-02 + 22 3.3238064217578078e-02 -3.5092881119841469e-03 -5.5130499477600743e-03 + 23 -9.5777464822891442e-02 -1.6270801792262735e-01 6.6577987317167353e-02 + 24 -4.0548984401360968e-02 2.6001318442684454e-02 -2.8710977737247827e-02 + 25 -7.2079783062206065e-03 -1.1551923840558299e-02 -3.9390884564980888e-03 + 26 7.2339414723388659e-02 7.9165643731302623e-02 -1.2169899193410784e-01 + 27 -1.2311213312665015e-02 -4.3068558457195986e-03 -4.9048891116894693e-03 + 28 -5.1134183157394847e-03 -4.9743298126113068e-03 -9.7660849586977162e-03 + 29 5.0646655331378507e-02 -3.5366362323187593e-02 -1.5821692482521729e-02 + 30 6.8872718311900991e-02 -2.6404119526525157e-04 3.9973810783156115e-02 + 31 2.4365821183292665e-02 -3.5211120751695441e-02 -1.9277907381276990e-02 + 32 2.9047476664616767e-02 -6.6602395038829866e-03 -3.0527687942334758e-03 + 33 -2.3100260653796608e-02 7.7806328399545937e-03 -2.8840665484158416e-02 + 34 -1.4082353103513787e-02 -1.2664441856360465e-03 -8.7897343645731985e-03 + 35 -3.2837748489127933e-02 -2.8259033656815206e-02 -4.7109045095865137e-02 + 36 6.3043838001276449e-03 2.2728472774255215e-02 -5.6021644246419438e-03 + 37 2.6212204671836617e-02 -1.3029975577260208e-02 3.1750286315189745e-02 + 38 2.0139944452979241e-02 4.3293211501602355e-03 -6.1649221447719615e-03 + 39 -7.8960492305738997e-02 -3.6406244109795260e-02 1.2184493007508632e-01 + 40 -3.9632145471438944e-02 1.3535049580284708e-02 -1.1321798778509602e-02 + 41 -2.4388307313721387e-02 2.3366329734192243e-02 3.8928089351917827e-02 + 42 1.1996964485176551e-01 6.9851097891208414e-02 -6.7069887050515309e-02 + 43 -4.8078980444857013e-02 1.7214309658435833e-01 6.1467794064474092e-02 + 44 -9.0284549171230966e-02 1.1015441455508669e-01 5.0331470960535987e-02 + 45 -1.0780088763184573e-02 -1.1270483165899507e-02 2.2080179323856999e-02 + 46 -3.6837588895857240e-02 2.7230340603483512e-02 -3.4349458862779035e-02 + 47 1.9027883772889591e-03 -1.3952420713065544e-02 -8.4498460237889667e-04 + 48 -1.3553909303709658e-02 -3.5297267658357221e-03 1.3635814385361164e-02 + 49 -9.5576836243609284e-03 3.6186064167046728e-02 1.4320944955278008e-02 + 50 8.5217870416684924e-02 -1.0799325876848664e-01 1.0051859972722318e-01 + 51 -1.0113063844638476e-02 -2.0226413912563735e-02 -3.3234528235788117e-02 + 52 -4.6943693418830201e-02 6.5649633286230746e-02 1.9270389814905101e-02 + 53 -5.4874429583722370e-03 -1.4030397163369601e-02 8.5032803055005886e-03 + 54 -4.2513762116223583e-02 5.3134910658803179e-02 -1.5583625460937492e-02 + 55 2.2355623057473926e-03 1.5758808140961804e-02 3.0512038204829561e-02 + 56 2.6470325258791221e-04 -3.6590607960638329e-03 1.7588493428989670e-02 + 57 1.0304091828730023e-02 5.7001837939965440e-03 1.2617318628876883e-02 + 58 -1.0367740879426791e-01 -1.9270956079747929e-02 -7.4383753891338625e-02 + 59 -2.4598814101855909e-03 3.6232140177768373e-03 -4.7141806905685686e-03 + 60 -5.0750993133886020e-03 5.8880547694201937e-02 1.4800121801422891e-02 + 61 2.7189102310242325e-03 -5.1306885606950549e-02 7.3310325318400645e-03 + 62 1.1256471955447235e-01 -8.8211823429294622e-02 5.4263270982756615e-02 + 63 -3.2228752477428985e-02 3.6691295193452315e-02 -3.8707049961896577e-02 + 64 -1.5804472791823187e-02 -2.5887199342793252e-02 -2.1134763354069236e-01 +...