Calculators¶
-
using featomic_torch::TorchCalculator = torch::intrusive_ptr<CalculatorHolder>¶
-
class CalculatorHolder : public torch::CustomClassHolder¶
Custom class holder to store, serialize and load featomic calculators inside Torch(Script) modules.
Public Functions
-
inline CalculatorHolder(std::string name, std::string parameters)¶
Create a new calculator with the given
nameand JSONparameters
-
inline std::string name() const¶
Get the name of this calculator.
-
inline std::string c_name() const¶
Get the name used to register this calculator.
-
inline std::string parameters() const¶
Get the parameters of this calculator.
-
inline std::vector<double> cutoffs() const¶
Get all radial cutoffs used by this
Calculator’s neighbors lists.
-
inline CalculatorHolder(std::string name, std::string parameters)¶
-
metatensor_torch::TensorMap featomic_torch::register_autograd(std::vector<metatomic_torch::System> systems, metatensor_torch::TensorMap precomputed, std::vector<std::string> forward_gradients)¶
Register autograd nodes between
system.positionsandsystem.cellfor each of the systems and the values in theprecomputedTensorMap.This is an advanced function must users should not need to use.
The autograd nodes
backward()function will use the gradients already stored inprecomputed, meaning that if any of the system’s positionsrequires_grad,precomputedmust contain"positions"gradients. Similarly, if any of the system’s cellrequires_grad,precomputedmust contain"cell"gradients.forward_gradientscontrols which gradients are left inside the TensorMap.