pyretis.bin

Here, the PyRETIS executables can be found. These are:

pyretis.bin.cli module

pyretis - The unified PyRETIS command-line interface.

This is the single entry point for PyRETIS. It dispatches a sub-command to the matching tool:

pyretis run -i input.toml          # run a simulation  (was pyretisrun)
pyretis analyse -i analysis.txt    # analyse output    (was pyretisanalyse)
pyretis tools init -i input.toml   # auto-place interfaces (infinit driver)
pyretis tools clean                # remove run artifacts in a directory

Run with no command (or pyretis -h) it prints the logo and this usage; pyretis -v / --version prints the version.

The run and analyse sub-commands take exactly the same options as the standalone command they replace; pyretis <command> -h shows them. The standalone pyretisrun and pyretisanalyse commands still work but are deprecated: from PyRETIS 5 only pyretis run and pyretis analyse will be supported. pyretis clean is likewise kept as a deprecated alias of pyretis tools clean.

pyretis.bin.cli.entry_point()[source]

Dispatch pyretis <command> ... to the matching tool.

The first argument selects the sub-command; every remaining argument is handed unchanged to that tool’s own argument parser.

pyretis.bin.cli.print_welcome()[source]

Print the PyRETIS logo followed by the usage text.

pyretis.bin.cli.usage()[source]

Return the top-level usage text for the unified CLI.

Returns:

string – The multi-line usage / help text.

pyretis.bin.pyretisrun module

pyretisrun - An application for running PyRETIS simulations.

This script is a part of the PyRETIS library and can be used for running simulations from an input script.

usage: pyretisrun.py [-h] -i INPUT [-V] [-f LOG_FILE] [-l LOG_LEVEL] [-p]

PyRETIS

optional arguments:
-h, --help

show this help message and exit

-i INPUT, --input INPUT

Location of PyRETIS input file

-V, --version

show program’s version number and exit

-f LOG_FILE, --log_file LOG_FILE

Specify log file to write

-l LOG_LEVEL, --log_level LOG_LEVEL

Specify log level for log file

-p, --progress

Display a progress meter instead of text output for the simulation

More information about running PyRETIS can be found at: www.pyretis.org

pyretis.bin.pyretisrun._reject_untranslated_scheduler_input(inputfile)[source]

Fail with an actionable error on a canonical-shaped scheduler input.

Every legitimate input to run_infinite_swapping() is in the coordinator’s own config shape and therefore carries a [simulation.tis_set] table: the translated output.toml / infswap.toml (written by run_pyretis_path_sampling() / run_legacy_runner_config() via to_scheduler_config, which always sets tis_set), a legacy restart.toml, and a raw legacy-runner config. A NATIVE-shaped config that still carries task = "infinite_swapping" (e.g. one produced by a converter version that preserved the dialect’s routing marker instead of rewriting it to the canonical task) has NO tis_set and would otherwise crash deep in apply_config_defaults with a bare KeyError('tis_set'). Detect that here and say how to fix it.

Parameters:

inputfile (string) – Path to the input TOML handed to the scheduler.

pyretis.bin.pyretisrun._report_execution_error(error, log_level)[source]

Log a stopped execution and write its traceback to the log only.

Shared by both CLI flows (the in-process simulation and the infinite-swapping scheduler) so a failure is reported the same way regardless of which path ran. The friendly one-line message goes to the screen; the full traceback goes to the log file only.

Parameters:
  • error (Exception) – The exception currently being handled.

  • log_level (integer) – The active log level. At DEBUG or below the caller should re-raise so the traceback also reaches the screen.

Returns:

reraise (boolean) – True when the caller should re-raise (debug mode), so the error is never silently swallowed.

pyretis.bin.pyretisrun._scheduler_worker_count(inputfile)[source]

Return the worker count the scheduler will use for inputfile.

Resolved exactly like pyretis.inout.config_adapter. to_scheduler_config(): the environment override wins, then a [runner] section (legal canonical syntax), then the default of 1. Used to report the effective count when routing a path-sampling config, so the progress line matches the run.

Parameters:

