Skip to content

Commit 8ec3b20

Browse files
committed
Proper handling of atom_proj_dir
1 parent 6c70284 commit 8ec3b20

8 files changed

Lines changed: 15 additions & 9 deletions

File tree

src/koopmans/calculators/_calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def fromfile(cls, filenames: Union[str, Path, List[str], List[Path]]):
385385
# Update calc.directory and calc.parameters.prefix
386386
assert hasattr(calc, 'parent_process')
387387
if calc.parent_process is None:
388-
base_directory = sanitized_filenames[0].parents[1]
388+
base_directory = sanitized_filenames[0].parents[-1]
389389
else:
390390
base_directory = calc.parent_process.base_directory
391391
calc.directory = Path(os.path.relpath(sanitized_filenames[0].parent, base_directory))

src/koopmans/engines/localhost.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,10 @@ def install_pseudopotential(self, file: Path, library: str) -> None:
182182
with open(config_file, 'r') as f:
183183
config = yaml.safe_load(f)
184184
except FileNotFoundError:
185-
config = {'installed_pseudopotentials': {}}
185+
config = {}
186+
187+
if 'installed_pseudopotentials' not in config:
188+
config['installed_pseudopotentials'] = {}
186189

187190
if library not in config['installed_pseudopotentials']:
188191
config['installed_pseudopotentials'][library] = set([str(file.resolve())])

src/koopmans/settings/_pw2wannier.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def __init__(self, **kwargs) -> None:
1010
'write_unk', 'reduce_unk', 'wan_mode', 'spin_component',
1111
'atom_proj', 'atom_proj_ext', 'atom_proj_dir'],
1212
defaults={'outdir': 'TMP', 'prefix': 'kc', 'seedname': 'wann',
13-
'wan_mode': 'standalone'},
13+
'wan_mode': 'standalone', 'write_mmn': True},
1414
are_paths=['outdir', 'atom_proj_dir'],
1515
**kwargs)
1616

src/koopmans/settings/_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __setitem__(self, key: str, value: Any):
130130
value = Path(value)
131131
elif not isinstance(value, Path):
132132
raise ValueError(f'`{key}` must be either a string or a Path')
133-
if value.is_absolute() and key not in ['pseudo_dir', 'pseudo_directory']:
133+
if value.is_absolute() and key not in ['pseudo_dir', 'pseudo_directory', 'atom_proj_dir']:
134134
raise ValueError(f'`{key}` must be a relative path')
135135

136136
# Parse any units provided

src/koopmans/settings/_wannier90.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def __init__(self, **kwargs) -> None:
2323
'write_u_matrices', 'write_xyz', 'wannier_plot', 'wannier_plot_list',
2424
'gamma_only', 'spin', 'use_ws_distance', 'translate_home_cell',
2525
'translation_centre_frac', 'write_tb', 'auto_projections', 'dis_proj_max',
26-
'dis_froz_proj', "dis_num_iter"],
26+
'dis_froz_proj', "dis_num_iter", "dis_proj_min"],
2727
defaults={'num_iter': 10000, 'conv_tol': 1.e-10, 'conv_window': 5,
2828
'write_hr': True, 'guiding_centres': True, 'gamma_only': False,
2929
'auto_projections': False},

src/koopmans/workflows/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
from ._singlepoint import SinglepointWorkflow
1414
from ._trajectory import TrajectoryWorkflow
1515
from ._unfold_and_interp import UnfoldAndInterpolateWorkflow
16-
from ._wannierize import WannierizeBlockWorkflow, WannierizeWorkflow
16+
from ._wannierize import (WannierizeAndSplitBlockWorkflow,
17+
WannierizeBlockWorkflow, WannierizeWorkflow)
1718
from ._workflow import Workflow

src/koopmans/workflows/_wannierize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ def _run(self) -> None:
611611

612612
self.amn_file = File(calc_p2w, calc_p2w.parameters.seedname + '.amn')
613613
self.eig_file = File(calc_p2w, calc_p2w.parameters.seedname + '.eig')
614-
self.mmn_file = File(calc_p2w, calc_p2w.parameters.seedname + '.mmn')
614+
if calc_p2w.parameters.write_mmn:
615+
self.mmn_file = File(calc_p2w, calc_p2w.parameters.seedname + '.mmn')
615616
self.nnkp_file = File(calc_p2w, calc_p2w.parameters.seedname + '.nnkp')
616617

617618
# Wannier90 calculation

src/koopmans/workflows/_workflow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ def __init__(self,
359359
else:
360360
spins = [Spin.NONE]
361361
if self.calculator_parameters['pw2wannier'].atom_proj_ext:
362-
if self.calculator_parameters['pw2wannier'].atom_proj_dir is None:
362+
proj_dir = self.calculator_parameters['pw2wannier'].atom_proj_dir
363+
if proj_dir is None:
363364
raise ValueError('`atom_proj_dir` must be specified when using `atom_proj_ext = True`')
364-
projectors = OrderedDict([(k, Path(p.filename.with_suffix('.dat').name))
365+
projectors = OrderedDict([(k, proj_dir / p.filename.with_suffix('.dat').name)
365366
for k, p in self.pseudopotentials.items()])
366367
num_wann = [nwfcs_from_projectors(self.atoms, projectors) for _ in spins]
367368
else:

0 commit comments

Comments
 (0)