Interface to DFTD3 by S. Grimme

Code author: Lori A. Burns

Section author: Lori A. Burns

Module: Samples

https://img.shields.io/badge/home-DFTD3-5077AB.svg
https://img.shields.io/badge/docs-latest-5077AB.svg

Installation

Binary

  • https://anaconda.org/psi4/dftd3/badges/version.svg
  • DFTD3 is available as a conda package for Linux and macOS (and Windows, through the Ubuntu shell).

  • If using the Psi4conda installer, DFTD3 has already been installed alongside.

  • If using the PSI4 conda package, the dftd3 conda package can be obtained through conda install dftd3 -c psi4 or conda install psi4-rt -c psi4.

  • If using PSI4 built from source, and anaconda or miniconda has already been installed (instructions at Quick Installation), the dftd3 executable can be obtained through conda install dftd3 -c psi4.

  • To remove a conda installation, conda remove dftd3.

Source

  • https://img.shields.io/badge/home-DFTD3-5077AB.svg
  • If using PSI4 built from source and you want to build DFTD3 from from source also, follow the instructions provided with the source (essentially, download the freely available tarball, unpack the source, edit the Makefile to select a Fortran compiler, and run make). From version 3.1.0 onwards, DFTD3 can be used as-is; for earlier versions, patches are available: psi4/psi4/share/psi4/scripts/patch_grimme_dftd3.3.0.2.

To be used by PSI4, the program binary (dftd3) must be found in your PSIPATH or PATH (in that order). If PSI4 is unable to execute the binary, an error will be reported. To preferentially use a particular dftd3 compilation, simply adjust its position in the path environment variables.

Theory

The local or semilocal character of conventional density functionals necessarily leads to neglect of the long-range correlation interactions which capture attractive van der Waals forces. Initially proposed by Yang [Wu:2002:515] and assiduously developed by Grimme, [Grimme:2004:1463] [Grimme:2006:1787] [Grimme:2010:154104] the DFT+Dispersion method appends to the base functional a scaled, damped, and fitted leading term to the well-known dispersion energy series, Edisp=C6/R6C8/R8C10/R10. The DFT-D2 [Grimme:2006:1787] variant takes the explicit form below. Here, dispersion coefficients, C6ij, obtained from the geometric mean of tabulated elemental values, are summed over interatomic distances, Rij, modulated by a damping function, fdamp(Rij), that gradually activates the dispersion correction (at a rate characterized by α6) over a distance characterized by the sum of the two atomic vdW radii, RvdW, while an overall scaling term, s6, is optimized to be unique to each Exc functional. (α6 is sometimes allowed to vary as well.)

(1)EdispD2=s6i,j>iNatC6ij(Rij)6fdamp(Rij)
fdamp(Rij)=11+eα6(Rij/RvdW1)

Grimme recently presented a refined method, DFT-D3, [Grimme:2010:154104] which incorporates an additional R8 term in the dispersion series and adjusts the C6ij combination formula and damping function. The individual atomic C6i are interpolated from several reference values based upon coordination numbers extracted from the molecular structure, rather than assigned solely by atomic identity as in DFT-D2, and thereby incorporate some awareness of the chemical environment into an otherwise largely heuristic correction. The -D3 dispersion has the following form, where sr,6 and s8 are the customary nonunity parameters fitted for individual functionals.

(2)EdispD3ZERO=n=6,8sni,j>iNatCnij(Rij)nfdamp(Rij)
fdamp(Rij)=11+6(Rij/(sr,nR0ij))αn

A modified damping scheme for DFT-D3 using the rational damping form of Becke and Johnson was introduced in [Grimme:2011:1456]. The parameters fit for individual functionals are now s6, s8, a1, and a2.

EdispD3BJ=n=6,8sni,j>iNatCnij(Rij)n+(fdamp)n
fdamp=a1C8ijC6ij+a2

All parameters characterizing the dispersion correction are taken from Grimme’s website or else from the literature.

Running DFTD3 or DFTD4

A number of a posteriori dispersion corrections are available in PSI4. While some are computed within PSI4‘s codebase (-D1, -D2, -CHG, -DAS2009, -DAS2010), the -D3 or -D4 corrections and their variants are available only through the DFTD3 or DFTD4 programs. Once installed, the dftd3/PSI4 and dftd4/PSI4 interfaces are transparent, and all corrections are interfaced exactly alike.

Dispersion corrections are built into DFT functionals, so appending an a posteriori correction to a computation is as simple as energy('b2plyp-d') vs. energy('b2plyp'). For example, the following input file computes (with much redundant work) for water a B3LYP, a B3LYP-D2, a B3LYP-D3 (zero-damping), and a B3LYP-D4 (Becke-Johnson damping) energy.

molecule h2o {
     O
     H 1 1.0
     H 1 1.0 2 104.5
 }
 set {
     basis cc-pVDZ
 }
 energy('b3lyp')
 energy('b3lyp-d')
 energy('b3lyp-d3')
 energy('b3lyp-d4')

Consult the table -D Functionals to see for each functional what corrections are available and what default parameters define them. The dispersion correction is available after a calculation in the PSI variable DISPERSION CORRECTION ENERGY. By default, the output from the dftd3 program is suppressed; to see it in the output file, set print > 2. No text output is available from the dftd4 program.

Variants of dispersion corrections

Extension 1

Variant

Computing Program (engine)

DFT_DISPERSION_PARAMETERS 11

-D

alias to -D2

-D1

-D1 2

PSI4‘s libdisp

