Skip to content

defects

Defect recipes for EMT.

has_deps module-attribute

has_deps = True

bulk_to_defects_flow

bulk_to_defects_flow(
    atoms: Atoms,
    defect_gen: (
        AntiSiteGenerator
        | ChargeInterstitialGenerator
        | InterstitialGenerator
        | SubstitutionGenerator
        | VacancyGenerator
        | VoronoiInterstitialGenerator
    ) = VacancyGenerator,
    defect_charge: int = 0,
    run_static: bool = True,
    make_defects_kwargs: dict[str, Any] | None = None,
    job_params: dict[str, dict[str, Any]] | None = None,
    job_decorators: (
        dict[str, Callable | None] | None
    ) = None,
) -> list[RunSchema | OptSchema]

Workflow consisting of:

  1. Defect generation

  2. Defect relaxations

  3. Optional defect statics

Parameters:

  • atoms (Atoms) –

    Atoms object for the structure.

  • defect_gen (AntiSiteGenerator | ChargeInterstitialGenerator | InterstitialGenerator | SubstitutionGenerator | VacancyGenerator | VoronoiInterstitialGenerator, default: VacancyGenerator ) –

    Defect generator

  • defect_charge (int, default: 0 ) –

    Charge state of the defect

  • run_static (bool, default: True ) –

    Whether to run static calculations.

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

    Keyword arguments to pass to quacc.atoms.defects.make_defects_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 dictinoary where the keys are the names of the jobs and the values are dictionaries of parameters.

  • 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:

Source code in quacc/recipes/emt/defects.py
@flow
@requires(
    has_deps, "Missing defect dependencies. Please run pip install quacc[defects]"
)
def bulk_to_defects_flow(
    atoms: Atoms,
    defect_gen: (
        AntiSiteGenerator
        | ChargeInterstitialGenerator
        | InterstitialGenerator
        | SubstitutionGenerator
        | VacancyGenerator
        | VoronoiInterstitialGenerator
    ) = VacancyGenerator,
    defect_charge: int = 0,
    run_static: bool = True,
    make_defects_kwargs: dict[str, Any] | None = None,
    job_params: dict[str, dict[str, Any]] | None = None,
    job_decorators: dict[str, Callable | None] | None = None,
) -> list[RunSchema | OptSchema]:
    """
    Workflow consisting of:

    1. Defect generation

    2. Defect relaxations
        - name: "relax_job"
        - job: [quacc.recipes.emt.core.relax_job][]

    3. Optional defect statics
        - name: "static_job"
        - job: [quacc.recipes.emt.core.static_job][]

    Parameters
    ----------
    atoms
        Atoms object for the structure.
    defect_gen
        Defect generator
    defect_charge
        Charge state of the defect
    run_static
        Whether to run static calculations.
    make_defects_kwargs
        Keyword arguments to pass to
        [quacc.atoms.defects.make_defects_from_bulk][]
    job_params
        Custom parameters to pass to each Job in the Flow. This is a dictinoary where
        the keys are the names of the jobs and the values are dictionaries of parameters.
    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
    -------
    list[RunSchema | OptSchema]
        List of dictionary of results from [quacc.schemas.ase.summarize_run][]
        or [quacc.schemas.ase.summarize_opt_run][].
        See the return type-hint for the data structure.
    """
    relax_job_, static_job_ = customize_funcs(
        ["relax_job", "static_job"],
        [relax_job, static_job],
        param_swaps=job_params,
        decorators=job_decorators,
    )
    make_defects_kwargs = recursive_dict_merge(
        make_defects_kwargs, {"defect_gen": defect_gen, "defect_charge": defect_charge}
    )

    return bulk_to_defects_subflow(
        atoms,
        relax_job_,
        static_job=static_job_ if run_static else None,
        make_defects_kwargs=make_defects_kwargs,
    )