Skip to content

Commit

Permalink
Bugfix: Sampling efficiency in Widom insertion sample script (#4388)
Browse files Browse the repository at this point in the history
As pointed out by @jonaslandsgesell, sampling only one particle insertion per MD step is terribly inefficient. Here I restore the inner loop in `samples/widom_insertion.py` to sample various particle insertion energies every time the MD integration is stopped.
  • Loading branch information
kodiakhq[bot] authored Nov 9, 2021
2 parents 731d76c + 181a9f5 commit b801493
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions samples/widom_insertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,12 @@
particle_insertion_potential_energy_samples = []

n_iterations = 500
n_samples_per_iteration = 100

for i in range(n_iterations):
particle_insertion_potential_energy_samples.append(
widom.calculate_particle_insertion_potential_energy(0))
for _ in range(n_samples_per_iteration):
particle_insertion_potential_energy_samples.append(
widom.calculate_particle_insertion_potential_energy(0))
system.integrator.run(steps=500)

if i % 20 == 0:
Expand Down

0 comments on commit b801493

Please sign in to comment.