File GradientBasedCheck.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
class GradientBasedCheck : public Scine::Utils::ConvergenceCheck
#include <GradientBasedCheck.h>

A convergence check based on parameter, value and gradient information.

Checks the RMS of the gradient and step, the maximum coefficient of the gradient and step and also the change in value.

For convergence the value and a set number of the other four criteria need to converge.

Public Functions

GradientBasedCheck()

Default constructor.

virtual ~GradientBasedCheck()

Default destructor.

virtual bool checkConvergence(const Eigen::VectorXd &parameter, double value, const Eigen::VectorXd &gradient)

Checks for convergence.

Return

true If converged.

false If not converged.

Parameters
  • parameter: The current parameters.

  • value: The current value

  • gradient: The current gradient.

bool checkMaxIterations(unsigned int currentIteration)

Checks if the curret iteration is within the maximum of allowed iterations.

Return

true If the current iteration is smaller than the maximum allowed number of iterations.

false If the current iteration is equal to or greater than the maximum allowed number of iterations.

Parameters
  • currentIteration: The number of the current iteration.

virtual void addSettingsDescriptors(UniversalSettings::DescriptorCollection &collection) const

See Scine::Utils::ConvergenceCheck::addSettingsDescriptors()

virtual void applySettings(const Settings &s)

See Scine::Utils::ConvergenceCheck::applySettings()

Public Members

double stepMaxCoeff = 1.0e-4

The threshold for the maximum absolute element of the last step taken.

double stepRMS = 5.0e-4

The threshold for the root mean square of the last step taken.

double gradMaxCoeff = 5.0e-5

The threshold for the maximum absolute element of the gradient.

double gradRMS = 1.0e-5

The threshold for the root mean square of the gradient.

double deltaValue = 1.0e-7

The threshold for the change in the functional value.

unsigned int maxIter = 100

The maximum number of iterations.

unsigned int requirement = 3

The number of criteria that have to converge besides the value criterion.

Public Static Attributes

constexpr const char *gconvStepMaxCoeffKey = "convergence_step_max_coefficient"
constexpr const char *gconvStepRMSKey = "convergence_step_rms"
constexpr const char *gconvGradMaxCoeffKey = "convergence_gradient_max_coefficient"
constexpr const char *gconvGradRMSKey = "convergence_gradient_rms"
constexpr const char *gconvDeltaValueKey = "convergence_delta_value"
constexpr const char *gconvMaxIterKey = "convergence_max_iterations"
constexpr const char *gconvRequirementKey = "convergence_requirement"

Private Members

Eigen::VectorXd _oldParams
double _oldValue = 0.0