inputfile (string) – Path to the input TOML (already validated by is_path_sampling_config()).

Returns:

integer – The number of scheduler workers the run will start.

pyretis.bin.pyretisrun._stage_continuation(resume_file, restart_file, config)[source]

Merge the new settings with the persisted scheduler state.

A restart continuation takes its SETTINGS from the new config (already translated by the caller into config) and only the running [current] state – cstep, RNG state, frac weights, the active path numbers and their birth-ensemble map – from the previous run’s state file. This restores the classic restart contract (settings from the input file, state from the restart file): resuming the previous run file verbatim would silently discard every setting change the continuation config makes (a new step target, a different engine or output options – e.g. the engine change the gromacs1-vs-gromacs2 example suite exercises).

Parameters:
  • resume_file (string) – Path to the previous run’s state file (output.toml, or a legacy restart.toml).

  • restart_file (string) – Path to the run file to write the merged config to (the run directory’s output.toml).

  • config (dict) – The translated scheduler config (defaults already applied), WITHOUT a [current] section. Mutated in place: the persisted [current] state is grafted onto it.

pyretis.bin.pyretisrun._warn_legacy_dialect_deprecated(inputfile)[source]

Emit a single DeprecationWarning for legacy-runner input.

Mirrors pyretis.inout.settings._warn_rst_deprecated()’s rst precedent: the legacy dialect keeps running (via the same normalize/translate pipeline every canonical config already goes through, see run_legacy_runner_config()), this only warns.

pyretis.bin.pyretisrun.bye_bye_world()[source]

Print out the goodbye message for PyRETIS.

pyretis.bin.pyretisrun.entry_point()[source]

entry_point - The entry point for the pip install of pyretisrun.

pyretis.bin.pyretisrun.entry_point_deprecated()[source]

Legacy pyretisrun entry point: warn, then run pyretis run.

The standalone pyretisrun command is kept working for now but is deprecated in favour of pyretis run; from PyRETIS 5 only the unified command will be supported. This wrapper emits that warning and then delegates to entry_point() unchanged.

pyretis.bin.pyretisrun.hello_world(infile, rundir, logfile)[source]

Print out a politically correct greeting for PyRETIS.

Parameters:
  • infile (string) – String showing the location of the input file.

  • rundir (string) – String showing the location we are running in.

  • logfile (string) – The output log file

pyretis.bin.pyretisrun.is_infinite_swapping_config(inputfile)[source]

Return True if the input selects the infinite-swapping sampler.

The infinite-swapping (replica-exchange) sampler is selected explicitly via [simulation] task = "infinite_swapping" (or infswap/infretis). A recognised path-sampling task (_PATH_SAMPLING_TASKS: retis/tis/explore/pptis/repptis) is NEVER treated as infinite-swapping, even if its [runner] section is present – [runner] (worker count / multi-engine pools) is legal canonical syntax too, translated by pyretis.inout.config_adapter.to_scheduler_config() just like every other canonical section. Only an input with NO recognised task at all falls back to the [runner]-presence heuristic (the still-supported legacy runner dialect, which never sets task). Only .toml inputs are considered; the in-process simulation flow handles everything else.

Parameters:

inputfile (string) – Path to the input file.

Returns:

boolean – True if the infinite-swapping scheduler should run this input.

pyretis.bin.pyretisrun.is_legacy_runner_config(inputfile)[source]

Return True if inputfile needs the legacy-runner pipeline.

The structural marker is [simulation.tis_set] – the legacy runner dialect’s own placement of its path-sampling knobs (vs. the canonical [tis]) – checked directly rather than inferred from task: real configs in the validation suite carry an explicit task = "infinite_swapping" for unambiguous routing while still using [simulation.tis_set] throughout, so task presence alone does not distinguish the two dialects here (see MERGE_TODO.md S5.6).

A restart continuation is excluded: it is always invoked by pointing -i directly at the scheduler’s own restart.toml (never the original config), which is already in the coordinator’s own shape (its [current] section is state, not input) and must not be re-normalized. Both the conventional filename and [current]’s presence are checked, since the restart-continuation convention in pyretis.simulation.setup.setup_config() already depends on the exact restart.toml name, not just this function.

