C---------------------------- parameters for PMhalosM --------
C      iDebug      = 1 gives long output for debuging
C                  = 0 makes output shorter
C      iHelp       = 1 gives short description of parameters
C                            and creates a file, which stores
C                            all your answers. Use it for
C                            rerunning the code.
C
C
C       Nc - number of centers, Np - number of dm particles
C       Nrad - number of shells for halos
C
C                       Configuration parameters
      PARAMETER (Nc      =   1 000 000)  ! Max number of initial centers
      PARAMETER (Nrad    =   40)      ! Number of shells for halo profile
      PARAMETER (FracSearch = 7. )      ! Factor of Rmax for small halos
      PARAMETER (Ncc     =   400 000)    ! Number of maxima of density field
      PARAMETER (Np      = Nmaxpart)    ! Max Nparticles
      PARAMETER (Nrad_lim =Nrad)
      PARAMETER (iDebug  =     0)       ! debugging parameteter
      PARAMETER (iHelp   =     0)       ! help

C                       Parameters to tune halo finder
      PARAMETER (dClose  =    15. )         ! Only one seed within distance
                                           ! dRdubl/dClose will be kept; dRdubl is distance
                                           ! to remove duplicates.
	                                   ! This is used in CATALOG.
                                           ! It is maximum of the radius of the first bin
                                           ! Rad(1) and  dRdubl/dClose

      PARAMETER (nFirst  =    15 )          ! minimum number of particles inside 
                                           ! radius for chosing first bin for overdensity
                                           ! and mass profiles
      PARAMETER (mFirst  =    30)          ! minimum number of particles in side 
                                           ! radius for chosing first bin for radial velocity
					   ! profile Vrad. This is for <Vradial>=0.5Vcirc test,
                                           ! which used to truncate outer radius of halos

      PARAMETER (dRmaxrot =    2.)         ! defines minimum concentration for a halo when
                                           ! deciding on escape velocity.
                                           ! Radius of maximum circular velocity is
                                           ! limited to be smaller than Rhalo/dRmaxrot.
                                           ! Concentration is larger than dRmaxrot*2.15

      PARAMETER (nmin     = 30 )           ! minimum number of particles, which defines
                                           ! radius of a sphere used for bulk velocity of a halo
 
      PARAMETER (iCentr   = 2 )           ! minimum bin number for  bulk velocity of a halo:
                                           ! Radial bin for the velocity is
                                           ! the largest of iCentr and radius containing nmin
 
c                       Optimization parameters
      PARAMETER (Nm      =    -10)          ! define size of linker mesh
      PARAMETER (Nlinker =    800)         ! 
      PARAMETER (Nb      =    Nlinker-Nm)  ! define size of linker mesh
      PARAMETER (mDynamic = 50 )     ! dynamical scheduling for OpenMP
      PARAMETER (kDynamic = 10 )     ! these parameters define length of
                                     ! chunk of halos to assign for 
                                     ! one OMP thread

      COMMON /CATx/ Xp(Np)
      COMMON /CATy/ Yp(Np)
      COMMON /CATz/ Zp(Np)
      COMMON /CAT1/ VXp(Np)
      COMMON /CAT2/ VYp(Np)
      COMMON /CAT3/ VZp(Np)

      COMMON /CBTx/ Xpp(Np)
      COMMON /CBTy/ Ypp(Np)
      COMMON /CBTz/ Zpp(Np)
      COMMON /CBT1/ VXpp(Np)
      COMMON /CBT2/ VYpp(Np)
      COMMON /CBT3/ VZpp(Np)
      COMMON /CBT4/ Wpp(Np)

      COMMON /MXM1/ Xm(Nc)
      COMMON /MXM2/ Ym(Nc)
      COMMON /MXM3/ Zm(Nc)
      COMMON /MXM4/ Amc(Nc)
      COMMON /MXM5/ Rmc(Nc)
      COMMON /MXM6/ Vrm(Nc)
      COMMON /MXM7/ iRadius(Nc)
      COMMON /MXM8/ RmaxV(Nc)



c     Common/XMX/ Xm(Nc),Ym(Nc),Zm(Nc),Amc(Nc),Rmc(Nc),Vrm(Nc),
c     +             iRadius(Nc),RmaxV(Nc) 
c      COMMON /MXMx/ Xm(Nc)
c      COMMON /MXMy/ Ym(Nc)
c      COMMON /MXMz/ Zm(Nc)
c      COMMON /aMXMx/ Amc(Nc)
c      COMMON /rMXMx/ Rmc(Nc)
c      COMMON /vXMx/ Vrm(Nc)
c      COMMON /iXMx/ iRadius(Nc)
c      COMMON /UXMx/ RmaxV(Nc)

      COMMON /GRD/ Label(Nm:Nb,Nm:Nb,Nm:Nb)
      COMMON /GRDm/ Lst(Np)
      COMMON /MXCa/ Wxc(0:Nrad,Ncc)
      COMMON /MXCd/ Wyc(0:Nrad,Ncc)
      COMMON /MXCe/ Wzc(0:Nrad,Ncc)
      COMMON /MXC1/Vrmc(0:Nrad,Ncc)
      COMMON /MXC2/Nbc(0:Nrad,Ncc)
      COMMON /MXC3/Rrc(0:Nrad,Ncc)
      COMMON /MXC4/NbcM(0:Nrad,Ncc)
      COMMON /MXC5/NbcG(0:Nrad,Ncc)
      COMMON /MXC6/NbcS(0:Nrad,Ncc)
      COMMON /MXC7/Vrada(0:Nrad,Ncc)
c     +       Nrad0(0:Nrad,Ncc),Wrad0(0:Nrad,Ncc),Wrad2(0:Nrad,Ncc)
c     +      ,Agx(0:Nrad,Ncc),Agy(0:Nrad,Ncc),Agz(0:Nrad,Ncc)
      COMMON /PNT/ RadSr1,RadSr2,aNvir,Cell,
     +             Rad(Nrad),Rad2(Nrad),weightSmall


