Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 130 additions & 155 deletions src/aiida_epw/calculations/epw.py

Large diffs are not rendered by default.

44 changes: 39 additions & 5 deletions src/aiida_epw/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,43 @@
class RestartType(enum.Enum):
"""Enumeration of EPW run/restart modes."""

NONE = "none"
FROM_SCRATCH = "from_scratch"
FROM_EPB = "from_epb"
FROM_EPMATWP = "from_epmatwp"
EPHWRITE = "ephwrite"
EPHREAD = "ephread"
EPHWRITE_RESTART = "ephwrite_restart"
EPHREAD_RESTART = "ephread_restart"
EPWREAD = "epwread"
FROM_EPH = "from_eph"


RESTART_TYPE_DEFAULTS = {
RestartType.FROM_SCRATCH: {
"epwread": False,
"epwwrite": True,
"epbwrite": True,
"epbread": False,
},
RestartType.FROM_EPB: {
"epbread": True,
"epbwrite": False,
"epwread": False,
"epwwrite": True,
},
RestartType.FROM_EPMATWP: {
"epwread": True,
"epwwrite": False,
"epbwrite": False,
"epbread": False,
},
RestartType.EPHWRITE: {
"epwread": True,
"ep_coupling": True,
"elph": True,
"ephwrite": True,
},
RestartType.FROM_EPH: {
"epwread": True,
"ep_coupling": False,
"elph": False,
"ephwrite": False,
"restart": False,
},
}
4 changes: 2 additions & 2 deletions src/aiida_epw/parsers/epw.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def parse(self, **kwargs):
parsed_data.update(parsed_epw)

elbands_contents = self.get_retrieved_content(
EpwCalculation._output_elbands_file
EpwCalculation._OUTPUT_ELBANDS_FILE
)
if elbands_contents is not None:
self.out(
Expand All @@ -100,7 +100,7 @@ def parse(self, **kwargs):
)

phbands_contents = self.get_retrieved_content(
EpwCalculation._output_phbands_file
EpwCalculation._OUTPUT_PHBANDS_FILE
)
if phbands_contents is not None:
self.out(
Expand Down
11 changes: 3 additions & 8 deletions src/aiida_epw/workflows/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,7 @@ def handle_cannot_bracket_ef(self, calculation):
restart_type_node.get_member() if restart_type_node is not None else None
)
next_restart_type = {
"NONE": "EPWREAD",
"EPHWRITE": "EPHREAD",
"EPHWRITE_RESTART": "EPHREAD",
"FROM_SCRATCH": "FROM_EPB",
}.get(getattr(restart_type, "name", None))
if next_restart_type is not None:
self.ctx.inputs.restart_type = restart_type.__class__[next_restart_type]
Expand Down Expand Up @@ -645,12 +643,9 @@ def handle_pade_approximants(self, calculation):
True, self.exit_codes.ERROR_KNOWN_UNRECOVERABLE_FAILURE
)

try:
from aiida_epw.common.types import RestartType
from aiida_epw.common.types import RestartType

self.ctx.inputs.restart_type = RestartType.EPHREAD
except ImportError:
parameters.setdefault("INPUTEPW", {})["epwread"] = True
self.ctx.inputs.restart_type = RestartType.FROM_EPH
self.ctx.inputs.parameters = orm.Dict(parameters)
self.ctx.inputs.parent_folder_epw = calculation.outputs.remote_folder

Expand Down
2 changes: 0 additions & 2 deletions src/aiida_epw/workflows/mobility.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from aiida_quantumespresso.workflows.protocols.utils import ProtocolMixin

from aiida_epw.calculations.epw import serialize_restart_type
from aiida_epw.tools.band_analysis import extract_band_edges_from_epw_prep
from aiida_epw.workflows.base import EpwBaseWorkChain

Expand Down Expand Up @@ -448,7 +447,6 @@ def run_conv(self):
"code": self.inputs.epw_mobility.code,
"structure": self.inputs.structure,
"parent_folder_epw": self.inputs.parent_folder_epw,
"restart_type": serialize_restart_type("ephread_restart"),
"qfpoints_distance": self.ctx.interpolation_list.pop(0),
"kfpoints_factor": self.inputs.kfpoints_factor,
"parameters": orm.Dict(parameters),
Expand Down
4 changes: 2 additions & 2 deletions src/aiida_epw/workflows/prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ def run_epw(self):

from aiida_epw.common.types import RestartType

inputs.restart_type = RestartType.NONE
inputs.restart_type = RestartType.FROM_SCRATCH