Parameters:

inputfile (string) – Path to the input file.

Returns:

boolean – True if this is a fresh legacy-runner config that should be routed through run_legacy_runner_config().

pyretis.bin.pyretisrun.is_path_sampling_config(inputfile)[source]

Return True if a canonical path-sampling TOML routes to the scheduler.

As of the Stage C collapse, canonical task = "retis" .toml inputs are run through the infinite-swapping scheduler at n_workers = 1 (their config is translated by pyretis.inout.config_adapter.to_scheduler_config()). The canonical tis, explore, pptis, and repptis tasks all route through the scheduler too (validated by VALIDITY, not byte-identity – the coordinator RNG differs from the in-process loop’s). Inputs that already select the infinite-swapping sampler are excluded. A canonical path-sampling config that hits a scheduler PORT GAP (see scheduler_port_gap()) returns False here and is rejected with a clear error by the caller – it is NOT dispatched to the retired in-process loop. Only .toml inputs are considered (a .rst input is not a scheduler config).

Parameters:

inputfile (string) – Path to the input file.

Returns:

boolean – True for a path-sampling .toml the scheduler can run.

pyretis.bin.pyretisrun.legacy_input_path_sampling_task(inputfile)[source]

Return the path-sampling task of a legacy (non-TOML) input, or None.

The scheduler routing predicates (is_path_sampling_config(), is_infinite_swapping_config()) read .toml inputs only, so a legacy .rst path-sampling input skips them and would fall through to the retired in-process loop – crashing deep in PathSimulation.run() only after every ensemble output directory has already been created, with an error that names the very command the user just ran. The caller must instead translate such an input to its TOML twin (translate_legacy_input()) before routing, so the run proceeds through the scheduler like any canonical config.

The settings are parsed exactly as set_up_simulation parses them (defaults included: a no-defaults parse crashes in the shared _finalise_settings post-processing for any input without a simulation/task entry – the very task-less case this helper must survive), so a malformed input raises the same error from here that it would have raised there. The default task is md, so a task-less legacy input keeps its in-process route.

Parameters:

inputfile (string) – Path to the input file.

Returns:

string or None – The retired path-sampling task the legacy input selects, or None when translation does not apply: a .toml input (the scheduler routing owns those), a missing file (set_up_simulation raises its own descriptive error), or a legacy input whose task still runs in-process (md / md-flux / make-tis-files / …).

pyretis.bin.pyretisrun.main(infile, indir, exe_dir, progress, log_level)[source]

Execute PyRETIS.

Parameters:
  • infile (string) – The input file to open with settings for PyRETIS.

  • indir (string) – The folder containing the settings file.

  • exe_dir (string) – The directory we are working from.

  • progress (boolean) – Determines if we should use a progress bar or not.

  • log_level (integer) – Determines if we should display the error traceback or not.

pyretis.bin.pyretisrun.make_tis_files(_, settings, progress=False)[source]

Create TIS simulations input files PyRETIS.

It just writes out input files for single TIS simulations and

exit without running a simulation.

Parameters:

settings (list of dicts or Simulation objects) – The settings for the simulations.

pyretis.bin.pyretisrun.remove_exit_file(exit_file)[source]

Remove the EXIT file after a completed soft exit.

pyretis.bin.pyretisrun.run_generic_simulation(sim, sim_settings, progress=False)[source]

Run a generic PyRETIS simulation.

These are simulations that are just going to complete a given number of steps. Other simulation may consist of several simulations tied together and these are NOT handled here.

Parameters:
  • sim (object like Simulation) – This is the simulation to run.

  • sim_settings (dict) – The simulation settings.

  • progress (boolean, optional) – If True, we will display a progress bar, otherwise, we print results to the screen.

pyretis.bin.pyretisrun.run_infinite_swapping(inputfile)[source]

Run an infinite-swapping (replica-exchange) input via its scheduler.

