Go to the previous, next section.

Molecular Graphics

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.

Sphere Drawing -- CPK Style Molecular Graphics

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.

Overview of Sphere Drawing

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:

  1. The rotation origin (OD) is subtracted from each component.
  2. A rotation matrix is applied to each atomic position and the rotation origin is added back. The user can freely specify the rotation.
  3. The components and radii are divided by the angstroms/cm scale factor.
  4. The origin shift (OC) is added to the coordinates.
  5. The components and radii are multiplied by the pixels/cm scale factor. The Y coordinate is inverted to make the origin into the bottom left of the screen.

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.

Using the Sphere Drawing Commands

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.

Atom Manipulations

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:

Nitrogens
Cyan
Carbons
Gray
Hydrogens
White
Oxygens
Red
Sulfur
Yellow
Others
Magenta
The commands for this section are as follows:

ADD -- Mark Atoms for the Spheres List

Syntax:
ADd atom-selection
Function:
The atoms in the atom selection (see section Atom Selection) are marked for inclusion into the spheres list.

COLOR -- Color Atoms

Syntax:
COlor color atom-selection
Function:
The color for atoms in the atom-selection (see section Atom Selection) is set to the color. Colors may be specified as either a word or an integer. The word gives the color name, and the integer gives the position of the color in the color table. Ten colors have guaranteed numbers, namely,

    1       Red
    2       Green
    3       Yellow
    4       Orange
    5       Blue
    6       Magenta
    7       Cyan
    8       Gray
    9       White
   10       Black
You may defined additional colors using the DC command below.

DC -- Define Colors

Syntax:
DC color real real real real real real
Function:
Defines a color. The color keyword is the name of the color and must not be an integer. The six real numbers following give the range of intensities using the RGB (Red, Green, and Blue) color scheme. The first two reals give the low and high limits for the red channel, the next two give the limits on green, and the last two specify blue. All limits should be between 0 and 1.

SFR -- Set Radius for Surface Coloring

Syntax:
SFR real
Function:
Specifies the radius for identifying pixels that are accessible. If this variable is positive, then all pixels which correspond to accessible points will be colored according to the SFCO (surface color) commands. NB: This option is very expensive to compute.

SFCO -- Set Color for Accessible Surface

Syntax:
SFCO color atom-selection
Function:
Same as the COLOR command above except the surface colors are set.

RA -- Set Atom Radii

Syntax:
RA real atom-selection
Function:
The radii of the atoms in the atom selection, see section Atom Selection, are set to the real number specified.

RC -- Reset Colors

Syntax:
RC
Function:
Reset Colors. The colors of the atoms are reset to the default scheme given above.

RM -- Unmark (Remove) Atoms

Syntax:
RM atom-selection
Function:
The atoms in the atom selection (see section Atom Selection) are removed from the list of atoms to be included into the spheres list. This is the inverse of the AD operation.

RR -- Reset Atomic Radii

Syntax:
RR
Function:
Reset Radii. The radii of the atoms are reset to the values given in the parameter set. Be careful using this after reading in a spheres list, see section Controlling Data Flow, because the PSF entries pointing to the parameter list (if it exists at all) are likely to be inconsistent.

ZMARK -- Mark Atoms by the Z Coordinate

Syntax:
ZMARk real
Function:
Mark atoms by their Z coordinate. Any atom whose Z coordinate plus its radius is greater than the parameter specified by this command will be removed from the list of atoms to be transformed into the spheres list. See the command, ZCUT, section Transformations from the Coordinates to the Image, a variant of this command.

Transformations from the Coordinates to the Image

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.

AS -- Automatic Scaling

Syntax:
AS real
Function:
Automatic scaling. The purpose of automatic scaling is to set transformation parameters so that the image will be centered in the Deanza screen and make full use of the screen. Both the scale factor and the origin shifts (OC) are set. In addition, the rotation origin (the point about which the rotation matrix is applied) is set to midpoint of the molecule. If a real number is specified, it is used to scale down the size of the image so that it will less of the screen. E.g., a scale factor of 2 will result in a image that whose maximum vertical or horizontal dimension will be less than half the screen.

DV -- Set Device Drawing Parameters

Syntax:
DV string
Function:
Device setting. This command will set the number of pixels in the vertical and horizontal dimensions as well as the screen size according to the device you specify by the string. The following devices are recognized:

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.

