Programming

Introduction

Programming in WHAT IF is hard to learn. But if you master, not even the sky is the limit. You can get access to an enormous protein data infrastructure. This infra-structure includes full access to crystal symmetry, all kinds of checking and correction options, things like accessibilities-hydrogen bonds- database hits-etcetera all are available to you with just one line of code.

The coding

One of my key objectives during the design of WHAT IF has been the ease of extension, both by myself, and by others. I have tried to obey a few ground rules rigidly throughout the entire design phase. These rules are:

User supplied subroutines that disobey any of the above 5 rules will not be acceptable for me to become an official WHAT IF subroutine.

Rules for writing your own subroutines

How to write an extension. In order to be able to write extensions to WHAT IF, or to make modifications in it without making it impossible to install future updates several rules should be taken into account:

The whatif data structure

The WHAT IF data structure recides in the .INC files that you find in the src directory.

Data structure description

The main data structure for WHAT IF is the soup. This appendix describes this soup, the molecules-residues-atoms in it, as well as several of the key variables needed to undestand the program, and some of the key routines that operate on the soup.

Molecule level

The soup consists of molecules. There can be MAXMOL molecules, MAXMOL is a parameter set in the include files. Every molecule has a name stored in the array SOUNAM(). The array SOUADM(,) holds some information about the molecules in the soup. The following is stored for molecule ISOUP in SOUADM(,):

SOUADM(ISOUP,1)   pointer to first residue in molecule
SOUADM(ISOUP,2)   pointer to last residue in molecule
SOUADM(ISOUP,3)   number of residues in the molecule
SOUADM(ISOUP,4)   number of atoms in the residue
SOUADM(ISOUP,5)   molecule type:
                  1) protein
                  2) multi atomic drug or ligand or co-factor (simply
                     called  drug throughout this writeup)
                  3) DNA or RNA
                  4) single atomic drug ligand or co-factor
SOUADM(ISOUP,6)   pointer to first connectivity in drug connectivity
                  table
SOUADM(ISOUP,7)   pointer to last connectivity in drug connectivity
                  table. These two pointers are only set if
                  souadm(isoup,5)=2
SOUADM(,) is an integer array.

Residue level

Proteins and nucleic acids are subdivided in residues. The soup can hold up to MAXAA residues. Every residue, drug or water is an entity. The soup can hold up to MAXRES entities.

The soup is organized such that proteins and nucleic acids come first, thereafter come the drugs, and finally the water molecules. This of course is not needed as you will see when you read this appendix carefuly, but it makes it easier to add subroutines to the program on the long run this way.

At the entity level several arrays are being used. For entity IAA the following information is kept in common:

PNTAAS(IAA)   pointer to first atom in IAA. (INTEGER).
PNTAAC(IAA)   pointer to  alpha  carbon  in  IAA  (if IAA  is an amino
              acid). (INTEGER).
PNTAAE(IAA)   pointer to last atom in IAA. (INTEGER).
CHAINN(,IAA)  CHAINN(1,IAA)=1 for  the N-terminal  residue in a chain,
              The C-terminal residue becomes 3. All other residues get
              the value 2.  CHAINN(2,IAA)  contains  the number of the
              molecule of which this residue is a part.
ONESA3(IAA)   type  indicator  of the entity.  For amino acids this is
              ALA,  CYS,  etc.  For nucleic acids DCYT,  DGUA,  etc is
              used.  No rules for nomenclature exist for drugs. Waters
              are called H2O. (CHARACTER*4).
ONESA1(IAA)   holds  the  character*1  representation  of  ONESA3(). I
              don't  think this  array  is  ever  used yet in WHAT IF.
              (CHARACTER*4).
NUMNAM(IAA)   This  is  the user given  name to  the entity.  No rules
              exist, but it is best to keep all NUMNAM()'s in the soup
              unique.  Mostly NUMNAM()'s  are just sequential numbers.
              (CHARACTER*4).
ACCDON(IAA)   flag that  becomes  true  if the  accessibility for this
              entity has been calculated. (LOGICAL).
AAISOK(IAA)   flag  that  becomes  true if the checks for nomenclature
              and completeness are all ok for a residue. (LOGICAL).
SPHRAD(,IAA)  information about  the smallest sphere that can hold the
              entity. The first three numbers  are  the x-, y-, and z-
              coordinate  of the center,  and the fourth coordinate is
              the radius. (REAL).
SUMACC(IAA)   holds the sum of the accessibilities of all atoms in the
              entity. (REAL).
PRPVAL(IAA)   The property moments (see the appendix on hydrophobic or
              property moments) are stored in this array. (REAL).
XYZCAS(,IAA)  This  array  is often  used to temporarily store the x-,
              y- and z-coordinates of the alpha carbons of amino acids
              in case they need to be changed for a short time (REAL).
CHIANG(,IAA)  holds phi,  psi,  omega,  and chi-1 till chi-5 for amino
              acids. (REAL).
ETMTOT(,IAA)  holds for  every energy  term the sum  of all individual
              atomic contributions. (REAL).
AMODEL(IAA)   flag that is true if  IAA  is activated for  the working
              model. (LOGICAL).
LOCHST(IAA)   secundary structure determination by DSSP (CHARACTER*1).

Atomic level

At the atomic level the following arrays are being used:

XCOORD(IAT)   x-coordinate of atom IAT. (REAL).
YCOORD(IAT)   y-coordinate of atom IAT. (REAL).
ZCOORD(IAT)   z-coordinate of atom IAT. (REAL).
XBFACT(IAT)   crystallographic b-factor. (REAL).
ACCESS(IAT)   atomic accessibility for water. (REAL).
WEIGHT(IAT)   occupancy. (REAL).
VDWRAD(IAT)   Van derWaals radius. (REAL).
ONESAT(IAT)   name of the atom, eg. CA, N, P, CD1, etc. (CHARACTER*4).
ATCOLR(IAT)   colour of IAT (0-360). (INTEGER).

Counters

The following counters are needed in order to know how much matter is present in the soup:

NUMAAT        total number of entities.
NUMAAF        total number of residues.
NUMATF        total number of atoms.
NUMCOF        total number of drugs.
NUMCON        total number of drug connectivities.
NUMSOU        total number of molecules (excluding waters) in the soup

Example

To loop over all molecules, and then for every molecule over all its residues (for drugs this is always one of course), and finally for every residue over all its atoms, you need the following nested loops:

      DO 30 ISOUP=1,NUMSOU
         DO 20 IAA=SOUADM(1,ISOUP),SOUADM(2,ISOUP)
            DO 10 IAT=PNTAAS(IAA),PNTAAE(IAA)
               here you can do something with the atom
   10       CONTINUE
   20    CONTINUE
   30 CONTINUE

The subroutine

In the src menu you find the file BOX.INC. This file holds:

      SUBROUTINE
C+++
C-------------------------------------------------------------------------------
C----                                                                       ----
C----
C----                                                                       ----
C.--- THIS SUBROUTINE IS PART OF THE WHAT IF PACKAGE. IT IS NOT ALLOWED TO  ----
C.--- REDISTRIBUTE THIS SUBROUTINE. ALSO NOT ALLOWED IS THE USAGE IN OTHER  ----
C.--- PROGRAMS. IT IS NOT ALLOWED TO MODIFY THIS SUBROUTINE.                ----
C.--- WHAT IF IS WRITTEN BY G.VRIEND FOR FREE USAGE BY ACADEMIC AND OTHER   ----
C.--- NON-PROFIT ORGANIZATIONS. RESULTS OBTAINED BY THIS PROGRAM CAN FREELY ----
C.--- BE PUBLISHED PROVIDED THE PROGRAM AND ITS AUTHOR ARE ACKNOWLEDGED     ----
C.--- BY NAME. COMMERCIAL ORGANISATIONS CAN OBTAIN A LICENSE TO USE WHAT IF ----
C.--- SUCH A LICENSE GIVES THEM THE FULL RIGHTS TO DO EVERYTHING WITH IT    ----
C.--- THEY WANT, EXCEPT REDISTRIBUTE, OR PUBLISH THE PROGRAM.               ----
C----                                                                       ----
C--------1---------2---------3---------4---------5---------6----------72--------
C===
      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
C----
C---- PUSH THIS ROUTINE ON THE DEBUG STACK
C----
C     CALL WIFPUSHSTK ('Oeps')
C----
C---- LOOK FOR TRIVIAL ERRORS
C----
C----
C---- INITIALIZE
C----
      GOTO 998
C----
C---- HERE UPON WRITE ERRORS
C----
  999 CONTINUE
      CALL GVSEIW ('...')
C----
C---- POP THIS ROUTINE FROM THE DEBUG STACK
C----
  998 CONTINUE
C     CALL WIFPOPSTK ('Oeps')
      RETURN
      END

If you want your source to be an integral part of WHAT IF (i.e. supported by me), then you should use this same format. The comment block at the top is fixed format. The IMPLICIT NONE is obligatory. The (commented out) calls to WIFPUSHSTK and WIFPOPSTK are obligatory (and should hold the name of the subroutine instead of oeps). If you use WRITE statements they must hold ERR=999 and the ... in the GVSEIW call should be replaced by the name of the subroutine or by an intelligent message that states what went wrong upon writing something. You might not need BIGINC.INC, or you might need other include files. That is your problem. The part between INITIALIZE and GOTO 998 is 'yours'.

The module

It would be best if you put all your stuff in one module (but I can easily allow for more modules if that would be useful). Make sure the first subroutine in the module works like a menu-handler. This subroutine should roughly look like this example:

      SUBROUTINE ACC000 (DONE)
C+++
C-------------------------------------------------------------------------------
C----                                                                       ----
C---- DRIVER FOR ACCESSIBILITY CALCULATIONS                                 ----
C----                                                                       ----
C.--- THIS SUBROUTINE IS PART OF THE WHAT IF PACKAGE. IT IS NOT ALLOWED TO  ----
C.--- REDISTRIBUTE THIS SUBROUTINE. ALSO NOT ALLOWED IS THE USAGE IN OTHER  ----
C.--- PROGRAMS. IT IS NOT ALLOWED TO MODIFY THIS SUBROUTINE.                ----
C.--- WHATIF IS WRITTEN BY G.VRIEND FOR FREE USAGE BY ACADEMIC AND OTHER    ----
C.--- NON-PROFIT ORGANIZATIONS. RESULTS OBTAINED BY THIS PROGRAM CAN FREELY ----
C.--- BE PUBLISHED PROVIDED THE PROGRAM AND ITS AUTHOR ARE ACKNOWLEDGED     ----
C.--- BY NAME. COMMERCIAL ORGANISATIONS CAN OBTAIN A LICENSE TO USE WHATIF  ----
C.--- SUCH A LICENSE GIVES THEM THE FULL RIGHTS TO DO EVERYTHING WITH IT    ----
C.--- THEY WANT, EXCEPT REDISTRIBUTE, OR PUBLISH THE PROGRAM.               ----
C----                                                                       ----
C-------------------------------------------------------------------------------
C===
C===
      IMPLICIT      NONE
      INCLUDE       'BIGINC.INC'
      INCLUDE       'OPTION.INC'
      LOGICAL       DONE
