Skip to content

Action: EDS

Module eds
Description Usage
Add a linear bias on a set of observables. used in 1 tutorialsused in 1 eggs

Details and examples

Add a linear bias on a set of observables.

This force is the same as the linear part of the bias in RESTRAINT, but this bias has the ability to compute the prefactors adaptively using the scheme of White and Voth that is discussed in the first paper cited below in order to match target observable values for a set of CVs. Further updates to the algorithm are described in the second paper cited below. The third paper cited below is a review on the method and its applications.

You can see a tutorial on EDS specifically for biasing coordination number at Andrew White's webpage.

The addition to the potential is of the form

where for CV , a coupling constant is determined adaptively or set by the user to match a target value for . is a scale parameter, which by default is set to the target value. It may also be set separately.

Notice that a similar method is available as MAXENT, although with different features and using a different optimization algorithm.

Warning

It is not possible to set the target value of the observable to zero with the default value of as this will cause a divide-by-zero error. Instead, set or modify the CV so the desired target value is no longer zero.

Virial

The bias forces modify the virial and this can change your simulation density if the bias is used in an NPT simulation. One way to avoid changing the virial contribution from the bias is to add the keyword VIRIAL=1.0, which changes how the bias is computed to minimize its contribution to the virial. This can also lead to smaller magnitude biases that are more robust if transferred to other systems. VIRIAL=1.0 can be a reasonable starting point and increasing the value changes the balance between matching the set-points and minimizing the virial. See \cite Amirkulova2019Recent for details on the equations. Since the coupling constants are unique with a single CV, VIRIAL is not applicable with a single CV. When used with multiple CVs, the CVs should be correlated which is almost always the case.

Weighting

EDS computes means and variances as part of its algorithm. If you are also using a biasing method like metadynamics, you may wish to remove the effect of this bias in your EDS computations so that EDS works on the canonical values (reweighted to be unbiased). For example, you may be using metadynamics to bias a dihedral angle to enhance sampling and be using EDS to set the average distance between two particular atoms. Specifically:

Click on the labels of the actions for more information on what each action computes
tested on2.11
# set-up metadynamics
t: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
md: METADUsed to performed metadynamics on one or more collective variables. More details ARGthe labels of the scalars on which the bias will act=d SIGMAthe widths of the Gaussian hills=0.2 HEIGHTthe heights of the Gaussian hills=0.3 PACEthe frequency for hill addition=500 TEMPthe system temperature - this is only needed if you are doing well-tempered metadynamics=300
# compute bias weights
bias: REWEIGHT_METADCalculate the weights configurations should contribute to the histogram in a simulation in which a metadynamics bias acts upon the system. More details TEMPthe system temperature=300
# now do EDS on distance while removing effect of metadynamics
d: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=4,7
eds: EDSAdd a linear bias on a set of observables. More details ARGthe labels of the scalars on which the bias will act=d CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=3.0 PERIODSteps over which to adjust bias for adaptive or ramping=100 TEMPThe system temperature=300 LOGWEIGHTSAdd weights to use for computing statistics=bias

This is an approximation though because EDS uses a finite samples while running to get means/variances. At the end of a run, you should ensure this approach worked and indeed your reweighted CV matches the target value.

Examples

The following input for a harmonic oscillator of two beads will adaptively find a linear bias to change the mean and variance to the target values. The PRINT line shows how to access the value of the coupling constants.

Click on the labels of the actions for more information on what each action computes
tested on2.11
dist: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
# this is the squared of the distance
dist2: COMBINECalculate a polynomial combination of a set of other variables. More details ARGthe values input to this function=dist POWERS the powers to which you are raising each of the arguments in your function=2 PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO

# bias mean and variance
eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=dist,dist2 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0,1.0 PERIODSteps over which to adjust bias for adaptive or ramping=100 TEMPThe system temperature=1.0
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=dist,dist2,eds.dist_coupling,eds.dist2_coupling,eds.bias,eds.force2 FILEthe name of the file on which to output these quantities=colvars.dat STRIDE the frequency with which the quantities of interest should be output=100

