mattertune.finetune.properties

Module Attributes

DType

The type of the property values.

Classes

EnergyPropertyConfig(*[, name, dtype, ...])

ForcesPropertyConfig(*[, name, dtype, ...])

GraphPropertyConfig(*, name, dtype, loss[, ...])

PropertyConfigBase(*, name, dtype, loss[, ...])

StressesPropertyConfig(*[, name, dtype, ...])

mattertune.finetune.properties.DType = DType

The type of the property values.

class mattertune.finetune.properties.PropertyConfigBase(*, name, dtype, loss, loss_coefficient=1.0)[source]
Parameters:
  • name (str)

  • dtype (DType)

  • loss (LossConfig)

  • loss_coefficient (float)

name: str

The name of the property.

This is the key that will be used to access the property in the output of the model.

This is also the key that will be used to access the property in the ASE Atoms object.

dtype: DType

The type of the property values.

loss: LossConfig

The loss function to use when training the model on this property.

loss_coefficient: float

The coefficient to apply to this property’s loss function when training the model.

abstract from_ase_atoms(atoms)[source]

Extract the property value from an ASE Atoms object.

Parameters:

atoms (Atoms)

Return type:

int | float | ndarray | Tensor

classmethod metric_cls()[source]
Return type:

type[MetricBase]

abstract ase_calculator_property_name()[source]

If this property can be calculated by an ASE calculator, returns the name of the property that the ASE calculator uses. Otherwise, returns None.

This should only return non-None for properties that are supported by the ASE calculator interface, i.e.: - ‘energy’ - ‘forces’ - ‘stress’ - ‘dipole’ - ‘charges’ - ‘magmom’ - ‘magmoms’

Note that this does not refer to the new experimental custom property prediction support feature in ASE, but rather the built-in properties that ASE can calculate in the ase.calculators.calculator.Calculator class.

Return type:

ASECalculatorPropertyName | None

abstract property_type()[source]
Return type:

Literal[‘system’, ‘atom’]

prepare_value_for_ase_calculator(value)[source]

Convert the property value to a format that can be used by the ASE calculator.

Parameters:

value (float | ndarray)

class mattertune.finetune.properties.GraphPropertyConfig(*, name, dtype, loss, loss_coefficient=1.0, type='graph_property', reduction)[source]
Parameters:
  • name (str)

  • dtype (DType)

  • loss (LossConfig)

  • loss_coefficient (float)

  • type (Literal['graph_property'])

  • reduction (Literal['mean', 'sum', 'max'])

type: Literal['graph_property']
reduction: Literal['mean', 'sum', 'max']

The reduction to use for the output. - “sum”: Sum the property values for all atoms in the system. This is optimal for extensive properties (e.g. energy). - “mean”: Take the mean of the property values for all atoms in the system. This is optimal for intensive properties (e.g. density). - “max”: Take the maximum of the property values for all atoms in the system. This is optimal for properties like the last phdos peak of Matbench’s phonons dataset.

from_ase_atoms(atoms)[source]

Extract the property value from an ASE Atoms object.

ase_calculator_property_name()[source]

If this property can be calculated by an ASE calculator, returns the name of the property that the ASE calculator uses. Otherwise, returns None.

This should only return non-None for properties that are supported by the ASE calculator interface, i.e.: - ‘energy’ - ‘forces’ - ‘stress’ - ‘dipole’ - ‘charges’ - ‘magmom’ - ‘magmoms’

Note that this does not refer to the new experimental custom property prediction support feature in ASE, but rather the built-in properties that ASE can calculate in the ase.calculators.calculator.Calculator class.

property_type()[source]
name: str

The name of the property.

This is the key that will be used to access the property in the output of the model.

This is also the key that will be used to access the property in the ASE Atoms object.

dtype: DType

The type of the property values.

loss: LossConfig

The loss function to use when training the model on this property.

loss_coefficient: float

The coefficient to apply to this property’s loss function when training the model.

class mattertune.finetune.properties.EnergyPropertyConfig(*, name='energy', dtype='float', loss, loss_coefficient=1.0, type='energy')[source]
Parameters:
  • name (str)

  • dtype (DType)

  • loss (LossConfig)

  • loss_coefficient (float)

  • type (Literal['energy'])

