Skip to content

Commit

Permalink
Faster IDPP (#302)
Browse files Browse the repository at this point in the history
* no parallelisation on idpp
  • Loading branch information
shoubhikraj authored Oct 29, 2023
1 parent eab64b4 commit dafe17f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions autode/neb/original.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,20 @@ def total_energy(flat_coords, images, method, n_cores, plot_energies):
f"{n_cores} total cores and {n_cores_pp} per process"
)

# Run an energy + gradient evaluation in parallel across all images
with ProcessPool(max_workers=n_cores) as pool:
results = [
pool.submit(energy_gradient, images[i], method, n_cores_pp)
# Run an energy + gradient evaluation across all images (parallel for EST)
if isinstance(method, IDPP):
images[1:-1] = [
energy_gradient(images[i], method, n_cores_pp)
for i in range(1, len(images) - 1)
]

images[1:-1] = [res.result() for res in results]
else:
with ProcessPool(max_workers=n_cores) as pool:
results = [
pool.submit(energy_gradient, images[i], method, n_cores_pp)
for i in range(1, len(images) - 1)
]

images[1:-1] = [res.result() for res in results]

images.increment()

Expand Down

0 comments on commit dafe17f

Please sign in to comment.