setupMomIndexTable Subroutine

public subroutine setupMomIndexTable()

Arguments

None

Contents

Source Code


Source Code

    subroutine setupMomIndexTable()
        implicit none
        integer :: li(3), i, kx, ky, kz, s
        ! fill the table containing the index of a given momentum
        ! such that knowing q allows for direct lookup of the matrix element
        do i = 1, 3
            li(i) = nBasisMax(i, 2) - nBasisMax(i, 1) + 1
        end do
        allocate(momIndexTable(li(1), li(2), li(3), 2), stat=i)
        do s = 1, 2
            do kz = 1, li(3)
                do ky = 1, li(2)
                    do kx = 1, li(1)
                        momIndexTable(kx, ky, kz, s) = kx + (ky - 1) * li(1) + &
                                                       (kz - 1) * li(1) * li(2) + (s - 1) * li(1) * li(2) * li(3)
                    end do
                end do
            end do
        end do
    end subroutine setupMomIndexTable