forked from aiidateam/aiida-wannier90-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_noncollinear.py
executable file
·86 lines (71 loc) · 2.83 KB
/
example_noncollinear.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
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env runaiida
"""Run a ``Wannier90BandsWorkChain`` for Wannier90 band structure.
Usage: ./example_02.py
"""
# Reference load_node(2653)
import click
from aiida import cmdline, orm
from aiida_wannier90_workflows.cli.params import RUN
from aiida_wannier90_workflows.utils.code import check_codes, identify_codes
from aiida_wannier90_workflows.utils.structure import read_structure
from aiida_wannier90_workflows.utils.workflows.builder.serializer import print_builder
from aiida_wannier90_workflows.utils.workflows.builder.setter import set_parallelization
from aiida_wannier90_workflows.utils.workflows.builder.submit import (
submit_and_add_group,
)
from aiida_wannier90_workflows.utils.workflows.builder.generator.post import (
get_wannier_builder_from_pwbands,
)
from aiida_wannier90_workflows.workflows import Wannier90BandsWorkChain, Wannier90WorkChain
from aiida_quantumespresso.common.types import SpinType
def submit(
codes: dict,
structure: orm.StructureData,
group: orm.Group = None,
run: bool = False,
):
"""Submit a ``Wannier90BandsWorkChain`` to calculate Wannier bands."""
codes = identify_codes(codes)
check_codes(codes)
builder = Wannier90WorkChain.get_builder_from_protocol(
codes,
structure,
protocol="fast",
initial_magnetic_moments={
"starting_magnetization(1)":3.0,
"angle1(1)": 90.0,
"angle2(1)": 90.0
},
# pseudo_family="pslibrary/1.0.0/rel-pbe/kjpaw",
spin_type=SpinType.NON_COLLINEAR,
# exclude_semicore=False,
)
# You can change parallelization here
parallelization = {
"num_mpiprocs_per_machine": 1,
"npool": 1,
}
set_parallelization(builder, parallelization, process_class=Wannier90BandsWorkChain)
print_builder(builder)
if run:
submit_and_add_group(builder, group)
@click.command()
@cmdline.utils.decorators.with_dbenv()
@cmdline.params.options.CODES()
@cmdline.params.options.GROUP(help="The group to add the submitted workchain.")
@click.argument("filename", type=click.Path(exists=True))
@RUN()
def cli(filename, codes, group, run):
"""Run a ``Wannier90BandsWorkChain`` to calculate Wannier90 band structure.
FILENAME: a crystal structure file, e.g., ``input_files/GaAs.xsf``.
"""
struct = read_structure(filename, store=True)
submit(codes, struct, group, run)
if __name__ == "__main__":
# cli() # pylint: disable=no-value-for-parameter
from aiida.orm import load_code
structure=read_structure("./input_files/bcc_Fe.cif")
codes=["qe-pw@localhost","qe-pw2wannier90@localhost","wannier90@localhost","qe-projwfc@localhost"]
submit(codes, structure,run=True)
# Run like this:
# ./example_02.py input_files/GaAs.xsf -X qe-pw@localhost qe-pw2wannier90@localhost wannier90@localhost qe-projwfc@localhost -r