[s6]

-D2

-D2 3

PSI4‘s libdisp OR dftd3

[s6, α6, sr,6]

-D3

alias to -D3ZERO

-D3ZERO

-D3 4 w/ original zero-damping

dftd3

[s6, s8, sr,6, α6, sr,8]

-D3BJ

-D3 5 w/ newer Becke-Johnson rational damping

dftd3

[s6, s8, a1, a2]

-D3(BJ)

alias to -D3BJ

-D3M

alias to -D3MZERO

-D3MZERO

-D3 6 w/ reparameterized and more flexible original zero-damping

dftd3

[s6, s8, sr,6, β]

-D3MBJ

-D3 6 w/ reparameterized newer Becke-Johnson rational damping

dftd3

[s6, s8, a1, a2]

-D3M(BJ)

alias to -D3MBJ

-NL

Grimme’s -NL (DFT plus VV10 correlation) 7

PSI4‘s nl

[b, c] via NL_DISPERSION_PARAMETERS

-CHG

Chai & Head-Gordon dispersion formula 8

PSI4‘s libdisp

[s6]

-DAS2009

Podeszwa & Szalewicz dispersion formula 9

PSI4‘s libdisp

[s6]

-DAS2010

Podeszwa & Szalewicz dispersion formula 10

PSI4‘s libdisp

[s6]

-D4

alias to -D4BJEEQATM

-D4BJ

alias to -D4BJEEQATM

-D4BJEEQATM

-D4 12

dftd4

[a1, a2, alp, s6, s8, s9]

Three-Body Dispersion Corrections

In addition to the previously discussed two-body dispersion corrections, the dftd3/PSI4 interface enables computations of three-body dispersion corrections. In DFT-D3, three-body dispersion is approximated with the Axilrod-Teller-Muto model:

Edisp(3)=16A\neqB\neqCC9ABC(3cosθacosθbcosθc+1)(rABrBCrAC)3fdamp(r¯ABC)

where θa is the angle at atom A corresponding to the triangle formed by atoms A, B, and C, and r¯ABC is the geometric mean of the corresponding atomic-pair distances. The dispersion coefficients are defined as

C9ABC=C6ABC6BCC6AC

See the DFT-D3 documentation for more details.

For now, the three-body correction can be called by using the run_dftd3() function with d3-atmgr as the passed functional string. For example, the three-body ATM dispersion correction for a neon trimer could be computed with:

molecule ne3 {
Ne 0.0 0.0 0.0
Ne 0.0 0.0 1.0
Ne 0.0 1.0 1.0
}
ne.update_geometry()
energy = m.run_dftd3('d3-atmgr', dertype=0)
print(energy)

Footnotes

1

Note that there are functionals with these extensions (e.g., wB97X-D) that, not being Grimme corrections, won’t follow this table exactly.

2

[Grimme:2004:1463]

3

[Grimme:2006:1787]

4

[Grimme:2010:154104]

5

[Grimme:2011:1456]

6(1,2)

[Smith:2016:2197]

7

[Hujo:2011:3866]

8

[Chai:2010:6615]

9

[Pernal:2009:263201]

10

[Podeszwa:2010:550]

11

Keyword not used for user-defined functionals where the dft_dict["dispersion"]["params"] is easily editable for this purpose. See Advanced Functional Use and Manipulation

12

[Caldeweyher:2019:154122]

A few practical examples:

  • DFT-D2 single point with default parameters (dftd3 not called)

    energy('bp86-d')
    
  • DFT-D3BJ optimization with default parameters

    optimize('pbe-d3bj')
    
  • DFT-D2 optimization with custom s6 parameter

    set dft_dispersion_parameters [1.20]
    optimize('b3lyp-d2')
    
  • DFT-D3ZERO single point (b3lyp) with custom s8 parameter (reset all four values)

    set dft_dispersion_parameters [1.0, 2.0, 1.261, 14.0]
    energy('b3lyp-d3')
    
  • DFT-D2 single point with dftd3 instead of PSI4‘s libdisp

    energy('pbe-d2', engine='dftd3')
    

If only dispersion corrections (rather than total energies) are of interest, the dispersion programs can be run independently of the scf through the python function run_dftd3() or run_dftd4(). (These functions call QCEngine, which is the same PSI4 + dftd3/dftd4 interface that is called during an scf job.) This “D-only” route is much faster than running a DFT-D energy.

Note that in a DFT+D energy or gradient calculation, user-specified dispersion parameters override any information provided about the functional. The same holds true for a dftd3 “D-only” calculation. But in a dftd4 “D-only” calculation, functional information overrides any user-specified dispersion parameters.

  • Some set-up:

    molecule nene {
    Ne
    Ne 1 2.0
    }
    
    nene.update_geometry()
    
  • The same four dispersion corrections/gradients as the section above:

    >>> print nene.run_dftd3('bp86', 'd', dertype=0)
    -7.735e-05
    
    >>> E, G = nene.run_dftd3('pbe', 'd3bj')
    >>> print G
    [[0.0, 0.0, -1.1809087569358e-05], [0.0, 0.0, 1.1809087569358e-05]]
    
    >>> E, G = nene.run_dftd3('b3lyp', 'd2', {'s6': 1.20})
    >>> print E
    -8.84e-05
    
    >>> E, G = nene.run_dftd3(dashlvl='d3', dashparam={'s8': 2.0, 'alpha6': 14.0, 'sr6': 1.261, 's6': 1.0})
    >>> print E
    -0.00024762