7.3. Map concepts 3.2.3. Molecular envelopes In the case of proper averaging one molecular envelope (mask) suffices for all molecules, while for improper averaging the procedure should distinguish between different molecular areas. For this reason the concept of labeled masks was introduced by Bricogne. In MAIN this is solved by storing each molecule's mask in a separate map. Since on each map only a single operation can be performed at a time, there are no principle differences between improper and proper averaging procedures. 3.2.4. Crystal cell generation The usual way to generate a complete crystal cell from an asymmetric unit was to write a procedure that applies the building rules. Building rules tell which grid point in a cell is equivalent to which one from the asymmetric unit. This approach has several drawbacks which can turn averaging (and solvent flattening as well) to a complicated procedure full of errors. First, for each different space group, different rules should be applied and second, in almost any space group it is possible to choose different definitions of an asymmetric unit. The third complication sometimes arises from differing numbers of grid points in a unit cell. These routines are, however, not available for every possible case and have to be, when necessary, programmed. Also when they are available their correctness should be verified for each single case. It happened quite often that there were whole empty layers left. At this point real problems may begin specially for an unskilled programmer. Therefore in MAIN another approach is applied: A crystal cell is generated from an asymmetric unit by applying crystal symmetry operations. The consequence of this generality is that there are no limitations on placement of an asymmetric unit and the routines work generally for any space group. Besides the asymetric unit may consist of several independent parts, each one stored in a separate map. The MAIN approach has also another advantage: since only empty points can be modified, there is no danger of having multiple density in certain regions. 3.2.5. Maps: enevelopes, density filled regions A map is a 3-dimensional array of grid points, each with a value. According to the value, they are treated as empty, density or mask points. The grid points with values inside the density interval are the density points, the ones with values below the density interval are empty points, and the ones above are mask points. In the case of character*1 maps 0 is an empty point and 255 is a masked point. In the case of real*4 maps the empty points have values below -9999.0 and masked above 9999.0. The region inbetween comprises the density points. Each map has size, starting coordinates and cell constants (cell constants are needed for transforming maps from differents cells). Grid points lying in different unit cells with the same fractional coordinates are identical. That means that, when a whole unit cell is defined in a map, the program can expand the density through the whole space. There are 9 elementary operations types that can be done with maps: - Creation of a map, - Creation and extension of a masked or an empty region, - Rotations and translations of a map, - Building the crystal unit cell from an asymmetric unit or its parts, - Setting values to selected grid points, - Scaling a single map with a constant, - Rescaling a map to 1 sigma and shifting its average to 0.0, - Adding and merging two maps and - Creation of electron density from atomic positions. The smallest map contains only a header where cell constants and crystal symmetry operations and number of grid points along the cell axes are stored. MAIN can read PROTEIN, X-PLOR and ASCII CCP4 as well as its own native formats of electron density maps. The maps can be written in Lyn Ten Eyck, X-PLOR and MAIN native formats. The native formats are ASCII files with record length 80 so that they can be edited and changed with a text editor. MAIN map files will be changed to unformatted, since some UNIX systems (Hewlett Packard and Silicon Graphics) cause problems when dealing with fixed length ASCII files. CONVEX FORTRAN causes however no problems. Besides a variety of smaller conversion programs were written to enable conversion of maps between PROTEIN, X-PLOR, P1SF, FRODO and native MAIN formats. Operations on a map grid point can be applied when the point is empty or masked. (The exception is the SET command that can set a value to a grid point in any specified range.) A new map can be created from an already existing one by taking its cell constants and size or from scratch. The map size, origin, and number of grid points per cell length and cell constants can be taken from an already existing map. The grid points are initialized to a specified value. The map origin and size can also be defined from an atom selection so that selected atoms plus some boundary grid points lie inside it. Masked or empty points can be defined in several ways: - By setting all grid points with their values in specified range to the mask value. - By a distance criteria from a selection of atomic center positions - By conversion of grid points to real space points and then to atoms and further to mask grid points. - By converting unmasked grid points that lie between masked points to masked points. A map can be transformed (rotated, translated or copied) into the mask points of another map by linear interpolation. This is done so that the position of a mask point is transformed into the space of the map with density. The masked point density value is then obtained by interpolation from the eight surrounding grid points. Electron density created from atoms can be added to density of a grid point or it can replace the value of an empty grid point. Empty points of a map can be filled with values of the density points of another map by applying crystal symmetry operations. This routine is independent of crystal symmetry. In order to find the position of the grid point into which the density value should be copied rotation matrices and translation vectors are applied. Two maps at a time can be added or merged together. Adding differs from merging in the way, that only two equipositioned grid points having a density valu can be added together, while merging two maps allows scaling of both map contributions prior to their adding together. When a grid point has no density value its value taken from the other map.