A framework for replica exchange simulations