workchain_node = self.submit(EpwBaseWorkChain, **inputs)
self.report(
Expand Down Expand Up @@ -1274,7 +1274,7 @@ def run_epw_bands(self):

from aiida_epw.common.types import RestartType

inputs.restart_type = RestartType.EPWREAD
inputs.restart_type = RestartType.FROM_EPMATWP

workchain_node = self.submit(EpwBaseWorkChain, **inputs)
self.report(
Expand Down
4 changes: 2 additions & 2 deletions src/aiida_epw/workflows/protocols/prep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ default_inputs:
temps: 300
vme: 'dipole'
wannierize: False
restart_type: wannierize
restart_type: from_scratch
epw_bands:
options:
resources:
Expand All @@ -70,7 +70,7 @@ default_inputs:
parameters:
INPUTEPW:
band_plot: True
restart_type: epwread
restart_type: from_epmatwp
default_protocol: moderate
protocols:
moderate:
Expand Down
4 changes: 2 additions & 2 deletions src/aiida_epw/workflows/protocols/prep_sc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ default_inputs:
fsthick: 100
phonselfen: False
temps: 300
restart_type: wannierize
restart_type: from_scratch
epw_bands:
options:
resources:
Expand All @@ -66,7 +66,7 @@ default_inputs:
parameters:
INPUTEPW:
band_plot: True
restart_type: epwread
restart_type: from_epmatwp
default_protocol: moderate
protocols:
moderate:
Expand Down
15 changes: 4 additions & 11 deletions src/aiida_epw/workflows/protocols/supercon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ default_inputs:
num_machines: 1
max_wallclock_seconds: 43200 # Twelve hours
withmpi: True
restart_type: ephwrite
momentum_dependence: False
analytical_continuation: pade
parameters:
Expand Down Expand Up @@ -46,12 +45,11 @@ default_inputs:
num_machines: 1
max_wallclock_seconds: 43200 # Twelve hours
withmpi: True
restart_type: ephread
parameters:
INPUTEPW:
eliashberg: True
elph: True
ep_coupling: True
elph: False
ep_coupling: False
conv_thr_iaxis: 0.01
elecselfen: False
etf_mem: 1
Expand All @@ -60,9 +58,7 @@ default_inputs:
muc: 0.13
nqstep: 500
nsiter: 500
nstemp: 40
selecqread: False
temps: 1 40
vme: 'dipole'
wscut: 0.5
wannierize: False
Expand All @@ -72,12 +68,11 @@ default_inputs:
num_machines: 1
max_wallclock_seconds: 43200 # Twelve hours
withmpi: True
restart_type: ephread
parameters:
INPUTEPW:
eliashberg: True
elph: True
ep_coupling: True
elph: False
ep_coupling: False
conv_thr_iaxis: 0.01
elecselfen: False
etf_mem: 1
Expand All @@ -86,9 +81,7 @@ default_inputs:
muc: 0.13
nqstep: 500
nsiter: 500
nstemp: 20
selecqread: False
temps: 5 43
vme: 'dipole'
wscut: 0.5
wannierize: False
Expand Down
21 changes: 14 additions & 7 deletions src/aiida_epw/workflows/supercon.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def define(cls, spec):
"parent_folder_chk",
"qfpoints",
"kfpoints",
"restart_type",
),
namespace_options={
"help": (
Expand All @@ -140,7 +139,6 @@ def define(cls, spec):
"parent_folder_chk",
"qfpoints_distance",
"kfpoints_factor",
"restart_type",
),
namespace_options={
"help": (
Expand All @@ -159,7 +157,6 @@ def define(cls, spec):
"parent_folder_chk",
"qfpoints_distance",
"kfpoints_factor",
"restart_type",
),
namespace_options={
"help": (
Expand Down Expand Up @@ -286,7 +283,11 @@ def get_builder_from_protocol(
real_axis = epw_inputs.pop("real_axis", False)
analytical_continuation = epw_inputs.pop("analytical_continuation", None)
epw_inputs.pop("calculation_type", None)
epw_inputs.pop("restart_type", None)
restart_type = epw_inputs.pop("restart_type", None)
if restart_type is None:
restart_type = (
"ephwrite" if epw_namespace == "epw_interp" else "from_eph"
)

# Check which input ports are supported by EpwBaseWorkChain dynamically for cross-branch compatibility
base_inputs = EpwBaseWorkChain.spec().inputs
Expand All @@ -308,6 +309,9 @@ def get_builder_from_protocol(
**kwargs,
)

if "restart_type" in base_inputs:
epw_builder.restart_type = serialize_restart_type(restart_type)

if epw_namespace == "epw_interp" and scon_epw_code is not None:
epw_builder.code = scon_epw_code
else:
Expand Down Expand Up @@ -402,7 +406,8 @@ def run_conv(self):
inputs.kfpoints_factor = self.inputs.epw_interp.kfpoints_factor
inputs.qfpoints_distance = self.ctx.interpolation_list.pop()

inputs.restart_type = serialize_restart_type("ephwrite")
if "restart_type" not in inputs:
inputs.restart_type = serialize_restart_type("ephwrite")

if self.ctx.degaussq:
parameters = inputs.parameters.get_dict()
Expand Down Expand Up @@ -469,7 +474,8 @@ def run_final_epw_iso(self):
inputs.kfpoints = parent_folder_epw.creator.inputs.kfpoints
inputs.qfpoints = parent_folder_epw.creator.inputs.qfpoints

inputs.restart_type = serialize_restart_type("ephread")
if "restart_type" not in inputs:
inputs.restart_type = serialize_restart_type("from_eph")

if self.ctx.degaussq:
parameters = inputs.parameters.get_dict()
Expand Down Expand Up @@ -507,7 +513,8 @@ def run_final_epw_aniso(self):
inputs.kfpoints = parent_folder_epw.creator.inputs.kfpoints
inputs.qfpoints = parent_folder_epw.creator.inputs.qfpoints

inputs.restart_type = serialize_restart_type("ephread")
if "restart_type" not in inputs:
inputs.restart_type = serialize_restart_type("from_eph")

inputs.metadata.call_link_label = "epw_final_aniso"
workchain_node = self.submit(EpwBaseWorkChain, **inputs)
Expand Down
Loading
Loading