Action: FIND_GRID_MAXIMUM
| Module | gridtools |
|---|---|
| Description | Usage |
| Find the point with the highest value of the function on the grid |
Details and examples
Find the point with the highest value of the function on the grid
This command takes a function on a grid as input and returns multiple scalars. One of the returned scalars (the one with component optval) is the value of the input
function at its highest point. The other scalars returned are the coordinates for which the function takes this particular value.
As the input grid has the values of the function evaluated over a grid of points we find this maximum value by finding the point on the grid where the function has its lowest value using interpolation and conjugate gradients. The coordinates of the grid point where the function's value is highest will be used as an initial coordinate for the optimisation. We then interpolate the function to find the optimum. You can use use the CGTOL keyword to control the conjugate gradient algorithm that is used to find the location of the maximum in the interpolated function.
To print out the location on the grid where the function is maximised and the value of the function at that point you can use an input like the one 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 max: FIND_GRID_MAXIMUMFind the point with the highest value of the function on the grid This action has hidden defaults. More details ARGthe label for the function on the grid that you would like to find the optimum in=hA1 PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=max.x_opt,max.optval STRIDE the frequency with which the quantities of interest should be output=0
Notice that we set STRIDE=0 in the PRINT command here so the position of the maximum is only output once at the end of the simulation.
If for any reason you do not want to use interpolation and conjugate gradient to find the optimum you can use the NOINTERPOL flag 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 max: FIND_GRID_MAXIMUMFind the point with the highest value of the function on the grid More details ARGthe label for the function on the grid that you would like to find the optimum in=hA1 NOINTERPOL do not interpolate the function when finding the optimum PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=max.x_opt,max.optval STRIDE the frequency with which the quantities of interest should be output=0
The FIND_GRID_MAXIMUM action then outputs the coordinates of the grid point where the function is largest as well as the value of the function on that 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 function on the grid that you would like to find the optimum in |
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 |
|---|---|---|
| optval | scalar | the value of the function at the optimum |
| _opt | scalar | the values of the arguments of the function at the optimum can be referenced elsewhere in the input file by using the names of the arguments followed by the string _opt |
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 function on the grid that you would like to find the optimum in |
| CGTOL | compulsory | 1E-4 | the tolerance for the conjugate gradient optimization |
| NOINTERPOL | optional | false | do not interpolate the function when finding the optimum |