Mathematical Backgrounds
Dynamical system
Assume that the system has dimension \(d\) and invariant distribution \(d\mu=\frac{1}{Z} \mathrm{e}^{-\beta V}dx\), where \(\beta=(k_BT)^{-1}\), \(T\) is the temperature, \(V\) is the potential of the sytem, and \(Z\) is the normalizing constant.
Training data
The trajectory data is \((x_i)_{1\le i \le n}\) with weights \((v_i)_{1\le i \le n}\), such that one can approximate the distribution \(\mu\) by
for test functions \(f\).
Representation of collective variables
In molecular applications, we often expect that the collective variables, denoted by \(\xi:\mathbb{R}^{d}\rightarrow \mathbb{R}^k\), are invariant under rotations and translations, or that \(\xi\) is a function of features (e.g. bond distances, angles). For this purpose, the training tasks in the module colvarsfinder.core
look for \(\xi\) that is of the form
where \(r:\mathbb{R}^{d}\rightarrow \mathbb{R}^{d_r}\) could be the action of certain alignment, a map to certain features, or even the identity map, and \(g\) is the map that we want to learn by training neural networks.
In the training tasks in colvarsfinder.core
, \(r\) is specified as the preprocessing layer in the input parameter which is a PyTorch neural network module, and \(g\) corresponds to (part of) the neural network model that is to be trained.
Loss function for training autoencoder
The class colvarsfinder.core.AutoEncoderTask
trains an encoder \(f_{enc}:\mathbb{R}^{d_r}\rightarrow \mathbb{R}^k\) and a decoder \(f_{dec}:\mathbb{R}^{k}\rightarrow \mathbb{R}^{d_r}\) by the reconstruction loss in the transformed space \(\mathbb{R}^{d_r}\):
where \(r_{\#}\mu\) denotes the pushforward measure of \(\mu\) by the map \(r\), and \(y_l = r(x_l)\).
After training, the collective variables are constructed as
Loss function for training eigenfunctions
The class colvarsfinder.core.EigenFunctionTask
finds the leading eigenfunctions \(\phi_1, \phi_2, \dots, \phi_k:\mathbb{R}^d\rightarrow \mathbb{R}\) of infinitesimal generator or transfer operator.
In the generator case, the generator is assumed to be
for a test function \(f\), and this class computes the eigenfunctions of PDE
corresponding to the \(k\) smallest eigenvalues \(0 < \lambda_1 \le \lambda_2 \le \cdots \le \lambda_k\). This is done by training neural network to learn functions \(g_1, g_2, \cdots, g_k:\mathbb{R}^{d_r}\rightarrow \mathbb{R}\) using the data-version of the loss
where
\(\mathbf{E}_{\mu}\) and \(\mbox{var}_{\mu}\) are the expectation and variance with respect to \(\mu\), respectively;
\(\alpha\) is the penalty parameter;
\(a\in \mathbb{R}^{d\times d}\) is a diagonal matrix;
\(\omega_1 \ge \omega_2 \ge \dots \ge \omega_k > 0\) are \(k\) positive constants;
\(f_i=g_i\circ r, 1\le i \le k\).
After training, the collective variables are constructed by
In the transfer operator case, assume the lag-time is \(\tau\) and the transition density at time \(\tau\) given the state \(x\) at time zero is \(p_\tau(\cdot|x)\). The loss function used to learn eigenfunctions is
In practice, with weighted trajectory data \(x^{(1)}, \cdots, x^{(n)}\) and assuming \(\tau=j\Delta t\), where \(\Delta t\) is the time interval between two consecutive states and \(j\) is an integer, then the first term in the loss function above is estimated using
Loss function for regularized autoencoders
The class colvarsfinder.core.RegAutoEncoderTask
learns regularized autoencoders using a loss that is the sum of the standard reconstruction loss and several regularization terms.
The model consists of an encoder \(f_{enc}:\mathbb{R}^{d_r}\rightarrow \mathbb{R}^k\) and a decoder \(f_{dec}:\mathbb{R}^{k}\rightarrow \mathbb{R}^{d_r}\), and regularizers \(\widetilde{f}_1,\cdots, \widetilde{f}_K:\mathbb{R}^k\rightarrow \mathbb{R}\). The loss involves two lag-times \(\tau_1,\tau_2 \ge 0\), as well as several other parameters. When \(\tau_2>0\), regularizers correspond to eigenfunctions of transfer operators, and the loss function is
where \(f_i = \widetilde{f}_i\circ f_{enc}\circ r\).
When \(\tau_2=0\), regularizers correspond to eigenfunctions of generators, and the loss is similar to the one above, except that the third line in the loss above is replaced by
References