pysages.methods.ann

Overview

pysages.methods.ann.ANNState(xi, bias, hist, ...)

ANN internal state.

pysages.methods.ann.ANN(cvs, grid, topology, ...)

Implementation of the sampling method described in "Learning free energy landscapes using artificial neural networks" [J.

Details

Artificial Neural Network (ANN) sampling.

ANN estimates the probability distribution as a function of a set of collective variables from the frequency of visits to each bin in a grid in CV space. Periodically, a binned estimate of the free energy (computed from the probability density estimate) is used to train a neural network that provides a continuous approximation to the free energy. The gradient of the neural network model with respect to the CVs is then used as biasing force for the simulation.

class pysages.methods.ann.ANNState(xi: Array, bias: Array, hist: Array, phi: Array, prob: Array, nn: NNData, ncalls: int)

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

  • phi (JaxArray (grid.shape, CV shape)) – The current estimate of the free energy.

  • prob (JaxArray (CV shape)) – The current estimate of the unnormalized probability distribution.

  • nn (NNDada) – 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

phi: Array

Alias for field number 3

prob: Array

Alias for field number 4

nn: NNData

Alias for field number 5

ncalls: int

Alias for field number 6

class pysages.methods.ann.ANN(cvs, grid, topology, kT, **kwargs)

Implementation of the sampling method described in “Learning free energy landscapes using artificial neural networks” [J. Chem. Phys. 148, 104111 (2018)](https://doi.org/10.1063/1.5018708).

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

  • kT (float) – Value of kT in the same units as the backend internal energy units.

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

pysages.methods.ann.build_free_energy_learner(method: ANN)

Returns a function that given an ANNState trains the method’s neural network parameters from an estimate to the probability density.

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