Skip to content

elastic

Elastic constants recipes for MLIPs.

elastic_tensor_flow

elastic_tensor_flow(
    atoms: Atoms,
    pre_relax: bool = True,
    run_static: bool = False,
    deform_kwargs: dict[str, Any] | None = None,
    job_params: dict[str, dict[str, Any]] | None = None,
    job_decorators: (
        dict[str, Callable | None] | None
    ) = None,
) -> ElasticSchema

Workflow consisting of:

  1. Bulk structure relaxation (if pre_relax is True)

  2. Bulk structure static calculation (if run_static is True)

  3. Deformed structures generation

  4. Deformed structures relaxations

  5. Deformed structures statics (if run_static is True)

  6. Elastic tensor calculation

Parameters:

  • atoms (Atoms) –

    Atoms object

  • pre_relax (bool, default: True ) –

    Whether to run a relaxation on the structure before deformation (true)

  • run_static (bool, default: False ) –

    Whether to run static calculations after any relaxations on the undeformed or deformed structures

  • deform_kwargs (dict[str, Any] | None, default: None ) –

    Additional keyword arguments to pass to quacc.atoms.deformation.make_deformations_from_bulk

  • job_params (dict[str, dict[str, Any]] | None, default: None ) –

    Custom parameters to pass to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are dictionaries of parameters. This is also where the MLIP library and its calculator kwargs are supplied to each job, e.g. job_params={"relax_job": {"library": "matcalc", "name": "TensorNet-MatPES-PBE-2025.2"}}. See quacc.recipes.mlip._base.pick_calculator for the kwargs each library requires.

  • job_decorators (dict[str, Callable | None] | None, default: None ) –

    Custom decorators to apply to each Job in the Flow. This is a dictionary where the keys are the names of the jobs and the values are decorators.

Returns:

  • ElasticSchema

    See the return type-hint for the data structure.

Source code in quacc/recipes/mlip/elastic.py
@flow
def elastic_tensor_flow(
    atoms: Atoms,
    pre_relax: bool = True,
    run_static: bool = False,
    deform_kwargs: dict[str, Any] | None = None,
    job_params: dict[str, dict[str, Any]] | None = None,
    job_decorators: dict[str, Callable | None] | None = None,
) -> ElasticSchema:
    """
    Workflow consisting of:

    1. Bulk structure relaxation (if pre_relax is True)
        - name: "relax_job"
        - job: [quacc.recipes.mlip.core.relax_job][]

    2. Bulk structure static calculation (if run_static is True)
        - name: "static_job"
        - job: [quacc.recipes.mlip.core.static_job][]

    3. Deformed structures generation

    4. Deformed structures relaxations
        - name: "relax_job"
        - job: [quacc.recipes.mlip.core.relax_job][]

    5. Deformed structures statics (if run_static is True)
        - name: "static_job"
        - job: [quacc.recipes.mlip.core.static_job][]

    6. Elastic tensor calculation

    Parameters
    ----------
    atoms
        Atoms object
    pre_relax
        Whether to run a relaxation on the structure before deformation (true)
    run_static
        Whether to run static calculations after any relaxations on the undeformed or deformed structures
    deform_kwargs
        Additional keyword arguments to pass to [quacc.atoms.deformation.make_deformations_from_bulk][]
    job_params
        Custom parameters to pass to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are dictionaries of parameters.
        This is also where the MLIP `library` and its calculator kwargs are supplied
        to each job, e.g. `job_params={"relax_job": {"library": "matcalc", "name":
        "TensorNet-MatPES-PBE-2025.2"}}`. See
        [quacc.recipes.mlip._base.pick_calculator][] for the kwargs each library
        requires.
    job_decorators
        Custom decorators to apply to each Job in the Flow. This is a dictionary where
        the keys are the names of the jobs and the values are decorators.

    Returns
    -------
    ElasticSchema
        See the return type-hint for the data structure.
    """
    relax_job_, static_job_ = customize_jobs(
        {"relax_job": relax_job, "static_job": static_job},
        param_defaults={"relax_job": {"relax_cell": True}},
        param_swaps=job_params,
        decorators=job_decorators,
    ).values()

    return elastic_tensor_flow_(
        atoms=atoms,
        relax_job=relax_job_,
        static_job=static_job_,
        pre_relax=pre_relax,
        run_static=run_static,
        deform_kwargs=deform_kwargs,
    )