setup_g1 Subroutine

public subroutine setup_g1(in_lat)

Uses

Arguments

Type IntentOptional Attributes Name
class(lattice), intent(in), optional :: in_lat

Contents

Source Code


Source Code

    subroutine setup_g1(in_lat)
        use SystemData, only: G1
        class(lattice), intent(in), optional :: in_lat
        character(*), parameter :: this_routine = "setup_g1"

        integer :: i

        ! i think everything is in the System_neci file
        if (present(in_lat)) then
            ! only do it if G1 has not been setup yet!
            if (.not. associated(G1)) then
                ! i need number of spin-orbitals
                allocate(G1(in_lat%get_nsites() * 2))
                G1 = NullBasisFn

                ! should i rely on the already setup nBasisMax?
                if (all(nBasisMax == 0)) then
                    call setup_nbasismax(in_lat)
                end if

                ! do a new setup of the G1..
                do i = 1, in_lat%get_nsites()
                    G1(2 * i - 1)%k = in_lat%get_k_vec(i)
                    G1(2 * i - 1)%ms = -1
                    ! can i already write the symmetry representation in here?
                    ! i guess so..
                    G1(2 * i - 1)%Sym = Symmetry(i)

                    G1(2 * i)%k = in_lat%get_k_vec(i)
                    G1(2 * i)%ms = 1
                    G1(2 * i)%Sym = Symmetry(i)
                end do

                if (in_lat%is_k_space()) then
                    call setup_symmetry_table()

                else
                    ! also to the rest of the symmetry stuff here:
                    ! in case of real-space turn off symmetry completely:
                    call GenMolpSymTable(1, G1, in_lat%get_nsites() * 2)
                    ! and i have to redo the symmetry setting to 0
                    do i = 1, in_lat%get_nsites() * 2
                        G1(i)%sym%s = 0
                    end do
                end if

            end if
        else
            ! not yet implemented!
            call Stop_All(this_routine, "not yet implemented")
        end if

    end subroutine setup_g1