rexfw.convenience package

Module contents

Convenient functions creating default objects to simplify standard tasks with this framework

rexfw.convenience.create_default_AMDRENS_params(schedule, n_steps, timesteps, collision_probability=0.1, update_interval=1)[source]
rexfw.convenience.create_default_HMCStepRENS_params(schedule, n_intermediate_steps, hmc_traj_length, n_hmc_iterations, timesteps)[source]
rexfw.convenience.create_default_LMDRENS_params(schedule, n_steps, timesteps, gamma)[source]
rexfw.convenience.create_default_RE_params(n_replicas)[source]

Creates default RE exchange parameters

Parameters:n_replicas (int) – the number of replicas
Returns:a list of parameter objects holding information required to perform swaps
Return type:list of ExchangeParams
rexfw.convenience.create_default_stats_elements(replica_names, variable_name)[source]

Creates default sampling statistics “elements”, each representing a tracked quantity such as acceptance rate, step size etc.

Parameters:replica_names (list) – a list of all replica names
Returns:MCMC acceptance rate, RE acceptance rate and step size quantity objects
Return type:tuple
rexfw.convenience.create_default_stats_writers(sim_path, variable_name)[source]

Creates default statistics writers, which print sampling statistics on the screen or write it to a text file

Parameters:
  • sim_path (str) – the output folder
  • variable_name (str) – the name of the only variable to be sampled
Returns:

default MCMC and RE statistics writers

Return type:

tuple

rexfw.convenience.create_directories(sim_folder)[source]

Creates simulation output folders

rexfw.convenience.setup_default_re_master(n_replicas, sim_path, comm)[source]

Creates a default ExchangeMaster object for Replica Exchange. This should suffice for most applications.

Parameters:
Returns:

a for all practical purposes sufficient ExchangeMaster object

Return type:

ExchangeMaster

rexfw.convenience.setup_default_replica(init_state, pdf, sampler_class, sampler_params, output_folder, comm, rank)[source]

Creates a default Replica object for replica exchange. This should suffice for most applications.

Parameters:
  • init_state (depends on your application) – initial state for the replica
  • pdf (AbstractPDF) – a AbstractPDF object which describes the probability density the replica will sample
  • sampler_class (AbstractSampler) – the class of the sampler used to sample from this replica’s PDF
  • sampler_params (dict) – a dict containing additional keyword arguments your sampler might need
  • output_folder (str) – the folder where simulation output will be stored
  • comm (AbstractCommunicator) – a AbstractCommunicator object responsible for communication with the master object
  • rank (int) – the index of this replica, usually 1, 2, …
Returns:

a for all practical purposes sufficient Replica object

Return type:

Replica