Shortcut: LOGSUMEXP

Module landmarks
Description Usage
This action takes the exponential of a vector of logarithms and divides each element of the vector by the sum of the exponentials. used in 0 tutorialsused in 0 eggs
output value type
the logarithms of the input weights logweights that are computed with the log-sum weights formula vector

Further details and examples

This action takes the exponential of a vector of logarithms and divides each element of the vector by the sum of the exponentials.

If you has performed a simulation with a time-independent bias, V(x), you can recover the unbiased distribution from the trajectory by constructing a histogram in which the ith frame of the trajectory is given weight of:

wi=eβV(xi)jeβV(xj)

where xi is used to indicate the coordinates for frame i and β is the inverse temperature in units of energy. If the bias is large then it is easy for eβV(xi) to overflow. This action thus allows you to use the following trick is to compute the wi values in the above expression:

wi=eβ(V(xi)cwherec=βVmax+log[jeβV(xj)βVmax]

In this expression Vmax is the maximum value the bias took during the simulation.

The following example shows how you can write a PLUMED input that exploits this trick.

Click on the labels of the actions for more information on what each action computes
tested on2.11
# Calculate some CVs for later analysis
t1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
t2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=5,6,7,8
t3: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=9,10,11,12

# This computes the bias potential
r: RESTRAINTAdds harmonic and/or linear restraints on one or more variables. This action has hidden defaults. More details ARGthe values the harmonic restraint acts upon=t1 ATthe position of the restraint=pi/2 KAPPA specifies that the restraint is harmonic and what the values of the force constants on each of the variables are=10
# This calculates the instantaneous reweighting weight
# given the bias potential that is acting upon the system
bw: REWEIGHT_BIASCalculate weights for ensemble averages that negate the effect the bias has on the region of phase space explored This action has hidden defaults. More details TEMPthe system temperature=300

# This collects our data for later analysis and the reweighting weights cc: COLLECT_FRAMESCollect atomic positions or argument values from the trajectory for later analysis This action is a shortcut and it has hidden defaults. More details ARGthe labels of the values whose time series you would like to collect for later analysis=t1,t2,t3 LOGWEIGHTSlist of actions that calculates log weights that should be used to weight configurations when calculating averages=bw
# And this determines the final vector of weights that should be used for histograms and so on. weights: LOGSUMEXPThis action takes the exponential of a vector of logarithms and divides each element of the vector by the sum of the exponentials. This action is a shortcut. More details ARGthe vector of logweights that you would like to normalise using the logsumexp trick=cc_logweights
# This outputs the time series of reweighting weights to a file DUMPVECTORPrint a vector to a file More details ARGthe labels of vectors/matrices that should be output in the file=weights FILE the file on which to write the vetors=weights

Syntax

The following table describes the keywords and options that can be used with this action

Keyword Type Default Description
ARG compulsory none the vector of logweights that you would like to normalise using the logsumexp trick