Rather than trying to find the coupling constants adaptively, one can ramp up to a constant value.

Click on the labels of the actions for more information on what each action computes
tested on2.11
dist: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
dist2: COMBINECalculate a polynomial combination of a set of other variables. More details ARGthe values input to this function=dist POWERS the powers to which you are raising each of the arguments in your function=2 PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO

# ramp couplings from 0,0 to -1,1 over 50000 steps
eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=dist,dist2 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0,1.0 FIXED Fixed target values for coupling constant=-1,1 RAMP Slowly increase bias constant to a fixed value PERIODSteps over which to adjust bias for adaptive or ramping=50000 TEMPThe system temperature=1.0

# same as above, except starting at -0.5,0.5 rather than default of 0,0 eds2: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=dist,dist2 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0,1.0 FIXED Fixed target values for coupling constant=-1,1 INIT Starting value for coupling constant=-0.5,0.5 RAMP Slowly increase bias constant to a fixed value PERIODSteps over which to adjust bias for adaptive or ramping=50000 TEMPThe system temperature=1.0

A restart file can be added to dump information needed to restart/continue simulation using these parameters every PERIOD.

Click on the labels of the actions for more information on what each action computes
tested on2.11
dist: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
dist2: COMBINECalculate a polynomial combination of a set of other variables. More details ARGthe values input to this function=dist POWERS the powers to which you are raising each of the arguments in your function=2 PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO

# add the option to write to a restart file
eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=dist,dist2 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0,1.0 PERIODSteps over which to adjust bias for adaptive or ramping=100 TEMPThe system temperature=1.0 OUT_RESTARTOutput file for all information needed to continue EDS simulation=checkpoint.eds

You can see extracts from the restart files that are output from these simulations in the following example inputs that fallow as these read in the restart file.

Read in a previous restart file. Adding RESTART flag makes output append

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=extras/restart.eds
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2

eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=d1 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0 PERIODSteps over which to adjust bias for adaptive or ramping=100 TEMPThe system temperature=1.0 IN_RESTARTRead this file to continue an EDS simulation=
extras/restart.eds
Click here to see an extract from this file.
×

FILE: extras/restart.eds

#! FIELDS time d1_center d1_set d1_target d1_coupling d1_maxrange d1_maxgrad d1_accum d1_mean d1_std
#! SET adaptive  1
#! SET update_period  1
#! SET seed  0
#! SET kbt    2.4943
   0.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   1.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   2.0000   1.0000  -7.4830   0.0000   0.0000   7.4830   0.1497   0.0224   0.0000   0.0000
   3.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
   4.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
RESTARTallows per-action setting of restart (YES/NO/AUTO)=YES

Read in a previous restart file and freeze the bias at the final level from the previous simulation

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=extras/restart.eds
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2

eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=d1 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0 TEMPThe system temperature=1.0 IN_RESTARTRead this file to continue an EDS simulation=
extras/restart.eds
Click here to see an extract from this file.
×

FILE: extras/restart.eds

#! FIELDS time d1_center d1_set d1_target d1_coupling d1_maxrange d1_maxgrad d1_accum d1_mean d1_std
#! SET adaptive  1
#! SET update_period  1
#! SET seed  0
#! SET kbt    2.4943
   0.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   1.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   2.0000   1.0000  -7.4830   0.0000   0.0000   7.4830   0.1497   0.0224   0.0000   0.0000
   3.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
   4.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
FREEZE Fix bias at current level (only used for restarting)

Read in a previous restart file and freeze the bias at the mean from the previous simulation

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=extras/restart.eds
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2

