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

On-the-fly probability enhanced sampling with metadynamics-like target distribution.

This On-the-fly probability enhanced sampling (OPES) method with metadynamics-like target distribution is described in [58].

This OPES_METAD action samples target distributions defined via their marginal \(p^{\text{tg}}(\mathbf{s})\) over some collective variables (CVs), \(\mathbf{s}=\mathbf{s}(\mathbf{x})\). By default OPES_METAD targets the well-tempered distribution, \(p^{\text{WT}}(\mathbf{s})\propto [P(\mathbf{s})]^{1/\gamma}\), where \(\gamma\) is known as BIASFACTOR. Similarly to METAD, OPES_METAD optimizes the bias on-the-fly, with a given PACE. It does so by reweighting via kernel density estimation the unbiased distribution in the CV space, \(P(\mathbf{s})\). A compression algorithm is used to prevent the number of kernels from growing linearly with the simulation time. The bias at step \(n\) is

\[ V_n(\mathbf{s}) = (1-1/\gamma)\frac{1}{\beta}\log\left(\frac{P_n(\mathbf{s})}{Z_n}+\epsilon\right)\, . \]

See Ref.[58] for a complete description of the method.

As an intuitive picture, rather than gradually filling the metastable basins, OPES_METAD quickly tries to get a coarse idea of the full free energy surface (FES), and then slowly refines its details. It has a fast initial exploration phase, and then becomes extremely conservative and does not significantly change the shape of the deposited bias any more, reaching a regime of quasi-static bias. For this reason, it is possible to use standard umbrella sampling reweighting (see REWEIGHT_BIAS) to analyse the trajectory. At this link you can find some python scripts that work in a similar way to sum_hills, but the preferred way to obtain a FES with OPES is via reweighting (see opes-metad). The estimated \(c(t)\) is printed for reference only, since it should converge to a fixed value as the bias converges. This \(c(t)\) should NOT be used for reweighting. Similarly, the \(Z_n\) factor is printed only for reference, and it should converge when no new region of the CV-space is explored.

Notice that OPES_METAD is more sensitive to degenerate CVs than METAD. If the employed CVs map different metastable basins onto the same CV-space region, then OPES_METAD will remain stuck rather than completely reshaping the bias. This can be useful to diagnose problems with your collective variable. If it is not possible to improve the set of CVs and remove this degeneracy, then you might instead consider to use OPES_METAD_EXPLORE or METAD. In this way you will be able to obtain an estimate of the FES, but be aware that you most likely will not reach convergence and thus this estimate will be subjected to systematic errors (see e.g. Fig.3 in [90]). On the contrary, if your CVs are not degenerate but only suboptimal, you should converge faster by using OPES_METAD instead of METAD [58].

The parameter BARRIER should be set to be at least equal to the highest free energy barrier you wish to overcome. If it is much lower than that, you will not cross the barrier, if it is much higher, convergence might take a little longer. If the system has a basin that is clearly more stable than the others, it is better to start the simulation from there.

By default, the kernels SIGMA is adaptive, estimated from the fluctuations over ADAPTIVE_SIGMA_STRIDE simulation steps (similar to METAD ADAPTIVE=DIFF, but contrary to that, no artifacts are introduced and the bias will converge to the correct one). However, notice that depending on the system this might not be the optimal choice for SIGMA.

You can target a uniform flat distribution by explicitly setting BIASFACTOR=inf. However, this should be useful only in very specific cases.

It is possible to take into account also of other bias potentials besides the one of OPES_METAD during the internal reweighting for \(P(\mathbf{s})\) estimation. To do so, one has to add those biases with the EXTRA_BIAS keyword, as in the example below. This allows one to define a custom target distribution by adding another bias potential equal to the desired target free energy and setting BIASFACTOR=inf (see example below). Another possible usage of EXTRA_BIAS is to make sure that OPES_METAD does not push against another fixed bias added to restrain the CVs range (e.g. UPPER_WALLS).

Through the EXCLUDED_REGION keywork, it is possible to specify a region of CV space where no kernels will be deposited. This can be useful for example for making sure the bias does not modify the transition region, thus allowing for rate calculation. See below for an example of how to use this keyword.

Restart can be done from a KERNELS file, but it might be not perfect (due to limited precision when printing kernels to file, or if adaptive SIGMA is used). For an exact restart you must use STATE_RFILE to read a checkpoint with all the needed info. To save such checkpoints, define a STATE_WFILE and choose how often to print them with STATE_WSTRIDE. By default this file is overwritten, but you can instead append to it using the flag STORE_STATES.

Multiple walkers are supported only with MPI communication, via the keyword WALKERS_MPI.

Examples

Several examples can be found on the PLUMED-NEST website, by searching for the OPES keyword. The opes-metad can also be useful to get started with the method.

The following is a minimal working example:

Click on the labels of the actions for more information on what each action computes
tested on master
cv: DISTANCE 
ATOMS
the pair of atom that we are calculating the distance between.
=1,2 opes: OPES_METAD
ARG
the input for this action is the scalar output from one or more other actions.
=cv
PACE
compulsory keyword the frequency for kernel deposition
=200
BARRIER
compulsory keyword the free energy barrier to be overcome.
=40

Another more articulated one:

Click on the labels of the actions for more information on what each action computes
tested on master
phi: TORSION 
ATOMS
the four atoms involved in the torsional angle
=5,7,9,15 psi: TORSION
ATOMS
the four atoms involved in the torsional angle
=7,9,15,17 opes: OPES_METAD ...
FILE
compulsory keyword ( default=KERNELS ) a file in which the list of all deposited kernels is stored
=Kernels.data
TEMP
compulsory keyword ( default=-1 ) temperature.
=300
ARG
the input for this action is the scalar output from one or more other actions.
=phi,psi
PACE
compulsory keyword the frequency for kernel deposition
=500
BARRIER
compulsory keyword the free energy barrier to be overcome.
=50
SIGMA
compulsory keyword ( default=ADAPTIVE ) the initial widths of the kernels.
=0.15,0.15
SIGMA_MIN
never reduce SIGMA below this value
=0.01,0.01
STATE_RFILE
read from this file the compressed kernels and all the info needed to RESTART the simulation
=Restart.data
STATE_WFILE
write to this file the compressed kernels and all the info needed to RESTART the simulation
=State.data
STATE_WSTRIDE
number of MD steps between writing the STATE_WFILE.
=500*100
STORE_STATES
( default=off ) append to STATE_WFILE instead of ovewriting it each time
WALKERS_MPI
( default=off ) switch on MPI version of multiple walkers
NLIST
( default=off ) use neighbor list for kernels summation, faster but experimental
...

Next is an example of how to define a custom target distribution different from the well-tempered one. Here we chose to focus more on the transition state, that is around \(\phi=0\). Our target distribution is a Gaussian centered there, thus the target free energy we want to sample is a parabola, \(F^{\text{tg}}(\mathbf{s})=-\frac{1}{\beta} \log [p^{\text{tg}}(\mathbf{s})]\).

Click on the labels of the actions for more information on what each action computes
tested on master