This is the programmatic entry for the infinite-swapping sampler (the scheduler + config loader), run from the current working directory. pyretisrun calls it for inputs that select infinite swapping, so it is the single way to drive that sampler.

Parameters:

inputfile (string) – Path to the infinite-swapping input TOML.

pyretis.bin.pyretisrun.run_legacy_runner_config(inputfile, runpath)[source]

Run a legacy-runner config via the canonical-schema pipeline.

Reshapes the raw legacy-runner dict (pyretis.inout.config_adapter.normalize_legacy_dialect()), parses the result through the same strict canonical-schema validator every hand-written canonical TOML goes through (pyretis.inout.settings.parse_settings_toml()), translates it (pyretis.inout.config_adapter.to_scheduler_config()), and hands the result to the unchanged scheduler via run_infinite_swapping() – the same three-stage pipeline run_pyretis_path_sampling() uses for canonical input, so both dialects now share one code path from this point on.

A restart continuation is excluded from this: it is always invoked by pointing -i directly at the scheduler’s own restart.toml (never the original config – setup_config itself refuses a fresh input file alongside an existing restart.toml), and restart.toml is already in the coordinator’s own shape, not a user-authored dialect needing translation.

A config with an explicit [simulation] ensemble_engines (a general multi-engine pool) is also excluded: it has no canonical-dialect equivalent, so it is handed straight to run_infinite_swapping(), which reads it untranslated via pyretis.simulation.setup.setup_config() (the only route that understands multi-engine pools).

Parameters:
  • inputfile (string) – Path to the legacy-runner input TOML.

  • runpath (string) – The directory the simulation runs from (where the intermediate canonical-shaped TOML and the final translated infswap.toml are written).

pyretis.bin.pyretisrun.run_md_flux_simulation(sim, sim_settings, progress=False)[source]

Run a MD-FLUX simulation.

Parameters:
  • sim (object like Simulation) – This is the simulation to run.

  • sim_settings (dict) – The simulation settings.

  • progress (boolean, optional) – If True, we will display a progress bar, otherwise, we print results to the screen.

pyretis.bin.pyretisrun.run_md_simulation(sim, sim_settings, progress=False)[source]

Run a MD simulation.

Parameters:
  • sim (object like Simulation) – This is the simulation to run.

  • sim_settings (dict) – The simulation settings.

  • progress (boolean, optional) – If True, we will display a progress bar, otherwise, we print results to the screen.

pyretis.bin.pyretisrun.run_pyretis_path_sampling(inputfile, runpath)[source]

Run a canonical RETIS config through the infinite-swapping coordinator.

This is the opt-in compatibility route. It translates the canonical configuration to the coordinator’s config dictionary (pyretis.inout.config_adapter.to_scheduler_config()) and generates the coordinator’s load_dir when requested. By default (method = "load", or "kick") this goes through the proven, sequential, single-process classic initiation (pyretis.inout.config_adapter.generate_load_dir()), unchanged. Opting into [initial-path] kick-parallel = true (with method = "kick" and kick-from = "initial", the default) instead routes through the parallel, engine-agnostic kick phase (pyretis.simulation.setup.run_kick_phase(), one job per ensemble across a worker pool) – proven so far only for engines that drive their kick search through propagate()/_propagate_from() (e.g. TurtleMD); internal engines’ own kick_across_middle is not yet streaming-aware, so kick-parallel stays opt-in rather than the default until that gap is closed. It then writes the resolved config to the single output.toml and hands it to the unchanged scheduler via run_infinite_swapping().

Parameters:
  • inputfile (string) – Path to the canonical RETIS input TOML.

  • runpath (string) – The directory the simulation runs from (where load and the translated output.toml are written).

pyretis.bin.pyretisrun.scheduler_port_gap(inputfile)[source]

Return the scheduler port-gap reason for a canonical path-sampling TOML.

A path-sampling task (tis/retis/explore/pptis/repptis) whose config the scheduler cannot yet run (see scheduler_supported_features()) has NO execution path – the in-process loop is retired – so the caller must reject it with this reason rather than dispatch the retired loop. Returns None for inputs that are not path-sampling .toml tasks (md / md-flux / a .rst input / an infinite-swapping config), which run their normal route, and None for a canonical path-sampling config the scheduler does cover.

