pysages.methods.abf

Overview

pysages.methods.abf.ABFState(xi, bias, hist, ...)

ABF internal state.

pysages.methods.abf.ABF(cvs, grid, **kwargs)

Adaptive Biasing Force Method.

Details

Adaptive Biasing Force (ABF) sampling method.

ABF partitions the collective variable space into bins determined by a user provided grid, and keeps a tabulation of the number of visits to each bin as well as the sum of generalized forces experienced by the system at each configuration bin. These provide an estimate for the mean generalized force, which can be integrated to yield the free energy.

The implementation of the adaptive biasing force method here closely follows https://doi.org/10.1063/1.2829861. One important difference is that the time derivative of the product \(W\cdot p\) (equation 9 of reference) is approximated by a second order backward finite difference in the simulation time step.

class pysages.methods.abf.ABFState(xi: Array, bias: Array, hist: Array, Fsum: Array, force: Array, Wp: Array, Wp_: Array, ncalls: int)

ABF internal state.

Parameters:
  • xi (JaxArray (CV shape)) – Last collective variable recorded in the simulation.

  • bias (JaxArray (Nparticles, d)) – Array with biasing forces for each particle.

  • hist (JaxArray (grid.shape)) – Histogram of visits to the bins in the collective variable grid.

  • Fsum (JaxArray (grid.shape, CV shape)) – Cumulative forces at each bin in the CV grid.

  • force (JaxArray (grid.shape, CV shape)) – Average force at each bin of the CV grid.

  • Wp (JaxArray (CV shape)) – Product of W matrix and momenta matrix for the current step.

  • Wp – Product of W matrix and momenta matrix for the previous step.

  • ncalls (int) – Counts the number of times the method’s update has been called.

xi: Array

Alias for field number 0

bias: Array

Alias for field number 1

hist: Array

Alias for field number 2

Fsum: Array

Alias for field number 3

force: Array

Alias for field number 4

Wp: Array

Alias for field number 5

Wp_: Array

Alias for field number 6

ncalls: int

Alias for field number 7

class pysages.methods.abf.ABF(cvs, grid, **kwargs)

Adaptive Biasing Force Method.

snapshot_flags

Indicate the system properties required from a snapshot.

Parameters:
  • cvs (Union[List, Tuple]) – Set of user selected collective variable.

  • grid (Grid) – Specifies the collective variables domain and number of bins for discretizing the CV space along each CV dimension.

  • N (Optional[int] = 500) – Threshold parameter before accounting for the full average of the adaptive biasing force.

  • restraints (Optional[CVRestraints] = None) – If provided, indicate that harmonic restraints will be applied when any collective variable lies outside the box from restraints.lower to restraints.upper.

  • use_pinv (Optional[Bool] = False) – If set to True, the product W @ p will be estimated using np.linalg.pinv rather than using the scipy.linalg.solve function. This is computationally more expensive but numerically more stable.

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

Build the functions for the execution of ABF

Parameters:
  • snapshot – PySAGES snapshot of the simulation (backend dependent).

  • helpers – Helper function bundle as generated by SamplingMethod.context[0].get_backend().build_helpers.

Return type:

Tuple (snapshot, initialize, update) to run ABF simulations.

pysages.methods.abf.build_force_estimator(method: ABF)

Returns a function that computes the average forces (or the harmonic restraints forces if provided).

pysages.methods.abf.build_force_estimator(method: pysages.methods.ann.ANN)

Returns a function that given the neural network parameters and a CV value, computes the gradient of the network (the mean force) with respect to CV.

pysages.methods.abf.build_force_estimator(method: pysages.methods.cff.CFF)

Returns a function that given a PartialCFFState computes an estimate to the force.

pysages.methods.abf.build_force_estimator(method: pysages.methods.sirens.Sirens)

Returns a function that given a PartialSirensState computes an estimate to the force.

pysages.methods.abf.build_force_estimator(method: pysages.methods.spectral_abf.SpectralABF)

Returns a function that given the coefficients of basis functions expansion and a CV value, evaluates the function approximation to the gradient of the free energy.