anchor.diff:  * ===========================
   * Info on configurations, etc
   * ===========================
  -*
  -      IF(NOCSF.EQ.0.AND.ICNFBAT.EQ.1) THEN
  -*
  -*. Generate the configurations and order them according
  -*. to number of open orbitals
  -*
  -        CALL GEN_CONF_FOR_CISPC(dbl_mb(KCIOCCLS_ACT),NCOCCLS_ACT,ISM,
  -     &       int_mb(KIOCCLS))
  -*. The output are delivered in pointers set in GEN_CONF_FOR_CISPC
  -*         Occupations: KICONF_OCC(ISYM)
  -*         Reorder arrays: KICONF_REO(1) (independent of symmetry)
  -*. And then the reordering of the SD's
  -*. The reordering arrays for the SD's are stored in KSDREO_I((ISM)
  -C       WRITE(6,*) ' KSDREO_I(ISM) = ', KSDREO_I(ISM)
  -        CALL CNFORD_GAS(dbl_mb(KCIOCCLS_ACT),NCOCCLS_ACT,
  -     &       int_mb(KIOCCLS),ISM,PSSIGN,
  -     &       IPRCSF,int_mb(KICONF_OCC(ISM)),int_mb(KICONF_REO(1)),
  -     &       int_mb(KSDREO_I(ISM)),int_mb(KSDREO_S(ISM)),
  -     &       dbl_mb(KCBLTP),int_mb(KCIBT),NCBLOCK)
  -C?      WRITE(6,*) ' IBLTP after CNFORD '
  -C?      CALL IWRTMA(WORK(KCBLTP),1,4,1,4)
  -      END IF ! all Conformation should be set up
   *
         MXSTBL0 = MXNSTR           
   *. type of alpha and beta strings
  
positive.code: C     PREPARE_NEW_LUC(LUCIN,LUCOUT,NROOTIN,NROOTUT,ISROOT,
  C    &           NVAR, ICISTR,ICOPY)
          CALL PREPARE_NEW_LUC(LUC,LUHC,NROOT,NROOT,ISROOT,
       &           NVAR,ICISTR,1,WORK(KPVEC1))
        END IF ! Root should be selected
  *
  *. Obtain densities etc for chosen reference root
  *
        IF(ISROOT.NE.NROOT.AND.IDENSI.GE.1) THEN
            IF(ICISTR.EQ.1) THEN
              CALL REWINO(LUC)
              CALL FRMDSC(WORK(KPVEC1),NVAR,-1,LUC,IMZERO,IAMPACK)
              CALL COPVEC(WORK(KPVEC1),WORK(KPVEC2),NVAR)
              IF(IDENSI.EQ.1) THEN
                KRHO2 = 1
              END IF
              CALL DENSI2(IDENSI,WORK(KRHO1),WORK(KRHO2),
       &      WORK(KPVEC1),WORK(KPVEC2),0,0,EXPS2,ISPNDEN,WORK(KSRHO1),
       &      WORK(KRHO2AA),WORK(KRHO2AB),WORK(KRHO2BB),1)
            ELSE
              CALL REWINO(LUSC1)
              CALL REWINO(LUC)
              CALL COPVCD(LUC,LUSC1,WORK(KVEC1),0,LBLK)
              CALL DENSI2(IDENSI,WORK(KRHO1),WORK(KRHO2),
       &          WORK(KVEC1),WORK(KVEC2),LUC,LUSC1,EXPS2,
       &          ISPNDEN,WORK(KSRHO1),WORK(KRHO2AA),WORK(KRHO2AB),
       &          WORK(KRHO2BB),1 ) 
            END IF ! ICISTR switch
        END IF ! densities should be calculated
  *
  *. Supersymmetry
  
negative.code:      &  ' **************************************************'
          WRITE(6,*)
          END IF
          CALL FRMDSC(WORK(KPVEC1),NVAR,-1,LUC,IMZERO,IAMPACK)
          CALL COPVEC(WORK(KPVEC1),WORK(KPVEC2),NVAR)
  *
  C?      WRITE(6,*) ' Testing: CI vector read in '
  C?      CALL WRTMAT(WORK(KPVEC1),1,NVAR,1,NVAR)
  *
          IF(IDENSI.EQ.1) THEN
            KRHO2 = 1
          END IF
          IF(IDENSI.GE.1)
       &  CALL DENSI2(IDENSI,WORK(KRHO1),WORK(KRHO2),
       &       WORK(KPVEC1),WORK(KPVEC2),0,0,EXPS2,ISPNDEN,WORK(KSRHO1),
       &       WORK(KRHO2AA),WORK(KRHO2AB),WORK(KRHO2BB),1)
          IF(IDENSI.EQ.2) THEN
  *. Test calculation of energy
            CALL EN_FROM_DENS(ENERGY,2,0)
            WRITE(6,*) ' Energy from density ', ENERGY
          END IF
  *
  C?      IF(I_DO_LZ2.EQ.1) THEN
  C?          CALL EXP_LZ2(KPVEC1,KPVEC2,RLZEFF,RL2EFF,0)
  C?          WORK(KLZEXP-1+JROOT) = RLZEFF
  C?          WORK(KL2EXP-1+JROOT) = RL2EFF
  C?      END IF
  *
          IF(IPRNT.GT.2) THEN
           IF(NOCSF.EQ.1) THEN
            CALL GASANA(WORK(KPVEC1),NBLOCK,int_mb(KCIBT),
       &                int_mb(KCBLTP),LUC,ICISTR)
           ELSE
            THRES = 0.1D0
            MAXTRM = 100
            IOUT = 6
  C              ANACSF(CIVEC,ICONF_OCC,NCONF_FOR_OPEN,IPROCS,THRES,MAXTRM,IOUT)
            IF(ICNFBAT.EQ.1) THEN
              CALL ANACSF(WORK(KPVEC1),int_mb(KICONF_OCC(ISM)),
       &                  NCONF_PER_OPEN(1,ISM),int_mb(KCFTP),
       &                  THRES,MAXTRM,IOUT)
            ELSE
              THRES = 0.1D0
              MAXTRM = 100
              IOUT = 6
              CALL ANACSF2(LUC,NCOCCLS_ACT,dbl_mb(KCIOCCLS_ACT),ISM,
       &           WORK(KPVEC1),int_mb(KICONF_OCC(ISM)),
       &           NCONF_PER_OPEN(1,ISM),int_mb(KCFTP),THRES,
       &           MAXTRM,IOUT)
  C    ANACSF2(LUC,NOCCLS_SPC,IOCCLS_SPC,
  C   &           CIVEC,ICONF_OCC,NCONF_FOR_OPEN,IPROCS,THRES,
  C   &           MAXTRM,IOUT)
              END IF ! CNF batch switch
           END IF! CSF switch
          END IF ! IPRNT > 2
        END DO
  *     ^ End of loop over roots
  *
  