Parameters:

inputfile (string) – Path to the input file.

Returns:

string or None – The first unsupported-feature reason, or None.

pyretis.bin.pyretisrun.scheduler_supported_features(config)[source]

Return (supported, reason) for routing a canonical retis config.

The infinite-swapping scheduler at n_workers = 1 faithfully reproduces the canonical RETIS loop for the kick- (or restart-) initialised internal-engine RETIS family with the sh/wt/wf/ ss shooting moves (wf/ss via the WHAM Cxy/HA unweighting on the per-ensemble-output route). Several classic features are still scheduler PORT GAPS and must keep the in-process loop until they are ported, so this helper detects them and reports the first one found:

  • shooting moves other than sh/wt/wf/ss.

  • the permeability mirror (mirror_freq) and target swap (target_freq) moves route through the scheduler but only at n_workers = 1 (both persist a global order-function mutation on accept).

  • an [initial-path] method of load for non-explore tasks.

  • a [simulation] restart continuation.

Parameters:

config (dict) – The parsed canonical TOML configuration.

Returns:

(boolean, string)(True, '') when the scheduler faithfully covers the config; (False, reason) naming the first unsupported feature.

pyretis.bin.pyretisrun.set_up_simulation(inputfile, runpath)[source]

Run all the needed generic set-up.

Parameters:
  • inputfile (string) – The input file which defines the simulation.

  • runpath (string) – The base path we are running the simulation from.

Returns:

  • runner (method) – A method which can be used to execute the simulation.

  • sim (object like Simulation) – The simulation defined by the input file.

  • syst (object like System) – The system created.

  • sim_settings (dict) – The input settings read from the input file.

pyretis.bin.pyretisrun.soft_exit_ignore(turn_keyboard_interruption_off=True, exe_dir=None)[source]

Manage the KeyboardInterrupt exception.

Parameters:
  • turn_keyboard_interruption_off (boolean) – If True, instead of regular exiting from the program, the file ‘EXIT’ is created to stop the PyRETIS.

  • exe_dir (string, optional) – The path where EXIT file is expected.

pyretis.bin.pyretisrun.store_simulation_settings(settings, indir, backup, ext='.rst')[source]

Store the parsed input settings.

Parameters:
  • settings (dict) – The simulation settings.

  • indir (string) – The directory which contains the input script.

  • backup (boolean) – If True, an existing settings file will be backed up.

  • ext (string) – Extension for the regenerated settings dump. Matches the input file extension, so a .toml run writes out.toml and a .rst run writes out.rst. Defaults to .rst for backwards compatibility.

pyretis.bin.pyretisrun.translate_legacy_input(inputfile, task)[source]

Translate a legacy path-sampling input to its TOML twin and return it.

Path sampling runs only through the scheduler, which reads TOML, so a legacy .rst input is translated to <stem>.toml with the same round-trip-validated converter behind python -m pyretis.tools.convert_settings. The legacy file is left untouched. If the twin already exists it is REUSED when it parses to the same raw settings as the legacy input (the run then behaves identically however it was invoked); a twin with DIFFERENT content is refused – two conflicting inputs for one run, and guessing which is the truth is exactly the kind of silent wrong answer this codebase forbids.

Parameters:
  • inputfile (string) – The legacy (non-TOML) input file.

  • task (string) – The path-sampling task it selects (for the log/error text).

Returns:

string – The path of the TOML input to run instead.

pyretis.bin.pyretisrun.use_tqdm(progress)[source]

Return a progress bar if we want one.

Parameters:

progress (boolean) – If True, we should use a progress bar, otherwise not.

Returns:

out (object like tqdm.tqdm) – The progress bar, if requested. Otherwise, just a dummy iterator.

pyretis.bin.pyretisclean module

pyretisclean - Remove the artifacts of a PyRETIS run.

