      SUBROUTINE Set_version_hfodd_modules
      !
      USE hfodd_sizes
      !
      CHARACTER NAMMOD*16
      INTEGER   MODUVE,MODSET
      !
      COMMON /VERMOD/ NAMMOD(NDMODU),MODUVE(NDMODU),MODSET(NDMODU)
      !
      NAMMOD(2) = 'hfodd_modules   '
      MODUVE(2) = 69
      MODSET(2) = 2
      !
      END SUBROUTINE Set_version_hfodd_modules
      !
C=======================================================================
      MODULE      MURMIX
      SAVE        OMRMIX,EMRMIX,QMRMIX,AMRMIX,WMRMIX,SMRMIX,
     *            DMRMIX,XMRMIX
      COMPLEX     OMRMIX,EMRMIX,QMRMIX,AMRMIX,WMRMIX,SMRMIX,
     *            DMRMIX,XMRMIX
      ALLOCATABLE OMRMIX(:),EMRMIX(:),QMRMIX(:),
     *            AMRMIX(:),WMRMIX(:),SMRMIX(:),
     *            DMRMIX(:),XMRMIX(:)
      SAVE        NMATMI,LMATMI
      ALLOCATABLE NMATMI(:,:,:,:,:,:),LMATMI(:,:,:,:,:,:,:)
      END MODULE  MURMIX
C=======================================================================
      MODULE      HE_DEN
      SAVE        DE_RHO,DE_TAU,DE_LPR,DE_DIV,
     *            DE_SPI,DE_KIS,DE_GRR,DE_LPS,DE_ROS,DE_ROC,DE_CUR,
     *            DE_KIF,DE_SCU,DE_DES
      COMPLEX     DE_RHO,DE_TAU,DE_LPR,DE_DIV,
     *            DE_SPI,DE_KIS,DE_GRR,DE_LPS,DE_ROS,DE_ROC,DE_CUR,
     *            DE_KIF,DE_SCU,DE_DES
      ALLOCATABLE DE_RHO(:,:,:,:,:),DE_TAU(:,:,:,:,:),
     *            DE_LPR(:,:,:,:,:),DE_DIV(:,:,:,:,:)
      ALLOCATABLE DE_SPI(:,:,:,:,:,:),DE_KIS(:,:,:,:,:,:),
     *            DE_GRR(:,:,:,:,:,:),DE_LPS(:,:,:,:,:,:),
     *            DE_ROS(:,:,:,:,:,:),DE_ROC(:,:,:,:,:,:),
     *            DE_CUR(:,:,:,:,:,:),DE_KIF(:,:,:,:,:,:)
      ALLOCATABLE DE_SCU(:,:,:,:,:,:,:),DE_DES(:,:,:,:,:,:,:)
      END MODULE  HE_DEN
C=======================================================================
      MODULE      TRUDEN
      SAVE        REVRHO,REVTAU,REVLPR,REVDIV,
     *            REVKIS,REVGRR,REVLPS,REVROS,REVROC,REVCUR,
     *            REVKIF,REVSCU,REVDES,REVSPI
      COMPLEX     REVRHO,REVTAU,REVLPR,REVDIV,
     *            REVKIS,REVGRR,REVLPS,REVROS,REVROC,REVCUR,
     *            REVKIF,REVSCU,REVDES,REVSPI
      ALLOCATABLE REVRHO(:,:,:,:),REVTAU(:,:,:,:),
     *            REVLPR(:,:,:,:),REVDIV(:,:,:,:)
      ALLOCATABLE REVKIS(:,:,:,:,:),REVSPI(:,:,:,:,:),
     *            REVGRR(:,:,:,:,:),REVLPS(:,:,:,:,:),
     *            REVROS(:,:,:,:,:),REVROC(:,:,:,:,:),
     *            REVCUR(:,:,:,:,:),REVKIF(:,:,:,:,:)
      ALLOCATABLE REVSCU(:,:,:,:,:,:),REVDES(:,:,:,:,:,:)
      END MODULE  TRUDEN
C=======================================================================
      MODULE      TRUINT
      SAVE        DDTRHO,DDTSPI,PDTRHO
      COMPLEX     DDTRHO,DDTSPI,PDTRHO
      ALLOCATABLE DDTRHO(:,:,:,:,:)
      ALLOCATABLE DDTSPI(:,:,:,:,:,:)
      ALLOCATABLE PDTRHO(:,:,:,:,:)
      END MODULE  TRUINT
C=======================================================================
      MODULE      HETDEN
      SAVE        DE_DIJ,DE_DIS
      COMPLEX     DE_DIJ,DE_DIS
      ALLOCATABLE DE_DIJ(:,:,:,:,:)
      ALLOCATABLE DE_DIS(:,:,:,:,:,:)
      END MODULE  HETDEN
C=======================================================================
      MODULE      PD_DEN
      SAVE        PD_RHO,PD_TAU,PD_LPR,PD_GRR,PD_SCU
      COMPLEX     PD_RHO,PD_TAU,PD_LPR,PD_GRR,PD_SCU
      ALLOCATABLE PD_RHO(:,:,:,:,:),
     *            PD_TAU(:,:,:,:,:),
     *            PD_LPR(:,:,:,:,:)
      ALLOCATABLE PD_GRR(:,:,:,:,:,:)
      ALLOCATABLE PD_SCU(:,:,:,:,:,:,:)
      END MODULE  PD_DEN
