Skip to content

Commit

Permalink
Added patching of MergeEVCProcess; updated tutorial 6 benchmarks; res…
Browse files Browse the repository at this point in the history
…et pseudopotentials to be a dict
  • Loading branch information
elinscott committed Oct 11, 2024
1 parent f19daee commit 56d88c0
Show file tree
Hide file tree
Showing 64 changed files with 7 additions and 18 deletions.
19 changes: 3 additions & 16 deletions src/koopmans/workflows/_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Workflow(utils.HasDirectory, ABC):
calculator_parameters: Dict[str, settings.SettingsDict]
name: str
kpoints: Kpoints
_pseudopotentials: Dict[str, str]
pseudopotentials: Dict[str, str]
pseudo_dir: Path
projections: ProjectionBlocks
ml_model: Optional[AbstractMLModel]
Expand All @@ -111,7 +111,7 @@ class Workflow(utils.HasDirectory, ABC):
_step_counter: int

__slots__ = utils.HasDirectory.__slots__ + ['atoms', 'parameters', 'calculator_parameters', 'name', 'kpoints',
'_pseudopotentials', 'projections', 'ml_model', 'snapshots',
'pseudopotentials', 'projections', 'ml_model', 'snapshots',
'version', '_step_counter', 'calculations', 'processes',
'steps', 'silent', 'print_indent', 'plotting', 'ml', '_bands']

Expand Down Expand Up @@ -465,18 +465,6 @@ def _run(self) -> None:
def output_model(self) -> Type[outputs.OutputModel]:
...

@property
def pseudopotentials(self) -> OrderedDict[str, str]:
# Always return the pseudopotentials in alphabetical order
out = OrderedDict()
for k in sorted(self._pseudopotentials):
out[k] = self._pseudopotentials[k]
return out

@pseudopotentials.setter
def pseudopotentials(self, value: Dict[str, str]):
self._pseudopotentials = value

def get_step_by_uuid(self, uuid: str):
for step in self.steps:
if step.uuid == uuid:
Expand Down Expand Up @@ -1185,7 +1173,7 @@ def fromdict(cls, dct: Dict[str, Any], **kwargs) -> Workflow:
wf = cls(atoms=dct.pop('atoms'),
parameters=dct.pop('parameters'),
calculator_parameters=dct.pop('calculator_parameters'),
pseudopotentials=dct.pop('_pseudopotentials'),
pseudopotentials=dct.pop('pseudopotentials'),
kpoints=dct.pop('kpoints'),
projections=dct.pop('projections'),
autogenerate_settings=False,
Expand Down Expand Up @@ -1219,7 +1207,6 @@ def fromjson(cls, fname: str, override: Dict[str, Any] = {}, **kwargs):

@classmethod
def _fromjsondct(cls, bigdct: Dict[str, Any], override: Dict[str, Any] = {}, **kwargs):

# Override all keywords provided explicitly
utils.update_nested_dict(bigdct, override)

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/helpers/patches/_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from koopmans.processes.bin2xml import Bin2XMLProcess
from koopmans.processes.koopmans_cp import (ConvertFilesFromSpin1To2,
ConvertFilesFromSpin2To1)
from koopmans.processes.merge_evc import MergeEVCProcess
from koopmans.processes.power_spectrum import (
ComputePowerSpectrumProcess, ExtractCoefficientsFromXMLProcess)
from koopmans.processes.ui import UnfoldAndInterpolateProcess
Expand Down Expand Up @@ -111,5 +112,5 @@ def monkeypatch_bench(monkeypatch):
patch_calculator(c, monkeypatch)

for p in [Bin2XMLProcess, ComputePowerSpectrumProcess, ConvertFilesFromSpin1To2, ConvertFilesFromSpin2To1,
ExtractCoefficientsFromXMLProcess, UnfoldAndInterpolateProcess, ExtendProcess, MergeProcess]:
ExtractCoefficientsFromXMLProcess, UnfoldAndInterpolateProcess, ExtendProcess, MergeProcess, MergeEVCProcess]:
patch_process(p, monkeypatch)
3 changes: 2 additions & 1 deletion tests/helpers/patches/_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ def monkeypatch_mock(monkeypatch):
from koopmans.processes.bin2xml import Bin2XMLProcess
from koopmans.processes.koopmans_cp import (ConvertFilesFromSpin1To2,
ConvertFilesFromSpin2To1)
from koopmans.processes.merge_evc import MergeEVCProcess
from koopmans.processes.power_spectrum import (
ComputePowerSpectrumProcess, ExtractCoefficientsFromXMLProcess)
from koopmans.processes.ui import UnfoldAndInterpolateProcess
Expand All @@ -170,5 +171,5 @@ def monkeypatch_mock(monkeypatch):
# monkeypatch.setattr(c, 'generate_band_structure', mock_generate_band_structure)

# Processes
for p in [ExtractCoefficientsFromXMLProcess, ComputePowerSpectrumProcess, Bin2XMLProcess, ConvertFilesFromSpin1To2, ConvertFilesFromSpin2To1, ExtendProcess, MergeProcess, UnfoldAndInterpolateProcess]:
for p in [ExtractCoefficientsFromXMLProcess, ComputePowerSpectrumProcess, Bin2XMLProcess, ConvertFilesFromSpin1To2, ConvertFilesFromSpin2To1, ExtendProcess, MergeProcess, UnfoldAndInterpolateProcess, MergeEVCProcess]:
monkeypatch.setattr(p, '_run', mock_process_run)

0 comments on commit 56d88c0

Please sign in to comment.