implemented d3 pair style

This commit is contained in:
soniasalomoni
2024-12-10 17:25:39 +01:00
parent a78aee5731
commit 335069f1ca
5 changed files with 34017 additions and 0 deletions

140
doc/src/pair_d3.rst Normal file
View File

@ -0,0 +1,140 @@
.. index:: pair_style d3
..
.. index:: pair_style d3/kk
pair_style d3 command
=====================
..
Accelerator Variants: *d3/kk*
Syntax
""""""
.. code-block:: LAMMPS
pair_style d3 damping functional cutoff cn_cutoff
* damping = damping function: *zero*, *zerom*, *bj*, or *bjm*
* functional = XC functional form: *pbe*, *pbe0*, etc.
* cutoff = global cutoff (distance units)
* cn_cutoff = coordination number cutoff (distance units)
Examples
""""""""
.. code-block:: LAMMPS
pair_style 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) <Grimme1>`.
The energy contribution :math:`E_i` for an atom :math:`i` is given by:
.. math::
E_i = \frac{1}{2} \sum_{j \neq i} \big(
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,
: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.
Available damping functions are the original "zero-damping" :ref:`(Grimme1) <Grimme1>`,
Becke-Johnson damping :ref:`(Grimme2) <Grimme2>`, and their revised forms :ref:`(Sherrill) <Sherrill>`.
Available XC functional scaling factors are listed in the table below, and depend on
the selected damping function.
+------------------+--------------------------------------------------------------------------------+
| Damping function | XC functional |
+==================+================================================================================+
| | | | slater-dirac-exchange, b-lyp, b-p, b97-d, revpbe, pbe, pbesol, rpw86-pbe, |
| | | | rpbe, tpss, b3-lyp, pbe0, hse06, revpbe38, pw6b95, tpss0, b2-plyp, pwpb95, |
| | zero | | b2gp-plyp, ptpss, hf, mpwlyp, bpbe, bh-lyp, tpssh, pwb6k, b1b95, bop, o-lyp, |
| | | | o-pbe, ssb, revssb, otpss, b3pw91, revpbe0, pbe38, mpw1b95, mpwb1k, bmk, |
| | | | cam-b3lyp, lc-wpbe, m05, m052x, m06l, m06, m062x, m06hf, hcth120 |
+------------------+--------------------------------------------------------------------------------+
| zerom | b2-plyp, b3-lyp, b97-d, b-lyp, b-p, pbe, pbe0, lc-wpbe |
+------------------+--------------------------------------------------------------------------------+
| | | | b-p, b-lyp, revpbe, rpbe, b97-d, pbe, rpw86-pbe, b3-lyp, tpss, hf, tpss0, |
| | | | pbe0, hse06, revpbe38, pw6b95, b2-plyp, dsd-blyp, dsd-blyp-fc, bop, mpwlyp, |
| | bj | | o-lyp, pbesol, bpbe, opbe, ssb, revssb, otpss, b3pw91, bh-lyp, revpbe0, |
| | | | tpssh, mpw1b95, pwb6k, b1b95, bmk, cam-b3lyp, lc-wpbe, b2gp-plyp, ptpss, |
| | | | pwpb95, hf/mixed, hf/sv, hf/minis, b3lyp/6-31gd, hcth120, pw1pw, pwgga, |
| | | | hsesol, hf3c, hf3cv, pbeh3c, pbeh-3c |
+------------------+--------------------------------------------------------------------------------+
| bjm | b2-plyp, b3-lyp, b97-d, b-lyp, b-p, pbe, pbe0, lc-wpbe |
+------------------+--------------------------------------------------------------------------------+
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.
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 the :doc:`pair_modify` shift, table, and tail options.
This pair style does not write its information to :doc:`binary restart files <restart>`.
This pair style can only be used via the *pair* keyword of the
:doc:`run_style respa <run_style>` 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 <Build_package>` page for more info.
Related commands
""""""""""""""""
:doc:`pair_coeff <pair_coeff>`
Default
"""""""
none
----------
.. _Grimme1:
**(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.
.. _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.

1143
src/EXTRA-PAIR/pair_d3.cpp Normal file

File diff suppressed because it is too large Load Diff

96
src/EXTRA-PAIR/pair_d3.h Normal file
View File

@ -0,0 +1,96 @@
/* -*- 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
------------------------------------------------------------------------- */
#ifdef PAIR_CLASS
// clang-format off
PairStyle(d3,PairD3);
// clang-format on
#else
#ifndef LMP_PAIR_D3_H
#define LMP_PAIR_D3_H
#include "pair.h"
namespace LAMMPS_NS {
class PairD3 : public Pair {
public:
PairD3(class LAMMPS *);
~PairD3() override;
void compute(int, int) override;
void settings(int, char **) override;
void coeff(int, char **) override;
void init_style() override;
double init_one(int, int) override;
int pack_forward_comm(int, int *, double *, int, int *) override;
int pack_reverse_comm(int, int, double *) override;
void unpack_forward_comm(int, int, double *) override;
void unpack_reverse_comm(int, int *, double *) override;
protected:
int nmax;
double evdwl;
double rthr; // R^2 distance to cutoff for D3_calculation
double cn_thr; // R^2 distance to cutoff for CN_calculation
std::string damping_type; // damping function type
double s6, s8, s18, rs6, rs8, rs18; // XC parameters
double a1, a2, alpha, alpha6, alpha8;
double* r2r4 = nullptr; // scale r4/r2 values of the atoms by sqrt(Z)
double* rcov = nullptr; // covalent radii
int* mxci = nullptr; // How large the grid for c6 interpolation
double** r0ab = nullptr; // cut-off radii for all element pairs
double***** c6ab = nullptr; // C6 for all element pairs
double* cn = nullptr; // Coordination numbers
double* dc6 = nullptr; // dC6i(iat) saves dE_dsp/dCN(iat)
int communicationStage; // communication stage
void allocate();
virtual void set_funcpar(std::string&);
void calc_coordination_number();
int find_atomic_number(std::string&);
std::vector<int> 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);
double* get_dC6(int, int, double, double);
};
} // namespace LAMMPS_NS
#endif
#endif

32483
src/EXTRA-PAIR/pair_d3_pars.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,155 @@
---
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
...