File State.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

Enums

enum StateSize

enum class defining the desired size of the State to save.

Values:

minimal
regular
extensive
class State
#include <State.h>

Base class for the implementation of a generic State.

A state should be viewed as a checkpoint. Implementation note: If a class having an interface needs to save/load a state, then it has to have a polymorphic pointer to StatesHandler in the interface and then populate it with a derived class, specific to the class. The same is true with the polymorphic State class.

Subclassed by Scine::Utils::ExternalQC::OrcaState

Public Types

using MatrixState = std::map<std::string, Eigen::MatrixXd>

Maps of key-value pairs containing possible states.

using StringState = std::map<std::string, std::string>
using DoubleState = std::map<std::string, double>
using IntState = std::map<std::string, int>

Public Functions

State(StateSize size)

Constructor, constructs the state with a StateSize.

StateSize getStateSize() const

Getter for the state size, i.e.

the required level of information about a state.

virtual const Eigen::MatrixXd &getMatrixState(const std::string &matrixName) const = 0

Getter for an Eigen::MatrixXd state identified with a std::string.

This function returns a const reference to an Eigen::MatrixXd in order to avoid unnecessary copying of possibly big matrices. Be careful, the state must not go out of scope!

Return

A const reference to the value of the key-value pair, an Eigen::MatrixXd.

Parameters
  • matrixState: The key for the state’s key-value pair.

virtual const std::string &getStringState(const std::string &stringState) const = 0

Getter for a std::string state identified with a std::string.

This function returns a const reference to a std::string in order to avoid unnecessary copying of possibly big strings. Be careful, the state must not go out of scope!

Return

A const reference to the value of the key-value pair, a std::string.

Parameters
  • stringState: The key for the state’s key-value pair.

virtual int getIntState(const std::string &intState) const = 0

Getter for an integer state identified with a std::string.

Return

The value of the key-value pair, an integer.

Parameters
  • intState: The key for the state’s key-value pair.

virtual double getDoubleState(const std::string &doubleState) const = 0

Getter for a double state identified with a std::string.

Return

The value of the key-value pair, a double.

Parameters
  • doubleState: The key for the state’s key-value pair.

virtual void initialize() = 0

Initializer for the state, resets it to the initial state.

Protected Attributes

StateSize stateSize_ = {StateSize::minimal}