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 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.
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
=1,2,3,4 The TORSION action with label r1 calculates a single scalar valuer2: TORSION
ATOMS
the four atoms involved in the torsional angle
=2,3,4,5 The TORSION action with label r2 calculates a single scalar valuehh_weight: ONES
SIZE
compulsory keyword
the number of ones that you would like to create
=1 The ONES action with label hh_weight calculates a single scalar valuehh_kde: KDE
ARG
the input for this action is the scalar output from one or more other actions.
=r1,r2
GRID_MIN
compulsory keyword ( default=auto )
the lower bounds for the grid
=-3.14,-3.14
GRID_MAX
compulsory keyword ( default=auto )
the upper bounds for the grid
=3.14,3.14
GRID_BIN
the number of bins for the grid
=200,200
BANDWIDTH
the bandwidths for kernel density esimtation
=0.05,0.05 The KDE action with label hh_kde calculates a single scalar valuehh_kdep: CUSTOM
ARG
the input to this function.
=hh_kde,hh_weight
FUNC
compulsory keyword
the function you wish to evaluate
=x*y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh_kdep calculates a single scalar valuehh_u: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_kdep
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=0 The ACCUMULATE action with label hh_u calculates a single scalar valuehh_nsum: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_weight
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=0 The ACCUMULATE action with label hh_nsum calculates a single scalar valuehh: CUSTOM
ARG
the input to this function.
=hh_u,hh_nsum
FUNC
compulsory keyword
the function you wish to evaluate
=x/y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh calculates a single scalar valueDUMPGRID
GRID
the grid you would like to print (can also use ARG for specifying what is being printed)
=hh
FILE
compulsory keyword ( default=density )
the file on which to write the grid.
=histo The DUMPGRID action with label
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.
Click on the labels of the actions for more information on what each action computes
=1,2,3,4 The TORSION action with label r1 calculates a single scalar valuer2: TORSION
ATOMS
the four atoms involved in the torsional angle
=2,3,4,5 The TORSION action with label r2 calculates a single scalar valuehh_weight: ONES
SIZE
compulsory keyword
the number of ones that you would like to create
=1 The ONES action with label hh_weight calculates a single scalar valuehh_kde: KDE
ARG
the input for this action is the scalar output from one or more other actions.
=r1,r2
GRID_MIN
compulsory keyword ( default=auto )
the lower bounds for the grid
=-3.14,-3.14
GRID_MAX
compulsory keyword ( default=auto )
the upper bounds for the grid
=3.14,3.14
GRID_BIN
the number of bins for the grid
=200,200
BANDWIDTH
the bandwidths for kernel density esimtation
=0.05,0.05 The KDE action with label hh_kde calculates a single scalar valuehh_kdep: CUSTOM
ARG
the input to this function.
=hh_kde,hh_weight
FUNC
compulsory keyword
the function you wish to evaluate
=x*y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh_kdep calculates a single scalar valuehh_u: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_kdep
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=0 The ACCUMULATE action with label hh_u calculates a single scalar valuehh_nsum: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_weight
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=0 The ACCUMULATE action with label hh_nsum calculates a single scalar valuehh: CUSTOM
ARG
the input to this function.
=hh_u,hh_nsum
FUNC
compulsory keyword
the function you wish to evaluate
=x/y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh calculates a single scalar valueDUMPGRID
GRID
the grid you would like to print (can also use ARG for specifying what is being printed)
=hh
FILE
compulsory keyword ( default=density )
the file on which to write the grid.
=histo
STRIDE
compulsory keyword ( default=0 )
the frequency with which the grid should be output to the file.
=100000 The DUMPGRID action with label
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 example.
Click on the labels of the actions for more information on what each action computes
=1,2,3,4 The TORSION action with label r1 calculates a single scalar valuer2: TORSION
ATOMS
the four atoms involved in the torsional angle
=2,3,4,5 The TORSION action with label r2 calculates a single scalar valuehh_weight: ONES
SIZE
compulsory keyword
the number of ones that you would like to create
=1 The ONES action with label hh_weight calculates a single scalar valuehh_kde: KDE
ARG
the input for this action is the scalar output from one or more other actions.
=r1,r2
GRID_MIN
compulsory keyword ( default=auto )
the lower bounds for the grid
=-3.14,-3.14
GRID_MAX
compulsory keyword ( default=auto )
the upper bounds for the grid
=3.14,3.14
GRID_BIN
the number of bins for the grid
=200,200
BANDWIDTH
the bandwidths for kernel density esimtation
=0.05,0.05 The KDE action with label hh_kde calculates a single scalar valuehh_kdep: CUSTOM
ARG
the input to this function.
=hh_kde,hh_weight
FUNC
compulsory keyword
the function you wish to evaluate
=x*y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh_kdep calculates a single scalar valuehh_u: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_kdep
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=100000 The ACCUMULATE action with label hh_u calculates a single scalar valuehh_nsum: ACCUMULATE
ARG
the input for this action is the scalar output from one or more other actions.
=hh_weight
STRIDE
compulsory keyword ( default=1 )
the frequency with which the data should be collected and added to the quantity being
averaged
=1
CLEAR
compulsory keyword ( default=0 )
the frequency with which to clear all the accumulated data.
=100000 The ACCUMULATE action with label hh_nsum calculates a single scalar valuehh: CUSTOM
ARG
the input to this function.
=hh_u,hh_nsum
FUNC
compulsory keyword
the function you wish to evaluate
=x/y
PERIODIC
compulsory keyword
if the output of your function is periodic then you should specify the periodicity
of the function.
=NO The CUSTOM action with label hh calculates a single scalar valueDUMPGRID
GRID
the grid you would like to print (can also use ARG for specifying what is being printed)
=hh
FILE
compulsory keyword ( default=density )
the file on which to write the grid.
=histo
STRIDE
compulsory keyword ( default=0 )
the frequency with which the grid should be output to the file.
=100000 The DUMPGRID action with label
Glossary of keywords and components
Compulsory keywords
STRIDE
( default=0 ) the frequency with which the grid should be output to the file. Default of zero means dump at end of calculation
FILE
( default=density ) the file on which to write the grid.
Options
PRINT_XYZ
( default=off ) output coordinates on fibonacci grid to xyz file
PRINT_ONE_FILE
( default=off ) output grids one after the other in a single file
ARG
the input for this action is the scalar output from one or more other actions. The particular scalars that you will use are referenced using the label of the action. If the label appears on its own then it is assumed that the Action calculates a single scalar value. The value of this scalar is thus used as the input to this new action. If * or *.* appears the scalars calculated by all the proceeding actions in the input file are taken. Some actions have multi-component outputs and each component of the output has a specific label. For example a DISTANCE action labelled dist may have three components x, y and z. To take just the x component you should use dist.x, if you wish to take all three components then use dist.*.More information on the referencing of Actions can be found in the section of the manual on the PLUMED Getting Started. Scalar values can also be referenced using POSIX regular expressions as detailed in the section on Regular Expressions. To use this feature you you must compile PLUMED with the appropriate flag.. You can use multiple instances of this keyword i.e. ARG1, ARG2, ARG3...
GRID
the grid you would like to print (can also use ARG for specifying what is being printed)
FMT
the format that should be used to output real numbers