This is the implementation behind pyretis tools clean. It deletes the output a PyRETIS run leaves in a directory (logs, out.toml / out.rst, restart files, the NNN ensemble directories, report, byte-code caches, …), so an example or run directory can be reset to its committed inputs. A per-directory clean.toml extends or overrides the built-in defaults; see pyretis.inout.clean.

usage: pyretis tools clean [-h] [–dry-run] [directory]

The pieces are factored so both the canonical pyretis tools clean sub-command (pyretis.bin.pyretistools) and the deprecated pyretis clean alias share one argument definition and one runner.

pyretis.bin.pyretisclean.add_clean_arguments(parser)[source]

Add the clean arguments to an argument parser.

Parameters:

parser (argparse.ArgumentParser) – The parser (or sub-parser) to extend with the directory positional and the --dry-run flag.

Returns:

argparse.ArgumentParser – The same parser, for convenience.

pyretis.bin.pyretisclean.entry_point()[source]

Entry point for the deprecated pyretis clean alias.

pyretis clean still works but is deprecated in favour of pyretis tools clean; it prints a one-line notice and then runs.

pyretis.bin.pyretisclean.main(argv=None)[source]

Parse clean arguments and run it.

Parameters:

argv (list of str, optional) – The argument list (default: sys.argv[1:]).

pyretis.bin.pyretisclean.run_clean(args)[source]

Clean a directory and report what was removed.

Parameters:

args (argparse.Namespace) – Parsed arguments; uses args.directory and args.dry_run.

pyretis.bin.pyretisanalyse module

pyretisanalyse - An application for analysing PyRETIS simulations.

This script is a part of the PyRETIS library and can be used for analysing the result from simulations.

usage: pyretisanalyse.py [-h] -i INPUT [-V] [-f LOG_FILE] [-l LOG_LEVEL]

optional arguments:
-h, --help

show this help message and exit

-i INPUT, --input INPUT

Location of PyRETIS input file

-V, --version

show program’s version number and exit

-f LOG_FILE, --log_file LOG_FILE

Specify log file to write

-l LOG_LEVEL, --log_level LOG_LEVEL

Specify log level for log file

pyretis.bin.pyretisanalyse._countered_report_name(reportfile, report_base, counter)[source]

Insert the archive counter before the cycle descriptor.

pyretis.bin.pyretisanalyse._format_cycle_suffix(cycles)[source]

Return a file-name suffix for the number of analysed cycles.

pyretis.bin.pyretisanalyse._latest_report_pattern(report_base, extension)[source]

Return a regexp matching uncountered latest report names.

pyretis.bin.pyretisanalyse._next_report_counter(path, report_base, extension)[source]

Return the next free archive counter for a report family.

pyretis.bin.pyretisanalyse._path_cycles(result)[source]

Return the cycle count from a path-ensemble analysis result.

pyretis.bin.pyretisanalyse._report_base(report_type, prefix=None)[source]

Return the base name for a report without counter or cycles.

pyretis.bin.pyretisanalyse._report_counter_pattern(report_base, extension)[source]

Return a regexp matching countered report archive names.

pyretis.bin.pyretisanalyse._run_wham_analysis(run_dir, report_dir, nskip=0)[source]

Analyse infinite-swapping output (WHAM crossing probability).

Parameters:
  • run_dir (string) – The run directory: either a literal infswap_data.txt lives directly in it, or it holds the numbered per-ensemble output directories the matrix is reconstructed from – see pyretis.analysis.wham_analysis.get_path_data_matrix().

  • report_dir (string) – Directory the wham_analysis.txt report is written to.

  • nskip (int, optional) – Number of initial cycles (records) to discard as equilibration – the skip_initial_cycles analysis setting. Defaults to 0.

Returns:

int – 0 on success, 1 if the interfaces could not be read.

pyretis.bin.pyretisanalyse.backup_latest_reports(reportfile, report_base)[source]

Back up uncountered reports from a report family.

pyretis.bin.pyretisanalyse.bye_bye_world()[source]

Print out the goodbye message for PyRETIS.

pyretis.bin.pyretisanalyse.completed_cycles(analysis_results)[source]

Return the number of cycles represented by an analysis result.

