class aux::Gradient

Overview

Methods to calculate gradients (derivatives) with respect to different directions. More…

#include <gpr/auxiliary/Gradient.h>
 
class Gradient {
public:
    // construction
 
    Gradient();
    virtual ~Gradient();
 
    // methods
 
    void calculateDerivativesSameDim(const gpr::Coord& x1, const gpr::Coord& x2, const gpr::AtomsConfiguration& conf_info, const gpr::FieldMatrixd& lengthScale, const gpr::FieldMatrixIdx& dims, uint8_t calc_options, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives_pt);
    void setFarFieldRadius(double radius);
    double farFieldRadius() const;
    void calculateDerivativesDiffDim(const gpr::Coord& x1, const gpr::Coord& x2, const gpr::AtomsConfiguration& conf_info, const gpr::FieldMatrixd& lengthScale, const gpr::FieldMatrixIdx& dims1, const gpr::FieldMatrixIdx& dims2, const uint8_t calc_options, const uint8_t direction_x2, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives_pt);
};

Detailed Documentation

Methods to calculate gradients (derivatives) with respect to different directions.

Methods

void calculateDerivativesSameDim(const gpr::Coord& x1, const gpr::Coord& x2, const gpr::AtomsConfiguration& conf_info, const gpr::FieldMatrixd& lengthScale, const gpr::FieldMatrixIdx& dims, uint8_t calc_options, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives_pt)

Evaluate gradient of covariance function with respect to both input variables x and x2 (in same dimension).

The first member of derivatives will contain a vector of fields for every derivative calculated for x (analog of D1). The second member of derivatives will contain derivatives calculated for active pairtypes.

Warning

derivatives_pt sums every coordinate named in dims. derivatives.D1/D2/D12 hold one block per coordinate.

Parameters:

x1

Matrix of gpr::Coordinates

x2

Matrix of gpr::Coordinates

conf_info

Configuration data for the GP model

lengthScale

Length-scale

dims

Derivative dimensions evaluated for both inputs

calc_options

Determines which derivative to calculate (D1, D2, D12)

derivatives

Output derivative fields (one block per coordinate)

derivatives_pt

Output derivatives for active pair types

void setFarFieldRadius(double radius)

Same radius convention as Distance::setFarFieldRadius.

Parameters:

radius

Far-field radius.

void calculateDerivativesDiffDim(const gpr::Coord& x1, const gpr::Coord& x2, const gpr::AtomsConfiguration& conf_info, const gpr::FieldMatrixd& lengthScale, const gpr::FieldMatrixIdx& dims1, const gpr::FieldMatrixIdx& dims2, const uint8_t calc_options, const uint8_t direction_x2, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives, gpr::Derivatives<std::vector<gpr::FieldMatrixd>>& derivatives_pt)

Evaluate gradient of covariance function, of which has been taken partial derivatives with respect to both input variables x and x2 with respect to parameters (if specified).

Warning

derivatives_pt sums every coordinate pair named by dims1 and dims2. derivatives.D1/D2/D12 hold one block per pair.

Parameters:

x1

Matrix of gpr::Coordinates

x2

Matrix of gpr::Coordinates

conf_info

Configuration data for the GP model

lengthScale

Length-scale

dims1

Coordinate-dimension indices differentiated in x1.

dims2

Coordinate-dimension indices differentiated in x2.

calc_options

General type of the options to be calculated

direction_x2

Direction for the derivative calculation for x2 field.

derivatives

Field of derivatives calculated at each dims (one block per coordinate)

derivatives_pt

Field of pairtype derivatives