pyretis.initiation package

This package defines methods for initiating path ensembles.

Package structure

Modules

__init__.py
This file, imports from the other modules and defines some helper methods for the initiation.
initiate_kick.py (pyretis.initiation.initiate_kick)
Methods for initiating using the kick method.
initiate_load.py (pyretis.initiation.initiate_load)
Methods for initiating by loading already existing paths from files.
initiate_restart.py (pyretis.initiation.initiate_restart)
Methods for initiating by loading PyRETIS restart files.

Important methods defined in this package

get_initiation_method (get_initiation_method())
Method to select initiation method from settings.
initiate_path_simulation (initiate_path_simulation())
Method to initiate a path simulation.
pyretis.initiation.initiate_path_simulation(simulation, settings)[source]

Initialise a path simulation.

Parameters:
  • simulation (object like PathSimulation) – The simulation we are doing the initiation for.
  • settings (dict) – A dictionary with settings for the initiation.
Returns:

out (callable) – The method to be used for the initiation.

pyretis.initiation.get_initiation_method(settings)[source]

Return the initiation method from given settings.

Parameters:settings (dict) – This dictionary contains the settings for the initiation.
Returns:out (callable) – The method to be used for the initiation.

pyretis.initiation.initiate_kick module

This file contains functions used for initiation of paths.

Important methods defined here

generate_initial_path_kick (generate_initial_path_kick())
Function for generating an initial path by repeatedly kicking a phase point.
initiate_kick (initiate_kick())
Helper method, selects either initiate_kicki() or initiate_kick_max().
initiate_kicki (initiate_kicki())
A method for initiating a path ensemble by repeatedly modifying velocities to find the crossing with the interfaces.
initiate_kick_max (initiate_kick_max())
A method similar to py:meth:.initiate_kick. Here, if possible, we will use points from the previous paths, closest to the target interface.
initiate_path_ensemble_kick (initiate_path_ensemble_kick())
Method to initiate a single path ensemble.
fix_path_by_tis (fix_path_by_tis())
Method to fix an initial path that starts and ends at the wrong interface via TIS moves.
pyretis.initiation.initiate_kick.generate_initial_path_kick(system, order_function, path_ensemble, engine, rgen, tis_settings)[source]

Generate an initial path with the kicking method.

This function will generate an initial path by repeatedly kicking a phase-space point until the middle interface is crossed. The point before and after kicking are stored, so when the middle interface is crossed we have two points we can integrate forward and backward in time. This function is intended for use with TIS. For use with RETIS one should set the appropriate tis_settings so that the starting conditions are fine (i.e. for the [0^-] ensemble it might be different for the other ensembles).

Parameters:
  • system (object like System) – This is the system that contains the particles we are investigating.
  • order_function (object like OrderParameter) – The class used for obtaining the order parameter(s).
  • path_ensemble (object like PathEnsemble) – The path ensemble to create an initial path for.
  • engine (object like EngineBase) – The engine to use for propagating a path.
  • rgen (object like RandomGenerator) – This is the random generator that will be used.
  • tis_settings (dict) – This dictionary contains settings for TIS. Explicitly used here:
    • start_cond: string, starting condition, ‘L’eft or ‘R’ight.
    • maxlength: integer, maximum allowed length of paths.
Yields:
  • out[0] (boolean) – True if we are finished.
  • out[1] (string) – The current status of this method.
  • out[2] (object like PathBase or None) – If we are finished (and successful) this is the generated initial path. Otherwise, this is equal to None.
pyretis.initiation.initiate_kick.initiate_kick(simulation, cycle, settings)[source]

Run the initiation method for several ensembles.

Please see documentation for initiate_path_ensemble_kick().

pyretis.initiation.initiate_kick.initiate_kicki(simulation, cycle)[source]

Run the initiation for several ensembles.

Please see documentation for initiate_path_ensemble_kick().

pyretis.initiation.initiate_kick.initiate_kick_max(simulation, cycle)[source]

Run the initiation for several ensembles.

This method is similar to initiate_kick(), but here we update the initial point for an ensemble to use that of the previous path (if this exist).

Please see documentation for initiate_path_ensemble_kick().

pyretis.initiation.initiate_kick.initiate_path_ensemble_kick(path_ensemble, system, order_function, engine, rgen, tis_settings, cycle)[source]

Run the “kick” initiate for a given ensemble.

Parameters:
  • path_ensemble (object like PathEnsemble) – The path ensemble to create an initial path for.
  • system (object like System) – The system is used here since we need access to the temperature and to the particle list.
  • order_function (object like OrderParameter) – The class used for obtaining the order parameter(s).
  • engine (object like EngineBase) – The engine to use for propagating a path.
  • rgen (object like RandomGenerator) – This is the random generator that will be used.
  • tis_settings (dict) – This dictionary contains the TIS settings.
  • cycle (integer, optional) – The cycle number we are initiating at, typically this will be 0 which is the default value.
Returns:

  • out[0] (boolean) – True if the initial path was accepted.
  • out[1] (object like py:class:.PathBase) – The initial path.
  • out[2] (string) – The status of the path.

pyretis.initiation.initiate_kick.fix_path_by_tis(initial_path, order_function, path_ensemble, engine, tis_settings, rgen=None)[source]

Fix a path that starts and ends at the wrong interfaces.

The given path is amended by performing TIS moves (shooting and time reversal). Note that this function is intended to be used in connection with the initialisation.

Parameters:
  • initial_path (object like PathBase) – This is the initial path to fix. It starts & ends at the wrong interface.

  • order_function (object like OrderParameter) – The object used for calculating the order parameter(s).

  • path_ensemble (object like PathEnsemble) – The path ensemble to create an initial path for.

  • engine (object like EngineBase) – The engine to use for propagating a path.

  • tis_settings (dict) – Settings for TIS method, here we explicitly use:

    • start_cond: string which defines the start condition.
    • maxlength: integer which gives the maximum allowed path length.

    Note that we here explicitly set some local TIS settings for use in the make_tis_step function.

  • rgen (object like RandomGenerator, optional.) – This is the random generator that will be used.

Returns:

out (object like PathBase) – The amended path.

pyretis.initiation.initiate_load module

Method for initiating paths by loading from previous simulation(s).

Important methods defined here

initiate_load (initiate_load())
A method that will get the initial path from the output of a previous simulation.
pyretis.initiation.initiate_load.initiate_load(simulation, cycle, settings)[source]

Initialise paths by loading already generated ones.

Parameters:
  • simulation (object like Simulation) – The simulation we are setting up.
  • cycle (integer) – The simulation cycles we are starting at.
  • settings (dictionary) – A dictionary with settings for the initiation.

pyretis.initiation.initiate_restart module

This file contains functions used for initiation of paths.

Important methods defined here

initiate_restart (initiate_restart())
A method that will get the initial path from the output from a previous simulation.
pyretis.initiation.initiate_restart.initiate_restart(simulation, cycle, settings)[source]

Initialise paths by loading restart data.

Parameters:
  • simulation (object like Simulation) – The simulation we are setting up.
  • cycle (integer) – The simulation cycles we are starting at.
  • settings (dictionary) – A dictionary with settings for the initiation.