HOME -- Reset Sphere Drawing Parameters

Syntax:
HOme
Function:
Initialize everything to starting state. I.e. origin shifts are set to zero, the rotation matrix is set to the identity matrix, scale factor is set to 1 Angstrom for the screen size, colors back to their default, etc.

IR -- Input Rotation Matrix

Syntax:
IR real real real real real real real real real
Function:
Input rotation matrix. The elements are read in the following subscript order, 11 12 13 21 22 23 31 32 33.

OC -- Shift Screen Origin in Centimeters

Syntax:
OC real real real
Function:
Origin shift in centimeters. The image is moved relative to the screen in units of centimeters by the amounts given in the command. The first number gives the horizontal shift; the second number gives the vertical shift; the third the depth shift, which will be significant if two separate images are overlaid upon each other.

OD -- Set Origin of Data

Syntax:
OD real real real
Function:
Set Origin of Data, ie. origin of rotation. The rotation matrix will be applied about this origin. The origin is specified by X, Y, and Z in the space of atomic coordinates.

OR -- Set Origin of Data in Screen Size Units

Syntax:
OR real real real
Function:
Set the picture origin in units of the screen size. The three arguments give the X, Y, and Z; horizontal, vertical, and depth shifts; respectively. Upon initialization, the origin is set at the bottom left of the screen. This command moves the origin so that image is shifted by the amounts specified in the command. For example, if the atomic coordinates are centered about the origin, an OR 0.5 0.5 command will center the image about the center of the screen. An OR 1.0 command will center the image about the lower right corner of the screen. The Z shift can be useful to control how two different molecules will overlay each other. This command works by changing the OC parameters described above.

SA -- Scale in Angstrom Units

Syntax:
SA real
Function:
Sets the scale factor which is in units of Angstroms / cm. For example, SA 2 will set a scale factor of 2 Angstroms/cm. The actual size of a centimeter on the screen depends on the device parameters which specify the number of pixels and screen size in each dimension. If the argument is omitted, the scale factor will be set to 1.

SCALE -- Scale by a Multiplicative Factor

Syntax:
SCale real
Function:
Multiplies the current scale factor by the argument to this command. If the argument is not specified, the command has no effect.

SHOW, SR -- Show Drawing Parameters

Syntax:
SHow
Function:
Show Rotation and other transformation parameters. Prints the rotation matrix, data origin (OD), origin shift (OC), scale factor (SA), and a checksum for the image.

Syntax:
SR
Function:
Same as SH above.

SO -- Set Stereo Offset

Syntax:
SO real real
Function:
Stereo Offset command. The first argument specified the rotation in degrees about the Y axis to be applied. The second argument moves the image that many centimeters to the right. A typical command here would be SO 6 6.

XP -- Set Horizontal (X) Pixel Count

Syntax:
XP int
Function:
Sets the number of pixels in the horizontal (X) dimension.

XR -- X Rotation

Syntax:
XR real
Function:
Rotation about X axis. The argument specifies how degrees about the X axis the image should be rotated. The command results in the modification of the rotation matrix.

XS -- Set Horizontal (X) Screen Size

Syntax:
XS real
Function:
Sets the screen size in centimeters for the horizontal (X) dimension. N.B. Be careful to avoid a difference between the number of pixels per centimeter in the horizontal and vertical dimensions unless you are trying to generate some unusual visual effects.

YP -- Set Vertical (Y) Pixel Count

Syntax:
YP int
Function:
Sets the number of pixels in the vertical (Y) dimension.

YR -- Y Rotation

Syntax:
YR real
Function:
Rotation about Y axis. The argument specifies how degrees about the Y axis the image should be rotated. The command results in the modification of the rotation matrix.

YS -- Set Vertical (Y) Screen Size

Syntax:
YS real
Function:
Sets the screen size in centimeters for the vertical (Y) dimension. N.B. Be careful to avoid a difference between the number of pixels per centimeter in the horizontal and vertical dimensions unless you are trying to generate some unusual visual effects.

ZCUT -- Mark Atoms by Transformed Z's

Syntax:
ZCUT real
Function:
ZCUT defines a visibility plane normal to the Z axis. Only those atoms whose upper surface is less than the parameter specified to this command will be displayed. The determination of Z is made after the molecule has been rotated. See the ZMARK command, section Atom Manipulations, for a variant.

ZR -- Z Rotation

