Skip to content

Action: REFERENCE_GRID

Module gridtools
Description Usage
Setup a constant grid by either reading values from a file or definining a function in input used in 1 tutorialsused in 0 eggs
output value type
the constant function on the grid that was specified in input grid

Details and examples

Setup a constant grid by either reading values from a file or definining a function in input

This action allows you to create a constant function and store the values that this function takes at a grid of points. There are two ways that you can create the constant function. You can either read in the value of the function at a set of grid points from a file as is done in this example input:

Click on the labels of the actions for more information on what each action computes
tested on2.11
#SETTINGS INPUTFILES=regtest/gridtools/rt-test-fib-read/kde.grid
ffg: REFERENCE_GRIDSetup a constant grid by either reading values from a file or definining a function in input More details FILEthe name of the file that contains the reference data=
regtest/gridtools/rt-test-fib-read/kde.grid
Click here to see an extract from this file.
×

FILE: regtest/gridtools/rt-test-fib-read/kde.grid

#! FIELDS d1n.x d1n.y d1n.z h dh_d1n.x dh_d1n.y dh_d1n.z
#! SET nbins  100
   0.1411  -0.9900   0.0000   0.0037   0.0052  -0.0364   0.0000
  -0.1793  -0.9700  -0.1642   0.0002  -0.0003  -0.0016  -0.0003
   0.0273  -0.9500   0.3111   0.0147   0.0040  -0.1401   0.0459
   0.2236  -0.9300  -0.2917   0.0007   0.0015  -0.0062  -0.0019
  -0.4083  -0.9100   0.0722   0.0002  -0.0007  -0.0016   0.0001
   0.3847  -0.8900   0.2447   0.0598   0.2301  -0.5322   0.1463
  -0.1280  -0.8700  -0.4761   0.0000  -0.0000  -0.0003  -0.0002
  -0.2428  -0.8500   0.4675   0.0063  -0.0152  -0.0532   0.0293
   0.5239  -0.8300  -0.1913   0.0049   0.0259  -0.0410  -0.0094
  -0.5421  -0.8100  -0.2238   0.0000  -0.0000  -0.0001  -0.0000
   0.2599  -0.7900   0.5553   0.1789   0.4648  -1.4132   0.9933
   0.1910  -0.7700  -0.6088   0.0001   0.0002  -0.0007  -0.0006
  -0.5723  -0.7500   0.3316   0.0002  -0.0013  -0.0018   0.0008
   0.6675  -0.7300   0.1467   0.0851   0.5683  -0.6215   0.1249
  -0.4050  -0.7100  -0.5761   0.0000  -0.0001  -0.0001  -0.0001
  -0.0930  -0.6900   0.7178   0.0487  -0.0453  -0.3362   0.3498
   0.5676  -0.6700  -0.4784   0.0006   0.0033  -0.0039  -0.0028
  -0.7593  -0.6500  -0.0314   0.0000  -0.0000  -0.0000  -0.0000
   0.5505  -0.6300   0.5478   0.5079   2.7961  -3.2001   2.7825
  -0.0366  -0.6100  -0.7916   0.0001  -0.0000  -0.0004  -0.0005
  -0.5173  -0.5900   0.6199   0.0014  -0.0071  -0.0080   0.0085
   0.8143  -0.5700  -0.1096   0.0177   0.1439  -0.1008  -0.0194
  -0.6856  -0.5500  -0.4770   0.0001  -0.0004  -0.0003  -0.0003
   0.1861  -0.5300   0.8273   0.2978   0.5542  -1.5782   2.4635
   0.4277  -0.5100  -0.7463   0.0001   0.0004  -0.0005  -0.0008
  -0.8305  -0.4900   0.2649   0.0000  -0.0001  -0.0001   0.0000
   0.8013  -0.4700   0.3702   0.3397   2.7222  -1.5968   1.2577
  -0.3448  -0.4500  -0.8238   0.0005  -0.0016  -0.0021  -0.0038
  -0.3056  -0.4300   0.8495   0.0132  -0.0403  -0.0568   0.1121
   0.8074  -0.4100  -0.4243   0.0010   0.0084  -0.0042  -0.0044
  -0.8904  -0.3900  -0.2347   0.0001  -0.0006  -0.0003  -0.0002
   0.5025  -0.3700   0.7814   0.7484   3.7603  -2.7690   5.8482
   0.1587  -0.3500  -0.9232   0.0006   0.0009  -0.0020  -0.0053
  -0.7463  -0.3300   0.5780   0.0001  -0.0007  -0.0003   0.0006
   0.9475  -0.3100   0.0785   0.0545   0.5161  -0.1689   0.0428
  -0.6499  -0.2900  -0.7025   0.0015  -0.0096  -0.0043  -0.0104
   0.0047  -0.2700   0.9628   0.0995   0.0047  -0.2687   0.9580
   0.6506  -0.2500  -0.7171   0.0002   0.0010  -0.0004  -0.0011
  -0.9690  -0.2300   0.0898   0.0000  -0.0003  -0.0001   0.0000
   0.7788  -0.2100   0.5911   0.5311   4.1361  -1.1153   3.1392
  -0.1757  -0.1900  -0.9659   0.0053  -0.0093  -0.0101  -0.0513
  -0.5249  -0.1700   0.8340   0.0012  -0.0063  -0.0020   0.0100
   0.9535  -0.1500  -0.2613   0.0027   0.0261  -0.0041  -0.0071
  -0.8821  -0.1300  -0.4527   0.0018  -0.0157  -0.0023  -0.0080
   0.3455  -0.1100   0.9319   0.3213   1.1102  -0.3535   2.9946
   0.3755  -0.0900  -0.9224   0.0024   0.0089  -0.0021  -0.0219
  -0.9014  -0.0700   0.4272   0.0000  -0.0002  -0.0000   0.0001
   0.9544  -0.0500   0.2943   0.0976   0.9316  -0.0488   0.2872
  -0.5054  -0.0300  -0.8624   0.0199  -0.1005  -0.0060  -0.1715
  -0.2099  -0.0100   0.9777   0.0116  -0.0243  -0.0012   0.1131
   0.8152   0.0100  -0.5791   0.0003   0.0023   0.0000  -0.0017
  -0.9919   0.0300  -0.1236   0.0010  -0.0097   0.0003  -0.0012
   0.6474   0.0500   0.7605   0.3033   1.9631   0.1516   2.3064
   0.0364   0.0700  -0.9969   0.0275   0.0100   0.0192  -0.2736
  -0.6991   0.0900   0.7094   0.0001  -0.0005   0.0001   0.0005
   0.9926   0.1100  -0.0508   0.0057   0.0564   0.0063  -0.0029
  -0.7644   0.1300  -0.6316   0.0287  -0.2191   0.0373  -0.1810
   0.1366   0.1500   0.9792   0.0487   0.0665   0.0731   0.4769
   0.5589   0.1700  -0.8116   0.0054   0.0304   0.0092  -0.0441
  -0.9568   0.1900   0.2202   0.0004  -0.0034   0.0007   0.0008
   0.8507   0.2100   0.4820   0.0747   0.6353   0.1568   0.3599
  -0.3003   0.2300  -0.9257   0.1279  -0.3840   0.2941  -1.1837
  -0.4018   0.2500   0.8809   0.0007  -0.0028   0.0017   0.0061
   0.8864   0.2700  -0.3761   0.0005   0.0046   0.0014  -0.0020
  -0.9021   0.2900  -0.3195   0.0188  -0.1697   0.0546  -0.0601
   0.4464   0.3100   0.8394   0.0603   0.2693   0.1870   0.5064
   0.2362   0.3300  -0.9140   0.0720   0.1701   0.2377  -0.6583
  -0.7854   0.3500   0.5105   0.0001  -0.0010   0.0005   0.0007
   0.9164   0.3700   0.1529   0.0057   0.0526   0.0212   0.0088
  -0.5674   0.3900  -0.7253   0.2269  -1.2873   0.8849  -1.6455
  -0.0709   0.4100   0.9093   0.0032  -0.0023   0.0133   0.0294
   0.6597   0.4300  -0.6163   0.0089   0.0589   0.0384  -0.0551
  -0.8930   0.4500   0.0087   0.0079  -0.0708   0.0357   0.0007
   0.6566   0.4700   0.5899   0.0190   0.1250   0.0895   0.1123
  -0.0847   0.4900  -0.8676   0.3773  -0.3195   1.8488  -3.2735
  -0.5167   0.5100   0.6877   0.0001  -0.0006   0.0006   0.0008
   0.8336   0.5300  -0.1558   0.0009   0.0078   0.0049  -0.0015
  -0.7090   0.5500  -0.4414   0.1790  -1.2691   0.9844  -0.7900
   0.2210   0.5700   0.7914   0.0042   0.0093   0.0241   0.0334
   0.3651   0.5900  -0.7201   0.1119   0.4085   0.6601  -0.8057
  -0.7416   0.6100   0.2791   0.0034  -0.0255   0.0210   0.0096
   0.7207   0.6300   0.2893   0.0019   0.0136   0.0119   0.0055
  -0.3288   0.6500  -0.6851   0.7096  -2.3331   4.6124  -4.8617
  -0.2153   0.6700   0.7105   0.0002  -0.0005   0.0016   0.0017
   0.6227   0.6900  -0.3690   0.0147   0.0913   0.1011  -0.0541
  -0.6892   0.7100  -0.1445   0.0894  -0.6165   0.6351  -0.1292
   0.3985   0.7300   0.5552   0.0013   0.0052   0.0096   0.0073
   0.0786   0.7500  -0.6568   0.4868   0.3826   3.6513  -3.1973
  -0.4838   0.7700   0.4159   0.0027  -0.0129   0.0206   0.0111
   0.6128   0.7900   0.0194   0.0029   0.0178   0.0230   0.0006
  -0.4197   0.8100  -0.4096   0.5239  -2.1988   4.2437  -2.1458
   0.0312   0.8300   0.5569   0.0006   0.0002   0.0052   0.0035
   0.3336   0.8500  -0.4077   0.1209   0.4033   1.0278  -0.4930
  -0.4880   0.8700   0.0705   0.0487  -0.2378   0.4239   0.0344
   0.3768   0.8900   0.2567   0.0024   0.0092   0.0217   0.0063
  -0.0949   0.9100  -0.4036   0.5007  -0.4754   4.5565  -2.0208
  -0.1796   0.9300   0.3207   0.0079  -0.0141   0.0732   0.0252
   0.2965   0.9500  -0.0978   0.0406   0.1204   0.3857  -0.0397
  -0.2217   0.9700  -0.0998   0.1596  -0.3537   1.5478  -0.1593
   0.0557   0.9900   0.1296   0.0234   0.0130   0.2312   0.0303