pyretis.bin.pyretisanalyse.configure_file_logging(log_file, log_level)[source]

Add the analysis file logger and return the numeric log level.

pyretis.bin.pyretisanalyse.create_pdf_report(texfile, pdflatex='pdflatex', report_base=None)[source]

Compile a LaTeX report to PDF if pdflatex is available.

pyretis.bin.pyretisanalyse.create_reports(settings, analysis_results, report_path)[source]

Create some reports to display the output.

Parameters:
  • settings (dict) – Settings for analysis (and the simulation).

  • analysis_results (dict) – Results from the analysis.

  • report_path (string) – The path to the directory where the reports should be saved.

Yields:

out (string) – The report files created.

pyretis.bin.pyretisanalyse.entry_point()[source]

entry_point - The entry point for the pip install of pyretisanalyse.

pyretis.bin.pyretisanalyse.entry_point_deprecated()[source]

Legacy pyretisanalyse entry: warn, then run pyretis analyse.

The standalone pyretisanalyse command is kept working for now but is deprecated in favour of pyretis analyse; from PyRETIS 5 only the unified command will be supported. This wrapper emits that warning and then delegates to entry_point() unchanged.

pyretis.bin.pyretisanalyse.get_report_name(report_type, ext, prefix=None, path=None, cycles=None, counter=None)[source]

Generate file name for a report.

Parameters:
  • report_type (string) – Identifier for the report we are writing.

  • ext (string) – Extension for the file to write.

  • prefix (string, optional) – A prefix to add to the file name. Usually just used to mark reports with ensemble number for report_type equal to ‘tis-single’

  • path (string) – A directory to use for saving the report to.

  • cycles (int, optional) – Number of completed cycles represented by the report.

  • counter (int, optional) – Archive counter to insert before the cycle descriptor.

Returns:

out (string) – The name of the file written.

pyretis.bin.pyretisanalyse.hello_world(infile, run_dir, report_dir, log_file=None)[source]

Output a standard greeting for PyRETIS analysis.

Parameters:
  • infile (string) – String showing the location of the input file.

  • run_dir (string) – The location where we are executing the analysis.

  • report_dir (string) – String showing the location of where we write the output.

  • log_file (string, optional) – The output log file.

pyretis.bin.pyretisanalyse.main(input_file, run_path, report_dir)[source]

Run the analysis.

Parameters:
  • input_file (string) – The input file with settings for the analysis.

  • run_path (string) – The location from which we are running the analysis.

  • report_dir (string) – The location where we will write the report.

pyretis.bin.pyretisanalyse.write_file(outname, report_txt, backup=True, report_base=None)[source]

Write a generated report to a given file.

Parameters:
  • outname (string) – The name of the file to write/create.

  • report_txt (string) – This is the generated report as a string.

  • backup (boolean, optional) – If True, back up an existing report before writing the new one.

  • report_base (string, optional) – Base report name used to back up the previous uncountered report.

Returns:

out (string) – The name of the file written.

pyretis.bin.pyretisanalyse.write_traceback(filename)[source]

Write the error traceback to the given file.

pyretis.bin.pyvisa module

pyvisa - An application for analysing PyRETIS simulations.

This script is a part of the PyRETIS library and can be used for analysing the result from simulations.

Usage:

pyvisa.py [-h] [-i INPUT] [-V] [-cmp] [-data DATA] [-recalculate]
          [-oo] [-p] [-w N]

Optional arguments:

-cmp --pyvisa_compressor  compress raw simulation output to a .hdf5 file.
-data --pyvisa-data       select the data source (file or folder).
-h, --help                show this help message and exit.
-i INPUT, --input INPUT   location of PyRETIS input files
                          or PyVisA compressed file.
-oo --only_order          use only data from order.txt files (faster).
-p, --progress            show progress bars during recalculation.
-recalculate              recalculate order parameter and cv data.
-V, --version             show program's version number and exit.
-w N, --workers N         number of parallel worker processes for
                          recalculation (default: all CPU cores).

Flags may be combined. Valid combinations include:

