Calculators¶
-
using rascaline_torch::TorchCalculator = torch::intrusive_ptr<CalculatorHolder>¶
-
class CalculatorHolder : public torch::CustomClassHolder¶
Custom class holder to store, serialize and load rascaline calculators inside Torch(Script) modules.
Public Functions
-
inline CalculatorHolder(std::string name, std::string parameters)¶
Create a new calculator with the given
name
and 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.
-
metatensor_torch::TorchTensorMap compute(std::vector<metatensor_torch::System> systems, TorchCalculatorOptions options = {})¶
Run a calculation for the given
systems
using the given options.
-
inline CalculatorHolder(std::string name, std::string parameters)¶
-
metatensor_torch::TorchTensorMap rascaline_torch::register_autograd(std::vector<metatensor_torch::System> systems, metatensor_torch::TorchTensorMap precomputed, std::vector<std::string> forward_gradients)¶
Register autograd nodes between
system.positions
andsystem.cell
for each of the systems and the values in theprecomputed
TensorMap.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
,precomputed
must contain"positions"
gradients. Similarly, if any of the system’s cellrequires_grad
,precomputed
must contain"cell"
gradients.forward_gradients
controls which gradients are left inside the TensorMap.