VALUEthe name of the value that should be read from the grid=h 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=ffg FILE the file on which to write the grid=output.grid

The input file in this case has the format for grids that is discussed in the documentation for DUMPGRID.

The second way you can create these constant functions is illustrated below.

Click on the labels of the actions for more information on what each action computes
tested on2.11
d2: REFERENCE_GRIDSetup a constant grid by either reading values from a file or definining a function in input More details GRID_MIN the lower bounds for the grid=0 GRID_MAX the upper bounds for the grid=10 GRID_BINthe number of bins for the grid=20 FUNCthe function to compute on the grid=d1*d1 VARthe names to give each of the grid directions in the function=d1 PERIODICare the grid directions periodic=NO
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
ff: EVALUATE_FUNCTION_FROM_GRIDCalculate the function stored on the input grid at an arbitrary point More details GRIDthe name of the grid that we are using to evaluate the function=d2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d1,ff FMT the format that should be used to output real numbers=%8.4f FILEthe name of the file on which to output these quantities=colvar

This input illustrates a rather elaborate (and approximate) method for evaluating the square of the distance between atoms 1 and 2. As you can see, the option involves using the GRID_MIN, GRID_MAX and GRID_BIN options to create a grid of points. You can then use the FUNC option to specify the function that should be evaluated at each of those grid points. If you use this option the lepton library that is discussed in the documentation for CUSTOM is used to evaluate the function at the various grid points.