Syntax:
ZR real
Function:
Rotation about Z axis. The argument specifies how degrees about the Z axis the image should be rotated. The command results in the modification of the rotation matrix.

Controlling Data Flow

The commands in this section control the flow of data from the CONGEN coordinates into images.

CS -- Clear Spheres List

Syntax:
CS
Function:
Clear Spheres list. Initializes the spheres list so a new image can be created.

IMAGE -- Make the Sphere Drawing Image

Syntax:
IMage
Function:
Construct an image from the currently stored spheres list. This command generally takes a minute or two of CPU time.

RS -- Read Sphere List from a File

Syntax:
RS integer
Function:
Read Spheres list from unit given as integer. This command reads a spheres list back in and uses the nomenclature information in the file to build a new set of nomenclature, residues, and segments in the PSF (thereby destroying the old info.) If you create a spheres list by another program containing only coordinates, radii, and colors; you'll be able to perform coordinate manipulations and image generation just fine; but you will not be able to reference atoms by name since all the identifying information will be blank (and therefore equal and indistinguishable).

TL -- Set Title

Syntax:
TL specially-delimited-string
Function:
Sets the title of image. This line will be appear at the bottom of the screen. Spaces will not obscure the image so you can use multiple spaces to shift the title around your picture. The specially-delimited-string begins with a delimiter character which can be any character followed by a string which does not contain the delimiter followed by the delimiter character. This construction allows you to use any character in your title.

An example title command would be

TL ;          KOL;

TRANSFORM -- Transform Atoms to Spheres

Syntax:
TRansform
Function:
Transform the currently selected list of atoms and add them to the spheres list. This command actually performs the transformation specified by the transformation commands in section Transformations from the Coordinates to the Image.

WI -- Write Image to a File

Syntax:
WI integer
Function:
Writes the current Image to the unit specified as an integer. The file format consists of unformatted records containing just the non-zero pixels.

WS -- Write Spheres to a File

Syntax:
WS integer
Function:
Write the Spheres list to the unit specified as an integer. The file format is a simple formatted list of coordinates, radii, and colors with the title being the first record, and the number of spheres being the second.

Adjustment of the Lighting and Shading

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:

BC -- Set Background Color

Syntax:
BC color real
Function:
Sets the background color. The color is specified as either a string or an integer, see the color commands in section Atom Manipulations. The second parameter is an intensity which may range between 0 and 1. It selects what intensity the background color will be.

GLOS -- Set Glossiness Drawing Parameter

Syntax:
GLOS integer
Function:
Sets G to whatever value you specify. Negative arguments are converted to 0.

LRAN -- Set Lighting Range

Syntax:
LRAN integer integer
Function:

LV -- Set Lighting Vector

Syntax:
LV real real real
Function:
Set the X, Y, and Z components of the lighting vector to the three arguments, respectively. The vector is normalized automatically.

SDCO -- Set Lighting Coefficients

Syntax:
SDCO real real
Function:
Specular Diffuse COefficient setting. The specular and diffuse scattering coefficients are set to the first and second arguments, respectively. The coefficient are normalized so that their sum is one.

SL -- Show Lighting Parameters

Syntax:
SL
Function:
Show Lighting parameters. Prints the various shading parameters.

Miscellaneous Sphere Drawing Commands

END, EXIT -- Exit Sphere Drawing

Syntax:
END
Function:
Return to CONGEN. All data structures are maintained until SPHERE is reinvoked.

Syntax:
EXIT
Function:
Same as END.

Example 1 -- Full Screen Image

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.

Example 2 -- Making a Stereo Image

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.

Example 3 -- Nine Drawings in One Image

In this example, we prepare an image which has 9 pictures generated from time points in a molecular dynamics calculation of McPC 603. Only the hypervariable loops are displayed and the loop are color coded so that they can be distinguished.

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.

Displaying Pictures

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 -- Display on Iris 4D workstations

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 -- Convert to SGI RGB Format

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 -- Display images on PS340

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 -- Display Images on the Deanza

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 -- Display Many Images on Deanza

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 -- Gamma Correction for E&S PS 340

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.

PEER Command

The PEER command is used for generating input files to the peer program, see section peer -- Interactive Molecular Display Program, for a complete description.

Syntax

PEER UNIT unit [RADIus real] [SEQLink] atom-selection

The atom-selection is described in section Atom Selection.

Function

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.