C----
C---- PUSH DEBUG STACK
C----
c     CALL WIFPUSHSTK ('ACC000')
C----
C---- INITIALIZE
C----
      DONE=.FALSE.
C----
C---- OPTION: LOOPAC
C----
      IF (OPTIN.EQ.'LOOPAC') THEN
         Hier some call to one of your modules
         DONE=.TRUE.
C----
C---- OPTION: DOITAC
C----
      ELSE IF (OPTIN.EQ.'DOITAC') THEN
         Hier some call to one of your modules
         DONE=.TRUE.
     END IF
C----
C---- POP DEBUG STACK
C----
c     CALL WIFPOPSTK ('ACC000')
      RETURN
      END

DONE is the parameter that tells WHAT IF that the option went well. You don't need to deal with unknown option warnings, and neither should you worry about reading the user's options. WHAT IF does all that for you.

The actual option to execute (in the above example that is either LOOPAC or DOITAC) will be placed by WHAT IF in the CHARACTER*6 variable OPTIN that sits in the include file OPTION.INC. Instead of ACC000 you should use your three-letter code with anything behind it you want.

It is nice for the FORTRAN to C converting compilers if you avoid underscores in subroutine names.

Available tools

WHAT IF provides a few thousand tool subroutines. There is no way I can type the documentation for all of them. The following sections list a series of modules. I strongly suggest you do not blindly trust these lists. When you call a standard routine, always check its source code, or if it is a big and complicated routine, check that the parameters and documentation on the top agree with what you expect.

The tools come principally in a few categories

The following blocks list some of the routines that could also function in other programs, albeit that I must admit that a few WHAT IF specific routines sneaked in...

Common variables that can be used at will

To realy find out which variables you can all use, you have to go through the (very long) list of include files. Here I will list a series of variables available in BIGINC.INC that have no other function than being used by you.

CHARACTER*80     LINE,   LINE2,  LINE3,  LINE4,  LINE5
CHARACTER*132    BIGLIN, BIGLN2
CHARACTER*250    LINE250, OPTINP, TEXT250
CHARACTER*300    LINE300
CHARACTER*1000   LINE1000, CHAR1000
CHARACTER*2000   LINE2000
CHARACTER*10000  LINE10000
REAL             XYZ(3), CV(3), MAT_1(3,3), MAT_2(3,3), MAT_3(3,3),
                 MAT_4(3,3), SCRRW1(3), SCRRW2(3), SCRRW3(3),
                 SCRRW4(3), SCRRW5(3), SCRRW6(3)

Program parameters

WHAT IF has several hundred parameters built-in that can be used to modify its behaviour. These parameters are available in a big flat-file.

The first few lines of this file (which inside WHAT IF is located in the dbdata directory and is called PARAMS.FIG) look like:

     This is the WHAT IF internal parameter file. This file holds
     many different parameters that are internally used for different
     purposes. If you are smart you can change this file to make
     WHAT IF behave differently. If you are smart, you do not touch
     this file, other than to read it, and use the SETWIF command
     to change parameters on the fly. That is less permanent. If you
     work with web-services then, no matter how smart you are,  you
     will need to read this file if you want to modify WHAT IF parameters.
     The format of this file is as follows:
      - This top 90% is only a description. But, as this description is used
        to tell the user what the parameter means, and what it's useful
        values are, etc., it is strongly suggested you use EXACTLY the
        format as used sofar. Also, please make sure no line gets longer
        than 80 characters.
        The first 5 columns should hold the parameter number, and nothing
        else.
      - The bottom 10 holds the actual parameter data.
        In this bottom part the first five columns should hold the parameter
        number, the actual value should be in the columns 6 till 80.
        Parameters not mentioned in the second part are initialized at zero.
      - An asterisk in column 1 indicates the beginning of the real data.
     Be aware that a few parameters are re-initialized in a machine
     dependent manner in subroutine WIF023 in the module ini.f. If you use
     web-services, a series of parameters is reinitialized anyway. Parameter
     1072 is, for obvious reasons, always set at 1, no matter what you try.
     This rigid file format is required for WHAT IF's HELP facility.
     Any line that is empty in the columns 1-5 is regarded by WHAT IF
     as comments, and thus skipped.
     Search for FREE if you need one single free WIFPAR, or otherwise,
     stay in your own block of reserved parameters.
   1       One or three letter code flag for listing amino acids
     = 0   1 letter code
     = 1   3 letter code
   2       Amount of sequence information
     = 0   only sequence
     = 1   sequence + aa frequency
     = 2   sequence + frequency + neighbor matrix
   3       Scale factor for arrows (*100)
   4       The number of the database file indicated to work with
   5       Output in DEBUMP flag
     = 0   Do not give output (unless other flag says to do so)
     = 1   Do always give output
     = 2   Only give final output per residue
   6       Precision of accessibility calculation
     = 0   Very course
     = 1   Course
     = 2   Normal (default)
     = 3   Fine
     = 4   Very fine ion
.....
..... a few thousand lines removed here
.....
1915       AutoDock runs rigid docking or flexible docking
     = 0   Rigid docking
     = 1   Flexible docking
1916       A docked pose needs to have its centre within this radius from the
           central point. Default 25 A.

1 1 2 1 3 100 4 0 5 0 6 2 ..... ..... a few hundred lines removed here ..... 1915 0 1916 25

OPERATIONS INVOLVING ONLY VECTORS

GVFANG (VECT1,VECT2)              Angle in radians between VECT1 and VECT2.
GVFNGN (VECT1,VECT2,NUM)          As GVFANG for longer vectors.
GVFDP3 (VECT1,VECT2)              GVFDP3 = VECT1 . VECT2 (dot product).
GVFDPN (VECT1,VECT2,NUM)          GVFDPN = VECT1 . VECT2 (idem).
GVFDV3 (VECT1,VECT2)              GVFDV3 = d(VECT1,VECT2) (distance).
GVFLNV (VECT)                     Returns length of VECT.
GVFLNN (VECT,NUM)                 Returns length of VECT.
GVSAV3 (VECT1,VECT2)              VECT1 = VECT1 + VECT2.
GVSAVN (VECT1,VECT2,NUM)          VECT1 = VECT1 + VECT2.
GVSCP3 (VECT1,VECT2,VECT3)        VECT1 = VECT2 x VECT3 (cross product).
GVSNRV (VNORM,VECT1,VECT2,VECT3)  VNORM othogonal to plane(VECT1,VECT2,VECT3)
GVSAOR (VECT1,VECT2,NUM)          Make VECT1 orthogonal VECT2.
GVSSCV (VECT,LENGTH)              Set length of VECT to LENGTH.
GVSNM3 (VECT)                     Normalizes VECT.
GVSNMN (VECT,NUM)                 Normalizes VECT.
GVSBV3 (VECT1,VECT2,VECT3)        VECT1 = VECT2 + VECT3.
GVSSV3 (VECT1,VECT2)              VECT1 = VECT1 - VECT2.
GVSTV3 (VECT1,VECT2,VECT3)        VECT1 = VECT2 - VECT3.
GVFTOR (VECT1,VECT2,VECT3,VECT4)  Returns torsion angle.

OPERATIONS INVOLVING ONLY MATRICES

GVFDET (RMAT)                     Returns the determinant of RMAT(3,3).
GVSREN (RMAT)                     Renormalizes RMAT.
GVFGTA (RMAT)                     Returns the angle that RMAT rotates.
GVSEIG (...)                      Calculates eigen-values for GVSREN.
GVSTPS (RMAT,NUM)                 RMAT gets transposed.
GVSTP2 (RMAT1,RMAT2,NUM)          RMAT1 = RMAT2 transposed.
GVS3X3 (RMAT1,RMAT2,RMAT3)        RMAT1 = RMAT2*RMAT3. 3*3 Matrices.
GVS4X4 (RMAT1,RMAT2,RMAT3)        RMAT1 = RMAT2*RMAT3. 4*4 Matrices.
GVSNX3 (RMAT1,RMAT2)              RMAT1 = RMAT1*RMAT2.
GVSNXN (RMAT1,RMAT2,RMAT3,NUM)    RMAT1=RMAT2*RMAT3.
GVSMIV (RMAT,NUM)                 RMAT becomes RMAT-inv.
GVSMI2 (RMAT1,RMAT2,NUM)          RMAT1 becomes RMAT2-inv.
GVSMTM (RMAT1,RMAT2,NUM)          RMAT1 becomes RMAT2.
GVSMTA (RMAT,ANGLES)              If RMAT is proper rotation, return ANGLES.
GVSMXM (RMAT,ANGLE)               RMAT rotates ANGLE radians around X-axis.
GVSMYM (RMAT,ANGLE)               RMAT rotates ANGLE radians around Y-axis.
GVSMZM (RMAT,ANGLE)               RMAT rotates ANGLE radians around Z-axis.
GVSMGM (RMAT,VECT,ANGLE)          RMAT rotates ANGLE radians around VECT.
GVSMTU (RMAT,NUM)                 RMAT is set to unity.
GVFIMU (RMAT)                     Returns TRUE is RMAT is unitary matrix.
GVSSVC (...)                      Singular value decomposition
GVSSVCX (...)                     Singular value decomposition
GVSKSB (...)                      Singular value decomposition

OPERATIONS INVOLVING VECTORS AND MATRICES

GVSMV3 (VECT1,RMAT,VECT2)         VECT1=RMAT*VECT2.
GVSMVV (VECT,RMAT)                VECT=RMAT*VECT.
GVSMPV (VECT1,RMAT,VECT2)         VECT1=RMAT*VECT1+VECT2.
GVSMVP (VECT1,RMAT,VECT2)         VECT1=RMAT(INV)*(VECT1-VECT2).
GVSMVN (VECT1,RMAT,VECT2,NUM)     VECT1=RMAT*VECT2.

OTHER VECTOR OPERATIONS (these things are not well tested)

GVFDPL (TVEC,RVEC,XYZ)            d(XYZ,TVEC+p*RVEC) distance(point,line).
GVFPPL (TVEC,RVEC,XYZ,PXYZ) Returns distance of projection of XYZ on
        line TVEC+p*RVEC to TVEC. PXYZ becomes projection of XYZ on line.
GVSPTL (VECT1,VECT2,A,B,C) Given two vectors in a plane, return A,B, and
        C in l : A*X + B*Y = C.
GVSPLN (XYZ,NUM,A,B,C,D,RMS) Determine plane through NUM points.
GVSL3D (XYZ,NUM,DIRVEC,POSVEC) Get best line through points in 3D.

TEXT STRING MANIPULATION

GVFFCP (CROW,CHAR,NUM,LEN)        Returns element number of CHAR in CROW.
GVFISN (CHAR)                     True if CHAR(*1) is a digit.
GVFICN (CHAR)                     True if CHAR(*1) is character in alphabet or digit.
GVFISC (CHAR)                     True if CHAR(*1) is character in alphabet.
GVFSTC (NUM)                      Returns NUM-th character in alphabet (or '0').
GVFWNB (CHAR)                     Returns value of digit CHAR(*1), or -1.
GVFLEN (TEXT)                     Returns length of non blank part of TEXT.
GVFPOS (TEXT,SUBTXT)              Returns first location of SUBTXT in TEXT.
GVFPCS (TEXT,SUBTXT)              As GVFPOS, including trailing blanks in SUBTXT
GVFPLS (TEXT,SUBTXT)              Returns last location of SUBTXT in TEXT.
GVSCUC (TEXT)                     Converts TEXT to upper case.
GVSCLC (TEXT)                     Converts TEXT to lower case.
GVSWLC (TEXT)                     Warn if TEXT contains lower case.
GVSSHN (TEXT,NUM)                 Left shift by NUM characters.
GVSSHL (TEXT)                     Left shift to remove leading blanks.
GVSSHR (TEXT,LEN)                 Right shift to remove trailing blanks.
GVSSTX (TEXT1,TEXT2)              TEXT1=TEXT2.
GVSTCP (TEXT)                     Remove blanks by shifting characters to left.
GVSRDB (TEXT)                     Replaces multiple blanks by single blanks.
GVSSLN (TEXT1,TEXT2)              TEXT1 = Left shifted TEXT2.
GVSCPT (TEXT1,TEXT2,LEN,NUM)      TEXT1()(1:LEN)=TEXT2()(1:LEN)
GVSCPT (TEXT1,TEXT2,LEN,NUM)      TEXT1()(1:LEN)=TEXT2()(1:LEN)
GVSCPC (TEXT1,TEXT2)              TEXT1=TEXT1&TEXT2
GVSCCC (TEXT1,TEXT2,TEXT3)        TEXT1=TEXT2&TEXT3
GVSCC3 (TEXT1,TEXT2,TEXT3,TEXT4)  TEXT1=TEXT2&TEXT3&TEXT4
GVSCC4 (...)                      As GVSCC3, but for 4 TEXT strings
GVSCC5 (...)                      As GVSCC3, but for 5 TEXT strings
GVSCC6 (...)                      As GVSCC3, but for 6 TEXT strings
GVST6C (TEXT1,TEXT2,BOOL)         Puts two text's concatenated at terminal.
GVSBOX (TEXT)                     Puts TEXT in fancy box at screen.
GVSBX2 (TEXT1,TEXT2)              Puts TEXT1 and TEXT2 in box at screen.
GVFSCP (TEXT1,TEXT2,IERR)         String compare 1>2 -> -1; 1=2 -> 0; 1<2 -> 1
GVFWCH (CHAR)                     Returns position of CHAR in the alfabet
GVSCBC (TEXT1,TEXT2)              Glues TEXT2 at the tail of TEXT1 (better use GVSCPC)
GVSCST (TEXT)                     Initializes tail of TEXT with blanks
GVSDTC (CHR,NUM)                  Sets CHR at character equivalent '0' - '9' of NUM 0 - 9
GVSNTC (CHR,NUM)                  Sets CHR at NUM-th character of alphabet
GVSFMT (TEXT)                     Sets the COMMON string FMT at the indicated format

TEXT AND NUMBER OUTPUT OPTIONS

FUNCTIONS:
GVFFCP(CROW,CHAR,NUM,LENC)
      FINDS THE LOCATION OF CHAR IN CROW
GVFICN(CHAR)
      SEE IF CHAR IS A (LETTER OR DIGIT) OR SOMETHING ELSE
GVFISC(CHAR)
      SEE IF CHAR IS A LETTER OR NOT
GVFISN(CHAR)
      SEE IF CHAR IS A DIGIT OR NOT
GVFLEN(TEXT)
      RETURNS THE LENGTH OF TEXT
GVFNIT(TEXT,IERR)
      RETURNS THE VALUE OF THE FIRST DIGIT FOUND IN TEXT
GVFPLS(TEXT,SUBTXT)
      RETURNS LOCATION OF LAST OCCURENCE OF SUBTXT IN TEXT
GVFPOS(TEXT,SUBIN)
      RETURNS LOCATION OF LAST OCCURENCE OF SUBTXT IN TEXT
GVFPOC(TEXT,SUBIN)
      RETURNS LOCATION OF LAST OCCURENCE OF SUBTXT IN TEXT. CASE SENSITIVE
GVFPS1(TEXT,SUBTXT,NUMERR)
      RETURNS LOCATION OF LAST OCCURENCE OF SUBTXT IN TEXT. WITH MISMATCHES
GVFPCS(TEXT,SUBTXT)
      SHOULD BE PHASED OUT ONE DAY
GVFSCP(TEXT1,TEXT2,IERR)
       COMPARES TWO STRINGS. -1: 1>2 ; 0: 1=2 ; 1: 1<2                                           ----
GVFWCH(CHAR)
      RETURNS POSITION OF CHAR IN ALFABET (OTHERWISE ZERO)
GVFWNB(CHAR)
      RETURNS INTEGER VALUE OF CHARACTER DIGIT (OTHERWISE -1)
SUBROUTINES:
GVSBOX (INTEXT)
        DRAW TEXT IN NICE BOX
GVSB6X (INTEXT)
       AS GVFBOX, BUT DOESN'T WRITE TO LOGFILE
GVSBUX (IUNIT,INTEXT)
       AS BOX, BUT WRITES TO IUNIT
