MPI Parallel Tempering

class mcpele.parallel_tempering.MPI_PT_RLhandshake(mcrunner, Tmax, Tmin, max_ptiter=10, pfreq=1, skip=0, print_status=True, base_directory=None, verbose=False, suppress_histogram=True)[source][source]

Bases: mcpele.parallel_tempering._base_mpi_ptmc._MPI_Parallel_Tempering

Perform Parallel Tempering by a right-left handshake

This class performs parallel tempering alternating swaps with right and left neighbours with geometrically distributed temperatures.

Parameters:

mcrunner : _BaseMCrunner

object of _BaseMCrunner that performs the MCMC walks

Tmax : double

maximum temperature to simulate (or equivalent control parameters)

Tmin : double

minimum temperature to simulate (or equivalent control parameters)

max_ptiter : int

maximum number of Parallel Tempering iterations

pfreq : int

frequency with which histogram and other information is dumped to a file

skip : int

number of parallel tempering iteration for which swaps should not be performed. Swaps should be avoided for instance while adjusting the step size

print_status : bool

choose whether to print MCrunner status at each iteration

base_directory : string

path to base directory where to save output

verbose : bool

print verbose output to terminal

suppress_histogram : bool

suppress histogram output

Attributes

exchange_dic (dictionary) assign -1 to left and 1 to right
exchange_choice (int) current swap choice (alternating) initialised randomlly to be 1 or -1
anyswap (bool) set to True is any of the attempted swaps have been succesfull
permutation_pattern (numpy.array) record pattern of exchanges, used to print the exchange permutations
suppress_histgoram (bool) suppress the output of the histogram
one_iteration()[source]

Perform one parallel tempering iteration

Each PT iteration consists of the following steps:

  • set the coordinates
  • run the MCrunner for a predefined number of steps
  • collect the results (energy and new coordinates)
  • attempt an exchange
run()[source]

Run multiple single iterations, plus initialisation if MPI_PT has not been initialised yet