c
c
c-----this is the 'common' file that prefaces most program units
c
      implicit integer*2(i-n)
      implicit double precision(a-h,o-z)
c
      double precision  A_1,a_vect,Aalpha,Adef,Adeff,
     x                  adtm,alphak,alphas,ambtmp,athdtm,avasp,
     x                  b_rad,boltzman,
     x                  C_11nu,c_begn,c_dura,cenrad,cirrad,chia1,
     x                  Cn,Cn_1,Cn_2,cosa,
     x                  D_o,
     x                  dAdef,dAdefc,dAdefct,dAdeff,dAdeffc,dAdeffct,
     x                  dAdeffcts,
     x                  def,defrat,defratl,defw,defwold,dele,
     x                  dfunc6,dfunc7,dfunc7i,Dlast,dpfluid,
     x                  dslidet,dsold1,dtfctr,dtiltr,dtinp,dvctrl,
     x                  E_abs_ft,E_abs_delta,
     x                  E_delta_ell,E_ell_ell,E_ft_ell,E_m_ell,
     x                  Ebar,Ebar23n,Ebar23t,Ebar43n,Ebar43t,
     x                  elnrgyo,etargt,
     x                  fabf,fpnrgy,frict_sav,frictm,fside,
     x                  func6,func7,func7i,fxside,
     x                  G,gamm,gravty,Gbar,h_rho, Hcc,
     x                  Iavg,Imean,ixcell,
     x                  K_f,K_s,kappa,kbulk,kn,knh,knmax,
     x                  knrgy,knrgyo,knsep2,knseph,
     x                  kratio,kt,kth,kthh,lambda,Ldt,l_i_old,
     x                  mass,massav,massd,massit,maxbox,
     x                  mnt,mnt2,mntav,mntit,mside,msum,N_o,n1,nu,
     x                  p_atm,p_o,p_vap,p_wcav,palpha,pfluid,pfluido,
     x                  planck,poros0,porosn,pstres,
     x                  q,q_alt,Qc_old,Qp,
     x                  rdampa,rgas,rhoinp,rin,rout,
     x                  S_now,S_o,s_rad,satrad,spheat,spnrgy,
     x                  streff,stres0,stresh,stress,stro,strsub,strtot,
     x                  stresf,stresft,
     x                  strwold,
     x                  tdampa,tdepf,tempr, temprt,
     x                  tmax,tolQ,torque,Tstar,tstres,
     x                  v_p,v_int,vcellt,vmnt_p,vmnt2p,
     x                  volavg,volmin,VolumQ,vrate,
     x                  workc,
     x                  xbar,xbreak,xfsum,xi_old,xlocal,xmsum,
     x                  xside,xxfsum
c
      integer*2         algori,Bversn,countr,damp,hmodel,
     x                  icoef,idamp,ifrctnl,iheat,ip1cnt,ip2cnt,iporo,
     x                  iqcntr,
     x                  listf1,listf2,mlist3,
     x                  nbumps,nobs,npnts_xtra,nslidc,order,platn,quad
c
      integer*4         BBvers,box,boxi,
     x                  c_list,c_i,c_j,c_mi,c_mj,cowntr,
     x                  f1,f2,header,hole,hf,hv,
     x                  iballw,icontl,icontp,icontpl,icontr,
     x                  icornw,ihole,inlayr,
     x                  iouti,iout9,ipoint,ipoin2,ipt2,ipt4,ipt6,
     x                  iptbx1,iptbx2,
     x                  isort,istep,istep2,istepa,istepm,
     x                  isub,itime,itrack,iunit,
     x                  lfaces,list1,list2,listb,liste,listf0,loopst,
     x                  mboxes,mbox1,mbox2,mbox3,mbumps,mbx,
     x                  mcells,medges,merror,
     x                  mfirst,mholes,
     x                  mlist,mlist2,mlist4,mlistJ,mnsid,
     x                  mp,mparts,mpiece,mprsid,mvers,
     x                  nbox,nboxes,
     x                  ncase3,ncells,ncownt,ndim1,ndim2,nedgs,nerror,
     x                  nfilled,nnear,nover2,np,np2,npiece,npm,
     x                  nsegs,nskip,nslide,
     x                  ntacts,ntactz,ntactzf,ntfill,ntag,ntago,nupdat4,
     x                  nverts,
     x                  p1,p2,v1,v2,Zero
