pysages.methods.funn

Overview

pysages.methods.funn.FUNNState(xi, bias, ...)

FUNN internal state.

pysages.methods.funn.FUNN(cvs, grid, ...)

Implementation of the sampling method described in "Adaptive enhanced sampling by force-biasing using neural networks" [J.

Details

Adaptive Enhanced Sampling by Force-biasing Using Neural Networks (FUNN).

FUNN learns the generalized mean forces as a function of some collective variables, by training a neural network from a binned estimate of the mean forces estimates. It closely follows the Adaptive Biasing Force (ABF) algorithm, except for biasing the simulation, which is done from the continuous approximation to the generalized mean force provided by the network.

To find the free energy surface, it is necessary to integrate the forces by some appropriate method.

class pysages.methods.funn.FUNNState(xi: Array, bias: Array, hist: Array, Fsum: Array, F: Array, Wp: Array, Wp_: Array, nn: NNData, ncalls: int)

FUNN internal state.

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

  • bias (JaxArray (natoms, 3)) – 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)) – The cumulative force recorded at each bin of the CV grid.

  • Wp (JaxArray (CV shape)) – Estimate of the product $W p$ where p is the matrix of momenta and W the Moore-Penrose inverse of the Jacobian of the CVs.

  • Wp – The value of Wp for the previous integration step.

  • nn (NNData) – Bundle of the neural network parameters, and output scaling coefficients.

  • 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

F: Array

Alias for field number 4

Wp: Array

Alias for field number 5

Wp_: Array

Alias for field number 6

nn: NNData

Alias for field number 7

ncalls: int

Alias for field number 8

class pysages.methods.funn.PartialFUNNState(xi, hist, Fsum, ind, nn, pred)
xi: Array

Alias for field number 0

hist: Array

Alias for field number 1

Fsum: Array

Alias for field number 2

ind: Tuple

Alias for field number 3

nn: NNData

Alias for field number 4

pred: bool

Alias for field number 5

class pysages.methods.funn.FUNN(cvs, grid, topology, **kwargs)

Implementation of the sampling method described in “Adaptive enhanced sampling by force-biasing using neural networks” [J. Chem. Phys. 148, 134108 (2018)](https://doi.org/10.1063/1.5020733).

Parameters:
  • cvs (Union[List, Tuple]) – List of collective variables.

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

  • topology (Tuple[int]) – Defines the architecture of the neural network (number of nodes of each hidden layer).

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

  • train_freq (Optional[int] = 5000) – Training frequency.

  • optimizer (Optional[Optimizer]) – Optimization method used for training, defaults to LevenbergMarquardt().

  • 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.

pysages.methods.funn.build_free_energy_grad_learner(method: FUNN)

Returns a function that given a FUNNState trains the method’s neural network parameters from an ABF-like estimate for the gradient of the free energy.

The training data is regularized by convolving it with a Blackman window.

pysages.methods.funn.build_force_estimator(method: FUNN)

Returns a function that given the neural network parameters and a CV value, evaluates the network on the provided CV.