Skip to content
Merged
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ __marimo__/

# MyST documentation build
docs/_build

dev/
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ dependencies = [
Source = "https://github.com/aiidaplugins/aiida-epw"

[project.entry-points.'aiida.calculations']
'quantumespresso.epw' = 'aiida_quantumespresso.calculations.epw:EpwCalculation'
'epw.epw' = 'aiida_epw.calculations.epw:EpwCalculation'

[project.entry-points.'aiida.parsers']
'quantumespresso.epw' = 'aiida_quantumespresso.parsers.epw:EpwParser'
'epw.epw' = 'aiida_epw.parsers.epw:EpwParser'

[project.entry-points.'aiida.workflows']
'epw.base' = 'aiida_epw.workflows.base:EpwBaseWorkChain'
'epw.epw_prep' = 'aiida_epw.workflows.prep:EpwPrepWorkChain'
'epw.supercon' = 'aiida_epw.workflows.supercon:SuperConWorkChain'

[tool.hatch.version]
path = "src/aiida_epw/__about__.py"
Expand Down
2 changes: 2 additions & 0 deletions src/aiida_epw/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
"""AiiDA plugin package for interfacing with the Electron Phonon Wannier (EPW) code."""

__version__ = '0.1.0'
50 changes: 49 additions & 1 deletion src/aiida_epw/calculations/epw.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,22 @@ def define(cls, spec):
spec.input('settings', valid_type=orm.Dict, required=False, help='')
spec.input('parent_folder_nscf', required=False, valid_type=orm.RemoteData,
help='the folder of a completed nscf `PwCalculation`')
spec.input('parent_folder_chk', required=False, valid_type=orm.RemoteData,
help='the folder of a completed wannier90 `Wannier90Calculation`')
spec.input('parent_folder_ph', required=False, valid_type=orm.RemoteData,
help='the folder of a completed `PhCalculation`')
spec.input('parent_folder_epw', required=False, valid_type=(orm.RemoteData, orm.RemoteStashFolderData),
help='folder that contains all files required to restart an `EpwCalculation`')
spec.inputs['metadata']['options']['parser_name'].default = 'quantumespresso.epw'
spec.input(
'w90_chk_to_ukk_script',
valid_type=orm.RemoteData,
required=False,
help=(
"The script to convert the chk file to a ukk file"
)
)

spec.inputs['metadata']['options']['parser_name'].default = 'epw.epw'

spec.output('output_parameters', valid_type=orm.Dict,
help='The `output_parameters` output node of the successful calculation.')
Expand Down Expand Up @@ -131,6 +142,28 @@ def test_offset(offset):
Path(parent_folder_nscf.get_remote_path(), PwCalculation._OUTPUT_SUBFOLDER).as_posix(),
self._OUTPUT_SUBFOLDER,
))

# If parent_folder_chk is provided, we need to copy the .chk, .bvec, and .mmn files to the epw folder.
# We can do symlink for .chk and .bvec. .mmn file is already a symlink as defined in wannier workflow.
# Note that we do some modification to the .mmn file in site so here we rename it to avoid overwriting.
if 'parent_folder_chk' in self.inputs:
parent_folder_chk = self.inputs.parent_folder_chk

for suffix in ['chk', 'bvec']:
remote_list.append(
(
parent_folder_chk.computer.uuid,
Path(parent_folder_chk.get_remote_path(), self._PREFIX + '.' + suffix).as_posix(),
self._PREFIX + '.' + suffix
)
)
remote_list.append(
(
parent_folder_chk.computer.uuid,
Path(parent_folder_chk.get_remote_path(), self._PREFIX + '.mmn').as_posix(),
self._PREFIX + '.wannier90.mmn'
)
)

if 'parent_folder_ph' in self.inputs:
parent_folder_ph = self.inputs.parent_folder_ph
Expand Down Expand Up @@ -207,6 +240,21 @@ def test_offset(offset):
remote_list.append(
(parent_folder_epw.computer.uuid, Path(epw_path, filename).as_posix(), Path(filename).as_posix())
)
# check if wannierize is True and if parent_folder_epw or parent_folder_chk is provided
wannierize = parameters['INPUTEPW'].get('wannierize', False)

if wannierize and any(
_ in self.inputs
for _ in ["parent_folder_epw", "parent_folder_chk"]
):
self.report("Should not have a parent folder of epw or chk if wannierize is True")
return self.exit_codes.ERROR_PARAMETERS_NOT_VALID

# check if nstemp is too large
nstemp = parameters['INPUTEPW'].get('nstemp', None)
if nstemp and nstemp > self._MAX_NSTEMP:
self.report(f'nstemp too large, reset it to maximum allowed: {self._MAX_NSTEMP}')
parameters['INPUTEPW']['nstemp'] = self._MAX_NSTEMP

parameters['INPUTEPW']['outdir'] = self._OUTPUT_SUBFOLDER
parameters['INPUTEPW']['dvscf_dir'] = self._FOLDER_SAVE
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion src/aiida_epw/parsers/epw.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from aiida import orm
import numpy

from aiida_quantumespresso.calculations.epw import EpwCalculation
from aiida_epw.calculations.epw import EpwCalculation
from aiida_quantumespresso.parsers.base import BaseParser
from aiida_quantumespresso.utils.mapping import get_logging_container

Expand Down
4 changes: 4 additions & 0 deletions src/aiida_epw/tools/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ def calculate_lambda_omega(frequency: ArrayLike, spectrum: ArrayLike) -> tuple:
omega_log = omega_log * meV_to_Kelvin

return lambda_, omega_log

# This function is taken from https://www.sciencedirect.com/science/article/pii/S0010465516302260 eq.81
def bcs_gap_function(T, Tc, p, Delta_0):
return Delta_0 * numpy.sqrt(1 - (T/Tc)**p)
23 changes: 23 additions & 0 deletions src/aiida_epw/tools/kpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
def check_kpoints_qpoints_compatibility(
kpoints,
qpoints,
) -> tuple[bool, str ]:
"""Check if the kpoints and qpoints are compatible."""

kpoints_mesh, kpoints_shift = kpoints.get_kpoints_mesh()
qpoints_mesh, qpoints_shift = qpoints.get_kpoints_mesh()

multiplicities = []
remainder = []

for k, q in zip(kpoints_mesh, qpoints_mesh):
multiplicities.append(k // q)
remainder.append(k % q)

if kpoints_shift != [0.0, 0.0, 0.0] or qpoints_shift != [0.0, 0.0, 0.0]:
return (False, "Shift grid is not supported.")
else:
if remainder == [0, 0, 0]:
return (True, f"The kpoints and qpoints are compatible with multiplicities {multiplicities}.")
else:
return (False, "The kpoints and qpoints are not compatible.")
10 changes: 10 additions & 0 deletions src/aiida_epw/workflows/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
"""Workflows for the EPW code."""
from .base import EpwBaseWorkChain
from .prep import EpwPrepWorkChain
from .supercon import SuperConWorkChain

__all__ = [
'EpwBaseWorkChain',
'EpwPrepWorkChain',
'SuperConWorkChain',
]
Loading