System

Instead of a custom System class, rascaline-torch uses the class defined by metatensor’s atomistic models facilities: metatensor.torch.atomistic.System. Rascaline provides converters from all the supported system providers (i.e. everything in rascaline.IntoSystem) to the TorchScript compatible System.

rascaline.torch.systems_to_torch(systems: rascaline.systems.IntoSystem, positions_requires_grad: bool | None = None, cell_requires_grad: bool | None = None) System
rascaline.torch.systems_to_torch(systems: Sequence[rascaline.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 in torch.Tensor and making the overall object compatible with TorchScript.

Parameters:
  • system – any system supported by rascaline. 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 output positions. If None and the positions of the input is already a torch.Tensor, requires_grad is kept the same. Otherwise it is initialized to False.

  • cell_requires_grad – The value of requires_grad on the output cell. If None and the positions of the input is already a torch.Tensor, requires_grad is kept the same. Otherwise it is initialized to False.