Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Calculation Workflows with FAIRChem Models

This repo is integrated with workflow tools like QuAcc to make complex molecular simulation workflows easy. You can use any MLP recipe (relaxations, single-points, elastic calculations, etc.) and simply specify the fairchem model type.

Below is an example that uses the default elastic_tensor_flow flow:

from __future__ import annotations

from ase.build import bulk
from quacc.recipes.mlp.elastic import elastic_tensor_flow

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

# Run an elastic property calculation with our favorite MLP potential
result = elastic_tensor_flow(
    atoms,
    job_params={
        "all": dict(
            method="fairchem",
            name_or_path="uma-s-1p2",
            task_name="omat",
        ),
    },
)
/tmp/ipykernel_8016/2729024292.py:4: DeprecationWarning: quacc.recipes.mlp is deprecated. Use quacc.recipes.mlip instead.
  from quacc.recipes.mlp.elastic import elastic_tensor_flow
/tmp/ipykernel_8016/2729024292.py:4: DeprecationWarning: quacc.recipes.mlp.elastic is deprecated. Use quacc.recipes.mlip.elastic instead.
  from quacc.recipes.mlp.elastic import elastic_tensor_flow
INFO:matplotlib.font_manager:generated new fontManager
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[1], line 10
      6 # Make an Atoms object of a bulk Cu structure
      7 atoms = bulk("Cu")
      8 
      9 # Run an elastic property calculation with our favorite MLP potential
---> 10 result = elastic_tensor_flow(
     11     atoms,
     12     job_params={
     13         "all": dict(

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:148, in tracked.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    146 @wraps(func)
    147 def wrapper(*args, **kwargs):
--> 148     return _tracked_call(func, node_type, args, kwargs)

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:169, in _tracked_call(func, node_type, args, kwargs)
    166 # When NESTED_RESULTS is off, skip all context tracking and just
    167 # delegate to the original function directly.
    168 if not settings.NESTED_RESULTS:
--> 169     return func(*args, **kwargs)
    171 # Create a unique name we can use at this level.
    172 name = make_unique_name(prefix=f"{func.__name__}-")

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/recipes/mlip/elastic.py:82, in elastic_tensor_flow(atoms, pre_relax, run_static, deform_kwargs, job_params, job_decorators)
     30 """
     31 Workflow consisting of:
     32 
   (...)     73     See the return type-hint for the data structure.
     74 """
     75 relax_job_, static_job_ = customize_funcs(
     76     ["relax_job", "static_job"],
     77     [relax_job, static_job],
     78     param_swaps=job_params,
     79     decorators=job_decorators,
     80 )  # type: ignore
---> 82 return elastic_tensor_flow_(
     83     atoms=atoms,
     84     relax_job=relax_job_,
     85     static_job=static_job_,
     86     pre_relax=pre_relax,
     87     run_static=run_static,
     88     deform_kwargs=deform_kwargs,
     89 )

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:148, in tracked.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    146 @wraps(func)
    147 def wrapper(*args, **kwargs):
--> 148     return _tracked_call(func, node_type, args, kwargs)

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:169, in _tracked_call(func, node_type, args, kwargs)
    166 # When NESTED_RESULTS is off, skip all context tracking and just
    167 # delegate to the original function directly.
    168 if not settings.NESTED_RESULTS:
--> 169     return func(*args, **kwargs)
    171 # Create a unique name we can use at this level.
    172 name = make_unique_name(prefix=f"{func.__name__}-")

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/recipes/common/elastic.py:60, in elastic_tensor_flow(atoms, relax_job, static_job, pre_relax, run_static, deform_kwargs)
     35 """
     36 Common workflow for calculating elastic tensors.
     37 
   (...)     57     See the return type-hint for the data structure.
     58 """
     59 if pre_relax:
---> 60     undeformed_result = relax_job(atoms, relax_cell=True)
     61     if run_static:
     62         undeformed_result = static_job(undeformed_result["atoms"])

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:148, in tracked.<locals>.decorator.<locals>.wrapper(*args, **kwargs)
    146 @wraps(func)
    147 def wrapper(*args, **kwargs):
--> 148     return _tracked_call(func, node_type, args, kwargs)

File ~/work/_tool/Python/3.12.13/x64/lib/python3.12/site-packages/quacc/wflow_tools/context.py:169, in _tracked_call(func, node_type, args, kwargs)
    166 # When NESTED_RESULTS is off, skip all context tracking and just
    167 # delegate to the original function directly.
    168 if not settings.NESTED_RESULTS:
--> 169     return func(*args, **kwargs)
    171 # Create a unique name we can use at this level.
    172 name = make_unique_name(prefix=f"{func.__name__}-")

TypeError: relax_job() missing 1 required positional argument: 'library'