meld.helpers.setup_replica_exchange(system, n_replicas, n_steps, n_trials=None, adaptation_growth_factor=2.0, adaptation_burn_in=50, adaptation_adapt_every=50, adaptation_stop_after=None, adaptation_min_acc_prob=0.02, mpi_timeout=60000)[source]

Setup replica exchange

  • system (ISystem) – The system to be simulated

  • n_replicas (int) – The number of replicas to be simulated

  • n_steps (int) – The number of steps of replica exchange to run

  • n_trials (Optional[int]) – The number of trials to run per exchange

  • adaptation_growth_factor (float) – The growth factor for adaptation

  • adaptation_burn_in (int) – The number of steps to ignore after adapting

  • adaptation_adapt_every (int) – The number of steps to run between adaptation

  • adaptation_stop_after (Optional[int]) – The number of steps to run before stopping adaptation

  • adaptation_min_acc_prob (float) – The minimum acceptance probability when adapting

  • mpi_timeout (int) – The number of seconds to wait for MPI communication to complete

Return type



Replica exchange adaptation works as follows. First adaptation_burn_in steps are run and no statistics about exchange are collected. Then adaptation_adapt_every steps are run and the average acceptance rate is calculated. Any acceptance rates below adaptation_min_acc_prob are clamped at the minimum. Then adaptation is performed to equalize the acceptance rates. After each adaptation, the values of adaptation_burn_in and adaptation_adapt_every are multiplied by adaptation_growth_factor.


If n_trials is None, then the number of trials is n_replicas**2.