File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1265,10 +1265,13 @@ def _run_block(
12651265 ),
12661266 )
12671267
1268- # Perform a GCMC move and write ghost water residue indices after
1269- # dynamics so that the ghost state is temporally consistent with
1270- # the saved frame.
12711268 if gcmc_sampler is not None :
1269+ # Write ghost residues before the GCMC move so the ghost state
1270+ # is consistent with the saved frame (which is also captured
1271+ # before the GCMC move).
1272+ if write_gcmc_ghosts :
1273+ gcmc_sampler .write_ghost_residues ()
1274+
12721275 if is_gcmc :
12731276 # Push the PyCUDA context on top of the stack.
12741277 gcmc_sampler .push ()
@@ -1280,9 +1283,6 @@ def _run_block(
12801283 # Remove the PyCUDA context from the stack.
12811284 gcmc_sampler .pop ()
12821285
1283- if write_gcmc_ghosts :
1284- gcmc_sampler .write_ghost_residues ()
1285-
12861286 # Save the GCMC state.
12871287 self ._dynamics_cache .save_gcmc_state (index )
12881288
Original file line number Diff line number Diff line change @@ -714,21 +714,22 @@ def generate_lam_vals(lambda_base, increment=0.001):
714714 ),
715715 )
716716
717- # Perform a GCMC move.
718- _logger .info (
719- f"Performing GCMC move at { _lam_sym } = { lambda_value :.5f} "
720- )
721- gcmc_sampler .move (dynamics .context ())
722-
723717 # Update the runtime.
724718 runtime += self ._config .energy_frequency
725719
726- # If a frame is saved, then we need to save current indices
727- # of the ghost water residues.
720+ # If a frame is saved, write the ghost residue indices
721+ # before the GCMC move so the ghost state is consistent
722+ # with the saved frame.
728723 if save_frames and runtime >= next_frame :
729724 gcmc_sampler .write_ghost_residues ()
730725 next_frame += self ._config .frame_frequency
731726
727+ # Perform a GCMC move.
728+ _logger .info (
729+ f"Performing GCMC move at { _lam_sym } = { lambda_value :.5f} "
730+ )
731+ gcmc_sampler .move (dynamics .context ())
732+
732733 else :
733734 dynamics .run (
734735 checkpoint_frequency ,
You can’t perform that action at this time.
0 commit comments