-
Notifications
You must be signed in to change notification settings - Fork 41
/
slabs.py
75 lines (61 loc) · 2.18 KB
/
slabs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""Slab recipes for EMT."""
from __future__ import annotations
from typing import TYPE_CHECKING
from quacc import flow
from quacc.recipes.common.slabs import bulk_to_slabs_subflow
from quacc.recipes.emt.core import relax_job, static_job
from quacc.wflow_tools.customizers import customize_funcs
if TYPE_CHECKING:
from typing import Any, Callable
from ase.atoms import Atoms
from quacc.schemas._aliases.ase import OptSchema, RunSchema
@flow
def bulk_to_slabs_flow(
atoms: Atoms,
run_static: bool = True,
make_slabs_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. Slab generation
2. Slab relaxations
- name: "relax_job"
- job: [quacc.recipes.emt.core.relax_job][]
3. Optional slab statics
- name: "static_job"
- job: [quacc.recipes.emt.core.static_job][]
Parameters
----------
atoms
Atoms object
run_static
Whether to run static calculations.
make_slabs_kwargs
Additional keyword arguments to pass to [quacc.atoms.slabs.make_slabs_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.
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]
[RunSchema][quacc.schemas.ase.summarize_run] or
[OptSchema][quacc.schemas.ase.summarize_opt_run] for each slab.
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,
)
return bulk_to_slabs_subflow(
atoms,
relax_job_,
static_job=static_job_ if run_static else None,
make_slabs_kwargs=make_slabs_kwargs,
)