C
C       VARIABLES
C     MAXVB IS MAXIMUM NUMBER OF VARIABLES IN OPTIM
C     MAXTVB IS MAXIMUM NUMBER OF TOLERANCE VARIABLES
C     MAXCMP IS MAXIMUM NUMBER OF COMPENSATORS
        INTEGER TVBCNT,CMPCNT,VBCNT,MAXVB,DELVAL,DELTAG,MAXTVB,MAXCMP
        REAL*8 VARABL(1:100000,1:17)
C
C     TOLER TRACKS COMPUND TOLERANCE VALUES AS THEY CAN'T BE TRACKED IN THE
C     LENS ARRAY
C
      REAL*8 TOLER(1:60,0:499)
      COMMON/TOLCOM/TOLER
C
      INTEGER OPCALC_TYPE
C
      COMMON/OPTYPE/OPCALC_TYPE
C
      LOGICAL ISCRIT(1:10)
C
      COMMON/ISYCRIT/ISCRIT
C
      LOGICAL ISCOMP(1:10)
C
      COMMON/COMPIS/ISCOMP
C
      LOGICAL ISTOP(1:10)
C
      COMMON/ISYTOP/ISTOP
C
C       VARIABLES COMMON
        COMMON/SUBPS3/MAXVB,VBCNT,VARABL,DELTAG,DELVAL,TVBCNT,CMPCNT
     1,MAXTVB,MAXCMP
C
C       MERIT (OPERANDS)
        LOGICAL OPEXST,FUNCL1,FUNCL2,FUNCL3,FUNCL4,FUNCL5
     1  ,FUNCL6,FUNCL7,FUNCL8,FUNCL9,FUNCL10,FUNCL11,FUNCL12,FUNCL13
     2,FUNCL14,FUNCL15,FUNCL16,FUNCL17,FUNCL18,FUNCL19,FUNCL20
        COMMON/FNCALC/FUNCL1,FUNCL2,FUNCL3,FUNCL4,FUNCL5,FUNCL6,FUNCL7
     1  ,FUNCL8,FUNCL9,FUNCL10,FUNCL11,FUNCL12,FUNCL13,FUNCL14,FUNCL15
     2,FUNCL16,FUNCL17,FUNCL18,FUNCL19,FUNCL20
        COMMON/OPBOOL/OPEXST
C
      INTEGER MAXOPT,MAXREG
      COMMON/REGMAX/MAXOPT,MAXREG
C
C     MAXOPT IS MAXIMUM NUMBER OF OPERANDS IN OPTIM
C     MAXTOP IS MAXIMUM NUMBER OF TOLERANCE OPERANDS
C     MAXFOCRIT IS MAXIMUM NUMBER OF FOCUS CRITERIA OPERANDS
C
      INTEGER TOPCNT,FCCNT,OPCNT,DELOP,CORMOD,MAXTOP,MAXFOCRIT
C
C     DINCRS
      REAL*8 DINC1,DINC2,DINC3,DINC4,DINC5A,DINC5B
     1,DINC6A,DINC6B,DINC7A,DINC7B,DINC8A,DINC8B,DINC9A,DINC9B
     2,DINC10A,DINC10B,DINC11A,DINC11B,DINC12A,DINC12B,DINC13A,DINC13B
     3,DINC14A,DINC14B,DINC15,DINC16,DINC17,DINC18A,DINC18B,DINC19A
     4,DINC19B,DINC20A,DINC20B,DINC21A,DINC21B,DINC22,DINC23,DINC24
     5,DINC25,DINC26,DINC27,DINC28,DINC29,DINC30,NSSDINC(1:300)
      COMMON/DINKY/DINC1,DINC2,DINC3,DINC4,DINC5A,DINC5B
     1,DINC6A,DINC6B,DINC7A,DINC7B,DINC8A,DINC8B,DINC9A,DINC9B
     2,DINC10A,DINC10B,DINC11A,DINC11B,DINC12A,DINC12B,DINC13A,DINC13B
     3,DINC14A,DINC14B,DINC15,DINC16,DINC17,DINC18A,DINC18B,DINC19A
     4,DINC19B,DINC20A,DINC20B,DINC21A,DINC21B,DINC22,DINC23,DINC24
     5,DINC25,DINC26,DINC27,DINC28,DINC29,DINC30,NSSDINC