c
      logical           l3d,lanch,lApprox,laxsym,
     x                  lbegin,lbody,lbodyf,lbound,lbumpy,lcdamp,
     x                  lcircl,lcirc1,lcirc2,lcirc3,lcirct,lconvx,
     x                  ldefrm,ldirec,ldisp,ldistr,ldrain,ldump,
     x                  lelips,lerror,lexact,
     x                  lfbnd,lfirst,lflag1,lflexc,lflexi,lfrict,
     x                  lgrav,lHertz,lhiddn,
     x                  linit,linitc,linitf,liso,liso2,
     x                  lJager,lJagr2,lJagr3,lJagr4,
     x                  llast,llayrs,lmove,lnew,lnewc,lnewdt,lnobby,
     x                  lout,loval,lovoid,lovrid,lplatn,
     x                  lplold,lplot,lplotd,
     x                  lpltmp,lporo,lstop,ltrue,lupdat,lqcntr,lquez,
     x                  lrepr2,lreprt,lreset,lrotat,
     x                  lshrtn,lsinh,lsphr,lswept,lspher,lsplvt,
     x                  ltheta,lthfix,ltotal,ltrick,lvctrl,lwalls,
     x                  lxfix,lXfull,lxiold,lYfull
c
      character*400     apend,file1,file2,file3
      character*72      title
      character*24      version
      character*4       cstep
c
c
c-----parameters that are used to dimension the various arrays:
c       mp     - maximum number of particles
c       mpiece - maximum number of component pieces (for oval particles)
c       lc1    - maximum number of stress-strain control periods, 
c                should be an odd integer
c       lc2    - maximum number of force-separation data
c       ldiams - maximum number of diameters in force-separation data
c       mlist  - maximum size of the linked list of neighbors: max. number
c                of particle pairs that are near neighbors
c       mlist2 - maximum size of the linked list of contact forces: max. number
c                of particle pairs that are touching
c       mlistJ - maximum size of the linked lists for storing information
c                for Jager contacts
c       mholes - maximum number of vacancies in list of touching particles
c       mdim1  - the number of spatial dimensions (2D or 3D)
c       mdim2  - the number of rotational "dimensions"
c       mfiles - maximum number of output files
c       mplatn - maximum number of platens (composed of particles)
c       mconvx - maximum number of contacts between a pair of two particles,
c                which might be non-convex (2D or 3D)
c       mparts - maximum number of parts in a composite 2D particle
c       mbumps - maximum number of satellite spheres in a bumpy particle
c
c-----comment out one or the other of the following "paramater" lines
c-----2D simulations only
c     parameter (mdim1=2,mdim2=3)
c-----3D or 2D simulations simulations
      parameter (mdim1=3,mdim2=1)
c
c-----maximum number of particles
c     parameter (mp=6400)
      parameter (mp=10648)
c     parameter (mp=60000)
c     parameter (mp=129000)
c     parameter (mp=11250)
c
      parameter (mpiece=4*mp)
      parameter (mfirst=0)
      parameter (mlist=mfirst+8*mp)
c-----convex particles
c     parameter (mlist2=16*mp/2,mholes=16*mp/2,mconvx=1)
c-----non-convex particles
      parameter (mlist2=20*mp/2,mholes=20*mp/2,mconvx=10)
      parameter (mparts=5)
      parameter (mlists=5,mlist3=mlists**2)
c
      parameter (mcells=mp*10/5,mlimbs=30)
      parameter (mstack=10,lc1=9999,lc2=9999,ldiams=20)
c
c-----parameters for use with application of body forces
      parameter (mnodes=128,lnodes=24)
      parameter (mordr2=4)
      parameter (mordr3=2)
      parameter (mdim=mnodes*2)
c     !!! Be sure to change 'mdim' in subroutins gauss2 and cyclix !!!
      parameter (mnsid=5*mp/lnodes/3)
c
      parameter (mdiff=1,mreslt=3)
      parameter (mpts=100)
c
      parameter (mboxes=mp/2,mbox1=150,mbox2=400,mbox3=40)
      parameter (mprsid=6000)
      parameter (mbx = mboxes+mpiece)
      parameter (mfiles=100)
      parameter (mplatn=10)
c
c     parameter (mlistJ=2000*mp)
c     parameter (mlistJ=4100*mp)
cc    parameter (mlistJ=8000*mp)
c     parameter (mlistJ=7200*mp)
      parameter (mlistJ=800*mp)
c     parameter (mlistJ=1*mp)
c
      parameter (mbumps=8)
      parameter (mtacts=1000)
c
      parameter (Zero=0)
c
c Double precision arrays:
      common a_vect(3,mp),Adef(3,3),Adeff(3,3),aspect(mp)
      common b_rad(0:mbumps)
      common bftot2(0:mnodes-1),bftot3(0:mnodes-1),bftot4(0:mdim-1)
      common branch(2,0:mlist2)
      common c_begn(mtacts),c_dura(mtacts)
      common c_etas(3,0:mlist2),cbeta(mdim1)
      common coefrl(0:mordr2,0:mnodes-1)
      common cofrlv(0:mordr3,0:mnodes-1),cofrlt(0:mordr3,0:mnodes-1)
      common coefsv(0:mordr2,0:mnodes-1),coefst(0:mordr2,0:mnodes-1)
      common cofsvv(0:mordr3,0:mnodes-1),cofstv(0:mordr3,0:mnodes-1)
      common cofsvt(0:mordr3,0:mnodes-1),cofstt(0:mordr3,0:mnodes-1)
      common cosa(mparts,3)
      common cosxl(2,0:mlist2),cosyl(2,mprsid),ctheta(mdim1,mp)
c
      common dAdef(3,3),dAdefc(3,3),dAdefct(3,3)
      common dAdeff(3,3),dAdeffc(3,3),dAdeffct(3,3),dAdeffcts(3,3)
      common ddef(8),ddefh(3),ddefho(3)
      common ddefme(3,3),ddefmt(3,3)
      common ddlate(0:mdim-1),ddlsav(0:mdim-1)
      common ddth(mdim2:3,mp),dth(mdim2:3,mp),dthtot(mp)
      common def(3,3),defb(3,3),defdot(0:lc1),defflx(3,3),defo(3,3)
      common defold(3,3),defp(3,0:3),defrat(8,0:lc1),defratl(8)
      common defup(3),defv(0:8)
      common deftot(3,3),defttn(3,3),defttt(3,3)
      common deftt1(3,3),deftt2(3,3),deftt3(3,3),defclt(3,3)
      common delfrc(0:mdim-1),densty(0:mdim-1,3,3:5)
      common dilate(0:mdim-1),disave(0:mdim-1)
      common ds(8),dsfals(8+mdiff,mstack),dsold(0:1),dsold1(0:mlist2)
      common dsreal(8,mstack),dstres(8),dtfctr,dtiltr(3)
      common dx(mdim1,mp),dxcell(3,3),dxcelt(3,3)
      common dxtot(mp),dxLdt(mdim1,mp)
