pysages.methods.core

Overview

pysages.methods.core.SamplingMethod(cvs, ...)

Abstract base class for all sampling methods.

pysages.methods.core.GriddedSamplingMethod(...)

Base class for sampling methods that use grids.

pysages.methods.core.NNSamplingMethod(cvs, ...)

Base class for sampling methods that use neural networks.

pysages.methods.core.Result(*args, **kw_args)

Bundles the essential information needed to estimate the free energy of a system, as well as the necessary data for restarting the simulation.

pysages.methods.core.run(method_or_result, ...)

Runs a single or multiple replicas of a simulation with the specified sampling method.

Details

class pysages.methods.core.Result(*args, **kw_args)

Bases: Result

Bundles the essential information needed to estimate the free energy of a system, as well as the necessary data for restarting the simulation.

Parameters:
  • method (SamplingMethod) – The sampling method used.

  • states (List[SamplingMethodState]) – The last state of the sampling method for each system replica run.

  • callbacks (Optional[List[Callback]]) – Optional set of callbacks for all simulation replicas.

  • snapshots (List[Snapshot]) – Last snapshot of each replica of the simulation.

class pysages.methods.core.SamplingMethod(cvs, **kwargs)

Bases: object

Abstract base class for all sampling methods.

This class defines a constructor that expects the list of collective variables and provides the necessary methods for initializing and executing the biasing during a simulation. Inheriting classes are expected to enhance or overwrite its methods as needed.

abstract build(snapshot, helpers, *args, **kwargs)

Returns the snapshot, and two functions, initialize and update.

The initialize function is intended to allocate any run-time information required by the update function. The update function is called after each integration step, that is, after each call to the wrapped context’s run method.

class pysages.methods.core.GriddedSamplingMethod(cvs, grid, **kwargs)

Bases: SamplingMethod

Base class for sampling methods that use grids.

class pysages.methods.core.NNSamplingMethod(cvs, grid, topology, **kwargs)

Bases: GriddedSamplingMethod

Base class for sampling methods that use neural networks.

pysages.methods.core.run(method_or_result, context_generator, timesteps, **kwargs)

Runs a single or multiple replicas of a simulation with the specified sampling method.

Note: Many specializations for this method are provided.

pysages.methods.core.run(method: pysages.methods.core.SamplingMethod, context_generator: Callable, timesteps: Union[int, float], callback: Union[Callable, NoneType] = None, context_args: dict = {}, post_run_action: Union[Callable, NoneType] = None, config: pysages.methods.utils.ReplicasConfiguration = <pysages.methods.utils.ReplicasConfiguration object at 0x7f2232d7f250>, **kwargs)
pysages.methods.core.run(sampling_context: pysages.backends.core.SamplingContext, timesteps: int | float, **kwargs)
pysages.methods.core.run(result: pysages.methods.core.Result, context_generator: Callable, timesteps: Union[int, float], context_args: dict = {}, post_run_action: Union[Callable, NoneType] = None, config: pysages.methods.utils.ReplicasConfiguration = <pysages.methods.utils.ReplicasConfiguration object at 0x7f2232d7f2b0>, **kwargs)
pysages.methods.core.run(method: pysages.methods.ffs.FFS, context_generator: Callable, timesteps: int, dt: float, win_i: float, win_l: float, Nw: int, sampling_steps_basin: int, Nmax_replicas: int, verbose: bool = False, callback: Callable | NoneType = None, context_args: dict = {}, **kwargs)
pysages.methods.core.run(method_or_result: Union[pysages.methods.umbrella_integration.UmbrellaIntegration, pysages.methods.core.Result[UmbrellaIntegration]], context_generator: Callable, timesteps: Union[int, float], context_args: dict = {}, post_run_action: Union[Callable, NoneType] = None, executor=<pysages.methods.utils.SerialExecutor object at 0x7f2230e66220>, executor_shutdown: bool = True, **kwargs)
pysages.methods.core.run(method_or_result: Union[pysages.methods.spline_string.SplineString, pysages.methods.core.Result[SplineString]], context_generator: Callable, timesteps: Union[int, float], stringsteps: Union[int, float], context_args: dict = {}, post_run_action: Union[Callable, NoneType] = None, executor=<pysages.methods.utils.SerialExecutor object at 0x7f2230e66310>, executor_shutdown: bool = True, **kwargs)