Skip to content

Commit

Permalink
use enumerate in NEBCalc.calc() and document return value unit
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Dec 11, 2023
1 parent c1b724e commit e3375e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions matcalc/neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def from_end_images(
)
return cls(images=images, calculator=calculator, **kwargs)

def calc(
def calc( # type: ignore[override]
self,
fmax: float = 0.1,
max_steps: int = 1000,
):
) -> float:
"""
Perform NEB calculation.
Expand All @@ -123,13 +123,13 @@ def calc(
max_steps (int): Maximum number of steps in NEB calculations. Default to 1000.
Returns:
NEB barrier.
float: The energy barrier in eV.
"""
if self.traj_folder is not None:
os.makedirs(self.traj_folder, exist_ok=True)
for i in range(len(self.images)):
for idx, img in enumerate(self.images):
self.optimizer.attach(
Trajectory(f"{self.traj_folder}/image_{i}.traj", "w", self.images[i]),
Trajectory(f"{self.traj_folder}/image_{idx}.traj", "w", img),
interval=self.interval,
)
self.optimizer.run(fmax=fmax, steps=max_steps)
Expand Down

0 comments on commit e3375e4

Please sign in to comment.