What's a DF3 file?

DF3 files are a rather simple format for a scalar field - quite similar to the DSN6 and BRIX formats. However, the file header only contains information regarding the extent of the map. The rest of the file is a scaled version (using unsigned chars) of scalars (x fast, y medium, z slow). Povray gladly accepts DF3 to use for any one of a number of purposes, such as texture mapping or volume rendering. The best part about the whole procedure is that it can be rendered using a *continuous density gradient*. In other words, as long as we tell povray a few things, the DF3 file can be used to define the electron density using voxels.

What does it look like?

Input file for the below example

Yowza! Now our picture contains all the information from 1.0 sigma to the maximum (5.7503 in this case) within the given contoured region.


Can I show it along with other density renderings?

Darn tootin'. This input file is an example how:

This type of rendering can yield some interesting information that polygonization tends to hide from us (and we end up fiddling with silly slider bars in esoteric programs and running various other programs trying to see/find areas of maximal signal). To see this more clearly, consider the following:


Where do you think the heavy metal sites are located (and do their occupancies or relative thermal order look the same?)?


So how does it work?

For each contour command after setting the maptype to 2, a df3 file is generated (starting at edmap.1.df3 and incrementing). This file is then loaded in povray through the following include (automatically done if the -povray output mode is on):
// density is scaled from 1.000000 to 12.154083
box{
 <0,0,0>, <1,1,1>
 texture{ pigment {rgbt 1} finish {ambient rgb <0,0,0>}}
 interior{
   media{
      intervals 100
      samples 1,20
      emission <0.5,0.5,0.5>
      absorption <0,0,0>
      scattering { 1,<0,0,0> }
      confidence 0.999
      variance 1/500
      density {
         density_file df3 "edmap.1.df3" interpolate 1
         density_map {
            [0 rgb 0]
            [1.0 rgb 10]
         }
         color_map {
            [0.0 rgb <0,0,0>]
            [0.001 FOO_5]
            [0.5 FOO_6]
            [1.0 FOO_7]
         }
      }
   }
 }
 no_shadow
 hollow

 scale <1.00, 1.00, 1.00>
 translate <0.00, 0.00, 0.00>
 matrix <1.00, 0.00, 0.00,
         0.00, 1.00, 0.00,
         0.00, 0.00, 1.00,
         0.00, 0.00, 0.00>
}
Forget most of the mumbo jumbo except for the density_map and color_map definitions (if you want the details for all the variables, see the povray user guide). The density_map declaration specifies a value (the df3 unsigned shorts are converted to values between 0.0 to 1.0 in terms of floats) and how density values should be interpolated. In the above definition, the map is simply rendered with increasing (relative) brightness from 0 to 10. The color map can be used to actually modify the color blend through that density_map. Given the definition above, at density_level 0 no color is displayed. This is ramped to FOO_5 (blue in our previous definitions) at a density level of 0.001, and then to FOO_6 (red in this case) at maximum sigma. Feel free to play with these values (or insert new ones) to obtain interesting effects. By taking the second example and modifying the color map to:
color_map {
   [0.0 rgb <0,0,0>]
   [0.001 FOO_5]
   [0.2 FOO_6]
   [0.4 FOO_7]
}
The following is the result:


Multiple DF3 files through the same volume:

In order to avoid intersection problems when rendering multiple DF3 files, it may be necessary to use the "mergemap" option. This allows for defining multiple media within the same box region (read: they share the same space, and overlapping regions will result in addition of color values). Although only a kludge (it only works when the df3 files cover the same region in space, e.g. when rendering both a 2fo-fc and fo-fc map on the same residue), it works relatively well:

set maptype 2;
set mapramp from black to red;
set mergemap 1;
contour 2fofc at 1.0 covering require in residue 1012, loc A and not $backb;
set mapramp from black to green;
set mergemap 3;
contour fofc at 2.0 covering require in residue 1012, loc A and not $backb;



A few other things worth mentioning:
Go back to the povscript+ home page