C=======================================================================
      MODULE      PP_DEN
      SAVE        PP_RHO,PP_TAU,PP_LPR,PP_GRR,PP_SCU
      COMPLEX     PP_RHO,PP_TAU,PP_LPR,PP_GRR,PP_SCU
      ALLOCATABLE PP_RHO(:,:,:,:,:),
     *            PP_TAU(:,:,:,:,:),
     *            PP_LPR(:,:,:,:,:)
      ALLOCATABLE PP_GRR(:,:,:,:,:,:)
      ALLOCATABLE PP_SCU(:,:,:,:,:,:,:)
      END MODULE  PP_DEN
C=======================================================================
      MODULE      PDTDEN
      SAVE        PD_DIS,PP_DIS
      COMPLEX     PD_DIS,PP_DIS
      ALLOCATABLE PD_DIS(:,:,:,:,:,:),PP_DIS(:,:,:,:,:,:)
      END MODULE  PDTDEN
C=======================================================================
      MODULE      VE_FLD
      SAVE        VE_MAS,VE_CEN,VE_SPT,VE_KIS,VE_SPI,VE_CUR,VE_KIT,
     *            VE_SOR
      COMPLEX     VE_MAS,VE_CEN,VE_SPT,VE_KIS,VE_SPI,VE_CUR,VE_KIT,
     *            VE_SOR
      ALLOCATABLE VE_MAS(:,:,:,:,:),VE_CEN(:,:,:,:,:),VE_SPT(:,:,:,:,:),
     *            VE_KIS(:,:,:,:,:,:),VE_SPI(:,:,:,:,:,:),
     *            VE_CUR(:,:,:,:,:,:),VE_KIT(:,:,:,:,:,:),
     *            VE_SOR(:,:,:,:,:,:,:)
      END MODULE  VE_FLD
C=======================================================================
      MODULE      WD_FLD
      SAVE        WD_CEN,WD_TAU,WD_SOR
      COMPLEX     WD_CEN,WD_TAU,WD_SOR
      ALLOCATABLE WD_CEN(:,:,:,:,:),WD_TAU(:,:,:,:,:),
     *            WD_SOR(:,:,:,:,:,:,:)
      END MODULE  WD_FLD
C=======================================================================
      MODULE      BROYIN
      SAVE        BRO_IN
      ALLOCATABLE BRO_IN(:)
      END MODULE  BROYIN
C=======================================================================
      MODULE      BROYOU
      SAVE        BRO_OU
      ALLOCATABLE BRO_OU(:)
      END MODULE  BROYOU
C=======================================================================
      MODULE      BROYIN_NEUTRON
      SAVE        BRONIN
      ALLOCATABLE BRONIN(:)
      END MODULE  BROYIN_NEUTRON
      MODULE      BROYOU_NEUTRON
      SAVE        BRONOU
      ALLOCATABLE BRONOU(:)
      END MODULE  BROYOU_NEUTRON
C=======================================================================
      MODULE      BROYIN_PROTON
      SAVE        BROPIN
      ALLOCATABLE BROPIN(:)
      END MODULE  BROYIN_PROTON
      MODULE      BROYOU_PROTON
      SAVE        BROPOU
      ALLOCATABLE BROPOU(:)
      END MODULE  BROYOU_PROTON
C=======================================================================
      MODULE      MAT_PP
      SAVE        BIG_PP
      COMPLEX     BIG_PP
      ALLOCATABLE BIG_PP(:,:,:)
      END MODULE  MAT_PP
C=======================================================================
      MODULE      MAT_PM
      SAVE        BIG_PM
      COMPLEX     BIG_PM
      ALLOCATABLE BIG_PM(:,:,:)
      END MODULE  MAT_PM
C=======================================================================
      MODULE      MAR_PP
      SAVE        RHO_PP
      COMPLEX     RHO_PP
      ALLOCATABLE RHO_PP(:,:,:)
      END MODULE  MAR_PP
C=======================================================================
      MODULE      MAR_PM
      SAVE        RHO_PM
      COMPLEX     RHO_PM
      ALLOCATABLE RHO_PM(:,:,:)
      END MODULE  MAR_PM
C=======================================================================
      MODULE      KAP_PP
      SAVE        PAI_PP
      COMPLEX     PAI_PP
      ALLOCATABLE PAI_PP(:,:,:)
      END MODULE  KAP_PP
C=======================================================================
      MODULE      KAP_PM
      SAVE        PAI_PM
      COMPLEX     PAI_PM
      ALLOCATABLE PAI_PM(:,:,:)
      END MODULE  KAP_PM
C=======================================================================
      MODULE      KAP2PP
      SAVE        PAI2PP
      COMPLEX     PAI2PP
      ALLOCATABLE PAI2PP(:,:,:)
      END MODULE  KAP2PP
C=======================================================================
      MODULE      KAP2PM
      SAVE        PAI2PM
      COMPLEX     PAI2PM
      ALLOCATABLE PAI2PM(:,:,:)
      END MODULE  KAP2PM
C=======================================================================
      MODULE      MAD_PP
      SAVE        DEN_PP
      COMPLEX     DEN_PP
      ALLOCATABLE DEN_PP(:,:,:,:)
      END MODULE  MAD_PP
C=======================================================================
      MODULE      MAD_PM
      SAVE        DEN_PM
      COMPLEX     DEN_PM
      ALLOCATABLE DEN_PM(:,:,:,:)
      END MODULE  MAD_PM
