Stability

Stability#

We’re going to start simple here - let’s run a local relaxation (optimize the unit cell and positions) using a pre-trained EquiformerV2-31M-OMAT24-MP-sAlex checkpoint. This checkpoint has a few fun properties

  1. It’s a relatively small (31M) parameter model

  2. It was pre-trained on the OMat24 dataset, and then fine-tuned on the MPtrj and Alexandria datasets, so it should emit energies and forces that are consistent with the MP GGA (PBE/PBE+U) level of theory

from __future__ import annotations

import pprint

from ase.build import bulk
from ase.optimize import LBFGS
from quacc.recipes.mlp.core import relax_job

# Make an Atoms object of a bulk Cu structure
atoms = bulk("Cu")

# Run a structure relaxation
result = relax_job(
    atoms,
    method="fairchem",
    name_or_path="uma-s-1p1",
    task_name="omat",
    opt_params={"fmax": 1e-3, "optimizer": LBFGS},
)
WARNING:root:device was not explicitly set, using device='cuda'.
WARNING:root:The 'seed' argument is deprecated and will be removed in future versions. Please set the seed in the MLIPPredictUnit configuration instead.
INFO:quacc.runners.prep:Calculation will run at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/tmp-quacc-2025-11-21-23-47-37-200899-59941
INFO:quacc.runners.prep:Calculation results stored at /home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2025-11-21-23-47-37-200899-59941
pprint.pprint(result)
{'atoms': Atoms(symbols='Cu', pbc=True, cell=[[0.0, 1.805, 1.805], [1.805, 0.0, 1.805], [1.805, 1.805, 0.0]]),
 'converged': np.True_,
 'dir_name': '/home/runner/work/fairchem/fairchem/docs/inorganic_materials/examples_tutorials/quacc-2025-11-21-23-47-37-200899-59941',
 'input_atoms': {'atoms': Atoms(symbols='Cu', pbc=True, cell=[[0.0, 1.805, 1.805], [1.805, 0.0, 1.805], [1.805, 1.805, 0.0]]),
                 'structure_metadata': {'chemsys': 'Cu',
                                        'composition': {'Cu': 1.0},
                                        'composition_reduced': {'Cu': 1.0},
                                        'density': 8.971719813140734,
                                        'density_atomic': 11.761470249999999,
                                        'elements': ['Cu'],
                                        'formula_anonymous': 'A',
                                        'formula_pretty': 'Cu',
                                        'nelements': 1,
                                        'nsites': 1,
                                        'symmetry': {'angle_tolerance': 5.0,
                                                     'crystal_system': 'Cubic',
                                                     'hall': '-F 4 2 3',
                                                     'number': 225,
                                                     'point_group': 'm-3m',
                                                     'symbol': 'Fm-3m',
                                                     'symprec': 0.1,
                                                     'version': '2.6.0'},
                                        'volume': 11.761470249999999}},
 'name': 'fairchem Relax',
 'nid': 'runnervm3a41e.ilonryld4j1ubp2vurtnjdzw0f.bx.internal.cloudapp.net',
 'parameters': {'version': '2.12.0'},
 'parameters_opt': {'fmax': 0.001,
                    'max_steps': 1000,
                    'maxstep': 0.2,
                    'optimizer': 'LBFGS',
                    'type': 'optimization'},
 'quacc_version': '1.0.6',
 'results': {'energy': -3.750168406173663,
             'forces': array([[0., 0., 0.]], dtype=float32),
             'free_energy': -3.750168406173663,
             'stress': array([-4.3533491e-03, -4.3533733e-03, -4.3533514e-03, -1.0742662e-09,
        1.0059429e-09, -5.0324139e-10], dtype=float32)},
 'structure_metadata': {'chemsys': 'Cu',
                        'composition': {'Cu': 1.0},
                        'composition_reduced': {'Cu': 1.0},
                        'density': 8.971719813140734,
                        'density_atomic': 11.761470249999999,
                        'elements': ['Cu'],
                        'formula_anonymous': 'A',
                        'formula_pretty': 'Cu',
                        'nelements': 1,
                        'nsites': 1,
                        'symmetry': {'angle_tolerance': 5.0,
                                     'crystal_system': 'Cubic',
                                     'hall': '-F 4 2 3',
                                     'number': 225,
                                     'point_group': 'm-3m',
                                     'symbol': 'Fm-3m',
                                     'symprec': 0.1,
                                     'version': '2.6.0'},
                        'volume': 11.761470249999999},
 'trajectory': [Atoms(symbols='Cu', pbc=True, cell=[[0.0, 1.805, 1.805], [1.805, 0.0, 1.805], [1.805, 1.805, 0.0]], calculator=SinglePointCalculator(...))],
 'trajectory_results': [{'energy': -3.750168406173663,
                         'forces': array([[0., 0., 0.]]),
                         'free_energy': -3.750168406173663,
                         'stress': array([-4.35334910e-03, -4.35337331e-03, -4.35335143e-03, -1.07426623e-09,
        1.00594288e-09, -5.03241393e-10])}]}

Congratulations; you ran your first relaxation using an OMat24-trained checkpoint and quacc!