c
      common E_delta_ell(3,3),E_ell_ell(3,3),E_ft_ell(3,3),E_m_ell(3,3)
      common eperm(3,3,3)
      common f(mdim1,mp),fext(mp),fabf(3,3)
      common finalv(0:lc1),fnold1(0:mlist2),fside(2,2,3)
      common fth(mdim2:3,mp),ftold(mdim1,0:mlist2)
      common func1(0:mpts),func2(0:mpts),func3(0:mpts+1)
      common func4(0:mpts+1),func5(0:mpts+1)
      common func6(0:mpts+1), func7(0:mpts+1), func7i(0:mpts+1)
      common fxside(2,2,3,3)
      common gamma_(3,mp),gravty(3),ixcell(3)
      common Ldt(3,3),l_i_old(mdim1,0:mlist2)
      common msum(3),mass(1:mp),mnt(1:mp),mnt2(1:mp),mside(2,2,3)
      common pairz(0:mdim-1),pcrit(3),pforce(0:lc2,0:ldiams)
      common pnrgyz(0:mdim-1),psep(0:lc2,0:ldiams)
      common pstres(mdim1,mdim1,mp),ptot(3,3),ptot2(3,3)
      common q(8,8),q_alt(8,8)
      common Qc_old(4,0:mlist2),qdef(8),qi(8,8),Qp(4,mp),qs(3,3)
      common rad(mp),rballz(0:mdim-1),r_piec(4,mp)
c
      common s(8),s_rad(0:mbumps),sepdia(0:ldiams),slidez(0:mdim-1)
      common str(0:8),stranc(3),strbeg(3,3)
      common stres0(3,3),stresh(3,3,3),stress(3,3),stresz(0:mdim-1,3,3)
      common streso(8),strs2(3,3),strsh2(3,3,3),strsub(3,3),dstI(3,3)
      common dstII(3,3),dstIIa(3,3),dstIIb(3,3),dstIIc(3,3),dstIId(3,3)
      common dstII1(3,3),dstII2(3,3),dstII3(3,3),dstII4(3,3)
      common dstIII(3,3),dstIIIa(3,3),dstIIIc(3,3),dstIIId(3,3)
      common dstIII1(3,3),dstIII2(3,3),dstIII3(3,3),dstIII4(3,3)
      common dstIV(3,3)
      common streff(8),strflx(3,3),stro(8),strold(3,3),strtot(8)
      common stresf(3,3),stresft(3,3)
      common tempr(mp)
      common th(0:mdim-1),theta(mdim2:3,mp),thklyr(0:mdim-1)
      common thmove(mdim2:3,mp),thp(0:mdim-1),thpsav(0:mdim-1)
      common thpp(0:mdim-1),thppsv(0:mdim-1),thsave(0:mdim-1)
      common tolrnc(2),torqu2(3),torque(3),Tstar(0:mlist2),tstres(3,3)
      common tstrs2(3,3)
c
      common u(0:mdim-1)
      common up(0:mdim-1),upp(0:mdim-1)
      common upsave(0:mdim-1),uppsav(0:mdim-1)
      common urel(0:mdim-1),ustart(0:mdim-1)
      common usave(0:mdim-1)
      common v_p(mp),vmnt_p(mp),vmnt2p(mp),v(0:mdim-1,mreslt)
      common vrate(0:lc1),vrel(0:mdim-1,mreslt)
      common vsave(0:mdim-1,mreslt),vstart(0:mdim-1,1)
      common vh(mdim1,mp),vhth(mdim2:3,mp)
      common xlocal(0:mbumps,3),xbar(3),x_piec(mdim1,mpiece)
      common xp(mdim1,mp)
      common xcell(3,3),xcelle(3),xcellf(2),xcelli(3,3),xcello(3,3)
      common xfsum(3,3)
      common xi(8,8),xi_old(2,mlist2),xmomnt(3)
      common xmove(mdim1,mp),xmsum(3,3),xside(2,2,3,3),xxfsum(3,3,3)
      common yi(8,8)