GVSCC* ROUTINES CONCATENATE STRINGS
GVSCC(TEXT1,INTEXT2,INTEXT3)
GVSCC3 (TEXT1,TEXT2,TEXT3,TEXT4)
GVSCC4 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5)
GVSCC5 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6)
GVSCC6 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6,TEXT7)
GVSCC7 (TEXT1,TEXT2,TEXT3,TEXT4,TEXT5,TEXT6,TEXT7,
GVSCCCB (TEXT1,INTEXT2,INTEXT3)
GVSCL(TEXT)
       CONVERT TO LOWER CASE
GVSCS(TEXT,CHARIN,CHAROUT)
       REPLACES EACH OCCURRENCE OF CHARIN IN TEXT BY CHAROUT
GVSCP(TEXT1,TEXT2)
       CONCATENATES THE TEXT STRINGS TEXT1 AND TEXT2 IN TEXT1
GVSCB(TEXT1,TEXT2)
       AS GVSCPC, ONE BLANK WILL BE PLACED BETWEEN THE TEXTS
GVSCST (TEXT)
       IF THE TAIL OF A STRING IS NOT INITIALIZED, THIS ROUTINE WILL DO SO
GVSCTB (CROW,NUM)
       SET CROW(1:NUM) AT BLANK
GVSCU(TEXT)
       CONVERT TO UPPER CASE
GVSDT(CHR,NUM)
       SET CHAR AT THE CHARACTER EQUIVALENT TO NUM.
GVSFMT (TEXT)
       PUTS THE INDICATED FORMAT IN FMT (IN COMMON)
GVSFMTL (FMT,TEXT)
       PUTS THE INDICATED FORMAT IN FMT (LOCAL PARAMETER)
GVSILR (BLINE,IPOS,JPOS,ILINE)
       REPLACES STRING (IPOS:JPOS) IN BLINE BY ILINE
GVS180
       WRITES A NUMBER BAR IN TWO LINES
GVSLIN
       PUTS OUT A LINE OF = SYMBOLS
GVSLUN (IUNIT)
       AS GVSLIN, BUT ON IUNIT
GVSNL6 (NL)
       WRITES NL EMPTY LINES (BUT JUST ONE TO LOG-FILE)
GVSNLU (NUMUNT,NL)
       WRITES NL EMPTY LINES TO IUNIT
GVSNT(CHR,NUM)
       SETCHAR AT THE NUM-TH CHARACTER OF THE ALPHABET.
GVSRDB (TEXT)
       SHIFTS ALL CHARACTERS LEFTWARDS IN TEXT UNTIL NO DOUBLE BLANKS LEFT
GVSSHL (TEXT)
       A LEFT SHIFT IS PERFORMED ON TEXT UNTIL ALL LEADING BLANKS ARE GONE
GVSSHN (TEXT,NUM)
       A LEFT SHIFT OF NUM CHARACTERS IS PERFORMED ON TEXT
GVSSHR (TEXT,LENGTH)
       A RIGHT SHIFT IS PERFORMED ON TEXT UNTIL ALL TRAILING BLANKS ARE GONE
GVSSTX (TEXT1,TEXT2)
       THIS SUBROUTINE WRITES TEXT2 INTO TEXT1.
GVST6(INTEXT1,INTEXT2,BLANK)
       TEXT1 AND TEXT 2 ARE CONCATENATED AND PRINTED
GVSTU(IUNIT,INTEXT1,INTEXT2,BLANK)
       AS GVST6C, BUT TO IUNIT
GVSTCP (TEXT)
       SHIFTS ALL CHARACTERS LEFTWARDS IN TEXT UNTIL NO BLANKS ARE LEFT.
GVSTTB (INTEXT)
       WRITES A BUG MESSAGE
GVSEIW (ROUTINE)
       WRITES WRITING ERROR MESSAGE AND ROUTINE NAME
GVSEIR (ROUTINE)
       WRITES READING ERROR MESSAGE AND ROUTINE NAME
GVSTTE (INTEXT)
       WRITES AN ERROR MESSAGE
GVSTO6 (TEXT)
       WRITES TEXT ONLY TO TERMINAL
GVSTOI (INTEXT,ININT)
       WRITES TEXT PLUS INTEGER ONLY TO TERMINAL
THE NEXT 15 OR GVST... ROUTINES ALL WRITE TO TERMINAL AND TO RELEVANT UNITS
BUT, IF IUNIT IS PARAMETER THEY JUST WRITE TO IUNIT
BUT, IF IUNIT IS GIVEN AS 6, THEY ALSO WRITE TO RELEVANT UNITS
GVSTT6 (TEXT)
       WRITES TEXT TO TERMINAL AND RELEVANT UNITS
GVSTTI (INTEXT,ININT)
       WRITES TEXT PLUS THE INTEGER
GVSTUI (IUNIT,INTEXT,ININT)
       WRITES TEXT PLUS THE INTEGER
GVSTTIU2 (IUNIT,INTEXT,ININT1,ININT2)
       WRITES TEXT PLUS TWO INTEGERS
GVSTTL (INTEXT,INBOOL)
       WRITES TEXT PLUS THE LOGICAL
GVSTTI2 (TEXT,ININT1,ININT2)
       WRITES TEXT PLUS TWO INTEGERS
GVSTTI3 (TEXT,ININT1,ININT2,ININT3)
       WRITES TEXT PLUS THREE INTEGERS
GVSTTI4 (TEXT,ININT1,ININT2,ININT3,ININT4)
       WRITES TEXT PLUS FOUR INTEGERS
GVSTTI5 (TEXT,ININT1,ININT2,ININT3,ININT4,ININT5)
       WRITES TEXT PLUS FIVE INTEGERS
GVSTTR (INTEXT,INREAL)
       WRITES TEXT PLUS THE REAL
GVSTUR (IUNIT,INTEXT,INREAL)
       WRITES TEXT PLUS THE REAL
GVSTTR2 (INTEXT,INREAL1,INREAL2)
       WRITES TEXT PLUS THE TWO REALS
GVSTTR2U (IUNIT,INTEXT,INREAL1,INREAL2)
       WRITES TEXT PLUS THE TWO REALS
GVSTTR3U (IUNIT,INTEXT,INREAL1,INREAL2,INREAL3)
       WRITES TEXT PLUS THE THREE REALS
GVSTTR4U (IUNIT,INTEXT,INREAL1,INREAL2,INREAL3,
       WRITES TEXT PLUS THE FOUR REALS
GVSTTR3 (INTEXT,INREAL1,INREAL2,INREAL3)
       WRITES TEXT PLUS THE THREE REALS
GVSTTR4 (INTEXT,INREAL1,INREAL2,INREAL3,INREAL4)
       WRITES TEXT PLUS THE FOUR REALS
GVSTTR5 (INTEXT,R1,R2,R3,R4,R5)
       WRITES TEXT PLUS THE FIVE REALS
GVSTTR2P (INTEXT,INREAL1,INREAL2)
       WRITES TEXT PLUS THE TWO REALS (DOUBLE BLANKS ARE REMOVED)
GVSTTU (IUNIT,TEXT)
       WRITES TEXT
GVSWIL (TEXT,INT,IERR)
       WRITES INTEGER LEFT-JUSTIFIED IN TEXT
GVSWRL (TEXT,VALUE,IERR)
       WRITES REAL LEFT-JUSTIFIED IN TEXT
GVSWTL (TEXT1,TEXT2,INT,IERR)
       WRITES TEXT2 AND INTEGER LEFT JUSTIFIED IN THE TEXT1
GVSR2P (OUT,R,S,MODE)
       Pretty print the two reals R and S into string OUT
GVSCLA (TEXT1,TEXT2)
       SETS TEXT1 TO BLANK, STARTING AT THE FIRST OCCURRENCE OF TEXT2.

FILE HANDLING

GVFFOP (NUMUNT)  Returns TRUE if unit NUMUNT is open.
GVSOPF (TEXT,NUMUNT,TYPE)  Opens TEXT formatted sequential
       at NUMUNT.
       TYPE = 'OLD' open old file.
       TYPE = 'NEW' open new file.
       TYPE = 'UNKNOWN' open old, if not exist,
       open new file.
       TYPE = 'WARN' open new file, but warn if
       it exists.
       TYPE = 'NOWARN' open new file, and do not
       warn if it exists.
       If * is last character of TYPE, close unit
       first.
GVSOUF (TEXT,NUMUNT,TYPE)  As GVSOPF for UNformatted files.
GVSOPS (TEXT,NUMUNT)  Opens unformatted sequential SCRATCH file.
GVSCLF (NUMUNT)  Closes unit NUMUNT.
GVSCPF (TEXT,NUMUNT)  Opens file TEXT for write at end at unit
       NUMUNT.
GVSCFF (FILE1,IUNIT1,FILE2,IUNIT2,IERR) Copies FILE2 into FILE1.
GVSCPL (TEXT,NUMUNT)  As GVSCPF but also writes contents of
       TEXT to unit 6.
GVST56  Opens the terminal at units 5 and 6.
GVFISF (TEXT)  Becomes .TRUE. if file TEXT exists.
GVSMFN (TEXT1,TEXT2,DEFEXT)  Makes TEXT2 a proper file name using
       TEXT1 and DEFEXT.
GVSREW (IUNIT) Rewinds unit IUNIT.
GVSLOP (WORK) Lists all open units.

ARRAY INITIALIZATION

GVSBTF (BROW,NUM)  Sets NUM LOGICALS to .FALSE.
GVSBTT (BROW,NUM)  Sets NUM LOGICALS to .TRUE.
GVSB1F (B1ROW,NUM)  Sets BOOL*1 to .FALSE.
GVSB1T (B1ROW,NUM)  Sets BOOL*1 to .TRUE.
GVSBY0 (BYTES,NUM)  Sets NUM BYTES to zero.
GVSCTB (CROW,NUM)  Sets NUM characters CROW to ' '.
GVSCTS (CROW,INDEX,NUM)  Sets NUM characters in INDEX elements in CROW to ' '.
GVSIT0 (IROW,NUM)  Sets IROW to zero.
GVS2T0 (IROW,NUM)  Sets IROW (INTEGER*2) to zero.
GVSITC (IROW,ICON,NUM)  Sets IROW to ICON.
GVSBYC (BROW,ICON,NUM)  Sets BROW (bytes) to ICON (integer).
GVSITI (IROW,NUM)  Sets IROW to 1,2,3,...,NUM.
GVS2TC (IROW,ICON,NUM) Sets IROW (integer*2) to ICON.
GVSITJ (IROW,ISTART,ISTEP,NUM)  Sets IROW to ISTART +
       0,1,2,...,(NUM-1)*ISTEP.
GVSRT0 (ROW,NUM)  Sets ROW to zero.
GVSRTC (ROW,CON,NUM)  Sets ROW to CON.
GVSRTI (ROW,NUM)  Sets ROW to 1.0,2.0,3.0,...,float.
GVSRTJ (ROW,START,STEP,NUM)  Sets ROW to START+1,2,3,...
       ...,(NUM-1)*STEP.
GVSSEX (ROW,START,STEP,NUM)  As GVSRTJ and takes exponential.
GVSSQR (ROW,START,STEP,NUM)  As GVSRTJ and takes square root.

ARRAY OPERATIONS INVOLVING ONE ARRAY

GVFCBT (BOOLS,NUM) Counts the .TRUE.'s in BOOLS.
GVFCBF (BOOLS,NUM) Counts the .FALSE.'s in BOOLS.
GVFFBT (BOOLS,NUM) Finds first .TRUE. in BOOLS.
GVFLBT (BOOLS,NUM) Finds last .TRUE. in BOOLS.
GVSVPC (ROW,CON,NUM)  ROW = ROW + CON.
GVSVMC (ROW,CON,NUM)  ROW = ROW - CON.
GVSVXC (ROW,CON,NUM)  ROW = ROW * CON.
GVSVDC (ROW,CON,NUM)  ROW = ROW / CON.
GVSVX2 (ROW,NUM)  ROM = ROW**2.
GVSVDI (ROW,ICON,NUM)  ROW = ROW / FLOAT(ICON).
GVSVXI (ROW,ICON,NUM)  ROW = ROW * FLOAT(ICON).
GVSV1O (ROW,NUM)  ROW = 1.0/ROW. 0 remains 0.
GVSIXI (IROW,ICON,NUM)  IROW = IROW * ICON.
GVSIXR (IROW,CON,NUM)  IROW = NINT(IROW * ICON).
GVSIPC (IROW,ICON,NUM)  IROW = IROW + ICON.
GVSABS (ROW,NUM)  ROW = ABS(ROW).
GVSTQR (ROW1,ROW2,NUM)  ROW2 = SQRT(ROW1).
GVSNEG (ROW,NUM)  ROW = -ROW.
GVSMOD (IROW,ICON,NUM)  IROW = MOD(IROW,ICON).
GVSREV (ROW,NUM)  Reverses the order of elements in ROW.

ARRAY OPERATIONS INVOLVING TWO ARRAYS

GVS2I4 (IROW4,IROW2)  Converts integer*2 into integer*4.
GVS4I2 (IROW2,IROW4)  Converts integer*4 into integer*2.
GVSVDV (ROW1,ROW2,NUM)  ROW1 = ROW1 / ROW2.
GVSVXV (ROW1,ROW2,NUM)  ROW1 = ROW1 * ROW2.
GVSVPV (ROW1,ROW2,NUM)  ROW1 = ROW1 + ROW2.
GVSVMV (ROW1,ROW2,NUM)  ROW1 = ROW1 - ROW2.
GVSIDV (IROW1,IROW2,NUM)  IROW1 = NINT(FLOAT(IROW1)/FLOAT(IROW2).
GVSIXV (IROW1,IROW2,NUM)  IROW1 = IROW1 * IROW2.
GVSIPV (IROW1,IROW2,NUM)  IROW1 = IROW1 + IROW2.
GVSIMV (IROW1,IROW2,NUM)  IROW1 = IROW1 - IROW2.
GVSCPR (ROW1,ROW2,NUM)  ROW1 = ROW2.
GVSCPI (IROW1,IROW2,NUM)  IROW1 = IROW2.
GVSCPB (BROW1,BROW2,NUM)  BROW1 = BROW2.
GVSCPT (TEXT1,TEXT2,LEN,NUM)  TEXT1()(1:LEN)=TEXT2()(1:LEN)
GVSFLT (ROW,IROW,NUM)  ROW = FLOAT(IROW).
GVFQFC (ROW1,ROW2,NUM)  SUM((ROW1-ROW2)**2)/NUM
GVFLDF (ROW1,ROW2,NUM)  Determines MAX(ABS(ROW1-ROW2))
GVSBND (BROW1,BROW2,BROW3,NUM)  BROW1 = BROW2 .AND. BROW3.
GVSBOR (BROW1,BROW2,BROW3,NUM)  BROW1 = BROW2 .OR. BROW3.
GVFIRI (IROW1,IROW2,NUM)  Returns TRUE if IROW1(1:NUM) = IROW2(1:NUM).

OTHER ARRAY OPERATIONS

GVFFIP (IROW,ICON,NUM)  Returns the location of ICON in IROW.
GVFMX2 (ROW,WORK,NTH,NUM)  Returns the NTH largest value found in ROW.
GVFMAX (ROW,NUM)  Returns the largest value found in ROW.
GVFBMX (BROW,NUM)  Returns the largest value found in byte array BROW.
GVFMIN (ROW,NUM)  Returns the smallest value found in ROW.
GVFIMX (IROW,NUM)  Returns the largest value found in IROW.
GVFIMN (IROW,NUM)  Returns the smallest value found in IROW.
GVFISM (IROW,NUM)  Returns the sum of IROW.
GVFBSM (BROW,NUM)  Returns the sum of BROW (Byte row).
GVF2SM (I2ROW,NUM)  Returns the sum of I2ROW (Integer*2 row).
GVFRSM (ROW,NUM)  Returns the sum of ROW.
GVFIN0 (IROW,NUM) Returns the number of non-zero elements in IROW.
GVSCPS (ROW,BROW,NUM,NEWNUM) Compress ROW to keep BROW=.TRUE.
GVSMTH (IROW,IWORK,NUM,IWINDO,ITYPE,ICYCLS)   Smooths IROW, using IWORK,
         window (odd, 3-25) is IWINDO, Type = ITYPE, # of cycles=ICYCLS.
GVSPCK (IROW,BRON,NUMNOW,NUM) Packs IROW according to BROW. NUM -> NUMNOW.
GVSPCR (ROW,BRON,NUMNOW,NUM) Packs ROW according to BROW. NUM -> NUMNOW.
GVSSAV (ROW,AVE,NUM) Sets whole ROW at its average value

I/O OPERATIONS and TEXT manipulations

GVFFFA (N,A)  Reads N 4 byte Alphanumericals.
GVFFFC (N,CHAR)  Reads CHARacter of length N.
GVFFFF (N,REAL)  Reads N REAL's.
GVFFFI (N,INT)  Reads N INTegers.
GVFLFI (N,INT,LINE) Reads N INTegers from the CHAR*80 LINE
GVFLFR (N,REAL,LINE) Reads N REALs from the CHAR*80 LINE
GVSFFF (N,ROW) Get exactly N reals from user.
GVSFFI (N,IROW) Get exactly N integers from user.
GVFLFI (N,IROW,LINE) Reads up to N integers from LINE.
GVFLFR (N,ROW,LINE) Reads up to N reals from LINE.
GVSMTI (RMAT,TVEC,IERR) Gets a 3*4 matrix from the user.
GVSNL6 (NL)  Writes NL empty lines.
GVSNPG (NP)  Goes NP times to top of next page.
GVSNLU (NL,NUMUNT)  Writes NL empty lines at unit NUMUNT.
GVSBCH (IUNIT,TEXT) Writes TEXT with 5*5 characters. LEN(TEXT)<=13.
GVSCTC (CROW,CHAR,NUM)   Sets NUM chars in CROW to CHAR.
GVSLIN  Writes a line of 60 equal signs.
GVSWM3 (RMAT)  Writes RMAT.
GVSW2M (RMAT1,RMAT2)  Writes 2 matrices.
GVSW3M (RMAT1,RMAT2,RMAT3)  Writes 3 matrices.
GVSW4M (RMAT1,RMAT2,RMAT3,RMAT4)  Writes 4 matrices.
GVSWM4 (RMAT,RVEC)  Writes RMAT and VECT.
GVSW44 (RMAT) Writes a 4*4 matrix.
GVSFLF (FMT,R) Determines format (FMT) to print R with.
GVSFRA (TEXT,ARR,NUM,FMT) Writes ARR(1-NUM) in TEXT.
GVSWV3 (VECT,WORK) Writes VECT.
GVSTT6 (TEXT) Writes TEXT.
GVSTO6 (TEXT) Writes TEXT, but only to the terminal.
GVSTTU (NUMUNT,TEXT) Writes TEXT at unit NUMUNT.
GVSTTB (TEXT) Writes TEXT as bug message
GVSTTE (TEXT) Writes TEXT as error message
GVSTTI (TEXT,INT) Writes TEXT plus INT (integer)
GVSTOI (TEXT,INT) Writes TEXT plus INT (integer), but only to terminal
GVSTTL (TEXT,BOOL) Writes TEXT plus BOOL (logical)
GVSTTI2 (TEXT,INT1,INT2) Writes TEXT plus INT1 and INT2 (integers)
GVSTTR (TEXT,REAL) Writes TEXT plus REAL (real)
GVSTTR2 (TEXT,REAL1,REAL2) Writes TEXT plus REAL1 + REAL2 (reals)
GVSTTR2P (TEXT,REAL1,REAL2) As GVSTTR2 but removes double blanks
GVSTOR (TEXT,REAL) Writes TEXT plus REAL (real), but only to terminal
GVSWIL (TEXT,INT,IERR) Writes INT (integer) in TEXT
GVSWTL (TEXT1,TEXT2,INT,IERR) Writes TEXT2 and INT (integer) in TEXT1
GVSR2P (TEXT,REAL1,REAL2,MODE) REAL1 is value. REAL2 is error. Writes them in
       TEXT. MODE=1, 3.456(13) if possible. MODE=2, always 3.456 +/- 0.013
SPLIT_LINE (TEXT1,TEXT2,TEXT3)    TEXT2 is first word of TEXT1; TEXT3 the rest

ATOMIC output routines LOCLIN is scratch string (that should be long enough to hold the output to be written). IUNIT is the unit on which the output will be written. If IUNIT is absent, standard output (unit 6) is being used. For all these routines the function is providing detailed output. It is easy to guess what the parameters do. All parameters are passed from somewhere to the DIF routines, they do not return anything.

DIF002  (IUNIT,IAA,VALUE)
DIF002A (IUNIT,IAA,IVALUE)
DIF002B (IUNIT,IAA,IVALUE,VALUE)
DIF002C (IUNIT,IAA,IVALUE,VALUE1,VALUE2)
DIF002D (IUNIT,IAA,IVALUE,VALUE1,VALUE2,VALUE3)
DIF003  (IUNIT,IAA,ICLU,LOCLIN)
DIF004  (IUNIT,IAA,VALUE1,VALUE2)
DIF005  (IUNIT,IAA,IFAM,LOCLIN)
DIF006  (IUNIT,IAA,VALUE1,VALUE2,VALUE3)
DIF006A (IUNIT,IAA,VALUE1,VALUE2,VALUE3,VALUE4)
DIF006A2(IUNIT,IAA,VALUE1,VALUE2,VALUE3,VALUE4,
DIF006B (IUNIT,IAA,JAA,VALUE1,VALUE2,VALUE3)
DIF006C (IUNIT,IAA,JAA,VALUE1,VALUE2,VALUE3,VALUE4)
DIF006D (IUNIT,IAA,VALUE1,VALUE2,VALUE3,TEXT)
DIF007  (IUNIT,IAA,V1,V2,V3,V4,V5,LOCLIN)
DIF007A (IUNIT,IAA,V1,V2,V3,V4,V5,V6)
DIF008  (TEXT,IAA)
DIF008A (IUNIT,IAA,TEXT)
DIF008B (IUNIT,IAA,TEXT,V1,V2)
DIF009  (IUNIT,IAA,JAA)
DIF009S (IAA,JAA,C1,C2,IVAL)
DIF010  (IAA,JAA,TEXT,VALUE)
DIF010A (IAA,JAA,TEXT)
DIF010B (IUNIT,IAA,JAA,VALUE)
DIF010C (IUNIT,IAA,JAA,VAL1,VAL2)
DIF010CU(IUNIT,IAA,JAA,VAL1,VAL2)
DIF010U (IUNIT,IAA,JAA,TEXT,VALUE)
DIF011  (IAA1,IAA2,JAA1,JAA2,TEXT,VALUE,LOCLIN)
DIF012  (IUNIT,IAT,JAT,VALUE)
DIF012A (IAT,JAT,VALUE1,VALUE2)
DIF012B (IAT,JAT,VALUE1,VALUE2,VALUE3)
DIF012C (IAT,JAT,VALUE1,VALUE2,VALUE3,VALUE4)
DIF013  (IUNIT,IAT,VALUE)
DIF013A (IUNIT,IAT,VALUE1,VALUE2)
DIF013B (IUNIT,IAT,VALUE1,VALUE2,VALUE3)
DIF013C (IUNIT,IAT,IVALUE)
DIF013D (IUNIT,IAT,IVALUE1,IVALUE2)
DIF014  (IUNIT,IAA,JAA)
DIF014A (IAA,JAA,KAA)
DIF015  (IUNIT,TEXT,IAT)
DIF015A (IAT,TEXT)
DIF015B (IUNIT,IAT,TEXT,VALUE1)
DIF015C (IAT,TEXT,VALUE1,VALUE2)
DIF015D (IAT,TEXT,VALUE1,VALUE2,VALUE3)
DIF015E (IUNIT,IAT,TEXT)
DIF016  (IAT,JAT)
DIF016A (IAT,JAT)
DIF016B (IAT,JAT,TEXT)
DIF017  (NUMB,IAT,JAT)
DIF018  (NUMB,IAT,JAT,ISYM)
DIF019  (IAT,JAT)
DIF020  (TEXT1,IAA,TEXT2)
DIF022  (IUNIT,IAT,JAT,TEXT)
DIF023  (IAT,JAT,KAT,LAT,VALUE1,VALUE2)
DIF024  (IAT,JAT,KAT,VALUE1,VALUE2)
DIF024A (IAT,JAT,KAT,VALUE1,VALUE2,VALUE3)
DIF024B (IAT,JAT,KAT,V1,V2,V3,V4)
DIF025  (IAT)
DIF026  (ISOUP,TEXT,LOCLIN)
DIF028  (IUNIT,IAA)
DIF029  (IUNIT,IAA)
DIF030  (IUNIT,IAA,BOOL1,BOOL2)
DIF031  (IAT,JAT,KAT)

GRAFIC TOOLS

GRTARR (XFROM,YFROM,ZFROM,XTO,YTO,ZTO,ICOL,IERR)
       Draws a 3D arrow from XYZfrom to XYZto
GRTBOX (LOW,HGH,MATRIX)
       DRAWS A BOX WITH EXTREMES LOW,HGH, AND WITH MATRIX APPLIED
GRTCIR (XCEN,YCEN,ZCEN,XN,YN,ZN,RADIUS,ICOL,IERR)
       DRAWS A CIRCLE IN 3D
GRTWHL (XCEN,YCEN,ZCEN,XN,YN,ZN,RAD1,RAD2,ICOL,IERR)
       DRAWS A wheel IN 3D
GRTCEN (IERR)
       Centres the grafics at whatever is in the IRIGRA vector ACONVC
GRTCON (X1,Y1,Z1,X2,Y2,Z2,ANGLE,ICOL,IERR)
       DRAWS A CONE FROM XYZ1 TO XYZ2 WITH OPENING ANGLE IS 'ANGLE'
GRTCRS (XPOS,YPOS,ZPOS,SIZE,ICOL,IERR)
        PUTS A CROSS AT XPOS,YPOS,ZPOS
GRTORS (XPOS,YPOS,ZPOS,SIZE,ICOL,IERR)
       PUTS AN OCTAHEDRAL CROSS AT XPOS,YPOS,ZPOS
GRTDRS (XPOS,YPOS,ZPOS,SIZE,ICOL,IERR)
       PUTS A DIAGONAL CROSS AT XPOS,YPOS,ZPOS
GRTPLS (XPOS,YPOS,ZPOS,ITYPE,INSIZE,ICOL,IERR)
       PUTS A 2D CROSS ORTHOGONAL TO THE XY PLANE AT XPOS,YPOS,ZPOS
GRTDOT (X1,Y1,Z1,ICOL,IERR)
       PUTS A DOT AT XYZ1
GRTDSH (X1,Y1,Z1,X2,Y2,Z2,ICOL,ISTEP,IERR)
       PUTS THE LINE FROM XYZ1 TO XYZ2 DASHED
GRTDTS (XD,YD,ZD,RADIUS,ICOL,NUMDOT,IERR)
       GIVEN XD,YD,ZD, AND THE RADIUS, PUT DOTS ON A SURFACE
GRTFRO (ROTMAT,IERR)
       RETURNS THE FBRT ROTATION MATRIX FROM GRAPHICS DEVICE
GRTFTR (TRANS,IERR)
       RETURNS THE FBRT TRANSLATION FROM THE GRAPHICS DEVICE
GRTGCE (CENTER,IERR)
       RETURNS THE WORLD CENTERING FROM THE GRAPHICS DEVICE
GRTGRO (ROTMAT,IERR)
       RETURNS THE WORLD ROTATION MATRIX FROM GRAPHICS DEVICE
GRTGSC (SCALE,IERR)
       RETURNS THE WORLD SCALE FACTOR FROM THE GRAPHICS DEVICE
GRTSSC (SCALE,IERR)
       SETS THE WORLD SCALE FACTOR AT THE GRAPHICS DEVICE
GRTGSL (SLAB,IERR)
       RETURNS THE WORLD SLAB FACTOR FROM THE GRAPHICS DEVICE
GRTGTR (TRANS,IERR)
       RETURNS THE WORLD TRANSLATION FROM THE GRAPHICS DEVICE
GRTTCN (C1,C2,C3,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,RADIUS,NUMDOT,ICOL,IERR)
       DRAWS A HAT ON A TRIANGULAR CONE FROM C, INBETWEEN POINTS 1 2 3
GRTVCN (C1,C2,C3,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,X4,Y4,Z4,RAD,NUM,ICOL,IERR)
       DRAWS A HAT ON A QUADRANGANGULAR CONE FROM C, BETWEEN POINTS 1-4
GRTHAT (X1,Y1,Z1,X2,Y2,Z2,ANGLE,NUMDOT,ICOL,IERR)
       DRAWS A HAT ON A CONE FROM XYZ1 TO XYZ2 WITH OPENING ANGLE IS 'ANGLE'
GRTKOF DE-ACTIVATES THE TEXT WINDOW
GRTKON ACTIVATES THE TEXT WINDOW
GRTLIN (X1,Y1,Z1,X2,Y2,Z2,ICOL,IERR)
       DRAWS LINE FROM XYZ1 TO XYZ2
GRTLWI (INWIDTH)
       CHANGES THE LINEWIDTH ON A SILICON GRAPHICS MACHINE
GRTMES (TEXT,IERR)
       SENDS A MESAGE TO THE GRAPHICS SMALL MESSAGE AREA
GRTMTR (TRANS,IERR)
       OBTAIN THE TRANSLATION VECTOR FOR THE MOVE OBJECT
GRTOPW (WINTYP,ONOFF,IERR)
       CREATE A WINDOW. ON IRIS THIS OPENS GRAPHICS WINDOW, OR SPAWNS\
       TEXT WINDOW. ON PC, THIS ONE TOGGLES WINDOWS.
GRTFPF CREATES THE SECOND DIRECT ACCESS PICK INDEX FILE
GRTMPF (NUMUNT,NEWTYP)
       CREATES THE DIRECT ACCESS PICK INDEX FILE
GRTPPP (IP,JP,KP,XPOS,YPOS,ZPOS,IERR)
       PUTS ONE PICKPOINT IN THE INDEX FILE
GRTFPP (XPOS,YPOS,ZPOS,TEXT,IERR)
       PUTS ONE PICKPOINT IN THE INDEX FILE
GRTPL4 (V1,V2,V3,V4,ISTEP,ICOL,IERR)
       ???
GRTSCL (VEC_LOWIN,VEC_HGH_IN,ICOL,IERR)
       SETS A RANGE OF VECTORS TO COLOUR ICOL
GRTVIN INITIALIZES GRAPHICS ARRAYS FOR NEXT MOL ITEM
GRTXY (ROW,NUM,SCRATCH,STEPS,ICOL,AXES)
       MAKES AN X-Y HISTOGRAM FOR ROW

Contact relations between residues / atoms

FUNCTION WIF040(IAA,JAA,CUTOFF)
       RETURNS TRUE IF THE SHORTEST DISTANCE BETWEEN THE TWO PSEUDO
       SPHERES FOR THE RESIDUES IAA AND JAA IS LESS OR EQUAL CUTOFF
FUNCTION WIF040A(IAA,JAA,CUTOFF)
       RETURNS TRUE IF THE SHORTEST DISTANCE BETWEEN ANY TWO ATOMS
       FOR THE RESIDUES IAA AND JAA IS LESS OR EQUAL CUTOFF
FUNCTION WIF040B(IAA,JAA,CUTOFF)
       RETURNS TRUE IF THE TWO SIDE CHAINS MAKE A CONTACT
FUNCTION WIF040C(IAA,JAA,CUTOFF)
       RETURNS THE NUMBER OF CONTACTS BETWEEN TWO SIDE CHAINS
WIF040D (IAA,JAA,CUTOFF,BBBB,BBSC,SCBB,SCSC)
       RETURNS THE CONTACTS BETWEEN CLASSES OF ATOMS
FUNCTION WIF040E(IAA,JAA)
       RETURNS THE SHORTEST DISTANCE BETWEEN ANY PAIR OF IAA,JAA ATOMS
FUNCTION WIF050(IAA,JAA)
       RETURNS TRUE IF IAA AND JAA ARE NEIGHBOURS
WIF052 (IAA,IFT1,IFT2,IERR)
       PUTS IN PRPVAL THE RANK ORDER IN DISTANCE TO IAA
       PUTS IN ATTVAL(CA) THE CA-CA DISTANCE AND IN ATTVAL(N) THE CB-CB
WIF061 PROMPTS FOR TWO RESIDUES AND ATOMS. GIVES THE DISTANCE(S)
WIF062 PROMPTS FOR THREE RESIDUES AND ATOMS. GIVES THE ANGLE

GONIOMETRY AND OPERATIONS ON ANGLES

GVFACS (ANGLE)                    Returns ACOS(angle) in radians.
GVFDTR (ANGLE)                    Converts ANGLE from degrees to radians.
GVFRTD (ANGLE)                    Converts ANGLE from radians to degrees.
GVSTCS (ROW1,ROW2,NUM)            ROW2 = COS(ROW1).
GVSSCS (ROW,START,STEP,NUM)       As GVSRTJ and takes cosine.
GVSSSN (ROW,START,STEP,NUM)       As GVSRTJ and takes sine.
GVSSTN (ROW,START,STEP,NUM)       As GVSRTJ and takes tangent.
GVF360 (ANGLE)                    Brings ANGLE (degrees) within 0,360
GVF2PI (ANGLE)                    Brings ANGLE (radians) within 0,2*PI
GVFADF (ANGLE1,ANGLE2)            Gets smallest angular difference (degrees)

OPERATING SYSTEM AND OTHER MACHINE DEPENDENT TOOLS

(WORK should be character*80)

GVSCLP                            Clears the screen.
GVSCOP (FILE,WORK)                Copies file to local
GVSCPP (FILE2,FILE1,BIGLIN)       Copies FILE2 to FILE1
GVSMV (FILNEW,FILOLD,WORK)        Moves FILENEW to FILEOLD.
GVSCTR                            CONTROL_C controller.
GVSDIR                            Lists contents of default directory.
GVSNDR(TEXT)                      Returns the name of the default directory.
GVSTMI(IADRES)                    Initiates CPU timer.
GVSTMS(IADRES)                    Shows elapsed time, CPU time, IO etc. since GVSTMI.
GVSTIM                            Types DATE and TIME at terminal.
GVSTUM                            Types DATE and TIME at NUMUNT.
GVSTRT (IDAY,IMONTH,IYEAR,IHOUR,IMINUT,ISECND)  obvious...
GVSDOW (IDAY)                     IDAY=1 at sunday, IDAY=2 at monday, etc.
GVSIIP (MODE)                     MODE = char*5 becomes 'INTER' or 'BATCH'
GVSVMS (TEXT)                     Spawns interactive subprocess.
GVSPWN (TEXT)                     Spawns TEXT in batch mode.
GVSSPL (TEXT)                     Spawns and executes the command stored in TEXT.
GVSPRT (TEXT,COLOUR)              Sends TEXT to laserwriter. COLOUR=.TRUE. :colour.
GVSEXE (TEXT,WORK)                Executes program TEXT.
GVSEDT (TEXT)                     Edits file TEXT. WHAT IF holds till editor is closed.
GVSZIP (TEXT,WORK)                Edits file TEXT, but continues WHAT IF
GVSDEL (TEXT,MODE)                Deletes file TEXT. The ;* should not be given.
                                  MODE=WARN or NOWARN for to get error warnings or not.
GVSPAU (SECNDS)                   Execute a pause of SECNDS seconds.

SORTING

GVSIRT (IROW,NUM,ITAG)  Sorts IROW increasing. ITAG is tag-row.
GVSDIS (IROW,NUM,ITAG)  Sorts IROW decreasing. ITAG is tag-row.
GVSORT (ROW,NUM,ITAG)  Sorts ROW increasing. ITAG is tag-row.
GVSDRT (ROW,NUM,ITAG)  Sorts ROW decreasing. ITAG is tag-row.
GVSCRT (CROW,LEN,NUM,ITAG)  Sorts CROW increasing. ITAG is tag-row. LEN
       is the length of the character strings in CROW.
GVSRT1 (ROW,NUM)  Sorts ROW increasing.
GVSIR1 (IROW,NUM)  Sorts IROW increasing.
GVSDT1 (ROW,NUM)  Sorts ROW decreasing.
GVSDT2 (IROW,NUM)  Sorts IROW decreasing.
GVSBRT (BYTE1,BYTE2,NUM) Sorts BYTE1, and permutes BYTE2 the same.
GVS2RT (RA,RB,N) Sorts RA (int*2) increasing (permutes RB (int*2) too)
GVSWAP (CON1,CON2)  Swaps CON1 and CON2.
GVSW2P (ICON1,ICON2)  Swaps ICON1 and ICON2 (both integer*2)
GVSWBP (BYTE1,BYTE2)  Swaps BYTE1 and BYTE2.
GVSWLP (BOOL1,BOOL2)  Swaps BOOL1 and BOOL2.
GVSWIP (ICON1,ICON2)  Swaps ICON1 and ICON2.
GVSWCP (TEXT1,TEXT2)  Swaps TEXT1 and TEXT2.

STATISTICS

GVSIAV (IROW,NUM,AVE,ADEV,SDEV,VAR,SKEW,CURT) Returns AVErage,
        Average DEViation, Standard DEViation, VARiance, SKEWness,
        and CURTosis. See recipes 13.1. With IROW integers.
GVS2AV (IROW,NUM,AVE,ADEV,SDEV,VAR,SKEW,CURT) With IROW integers*2.
GVSBAV (BROW,NUM,AVE,ADEV,SDEV,VAR,SKEW,CURT) With BROW bytes.
GVSRAV (ROW,NUM,AVE,ADEV,SDEV,VAR,SKEW,CURT) With ROW reals.
GVSANZ As GVSRAV excluding near zeros in ROW.
GVSRLV (ROW,BOOLS,NUM,AVE,ADEV,SDEV,VAR,SKEW,CURT) With ROW reals.
        BOOLS determines what to use in ROW.
GVSPRS (AVE,ADEV,SDEV,VAR,SKEW,CURT) Writes results from statistics routines.
GVSUUT (IUNIT,AVE,ADEV,SDEV,VAR,SKEW,CURT) Writes results from statistics
        routines to unit IUNIT.
GVSHIS (ROW,NUMR,IROW,NUMI) makes in IROW(1-NUMI) a histogram of ROW(1-NUMR).
GVSHUT (ROW,NUMR,IROW,NUMI) as GVSHIS, but with line printer output.
GVSHUT2 (ROW,NUM,IBINS,NUMBIN,ROWMIN,ROWMAX,INMBIN) as GVSHIS, with lp output.
GVSHLT (ROW,BOOLS,NUM,IBINS,NUMBIN) as GVSHIS, but with line printer output.
GVSPMM (ROW,NUM) Print minimum and maximum of ROW
GVSPMM (ROW,BOOLS,NUM) As GVSPMM, using only ROW where BOOLS is .TRUE.

COORDINATE TRANSFORMATION TOOLS

GVSSUP (NUM,XA,XB,R,T,QRMS)  Superpositions XB(3,NUM) on
       XA(3,NUM), R is the matrix needed, T the vector,
       QRMS is the RMS misplacement in Angstroms. R and T are applied.
GVSSPN (NUM,XA,XB,R,T,QRMS,QMAX)  Superpositions XB(3,NUM) on XA(3,NUM),
       R is the matrix needed, T the vector, QRMS is the RMS misplacement
       in Angstroms, QMAX is the maximal one. R and T are NOT applied.
GVSSNP (NUM,XA,XB,R,T,QRMS,QMAX)  Superpositions XB(3,NUM) on XA(3,NUM),
       R is the matrix needed, T the vector, QRMS is the RMS misplacement
       in Angstroms, QMAX is the maximal one. R and T are applied.
GVSCM1 (XYZ,NUM) Puts center of mass of XYZ(3,NUM) to 0,0,0.
GVSCM2 (XYZ,NUM,VECT) Add VECT to XYZ to get center of mass in (0,0,0).
       VECT should still be added.
GVSCM3 (XYZ,NUM,VECT) Add VECT to XYZ to get center of mass in (0,0,0).
       VECT is already added.
GVSCM4 (XYZ,NUM,VECT) Subtracts VECT from XYZ (Undoes GVSCM3)
GVSCM5 (XYZ,NUM,VECT) Adds VECT to XYZ.
GVSCMT (XYZ,BROW,NUM) Puts center of mass of tagged part of XYZ(3,NUM)
       to 0,0,0; rest is translated too.
GVSCMA (XYZ,NUM,RMAT,VECT) Applies RMAT and VECT to XYZ.
GVSCMU (XYZ,NUM,RMAT,VECT) Undoes the application of RMAT and VECT to XYZ.
GVSRSP (XYZ1,XYZ2,NUM,DMAX,DAVE,DRMS) Determines average, mean
       and root mean square difference between XYZ1 and XYZ2.
GVSSP4 (NUM,XA,XB,R,T,QRMS,W)  Superpositions XB(3,NUM) on
       XA(3,NUM), R is the matrix needed, T the vector,
       QRMS is the RMS misplacement in Angstroms. W are the
       weigths use in determinig QRMS (not R and T!).
GVSAM1 (X,Y,Z,NUM,RMAT,TVEC) Apply RMAT on center of gravity; apply TVEC.

OTHER UTILITIES

GVFMPI  (CONT) Returns CONT * PI (=3.14 etc.)
GVFODD  (ICON)  Becomes TRUE if ICON is an odd integer.
GVFEVN  (ICON)  Becomes TRUE if ICON is an even integer.
GVFYON  (TEXT)  Prints text. RETURNS true upon yes (no=false).
GVFRAN  (ISEED,VALLOW,VALHGH) Returns random number in range. Use ISEED=0
        in the first call.
GVFIAN  (ISEED,IVLLOW,IVLHGH) Returns random number in range. Use ISEED=0
        in the first call.
GVFEND  (TEXT)  Returns .TRUE. upon QUIT,STOP,END, etc.
GVFIIN  (ICON1,ICON2,ICON3)  .TRUE. if ICON1 in between but
        not equal ICON2 and ICON3
GVFIBN  (ICON1,ICON2,ICON3)  .TRUE. if ICON1 in between or
        equal ICON2 and ICON3
GVFRIN  (CON1,CON2,CON3)  .TRUE. if CON1 in between or
        equal CON2, CON3.
GVFRNG  (CON1,CON2,CON3) Returns CON1 in case CON1 is in range CON2-CON3, else
        the nearest of CON2 and CON3 will be returned.
GVFIRG  (ICON1,ICON2,ICON3) Returns ICON1 in case ICON1 is in range ICON2-CON3,
        else the nearest of ICON2 and ICON3 will be returned.
GVFEND  (TEXT)  .TRUE. if TEXT contains QUIT, END, STOP, etc.
GVFDFN  (INT1,INT2,IDIFF) Returns TRUE if ABS(INT1-INT2).eq.IDIFF
GVSBEL  Rings the bell in the keyboard.
GVSCOD  Holds the terminal till return is hit.
GVSKIL  Creates a stackdump by dividing by zero.
GVSLKK  (X,Y,NUM,MWT,A,B,SIGA,SIGB,CHI2,Q) See Recipes page 508. (Use mwt=0
        if SIG (is errors on Y) is empty).
GVSMNF  (....) General function minimizer.
GVSOLV  (A,B,C,X1,X2,IMAG) Solve A*X*X+B*X+C=0. IMAG=.TRUE. if no real solutions
GVS3LK  (X,Y,Z,NUM,R,P) 3-dimensional LKK. R=direction of best line. P is point
        on that line. Algorithm probably not too good...

AMINO ACID TOOLS

GVSAA3 (AAROW,LEN)  Puts 3-letter code aa in CHAR*LEN AAROW(20).
GVFWGT (AA1)  Returns weight of aa (CHAR*1) AA1 '-' is H2O.

GEOMETRY ON ATOMS

WIFDSP(IAA,JAA)             Residue center distance
WIFBBA1(IAA,IERR)           N-CA-C BACKBONE ANGLE
WIFBBA2(IAA,IERR)           CA-C-N BACKBONE ANGLE
WIFBBA3(IAA,IERR)           CA-C-O BACKBONE ANGLE
WIFBBA4(IAA,IERR)           O-C-N BACKBONE ANGLE
WIFANG(IAT1,IAT2,IAT3)      ANGLE OVER IAT2
XYZNUL(IAT)                 TRUE IF IAT HAS AS COORDINATES (0.0,0.0,0.0)
WIFDST(IAT,JAT)             Distance between IAT and JAT
CHI001(IAT1,IAT2,IAT3,IAT4) Torsion angle over IAT1-IAT4
WIFAIJ(IAA,JAA)             Angle between Ca-Cb axes in two residues (degrees)
WIFELA (IAA,XYZCEN,EV)      Determine ellipse around a residue
WIFPL4 (IAT1,IAT2,IAT3,IAT4,RMS) RMS deviation from best plane
OPTIONS TO GET SOMETHING FROM THE USER. Unless mentioned otherwise:
IERR=0 all OK; IERR=1 error or zero as input; IERR=2 user hit RETURN or end-of-information
was encountered

GET_WORD (TEXT,IERR)              Get TEXT.
NEED_WORD (TEXT1,TEXT2,IERR)      Get TEXT1. TEXT2=default. (IERR=0 or 1 only).
GET_FULL_LINE (TEXT,IERR)         Gets in TEXT the entire input line
NEED_FULL_LINE (TEXT,IERR)        As GET_FULL_LINE. TEXT2=default. (IERR=0 or 1 only).
NEED_F (REAL1,REAL2,IERR)         Gets REAL1. REAL2=default. (IERR=0 or 1 only).
NEED_IF (INT1,INT2,IERR)          Gets INT1. INT2=default. (IERR=0 or 1 only).
PEEK_WORD (TEXT,IERR)             Look what TEXT would be upon GET_WORD. (IERR=0 or 1 only).
AHEAD()                           Returns TRUE if type-ahead buffer contains something
POKE_AHEAD (TEXT)                 Poke TEXT in the type ahead buffer (for dirty hacks)
WIFBO0                            Warns user for 'No default' advises to use ZERO.
WIFBO1 (MODE,TEXT)                As WIFBO0, but with menu specific help
WIFGAA (AACID,INTEXT)             Promps user for an amino acid type (char*4).
WIFGAT (IAA,IAT,IERR)             Prompts user for an atom.
WIFGPR (ISEQ1,ISEQ2)              Asks for range of database proteins.
WIFG2N (TEXT,ISEQ1,ISEQ2,DEFAULT) Get two numbers. TEXT=prompt. Defaults=1 to DEFAULT.
WIFGRS (IFT1,TEXT)                Get one residue from user. TEXT=prompt.
WIFGRN (IFT1,IFT2,TEXT)           Get a range from user. TEXT=prompt.
WIFWTF (TEXT,IERR)                Get ranges from user. Put in WRK1TF.
GRA008 (IAA,IAT)                  Prompts user to pick an atom.
GRA008A (TEXT,IAA,IAT)            As GRA008, but with TEXT as prompt.
GRA009 (IAA1,IAT1,IAA2,IAT2)      Prompts user to pick two atoms.

TOOLS TO ADDRESS RESIDUES, ATOMS, etc.

WHAT IF holds one modeule (whatis.f) with logical functions. These functions return true or false depending on the atom, residue or molecule send to it being of a certain kind. The following functions get a residue (left) or molecule (middle) passed and return true if it is the type as listed right.

WIFIRA     WIFISA     Amino acid
WIFIRB                Ca-Cb obly amino acid
WIFIRC     WIFISC     Ca only amino acid
WIFIRD     WIFISD     Drug (with or without topology) or single atomic
WIFIRE                C-terminal OH
WIFIRM     WIFISI     Single atomic
WIFIRL                Last entity in an NMR model
WIFIRZ     WIFISZ     Sugar
WIFIRN     WIFISN     Nucleic acid
WIFIRND               DNA
WIFIRNR               RNA
WIFIRO     WIFISO     C-terminal oxygen
WIFIRR     WIFISR     Residue (amino acid, nucleic acid, sugar)
WIFIRS                Cysteine involved in a Cys-Cys bridge
WIFIRW     WIFISW     Water
WIFIRH     WIFISH     Protons only
WIFIRP                N-terminal protons only
WIFIR1                First residue of a molecule
WIFIR3                Last residue of a molecule
WIFIR6                Drug with known topology
WIFIRI                Residue exists

A series of functions deals with atoms:

WIFITI                ATOM: Exists
WIFITC                Atom: Backbone C
WIFITW                Atom: water
WIFITS                Atom: Single atomic entity
WIFITO                Character*4: C-terminal oxygen
WIFITO1               Character*4: C-terminal oxygen1
WIFITO2               Character*4: C-terminal oxygen2

A series of functions deals with the whole soup

ISSOUPCA              True if >95% of amino acids is Ca only
ISSOUPUNK             True if >50% and >8 amino acids are UNK
HASPROTON             True if there is a proton in the soup
HASPROTEIN            True if there is an amino acid in the soup
HASSUGAR              True if there is a sugar in the soup
HASWATER              True if there is at least one water in the soup
HASDNA                True if there is some DNA or RNA (!) in the soup

A series of tools that tell you who is bound to what. Sometimes ISYM is a parameter. In those cases ISYM is the matrix you choose that needs to be applied to the second partner in the event in order to have the event. So, you normally set ISYM to 1, or you look over ISYM (from 1 to NUMSYM).

In the FBOND routines, MAXNUM typically would be expected to be 4, but is better set at 10 or so to be prepared for catastrophes.

AREBOUND(IAT,JAT)     True is IAT and JAT are covalently bound
AREBOUNDS(IAT,JAT,ISYM)True is IAT and JAT are covalently bound.
AREB13(IAT,JAT,ISYM)  True if IAT and JAT are 1-3 connected via one
                      other atom.
AREB14(IAT,JAT,ISYM,IBETWEEN,JBETWEEN) True if IAT and JAT
                      are 1-4 connected via two other atoms. These
                      two atoms 'inbetween are returned as IBETWEEN
                      (bound to IAT), and JBETWEEN (bound to JAT)
FBOND (IAT,JATARR,MAXNUM,NUM) Returns in JATARR the NUM atoms bound to IAT
FBONDA (IAT,JATARR,MAXNUM,NUM) As FBOND, but for heavy (bound) atoms only
FBONDH (IAT,JATARR,MAXNUM,NUM) As FBONDA, but for bound protons only
FBONDOK (IAT,JATARR,MAXNUM,NUM) As FBOND but for correct atoms only
FBONDHOK (IAT,JATARR,MAXNUM,NUM) As for FBONDH but for correct atoms only
FBONDAOK (IAT,JATARR,MAXNUM,NUM) As for FBONDA but for correct atoms only

There also exist routines to find atoms 'in the neighbourhood' ask me if you need them.

TOOLS TO DEAL WITH FILES AND UNITS.

GETFILE (NUMUNT,TEXT,FILE,IERR)   Open FILE at NUMUNT. TEXT=prompt. TEXT or FILE must be ' '
GETFILD (NUMUNT,TEXT,FILE,IERR)   Open FILE at NUMUNT. TEXT=prompt. FILE=default.
GETFILN (NUMUNT,TEXT,FILE,IERR)   Open FILE at NUMUNT. TEXT=prompt. TEXT or FILE must be ' '
GETUFILE (NUMUNT,TEXT,IERR)       Open old unformatted file. TEXT=prompt.
GETUFILN (NUMUNT,TEXT,IERR)       Open new unformatted file. TEXT=prompt.

Some still to be documented tools:

GETCBETA (IAA,IERR)
GET_TEXTP (BOOL)
KILL_TEXTP (BOOL)
WIFTPN (TEXT,ADDONE,IERR)
RESET_INTERRUPT
ISLOGF (IERR)
MOVE_ATOM (IATIN,VECT)
OVRFLO (PARAM,INPVAL,DETECT)
TOO_MANY (TEXT)
SETIFT (IFT1,IFT2,JFT1,JFT2)
CLEAN_LINE (TEXT,NUMB,IERR)
WIFMMX (IFT1,IFT2,XYZMIN,XYZMAX,XYZCEN)
WIFMMX2 (IFT1,IFT2,XYZMIN,XYZMAX)
WIFMMX3 (XYZMIN,XYZMAX,XYZCEN)
WIFMMX4 (IFT1,IFT2)
WIFPPO (IANG)
WIFSDS (INDSSP,IERR)
WIFWAIT
FULLSTOP
RESETP
SETUSYM (USYM,IWF590)
MYTEST
REALHYD (IATIN,NUMRHY,IATRHY,XYZRHY)
TYPRNG (ITYPE,ILOW,IHGH,IERR)
WIF_PUSH_PPP (IWFPPP,VALUE)
WIF_DUMP_PPP
WIF_POP_PPP (IWFPPP)
WIFIERR (IERR,TEXT)
LOGICAL FUNCTION INTERRUPTED()
LOGICAL FUNCTION GRAPON()
INTEGER FUNCTION INDAA1(AACID)
INTEGER FUNCTION INDAA1R(AACID,ILOW,IHGH)
INTEGER FUNCTION INDAA3(AACIDIN)
LOGICAL FUNCTION ISINAA(NUM,IAA)
REAL FUNCTION WIFANG(IAT1,IAT2,IAT3)
REAL FUNCTION WIFDSP(IAA,JAA)
LOGICAL FUNCTION XYZNUL(IAT)
      LOGICAL FUNCTION WIFITW(IAT)
      LOGICAL FUNCTION WIFROK(IAA)
      LOGICAL FUNCTION WIFCOK(IAA)
      LOGICAL FUNCTION WIFBOK(IAA)
      LOGICAL FUNCTION WIFALL(IAA)
      LOGICAL FUNCTION WIFSOK(IFT1,IFT2)
      LOGICAL FUNCTION WIFTDS(INDSSP,INPCHR)

Your chapter in the writeup

The WHAT IF menu DOSELF holds some routines that we use to do program maintenance. You are not supposed to even know that this menu exists. However, feel free to abuse WHAT IF to make your own hypertext documentation, etc.

Fortran pretty printer (PRETTY)

FORTRAN source code is not always equally nicely readable. The command PRETTY can be used to make a very nicely readable listing of WHAT IF source code modules.

This pretty printer relies heavily on our coding conventions, and can not be used as a general FORTRAN pretty printer. We stick, among others, to the following rules:

The writeup (language)

The WHAT IF documentation is written in the very old Digital RUNOFF format. This seems rather clumsy, but the advantage is that these are very easy to parse flat text files. WHAT IF has several facilities to make more useful files out of these files. : The best way of figuring out which RUNOFF command subset we use, is to look in the .rno files in the writeup directory. A brief summary follows:

RUNOFF files are flat files of text lines no longer than 132 characters, but preferably shorter than 80 characters. RUNOFF directives can be put in between the text. Directives start with a period as the first character on the line. The next two till four positions are used for the actual directive (.NM CH .CH .HL .X .BR .LT or .EL). No other directives are supported. There can only be one directive per line. Directives can be followed by a directive text string or a number. the following directives can be used:

 .NMCH xx    (where xx is the chapter number)
 .CH   xx    (where xx is the chapter title)
 .HL   xx    (where xx is a header level 1 for a paragraph,
              2 for a sub-paragraph, 3 for a sub-sub-paragraph,
              etc.)
 .LT         (To start literal text, this will not be justified
              etc. during the conversion)
 .EL         (To indicate the end of literal text)
 .BR         (To start on a new line)
 .X    xx    (Where xx is a text string to make an entry in
              the index table).

The .HL lines can be closed by a word in brackets. If this word is found anywhere in the text in capitals, a cross reference is create in the WWW page.

RUNOFF emulation (RUNOFF)

The command RUNOFF will prompt you for the name of an input runoff file, an output file with extension .mem file (human readable, and nicely formatted), and a postscript file.

RUNOFF emulation (RUNALL)

The command RUNALL prompts you for a file with runoff format file names. It will automatically (without further prompting) run the RUNOFF option on all the runoff files. The file 'tex.list' in the writeup direction provides an example of such a file of files.

This option is used to convert the documentation into WHAT IF help files.

Create one chapter of the writeup (TEXONE)

TEXONE is to TEXALL as RUNOFF is to RUNALL; i.e. you can make a single chapter of the WHAT IF manual in LaTeX using this option.

Create the writeup (TEXALL)

The writeup can be converted into a Latex document with the command TEXALL. The same 'tex.list' input file is needed as for RUNALL. Make sure that any files 'manual.*' are deleted from the directory before you run this option. After the TEXALL option you HAVE to terminate the program with the FULLSTOP option.

You have to type:

latex manual.tex
makeindex manual
latex manual

Thereafter you run 'xdvi manual.dvi' to preview (or dvips manual.dvi and ghostview manual.ps, or any other conversion). We use dvips to get a postscript file that gets printed.

The latex output can be converted to complete index and cross referenced HTML with the script xxx.

Many 'things' have a name. Things can be files, commands, locations, etc. These 'things' are internally stored in FILNMS. The 100 FILNMS entries are:

  1
  2
  3
  4 postscript file
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16 log file
 17
 18
 19
 20
 21 Quality
 22 Quality
 23 Quality
 24 Quality
 25 Quality
 26 Quality
 27 Quality
 28 Quality
 29 Quality
 30 Quality
 31 Quality
 32 Quality
 33 Quality
 34 Quality
 35 Teach
 36 Teach
 37 Teach
 38 Teach
 39 Corrected PDB file name
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61 PDB location (read from CCONFI.FIG)
 62 Last used PDB file, or sometimes last used PDB-identifier
 63
 64 !%PSADOBE (read from CCONFI.FIG)
 65 lpr command for colour plots (read from CCONFI.FIG)
 66 hssp location (read from CCONFI.FIG)
 67 editor name (read from CCONFI.FIG)
 68 lpr for b/w (read from CCONFI.FIG)
 69 UNIX command to spawn a shell (read from CCONFI.FIG)
 70 User command to get shell (read from CCONFI.FIG)
 71 xmgr (read from CCONFI.FIG)
 72 PST top txt. Also used for chain-names in PDBCHECK (sorry...)
 73
 74 last used file in a series of options, but not everywhere...
 75 start browser command (read from CCONFI.FIG)
 76 Scratch dir
 77 Last ECcode read from PDB-file
 78 Last MOLcode read from PDB-file
 79 ghostview (read from CCONFI.FIG)
 80 used for file name in loops menu
 81 PDB code in INF**
 82
 83
 84
 85
 86
 87
 88
 89
 90 PDB-identifier
 91 Present SOUNAM
 92 Last HSSP file
 93 Walser directory
 94 ALLNUM.NAM
 95 ALDRUG.XYZ
 96
 97
 98
 99
100 ALCOOR.XYZ

Structure validation parameters

The structure validation routines return their scores in arrays that are in RESULT.INC. The essential arrays are GENIVL and GENRVL. They contain (after the routine ran that generates that value):

GENIVL
  1: First residue checked by the last qualty check
  2: Last residue checked by the last qualty check
  3: Highest multiplicity of a polymer chain in the asym. unit.
  4: Number of symmetry operations of the space group.
  5: Number of bonds used to calculate R(7)
  6: Number of residues used for R(32)
  7: Number of atoms used for R(33)
  8: Boolean: is the NQA Z-score usable? 1=yes, 0=no
  9: Number of low-pH state residues.
 10: Number of high-pH state residues.

GENRVL
  1: Last average qualty score (see GENIVL 1 and 2)
  2: TOTVAL from ACC008
  3: TOTNOR from ACC008
  4: TOTABS from ACC008
  5: Fraction of buried atoms that has XBFACT<5.0 (XBFCHK)
  6: Average XBFACT for buried atoms
  7: RMS XBF score over bonds.
  8: RMS Z-score of the bond lengths vs. Engh and Huber.
  9: Scaling needed along A axis according to BNDCHK
 10: Scaling needed along B axis according to BNDCHK
 11: Scaling needed along C axis according to BNDCHK
 12: cross-term scaling needed B-C axis according to BNDCHK
 13: cross-term scaling needed A-C axis according to BNDCHK
 14: cross-term scaling needed A-B axis according to BNDCHK
 15: NQA structure Z-score
 16: NQA structure Z-score, Backbone-Backbone
 17: NQA structure Z-score, Backbone-Sidechain
 18: NQA structure Z-score, Sidechain-Backbone
 19: NQA structure Z-score, Sidechain-Sidechain
 20: Bond angle Z-score
 21: RMSD bond distances
 22: RMSD bond angles
 24: Matthews Coefficient Vm
 25: Molecular weight of all polymer chains summed.
 26: Average difference in B over a bond
 27: Significance of values 9-14 as multidimensional variance.
 28: RMS difference in B over a bond
 29: Ramachandran plot Z-score
 30: Standard deviation in omega distribution
 31: Chi1/Chi2 overall Z-score
 32: Structure RMS planarity (PLN) Z-score
 33: Structure RMS planarity (PL2) Z-score
 34: Structure Backbone fit quality
 35: RMS Z-score for improper dihedrals
 36: Structure RMS polarity score
 37: RMS superposition mismatch for last 2 NCS molecules, all-atom
 38: NQA structure ave-score
 39: NQA structure ave-score, Backbone-Backbone
 40: NQA structure ave-score, Backbone-Sidechain
 41: NQA structure ave-score, Sidechain-Backbone
 42: NQA structure ave-score, Sidechain-Sidechain
 43: RMS superposition mismatch for last 2 NCS molecules, CA only