ANN
This is part of the annfunc module
It is only available if you configure PLUMED with ./configure –enable-modules=annfunc . Furthermore, this feature is still being developed so take care when using it and report any problems on the mailing list.

Calculates the ANN-function.

This module implements ANN class, which is a subclass of Function class. ANN class takes multi-dimensional arrays as inputs for a fully-connected feedforward neural network with specified neural network weights and generates corresponding outputs. The ANN outputs can be used as collective variables, inputs for other collective variables, or inputs for data analysis tools.

Examples

Assume we have an ANN with numbers of nodes being [2, 3, 1], and weights connecting layer 0 and 1 are

[[1,2], [3,4], [5,6]]

weights connecting layer 1 and 2 are

[[7,8,9]]

Bias for layer 1 and 2 are [10, 11, 12] and [13], respectively.

All activation functions are Tanh.

Then if input variables are l_0_out_0, l_0_out_1, the corresponding ANN function object can be defined using following plumed script:

Click on the labels of the actions for more information on what each action computes
tested on master
ann: ANN ...
   
   
ARG
compulsory keyword the labels of the values from which the function is calculated
=l_0_out_0,l_0_out_1
NUM_LAYERS
compulsory keyword number of layers of the neural network
=3
NUM_NODES
compulsory keyword numbers of nodes in each layer of the neural network
=2,3,1
ACTIVATIONS
compulsory keyword activation functions for the neural network
=Tanh,Tanh
WEIGHTS0
flattened weight arrays connecting adjacent layers, WEIGHTS0 represents flattened weight array connecting layer 0 and layer 1, WEIGHTS1 represents flattened weight array connecting layer 1 and layer 2, ....
=1,2,3,4,5,6
WEIGHTS1
flattened weight arrays connecting adjacent layers, WEIGHTS0 represents flattened weight array connecting layer 0 and layer 1, WEIGHTS1 represents flattened weight array connecting layer 1 and layer 2, ....
=7,8,9
BIASES0
bias array for each layer of the neural network, BIASES0 represents bias array for layer 1, BIASES1 represents bias array for layer 2, ....
=10,11,12
BIASES1
bias array for each layer of the neural network, BIASES0 represents bias array for layer 1, BIASES1 represents bias array for layer 2, ....
=13 ...

To access its components, we use "ann.node-0", "ann.node-1", ..., which represents the components of neural network outputs.

Glossary of keywords and components
Description of components

By default this Action calculates the following quantities. These quantities can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the quantity required from the list below.

Quantity Description
node components of ANN outputs
Compulsory keywords
ARG the labels of the values from which the function is calculated
PERIODIC if the output of your function is periodic then you should specify the periodicity of the function. If the output is not periodic you must state this using PERIODIC=NO
NUM_LAYERS number of layers of the neural network
NUM_NODES numbers of nodes in each layer of the neural network
ACTIVATIONS activation functions for the neural network
Options
NUMERICAL_DERIVATIVES

( default=off ) calculate the derivatives for these quantities numerically

WEIGHTS flattened weight arrays connecting adjacent layers, WEIGHTS0 represents flattened weight array connecting layer 0 and layer 1, WEIGHTS1 represents flattened weight array connecting layer 1 and layer 2, .... You can use multiple instances of this keyword i.e. WEIGHTS1, WEIGHTS2, WEIGHTS3...
BIASES bias array for each layer of the neural network, BIASES0 represents bias array for layer 1, BIASES1 represents bias array for layer 2, .... You can use multiple instances of this keyword i.e. BIASES1, BIASES2, BIASES3...