eds: EDSAdd a linear bias on a set of observables. This action has hidden defaults. More details ARGthe labels of the scalars on which the bias will act=d1 CENTERThe desired centers (equilibrium values) which will be sought during the adaptive linear biasing=2.0 TEMPThe system temperature=1.0 IN_RESTARTRead this file to continue an EDS simulation=
extras/restart.eds
Click here to see an extract from this file.
×

FILE: extras/restart.eds

#! FIELDS time d1_center d1_set d1_target d1_coupling d1_maxrange d1_maxgrad d1_accum d1_mean d1_std
#! SET adaptive  1
#! SET update_period  1
#! SET seed  0
#! SET kbt    2.4943
   0.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   1.0000   1.0000   0.0000   0.0000   0.0000   7.4830   0.1497   0.0000   0.0000   0.0000
   2.0000   1.0000  -7.4830   0.0000   0.0000   7.4830   0.1497   0.0224   0.0000   0.0000
   3.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
   4.0000   1.0000  -7.4830   0.0000  -7.4830   7.4830   0.1497   0.0224   0.0000   0.0000
FREEZE Fix bias at current level (only used for restarting) MEAN Instead of using final bias level from restart, use average

Input

The arguments that serve as the input for this action are specified using one or more of the keywords in the following table.

Keyword Type Description
ARG scalar the labels of the scalars on which the bias will act
CENTER_ARG scalar The desired centers (equilibrium values) which will be sought during the adaptive linear biasing
LOGWEIGHTS scalar Add weights to use for computing statistics

Output components

This action calculates the values in the following table. These values can be referenced elsewhere in the input by using this Action's label followed by a dot and the name of the value required from the list below.

Name Type Description
bias scalar the instantaneous value of the bias potential
force2 scalar squared value of force from the bias
pressure scalar If using virial keyword, this is the current sum of virial terms
_coupling scalar For each named CV biased, there will be a corresponding output CV_coupling storing the current linear bias prefactor

Full list of keywords

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

Keyword Type Default Description
ARG input none the labels of the scalars on which the bias will act
CENTER_ARGThis keyword do not have examples input none The desired centers (equilibrium values) which will be sought during the adaptive linear biasing
LOGWEIGHTS input none Add weights to use for computing statistics
RANGE compulsory 25.0 The (starting) maximum increase in coupling constant per PERIOD (in k_B T/[BIAS_SCALE unit]) for each CV biased
SEED compulsory 0 Seed for random order of changing bias
INIT compulsory 0 Starting value for coupling constant
FIXED compulsory 0 Fixed target values for coupling constant
LM_MIXING compulsory 1 Initial mixing parameter when using Levenberg-Marquadt minimization
NUMERICAL_DERIVATIVESThis keyword do not have examples optional false calculate the derivatives for these quantities numerically
CENTER optional not used The desired centers (equilibrium values) which will be sought during the adaptive linear biasing
PERIOD optional not used Steps over which to adjust bias for adaptive or ramping
BIAS_SCALEThis keyword do not have examples optional not used A divisor to set the units of the bias
TEMP optional not used The system temperature
MULTI_PROPThis keyword do not have examples optional not used What proportion of dimensions to update at each step
VIRIALThis keyword do not have examples optional not used Add an update penalty for having non-zero virial contributions
LMThis keyword do not have examples optional false Use Levenberg-Marquadt algorithm along with simultaneous keyword
RESTART_FMTThis keyword do not have examples optional not used the format that should be used to output real numbers in EDS restarts
OUT_RESTART optional not used Output file for all information needed to continue EDS simulation
IN_RESTART optional not used Read this file to continue an EDS simulation
RAMP optional false Slowly increase bias constant to a fixed value
COVARThis keyword do not have examples optional false Utilize the covariance matrix when updating the bias
FREEZE optional false Fix bias at current level (only used for restarting)
MEAN optional false Instead of using final bias level from restart, use average
RESTART optional not used allows per-action setting of restart (YES/NO/AUTO)

References

More information about how this action can be used is available in the following articles: