Skip to content

MEGNet

Optional dependency

MEGNetCalculator requires the matgl extra.

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

MEGNetCalculator

MEGNetCalculator(model: str = 'MEGNet-Eform-MP-2018.6.1')

Calculator for the formation energy of a structure using the MEGNet potential, via the matgl package.

Attributes:

Name Type Description
AVAILABLE_PROPERTIES list[str]

A list of properties that this calculator can compute. Currently, only "formation_energy" is supported.

References
  • MEGNet: https://doi.org/10.1021/acs.chemmater.9b01294

Initializes a MEGNetCalculator instance with the specified MEGNet model.

Parameters:

Name Type Description Default
model str

The name of the MEGNet model to use for calculations. Defaults to "MEGNet-Eform-MP-2018.6.1".

'MEGNet-Eform-MP-2018.6.1'

Examples:

>>> megnet_calculator = MEGNetCalculator(model="MEGNet-Eform-MP-2018.6.1")
Note

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

potential

potential() -> Any

Lazily loads and caches the MEGNet potential specified during initialization.

Returns:

Name Type Description
Any Any

The loaded matgl MEGNet potential.

calculate

calculate(structure: Structure) -> dict[str, float]

Calculates the formation energy of the provided structure using the MEGNet model.

Parameters:

Name Type Description Default
structure Structure

A Pymatgen Structure object representing the material structure for which the formation energy will be calculated.

required

Returns:

Type Description
dict[str, float]

dict[str, float]: A dictionary containing the formation energy of the structure under the key "formation_energy".

Examples:

>>> struct = Structure.from_file("POSCAR")
>>> megnet_calculator = MEGNetCalculator()
>>> result = megnet_calculator.calculate(structure=struct)