C=======================================================================
      MODULE      MLI_PP
      SAVE        DLI_PP
      COMPLEX     DLI_PP
      ALLOCATABLE DLI_PP(:,:,:,:)
      END MODULE  MLI_PP
C=======================================================================
      MODULE      MLI_PM
      SAVE        DLI_PM
      COMPLEX     DLI_PM
      ALLOCATABLE DLI_PM(:,:,:,:)
      END MODULE  MLI_PM
C=======================================================================
      MODULE      OVM_PP
      SAVE        OVMAPP
      COMPLEX     OVMAPP
      ALLOCATABLE OVMAPP(:,:,:)
      END MODULE  OVM_PP
C=======================================================================
      MODULE      BIGOVE
      SAVE        BIGNOR
      COMPLEX     BIGNOR
      ALLOCATABLE BIGNOR(:,:)
      END MODULE  BIGOVE
C=======================================================================
      MODULE      BIGFRA
      SAVE        FRAMAT
      COMPLEX     FRAMAT
      ALLOCATABLE FRAMAT(:,:)
      END MODULE  BIGFRA
C=======================================================================
      MODULE      BIGHAM
      SAVE        COMHAM
      COMPLEX     COMHAM
      ALLOCATABLE COMHAM(:,:)
      END MODULE  BIGHAM
C=======================================================================
      MODULE      BIGDEN
      SAVE        BIGTWC
      COMPLEX     BIGTWC
      ALLOCATABLE BIGTWC(:,:)
      END MODULE  BIGDEN
C=======================================================================
      MODULE      TWCOBO
      SAVE        BIGOBO
      COMPLEX     BIGOBO
      ALLOCATABLE BIGOBO(:,:)
      END MODULE  TWCOBO
C=======================================================================
      MODULE      BIGOPP
      SAVE        TWCOPP
      COMPLEX     TWCOPP
      ALLOCATABLE TWCOPP(:,:,:)
      END MODULE  BIGOPP
C=======================================================================
      MODULE      BIGOPM
      SAVE        TWCOPM
      COMPLEX     TWCOPM
      ALLOCATABLE TWCOPM(:,:,:)
      END MODULE  BIGOPM
C=======================================================================
      MODULE      OVM_PM
      SAVE        OVMAPM
      COMPLEX     OVMAPM
      ALLOCATABLE OVMAPM(:,:,:)
      END MODULE  OVM_PM
C=======================================================================
      MODULE      OVMSIM
      SAVE        OVERME
      COMPLEX     OVERME
      ALLOCATABLE OVERME(:,:)
      END MODULE  OVMSIM
C=======================================================================
      MODULE      NOREIG
      SAVE        EWTNOR,EWTAUX
      COMPLEX     EWTNOR,EWTAUX
      ALLOCATABLE EWTNOR(:,:),EWTAUX(:,:)
      END MODULE  NOREIG
C=======================================================================
      MODULE      MAP_PP
      SAVE        CHI_PP
      COMPLEX     CHI_PP
      ALLOCATABLE CHI_PP(:,:,:,:)
      END MODULE  MAP_PP
C=======================================================================
      MODULE      MAP_PM
      SAVE        CHI_PM
      COMPLEX     CHI_PM
      ALLOCATABLE CHI_PM(:,:,:,:)
      END MODULE  MAP_PM
C=======================================================================
      MODULE      MAF_PP
      SAVE        FIL_PP
      COMPLEX     FIL_PP
      ALLOCATABLE FIL_PP(:,:,:,:)
      END MODULE  MAF_PP
C=======================================================================
      MODULE      MAF_PM
      SAVE        FIL_PM
      COMPLEX     FIL_PM
      ALLOCATABLE FIL_PM(:,:,:,:)
      END MODULE  MAF_PM
C=======================================================================
      MODULE      MAPIDE
      SAVE        FIPIDE
      SAVE        FIP2DE
      COMPLEX     FIPIDE
      COMPLEX     FIP2DE
      ALLOCATABLE FIPIDE(:,:,:,:)
      ALLOCATABLE FIP2DE(:,:,:,:)
      END MODULE  MAPIDE
C=======================================================================
      MODULE      MAFTWC
      SAVE        FITWPP,FITWPM,FITWDE
      COMPLEX     FITWPP,FITWPM,FITWDE
      ALLOCATABLE FITWPP(:,:,:,:,:),FITWPM(:,:,:,:,:),FITWDE(:,:,:,:,:)
      END MODULE  MAFTWC
C=======================================================================
      MODULE      HCOULO
      SAVE        HPPCOU
      SAVE        HPMCOU
      COMPLEX     HPPCOU
      COMPLEX     HPMCOU
      ALLOCATABLE HPPCOU(:,:)
      ALLOCATABLE HPMCOU(:,:)
      END MODULE  HCOULO
C=======================================================================
      MODULE      HYUKAW
      SAVE        HPPYUK
      SAVE        HPMYUK
      COMPLEX     HPPYUK
      COMPLEX     HPMYUK
      ALLOCATABLE HPPYUK(:,:,:)
      ALLOCATABLE HPMYUK(:,:,:)
      END MODULE  HYUKAW
C=======================================================================
      MODULE      PAIDEL
      SAVE        HAMIDE
      SAVE        HAM2DE
      COMPLEX     HAMIDE
      COMPLEX     HAM2DE
      ALLOCATABLE HAMIDE(:,:,:)
      ALLOCATABLE HAM2DE(:,:,:)
      END MODULE  PAIDEL
C=======================================================================
      MODULE      SPINOR
      SAVE        WSWAVE
      COMPLEX     WSWAVE
      ALLOCATABLE WSWAVE(:,:,:)
      END MODULE  SPINOR
C=======================================================================
      MODULE      WAVSQU
      SAVE        SQUWAV
      ALLOCATABLE SQUWAV(:,:,:,:)
      END MODULE  WAVSQU
C=======================================================================
      MODULE      WAVR_L
      SAVE        WARIGH
      SAVE        WALEFT
      COMPLEX     WARIGH
      COMPLEX     WALEFT
      ALLOCATABLE WARIGH(:,:,:)
      ALLOCATABLE WALEFT(:,:,:)
      END MODULE  WAVR_L
C=======================================================================
      MODULE      SAVRIG
      SAVE        SARIGH
      COMPLEX     SARIGH
      ALLOCATABLE SARIGH(:,:,:,:,:)
      END MODULE  SAVRIG
C=======================================================================
      MODULE      SAVLEF
      SAVE        SALEFT
      COMPLEX     SALEFT
      ALLOCATABLE SALEFT(:,:,:,:)
      END MODULE  SAVLEF
C=======================================================================
      MODULE      ALLWAV
      SAVE        WAVOCC,SAVOCC
      COMPLEX     WAVOCC,SAVOCC
      ALLOCATABLE WAVOCC(:,:,:),SAVOCC(:,:,:,:)
      END MODULE  ALLWAV
C=======================================================================
      MODULE      CANBAS
c     Canonical wave functions and u- and v- amplitudes
c     WAVCAN(IBASE, ISTATE, IREVER, ICHARG)
c     V_CAN (       ISTATE, IREVER, ICHARG)
c     U_CAN (       ISTATE, IREVER, ICHARG)
c     Where IBASE  = index of basis state
c     ISTATE = index of can.  state
c           IREVER = index of time-reversal block
c           ICHARG = index of charge (n/p) block
      COMPLEX, SAVE, ALLOCATABLE :: WAVCAN(:,:,:,:)
      REAL,    SAVE, ALLOCATABLE :: V_CAN(:,:,:), U_CAN(:,:,:)
      END MODULE  CANBAS
C=======================================================================
      MODULE      PNMWAV
      SAVE        PNMOCC
      COMPLEX     PNMOCC
      ALLOCATABLE PNMOCC(:,:,:)
      END MODULE  PNMWAV
C=======================================================================
      MODULE      TWCWAV
      SAVE        TWCOCC
      COMPLEX     TWCOCC
      ALLOCATABLE TWCOCC(:,:,:,:)
      END MODULE  TWCWAV
C=======================================================================
      MODULE      ALLSIG
      SAVE        EWASIG,SPESVG,LDMEFG
      INTEGER     LDMEFG
      COMPLEX     EWASIG,SPESVG
      ALLOCATABLE EWASIG(:,:,:,:),SPESVG(:,:,:),LDMEFG(:,:)
      END MODULE  ALLSIG
C=======================================================================
      MODULE      ALLSIM
      SAVE        EWASIM,SPESVM,LDMEFM
      INTEGER     LDMEFM
      COMPLEX     EWASIM,SPESVM
      ALLOCATABLE EWASIM(:,:,:),SPESVM(:,:),LDMEFM(:)
      END MODULE  ALLSIM
C=======================================================================
      MODULE      ALLSIQ
      SAVE        EWASIQ,SPESVQ,LDMEFQ
      INTEGER     LDMEFQ
      COMPLEX     EWASIQ,SPESVQ
      ALLOCATABLE EWASIQ(:,:,:),SPESVQ(:,:),LDMEFQ(:)
      END MODULE  ALLSIQ
C=======================================================================
      MODULE      ALLSIZ
      SAVE        EWASIZ
      COMPLEX     EWASIZ
      ALLOCATABLE EWASIZ(:,:)
      END MODULE  ALLSIZ
C=======================================================================
      MODULE      ALLMIZ
      SAVE        EWAMIZ
      COMPLEX     EWAMIZ
      ALLOCATABLE EWAMIZ(:,:)
      END MODULE  ALLMIZ
C=======================================================================
      MODULE      SAVQUA
      SAVE        ASVQUA         ,BSVQUA
      COMPLEX     ASVQUA         ,BSVQUA
      ALLOCATABLE ASVQUA(:,:,:,:),BSVQUA(:,:,:,:)
      END MODULE  SAVQUA
C=======================================================================
      MODULE      ALLQUA
      SAVE        AWAQUA       ,BWAQUA
      COMPLEX     AWAQUA       ,BWAQUA
      ALLOCATABLE AWAQUA(:,:,:),BWAQUA(:,:,:)
      END MODULE  ALLQUA
C=======================================================================
      MODULE      ALLQUZ
      SAVE        AWAQUZ       ,BWAQUZ
      COMPLEX     AWAQUZ       ,BWAQUZ
      ALLOCATABLE AWAQUZ(:,:,:),BWAQUZ(:,:,:)
      END MODULE  ALLQUZ
C=======================================================================
      MODULE      TWCQUZ
      SAVE        AWATWC       ,BWATWC
      COMPLEX     AWATWC       ,BWATWC
      ALLOCATABLE AWATWC(:,:,:),BWATWC(:,:,:)
      END MODULE  TWCQUZ
C=======================================================================
      MODULE      BLOSAV
      SAVE        IPRODD, LPRODR, LPRODL, BLOLAB, LDBLOL
     *            WLABBR, WLABAR, WLABBL, WLABAL
      TYPE        BLAB
      INTEGER     N,IR
      END TYPE
      INTEGER     IPRODD, LPRODR, LPRODL, LDBLOL
      ALLOCATABLE LPRODR(:),LPRODL(:),LDBLOL(:)
      TYPE(BLAB)  BLOLAB
      ALLOCATABLE BLOLAB(:,:)
      INTEGER     WLABBR, WLABAR, WLABBL, WLABAL
      ALLOCATABLE WLABBR(:,:),WLABAR(:,:),WLABBL(:,:),WLABAL(:,:)
      END MODULE  BLOSAV
C=======================================================================
      MODULE      REDMOM
      SAVE        REDQ_P   ,REDM_P     ,REDA_T     ,REDS_P   ,INDRED
      COMPLEX     REDQ_P   ,REDM_P     ,REDA_T     ,REDS_P
      ALLOCATABLE REDQ_P(:),REDM_P(:,:),REDA_T(:,:),REDS_P(:),
     *            INDRED(:,:,:)
      END MODULE  REDMOM
C=======================================================================
      MODULE      REEMOM
      SAVE        REEQ_P   ,REEM_P     ,REEA_T     ,REES_P   ,INDREE
      COMPLEX     REEQ_P   ,REEM_P     ,REEA_T     ,REES_P
      ALLOCATABLE REEQ_P(:),REEM_P(:,:),REEA_T(:,:),REES_P(:),
     *            INDREE(:,:,:)
      END MODULE  REEMOM
C=======================================================================
      MODULE      COUMOM
      SAVE        COUD_P,COUX_P,CEED_P,CEEX_P
      COMPLEX     COUD_P,COUX_P,CEED_P,CEEX_P
      ALLOCATABLE COUD_P(:),COUX_P(:),CEED_P(:),CEEX_P(:)
      END MODULE  COUMOM
C=======================================================================
      MODULE      GAUSTO
      SAVE        GAUFIL
      COMPLEX     GAUFIL
      ALLOCATABLE GAUFIL(:,:,:,:,:)
      SAVE        GAUAVR
      COMPLEX     GAUAVR
      ALLOCATABLE GAUAVR(:,:,:,:,:)
      END MODULE  GAUSTO
C=======================================================================
      MODULE      TBCSTO
      SAVE        TINAVR
      COMPLEX     TINAVR
      ALLOCATABLE TINAVR(:,:,:,:,:,:)
      SAVE        TSAAVR
      COMPLEX     TSAAVR
      ALLOCATABLE TSAAVR(:,:,:,:,:,:,:,:)
      END MODULE  TBCSTO
C=======================================================================
      MODULE      GAUNEW
      SAVE        GENGA0
      COMPLEX     GENGA0
      ALLOCATABLE GENGA0(:,:,:,:,:,:)
      END MODULE  GAUNEW
C=======================================================================
      MODULE      YUKSTO
      SAVE        YUKASV
      COMPLEX     YUKASV
      ALLOCATABLE YUKASV(:,:,:,:)
      END MODULE  YUKSTO
C=======================================================================
      MODULE      GOGSTO
      SAVE        GOGASV
      COMPLEX     GOGASV
      ALLOCATABLE GOGASV(:,:,:,:)
      END MODULE  GOGSTO
C=======================================================================
      MODULE      GOGKAP
      SAVE        GOGCHI
      COMPLEX     GOGCHI
      ALLOCATABLE GOGCHI(:,:,:,:)
      END MODULE  GOGKAP
C=======================================================================
      MODULE      REGSTO
      SAVE        REGASV
      COMPLEX     REGASV
      ALLOCATABLE REGASV(:,:,:,:)
      END MODULE  REGSTO
C=======================================================================
      MODULE      RPASTO
      SAVE        REGPSV
      COMPLEX     REGPSV
      ALLOCATABLE REGPSV(:,:,:,:)
      END MODULE  RPASTO
C=======================================================================
      MODULE      SEPSTO
      SAVE        SEPASV
      COMPLEX     SEPASV
      ALLOCATABLE SEPASV(:,:,:,:)
      END MODULE  SEPSTO
C=======================================================================
      MODULE      SPASTO
      SAVE        SEPPSV
      COMPLEX     SEPPSV
      ALLOCATABLE SEPPSV(:,:,:,:)
      END MODULE  SPASTO
C=======================================================================
      MODULE      FSTSTO
      SAVE        FSTASV
      COMPLEX     FSTASV
      ALLOCATABLE FSTASV(:,:,:,:)
      END MODULE  FSTSTO
C=======================================================================
      MODULE      FPASTO
      SAVE        FSTPSV
      COMPLEX     FSTPSV
      ALLOCATABLE FSTPSV(:,:,:,:)
      END MODULE  FPASTO
C=======================================================================
      MODULE      ALISTO
      SAVE        ALINPP
      SAVE        ALINPM
      COMPLEX     ALINPP
      COMPLEX     ALINPM
      ALLOCATABLE ALINPP(:,:,:,:,:)
      ALLOCATABLE ALINPM(:,:,:,:,:)
      END MODULE  ALISTO
C=======================================================================
      MODULE      PLISTO
      SAVE        PLINPP
      SAVE        PLINPM
      COMPLEX     PLINPP
      COMPLEX     PLINPM
      ALLOCATABLE PLINPP(:,:,:,:,:)
      ALLOCATABLE PLINPM(:,:,:,:,:)
      END MODULE  PLISTO
C=======================================================================
      MODULE      AROSTO
      SAVE        AROTPP
      SAVE        AROTPM
      COMPLEX     AROTPP
      COMPLEX     AROTPM
      ALLOCATABLE AROTPP(:,:,:,:,:)
      ALLOCATABLE AROTPM(:,:,:,:,:)
      END MODULE  AROSTO
C=======================================================================
      MODULE      PROSTO
      SAVE        PROTPP
      SAVE        PROTPM
      COMPLEX     PROTPP
      COMPLEX     PROTPM
      ALLOCATABLE PROTPP(:,:,:,:,:)
      ALLOCATABLE PROTPM(:,:,:,:,:)
      END MODULE  PROSTO
C=======================================================================
      MODULE      COUSTO
      SAVE        COULSV
      COMPLEX     COULSV
      ALLOCATABLE COULSV(:,:,:,:)
      END MODULE  COUSTO
C=======================================================================
      MODULE      CPASTO
      SAVE        COUPSV
      COMPLEX     COUPSV
      ALLOCATABLE COUPSV(:,:,:)
      END MODULE  CPASTO
C=======================================================================
      MODULE      CYLTRA
      SAVE        AUXCYL
      COMPLEX     AUXCYL
      ALLOCATABLE AUXCYL(:,:)
      END MODULE  CYLTRA
C=======================================================================
      MODULE      PNMXPP
      SAVE        PNM_PP
      COMPLEX     PNM_PP
      ALLOCATABLE PNM_PP(:,:,:)
      END MODULE  PNMXPP
C=======================================================================
      MODULE      PNMXPM
      SAVE        PNM_PM
      COMPLEX     PNM_PM
      ALLOCATABLE PNM_PM(:,:,:)
      END MODULE  PNMXPM
C=======================================================================
      MODULE      TWCEPP
      SAVE        TWC_PP
      COMPLEX     TWC_PP
      ALLOCATABLE TWC_PP(:,:,:,:)
      END MODULE  TWCEPP
C=======================================================================
      MODULE      TWCEPM
      SAVE        TWC_PM
      COMPLEX     TWC_PM
      ALLOCATABLE TWC_PM(:,:,:,:)
      END MODULE  TWCEPM
C=======================================================================
      MODULE      TWCDEL
      SAVE        TWDEPP,TWDEPM
      COMPLEX     TWDEPP,TWDEPM
      ALLOCATABLE TWDEPP(:,:,:,:),TWDEPM(:,:,:,:)
      END MODULE  TWCDEL
C=======================================================================
      MODULE      DNMXPP
      SAVE        DNM_PP
      COMPLEX     DNM_PP
      ALLOCATABLE DNM_PP(:,:,:)
      END MODULE  DNMXPP
C=======================================================================
      MODULE      DNMXPM
      SAVE        DNM_PM
      COMPLEX     DNM_PM
      ALLOCATABLE DNM_PM(:,:,:)
      END MODULE  DNMXPM
C=======================================================================
      MODULE      FRAGFL
      SAVE        F_FLAG
      ALLOCATABLE F_FLAG(:,:,:)
      END MODULE  FRAGFL
C=======================================================================
      MODULE      RFACTO
#if(SWITCH_QUAD==1)
      REAL*16
     *            FACTOR,    FACTOE,    FACTOO
#endif
      SAVE        FACTOR,    FACTOE,    FACTOO
      ALLOCATABLE FACTOR(:), FACTOE(:), FACTOO(:)
      END MODULE  RFACTO
C=======================================================================
C=======================================================================
C=======================================================================
C      MODULE      CANWFV    !SIMIMAR AS CANBAS: REMOVE IT in lipnp_2
C     Canonical wave functions and u- and v- amplitudes
C     WAVCAN(IBASE, ISTATE, IREVER, ICHARG)
C     V_CAN (       ISTATE, ICHARG)
C     U_CAN (       ISTATE, ICHARG)
C     Where IBASE  = index of basis state
C           ISTATE = index of can.  state
C           IREVER = index of time-reversal block
C           ICHARG = index of charge (n/p) block
C      SAVE        WAVCAN,          V_CAN,        U_CAN
C      COMPLEX     WAVCAN
C      REAL                         V_CAN,        U_CAN
C      ALLOCATABLE WAVCAN(:,:,:,:), V_CAN(:,:), U_CAN(:,:)
C      END MODULE  CANWFV
C=======================================================================
C=======================================================================
      MODULE      MAD2PP
      SAVE        DEN2PP
      COMPLEX     DEN2PP
      ALLOCATABLE DEN2PP(:,:,:,:)
      END MODULE  MAD2PP
C=======================================================================
C=======================================================================
      MODULE      MAD3PP
      SAVE        DEN3PP
      COMPLEX     DEN3PP
      ALLOCATABLE DEN3PP(:,:,:,:)
      END MODULE  MAD3PP
C=======================================================================
C=======================================================================
      MODULE      MAD4PP
      SAVE        DEN4PP
      COMPLEX     DEN4PP
      ALLOCATABLE DEN4PP(:,:,:,:)
      END MODULE  MAD4PP
C=======================================================================
C=======================================================================
      MODULE      MAD5PP
      SAVE        DEN5PP
      COMPLEX     DEN5PP
      ALLOCATABLE DEN5PP(:,:,:,:)
      END MODULE  MAD5PP
C=======================================================================
      MODULE      DENCON
      SAVE        DCONTI
      COMPLEX     DCONTI
      ALLOCATABLE DCONTI(:,:,:)
      END MODULE  DENCON
C=======================================================================
      MODULE      TXXX_Y
      SAVE
C TER*          ZTER_T,
     *          ZKER_T,ZSKY_T,ZKIN_N,ZKIN_P,ZCOU_D,ZCOU_X,ZPAI_N,ZPAI_P,
     *                               ZPNU00,ZPNU10,ZPNU1P,ZPNU1M,
     *                               ZTZISO,ZT2ISO,ZBZROT,ZB2ROT,
     *                               ZC10_D,ZC1P_D,ZC1M_D,
     *                               ZC10_X,ZC1P_X,ZC1M_X,
     *                               ZC20_D,ZC21PD,ZC21MD,ZC22PD,ZC22MD,
     *                               ZC20_X,ZC21PX,ZC21MX,ZC22PX,ZC22MX,
C TER*          TTER_T,
     *          TKER_T,TSKY_T,TKIN_N,TKIN_P,TCOU_D,TCOU_X,TPAI_N,TPAI_P,
     *                               TPNU00,TPNU10,TPNU1P,TPNU1M,
     *                               TTZISO,TT2ISO,TBZROT,TB2ROT,
     *                               TC10_D,TC1P_D,TC1M_D,
     *                               TC10_X,TC1P_X,TC1M_X,
     *                               TC20_D,TC21PD,TC21MD,TC22PD,TC22MD,
     *                               TC20_X,TC21PX,TC21MX,TC22PX,TC22MX,
C TER*          TTE_TT,
     *          TKE_TT,TSK_TT,TKI_NT,TKI_PT,TCO_DT,TCO_XT,TPA_NT,TPA_PT,
     *                               TPN_00,TPN_10,TPN_1P,TPN_1M,
     *                               TTZ_IS,TT2_IS,TBZ_RO,TB2_RO,
     *                               TC1_D0,TC1_DP,TC1_DM,
     *                               TC1_X0,TC1_XP,TC1_XM,
     *                               TC2_D0,TC21DP,TC21DM,TC22DP,TC22DM,
     *                               TC2_X0,TC21XP,TC21XM,TC22XP,TC22XM
      COMPLEX
C TER*          ZTER_T,
     *          ZKER_T,ZSKY_T,ZKIN_N,ZKIN_P,ZCOU_D,ZCOU_X,ZPAI_N,ZPAI_P,
     *                               ZPNU00,ZPNU10,ZPNU1P,ZPNU1M,
     *                               ZTZISO,ZT2ISO,ZBZROT,ZB2ROT,
     *                               ZC10_D,ZC1P_D,ZC1M_D,
     *                               ZC10_X,ZC1P_X,ZC1M_X,
     *                               ZC20_D,ZC21PD,ZC21MD,ZC22PD,ZC22MD,
     *                               ZC20_X,ZC21PX,ZC21MX,ZC22PX,ZC22MX,
C TER*          TTER_T,
     *          TKER_T,TSKY_T,TKIN_N,TKIN_P,TCOU_D,TCOU_X,TPAI_N,TPAI_P,
     *                               TPNU00,TPNU10,TPNU1P,TPNU1M,
     *                               TTZISO,TT2ISO,TBZROT,TB2ROT,
     *                               TC10_D,TC1P_D,TC1M_D,
     *                               TC10_X,TC1P_X,TC1M_X,
     *                               TC20_D,TC21PD,TC21MD,TC22PD,TC22MD,
     *                               TC20_X,TC21PX,TC21MX,TC22PX,TC22MX,
C TER*          TTE_TT,
     *          TKE_TT,TSK_TT,TKI_NT,TKI_PT,TCO_DT,TCO_XT,TPA_NT,TPA_PT,
     *                               TPN_00,TPN_10,TPN_1P,TPN_1M,
     *                               TTZ_IS,TT2_IS,TBZ_RO,TB2_RO,
     *                               TC1_D0,TC1_DP,TC1_DM,
     *                               TC1_X0,TC1_XP,TC1_XM,
     *                               TC2_D0,TC21DP,TC21DM,TC22DP,TC22DM,
     *                               TC2_X0,TC21XP,TC21XM,TC22XP,TC22XM
      ALLOCATABLE
C TER*          TTER_T(:,:),TTE_TT(:,:,:),ZTER_T(:,:,:,:),
     *          TKER_T(:),TKE_TT(:,:),ZKER_T(:,:,:),
     *          TSKY_T(:),TSK_TT(:,:),ZSKY_T(:,:,:),
     *          TKIN_N(:),TKI_NT(:,:),ZKIN_N(:,:,:),
     *          TKIN_P(:),TKI_PT(:,:),ZKIN_P(:,:,:),
     *          TCOU_D(:),TCO_DT(:,:),ZCOU_D(:,:,:),
     *          TCOU_X(:),TCO_XT(:,:),ZCOU_X(:,:,:),
     *          TPAI_N(:),TPA_NT(:,:),ZPAI_N(:,:,:),
     *          TPAI_P(:),TPA_PT(:,:),ZPAI_P(:,:,:),
     *          TPNU00(:),TPN_00(:,:),ZPNU00(:,:,:),
     *          TPNU10(:),TPN_10(:,:),ZPNU10(:,:,:),
     *          TPNU1P(:),TPN_1P(:,:),ZPNU1P(:,:,:),
     *          TPNU1M(:),TPN_1M(:,:),ZPNU1M(:,:,:),
     *          TTZISO(:),TTZ_IS(:,:),ZTZISO(:,:,:),
     *          TT2ISO(:),TT2_IS(:,:),ZT2ISO(:,:,:),
     *          TBZROT(:),TBZ_RO(:,:),ZBZROT(:,:,:),
     *          TB2ROT(:),TB2_RO(:,:),ZB2ROT(:,:,:),
     *          TC10_D(:),TC1_D0(:,:),ZC10_D(:,:,:),
     *          TC1P_D(:),TC1_DP(:,:),ZC1P_D(:,:,:),
     *          TC1M_D(:),TC1_DM(:,:),ZC1M_D(:,:,:),
     *          TC20_D(:),TC2_D0(:,:),ZC20_D(:,:,:),
     *          TC21PD(:),TC21DP(:,:),ZC21PD(:,:,:),
     *          TC21MD(:),TC21DM(:,:),ZC21MD(:,:,:),
     *          TC22PD(:),TC22DP(:,:),ZC22PD(:,:,:),
     *          TC22MD(:),TC22DM(:,:),ZC22MD(:,:,:),
     *          TC10_X(:),TC1_X0(:,:),ZC10_X(:,:,:),
     *          TC1P_X(:),TC1_XP(:,:),ZC1P_X(:,:,:),
     *          TC1M_X(:),TC1_XM(:,:),ZC1M_X(:,:,:),
     *          TC20_X(:),TC2_X0(:,:),ZC20_X(:,:,:),
     *          TC21PX(:),TC21XP(:,:),ZC21PX(:,:,:),
     *          TC21MX(:),TC21XM(:,:),ZC21MX(:,:,:),
     *          TC22PX(:),TC22XP(:,:),ZC22PX(:,:,:),
     *          TC22MX(:),TC22XM(:,:),ZC22MX(:,:,:)
C
      END MODULE  TXXX_Y
C=======================================================================
      MODULE      HAMMIX
      SAVE
     *            CELMTS,OVEWAV,HAMWAV,HAMMAT,
     *            WAVPRO,WAVLEF,WAV_3D,
     *            OVEPRO,ENEPRO,ENE_3D
      COMPLEX
     *            CELMTS,OVEWAV,HAMWAV,HAMMAT,
     *            WAVPRO,WAVLEF,WAV_3D
      ALLOCATABLE
     *            CELMTS(:),
     *            OVEWAV(:,:),
     *            HAMWAV(:,:),
     *            HAMMAT(:,:),
     *            OVEPRO(:,:,:),
     *            WAVPRO(:,:,:),
     *            WAVLEF(:,:,:),
     *            WAV_3D(:,:,:),
     *            ENEPRO(:,:,:),
     *            ENE_3D(:,:,:)
C
      END MODULE  HAMMIX
C=======================================================================
        module colcoord
        use hfodd_sizes

!       nccmult - "mass parameters" are limited to multipolarity 2,3,4
!       nccall - max number of components, for real multipoles nccall=12
!
        integer, parameter :: nccmult=4, nccall=12

!       added for hf320a, max order of rpa energy moments
        integer, parameter :: ndemom=3

!        icolcoor - array of multipoles used for calculation of Bkj's,
!        read from input
!        numcoor - number of the multipoles
        integer, dimension (1:nccall,1:2) ::  icolcoor
        integer :: numcoor

!        switches, for value=1 mass parameters/ moments of inertia
!        calculations are done
        integer :: imaspar, imominer

!        amominer - moments of inertia (n+p)
!        aparmbg - mass parameters for quadrupole case
!      (beta, gamma variables)
!           calculated if condquad=.true.
!       ggr - collective gyrmagnetic coefficients
        real, dimension (1:3), save ::  amominer, aparmbg, ggr

!       condquad - TRUE if we have quadrupole case (plus some
!           extra requirements)
        logical, save :: condquad

!       amasmat - auxiliary arrays needed for calclations of Bkj
        real, dimension (1:nccall,1:nccall,1:ndemom,0:NDISOS),
     &  save :: amasmat

!       arbkj - Bkj quantities (in a sense mass parameters in
!     the cranking approximation)
        real, dimension (1:nccall,1:nccall), save :: arbkj
C
        end module colcoord

!===================
        module complex_const
        complex, parameter :: c_zero=(0.0,0.0), c_unit=(1.0,0.0),
     &  c_munit=(-1.0,0.0)
        end module complex_const

!===================
        module gyro
!       single-particle gyromagnetic factors
!       values set in PREDEF
        real, dimension (0:1) ::  gl, gs

        data gl(0) /0.d0  /
        data gl(1) /1.d0  /
        data gs(0) /-3.826/
        data gs(1) /5.586 /

        end module gyro

!===================
        module      te_mas
        complex     SPELEM,FOPQPA,FOPQPB
        allocatable SPELEM(:,:)
        allocatable FOPQPA(:,:,:), FOPQPB(:,:,:)
        allocatable OPIMRE(:,:)
        end module  te_mas

