metropolis_criterion

torch_sim.monte_carlo.metropolis_criterion(energy_new, energy_old, kT, generator=None)[source]

Apply the Metropolis acceptance criterion for Monte Carlo moves.

Determines whether proposed moves should be accepted or rejected based on the energy difference and system temperature, following the Boltzmann distribution.

Parameters:
  • energy_new (Tensor) – New energy after proposed move of shape [batch_size]

  • energy_old (Tensor) – Old energy before proposed move of shape [batch_size]

  • kT (float) – Temperature of the system in energy units

  • generator (Generator | None, optional) – Random number generator for reproducibility. Defaults to None.

Returns:

Boolean tensor of shape [batch_size] indicating acceptance (True)

or rejection (False) for each move

Return type:

Tensor

Notes

The acceptance probability follows min(1, exp(-ΔE/kT)) according to the standard Metropolis algorithm.