Skip to content

Action: DUMPGRID

Module gridtools
Description Usage
Output the function on the grid to a file with the PLUMED grid format. used in 9 tutorialsused in 30 eggs
This action outputs data to a file. You can read more about how PLUMED manages output files here

Details and examples

Output the function on the grid to a file with the PLUMED grid format.

PLUMED provides a number of actions that calculate the values of functions on grids. For instance, whenever you calculate a free energy as a function of a collective variable using KDE, HISTOGRAM and CONVERT_TO_FES you will generally want to output the value of the free energy at a number of points on a discrete grid that covers the CV space uniformly. Alternatively you may want to calculate what value some symmetry function takes at different points inside your simulation cell using MULTICOLVARDENS or some suitable combination of CUSTOM actions.

This action allows you to output these functions calculated on a grid using a format that can be read in using gnuplot and other such plotting programs. The file output using this action will have a header that contains some essential information about the function plotted and that looks something like this:

#! FIELDS x y hA1 dhA1_x dhA1_x
#! SET normalisation    2.0000
#! SET min_x 0.0
#! SET max_x 3.0
#! SET nbins_x  100
#! SET periodic_x false
#! SET min_y 0.0
#! SET max_y 3.0
#! SET nbins_y  100
#! SET periodic_y false

The header shown here tells us that we have grid showing the values that a function with two arguments x and y takes at various points in our cell. The lines beneath the first line then tell us a little bit about these two input arguments.

The remaining lines of the file give us information on the positions of our grid points and the value the function and its partial derivatives with respect to x and y. If the header is as above a list of values of the function that have x=0 and 100 values of y between 0.0 and 3.0 will be provided. This block of data will be followed with a blank line. There will then be a second block of values which will all have been evaluated the same value of x and all possible values for y. This block is then followed by a blank line again and this pattern continues until all points of the grid have been covered.

Examples

The following input monitors two torsional angles during a simulation and outputs a continuous histogram as a function of them at the end of the simulation.

Click on the labels of the actions for more information on what each action computes
tested on2.11
r1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
r2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=2,3,4,5
hh: HISTOGRAMAccumulate the average probability density along a few CVs from a trajectory. This action is a shortcut and it has hidden defaults. More details ...
  ARGthe quantities that are being used to construct the histogram=r1,r2
  GRID_MIN the lower bounds for the grid=-3.14,-3.14
  GRID_MAX the upper bounds for the grid=3.14,3.14
  GRID_BINthe number of bins for the grid=200,200
  BANDWIDTHthe bandwidths for kernel density esimtation=0.05,0.05
...

DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=hh FILE the file on which to write the grid=histo

The following input monitors two torsional angles during a simulation and outputs a discrete histogram as a function of them at the end of the simulation. In this input we have also used the FMT keyword to control the appearance of the numbers in the output file.

Click on the labels of the actions for more information on what each action computes
tested on2.11
r1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
r2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=2,3,4,5
hh: HISTOGRAMAccumulate the average probability density along a few CVs from a trajectory. This action is a shortcut and it has hidden defaults. More details ...
  ARGthe quantities that are being used to construct the histogram=r1,r2
  KERNEL the kernel function you are using=DISCRETE
  GRID_MIN the lower bounds for the grid=-3.14,-3.14
  GRID_MAX the upper bounds for the grid=3.14,3.14
  GRID_BINthe number of bins for the grid=200,200
...

DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=hh FILE the file on which to write the grid=histo FMTthe format that should be used to output real numbers=%10.6f

The following input monitors two torsional angles during a simulation and outputs the histogram accumulated thus far every 100000 steps.

Click on the labels of the actions for more information on what each action computes
tested on2.11
r1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
r2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=2,3,4,5
hh: HISTOGRAMAccumulate the average probability density along a few CVs from a trajectory. This action is a shortcut and it has hidden defaults. More details ...
  ARGthe quantities that are being used to construct the histogram=r1,r2
  GRID_MIN the lower bounds for the grid=-3.14,-3.14
  GRID_MAX the upper bounds for the grid=3.14,3.14
  GRID_BINthe number of bins for the grid=200,200
  BANDWIDTHthe bandwidths for kernel density esimtation=0.05,0.05
...

DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=hh FILE the file on which to write the grid=histo STRIDE the frequency with which the grid should be output to the file=100000

By default each of the histogram estimates are output to separate files. There will thus be one file called analysis.0.histo which contains the histogram that was obtained from the first 100000 steps of the simulation. The file analysis.1.histo contains the histogram that was obtained from the first 200000 steps of the simulation and so on until the final estimate of the histogram is output to a file called histo. If you would like to output all estimates of the histogram to a single file you can use the PRINT_ONE_FILE keyword as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
r1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
r2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=2,3,4,5
hh: HISTOGRAMAccumulate the average probability density along a few CVs from a trajectory. This action is a shortcut and it has hidden defaults. More details ...
  ARGthe quantities that are being used to construct the histogram=r1,r2
  GRID_MIN the lower bounds for the grid=-3.14,-3.14
  GRID_MAX the upper bounds for the grid=3.14,3.14
  GRID_BINthe number of bins for the grid=200,200
  BANDWIDTHthe bandwidths for kernel density esimtation=0.05,0.05
...

DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=hh FILE the file on which to write the grid=histo STRIDE the frequency with which the grid should be output to the file=100000 PRINT_ONE_FILE output grids one after the other in a single file

