ensembler.ensemble package¶
Submodules¶
ensembler.ensemble.exchange_pattern module¶
-
class
ensembler.ensemble.exchange_pattern.
Exchange_pattern
(replica_graph: dict)[source]¶ Bases:
object
general Scaffold for an exchange pattern
-
__init__
(replica_graph: dict)[source]¶ build the exchange scaffold for replica_graph
- Parameters
replica_graph (dict) – representation of the replica graph
-
_do_exchange
(exchanges_to_make: Dict[Tuple[int, int], bool], verbose: bool = False) → NoReturn[source]¶ post exchange decision step, executing the exchange
- Parameters
exchanges_to_make (Dict[Tuple[int, int], bool]) – the key of the dictionary is a tuple containing the replica identifiers, which exchange parameters. The value is stating if they should exchang.
verbose (bool, optional) – DADADA (default: False)
-
exchange
(verbose: bool = False)[source]¶ @ interface needs to be implemented in subclass :Parameters: verbose
-
replica_graph
= None¶
-
update_exchange_information
(original_exchange_coordinates: List, original_totPots: List[float], swapped_totPots: List[float]) → NoReturn[source]¶ This function keeps track of the exchanges
- Parameters
original_exchange_coordinates (List) – original exchange coordinates
original_totPots (List) – original total potentials
swapped_totPots (List) – swapped original total potentials
-
-
class
ensembler.ensemble.exchange_pattern.
globalExchangeScheme
(replica_graph: dict)[source]¶ Bases:
ensembler.ensemble.exchange_pattern.Exchange_pattern
Implement a grlobal exchange scheme here :)
-
class
ensembler.ensemble.exchange_pattern.
localExchangeScheme
(replica_graph: dict)[source]¶ Bases:
ensembler.ensemble.exchange_pattern.Exchange_pattern
This scheme is exchanging a replica with its neighbour if possible
-
_collect_replica_energies
(verbose: bool = False) → Tuple[List[int], List[float], List[int], List[float]][source]¶ _collect_replica_energies collect all rep
- Parameters
verbose (bool, optional) – More noise! More noise!
- Returns
original_exCoord, original_totPots, swapped_exCoord, swapped_totPots
- Return type
Tuple[List[int], List[float], List[int], List[float]]
-
_swap_coordinates
(original_exCoord: List[int]) → List[int][source]¶ swap the coordinates pairwise of the original exchange coord list
- Parameters
original_exCoord (List) – Of replicas in order
- Returns
return list with swapped replica IDs
- Return type
List
-
exchange
(verbose: bool = False)[source]¶ Exchange the Trajectory of T-replicas in pairwise fashion
- Parameters
verbose (bool, optional) – Make some music (Default: False)
-
exchange_offset
: int = 0¶
-
ensembler.ensemble.replica_exchange module¶
[summary]
-
class
ensembler.ensemble.replica_exchange.
HamiltonianReplicaExchange
(system: system, exchange_dimensions: Dict[str, Iterable], exchange_criterium=<function _replicaExchange.<lambda>>, steps_between_trials: int = 10)[source]¶ Bases:
ensembler.ensemble._replica_graph._replicaExchange
-
nSteps_between_trials
: int¶
-
-
class
ensembler.ensemble.replica_exchange.
replicaExchangeEnvelopingDistributionSampling
(system: system, s_range: Iterable = array([10.0, 0.0316227766, 0.0001]), exchange_criterium=None, steps_between_trials=20, exchange_trajs: bool = False)[source]¶ Bases:
ensembler.ensemble._replica_graph._replicaExchange
-
__init__
(system: system, s_range: Iterable = array([10.0, 0.0316227766, 0.0001]), exchange_criterium=None, steps_between_trials=20, exchange_trajs: bool = False)[source]¶ constructs a replic exchange enveloping distribution sampling (RE-EDS) ensemble. This approach was developed by Sidler, Schwaninger and Riniker 2016. It exchanges the smoothing parameter s during the simulations.
- Parameters
system (systemCls) – system class that is the basis of the ensemble
s_range (Iterable, optional) – smootghin parameter range for eds in the replica graph (Default: np.linspace(start=1, stop=-4, num=3))
exchange_criterium (callable, optional) – exchange criterium (Default: None - metropolis)
steps_between_trials (int, optional) – number of steps inbetween the trials. (Default: 20)
exchange_trajs (bool, optional) – shall we exchange the trajectories (Default: False)
-
coordinate_dimensions
: int = 1¶
-
nSteps_between_trials
: int¶
-
replica_graph_dimensions
: int = 1¶
-
-
class
ensembler.ensemble.replica_exchange.
temperatureReplicaExchange
(system: system, temperature_range: Iterable = array([298.0, 309.0, 320.0]), exchange_criterium: callable = None, steps_between_trials: int = 20, exchange_trajs: bool = False)[source]¶ Bases:
ensembler.ensemble._replica_graph._replicaExchange
Temperature Replica Exchange is swapping the temperature frequently between replicas. This method was to our knowledge first descibed by Sugita and Okamoto in 1999
-
__init__
(system: system, temperature_range: Iterable = array([298.0, 309.0, 320.0]), exchange_criterium: callable = None, steps_between_trials: int = 20, exchange_trajs: bool = False)[source]¶ - __init__
constructs an Ensemble that is exchanging the temperaturesbetween replicas
- Parameters
system (systemCls) – system class that is the basis of the ensemble
temperature_range (Iterable, optional) – temperature range for replica graph (Default: np.linspace(start=298, stop=320, num=3))
exchange_criterium (callable, optional) – exchange criterium (Default: None - metropolis)
steps_between_trials (int, optional) – number of steps inbetween the trials. (Default: 20)
exchange_trajs (bool, optional) – shall we exchange the trajectories (Default: False)
-
_adapt_system_to_exchange_coordinate
() → NoReturn[source]¶ update the replica to the new coordinate set.
-
_scale_velocities_fitting_to_temperature
(original_T: List[float], swapped_T: List[float]) → NoReturn[source]¶ adapt the velocities to the new coordinates
- Parameters
original_T (List[float]) – original temperatures
swapped_T (List[float]) – swapped temperatures
-
coordinate_dimensions
: int = 1¶
-
nSteps_between_trials
: int¶
-
replica_graph_dimensions
: int = 1¶
-
ensembler.ensemble.replicas_dynamic_parameters module¶
-
class
ensembler.ensemble.replicas_dynamic_parameters.
conveyorBelt
(capital_lambda: float, n_replicas: int, system: system = <ensembler.system.perturbed_system.perturbedSystem object>, build: bool = False)[source]¶ Bases:
ensembler.ensemble._replica_graph._mutliReplicaApproach
Conveyor belt ensemble class
organizes the replicas and their coupling
-
__init__
(capital_lambda: float, n_replicas: int, system: system = <ensembler.system.perturbed_system.perturbedSystem object>, build: bool = False)[source]¶ initialize Ensemble object
- Parameters
capital_lambda (float) – state of ensemble, 0 <= capital_lambda < pi
n_replicas (int) – number of replicas
system (systemCls, optional) – a system1D instance
build (bool, optional) – build memory?
-
accept_move
() → NoReturn[source]¶ Performs one trial move of the capital lambda, either accepts or rejects it and updates the lambdas of all replicas.
-
add_replica
(clam: float, add_n_replicas: int = 1) → NoReturn[source]¶ Not Implemented!!!
adds a replica to the ensemble
-
calculate_replica_lambda
(capital_lambda: float, i: int) → float[source]¶ - Parameters
capital_lambda (float) – state of ensemble 0 <= capital_lambda < 2 pi
i (int) – index of replica
- Returns
lambda of replica i
- Return type
float
-
calculate_total_ensemble_energy
() → float[source]¶ calculates energy of Conveyor Belt Ensemble
- Returns
total energy of the Conveyor Belt Ensemble.
- Return type
float
-
coordinate_dimensions
: int = 1¶
-
exchange_criterium
(originalParams, swappedParams)¶
-
exchange_dimensions
: Dict[str, numpy.array]¶
-
exchange_information
: pandas.core.frame.DataFrame = Empty DataFrame Columns: [Step, capital_lambda, TotE, biasE, doAccept] Index: []¶
-
get_conveyorbelt_trajectory
() → pandas.core.frame.DataFrame[source]¶ get_conveyorbelt_trajectory returns the pandas DataFrame of the conveyorbelt trajectory
- Returns
conveyorbelt_trajectory
- Return type
pd.DataFrame
-
get_replica_trajectories
() → Dict[int, pandas.core.frame.DataFrame][source]¶ get_replica_trajectories
- Returns
trajectories of all replicas
- Return type
Dict[int, pd.DataFrame]
-
get_trajs
() → Tuple[pandas.core.frame.DataFrame, Dict[int, pandas.core.frame.DataFrame]][source]¶ returns all Trajectories of this Ensemble.
- Returns
Conveyor Belt Trajectory, Replica Trajectories.
- Return type
Tuple[pd.DataFrame, Dict[int, pd.DataFrame]]
-
initialise
() → NoReturn[source]¶ Initialises a conveyor belt ensemble: deletes biasing potential, initialises the replica graph and updates the systems.
- Returns
- Return type
NoReturn
-
nSteps_between_trials
: int = 1¶
-
replica_graph_dimensions
: int = 1¶
-
run
(verbosity: bool = False) → NoReturn[source]¶ Integrates the systems of the ensemble for the :var:nSteps_between_trials.
-
set_simulation_n_steps_between_trials
(n_steps: int) → NoReturn[source]¶ Sets the integration steps of the replicas between a trail move.
- Parameters
n_steps (int) – number of steps
-
simulate
(ntrials: int, nSteps_between_trials: int = 1, reset_ensemble: bool = False, verbosity: bool = True)[source]¶ Integrates the conveyor belt ensemble
- Parameters
ntrials (int) – Number of conveyor belt steps
nSteps_between_trials (int, optional) – number of integration steps of replicas between a move of the conveyor belt (Default: None)
reset_ensemble (bool, optional) – reset ensemble for starting the simulation? (Default: False)
verbosity (bool, optional) – verbose output? (Default: False)
- Returns
- Return type
NoReturn
-
static
spline
(dg)[source]¶ calculates the value of the spline function depending on the deviation dg from the grid point
# Todo: PUT SOMEWHERE ELSE OR NUMPY? : numpy.interp¶.
- Parameters
dg (float) – deviation from gridpoint (absolute value)
- Returns
value of spline (float)
- Return type
float
-
system_trajs
: dict = {}¶
-
Module contents¶
High level representaiton for methods that use multiple systems, e.g. Simulated Tempering, RE-EDS, Conveyorbelt.