a3fe.run._utils
“Utilities for SimulationRunners.
Functions
|
Temporarily changes to path working directory. |
|
Check that the system has water and a box. |
|
Get the simulation time of a sub simulation runner, in ns. |
|
Get a single molecule from a BSS system. |
|
Retry a function a given number of times if the specified exceptions are raised. |
Classes
|
Iterator for SimulationRunners. |
- class a3fe.run._utils.SimulationRunnerIterator(base_dirs: List[str], subclass: Type[_T], **kwargs: Any)[source]
Iterator for SimulationRunners. This is required to avoid too many open files, because each simulation runner opens its own loggers. Hence, simulation runners are set up before being yielded, and then deleted after being yielded.
- a3fe.run._utils.check_has_wat_and_box(system: System) None[source]
Check that the system has water and a box.
- a3fe.run._utils.get_simtime(sim_runner: SimulationRunner, run_nos: _Optional[_List[int]] = None) float[source]
Get the simulation time of a sub simulation runner, in ns. This function is used with multiprocessing to speed up the calculation.
- Parameters:
sim_runner (SimulationRunner) – The simulation runner to get the simulation time of.
run_nos (List[int], Optional, default: None) – The run numbers to use for MBAR. If None, all runs will be used.
- a3fe.run._utils.get_single_mol(system: System, mol_name: str) Molecule[source]
Get a single molecule from a BSS system.
- a3fe.run._utils.retry(times: int, exceptions: Tuple[Exception], wait_time: int, logger: Logger) Callable[source]
Retry a function a given number of times if the specified exceptions are raised.
- Parameters:
times (int) – The number of retries to attempt before raising the error.
exceptions (Tuple[Exception]) – A list of exceptions for which the function will be retried. The function will not be retried if an exception is raised which is not supplied.
wait_time (int) – How long to wait between retries, in seconds.
- Returns:
decorator – The retry decorator
- Return type:
Callable