System¶
Instead of a custom System
class, featomic-torch
uses the class defined
by metatensor’s atomistic models facilities:
metatensor.torch.atomistic.System
. Featomic provides converters
from all the supported system providers (i.e. everything in
featomic.IntoSystem
) to the TorchScript compatible System
.
- featomic.torch.systems_to_torch(systems: featomic.systems.IntoSystem, positions_requires_grad: bool | None = None, cell_requires_grad: bool | None = None) System ¶
- featomic.torch.systems_to_torch(systems: Sequence[featomic.systems.IntoSystem], positions_requires_grad: bool | None = None, cell_requires_grad: bool | None = None) List[System]
Convert a arbitrary system to metatensor’s atomistic
metatensor.torch.atomistic.System
, putting all the data intorch.Tensor
and making the overall object compatible with TorchScript.- Parameters:
system – any system supported by featomic. If this is an iterable of system, this function converts them all and returns a list of converted systems.
positions_requires_grad – The value of
requires_grad
on the outputpositions
. IfNone
and the positions of the input is already atorch.Tensor
,requires_grad
is kept the same. Otherwise it is initialized toFalse
.cell_requires_grad – The value of
requires_grad
on the outputcell
. IfNone
and the positions of the input is already atorch.Tensor
,requires_grad
is kept the same. Otherwise it is initialized toFalse
.