Go to the previous, next section.
CONGEN provides three mechanisms for generating molecular graphics. The first is a simple CPK drawing facility accessed via the SPHERE command. This facility will generate unformatted binary files which can be displayed on an RGB raster device. The second is an auxiliary program called peer which provides an interactive graphics capability; see section peer -- Interactive Molecular Display Program, for a complete description. The third mechanism is the DRAW command in the analysis facility, see section Non-interactive Molecular Line Drawings, for a description.
Using a color raster display, it is possible to make solid sphere pictures of a macromolecule as stored in CONGEN. The implementation described here generates an image as an arbitrary size pixel array using up to 256 intensity values for three colors; red, green, and blue. This image is written to a file, and there are several programs for displaying these images. diris may be used for a Silicon Graphics Iris 4D series machine (see section diris -- Display on Iris 4D workstations), DI340 may be used for an Evans and Sutherland PS340 (see section DI340 -- Display images on PS340), and DISPIMG and DISPMANY may be used on the Deanza image processor (see section DISPIMG -- Display Images on the Deanza and section DISPMANY -- Display Many Images on Deanza). DI340, DISPIMG, and DISPMANY are written only for VAX/VMS and are specific for the computers at Massachusetts General Hospital.
To use this command, specify SPHERE as a single command to
CONGEN. This will enter the SPHERE
command parser which will
accept the commands described in this chapter.
The basic algorithm for generating the images is known the Z-buffer algorithm. The image is composed of an array of pixels, and each pixel has a height (a Z value) associated with it. Before the picture is constructed, the Z value is set to minus infinity. As pixels are set during the image generation, the height of each newly generated pixel is compared with that of the image already constructed, and if it will obscure the previous pixel (new Z is greater than that of the pixel), it is overwritten. Otherwise, it is left alone. This takes care of hidden surface removal trivially.
To generate a picture of spheres, we orthographically project each sphere in turn onto the pixel array, and determine the intensity for each such pixel. No anti-aliasing is done to reduce boundary effects. The intensity of the pixels for the sphere is determined using Phong shading (Communications of the Association for Computing Machinery 18, 311 (1975)) which is a simple shading model involving two types of reflectance, diffuse and specular. Diffuse reflectance means uniform scattering, so that the surface will scatter light the same regardless of its orientation. The only determinant is what the projected area of the surface the observer can see. Specular reflectance takes into account the reflection of light off the surface, with the intensity the viewer sees being proportional to some power of the cosine of the reflected light vector and the observer. The higher the power, the more plastic the surface appears. The observer is presumed to be at z=infinity; the light source can be anywhere; however, shadows are not computed, so some of the lighting effects can be weird especially for side lighting. All the shading parameters can be varied, see section Adjustment of the Lighting and Shading.
The color of the atoms is determined by what combination of primary colors; red, green, or blue; are used. The program predefines these three primary colors, three secondary colors (yellow, magenta, cyan), and orange, black, gray and white. Any number of additional colors may be defined by the user.
For efficiency, the spheres are sorted with the spheres closest to the observer being processed first. Additional sorting on X and Y is done to minimize paging into the pixel arrays.
There are several transformations that must take place in going from the atomic representation stored in CONGEN to a picture on the display device. The first transformation is from CONGEN coordinates to display device coordinates. The second transformation is from these atomic coordinates into pixels which can be stored in a image file.
The first transformation depends on the coordinates of the display device. The process of generating the image operates in a space where two of the dimensions are those of the display device. The third dimension must be scaled to match that of the screen, and so must the radii of the atoms. Therefore, the first transformation prepares a listing of the atoms along with their radii in coordinates appropriate for the display device. The color of each atom is also included. The user is free to select any atom in the PSF to be displayed. Finally, there is an 80 character title associated with the picture to identify it.
The atomic transformation in this first step is performed on the atoms selected by the user and consists of the following steps:
The resulting list of atomic coordinates, radii, and colors is
called the spheres list. It is expected that these lists can be
concatenated to produce complex images. The spheres list can be written
to a file in formatted form so that it can edited if desired. The first
line of the file contains the title; the rest are atoms stored as X, Y,
Z, radii, color codes, IUPAC name, residue name, residue identifier, and
segment identifier with a format of (4F10.5,I5,4(1X,A4))
.
The next transformation into an image is done by the Z-buffer algorithm described earlier. This image can be written to a file in unformatted, run-length encoded form.
One special purpose option provided is the ability to change the coloring of pixels based on their accessibility. When this option is used, the program checks to see if the surface point corresponding to a pixel is accessible to a probe sphere of given radius as in the Lee and Richards accessible surface algorithm.
It is possible to go backwards in a crude sense from a spheres list back into some PSF arrays so that new transformations are possible. The spheres lists can be read in with the coordinates therein overwriting the coordinates in CONGEN and also resetting the number of atoms and all the arrays which partition atoms in residues and residues into segments as well redefining the residue names, residue identifiers, and segment identifiers. See section Controlling Data Flow, and the RS command for details.
The space filling image drawing facility of CONGEN runs its own command interpreter. It is entered by specifying SPHERE to CONGEN. The commands to this facility consist of 2 or 4 letter keywords which may be followed by various arguments. Except for the title command, (see section Controlling Data Flow), the commands expect their arguments free field. If any arguments are not specified, they will default to 0 unless otherwise noted.
To exit from SPHERE, specify EX or END as a command and you will exit.
When SPHERE is first called, all of its data structures are initialized. Thereafter, leaving and reentering it will not affect anything internal to it. This permits you to construct images of multiple molecules very easily. To initialize everything back to its starting state, use the HO command, see section Controlling Data Flow.
Since the data structures sphere drawing are used for the PEER command, see section PEER Command, the initial display device is a small dummy device that does not require much pixel storage. Therefore, before making a picture, you must also specify an output device size using the DV command or use the various screen size and scale factor commands described in section Transformations from the Coordinates to the Image.
Before invoking SPHERE, you must have read in a PSF, coordinate set, and parameter set; unless you read in a spheres list in which case nothing is needed. Note that if the PSF is changed by a SPLICE command or by an editing command, the HOME command should be executed, see section Transformations from the Coordinates to the Image.
Prior to the transformation of atoms into a spheres list, the user may select the atoms he wishes to display, what color they will be displayed with, and the radii to be used. By default, all atoms in the PSF are displayed. The radii are initialized to the radii given by the van der Waals parameters. The default colors for the atoms are set using the following table:
1 Red 2 Green 3 Yellow 4 Orange 5 Blue 6 Magenta 7 Cyan 8 Gray 9 White 10 BlackYou may defined additional colors using the DC command below.
The commands for controlling the transformation from atomic coordinates to the spheres list are described below. They take effect for any TR commands executed thereafter.
Device name Xpixels Ypixels Xscreen Yscreen IRIS or 4D 1250 994 33.75 26.84 PS390 1024 864 32.5 27.42 DEANZA 512 512 20.0 20.00 DUMMY 25 25 1.0 1.0
If the device name is not recognized, then the DEANZA dimensions are used.
The commands in this section control the flow of data from the CONGEN coordinates into images.
An example title command would be
TL ; KOL;
The equation for determining the intensity of a particular pixel is as follows:
_ _ _ _ G I = I + (I - I ) (K N . L + K (R . O) LOW HI LOW D S where I minimum intensity for a pixel. This provides for LOW an ambient light level. Defaults to 10. I maximum intensity for a pixel. Useful if the HI display saturates below 255. Defaults to 255. K coefficient of diffusive reflection, ie. uniform D scattering of light. Defaults to 0.5. K coefficient of specular reflection, ie. where S light reflects in a particular direction. Defaults to 0.5. _ Unit normal vector of the sphere's surface at the pixel N coordinate. _ Unit vector pointing to the light source. Defaults to L (0,0,1). A vector of (0,0,-1) is perfect backlighting which sets all pixels to I . (0,1,0) gives right lighting. LOW _ Unit vector giving the reflected light vector off the R surface. Computed as follows: _ _ _ _ _ R = 2 N . L N - L _ Vector to observer. This is preset to (0,0,1) O so that the observer is at z = infinity G Glossiness exponent. This controls how accurately the reflected light vector must point toward the observer. Low values (3-6) give a metallic appearance. Larger values (30-100) give a more plastic appearance. Defaults to 6.
All negative dot products are converted to zero which models the opacity of the surface. The commands for manipulating the shading parameters are as follows:
In this example, we produce a full screen image of the Fv of KOL.
Example of drawing KOL * OPEN NAME CGDATA:RTOPH8.MOD UNIT 01 READ UNFORM OPEN NAME CGDATA:PARAM5.MOD UNIT 03 READ UNFORM OPEN NAME CGTD:KOLPSF.MOD UNIT 12 READ UNFORM OPEN NAME CGTD:KOLV.MOD UNIT 14 READ UNFORM READ RTF UNIT 1 READ PARAMETER UNIT 3 READ PSF FILE UNIT 12 READ COOR FILE UNIT 14 ! At this point, all requisite data structures have been read. OPEN UNIT 20 NAME KOL.IMG WRITE UNFORM ! Get a file for the new image SPHERE ! Enter SPHERE. TL ; KOL; ! Simple title AS ! Full screen scaling TR ! Make spheres list IM ! Make the image WI 20 ! Write the image out. EX ! All done.
In this example, we produce a stereo image of the Fv of KOL.
Drawing a stereo image of KOL. * OPEN NAME CGDATA:RTOPH8.MOD UNIT 01 READ UNFORM OPEN NAME CGDATA:PARAM5.MOD UNIT 03 READ UNFORM OPEN NAME CGTD:KOLPSF.MOD UNIT 12 READ UNFORM OPEN NAME CGTD:KOLV.MOD UNIT 14 READ UNFORM READ RTF UNIT 1 READ PARAMETER UNIT 3 READ PSF FILE UNIT 12 READ COOR FILE UNIT 14 ! At this point, all requisite data structure have been read. OPEN UNIT 20 NAME KOLSTEREO.IMG WRITE UNFORM ! Get a file for the new image SPHERE ! Enter SPHERE. TL ; KOL; ! Simple title AS 2.0 ! Half size scaling OC -3.25 ! Move the image to the left side TR ! Make spheres list for left side SO 6 6.5 ! Make right side transformation TR ! Add spheres for the right side IM ! Make the image WI 20 ! Write the image out. EX ! All done.
Display of 9 images of hypervariable loops of McPC 603 * OPEN NAME CGDATA:RTOPH8.MOD UNIT 01 READ UNFORM OPEN NAME CGDATA:PARAM5.MOD UNIT 03 READ UNFORM OPEN NAME [BRUC.SEARCH]M603VPSF.MOD UNIT 12 READ UNFORM OPEN NAME [BRUC.M603.A.NEW]M6VAMN18.MOD UNIT 14 READ UNFORM READ RTF UNIT 1 READ PARAMETER UNIT 3 READ PSF FILE UNIT 12 READ COOR FILE UNIT 14 ! ! At this point, everything we need except the trajectory has been read. ! We now orient the coordinates to a standard orientation. ! COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA OPEN UNIT 20 NAME MCPDYN.IMG WRITE UNFORM ! File where image will go SPHERE TL ; McPC 603 DYNAMICS, 500 K. 0,6,12,20,34,54,74,94,114 PS; ! ! Display only the hypervariable loops. ! RM ALL AD CLEAR RANGE H 31 N H 35 O - RANGE H 51 N H 65 O - RANGE H 101 N H 107 O - RANGE L 24 N L 40 O - RANGE L 56 N L 62 O - RANGE L 95 N L 103 O AS 3.2 ! Need three fold reduction YR 180 ! Reorient for better view. CO 1 CLEAR RANGE H 31 N H 35 O ! Color the loops CO 2 CLEAR RANGE H 51 N H 65 O CO 3 CLEAR RANGE H 101 N H 107 O CO 2 CLEAR RANGE L 24 N L 40 O CO 1 CLEAR RANGE L 56 N L 62 O CO 4 CLEAR RANGE L 95 N L 103 O OC -4.3 3.8 ! First picture in top left TR ! Make spheres for first picture EX ! Back to CONGEN for more work OPEN UNIT 14 NAME D18.CRD UNFORM READ ! Trajectory READ COOR FILE UNIT 14 IFILE 30 ! Get fresh coordinates ! ! Reorient like the first set ! COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Second picture to right of first. TR ! Add spheres for next picture. The ! previous transformation applies. EX ! ! Spheres for the next seven pictures are generated the same way. ! OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 60 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Third picture to right of second. TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 100 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC -8 -3.7 ! Fourth picture at middle left TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 170 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Fifth picture at center. TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 270 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Sixth picture at center right TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 370 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC -8 -3.7 ! Seventh picture at bottom left TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 470 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Eighth picture at bottom center TR EX OPEN UNIT 14 NAME D18.CRD UNFORM READ READ COOR FILE UNIT 14 IFILE 570 COOR ORIENT CLEAR ATOM H 22 CA ATOM H 98 CA ATOM L 23 CA ATOM L 94 CA SPHERE OC 4 0 ! Ninth picture at bottom right TR EX SPHERE IM ! Finally, construct the image from ! all the spheres we've collected. WI 20 ! Write the image out EX ! All done.
There are five programs available for displaying images, diris for the Silicon Graphics Iris 4D workstations, sphrgb for converting images to Silicon Graphics Iris 4D RGB image format, DISPIMG and DISPMANY for the Deanza belonging to the Cardiac Unit, and DI340 for an Evans and Sutherland Picture System 340. DISPIMG, DISPMANY, and DI340 will currently work only on a VAX/VMS system, and are configured for the computer environment at Massachusetts General Hospital. All programs take files generated by the WI command, see section Controlling Data Flow, and send them to the appropriate device. They are defined as shell commands when correctly installed, see section Installation of CONGEN on VMS, and section Installation of CONGEN on UNIX, and are part of the support programs, see section Support Programs. DISPIMG and DI340 take a single file as an operand, and display the image stored therein. DISPMANY accepts a list of file names from SYS$INPUT: and displays them in sequence on the Deanza by overwriting the pixels without erasing the image first. This has the advantage of letting the eye see differences between two images.
In addition to DI340, there is a program, SLU, for setting the color lookup tables in the PS340 raster display.
diris takes an image file as its only argument, and displays on the Iris 4D screen. You have the option of setting the window size, and diris will center the image within that space. Use the right mouse button to bring up the normal pop-up menu manipulate the window. Typing ESC will kill the window.
sphrgb converts an image file to the Silicon Graphics RGB format. Silicon Graphics provides a large number of unsupported(21) tools for manipulating these images. For example, you can create a series of snapshots of your system, and then use the movie program to display them sequentially at high speed. The tools are part of the `4Dgifts' subsystem.
sphrgb expects two arguments as follows:
sphrgb congen-image-file rgb-file
The size of image will be set to the size specified as the pixel dimensions in your XP and YP commands to CONGEN, see section Transformations from the Coordinates to the Image, for more information. There is currently a limit of 4096 in the horizontal dimension for these images.
DI340 takes an image file as its only argument and
displays it on the E&S PS340 in Jackson 1306 using the Ethernet. (Note:
this display location is determined by a PATTCH
subroutine call
in the program). Because the display is slow, the program displays every
third scan line so that the overall appearance of the image can be seen
quickly.
N.B. This program only works on a VAX/VMS system.
DISPIMG takes an image file as its only parameter and displays it on the Cardiac Unit Deanza image processor. This Deanza has only red and green display channels, so two qualifiers for the command are provided. The syntax is
{ RED } { RED } DISPIMG file-spec /RED={ GREEN } /GREEN={ GREEN } { BLUE } { BLUE }
The value of each qualifier determines what color plane is displayed on the Deanza's color planes.
N.B. This program only works at Massachusetts General Hospital on the VAX connected to the Deanza Image Processor.
DISPMANY will display a series of images on the Cardiac Unit Deanza image processor. This Deanza has only red and green display channels, so two qualifiers for the command are provided. The syntax is
{ RED } { RED } DISPMANY file-spec /RED={ GREEN } /GREEN={ GREEN } { BLUE } { BLUE }
The value of each qualifier determines what color plane is displayed on the Deanza's color planes.
The files containing the images to be displayed are read one per
line from SYS$INPUT
:
N.B. This program only works at Massachusetts General Hospital on the VAX connected to the Deanza Image Processor.
SLU (Set LookUp) will set the color lookup tables for the Evans & Sutherland Picture 340. The color lookup tables are used to adjust for the scaling of intensities for each of three primary colors. In our eyes, the lower end of the scales are too dark, so SLU provides a smooth mechanism for shifting the values. The function used is
where x is the position in the color lookup table and f(x) gives the adjusted value. k, which depends on b, is adjusted to correctly normalize f(x). The program asks for b. DI340 sets b to 1.
N.B. This program works only a VAX/VMS computer.
The PEER command is used for generating input files to the peer program, see section peer -- Interactive Molecular Display Program, for a complete description.
PEER UNIT unit [RADIus real] [SEQLink] atom-selection
The atom-selection is described in section Atom Selection.
Each invocation of the PEER command generates a single object for use by peer. The object consists of three parts; a list of colors, a list of atoms, and a list of bonds. The colors come from the SPHERE command. The atoms are selected from atom-selection you specify in the command, and only atoms which have defined coordinates are eligible for inclusion into the object. The bonds can be specified in two ways. If you omit the SEQLINK option, then only bonds between selected atoms are included. If you include the SEQLINK option, then a bond is drawn between each selected atom. This latter option is useful for making alpha-carbon displays. The object is written to the file on the unit you specify with the UNIT operand. It is a formatted file, and if multiple PEER commands are issued to the same unit in a CONGEN run, each object will be appended to the file. Note that only the first color table is used by peer.
Before using the PEER command, you must first invoke the SPHERE command, see section Using the Sphere Drawing Commands. It suffices just to enter the command, and then leave it. For example,
SPHERE EX
The SPHERE command defines the color table, as well as specifying a default color for all the atoms in the system.
Normally, atomic radii are specified by the parameter set as the van der Waals radii. However, if the RADIUS option is used, then you can specify the radii of all the atoms explicitly. Do not specify a negative or zero radii, as CONGEN will interpret this to mean that the van der Waals radii should be used.
Go to the previous, next section.