-
Notifications
You must be signed in to change notification settings - Fork 1
/
example_02.py
executable file
·66 lines (51 loc) · 1.93 KB
/
example_02.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
#!/usr/bin/env python
"""Run a ``PwBaseWorkChain`` for PW band structure.
Usage: ./example_02.py
"""
import click
from aiida import cmdline, orm
from aiida_quantumespresso.workflows.pw.base import PwBaseWorkChain
from aiida_wannier90_workflows.cli.params import RUN, FilteredWorkflowParamType
from aiida_wannier90_workflows.utils.workflows.builder.serializer import print_builder
from aiida_wannier90_workflows.utils.workflows.builder.setter import set_parallelization, set_num_bands
from aiida_wannier90_workflows.utils.workflows.builder.submit import submit_and_add_group
from aiida_wannier90_workflows.utils.workflows.builder.generator import get_pwbands_builder
from aiida_wannier90_workflows.workflows import Wannier90BandsWorkChain
def submit(
w90_wkchain: Wannier90BandsWorkChain,
group: orm.Group = None,
run: bool = False,
):
"""Submit a ``PwBaseWorkChain`` to calculate PW bands.
Load a finished ``Wannier90BandsWorkChain``, and reuse the scf calculation.
"""
builder = get_pwbands_builder(w90_wkchain)
parallelization = {
"npool": 8,
}
set_parallelization(builder, parallelization, process_class=PwBaseWorkChain)
print_builder(builder)
if run:
submit_and_add_group(builder, group)
@click.command()
@cmdline.utils.decorators.with_dbenv()
@cmdline.params.arguments.WORKFLOW(
type=FilteredWorkflowParamType(
process_classes=(
"aiida.workflows:wannier90_workflows.bands",
"aiida.workflows:wannier90_workflows.optimize",
)
),
)
@cmdline.params.options.GROUP(
help="The group to add the submitted workchain.",
)
@RUN()
def cli(workflow, group, run):
"""Run a ``PwBaseWorkChain`` for PW band structure.
Reuse the scf calculation from a finished Wannier90BandsWorkChain.
"""
# workflow = orm.load_node(139623)
submit(workflow, group, run)
if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter