File AutomaticDifferentiationHelpers.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 AutomaticDifferentiation

Functions

derivOrder getDerivativeOrderEnum(unsigned order)

Get the enum corresponding to the derivative order.

int getDerivativeOrder(derivOrder order)

Get the integer corresponding to the derivative order.

template<derivOrder o>
Value1DType<o> getFromFull(double v, double firstDer, double secondDer)

Create a value with derivatives in 1 dimension and neglect the unnecessary derivatives.

template<derivOrder o>
Value1DType<o> constant1D(double c)

Transform a double to a ValueWithDerivative in one dimension, with derivatives equal to zero.

template<derivOrder o>
Value1DType<o> variableWithUnitDerivative(double v)

Transform v to a ValueWithDerivative in one dimension, with first derivative 1 and second derivative 0.

template<derivOrder o>
Value3DType<o> constant3D(double c)

Transform a double to a ValueWithDerivative in three dimensions, with derivatives equal to zero.

template<derivOrder o>
Value3DType<o> toX(double x)

Get X as a value with derivatives in three dimensions.

The only non-zero derivative is the first derivative in x-direction.

template<derivOrder o>
Value3DType<o> toY(double y)

Get Y as a value with derivatives in three dimensions.

The only non-zero derivative is the first derivative in y-direction.

template<derivOrder o>
Value3DType<o> toZ(double z)

Get Z as a value with derivatives in three dimensions.

The only non-zero derivative is the first derivative in z-direction.

template<derivOrder o>
Value3DType<o> toRSquared(double x, double y, double z)

Get R-squared as a value with derivatives in three dimensions.

template<derivOrder o>
Value3DType<o> get3Dfrom1D(Value1DType<o> v, const Eigen::Vector3d &R)

Get a value with derivatives in 3 dimensions from the value with derivatives in one dimension, given a vector R.

template<derivOrder o>
Value3DType<o> getValueWithOppositeDerivative(const Value3DType<o> &v)

Get the value with inverted derivatives (useful for pairs of derivatives for two atoms).

The sign of the first derivatives changes.

template<derivOrder o>
double getValue1DAsDouble(const Value1DType<o> &v)

Extract the value with derivatives in 1 dimension as a double.

template<derivOrder o>
double getValue3DAsDouble(const Value3DType<o> &v)

Extract the value with derivatives in 3 dimension as a double.

template<>
double constant1D<derivOrder::zero>(double c)
template<>
double variableWithUnitDerivative<derivOrder::zero>(double v)
template<>
double getFromFull<derivOrder::zero>(double v, double, double)
template<>
double constant3D<derivOrder::zero>(double c)
template<>
double toX<derivOrder::zero>(double x)
template<>
double toY<derivOrder::zero>(double y)
template<>
double toZ<derivOrder::zero>(double z)
template<>
double toRSquared<derivOrder::zero>(double x, double y, double z)
template<>
double get3Dfrom1D<derivOrder::zero>(double v, const Eigen::Vector3d&)
template<>
double getValueWithOppositeDerivative<derivOrder::zero>(const double &v)
template<>
double getValue1DAsDouble<derivOrder::zero>(const double &v)
template<>
double getValue3DAsDouble<derivOrder::zero>(const double &v)
template<>
First1D constant1D<derivOrder::one>(double c)
template<>
First1D variableWithUnitDerivative<derivOrder::one>(double v)
template<>
First1D getFromFull<derivOrder::one>(double v, double firstDer, double)
template<>
First3D constant3D<derivOrder::one>(double c)
template<>
First3D toX<derivOrder::one>(double x)
template<>
First3D toY<derivOrder::one>(double y)
template<>
First3D toZ<derivOrder::one>(double z)
template<>
First3D toRSquared<derivOrder::one>(double x, double y, double z)
template<>
First3D get3Dfrom1D<derivOrder::one>(First1D v, const Eigen::Vector3d &R)
template<>
First3D getValueWithOppositeDerivative<derivOrder::one>(const First3D &v)
template<>
double getValue1DAsDouble<derivOrder::one>(const First1D &v)
template<>
double getValue3DAsDouble<derivOrder::one>(const First3D &v)
template<>
Second1D constant1D<derivOrder::two>(double c)
template<>
Second1D variableWithUnitDerivative<derivOrder::two>(double v)
template<>
Second1D getFromFull<derivOrder::two>(double v, double firstDer, double secondDer)
template<>
Second3D constant3D<derivOrder::two>(double c)
template<>
Second3D toX<derivOrder::two>(double x)
template<>
Second3D toY<derivOrder::two>(double y)
template<>
Second3D toZ<derivOrder::two>(double z)
template<>
Second3D toRSquared<derivOrder::two>(double x, double y, double z)
template<>
Second3D get3Dfrom1D<derivOrder::two>(Second1D v, const Eigen::Vector3d &R)
template<>
Second3D getValueWithOppositeDerivative<derivOrder::two>(const Second3D &v)
template<>
double getValue1DAsDouble<derivOrder::two>(const Second1D &v)
template<>
double getValue3DAsDouble<derivOrder::two>(const Second3D &v)