Skip to content

Implement FileIOCalculator for dftd3 reference implementation

username-removed-249965 requested to merge d3_fileio into master

This is an implementation of the FileIOCalculator interface for the dftd3 reference implementation (see http://www.thch.uni-bonn.de/tc/dftd3). This can be used in conjunction with a DFT calculator object to add vdW dispersion corrections to the energy, forces, and stress of a system. Example:

from ase.calculators.dftd3 import DFTD3
from ase.build import bulk
from gpaw import GPAW

diamond = bulk('C')
dft = GPAW()
d3 = DFTD3(dft=dft)
diamond.set_calculator(d3)
diamond.get_potential_energy()

This will return the PBE-D3 energy for the system. All options supported by the dftd3 program are supported by this interface. Of note, this includes three-body corrections (enabled with the flag abc=True) with analytic forces and stress. This can still take a very long time for large, dense, 3D-periodic systems! The dftd3 reference implementation is not parallelized, so neither is this interface.

One limitation of this interface is that it does not correctly handle systems with only 1D- or 2D-periodic boundary conditions. If the DFTD3 calculator detects the system is 1D- or 2D-periodic, it will raise a warning and continue with 3D-periodic boundary conditions.

Merge request reports