Skip to content

Commit

Permalink
Adjust num_energy_neighbours to account for TI windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
lohedges committed Feb 7, 2025
1 parent df9bc7b commit b44102c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/somd2/runner/_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,14 @@ def generate_lam_vals(lambda_base, increment=0.001):
# Create the dynamics object.
dynamics = system.dynamics(**dynamics_kwargs)

# Set the number of neighbours used for the energy calculation.
# If not None, then we add one to account for the extra windows
# used for finite-difference gradient analysis.
if self._config.num_energy_neighbours is not None:
num_energy_neighbours = self._config.num_energy_neighbours + 1
else:
num_energy_neighbours = None

# Run the simulation, checkpointing in blocks.
if self._config.checkpoint_frequency.value() > 0.0:

Expand Down Expand Up @@ -515,7 +523,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
rest2_scale_factors=rest2_scale_factors,
save_velocities=self._config.save_velocities,
auto_fix_minimise=True,
num_energy_neighbours=self._config.num_energy_neighbours,
num_energy_neighbours=num_energy_neighbours,
null_energy=self._config.null_energy,
)
except Exception as e:
Expand Down Expand Up @@ -581,7 +589,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
rest2_scale_factors=rest2_scale_factors,
save_velocities=self._config.save_velocities,
auto_fix_minimise=True,
num_energy_neighbours=self._config.num_energy_neighbours,
num_energy_neighbours=num_energy_neighbours,
null_energy=self._config.null_energy,
)

Expand Down Expand Up @@ -632,7 +640,7 @@ def generate_lam_vals(lambda_base, increment=0.001):
rest2_scale_factors=rest2_scale_factors,
save_velocities=self._config.save_velocities,
auto_fix_minimise=True,
num_energy_neighbours=self._config.num_energy_neighbours,
num_energy_neighbours=num_energy_neighbours,
null_energy=self._config.null_energy,
)
except Exception as e:
Expand Down

0 comments on commit b44102c

Please sign in to comment.