Bin selected atoms on a 3D grid.

grid <filename> { data <dsname> | boxref <ref name/tag> <nx> <ny> <nz> | <nx> <dx> <ny> <dy> <nz> <dz> [gridcenter <cx> <cy> <cz>] } box|origin|center <mask>] [negative] [name <gridname>] <mask> [normframe | normdensity [density <density>]] [pdb <pdbout> [max <fraction>]]
[[smoothdensity <value>] [invert]] [madura <madura>]

<filename> File to write out grid to. Use “.grid” or “.xplor” extension for XPLOR format, “.dx” for OpenDX format.
Options for setting up grid:
data <dsname> Use previously calculated/loaded grid data set named <dsname>. When using this option there is no need to specify grid bins/spacing/center.
boxref <ref name/tag> <nx> <ny> <nz> Set up grid using box information from a previously loaded reference structure. Currently the only way to set up non-orthogonal grids.
<nx> <dx> <ny> <dy> <nz> <dz> Number of grid bins and spacing in the X/Y/Z directions.
[gridcenter <cx> <cy> <cz>] Location of grid center, default is origin (0.0, 0.0, 0.0). Options for offset during grid binning (must center grid at origin):
[box] Offset each point by location of box center prior to gridding. Cannot be used with ’gridcenter’.
[origin] No offset (default)
[center <mask>] Offset each point by center of atoms in <mask> prior to gridding. Cannot be used with ’gridcenter’.

Other options:
[negative] Grid negative density instead of positive density.
[name <gridname>] Grid data set name.
<mask> Mask of atoms to grid.
[normframe] Normalize grid bins by the number of frames.
[normdensity [density <density>]] Normalize grid bins by density: GridBin = GridBin / (Nframes * BinVolume * density). Default particle density (molecules/Ang^3) for water based on 1.0 g/mL.
[pdb <pdbout> [max <fraction>]] Write a pseudo-PDB of grid points that have density greater than <fraction> (default 0.80) of the grid max value.

Less common options:
[smoothdensity <smooth>] Used to smooth density. The smoothing takes the form of GridBin = 0 if GridBin < smooth, otherwise GridBin = GridBin – (GridBin* exp[-(GridBin – smooth)^2 / (0.2 * smooth^2)]).
[invert] (Only used if smoothdensity also used) Do inverse smoothing (i.e. if GridBin > smooth).
[madura <madura>] Grid values lower than <madura> become flipped in sign, exposes low density.

Data Sets Created:
<dsname> Grid data set.

By default the grid is centered at the origin unless gridcenter is specified. Grid points can be offset by either the box center (using box) or the center of specified atoms (using center <mask>); if either of these options are used the grid must be centered at the origin. Note that the bounds command can be very useful for determining grid dimensions.

Note that when calculating grid densities for things like solvent/ions, the solute of interest (about which the atomic densities are binned) should be rms fit, centered and imaged prior to the grid call in order to provide any meaningful representation of the density. If the optional keyword negative is also specified, then these density will be stored as negative numbers. Output can be in the XPLOR or OpenDX data formats.


Grid water density around a solute.

autoimage origin
rms first :1-13
# Create average of solute to view with grid.
average avg.mol2 :1-13
grid out.dx 20 0.5 20 0.5 20 0.5 :WAT@O

Generate grid from bounds command.

rms first :1-13&!@H= mass
bounds :1-13 dx .5 name MyGrid out bounds.dat
average bounds.mol2 :1-13
# Save coordinates for second pass.
createcrd MyCoords

# Grid using grid data set from bounds command.
crdaction MyCoords grid bounds.xplor data MyGrid :WAT@O

Create non-orthogonal grid:

reference ../ [REF]
autoimage triclinic
grid nonortho.dx boxref [REF] 50 50 50 :WAT@O pdb nonortho.pdb