<commit_before>module kpoints

use const
use system

implicit none

type kpoint
    integer, pointer :: k(:)
    real(dp) :: eigv
end type kpoint

contains

    subroutine init_kpoint(kp,k)

        type(kpoint) :: kp
        integer, intent(in), optional  :: k(ndim)
        integer :: ierr

        allocate(kp%k(ndim),stat=ierr)

        if (present(k)) then
            kp%k = k
            kp%eigv = calc_eigv(k)
        end if

    end subroutine init_kpoint

    real(dp) function calc_eigv(k)

        integer, intent(in) :: k(ndim)
        integer :: i

        calc_eigv = 0.0_dp
        do i = 1,ndim
            calc_eigv = calc_eigv + cos((2*pi*k(i))/Length(i))
        end do

        calc_eigv = -2*calc_eigv

    end function calc_eigv

end module kpoints<commit_msg>Emphasise that it's the kinetic energy rather than eigenvalue of the Hamiltonian associated with each kpoint.<commit_after>module kpoints

use const
use system

implicit none

type kpoint
    integer, pointer :: k(:)
    real(dp) :: kinetic
end type kpoint

contains

    subroutine init_kpoint(kp,k)

        type(kpoint) :: kp
        integer, intent(in), optional  :: k(ndim)
        integer :: ierr

        allocate(kp%k(ndim),stat=ierr)

        if (present(k)) then
            kp%k = k
            kp%kinetic = calc_kinetic(k)
        end if

    end subroutine init_kpoint

    real(dp) function calc_kinetic(k)

        integer, intent(in) :: k(ndim)
        integer :: i

        calc_kinetic = 0.0_dp
        do i = 1,ndim
            calc_kinetic = calc_kinetic + cos((2*pi*k(i))/Length(i))
        end do

        calc_kinetic = -2*calc_kinetic

    end function calc_kinetic

end module kpoints
{'fraction_non_alphanumeric': 0.09574468085106383, 'fraction_numerical': 0.00591016548463357, 'mean_word_length': 2.2003780718336485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3454722', 'n_tokens_mistral': 613, 'n_tokens_neox': 573, 'n_words': 150}