DumpUMatCache Subroutine

public subroutine DumpUMatCache()

Arguments

None

Contents

Source Code


Source Code

    subroutine DumpUMatCache()
        ! Print out the cache contents so they can be read back in for a future
        ! calculation.  Need to print out the full set of indices, as the number of
        ! states may change with the next calculation.
        ! Variables
        integer iPair, iSlot, i, j, k, l, iCache1, iCache2, A, B, iType
        HElement_t(dp) UMatEl
        type(Symmetry) Sym
        integer iunit
        iunit = get_free_unit()
        open(iunit, file="CacheDump", status="unknown")
!      do i=1,nPairs !Run through ik pairs
!          do j=1,nSlots !Run through all pairs (unordered in the list)
!              write(iunit,*) i,j,UMatLabels(j,i),UMatCacheData(:,j,i)  !ik label, slot value, jl label, integral
!          end do
!      end do
!      write(iunit,*) "*****"
        write(iunit, *) nStates
        do iPair = 1, nPairs
            do iSlot = iPair, nSlots
                call GetCacheIndexStates(iPair, i, k)
                call GetCacheIndexStates(iSlot, j, l)
                Sym = TotSymRep()
                ! All integrals stored in the cache are non-zero by symmetry.
                if (LSymSym(Sym)) then
                    if (.not. GetCachedUMatEl(i, j, k, l, UMatEl, iCache1, iCache2, A, B, iType)) then
                        if (TTRANSFINDX) then
                            i = InvTransTable(i)
                            j = InvTransTable(j)
                            k = InvTransTable(k)
                            l = InvTransTable(l)
                        end if
                        ! Print out UmatCacheData as UMatEl holds just a single
                        ! integral.
                        write(iunit, *) i, j, k, l, UMatCacheData(:, ICACHE2, ICACHE1)!,A,B
                    end if
                end if
            end do
        end do
        close(iunit, status="keep")
        return
    end subroutine DumpUMatCache