Skip to content

Implement Parallel Tempering #302

@thomasloux

Description

@thomasloux

Parallel Tempering is a way to improve the coverage of a distribution, by preventing a system to be trapped in a local minimum. The idea is that it's easier to pass an energy barrier with more energy, in this case provided by a higher temperature.

So, a number N of simulations are run in parallel at temperatures T_1, ..., T_N. Every n_step, a proposal to exchange two adjacent systems with temperatures T_i, T_{i+1} is tested using Metropolis Hasting. In case of success, the systems are exchange, so that the in practice the temperatures are changed and velocities are scaled.

Doing so, all chains for a given temperature follow its Boltzmann distribution for the intended temperature.

The implementation in TorchSim would be fairly easy in the first approach.

  1. Choose a system to analyse
  2. Create a function that duplicate into N systems
  3. Choose the temperatures to consider (often logarithmic)
  4. Every n_step test the exchange of adjacent systems. In case of success, of course don't change the index of systems but only the temperatures. Integrators are already able to accept different temperatures for a batched system.
  5. Update velocities in case of success
  6. (Most important step) save efficiently the trajectories so that it's easy to access the trajectories for all temperatures or a chosen temperature (most of the time the lowest temperature).Note:
  • this approach works both for NVT or NPT simulations.
  • I suspect NVT Nosé Hoover may not work properly. Or at least maybe the thermostat (extended variable) need to be rescaled or reset. But I don't have proof for that.
  • Actually the swap does not need to be between adjacent, it's often an approximation as the probability of swapping is exponentially low.

References:

  • GROMACS: https://manual.gromacs.org/documentation/2024.0/reference-manual/algorithms/replica-exchange.html
  • K. Hukushima and K. Nemoto, “Exchange Monte Carlo Method and Application to Spin Glass Simulations,” J. Phys. Soc. Jpn., 65 1604–1608 (1996). -> Apply for Monte Carlo simulations, no thermostat
  • Y. Sugita and Y. Okamoto, “Replica-exchange molecular dynamics method for protein folding,” Chem. Phys. Lett., 314 141–151 (1999). -> MD simulation but thermostat only relevant for perfect gaz, as far as I understood.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureEntirely new features, not improvements to existing onesphysicist-friendlyContributors would benefit from having technical physics background

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions