anchor.diff:              else
                 call mqc_error_l('errorMsg',6,'found',found)
               endIf
  -          endIf
  -          call fileInfo%getArray('BETA SCF DENSITY MATRIX',tmpMatrixBeta,foundOut=found)
  -          if(present(foundObj)) foundObj = found
  -          if(.not.found) then
  -            errorMsg = 'BETA SCF DENSITY MATRIX not present on file'
  -            if(present(foundObj)) then
  -              write(6,'(A)') errorMsg
  +          else
  +            call fileInfo%getArray('BETA SCF DENSITY MATRIX',tmpMatrixBeta,foundOut=found)
  +            if(present(foundObj)) foundObj = found
  +            if(.not.found) then
  +              errorMsg = 'BETA SCF DENSITY MATRIX not present on file'
  +              if(present(foundObj)) then
  +                write(6,'(A)') errorMsg
  +              else
  +                call mqc_error_l('errorMsg',6,'found',found)
  +              endIf
               else
  -              call mqc_error_l('errorMsg',6,'found',found)
  -            endIf
  -          endIf
  -          if(MQC_Matrix_HaveComplex(tmpMatrixAlpha)) then
  -            call mqc_matrix_symm2full(tmpMatrixAlpha,'hermitian')
  -            tmpMatrixAlpha = transpose(tmpMatrixAlpha)
  -          endIf
  -          if(MQC_Matrix_HaveComplex(tmpMatrixBeta)) then
  -            call mqc_matrix_symm2full(tmpMatrixBeta,'hermitian')
  -            tmpMatrixBeta = transpose(tmpMatrixBeta)
  -          endIf
  -          call mqc_integral_allocate(est_integral,'density','spin',tmpMatrixAlpha, &
  -            tmpMatrixBeta)
  +              if(MQC_Matrix_HaveComplex(tmpMatrixAlpha)) then
  +                call mqc_matrix_symm2full(tmpMatrixAlpha,'hermitian')
  +                tmpMatrixAlpha = transpose(tmpMatrixAlpha)
  +              endIf
  +              if(MQC_Matrix_HaveComplex(tmpMatrixBeta)) then
  +                call mqc_matrix_symm2full(tmpMatrixBeta,'hermitian')
  +                tmpMatrixBeta = transpose(tmpMatrixBeta)
  +              endIf
  +              call mqc_integral_allocate(est_integral,'density','spin',tmpMatrixAlpha, &
  +                tmpMatrixBeta)
  +            endIf
  +          endIf
           elseIf(fileinfo%isGeneral()) then
             call fileInfo%getArray('ALPHA SCF DENSITY MATRIX',tmpMatrixAlpha,foundOut=found)
             if(present(foundObj)) foundObj = found
  
positive.code:             else
                call mqc_error_l('errorMsg',6,'found',found)
              endIf
            endIf
            nBasis = fileInfo%getVal('nBasis')
            call mqc_matrix_spinBlockGHF(tmpMatrixAlpha,fileInfo%getVal('nElectrons'), &
              fileInfo%getVal('multiplicity'),elist)
            tmpMatrixBeta = tmpMatrixAlpha%mat([nBasis+1,-1],[nBasis+1,-1])
            tmpMatrixBetaAlpha = tmpMatrixAlpha%mat([1,nBasis],[nBasis+1,-1])
            tmpMatrixAlphaBeta = tmpMatrixAlpha%mat([nBasis+1,-1],[1,nBasis])
            tmpMatrixAlpha = tmpMatrixAlpha%mat([1,nBasis],[1,nBasis])
            call mqc_integral_allocate(est_integral,'mo coefficients','general',tmpMatrixAlpha, &
              tmpMatrixBeta,tmpMatrixAlphaBeta,tmpMatrixBetaAlpha)
            call est_integral%setEList(elist)
          else
            call mqc_error_L('Unknown wavefunction type in getESTObj', 6, &
                 'fileinfo%isRestricted()', fileinfo%isRestricted(), &
  
negative.code:             else
                call mqc_error_l('errorMsg',6,'found',found)
              endIf
            else
              call mqc_integral_allocate(est_integral,'mo coefficients','space',tmpMatrixAlpha)
            endIf
          elseIf(fileinfo%isUnrestricted()) then
            call fileInfo%getArray('ALPHA MO COEFFICIENTS',tmpMatrixAlpha,foundOut=found)
            if(present(foundObj)) foundObj = found
  