Now all estimates of the histogram are contained in a single file called histo.

The following input monitors two torsional angles during a simulation and outputs a separate histogram for each 100000 steps worth of trajectory. Notice how the CLEAR keyword is used here and how it is not used in the previous two examples.

Click on the labels of the actions for more information on what each action computes
tested on2.11
r1: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=1,2,3,4
r2: TORSIONCalculate one or multiple torsional angles. More details ATOMSthe four atoms involved in the torsional angle=2,3,4,5
hh: HISTOGRAMAccumulate the average probability density along a few CVs from a trajectory. This action is a shortcut and it has hidden defaults. More details ...
  ARGthe quantities that are being used to construct the histogram=r1,r2 CLEAR the frequency with whihc to clear the data that is being averaged=100000
  GRID_MIN the lower bounds for the grid=-3.14,-3.14
  GRID_MAX the upper bounds for the grid=3.14,3.14
  GRID_BINthe number of bins for the grid=200,200
  BANDWIDTHthe bandwidths for kernel density esimtation=0.05,0.05
...

DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details ARGthe label for the grid that you would like to output=hh FILE the file on which to write the grid=histo STRIDE the frequency with which the grid should be output to the file=100000

Working with Fibonacci grids

If you have accumulated a histogram using the SPHERICAL_KDE keyword as has been done in the following input, we recommend you use the PRINT_XYZ keyword when using DUMPGRID as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMS1the pair of atom that we are calculating the distance between=1,2 ATOMS2the pair of atom that we are calculating the distance between=1,3 ATOMS3the pair of atom that we are calculating the distance between=1,4 ATOMS4the pair of atom that we are calculating the distance between=1,5 ATOMS5the pair of atom that we are calculating the distance between=2,3 ATOMS6the pair of atom that we are calculating the distance between=2,4 ATOMS7the pair of atom that we are calculating the distance between=2,5 ATOMS8the pair of atom that we are calculating the distance between=3,4 ATOMS9the pair of atom that we are calculating the distance between=3,5 ATOMS10the pair of atom that we are calculating the distance between=4,5
d1lt: LESS_THANUse a switching function to determine how many of the input variables are less than a certain cutoff. More details ARGthe values input to this function=d1 SWITCHThis keyword is used if you want to employ an alternative to the continuous swiching function defined above={RATIONAL D_0=2.0 R_0=0.5 D_MAX=5.0}
d1lts: SUMCalculate the sum of the arguments More details ARGthe vector/matrix/grid whose elements shuld be added together=d1lt PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
d1c: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMS1the pair of atom that we are calculating the distance between=2,1 ATOMS2the pair of atom that we are calculating the distance between=3,1 ATOMS3the pair of atom that we are calculating the distance between=4,1 ATOMS4the pair of atom that we are calculating the distance between=5,1 ATOMS5the pair of atom that we are calculating the distance between=3,2 ATOMS6the pair of atom that we are calculating the distance between=4,2 ATOMS7the pair of atom that we are calculating the distance between=5,2 ATOMS8the pair of atom that we are calculating the distance between=4,3 ATOMS9the pair of atom that we are calculating the distance between=5,3 ATOMS10the pair of atom that we are calculating the distance between=5,4 COMPONENTS calculate the x, y and z components of the distance separately and store them as label
b1_x: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=d1c.x,d1 FUNCthe function you wish to evaluate=x/y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
b1_y: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=d1c.y,d1 FUNCthe function you wish to evaluate=x/y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
b1_z: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=d1c.z,d1 FUNCthe function you wish to evaluate=x/y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
hu: SPHERICAL_KDECreate a histogram from the input scalar/vector/matrix using SPHERICAL_KDE More details HEIGHTSthis keyword takes the label of an action that calculates a vector of values=d1lt ARGthe label for the value that should be used to construct the histogram=b1_x,b1_y,b1_z CONCENTRATIONthe concentration parameter for the Von Mises-Fisher distributions=100 GRID_BINthe number of bins for the grid=144
h: CUSTOMCalculate a combination of variables using a custom expression. More details ARGthe values input to this function=hu,d1lts FUNCthe function you wish to evaluate=x/y PERIODICif the output of your function is periodic then you should specify the periodicity of the function=NO
DUMPGRIDOutput the function on the grid to a file with the PLUMED grid format. More details PRINT_XYZ output coordinates on fibonacci grid to xyz file ARGthe label for the grid that you would like to output=h PRINT_ONE_FILE output grids one after the other in a single file STRIDE the frequency with which the grid should be output to the file=1 FILE the file on which to write the grid=allkde.xyz

This input outputs an xyz file in which atom represents one of the grid points on your spherical grid. These atoms are shifted in and out radially based on the value of the function at the grid point.

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 grid the label for the grid that you would like to output

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 label for the grid that you would like to output
STRIDE compulsory 0 the frequency with which the grid should be output to the file
FILE compulsory density the file on which to write the grid
FMT optional not used the format that should be used to output real numbers
PRINT_XYZ optional false output coordinates on fibonacci grid to xyz file
PRINT_ONE_FILE optional false output grids one after the other in a single file

deprecated keywords

The keywords in the following table can still be used with this action but have been deprecated

Keyword Description
GRID You should use ARG instead of this keyword which was used in older versions of PLUMED and is provided for back compatibility only