c
c Double precision variables:
      common A_1,adtm,alphak,alphas,alphit,ambtmp,athdtm,avasp
      common beta,betar,boltzman
      common C_11,C_11nu,cenrad
      common chi1,chi1t,chia1,chi2,chi2t,chi3,chi3t,chi4,chi4t
      common chiavg,chiavt,chimax,cirrad
      common Cn,Cn_1,Cn_2,coef4,coef5,coef7,cosm,cot_b
      common D_o,dampc1,dampc2,damp1,damp2
      common dbegin,dbfavt,ddeflx,dease,defw,defwold,dele,dely,delz
      common dfunc6,dfunc7,dfunc7i,doubl2,Dlast,dpfluid,dsfm
      common dsflx,dslide,dslidet,du2m,dufm
      common dt,dtinp,dtreal,dtrl2,dtrl2s,dtrlo
      common dvctrl,dxym
c
      common E_abs_ft,E_abs_delta
      common ease,Ebar,Ebar23n,Ebar23t,Ebar43n,Ebar43t,elnrgyo,etargt
      common fbalsq,fdampa,ffactr,fk2,fnavg,fnavg2,fpnrgy
      common frcfac,frict,frict_sav,frictm,frictw,frict2,ftsq
      common G,gamm,gamma1,gmod,grypwr,Gbar,h_rho,Hcc,Iavg,Imean
      common K_f,K_s,kappa,kbulk
      common kn,knh,knmax,knrgy,knrgyo,knsep2,knseph
      common kratio,kt,kth,kthh,lambda
      common massav,massd,massit,maxbox,mntav,mntit,N_o,n1,nu,ovravg
      common p_atm,p_o,p_vap,p_wcav,palpha,pdif,pdifsv,pdif2
      common pfluid,pfluido
      common pi,picpt1,picpt2,pinit,planck
      common pn,pnrgy,pnrgy_alt
      common pnrgy1,pnrgy1o,pnrgy2,pnrgy2_alt,pnrgy2o,pnrgy2o_alt
      common poros0,porosn,powerm,psep1,psep2,psi,psi2,ptol
c
      common ravg,ratmax,rdampa,rfact1,rfact2,rgas
      common rho,rhoinp,rin,rmax,rmax2,rmin,rmsvel,rout,rpcmin
      common S_now,S_o,satrad,scale,sep,seprat0,sinm
      common slidet,slidet_alt,solidr
      common spheat,spin,spnrgy,srint,stdevt,stff1,stff2,stravg,strwold
      common sweep
      common tan_b,tclock,tclokm,tdampa,tdepf
      common temprt,tfact1,tfact2,thblsq,thsq
      common timer,tlim1,tlim2,tmax,tolQ,trans,treal,treal1
c
      common udot
      common v_int,vcell,vcell2,vcelli,vcell0,vcello,vcellt
      common viscb,viscbt,viscc,viscct
      common voidn,voido,volavg,volmin,VolumQ,vprime,vs,vso,vsubt
      common work1t,work2t,workc
      common xbreak,xcellh,xcells,xfilt,xmag,xpnts,xseed,xshift,zone
c
c Character variables:
      common title
      common cstep,file1,file2,file3,apend,version
c
c Logical variables (4 bytes):
      common l3d,lanch,lApprox,laxsym
      common lbegin,lbody(2),lbodyf,lbound(mp),lbumpy,lcdamp
      common lcircl,lcirc1,lcirc2,lcirc3,lcirct,lconvx
      common ldefrm,ldirec(mplatn),ldisp,ldistr,ldrain,ldump
      common lelips,lerror,lexact
      common lfbnd,lfirst,lflag1,lflexc,lflexi,lfrict,lgrav
      common lHertz,lhiddn,linit,linitc,linitf,liso,liso2
      common lJager,lJagr2,lJagr3,lJagr4,llast,llayrs
      common lmove,lnew,lnewc,lnewdt,lnobby
      common lout(mfiles),loval,lovoid,lovrid
      common lplatn,lplold(0:mlist2),lplot,lplotd,lpltmp,lporo
      common lqcntr,lquez,lrepr2,lreprt,lreset,lrotat
      common lshrtn,lsinh,lspher,lsphr,lsplvt,lstop,lswept
      common ltheta,lthfix(3,0:mplatn),ltotal(8),ltrick,ltrue
      common lupdat,lvctrl,lwalls
      common lxfix(3,0:mplatn),lXfull,lxiold,lYfull
c
c Integer variables (4 bytes):
      common BBvers
      common box(0:mbox1-1, 0:mbox2-1, 0:mbox3-1),boxi(mboxes,3)
      common c_list(mtacts),c_i(mtacts),c_j(mtacts)
      common c_mi(mtacts),c_mj(mtacts)
      common cowntr,f1(0:mlist2),f2(0:mlist2)
      common header(mp),hole(mholes)
      common hf(mcells),hv(mp)
      common icontl
      common iballw(mprsid,2)
      common icontp(0:lc1),icontpl,icontr(0:lc1),icornw(0:3),ihole
      common inlayr(0:mnsid,0:mnodes-1)
      common iptbx1(1:mbx),iptbx2(1:mbx)
      common isort(mp),istep,istep2,istepa,istepm
      common isub,itime,itrack(4)
      common lfaces,list1(mfirst+1:mlist),list2(0:mlist)
      common listb(mfirst+1:mlist)
      common liste(0:mlist2),listf0(0:mlist2),loopst
      common medges,mvers
      common p1(0:mlist2),p2(0:mlist2),v1(0:mlist2),v2(0:mlist2)
      common iouti,iout9,ipoint,ipoin2,ipt2,ipt4,ipt6,iunit,merror
      common nbox(3),nboxes,ncase3
      common ncells,ncownt,ndim1,ndim2,nedgs,nerror,nfilled
      common nnear,nover2,np,np2,npiece,npm
      common nsegs,nskip,nslide
      common ntacts,ntactz,ntactzf,ntag,ntago,ntfill,nupdat4,nverts
c
c Integer arrays (2 bytes):
c
      common countr(8),damp(3,3)
      common ianch(3),ibodyf(0:lc1),nbound(3)
      common icont(7),idirec(mplatn),idump(0:lc1),iflexc(0:lc1)
      common ifn_togl(0:mlist2),igoal(0:lc1),iiso(3)
      common iknown(8),imicro(0:lc1),indx(2,6),iout(10)
      common ip1cnt(8),ip2cnt(8),iplot(0:lc1),ipts2(0:lc1),ipts(0:lc1)
      common islip(0:mlist2), isolve(8)
      common itrick(0:lc1),ivctrl(8),jout(0:lc1),krotat(0:lc1)
      common list3(mfirst+1:mlist,-1:mlist3)
      common listf1(0:mlist2),listf2(0:mlist2)
      common nabors(mp),nballz(0:mdim-1),nbumps,nsepf(0:ldiams)
      common nslidc(mp)
      common platn(mp),quad(2,0:mlist2)
c
c Integer variables (2 bytes):
      common algori,Bversn,hmodel,ibody1,ibody2
      common iaxis1,iaxis2,icirct,icoef,idamp
      common idef,idirct,idxold,iend,iexact,iflex,ifrctnl
      common ignore,igoala,igoalb,ihat,iheat
      common iinteg,iloops,ilpavg,imodel
      common ioutd,ioutyp,iporo,iqcntr,irotat
      common istart,istepc,istepf
      common itxt,iupdat,iupdtm
      common kshape
      common lpsxcd
      common ndummy,ntests
      common nc,nc2,ncount,ncyc
      common ndiams,ndoubl,nesses,nfacts,nfilt,nfit,niso,njoin,nknown
      common nlayrs,nloop1,nloop2,nloopa,nloopb,nloopm,nloops
      common nlpmin,nodes,nodes2,nobs,npnts_xtra
      common np1,np1b,npiecs,nplatn,npnts,nplots
      common nshift,nshift1,nshift2
      common nsolve,nsplin,nstepf
      common nsplnt,nsplnv,nfitt,nfitv
      common ntaga,number,nupdat
      common order
c
