Skip to content

Commit

Permalink
Forgot to commit the nbr_list checking line in the generalized MC mov…
Browse files Browse the repository at this point in the history
…e in the MC PR. Addressed comments from marcus.
  • Loading branch information
chrisiacovella committed Dec 28, 2023
1 parent ee15dbb commit 20f8c9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chiron/mcmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ def apply(
log.debug(f"Initial positions are {initial_positions} nm.")
# Propose perturbed positions. Modifying the reference changes the sampler state.
proposed_positions = self._propose_positions(initial_positions)

log.debug(f"Proposed positions are {proposed_positions} nm.")
# Compute the energy of the proposed positions.
if atom_subset is None:
Expand All @@ -420,6 +421,10 @@ def apply(
sampler_state.x0 = sampler_state.x0.at[jnp.array(atom_subset)].set(
proposed_positions
)
if nbr_list is not None:
if nbr_list.check(sampler_state.x0):
nbr_list.build(sampler_state.x0, sampler_state.box_vectors)

proposed_energy = thermodynamic_state.get_reduced_potential(
sampler_state, nbr_list
) # NOTE: in kT
Expand Down
4 changes: 4 additions & 0 deletions chiron/neighbors.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def __init__(
)

self.box_vectors = box_vectors
else:
raise TypeError(
f"box_vectors must be a jnp.array or unit.Quantity, not {type(box_vectors)}"
)

@property
def box_vectors(self) -> jnp.array:
Expand Down

0 comments on commit 20f8c9a

Please sign in to comment.