Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update neighboring #11

Merged
merged 6 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Examples/LJ_langevin.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@
nbr_list = NeighborListNsqrd(
OrthogonalPeriodicSpace(), cutoff=cutoff, skin=skin, n_max_neighbors=180
)
from chiron.neighbors import PairList


# build the neighbor list from the sampler state
nbr_list.build_from_state(sampler_state)
Expand Down
25 changes: 22 additions & 3 deletions chiron/integrators.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@


class LangevinIntegrator:
"""
Langevin dynamics integrator for molecular dynamics simulation using the BAOAB splitting scheme [1].

References:
[1] Benedict Leimkuhler, Charles Matthews;
Robust and efficient configurational molecular sampling via Langevin dynamics.
J. Chem. Phys. 7 May 2013; 138 (17): 174102. https://doi.org/10.1063/1.4802990


"""

def __init__(
self,
stepsize=1.0 * unit.femtoseconds,
Expand All @@ -25,21 +36,28 @@ def __init__(
Parameters
----------
stepsize : unit.Quantity, optional
Time step size for the integration.
Time step of integration with units of time. Default is 1.0 * unit.femtoseconds.
collision_rate : unit.Quantity, optional
Collision rate for the Langevin dynamics.
Collision rate for the Langevin dynamics, with units 1/time. Default is 1.0 / unit.picoseconds.
save_frequency : int, optional
Frequency of saving the simulation data. Default is 100.
reporter : SimulationReporter, optional
Reporter object for saving the simulation data. Default is None.
"""

self.kB = unit.BOLTZMANN_CONSTANT_kB * unit.AVOGADRO_CONSTANT_NA
log.info(f"stepsize = {stepsize}")
log.info(f"collision_rate = {collision_rate}")
log.info(f"save_frequency = {save_frequency}")

self.stepsize = stepsize
self.collision_rate = collision_rate
if reporter is not None:
log.info(f"Using reporter {reporter} saving to {reporter.filename}")
self.reporter = reporter
self.save_frequency = save_frequency

self.velocities = None
def set_velocities(self, vel: unit.Quantity) -> None:
"""
Set the initial velocities for the Langevin Integrator.
Expand Down Expand Up @@ -73,6 +91,8 @@ def run(
Number of simulation steps to perform.
key : jax.random.PRNGKey, optional
Random key for generating random numbers.
nbr_list : NeighborListNsqrd, optional
Neighbor list for the system.
progress_bar : bool, optional
Flag indicating whether to display a progress bar during integration.

Expand All @@ -85,7 +105,6 @@ def run(

self.box_vectors = sampler_state.box_vectors
self.progress_bar = progress_bar
self.velocities = None
temperature = thermodynamic_state.temperature
x0 = sampler_state.x0

Expand Down
Loading
Loading