-
Notifications
You must be signed in to change notification settings - Fork 1
/
example_09_Cu.py
executable file
·221 lines (174 loc) · 10.5 KB
/
example_09_Cu.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/usr/bin/env python
"""Run a full ``YamboWannier90WorkChain``.
Usage: ./example_09.py
To compare bands between QE, W90, W90 with QP, run in terminal
```
aiida-yambo-wannier90 plot bands PW_PK GWW90_PK
```
Where `PW_PK` is the PK of a `PwBandsWorkChain/PwBaseWorkChain` for PW bands calculation,
`GWW90_PK` is the PK of a `YamboWannier90WorkChain`.
"""
import click
from aiida import cmdline, orm
from aiida_wannier90_workflows.cli.params import RUN
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
def submit(group: orm.Group = None, run: bool = False):
"""Submit a ``YamboWannier90WorkChain`` from scratch.
Run all the steps.
"""
# pylint: disable=import-outside-toplevel
from aiida_quantumespresso.workflows.pw.base import PwBaseWorkChain
from aiida_wannier90_workflows.workflows.bands import Wannier90BandsWorkChain
from aiida_wannier90_workflows.workflows.base.wannier90 import (
Wannier90BaseWorkChain,
)
from aiida_yambo_wannier90.workflows import YamboWannier90WorkChain
codes = {
"pw": "pw-6.8@hydralogin",
"pw2wannier90": "pw2wannier90@hydralogin",
"projwfc": "projwfc-6.8@hydralogin",
"wannier90": "w90@hydralogin",
"yambo": "yambo-RIMW@hydralogin",
"p2y": "p2y-devel@hydralogin",
"ypp": "ypp-RIMW@hydralogin",
"gw2wannier90": "gw2wannier90@hydralogin",
}
# Si2 from wannier90/example23
#w90_wkchain = orm.load_node(222) # Si
structure = orm.load_node(402) # Cu
builder = YamboWannier90WorkChain.get_builder_from_protocol(
codes=codes,
structure=structure,
pseudo_family="PseudoDojo/0.4/LDA/SR/standard/upf",
)
# Increase ecutwfc
params = builder.yambo.ywfl.scf.pw.parameters.get_dict()
params["SYSTEM"]["ecutwfc"] = 100
builder.yambo.ywfl.scf.pw.parameters = orm.Dict(dict=params)
params = builder.yambo.ywfl.nscf.pw.parameters.get_dict()
params["SYSTEM"]["ecutwfc"] = 100
builder.yambo.ywfl.nscf.pw.parameters = orm.Dict(dict=params)
parallelization = dict(
max_wallclock_seconds=24 * 3600,
# num_mpiprocs_per_machine=48,
#npool=4,
num_machines=1,
)
set_parallelization(
builder["yambo"]["ywfl"]["scf"],
parallelization=parallelization,
process_class=PwBaseWorkChain,
)
set_parallelization(
builder["yambo"]["ywfl"]["nscf"],
parallelization=parallelization,
process_class=PwBaseWorkChain,
)
set_parallelization(
builder["yambo_qp"]["scf"],
parallelization=parallelization,
process_class=PwBaseWorkChain,
)
set_parallelization(
builder["yambo_qp"]["nscf"],
parallelization=parallelization,
process_class=PwBaseWorkChain,
)
set_parallelization(
builder["wannier90"],
parallelization=parallelization,
process_class=Wannier90BandsWorkChain,
)
set_parallelization(
builder["wannier90_qp"],
parallelization=parallelization,
process_class=Wannier90BaseWorkChain,
)
'''builder['yambo']['parameters_space']= orm.List(list=[{'conv_thr': 1,
'conv_thr_units': '%',
'convergence_algorithm': 'new_algorithm_1D',
'delta': [2, 2, 2],
'max': [32, 32, 32],
'max_iterations': 4,
'start': [8, 8, 8],
'steps': 4,
'stop': [16, 16, 16],
'var': ['kpoint_mesh']},
{'conv_thr': 1,
'conv_thr_units': '%',
'convergence_algorithm': 'new_algorithm_1D',
'delta': [2],
'max': 40,
'max_iterations': 8,
'start': 8,
'steps': 6,
'stop': 20,
'var': ['NGsBlkXp']}])'''
builder['yambo']['workflow_settings']= orm.Dict(dict= {'bands_nscf_update': 'all-at-once',
'skip_pre': True,
'type': '1D_convergence',
'what': ['homo_G']},)
builder['yambo']['ywfl']['additional_parsing'] = orm.List(list=['gap_GG'])
builder['yambo']['ywfl']['yres']['yambo']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 4, 'num_cores_per_mpiproc': 1, 'num_mpiprocs_per_machine': 16}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=1'}}
builder['yambo']['ywfl']['scf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=16'}}
builder['yambo']['ywfl']['nscf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 2, 'num_cores_per_mpiproc': 2, 'num_mpiprocs_per_machine':8}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=2'}}
builder['yambo_qp']['additional_parsing'] = orm.List(list=['gap_GG'])
builder['yambo_qp']['yres']['yambo']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 1, 'num_mpiprocs_per_machine': 16}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=1'}}
builder['yambo_qp']['scf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=16'}}
builder['yambo_qp']['nscf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 1, 'num_mpiprocs_per_machine': 16}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=1'}}
builder['wannier90_qp']['wannier90']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 2, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=16'}}
builder['wannier90']['nscf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines':4, 'num_cores_per_mpiproc': 1, 'num_mpiprocs_per_machine': 16}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=1'}}
builder['wannier90']['scf']['pw']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=16'}}
builder['wannier90']['pw2wannier90']['pw2wannier90']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 8, 'num_mpiprocs_per_machine':2}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=8'}}
builder['wannier90']['wannier90']['wannier90']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 4, 'num_cores_per_mpiproc':2, 'num_mpiprocs_per_machine': 8}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': 'export OMP_NUM_THREADS=2'}}
preprend_ypp_w = builder['ypp']['ypp']['metadata']['options']['prepend_text']
builder['ypp']['ypp']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': preprend_ypp_w}}
preprend_ypp_qp = builder['ypp_QP']['ypp']['metadata']['options']['prepend_text']
builder['ypp_QP']['ypp']['metadata'] = {'options': {'stash': {}, 'resources': {'num_machines': 1, 'num_cores_per_mpiproc': 16, 'num_mpiprocs_per_machine': 1}, 'max_wallclock_seconds': 86400,
'withmpi': True, 'queue_name': 's3par', 'prepend_text': preprend_ypp_qp}}
builder.pop('yambo')
builder['yambo_qp']['parent_folder'] = orm.load_node(13004).outputs.remote_folder
builder['yambo_qp']['QP_subset_dict'] = orm.Dict(dict={
'qp_per_subset':50,
'parallel_runs':4,
})
'''builder['yambo']['ywfl']['yres']['yambo']['parameters'] = orm.Dict(dict={'arguments': ['dipoles', 'ppa', 'HF_and_locXC', 'gw0', 'NLCC', 'rim_cut'],
'variables': {'Chimod': 'hartree',
'DysSolver': 'n',
'GTermKind': 'BG',
'PAR_def_mode': 'workload',
'X_and_IO_nCPU_LinAlg_INV': [1, ''],
'RandQpts': [5000000, ''],
'RandGvec': [100, 'RL'],
'NGsBlkXp': [16, 'Ry'],
'BndsRnXp': [[1, 400], ''],
'GbndRnge': [[1, 400], ''],
'QPkrange': [[[1, 1, 32, 32]], '']}})'''
print_builder(builder)
if run:
submit_and_add_group(builder, group)
@click.command()
@cmdline.utils.decorators.with_dbenv()
@cmdline.params.options.GROUP(
help="The group to add the submitted workchain.",
)
@RUN()
def cli(group, run):
"""Run a ``YamboWannier90WorkChain``."""
submit(group, run)
if __name__ == "__main__":
cli() # pylint: disable=no-value-for-parameter