      IMPLICIT NONE
      INTEGER MAXOS,MAXFE,MAXSTR,MAXDEF,MPAR,MP,NP,MH

      PARAMETER (MAXOS=1000, MAXFE=2, MAXSTR=2, MAXDEF=1000,
     *    MPAR=1, MP=MAXFE*MPAR+1, NP=MAXFE*MPAR, MH=MAXOS*MAXSTR)
     
      CHARACTER	FILENAME3*132
           

      DOUBLE PRECISION CX,CY,CZ,
     *        FX,FY,FZ,
     *        RCCPTX,RCCPTY,RCCPTZ,
     *        CENTER,SSX,SSY,SSZ,
     *        TSX,TSY,TSZ

      DOUBLE PRECISION  TOLPROT,WPROT,CSHIFT,
     *        OBS,MLPROT,
     *        PHI,TETA,OMEGA,
     *        A1DIP,A2DIP,
     *        OPTPHI,OPTTETA,OPTOMEGA,
     *        OPTA1,OPTA2,STR1,STR2,
     *        STR3,STR4,STR5,STR6,
     *        STR7,STR8,
     *        ASXX, ASYY, ASZZ,
     *        AXSYS, AYSYS, AZSYS,
     *        TOLDIP,RESID,OLDRESID,PERC,X1O,Y1O,Z1O,X2O
     *        ,Y2O,Z2O,X3O,Y3O,Z3O,DELTA,SIMP,RAND,EXTR
      DOUBLE PRECISION AK1,RK1,RK2
      DOUBLE PRECISION VAL,CCASH,ZRR,X1,Y1,Z1,X2,Y2,Z2,X3,Y3,Z3,X4,Y4

      DOUBLE PRECISION Z4,TETA2,PHI2,P,T,O,AL,BE,GA,RNDOM,PERM,Y
      DOUBLE PRECISION APP,AVERAGE,ASTDEV,ERR,PBAR,PR,YR,PK,YK,PE,YE

      DOUBLE PRECISION PT,YT,PC,YC,OLDP,OLDPOPPA,RMR,TMP1,VETT,A1D,A2D
      DOUBLE PRECISION TMP2,COSTMULT,PRIMO,G1,G2,G3,G4,G5,RM
      DOUBLE PRECISION SMED,STDEV,VV,VMAX,VMIN,PI,A1,A2,SAXSYS,SAYSYS,
     *        SAZSYS,SAXX,SAYY,SAZZ,SDZX,APPX,APPY,SXX,SYY,SXZ,SYX,SXY,
     *       SYZ,SZX,SZY,SZZ,VZX,VZY,VZZ,CDIR


      INTEGER IOLDVIO,IVIOLATION,INTSYS,
     *        NHP,NFE,NSTR,NUMS,NUMD,NUMT,NAT,NSYSTEM,NGRID
     *        ,IHP,NIA,L,NK,I,J,ITER,IL,IM,JM,N,M,NPROTML
     *        ,MED,NORES,NUMBERATOM,NR,MDIPO
     

      DOUBLE PRECISION XP(MAXSTR,MAXDEF),YP(MAXSTR,MAXDEF),
     *                 ZP(MAXSTR,MAXDEF)
      INTEGER NUM_RES(MAXSTR,MAXDEF),NUMRES(MH)

      DOUBLE PRECISION R(MAXSTR,MAXOS),TETA1(MAXSTR,MAXOS),
     *          PHI1(MAXSTR,MAXOS) 

      COMMON /SIMPLEX/ 
     *        CX(MAXSTR,MAXOS),CY(MAXSTR,MAXOS),CZ(MAXSTR,MAXOS),
     *        FX(MAXSTR,MAXOS),FY(MAXSTR,MAXOS),FZ(MAXSTR,MAXOS),
     *        RCCPTX(MAXFE,3), RCCPTY(MAXFE,3),RCCPTZ(MAXFE,3),
     *        CENTER(MAXFE,3),SSX(MAXFE,3),SSY(MAXFE,3),SSZ(MAXFE,3),
     *        TSX(MAXFE,3),TSY(MAXFE,3),TSZ(MAXFE,3),
     *        TOLPROT(MH),WPROT(MH),CSHIFT(MH),
     *        OBS(MH),MLPROT(MH),AK1(MAXOS),RK1(MAXOS),RK2(MAXOS),
     *        PHI(MAXFE),TETA(MAXFE),OMEGA(MAXFE),
     *        A1DIP(MAXFE),A2DIP(MAXFE),
     *        OPTPHI(MAXFE),OPTTETA(MAXFE),OPTOMEGA(MAXFE),
     *        OPTA1(MAXFE),OPTA2(MAXFE),STR1(MAXSTR),STR2(MAXSTR),
     *        STR3(MAXSTR),STR4(MAXSTR),STR5(MAXSTR),STR6(MAXSTR),
     *        STR7(MAXSTR),STR8(MAXSTR),
     *        ASXX(MAXFE,3), ASYY(MAXFE,3), ASZZ(MAXFE,3),
     *        AXSYS(MAXFE,3), AYSYS(MAXFE,3), AZSYS(MAXFE,3),
     *        TOLDIP,RESID,OLDRESID,IOLDVIO,IVIOLATION,INTSYS,
     *        NHP,NFE,NSTR,NUMS,NUMD,NUMT,NAT,NSYSTEM,NGRID,
     *        FILENAME3,MDIPO

