Skip to content

Commit

Permalink
Bugfixes to get CrI3 example working
Browse files Browse the repository at this point in the history
  • Loading branch information
elinscott committed Oct 8, 2024
1 parent dbc4fb8 commit 7891797
Show file tree
Hide file tree
Showing 90 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/koopmans/calculators/_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def fromfile(cls, filenames: Union[str, Path, List[str], List[Path]]):

# Read qe output file
for filename in [f for f in sanitized_filenames if f.suffix == cls.ext_out]:
calc.directory = filename.parent
calc.prefix = filename.stem
try:
calc.read_results()
Expand Down
19 changes: 16 additions & 3 deletions src/koopmans/processes/ui/_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,17 +491,30 @@ def correct_phase(self) -> NDArray[np.complex128]:
return phase


def generate_dos(band_structure: BandStructure, plotting_parameters: PlotSettingsDict) -> DOS:
def generate_dos(band_structure: BandStructure, plotting_parameters: PlotSettingsDict, spin_polarized=False) -> DOS:
"""
Generate the density of states using the DOS function from ASE
"""

if spin_polarized:
nspins = 2
if band_structure.energies.shape[0] != 2:
raise ValueError(
'Requested to generate a spin-polarized DOS but the provided band structure only has 1 spin channel')
e_skn = band_structure.energies.copy()
else:
nspins = 1
if band_structure.energies.shape[0] == 1:
e_skn = band_structure.energies.copy()
else:
e_skn = np.array([band_structure.energies[0, :]])

dos = DOS(None,
width=plotting_parameters.degauss,
window=(plotting_parameters.Emin, plotting_parameters.Emax),
npts=plotting_parameters.nstep + 1,
w_k=np.ones(len(band_structure.path.kpts)),
nspins=1,
e_skn=np.array([band_structure.energies[0, :]]))
nspins=nspins,
e_skn=e_skn)

return dos
4 changes: 1 addition & 3 deletions src/koopmans/workflows/_folding.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ def _run(self):
# Create the calculator
calc_w2k = self.new_calculator('wann2kcp', spin_component=block.spin, wan_mode='wannier2kcp')
calc_w2k.prefix = f'convert_{block.name}_to_supercell'
if block.spin:
calc_w2k.prefix += f'_spin{block.spin}'

# Checking that gamma_trick is consistent with gamma_only
if calc_w2k.parameters.gamma_trick and not self.kpoints.gamma_only:
Expand Down Expand Up @@ -114,7 +112,7 @@ def _run(self):
merge_proc.name = 'merging_wavefunctions_for_' + tidy_label
self.run_process(merge_proc)

dest_file = _construct_dest_filename(evc_fname, subset, label)
dest_file = _construct_dest_filename(evc_fname, subset[0], label)
merged_files[dest_file] = merge_proc.outputs.merged_file

else:
Expand Down
7 changes: 4 additions & 3 deletions src/koopmans/workflows/_unfold_and_interp.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ def _run(self) -> None:
dft_smooth_ham_file = None

process = self.new_ui_process(presets, centers=centers[mask], spreads=spreads[mask].tolist(),
dft_smooth_ham_file=dft_smooth_ham_file)
dft_smooth_ham_file=dft_smooth_ham_file,
dft_ham_file=self._dft_ham_files[(filling, spin)])

# Run the process
self.run_process(process)
Expand All @@ -124,16 +125,16 @@ def _run(self) -> None:
if self.parameters.spin_polarized:
energies = [[p.outputs.band_structure.energies for p in subset]
for subset in [self.processes[-4:-2], self.processes[-2:]]]
reference = np.max([e[0] for e in energies])
energies_np = np.concatenate([np.concatenate(e, axis=2) for e in energies], axis=0)
reference = np.max([np.max(e[0]) for e in energies])
else:
energies = [p.outputs.band_structure.energies for p in self.processes[-2:]]
reference = np.max(energies[0])
energies_np = np.concatenate(energies, axis=2)
merged_bs = BandStructure(self.kpoints.path, energies_np, reference=reference)

if process.inputs.parameters.do_dos:
merged_dos = generate_dos(merged_bs, self.plotting)
merged_dos = generate_dos(merged_bs, self.plotting, self.parameters.spin_polarized)

# Plot the band structure and DOS
if process.inputs.parameters.do_dos:
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.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_up_block_1_to_supercell_spinup.wko", "evcw.dat"]}
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_up_block_1_to_supercell.wko", "evcw.dat"]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_up_block_2_to_supercell_spinup.wko", "evcw.dat"]}
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_up_block_2_to_supercell.wko", "evcw.dat"]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_down_block_1_to_supercell_spindown.wko", "evcw.dat"]}
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_down_block_1_to_supercell.wko", "evcw.dat"]}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_down_block_2_to_supercell_spindown.wko", "evcw.dat"]}
{"input_files": ["TMP/kc.save/Si.upf", "TMP/kc.save/charge-density.dat", "TMP/kc.save/data-file-schema.xml", "TMP/kc.save/wfcdw1.dat", "TMP/kc.save/wfcdw2.dat", "TMP/kc.save/wfcdw3.dat", "TMP/kc.save/wfcdw4.dat", "TMP/kc.save/wfcdw5.dat", "TMP/kc.save/wfcdw6.dat", "TMP/kc.save/wfcdw7.dat", "TMP/kc.save/wfcdw8.dat", "TMP/kc.save/wfcup1.dat", "TMP/kc.save/wfcup2.dat", "TMP/kc.save/wfcup3.dat", "TMP/kc.save/wfcup4.dat", "TMP/kc.save/wfcup5.dat", "TMP/kc.save/wfcup6.dat", "TMP/kc.save/wfcup7.dat", "TMP/kc.save/wfcup8.dat", "TMP/kc.xml", "wann.chk", "wann.nnkp", "wannier90_hr.dat"], "output_files": ["convert_spin_down_block_2_to_supercell.wko", "evcw.dat"]}
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.

This file was deleted.

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.

0 comments on commit 7891797

Please sign in to comment.