Skip to content
Snippets Groups Projects
Commit 76302cdd authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Merge branch 'v2.5' of https://github.com/plumed/plumed2 into v2.5

parents bf139154 434cbf64
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ namespace analysis { ...@@ -30,7 +30,7 @@ namespace analysis {
This can be used to output the a histogram using the weighted histogram technique This can be used to output the a histogram using the weighted histogram technique
This shortcut action allows you to calculate a histogram using the weighted histogram This shortcut action allows you to calculate a histogram using the weighted histogram
analysis technique. For more detail on how this the weights for configurations are analysis technique. For more detail on how this the weights for configurations are
computed see \ref REWEIGHT_WHAM computed see \ref REWEIGHT_WHAM
\par Examples \par Examples
...@@ -41,7 +41,7 @@ single trajectory before running the following analysis script on the concatenat ...@@ -41,7 +41,7 @@ single trajectory before running the following analysis script on the concatenat
driver. The umbrella sampling simulations that will be analyzed using the script below applied a harmonic driver. The umbrella sampling simulations that will be analyzed using the script below applied a harmonic
restraint that restrained the torsional angle involving atoms 5, 7, 9 and 15 to particular values. The script restraint that restrained the torsional angle involving atoms 5, 7, 9 and 15 to particular values. The script
below calculates the reweighting weights for each of the trajectories and then applies the binless WHAM algorithm below calculates the reweighting weights for each of the trajectories and then applies the binless WHAM algorithm
to determine a weight for each configuration in the concatenated trajectory. A histogram is then constructed from to determine a weight for each configuration in the concatenated trajectory. A histogram is then constructed from
the configurations visited and their weights. This histogram is then converted into a free energy surface and output the configurations visited and their weights. This histogram is then converted into a free energy surface and output
to a file called fes.dat to a file called fes.dat
......
...@@ -35,7 +35,7 @@ analysis technique. For more detail on how this technique works see \ref REWEIG ...@@ -35,7 +35,7 @@ analysis technique. For more detail on how this technique works see \ref REWEIG
\par Examples \par Examples
The following input can be used to analyze the output from a series of umbrella sampling calculations. The following input can be used to analyze the output from a series of umbrella sampling calculations.
The trajectory from each of the simulations run with the different biases should be concatenated into a The trajectory from each of the simulations run with the different biases should be concatenated into a
single trajectory before running the following analysis script on the concatenated trajectory using PLUMED single trajectory before running the following analysis script on the concatenated trajectory using PLUMED
driver. The umbrella sampling simulations that will be analyzed using the script below applied a harmonic driver. The umbrella sampling simulations that will be analyzed using the script below applied a harmonic
restraint that restrained the torsional angle involving atoms 5, 7, 9 and 15 to particular values. The script restraint that restrained the torsional angle involving atoms 5, 7, 9 and 15 to particular values. The script
......
...@@ -27,28 +27,28 @@ ...@@ -27,28 +27,28 @@
/* /*
Calculate the weights for configurations using the weighted histogram analysis method. Calculate the weights for configurations using the weighted histogram analysis method.
Suppose that you have run multiple \f$N\f$ trajectories each of which was computed by integrating a different biased Hamiltonian. We can calculate the probability of observing Suppose that you have run multiple \f$N\f$ trajectories each of which was computed by integrating a different biased Hamiltonian. We can calculate the probability of observing
the set of configurations during the \f$N\f$ trajectories that we ran using the product of multinomial distributions shown below: the set of configurations during the \f$N\f$ trajectories that we ran using the product of multinomial distributions shown below:
\f[ \f[
P( \vec{T} ) \propto \prod_{j=1}^M \prod_{k=1}^N (c_k w_{kj} p_j)^{t_{kj}} P( \vec{T} ) \propto \prod_{j=1}^M \prod_{k=1}^N (c_k w_{kj} p_j)^{t_{kj}}
\label{eqn:wham1} \label{eqn:wham1}
\f] \f]
In this expression the second product runs over the biases that were used when calculating the \f$N\f$ trajectories. The first product then runs over the In this expression the second product runs over the biases that were used when calculating the \f$N\f$ trajectories. The first product then runs over the
\f$M\f$ bins in our histogram. The \f$p_j\f$ variable that is inside this product is the quantity we wish to extract; namely, the unbiased probability of \f$M\f$ bins in our histogram. The \f$p_j\f$ variable that is inside this product is the quantity we wish to extract; namely, the unbiased probability of
having a set of CV values that lie within the range for the \f$j\f$th bin. having a set of CV values that lie within the range for the \f$j\f$th bin.
The quantity that we can easily extract from our simulations, \f$t_{kj}\f$, however, measures the number of frames from trajectory \f$k\f$ that are inside the \f$j\f$th bin. The quantity that we can easily extract from our simulations, \f$t_{kj}\f$, however, measures the number of frames from trajectory \f$k\f$ that are inside the \f$j\f$th bin.
To interpret this quantity we must consider the bias that acts on each of the replicas so the \f$w_{kj}\f$ term is introduced. This quantity is calculated as: To interpret this quantity we must consider the bias that acts on each of the replicas so the \f$w_{kj}\f$ term is introduced. This quantity is calculated as:
\f[ \f[
w_{kj} = w_{kj} =
\f] \f]
and is essentially the factor that we have to multiply the unbiased probability of being in the bin by in order to get the probability that we would be inside this same bin in and is essentially the factor that we have to multiply the unbiased probability of being in the bin by in order to get the probability that we would be inside this same bin in
the \f$k\f$th of our biased simulations. Obviously, these \f$w_{kj}\f$ values depend on the value that the CVs take and also on the particular trajectory that we are investigating the \f$k\f$th of our biased simulations. Obviously, these \f$w_{kj}\f$ values depend on the value that the CVs take and also on the particular trajectory that we are investigating
all of which, remember, have different simulation biases. Finally, \f$c_k\f$ is a free parameter that ensures that, for each \f$k\f$, the biased probability is normalized. all of which, remember, have different simulation biases. Finally, \f$c_k\f$ is a free parameter that ensures that, for each \f$k\f$, the biased probability is normalized.
We can use the equation for the probability that was given above to find a set of values for \f$p_j\f$ that maximizes the likelihood of observing the trajectory. We can use the equation for the probablity that was given above to find a set of values for \f$p_j\f$ that maximizes the likelihood of observing the trajectory.
This constrained optimization must be performed using a set of Lagrange multipliers, \f$\lambda_k\f$, that ensure that each of the biased probability distributions This constrained optimization must be performed using a set of Lagrange multipliers, \f$\lambda_k\f$, that ensure that each of the biased probability distributions
are normalized, that is \f$\sum_j c_kw_{kj}p_j=1\f$. Furthermore, as the problem is made easier if the quantity in the equation above is replaced by its logarithm are normalized, that is \f$\sum_j c_kw_{kj}p_j=1\f$. Furthermore, as the problem is made easier if the quantity in the equation above is replaced by its logarithm
we actually chose to minimize we actually chose to minimize
\f[ \f[
\mathcal{L}= \sum_{j=1}^M \sum_{k=1}^N t_{kj} \ln c_k w_{kj} p_j + \sum_k\lambda_k \left( \sum_{j=1}^N c_k w_{kj} p_j - 1 \right) \mathcal{L}= \sum_{j=1}^M \sum_{k=1}^N t_{kj} \ln c_k w_{kj} p_j + \sum_k\lambda_k \left( \sum_{j=1}^N c_k w_{kj} p_j - 1 \right)
...@@ -60,8 +60,8 @@ p_j & \propto \frac{\sum_{k=1}^N t_{kj}}{\sum_k c_k w_{kj}} \\ ...@@ -60,8 +60,8 @@ p_j & \propto \frac{\sum_{k=1}^N t_{kj}}{\sum_k c_k w_{kj}} \\
c_k & =\frac{1}{\sum_{j=1}^M w_{kj} p_j} c_k & =\frac{1}{\sum_{j=1}^M w_{kj} p_j}
\end{aligned} \end{aligned}
\f] \f]
which can be solved by computing the \f$p_j\f$ values using the first of the two equations above with an initial guess for the \f$c_k\f$ values and by then refining which can be solved by computing the \f$p_j\f$ values using the first of the two equations above with an initial guess for the \f$c_k\f$ values and by then refining
these \f$p_j\f$ values using the \f$c_k\f$ values that are obtained by inserting the \f$p_j\f$ values obtained into the second of the two equations above. these \f$p_j\f$ values using the \f$c_k\f$ values that are obtained by inserting the \f$p_j\f$ values obtained into the second of the two equations above.
Notice that only \f$\sum_k t_{kj}\f$, which is the total number of configurations from all the replicas that enter the \f$j\f$th bin, enters the WHAM equations above. Notice that only \f$\sum_k t_{kj}\f$, which is the total number of configurations from all the replicas that enter the \f$j\f$th bin, enters the WHAM equations above.
There is thus no need to record which replica generated each of the frames. One can thus simply gather the trajectories from all the replicas together at the outset. There is thus no need to record which replica generated each of the frames. One can thus simply gather the trajectories from all the replicas together at the outset.
......
...@@ -97,9 +97,9 @@ void GridVessel::setBounds( const std::vector<std::string>& smin, const std::vec ...@@ -97,9 +97,9 @@ void GridVessel::setBounds( const std::vector<std::string>& smin, const std::vec
if( spacing.size()==dimension && binsin.size()==dimension ) { if( spacing.size()==dimension && binsin.size()==dimension ) {
if( spacing[i]==0 ) nbin[i] = binsin[i]; if( spacing[i]==0 ) nbin[i] = binsin[i];
else { else {
double range = max[i] - min[i]; nbin[i] = std::ceil( range / spacing[i]); double range = max[i] - min[i]; nbin[i] = std::ceil( range / spacing[i]);
// This check ensures that nbins is set correctly if spacing is set the same as the number of bins // This check ensures that nbins is set correctly if spacing is set the same as the number of bins
if( nbin[i]!=binsin[i] ) plumed_merror("mismatch between input spacing and input number of bins"); if( nbin[i]!=binsin[i] ) plumed_merror("mismatch between input spacing and input number of bins");
} }
} else if( binsin.size()==dimension ) nbin[i]=binsin[i]; } else if( binsin.size()==dimension ) nbin[i]=binsin[i];
else if( spacing.size()==dimension ) nbin[i] = std::floor(( max[i] - min[i] ) / spacing[i]) + 1; else if( spacing.size()==dimension ) nbin[i] = std::floor(( max[i] - min[i] ) / spacing[i]) + 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment