      SUBROUTINE LOCTVMDST(ML,MR,MGB,MSTATES,MG3,MSSPC,MWRKTV,MTBLTV,
     &MPOUT,MTOUT,MSOUT)
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C 
C LOCTVMDS: SET UP LOCATION COMMOM BLOCK FOR WRKTVMDS
C
C INPUT PARAMETERS:
C
C   ML     --- MAXIMUM NUMBER OF LEVELS IN MODEL ATMOSPHERE.
C   MR     --- MAXIMUM LEVELS IN INPUT ATMOSPHERE.
C   MGB    --- MAXIMUM GASES/ISOTOPES/TRANSITIONS IN FORWARD MODEL.
C   MSTATES--- MAXIMUM GASES/ISOTOPES/TRANSITIONS IN TVIB MODEL.
C   MG3    --- NUMBER OF STATES IN G3-STATE MANIFOLD.
C   MSSPC  --- MAXIMUM SIZE OF SOLAR SPECTRUM ARRAY.
C   MWRKTV --- MAXIMUM SIZE OF WRKTV WORK ARRAY (IN WRKTVMDS).
C   MTBLTV --- MAXIMUM SIZE OF TBL DATA SUBSET.
C   MPOUT  --- MAXIMUM SIZE OF POUT DATA SUBSET. 
C   MTOUT  --- MAXIMUM SIZE OF TOUT.
C   MSOUT  --- MAX SIZE OF SOUT PER GAS (or vibrational transition).
C
C SOFTWARE WRITTEN BY Christopher J. Mertens
C                     NASA Langley Research Center
C                     Atmospheric Sciences Competency
C                     21 Langley Blvd., Mail Stop 401B
C                     Hampton, VA 23681-2199
C MODIFIED 2004 By B.T. Marshall to include MGB for dimensioning of
C NLMX and NLMXVMR. 
C
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
      SAVE
      COMMON/LWRKTVMDST/LIDAY,LINITTV,LLVSED,LLVSEDTV,LLTV,LLMCM,LLSHR,
     &LIFLUXAL,LICCM,LISLH,LISECANT,LNITN,LNITD,LNITC,LITVOPT,LITVOPTN2,
     &LMG3,LMSSPC,LMTBLTV,LMWRKTV,LNLTV,LNVTS,LIVTS,LIVTSN,LIVTSG3,
     &LITVID,LITVIDVMR,LNLMX,LNLMXVMR,LNMXTV,LIRADTV,LZATV,LABDISO,
     &LABDISOG3,LENGY,LENGYG3,LSZA,LCSSPC,LWRKTV,LTVTBL,LTVPOUT,LTVTOUT,
     &LTVSOUT,LPN21RMOD,LPN21TMOD,LTVRMOD,LTVTMOD,LTVRN2MOD,LTVTN2MOD,
     &LTVRG3,LTVTG3,LSLHRMOD,LSLHTMOD,LSLHKRMOD,LSLHKTMOD,LSPHARRMOD,
     &LSPHARTMOD,LHRRMOD,LHRTMOD,LFQQ,LFQQT,LFQQVMR,LFQQTVMR

      LFQQ=1
      LFQQT=LFQQ+2*MR*MSTATES
      LFQQVMR=LFQQT+2*ML*MSTATES
      LFQQTVMR=LFQQVMR+2*MR*MSTATES
      LIDAY=LFQQTVMR+2*ML*MSTATES
      LINITTV=LIDAY+1
      LLVSED=LINITTV+1
      LLVSEDTV=LLVSED+1
      LLTV=LLVSEDTV+1
      LLMCM=LLTV+1
      LLSHR=LLMCM+1
      LIFLUXAL=LLSHR+1
      LICCM=LIFLUXAL+1
      LISLH=LICCM+1
      LISECANT=LISLH+1
      LNITN=LISECANT+1
      LNITD=LNITN+1
      LNITC=LNITD+1
      LITVOPT=LNITC+1
      LITVOPTN2=LITVOPT+1
      LMG3=LITVOPTN2+1
      LMSSPC=LMG3+1
      LMTBLTV=LMSSPC+1
      LMWRKTV=LMTBLTV+1
      LNLTV=LMWRKTV+1
      LNVTS=LNLTV+1
      LIVTS=LNVTS+1
      LIVTSN=LIVTS+MSTATES
      LIVTSG3=LIVTSN+MSTATES
      LITVID=LIVTSG3+MG3
      LITVIDVMR=LITVID+MSTATES
      LNLMX=LITVIDVMR+MSTATES
      LNLMXVMR=LNLMX+MGB
      LNMXTV=LNLMXVMR+MGB
      LIRADTV=LNMXTV+MSTATES
      LZATV=LIRADTV+MSTATES
      LABDISO=LZATV+ML
      LENGY=LABDISO+MSTATES
      LSZA=LENGY+2*MSTATES
      LCSSPC=LSZA+1
      LWRKTV=LCSSPC+MSSPC
      IF(MOD(LWRKTV,2).EQ.0) LWRKTV=LWRKTV+1
      LTVTBL=LWRKTV+MWRKTV
      IF(MOD(LTVTBL,2).EQ.0) LTVTBL=LTVTBL+1
      LTVPOUT=LTVTBL+MTBLTV
      IF(MOD(LTVPOUT,2).EQ.0) LTVPOUT=LTVPOUT+1
      LTVTOUT=LTVPOUT+MPOUT
      IF(MOD(LTVTOUT,2).EQ.0) LTVTOUT=LTVTOUT+1
      LTVSOUT=LTVTOUT+MTOUT
      IF(MOD(LTVSOUT,2).EQ.0) LTVSOUT=LTVSOUT+1
      LPN21RMOD=LTVSOUT+MSOUT*MSTATES
      LPN21TMOD=LPN21RMOD+MR
      LTVRMOD=LPN21TMOD+ML
      LTVTMOD=LTVRMOD+2*MR*MSTATES
      LTVRN2MOD=LTVTMOD+2*ML*MSTATES
      LTVTN2MOD=LTVRN2MOD+MR
      LTVRG3=LTVTN2MOD+ML
      LTVTG3=LTVRG3+2*MR*MG3
      LSLHRMOD=LTVTG3+2*ML*MG3
      LSLHTMOD=LSLHRMOD+MR*MSTATES
      LSLHKRMOD=LSLHTMOD+ML*MSTATES
      LSLHKTMOD=LSLHKRMOD+MR*MSTATES
      LSPHARRMOD=LSLHKTMOD+ML*MSTATES
      LSPHARTMOD=LSPHARRMOD+MR*MSTATES
      LHRRMOD=LSPHARTMOD+ML*MSTATES
      LHRTMOD=LHRRMOD+MR*MSTATES
      RETURN
      END
