grid

Bin selected atoms on a 3D grid.

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

[out <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):
[boxcenter] Center grid on box center.
[maskcenter <mask>] Center the grid on the atoms selected by <mask>.
[rmsfit <mask>] Perform a bst-fit rotation of the grid using the coordinates selected by <mask>
[noxalign] If specified, grid will not be re-oriented to align with Cartesian axes once binning is finished. Will affect file formats that do not store full unit cell vectors (like Xplor).

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.
[{byres|bymol}] Grid the centers of mass of residues or molecules selected by <mask>.

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.

Create a grid representing the histogram of atoms in <mask> on the 3D grid that is “nx * x_spacing by ny * y_spacing by nz * z_spacing angstroms (cubed). 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); 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.

An example of the use of the grid command is available following this recipe

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.

Examples:

Example 1: Grid water density around a solute. The solute is imaged to the origin and rms fit to the first frame. The grid will be centered on the origin as well.

trajin tz2.truncoct.nc
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

Example 2: Grid water density around a solute. The grid is centered on the solute.

trajin tz2.truncoct.nc
autoimage
grid out.dx 20 0.5 20 0.5 20 0.5 :WAT@O maskcenter :1-13

Example 3: Grid water density around a solute. The grid is centered on the solute and rms-fit. The density obtained should be equivalent to the first example.

trajin tz2.truncoct.nc
image :WAT
grid out.dx 20 0.5 20 0.5 20 0.5 :WAT@O rmsfit :1-13

Example 4: Generate grid from bounds command.

trajin tz2.ortho.nc
autoimage
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
run
# Grid using grid data set from bounds command.
crdaction MyCoords grid bounds.xplor data MyGrid :WAT@O

Example 5: Create non-orthogonal grid based on the box.trajin tz2.truncoct.nc

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

Generate grid from bounds command.

trajin tz2.ortho.nc
autoimage
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

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