REWEIGHT_TEMP_PRESS

This is part of the bias module |

Calculate weights for ensemble averages at temperatures and/or pressures different than those used in your original simulation.

We can use our knowledge of the probability distribution in the canonical (N \(\mathcal{V}\)T) or the isothermal-isobaric ensemble (NPT) to reweight the data contained in trajectories and obtain ensemble averages at different temperatures and/or pressures.

Consider the ensemble average of an observable \(O(\mathbf{R},\mathcal{V})\) that depends on the atomic coordinates \(\mathbf{R}\) and the volume \(\mathcal{V}\). This observable is in practice any collective variable (CV) calculated by Plumed. The ensemble average of the observable in an ensemble \( \xi' \) can be calculated from a simulation performed in an ensemble \( \xi \) using:

\[ \langle O(\mathbf{R},\mathcal{V}) \rangle_{\xi'} = \frac{\langle O(\mathbf{R},\mathcal{V}) w(\mathbf{R},\mathcal{V}) \rangle_{\xi}} {\langle w(\mathbf{R},\mathcal{V}) \rangle_{\xi}} \]

where \(\langle \cdot \rangle_{\xi}\) and \(\langle \cdot \rangle_{\xi'}\) are mean values in the simulated and targeted ensemble, respectively, \( E(\mathbf{R}) \) is the potential energy of the system, and \( w (\mathbf{R},\mathcal{V}) \) are the appropriate weights to take from \( \xi \) to \( \xi' \). This action calculates the weights \( w (\mathbf{R},\mathcal{V}) \) and handles 4 different cases:

- Change of temperature from T to T' at constant volume. That is to say, from a simulation performed in the N \(\mathcal{V}\)T (canonical) ensemble, obtain an ensemble average in the N \(\mathcal{V}\)T' ensemble. The weights in this case are \( w(\mathbf{R},\mathcal{V}) = e^{(\beta-\beta')E(\mathbf{R})} \) with \( \beta \) and \( \beta' \) the inverse temperatures.
- Change of temperature from T to T' at constant pressure. That is to say, from a simulation performed in the NPT (isothermal-isobaric) ensemble, obtain an ensemble average in the NPT' ensemble. The weights in this case are \( w(\mathbf{R},\mathcal{V}) = e^{(\beta-\beta')(E(\mathbf{R}) + P\mathcal{V}) } \).
- Change of pressure from P to P' at constant temperature. That is to say, from a simulation performed in the NPT (isothermal-isobaric) ensemble, obtain an ensemble average in the NP'T ensemble. The weights in this case are \( w(\mathbf{R},\mathcal{V}) = e^{\beta (P - P') \mathcal{V}} \).
- Change of temperature and pressure from T,P to T',P'. That is to say, from a simulation performed in the NPT (isothermal-isobaric) ensemble, obtain an ensemble average in the NP'T' ensemble. The weights in this case are \( w(\mathbf{R},\mathcal{V}) = e^{(\beta-\beta')E(\mathbf{R}) + (\beta P - \beta' P') \mathcal{V}} \).

These weights can be used in any action that computes ensemble averages. For example this action can be used in tandem with HISTOGRAM or AVERAGE.

The above equation is often impractical since the overlap between the distributions of energy and volume at different temperatures and pressures is only significant for neighboring temperatures and pressures. For this reason an unbiased simulation is of little use to reweight at different temperatures and/or pressures. A successful approach has been altering the probability of observing a configuration in order to increase this overlap [107]. This is done through a bias potential \( V(\mathbf{s}) \) where \( \mathbf{s} \) is a set of CVs, that often is the energy (and possibly the volume). In order to calculate ensemble averages, also the effect of this bias must be taken into account. The ensemble average of the observable in the ensemble \( \xi' \) can be calculated from a biased simulation performed in the ensemble \(\xi\) with bias \( V(\mathbf{s}) \) using:

\[ \langle O(\mathbf{R},\mathcal{V}) \rangle_{\xi'} = \frac{\langle O(\mathbf{R},\mathcal{V}) w (\mathbf{R},\mathcal{V}) e^{\beta V(\mathbf{s})} \rangle_{\xi,V}} {\langle w (\mathbf{R},\mathcal{V}) e^{\beta V(\mathbf{s})} \rangle_{\xi,V}} \]

where \(\langle \cdot \rangle_{\xi,V}\) is a mean value in the biased ensemble with static bias \( V(\mathbf{s}) \). Therefore in order to reweight the trajectory at different temperatures and/or pressures one must use the weights calculated by this action \( w (\mathbf{R},\mathcal{V}) \) together with the weights of REWEIGHT_BIAS (see the examples below).

The bias potential \( V(\mathbf{s}) \) can be constructed with METAD using ENERGY as a CV [75]. More specialized tools are available, for instance using bespoke target distributions such as TD_MULTICANONICAL and TD_MULTITHERMAL_MULTIBARIC [83] [84] within Variationally Enhanced Sampling (VES code). In the latter algorithms the interval of temperatures and pressures in which the trajectory can be reweighted is chosen explicitly.

- Examples

We consider the 4 cases described above.

The following input can be used to postprocess a molecular dynamics trajectory of a system of 1000 particles run at 500 K and constant volume using a static bias potential.

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

energy:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the fileenergyIGNORE_TIME( default=off ) ignore the time in the colvar file.distance:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filedistanceIGNORE_TIME( default=off ) ignore the time in the colvar file.mybias:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filemybias.biasIGNORE_TIME# Shift energy (to avoid numerical issues)( default=off ) ignore the time in the colvar file.renergy:COMBINEARG=the input for this action is the scalar output from one or more other actions.energyPARAMETERS=-13250compulsory keyword ( default=0.0 )the parameters of the arguments in your functionPERIODIC=NO # Weightscompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.bias_weights:REWEIGHT_BIASTEMP=500the system temperature.ARG=compulsory keyword ( default=*.bias )the biases that must be taken into account when reweightingmybias.biastemp_press_weights:REWEIGHT_TEMP_PRESSTEMP=500the system temperature.REWEIGHT_TEMP=300Reweighting temperatureENERGY=Energyrenergy# Ensemble average of the distance at 300 Kavg_dist:AVERAGEARG=the input for this action is the scalar output from one or more other actions.distanceLOGWEIGHTS=list of actions that calculates log weights that should be used to weight configurations when calculating averagesbias_weights,temp_press_weightsPRINTARG=the input for this action is the scalar output from one or more other actions.avg_distFILE=COLVAR_REWEIGHTthe name of the file on which to output these quantitiesSTRIDE=1compulsory keyword ( default=1 )the frequency with which the quantities of interest should be output

Clearly, in performing the analysis above we would read from the potential energy, a distance, and the value of the bias potential from a COLVAR file like the one shown below. We would then be able to calculate the ensemble average of the distance at 300 K.

#! FIELDS time energy volume mybias.bias distance 10000.000000 -13133.769283 7.488921 63.740530 0.10293 10001.000000 -13200.239722 7.116548 36.691988 0.16253 10002.000000 -13165.108850 7.202273 44.408815 0.17625

The next three inputs can be used to postprocess a molecular dynamics trajectory of a system of 1000 particles run at 500 K and 1 bar using a static bias potential.

We read from a file COLVAR the potential energy, the volume, and the value of the bias potential and calculate the ensemble average of the (particle) density at 300 K and 1 bar (the simulation temperature was 500 K).

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

energy:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the fileenergyIGNORE_TIME( default=off ) ignore the time in the colvar file.volume:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filevolumeIGNORE_TIME( default=off ) ignore the time in the colvar file.mybias:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filemybias.biasIGNORE_TIME# Shift energy and volume (to avoid numerical issues)( default=off ) ignore the time in the colvar file.rvol:COMBINEARG=the input for this action is the scalar output from one or more other actions.volumePARAMETERS=7.8compulsory keyword ( default=0.0 )the parameters of the arguments in your functionPERIODIC=NOcompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.renergy:COMBINEARG=the input for this action is the scalar output from one or more other actions.energyPARAMETERS=-13250compulsory keyword ( default=0.0 )the parameters of the arguments in your functionPERIODIC=NO # Weightscompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.bias_weights:REWEIGHT_BIASTEMP=500the system temperature.ARG=compulsory keyword ( default=*.bias )the biases that must be taken into account when reweightingmybias.biastemp_press_weights:REWEIGHT_TEMP_PRESSTEMP=500the system temperature.REWEIGHT_TEMP=300Reweighting temperaturePRESSURE=0.06022140857The system pressureENERGY=EnergyrenergyVOLUME=Volumervol# Ensemble average of the volume at 300 Kavg_vol:AVERAGEARG=the input for this action is the scalar output from one or more other actions.volumeLOGWEIGHTS=list of actions that calculates log weights that should be used to weight configurations when calculating averagesbias_weights,temp_press_weights# Ensemble average of the density at 300 Kavg_density:CUSTOMARG=the input for this action is the scalar output from one or more other actions.avg_volFUNC=1000/xcompulsory keywordthe function you wish to evaluatecompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.ARG=the input for this action is the scalar output from one or more other actions.avg_densityFILE=COLVAR_REWEIGHTthe name of the file on which to output these quantitiesSTRIDE=1compulsory keyword ( default=1 )the frequency with which the quantities of interest should be output

In the next example we calculate the ensemble average of the (particle) density at 500 K and 300 MPa (the simulation pressure was 1 bar).

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

volume:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filevolumeIGNORE_TIME( default=off ) ignore the time in the colvar file.mybias:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filemybias.biasIGNORE_TIME# Shift volume (to avoid numerical issues)( default=off ) ignore the time in the colvar file.rvol:COMBINEARG=the input for this action is the scalar output from one or more other actions.volumePARAMETERS=7.8compulsory keyword ( default=0.0 )the parameters of the arguments in your functioncompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.bias_weights:REWEIGHT_BIASTEMP=500the system temperature.ARG=compulsory keyword ( default=*.bias )the biases that must be taken into account when reweightingmybias.biastemp_press_weights:REWEIGHT_TEMP_PRESSTEMP=500the system temperature.PRESSURE=0.06022140857The system pressureREWEIGHT_PRESSURE=180.66422571Reweighting pressureVOLUME=Volumevolume# Ensemble average of the volume at 300 K and 300 MPaavg_vol:AVERAGEARG=the input for this action is the scalar output from one or more other actions.volumeLOGWEIGHTS=list of actions that calculates log weights that should be used to weight configurations when calculating averagesbias_weights,temp_press_weights# Ensemble average of the density at 300 K and 300 MPaavg_density:CUSTOMARG=the input for this action is the scalar output from one or more other actions.avg_volFUNC=1000/xcompulsory keywordthe function you wish to evaluatecompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.ARG=the input for this action is the scalar output from one or more other actions.avg_densityFILE=COLVAR_REWEIGHTthe name of the file on which to output these quantitiesSTRIDE=1compulsory keyword ( default=1 )the frequency with which the quantities of interest should be output

In this final example we calculate the ensemble average of the (particle) density at 300 K and 300 MPa (the simulation temperature and pressure were 500 K and 1 bar).

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

energy:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the fileenergyIGNORE_TIME( default=off ) ignore the time in the colvar file.volume:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filevolumeIGNORE_TIME( default=off ) ignore the time in the colvar file.mybias:READFILE=COLVARcompulsory keywordthe name of the file from which to read these quantitiesVALUES=compulsory keywordthe values to read from the filemybias.biasIGNORE_TIME# Shift energy and volume (to avoid numerical issues)( default=off ) ignore the time in the colvar file.rvol:COMBINEARG=the input for this action is the scalar output from one or more other actions.volumePARAMETERS=7.8compulsory keyword ( default=0.0 )the parameters of the arguments in your functioncompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.renergy:COMBINEARG=the input for this action is the scalar output from one or more other actions.energyPARAMETERS=-13250compulsory keyword ( default=0.0 )the parameters of the arguments in your functioncompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.bias_weights:REWEIGHT_BIASTEMP=500the system temperature.compulsory keyword ( default=*.bias )the biases that must be taken into account when reweightingmybias.biastemp_press_weights:REWEIGHT_TEMP_PRESSTEMP=500the system temperature.REWEIGHT_TEMP=300Reweighting temperaturePRESSURE=0.06022140857The system pressureREWEIGHT_PRESSURE=180.66422571Reweighting pressureENERGY=EnergyrenergyVOLUME=Volumervol# Ensemble average of the volume at 300 K and 300 MPaavg_vol:AVERAGEARG=the input for this action is the scalar output from one or more other actions.volumebias_weights,temp_press_weights# Ensemble average of the density at 300 K and 300 MPaavg_density:CUSTOMARG=the input for this action is the scalar output from one or more other actions.avg_volFUNC=1000/xcompulsory keywordthe function you wish to evaluatecompulsory keywordif the output of your function is periodic then you should specify the periodicity of the function.ARG=the input for this action is the scalar output from one or more other actions.avg_densityFILE=COLVAR_REWEIGHTthe name of the file on which to output these quantitiescompulsory keyword ( default=1 )the frequency with which the quantities of interest should be output

- Glossary of keywords and components

- Options

TEMP | the system temperature. This is not required if your MD code passes this quantity to PLUMED |

ENERGY | Energy |

VOLUME | Volume |

REWEIGHT_PRESSURE | Reweighting pressure |

PRESSURE | The system pressure |

REWEIGHT_TEMP | Reweighting temperature |