pyvisa -i out.rst -cmp                       # compress only
pyvisa -i out.rst -cmp -oo                   # compress, order files only
pyvisa -i out.rst -recalculate               # recalculate only
pyvisa -i out.rst -recalculate -p            # recalculate with progress
pyvisa -i out.rst -recalculate -w 4          # recalculate with 4 workers
pyvisa -i out.rst -recalculate -p -w 4       # recalculate, progress, 4 wk
pyvisa -i out.rst -recalculate -data 000     # recalculate one ensemble
pyvisa -i out.rst -recalculate -cmp          # recalculate then compress
pyvisa -i out.rst -recalculate -cmp -oo      # recalc then compress (oo)
pyvisa -i out.rst                            # open GUI
pyvisa -i out.rst -data 000                  # open GUI with one ensemble
pyretis.bin.pyvisa.bye_pyvisa()[source]

Print out the goodbye message for PyVisA.

pyretis.bin.pyvisa.entry_point()[source]

entry_point - The entry point for the pip install of pyretisanalyse.

pyretis.bin.pyvisa.hello_pyvisa(run_dir, infile)[source]

Output a standard greeting for PyVISA.

Parameters:
  • run_dir (string) – The location where we are executing the analysis.

  • infile (string) – String showing the location of the input file.

pyretis.bin.pyvisa.main(basepath, input_file, pyvisa_dict=None)[source]

Run the analysis.

Parameters:
  • basepath (string) – The execution folder where the input files are.

  • input_file (string) – The input file with settings for the analysis.

  • pyvisa_dict (dictionary, optional) –

    It determines the section of pyvisa to use, it contains:

    • pyvisa_compressor, boolean If true, compress raw output to a .hdf5 file.

    • pyvisa_data, str If given, the file or folder containing the files that will be used to feed to PyVisA.

    • pyvisa_recalculate, boolean If true, use the recalculation tool to compute new op and cv values.

    • only_order, boolean If true, use only data from order.txt files when compressing.

    Flags may be combined: pyvisa_recalculate and pyvisa_compressor can both be set to run recalculation followed by compression in a single invocation. If neither is set, the visualization GUI is launched.

pyretis.bin.pyvisa.pyvisa_visual(basepath, input_file, pyvisa_dict)[source]

Load data to PyVisA.

Parameters:
  • basepath (string) – The execution folder where the input files are.

  • input_file (string) – The input file with settings for the analysis.

  • pyvisa_dict (dictionary, optional) – It determines the section of pyvisa to use, it contains:

pyretis.bin.pyretistools module

pyretis tools - auxiliary PyRETIS tools.

Dispatches the pyretis tools <tool> sub-commands:

pyretis tools init -i input.toml    # auto-place the interfaces
pyretis tools clean [directory]     # remove a run's artifacts

pyretis tools init runs the iterative infinit driver to place the TIS/RETIS interfaces automatically – it repeatedly runs a short infinite-swapping simulation, re-estimates the crossing probability with WHAM, and re-places the interfaces so every ensemble carries roughly the same local crossing probability (see pyretis.tools.interface_optimizer.run_infinit()).

pyretis tools clean removes the output a run leaves in a directory so it can be reset to its committed inputs (see pyretis.bin.pyretisclean / pyretis.inout.clean).

pyretis.bin.pyretistools.build_parser()[source]

Build the argument parser for pyretis tools.

Returns:

argparse.ArgumentParser – The parser with one sub-parser per available tool.

pyretis.bin.pyretistools.entry_point()[source]

Entry point for pyretis tools.

pyretis.bin.pyretistools.main(argv=None)[source]

Parse pyretis tools arguments and dispatch the chosen tool.

Parameters:

argv (list of str, optional) – The argument list (default: sys.argv[1:]).

Returns:

int – A process exit code (0 on success, 2 when no tool was given).

pyretis.bin.pyretistools.run_init(args)[source]

Run pyretis tools init (the infinit interface driver).

Parameters:

args (argparse.Namespace) – Parsed arguments; uses args.input and args.workdir.

Returns:

list of float – The interface set after the final iteration.