type: Literal['energy']
name: str

The name of the property.

This is the key that will be used to access the property in the output of the model.

dtype: DType

The type of the property values.

from_ase_atoms(atoms)[source]

Extract the property value from an ASE Atoms object.

ase_calculator_property_name()[source]

If this property can be calculated by an ASE calculator, returns the name of the property that the ASE calculator uses. Otherwise, returns None.

This should only return non-None for properties that are supported by the ASE calculator interface, i.e.: - ‘energy’ - ‘forces’ - ‘stress’ - ‘dipole’ - ‘charges’ - ‘magmom’ - ‘magmoms’

Note that this does not refer to the new experimental custom property prediction support feature in ASE, but rather the built-in properties that ASE can calculate in the ase.calculators.calculator.Calculator class.

prepare_value_for_ase_calculator(value)[source]

Convert the property value to a format that can be used by the ASE calculator.

property_type()[source]
loss: LossConfig

The loss function to use when training the model on this property.

loss_coefficient: float

The coefficient to apply to this property’s loss function when training the model.

class mattertune.finetune.properties.ForcesPropertyConfig(*, name='forces', dtype='float', loss, loss_coefficient=1.0, type='forces', conservative)[source]
Parameters:
  • name (str)

  • dtype (DType)

  • loss (LossConfig)

  • loss_coefficient (float)

  • type (Literal['forces'])

  • conservative (bool)

type: Literal['forces']
name: str

The name of the property.

This is the key that will be used to access the property in the output of the model.

dtype: DType

The type of the property values.

conservative: bool

Whether the forces are energy conserving.

This is used by the backbone to decide the type of output head to use for this property. Conservative force predictions are computed by taking the negative gradient of the energy with respect to the atomic positions, whereas non-conservative forces may be computed by other means.

from_ase_atoms(atoms)[source]

Extract the property value from an ASE Atoms object.

ase_calculator_property_name()[source]

If this property can be calculated by an ASE calculator, returns the name of the property that the ASE calculator uses. Otherwise, returns None.

This should only return non-None for properties that are supported by the ASE calculator interface, i.e.: - ‘energy’ - ‘forces’ - ‘stress’ - ‘dipole’ - ‘charges’ - ‘magmom’ - ‘magmoms’

Note that this does not refer to the new experimental custom property prediction support feature in ASE, but rather the built-in properties that ASE can calculate in the ase.calculators.calculator.Calculator class.

loss: LossConfig

The loss function to use when training the model on this property.

loss_coefficient: float

The coefficient to apply to this property’s loss function when training the model.

property_type()[source]
class mattertune.finetune.properties.StressesPropertyConfig(*, name='stresses', dtype='float', loss, loss_coefficient=1.0, type='stresses', conservative)[source]
Parameters:
  • name (str)

  • dtype (DType)

  • loss (LossConfig)

  • loss_coefficient (float)

  • type (Literal['stresses'])

  • conservative (bool)

loss: LossConfig

The loss function to use when training the model on this property.

loss_coefficient: float

The coefficient to apply to this property’s loss function when training the model.

type: Literal['stresses']
name: str

The name of the property.

This is the key that will be used to access the property in the output of the model.

dtype: DType

The type of the property values.

conservative: bool

Similar to the conservative parameter in ForcesPropertyConfig, this parameter specifies whether the stresses should be computed in a conservative manner.

from_ase_atoms(atoms)[source]

Extract the property value from an ASE Atoms object.

ase_calculator_property_name()[source]

If this property can be calculated by an ASE calculator, returns the name of the property that the ASE calculator uses. Otherwise, returns None.

This should only return non-None for properties that are supported by the ASE calculator interface, i.e.: - ‘energy’ - ‘forces’ - ‘stress’ - ‘dipole’ - ‘charges’ - ‘magmom’ - ‘magmoms’

Note that this does not refer to the new experimental custom property prediction support feature in ASE, but rather the built-in properties that ASE can calculate in the ase.calculators.calculator.Calculator class.

prepare_value_for_ase_calculator(value)[source]

Convert the property value to a format that can be used by the ASE calculator.

property_type()[source]