N.B. This method with lepton was implemented to facilitate the implementation of the normalisation in the implementation of the RDF shortcut.

Lastly note that you can specify the grid spacing in the input to this action rather than the number of bins as shown below:

Click on the labels of the actions for more information on what each action computes
tested on2.11
d2: REFERENCE_GRIDSetup a constant grid by either reading values from a file or definining a function in input More details GRID_MIN the lower bounds for the grid=0 GRID_MAX the upper bounds for the grid=10 GRID_SPACINGthe approximate grid spacing (to be used as an alternative or together with GRID_BIN)=0.5 FUNCthe function to compute on the grid=d1*d1 VARthe names to give each of the grid directions in the function=d1 PERIODICare the grid directions periodic=NO
d1: DISTANCECalculate the distance/s between pairs of atoms. More details ATOMSthe pair of atom that we are calculating the distance between=1,2
ff: EVALUATE_FUNCTION_FROM_GRIDCalculate the function stored on the input grid at an arbitrary point More details GRIDthe name of the grid that we are using to evaluate the function=d2
PRINTPrint quantities to a file. More details ARGthe labels of the values that you would like to print to the file=d1,ff FMT the format that should be used to output real numbers=%8.4f FILEthe name of the file on which to output these quantities=colvar

Full list of keywords

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

Keyword Type Default Description
GRID_MIN compulsory auto the lower bounds for the grid
GRID_MAX compulsory auto the upper bounds for the grid
PERIODIC compulsory none are the grid directions periodic
FILE compulsory none the name of the file that contains the reference data
VALUE compulsory none the name of the value that should be read from the grid
FUNC optional not used the function to compute on the grid
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)
VAR optional not used the names to give each of the grid directions in the function