PROGRAM KEYP
C
C     Program created from matthews_coef.f 
C     this is a template for the keyparse routines
C     
C     ..
C     .. Local Scalars ..
      INTEGER NMOL, NUMSGP, NSYM, NSYMP, HOWMANY
      REAL CMATH, PER2, RO, VOLUME, WEIGHT, ULT
      LOGICAL CONT, DEBUG, FLAG
      CHARACTER PGNAME*10, SPGNAM*10, LONGLINE*100
C     ..
C     .. Local Arrays ..
      REAL CELL(6), RSYM(4,4,192)
      INTEGER ARRAYMISB(100)
C     ..
C     .. External Routines ..
      EXTERNAL CCPERR, CCPFYP, CCPRCS, MEMOPARSE, PARSECELL, 
     +         PARSEDIAGNOSE, PARSEINT, PARSEREAL, PARSESYMM,
     +         PARSEKEY, PARSENINTS, PARSEKEYARG, PARSESUBKEY
C     ..
C     .. Intrinsic Functions ..
      INTRINSIC COS, SQRT
C     .. 
C     .. Initialisations
      NMOL = 1
      NSYM = 0
      CELL(1) = 0.0
      CELL(2) = 0.0
      CELL(3) = 0.0
      CELL(4) = 90.0
      CELL(5) = 90.0
      CELL(6) = 90.0
      WEIGHT = 0.0
      DEBUG = .FALSE.
      HOWMANY = 100
      FLAG = .FALSE.
C
      CALL CCPFYP
      CALL CCPRCS(6,'Keyp','$Date: 1996/10/09 10:47:26 $')

C---- Read in data cards
C
10    CALL MEMOPARSE(.TRUE.)
C
C  Check to see if a keyword is declared eg debug?
      CALL PARSEKEY('DEBU', DEBUG)
C
C  Parse a real e.g. Molecular weight
      CALL PARSEREAL('MOLW',WEIGHT)
C
C  Parse an integer eg Number of Molecules per asymmetric unit
      CALL PARSEINT('NMOL',NMOL)
C
C  Parse a number n of integers eg batches to miss
      CALL PARSENINTS('MISB', HOWMANY, ARRAYMISB)
C
C  Parse the cell Cell
      CALL PARSECELL(CELL)
C
C  Parse the Symm
      CALL PARSESYMM(SPGNAM, NUMSGP, PGNAME, NSYM, NSYMP, RSYM)
C
C  Other subroutines for standard Keywordsa 
C     parsereso
C     parselabin
C     parselabout
C

C
C  Get a complicated line to parse later if need
      CALL PARSEKEYARG ('BLUR', LONGLINE)
C
C  Some more complex sitiuations:
C
C  Parse a SUBKEY - flag becomes true if subkey matched
C     DOIT = the key
C     FAST = subkey
C     See also Parsesubint, Parsesubreal, parsesubchar

      CALL PARSESUBKEY('DOIT', 'FAST', FLAG)
C
C  Test data input
C
C  Parse a SUBKEY - flag becomes true if subkey matched
C     DOIT = the key
C     FAST = subkey
C     See also Parsesubint, Parsesubreal, parsesubchar

      CALL PARSESUBKEY('DOIT', 'FAST', FLAG)
C
C  Test data input
C
      CALL PARSEDIAGNOSE(CONT)
      IF (CONT) GOTO 10
C
C---- End of input keywords 
C     at this point you can check to see if all the required 
C     keywords have been called with correct values e.g.
C
      IF (CELL(1) .EQ. 0.0) 
     +  CALL CCPERR(1,' *** The CELL keyword has not been given ***')
      IF (NSYM .EQ. 0) 
     +  CALL CCPERR(1,' *** The SYMM keyword has not been given ***')
      IF (WEIGHT .EQ. 0.0) CALL CCPERR(1,
     +           ' *** The MOLWEIGHT keyword has not been given ***')
C
C---- If everything OK start to calculate!

C     the main body of your program would be here
 
C

      CALL CCPERR(0,'Normal Termination')
      END