C
C     DELTT'S
      REAL*8
     1DELTT1,DELTT1A,DELTT2,DELTT2A,DELTT3,DELTT4,DELTT5A,
     1DELTT6A,DELTT7A,DELTT8A,DELTT9A,DELTT10A,DELTT11A,DELTT12A,
     1DELTT13A,DELTT14A,DELTT5B,DELTT6B,DELTT7B,DELTT8B,DELTT9B,
     1DELTT10B,DELTT11B,DELTT12B,DELTT13B,DELTT14B,DELTT15,DELTT16,
     1DELTT15A,DELTT16A,DELTT17,DELTT18A,DELTT19A,DELTT20A,DELTT21A,
     1DELTT18B,DELTT19B,DELTT20B,DELTT21B,DELTT29,
     1DELTT22,DELTT23,DELTT24,DELTT25,DELTT26,DELTT27,DELTT28
      COMMON/DLLTTAA/
     1DELTT1,DELTT1A,DELTT2,DELTT2A,DELTT3,DELTT4,DELTT5A,
     1DELTT6A,DELTT7A,DELTT8A,DELTT9A,DELTT10A,DELTT11A,DELTT12A,
     1DELTT13A,DELTT14A,DELTT5B,DELTT6B,DELTT7B,DELTT8B,DELTT9B,
     1DELTT10B,DELTT11B,DELTT12B,DELTT13B,DELTT14B,DELTT15,DELTT16,
     1DELTT15A,DELTT16A,DELTT17,DELTT18A,DELTT19A,DELTT20A,DELTT21A,
     1DELTT18B,DELTT19B,DELTT20B,DELTT21B,
     1DELTT22,DELTT23,DELTT24,DELTT25,DELTT26,DELTT27,DELTT28,DELTT29
C
      REAL*8 OPERND(1:100000,1:20),OLDOP(1:100000,1:20),CURFIG
C
      CHARACTER VARNAM(1:100000)*8,OPNAM(1:100000)*8,
     1FUNNAM(0:10)*6,CORNAM*3
     2,OPERDESC(1:100000)*80
C
C       VARIABLE NAMES COMMON
        COMMON/VBNMCM/VARNAM
C
C       MERIT COMMON
        COMMON/SUBPS5/OPCNT,OPERND,DELOP,CORMOD,OLDOP,CURFIG
     1,TOPCNT,FCCNT,MAXTOP,MAXFOCRIT
        COMMON/SUBPS6/OPNAM,FUNNAM,CORNAM
        COMMON/DESCRY/OPERDESC
C
C     AUXILLIARY CFG ARRAYS FOR USE WITH AUTO
      INTEGER CFADD(1:410,1:9),AUXMAX,VBCFG,LASCFG
      LOGICAL ULON,USON
      REAL*8 CFVAL(1:410,1:2)
      CHARACTER CFCHAR(1:410,1:2)*23
      COMMON/AUXCF1/CFVAL,CFADD,AUXMAX,VBCFG,LASCFG
      COMMON/AUXCF2/CFCHAR
      COMMON/AUXCF3/ULON,USON
C
      LOGICAL FMTFLG,JK_CHMODE
      REAL*8 FMTFMT,OLDFMT,OOLDFMT
      COMMON/MODECH/JK_CHMODE
      COMMON/FMTT1/FMTFLG
      COMMON/FMTT2/FMTFMT,OLDFMT,OOLDFMT
C
C     THE FIRST ENTRY IS THE ROW ENTRY, EACH ROW IS USED FOR A
C     DIFFERENT OPERAND
C     THE SECOND ENTRY IS THE COLUMN ENTRY, EACH COLUMN IS USED FOR A
C     DIFFERENT VARIABLE
C
C     DERSIZ IS EQUAL TO THE MAXIMUM VALUE OF OPCNT AND VBCNT
      INTEGER DERSIZ
C
      LOGICAL SOLEXT,DEREXT,CFCH,OPTMES,FMTEXT
C
      COMMON/MESOPT/OPTMES
C
C     DERIVATIVE COMMON BLOCK
      COMMON/DERDER/DERSIZ
      COMMON/DEEXIS/SOLEXT,DEREXT,CFCH,FMTEXT
C
C     KEEPS THE LAST CHANGE VECTOR LENGTH
      REAL*8 LCVLCV
C
      COMMON /VCLVCL/LCVLCV
C
      INTEGER DMP,ODMP
      COMMON/DMPDMP/DMP,ODMP
C
C     PFIND VARIABLES
C     PFIND DEFAULT VALUES
      REAL*8 PFDELA,PFDELM
      INTEGER PFNUM,MAXFAIL
      COMMON/FINDER/PFDELA,PFDELM,MAXFAIL,PFNUM
C     INITIAL VALUES SET IN PROGRAM.FOR ARE:
C              PFDEL=0.6D0
C              MAXFAIL=10
C              PFNUM=10
C
C     RAYS AND FIELDS FOR OPTIMIZATION
C
      REAL*8 FIELDX(1:200),FIELDY(1:200),FIELDZ(1:200)
     1,FIELDW(1:200),RAYX(1:5000),RAYY(1:5000),RAYW(1:5000)
C
      COMMON/FRS/FIELDX,FIELDY,FIELDZ,FIELDW,RAYX,RAYY,RAYW
C
C     POWELL STUFF
C
      INTEGER IPMVAR
C
      REAL*8 IPVAR,IPFMT
C
      COMMON/IPFUNKY/IPVAR,IPFMT,IPMVAR
C
C     TRACKS NON-CALCULABLE OPERANDS IN OPTIM
      INTEGER BAAD
      COMMON/NOCALOP/BAAD
C
C     MODEFLAG IS SET TRUE IF CORMOD EXPLICITLY SET BY USER
C     IN UPDATE MERIT, MODEFLAG IS SET TRUE ELSE IT IS FALSE
      LOGICAL MODEFLAG
      COMMON/MULDER/MODEFLAG
C
      LOGICAL BADOPS
C
      COMMON/OPSBAD/BADOPS
C
C     DILITCNT KEEPS TRACK OF WHETHER OR NOT THE FIRST SET OF DERIVATIVES
C     EXIST.
      INTEGER DILITCNT
C
      COMMON/DILWORTH/DILITCNT
C
C     TVAR LEVEL PIVOT POSITIONS FOR STILT(A, B OR G)
C     AND BTILT(A, B OR G COMMANDS
      REAL*8 ASTILTXP,ASTILTYP,ASTILTZP
      REAL*8 BSTILTXP,BSTILTYP,BSTILTZP
      REAL*8 GSTILTXP,GSTILTYP,GSTILTZP
      REAL*8 ABTILTXP,ABTILTYP,ABTILTZP
      REAL*8 BBTILTXP,BBTILTYP,BBTILTZP
      REAL*8 GBTILTXP,GBTILTYP,GBTILTZP
      COMMON/ASTILTPIV/ASTILTXP,ASTILTYP,ASTILTZP
      COMMON/BSTILTPIV/BSTILTXP,BSTILTYP,BSTILTZP
      COMMON/GSTILTPIV/GSTILTXP,GSTILTYP,GSTILTZP
      COMMON/ABTILTPIV/ABTILTXP,ABTILTYP,ABTILTZP
      COMMON/BBTILTPIV/BBTILTXP,BBTILTYP,BBTILTZP
      COMMON/GBTILTPIV/GBTILTXP,GBTILTYP,GBTILTZP
C
C       SET UP DEFAULT MERIT FUNCTION CONDITIONS
C       DFGRID=1 (HEX) OR =2 FOR (RECT)
C               DFGRID=1
C               DFDEL=0.385
C               DFSEC=8
C               DFRIN=1
C     DEFAULT AUTO STUFF FOR AUTO GENERATION OF OPERANDS 12/7/99
      INTEGER DFPNUMB,DFWAVENUMB,DFTYPENUMB,DF_CFG,DFGRID,DFSEC,DFRIN
      REAL*8 DFWT1,DFWT2,DFWT3,DEFAULT_FOB(1:4,1:25),DFDEL
      COMMON/DEFAUTO/DFDEL,DFPNUMB,DFWAVENUMB,DFTYPENUMB,DFWT1
     1,DFWT2,DFWT3,DEFAULT_FOB,DF_CFG,DFGRID,DFSEC,DFRIN
C
        LOGICAL CHROMATIC
        COMMON/MONOCHROME/CHROMATIC
C
C       GLOBAL LIMITS ON TH AND RD VARIABLES IN OPTIMIZATION
        REAL*8 THMINLIM,THMAXLIM,RDNEGLIM,RDPOSLIM
        COMMON/LIMITORS/THMINLIM,THMAXLIM,RDPOSLIM,RDNEGLIM
C
        INTEGER DERLIM
        LOGICAL L_DERLIM
        COMMON/LIMDER/DERLIM,L_DERLIM
C
C       4/27/2003 ITERROR ADDED TO STOP LOOPS WHEN "ITER" GOES BAD.
!        LOGICAL ITERROR
C
C       CLEARX,CLEARY VARIABLES
        REAL*8 CLFOB1,CLFOB2,CLRAY1,CLRAY2,CLSRF1,CLSRF2
        COMMON/CLEARANCEVARS/CLFOB1,CLFOB2,CLRAY1,CLRAY2,CLSRF1,CLSRF2
C
C       ITER ADJUST COMMON BLOCK
        REAL*8 ADJUST_VAL1
        COMMON/ITADJUSTCOM/ADJUST_VAL1
C
