Skip to content

CHGNet

Optional dependency

CHGNetCalculator requires the chgnet extra.

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

CHGNetCalculator

CHGNetCalculator(
    model: str = "0.3.0",
    stress_weight: float = 1 / 160.21766208,
    include_magmoms: bool = False,
    on_isolated_atoms: Literal[
        "ignore", "warn", "error"
    ] = "warn",
    device: Literal["cpu", "cuda", "mps"] = "cpu",
    check_cuda_mem: bool = True,
    verbose: bool = False,
    **kwargs: Any,
)

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

Attributes:

Name Type Description
AVAILABLE_PROPERTIES list[str]

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

References
  • CHGNet: https://doi.org/10.1038/s42256-023-00716-3

Initializes the CHGNetCalculator with the specified model and calculation settings.

Parameters:

Name Type Description Default
model str

The CHGNet model to use. Defaults to "0.3.0".

'0.3.0'
stress_weight float

Conversion factor for stress from GPa to eV/A^3. Defaults to 1 / 160.21766208.

1 / 160.21766208
include_magmoms bool

Whether to include magnetic moments in the model. Defaults to False.

False
on_isolated_atoms Literal['ignore', 'warn', 'error']

Behavior when isolated atoms are detected. Defaults to "warn".

'warn'
device Literal['cpu', 'cuda', 'mps']

The device to use for calculations. Defaults to "cpu".

'cpu'
check_cuda_mem bool

Whether to check CUDA memory before running calculations. Defaults to True.

True
verbose bool

Whether to print verbose output during calculations. Defaults to False.

False
**kwargs Any

Additional keyword arguments passed to the BaseCalculator and BaseMDCalculator constructors.

{}

Examples:

>>> chgnet_calculator = CHGNetCalculator(model="0.3.0", device="cuda", verbose=True)
Note

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

calculator

calculator() -> Calculator

Lazily builds the ASE Calculator object for the CHGNet potential, using device, check_cuda_mem, and stress_weight.

Returns:

Name Type Description
Calculator Calculator

The ASE Calculator object configured with the CHGNet potential.