Models#

Most of the code in metatensor.torch.atomistic is here to define and export models and to store model metadata. The corresponding classes are documented below:

We also provide a couple of functions to work with the models:

metatensor.torch.atomistic.check_atomistic_model(path: str)[source]#

Check that the file at path contains an exported metatensor atomistic model, and that this model can be loaded in the current process.

This function should be called before torch.jit.load() when loading an existing model.

Parameters:

path (str) – path to the exported model file

metatensor.torch.atomistic.unit_conversion_factor(quantity: str, from_unit: str, to_unit: str)[source]#

Get the multiplicative conversion factor from from_unit to to_unit. Both units must be valid and known for the given physical quantity. The set of valid quantities and units is available here.

Parameters:
  • quantity (str) – name of the physical quantity

  • from_unit (str) – current unit of the data

  • to_unit (str) – target unit of the data

Known quantities and units#

The following quantities and units can be used with metatensor models. Adding new units and quantities is very easy, please contact us if you need something else! In the mean time, you can create metatensor.torch.atomistic.ModelOutput with quantities that are not in this table. A warning will be issued and no unit conversion will be performed.

When working with one of the quantity in this table, the unit you use must be one of the registered unit.

quantity

units

length

angstrom, Bohr, nanometer, nm

energy

eV, meV, Hartree, kcal/mol, kJ/mol