Action: INTERPOLATE_GRID
| Module | gridtools |
|---|---|
| Description | Usage |
| Interpolate a smooth function stored on a grid onto a grid with a smaller grid spacing. | |
| output value | type |
| the function evaluated onto the interpolated grid | grid |
Details and examples
Interpolate a smooth function stored on a grid onto a grid with a smaller grid spacing.
This action takes a function evaluated on a grid as input and can be used to interpolate the values of that function on to a finer grained grid. By default the interpolation within this algorithm is done using splines.
Examples
The input below can be used to post process a trajectory. It calculates a HISTOGRAM as a function the distance between atoms 1 and 2 using kernel density estimation. During the calculation the values of the kernels are evaluated at 100 points on a uniform grid between 0.0 and 3.0. Prior to outputting this function at the end of the simulation this function is interpolated onto a finer grid of 200 points between 0.0 and 3.0.
x: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2 hA1: 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=x GRID_MIN the lower bounds for the grid=0.0 GRID_MAX the upper bounds for the grid=3.0 GRID_BINthe number of bins for the grid=100 BANDWIDTHthe bandwidths for kernel density esimtation=0.1 ii: INTERPOLATE_GRIDInterpolate a smooth function stored on a grid onto a grid with a smaller grid spacing. This action has hidden defaults. More details ARGthe label for function on the grid that you would like to interpolate=hA1 GRID_BINthe number of bins for the grid=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=ii FILE the file on which to write the grid=histo.dat
When specifying the parameters of the interpolating grid you can use GRID_BIN to specify the number of grid points or GRID_SPACING to specify the spacing between grid points as shown below:
x: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2 hA1: 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=x GRID_MIN the lower bounds for the grid=0.0 GRID_MAX the upper bounds for the grid=3.0 GRID_BINthe number of bins for the grid=100 BANDWIDTHthe bandwidths for kernel density esimtation=0.1 ii: INTERPOLATE_GRIDInterpolate a smooth function stored on a grid onto a grid with a smaller grid spacing. This action has hidden defaults. More details ARGthe label for function on the grid that you would like to interpolate=hA1 GRID_SPACINGthe approximate grid spacing (to be used as an alternative or together with GRID_BIN)=0.05 INTERPOLATION_TYPE the method to use for interpolation=floor 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=ii FILE the file on which to write the grid=histo.dat
In the above input spline interpolation is not used. Instead, if you evaluating the function at value , which
is where and are two points where the values for the function on the input grid
are and then . If you want you use INTERPOLATION_TYPE=ceiling.
Alternatively, you can use linear interpolation as has been done in the following input.
x: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2 hA1: 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=x GRID_MIN the lower bounds for the grid=0.0 GRID_MAX the upper bounds for the grid=3.0 GRID_BINthe number of bins for the grid=100 BANDWIDTHthe bandwidths for kernel density esimtation=0.1 ii: INTERPOLATE_GRIDInterpolate a smooth function stored on a grid onto a grid with a smaller grid spacing. More details ARGthe label for function on the grid that you would like to interpolate=hA1 GRID_MIN the lower bounds for the grid=0.015 GRID_MAX the upper bounds for the grid=2.985 GRID_BINthe number of bins for the grid=99 INTERPOLATION_TYPE the method to use for interpolation=linear 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=ii FILE the file on which to write the grid=histo.dat
Notice that the way we have specified GRID_MIN, GRID_MAX and GRID_BIN in the above input ensures that function is evaluated
at the mid points that lie between the points on the input grid.
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 function on the grid that you would like to interpolate |
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 function on the grid that you would like to interpolate |
| GRID_MIN | compulsory | auto | the lower bounds for the grid |
| GRID_MAX | compulsory | auto | the upper bounds for the grid |
| INTERPOLATION_TYPE | compulsory | spline | the method to use for interpolation |
| GRID_BIN | optional | not used | the number of bins for the grid |
| GRID_SPACING | optional | not used | the approximate grid spacing (to be used as an alternative or together with GRID_BIN) |
| SERIAL | optional | false | do the calculation in serial. Further information about this flag can be found here. |
| USEGPU | optional | false | run this calculation on the GPU. Further information about this flag can be found here. |