Skip to content

Commit

Permalink
Fix typoes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmatteo committed May 25, 2024
1 parent 1f2abbd commit f824ba9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions abipy/ml/extxyz_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def check_vasp_success(vasprun, outcar, verbose: int = 0) -> bool:
Returns:
bool: True if the calculation completed successfully, False otherwise.
"""
def my_print(*args, **kwargs)
def my_print(*args, **kwargs):
if verbose: print(*args, **kwargs)

from pymatgen.io.vasp.outputs import Vasprun, Outcar
Expand Down Expand Up @@ -192,10 +192,10 @@ def __init__(self, traj_path: PathLike, topdir: PathLike, traj_range: range,
self.traj_path = traj_path
self.topdir = Path(str(topdir)).absolute()
self.traj_range = traj_range
if not isinstance(traj_range):
if not isinstance(traj_range, range):
raise TypeError(f"Got type{traj_range} instead of range")
self.abinitio_code = abinitio_code
if not ps.path.exists(self.slurm_template):
if not os.path.exists(slurm_template):
s = qu.get_slurm_template()
open(slurm_template, "wt").write(s)
raise RuntimeError("")
Expand Down Expand Up @@ -225,7 +225,12 @@ def sbatch(self):
print("{workdir=} already exists. Ignoring it")
continue

atoms = read(self.traj_path, index=index)
try:
atoms = read(self.traj_path, index=index)
except StopIteration as exc:
print("ASE trajector does not have more that {index=} configurations. Exiting loop!")
break

structure = Structure.as_structure(atoms)
script_filepath = workdir / "run.sh"
workdir.mkdir()
Expand Down

0 comments on commit f824ba9

Please sign in to comment.