File Dftd3.h

Copyright

This code is licensed under the 3-clause BSD license.

Copyright ETH Zurich, Laboratory for Physical Chemistry, Reiher Group.

See LICENSE.txt for details.

namespace Scine

This header file contains functions that allow for common notation for common things that can be done at a different degree of derivatives.

This header contains alias definitions defining which classes to use for the different degrees of derivatives.

namespace Utils
namespace Dftd3
class Dftd3
#include <Dftd3.h>

A class calculating D3 semi-classical dispersion corrections (with BJ damping) for energies and gradients.

 This class uses a default constructor. The calculations are initialized by the initialize function.
 Simple calculations are done using the calculate function, to which you can pass the required
 derivative level.

References:

  • J. Chem. Phys. 132, 154104, (2010) (Description D3)

  • J. Comput. Chem. 32, 1456, (2011) (Description of BJ damping function)

Developer Info:

  • The assignment of some functions as public is based on the fact that they are needed for the non-bonded interactions in the molecular mechanics library.

Public Functions

void initialize(AtomCollection atomCollection, double a1, double s8, double a2)

The initialize function needs to be called before a calculation as a set-up.

The meaning of the three Grimme D3 parameters can be found in the aformentioned reference.

double getEnergy()

Getter for the D3 energy.

Return

double

GradientCollection getGradients()

Getter for the D3 gradients.

std::vector<Dftd3Atom> getStructure()

Getter for the structure in the format of a vector of Dftd3Atoms.

void calculate(derivativeType d)

This function needs to be called to do a D3 dispersion correction calculation.

Parameters
  • d: derivative type, up to which will be calculated (either none or first).

void setStructure(std::vector<Dftd3Atom> structure)

Set structure as vector of Dftd3Atoms.

double calculateC6Coefficient(Dftd3Atom atom1, Dftd3Atom atom2)

Calculates C6 coefficient for one atom pair.

Return

double

double calculateC8Coefficient(Dftd3Atom atom1, Dftd3Atom atom2, double c6)

Calculates C8 coefficient for one atom pair.

Return

double

Parameters
  • C6: coefficient for that atom pair.

double getR0(int atom1Index, int atom2Index)

Getter for the pair cutoff radius R0 for one atom pair.

Return

double

Eigen::MatrixXd getC6Matrix() const

Getter for the matrix of all C6 coefficients.

Return

Eigen::MatrixXd

double calculateCoordinationNumber(Dftd3Atom atom)

This function calculates the D3 coordination number (fractional value).

Return

double

Private Functions

double evaluateEnergy(Dftd3Atom &atom1, Dftd3Atom &atom2)
void evaluateGradients(Dftd3Atom &atom1, Dftd3Atom &atom2, double &dE_drij, std::vector<double> &dc6, AtomicSecondDerivativeCollection &UpToSecondDerivatives)
void calculateValuesForConstants()
double evaluateEnergyDividedByC6(Dftd3Atom &atom1, Dftd3Atom &atom2)
double evaluateGradientOfCoordNumberWrtDistance(Dftd3Atom &atom1, Dftd3Atom &atom2)
double evaluateGradientsWrtDistances(Dftd3Atom &atom1, Dftd3Atom &atom2)
double evaluateGradientOfC6WrtCoordNumber(Dftd3Atom &atom1, Dftd3Atom &atom2)

Private Members

std::vector<Dftd3Atom> structure_
double energy_
GradientCollection gradients_
AtomicSecondDerivativeCollection UpToSecondDerivatives_
Dftd3Parameters parameters_
Eigen::MatrixXd dC6_dCN_
Eigen::MatrixXd dCN_drij_
Eigen::MatrixXd C6_
Eigen::MatrixXd C8_
Eigen::MatrixXd R0_

Friends

friend Scine::Utils::Dftd3::Tests::ADftd3Calculation_EnergyCalculationIsInternallyConsistent_Test
friend Scine::Utils::Dftd3::Tests::ADftd3Calculation_HasCorrectDerivativeOfC6WrtCoordNumber_Test
friend Scine::Utils::Dftd3::Tests::ADftd3Calculation_HasCorrectDerivativeOfEnergyWrtDistance_Test