Skip to content

M3GNet

Optional dependency

M3GNetCalculator requires the matgl extra.

uv add "materialsframework[matgl]"
pip install "materialsframework[matgl]"

M3GNetCalculator

M3GNetCalculator(
    model: str = "M3GNet-PES-MatPES-r2SCAN-2025.2",
    state_attr: Tensor | None = None,
    stress_unit: Literal["eV/A3", "GPa"] = "GPa",
    stress_weight: float = 1.0,
    use_voigt: bool = False,
    **kwargs: Any,
)

Calculator for material property calculations and structure relaxation using the M3GNet potential.

Attributes:

Name Type Description
AVAILABLE_PROPERTIES list[str]

A list of properties that this calculator can compute, including "potential_energy", "forces", and "stress".

References
  • M3GNet: https://doi.org/10.1038/s43588-022-00349-3

Initializes the M3GNetCalculator with the specified model and calculation settings.

Parameters:

Name Type Description Default
model str

The M3GNet model to use. Defaults to "M3GNet-PES-MatPES-r2SCAN-2025.2".

'M3GNet-PES-MatPES-r2SCAN-2025.2'
state_attr Tensor | None

State attributes to include in the potential energy calculation. This allows for additional model customization. Defaults to None.

None
stress_unit Literal['eV/A3', 'GPa']

The unit for stress calculations. If set to "GPa", stress will be calculated in GPa.

'GPa'
stress_weight float

Conversion factor from GPa to eV/ang^3. If set to 1.0, stress is calculated in GPa. Defaults to 1.0.

1.0
use_voigt bool

Whether to use Voigt notation for stress. Defaults to False.

False
**kwargs Any

Additional keyword arguments passed to the BaseCalculator and BaseMDCalculator constructors.

{}

Examples:

>>> m3gnet_calculator = M3GNetCalculator(model="M3GNet-MP-2021.2.8-PES")
Note

The remaining parameters for the M3GNet potential are set to their default values.

calculator

calculator() -> Calculator

Lazily builds the ASE Calculator object for the M3GNet potential, using state_attr and stress_weight.

Returns:

Name Type Description
Calculator Calculator

The ASE Calculator object configured with the M3GNet potential.