fill_lu_table Subroutine

private subroutine fill_lu_table(this)

Type Bound

lattice

Arguments

Type IntentOptional Attributes Name
class(lattice) :: this

Contents

Source Code


Source Code

    subroutine fill_lu_table(this)
        implicit none
        class(lattice) :: this
        integer :: i, j, m, k_check(sdim), k_sum(sdim), nsites
        integer :: k

        nsites = this%get_nsites()
        !U.Ebling:
        !The older loop took a very long to finish for any lattice that is not super tiny.
        !I tried a 21x5x1 rectangle and it did not finish after 2 days
        !It over-counts a lot.
        !Below is my optimized version, which loops directly over momenta instead of orbitals
        !There is no need to distinguish the 1-body and 2-body transcorrelation terms, because it
        !uses the result of the subroutine get_lu_table_size
        do i=this%kmin(1),this%kmax(1)
            do j=this%kmin(2),this%kmax(2)
                do k=this%kmin(3),this%kmax(3)
                    k_sum(1)=i
                    k_sum(2)=j
                    k_sum(3)=k
                    k_check=this%map_k_vec(k_sum)
                    do m=1,nsites
                        if(all(k_check == this%get_k_vec(m))) then
                            this%lu_table(k_sum(1),k_sum(2),k_sum(3)) = m
                            exit
                        end if
                    end do
                end do
            end do
        end do

    end subroutine fill_lu_table