choderalab / chiron

Differentiable Markov Chain Monte Carlo
https://github.com/choderalab/chiron/wiki
MIT License
14 stars 1 forks source link

We might also consider whether we want the `MCMCSampler` to be irrevocably bound to a single system and thermodynamic state, or if we want to be able to apply the same simulation object to different initial conditions. #29

Open wiederm opened 6 months ago

wiederm commented 6 months ago
# Current approach: sampler is bound to a single system and state
sampler = MCMCSampler(move_set, sampler_state, thermodynamic_state)
# Now run a bunch of replicas
for replica_index in range(n_replicas):
  # Set initial conditions
  sampler.thermodynamic_state = thermodynamic_state[replica_index]
  sampler.sampler_state = sampler_state[replica_index]
  # Run
  sampler.run()
  # Get final conditions
  new_sampler_state[replica_index] = sampler.sampler_state
  new_thermodynamic_state[replica_index] = sampler.thermodynamic_state # may not be relevant if we're not updating these yet

Alternatively, MCMCSampler.run() could consume and return the sampler and thermodynamic states:

sampler = MCMCSampler(move_set, ...)
# Now run a bunch of replicas
for replica_index in range(n_replicas):
  sampler.sampler_state[replica_index], sampler.thermodynamic_state[replica_index] = sampler.run(sampler.sampler_state[replica_index], sampler.thermodynamic_state[replica_index])

_Originally posted by @jchodera in https://github.com/choderalab/chiron/pull/8#discussion_r1443876099_