Skip to content

elastic

Common elastic constants workflows.

elastic_tensor_flow

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

Common workflow for calculating elastic tensors.

Parameters:

  • atoms (Atoms) –

    Atoms object

  • relax_job (Job) –

    The relaxation function.

  • static_job (Job) –

    The static function

  • pre_relax (bool, default: True ) –

    Whether to run a relaxation on the bulk structure before deformation (true) or run a static calculation (false)

  • 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

Returns:

  • ElasticSchema

    See the return type-hint for the data structure.

Source code in quacc/recipes/common/elastic.py
@flow
def elastic_tensor_flow(
    atoms: Atoms,
    relax_job: Job,
    static_job: Job,
    pre_relax: bool = True,
    run_static: bool = False,
    deform_kwargs: dict[str, Any] | None = None,
) -> ElasticSchema:
    """
    Common workflow for calculating elastic tensors.

    Parameters
    ----------
    atoms
        Atoms object
    relax_job
        The relaxation function.
    static_job
        The static function
    pre_relax
        Whether to run a relaxation on the bulk structure before deformation (true) or run a static
        calculation (false)
    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][]

    Returns
    -------
    ElasticSchema
        See the return type-hint for the data structure.
    """
    if pre_relax:
        undeformed_result = relax_job(atoms, relax_cell=True)
        if run_static:
            undeformed_result = static_job(undeformed_result["atoms"])
    else:
        undeformed_result = static_job(atoms)

    return _elastic_tensor_subflow(
        undeformed_result=undeformed_result,
        relax_job=relax_job,
        static_job=static_job if run_static else None,
        deform_kwargs=deform_kwargs,
    )