Skip to content

Commit

Permalink
Fix output_dir bug in parallel scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Feb 18, 2024
1 parent a809dd0 commit 2206440
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 2 additions & 3 deletions examples/coulomb_blockade/pentacene/hybr.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ def hybridize_orbitals(
) -> None:
"""docstring"""

if comm.rank == 0:
output_dir = Path("results")
output_dir.mkdir(exist_ok=True)
output_dir = Path("results")
output_dir.mkdir(exist_ok=True)

gf = greenfunction.GreenFunction(
hs_list_ii,
Expand Down
14 changes: 5 additions & 9 deletions examples/coulomb_blockade/pentacene/trans.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ def compute_transmission(
) -> None:
"""docstring"""

if comm.rank == 0:
output_dir = Path("results")
output_dir.mkdir(exist_ok=True)
output_dir = Path("results")
output_dir.mkdir(exist_ok=True)

transmission_dir = output_dir / TRANSMISSION_DIRNAME
transmission_dir.mkdir(exist_ok=True)
transmission_dir = output_dir / TRANSMISSION_DIRNAME
transmission_dir.mkdir(exist_ok=True)

gf = greenfunction.GreenFunction(
hs_list_ii,
Expand All @@ -57,9 +56,6 @@ class DataSelfEnergy(BaseDataSelfEnergy):
def retarded(self, energy):
return expand(s1, super().retarded(energy), i1)

def load(filename):
return DataSelfEnergy(energies, np.load(filename))

def run(filepath: Path):
gd = GridDesc(energies, 1, float)
T = np.empty(gd.energies.size)
Expand All @@ -73,7 +69,7 @@ def run(filepath: Path):
np.save(transmission_dir / filepath, T.real)

for filename in Path(sigma_folder_path).glob("dmu_*"):
dmft_self_energy = load(filename)
dmft_self_energy = DataSelfEnergy(energies, np.load(filename))
gf.selfenergies.append((1, dmft_self_energy))
run(filename)
gf.selfenergies.pop()
Expand Down

0 comments on commit 2206440

Please sign in to comment.