subroutine setupBreathingCont(prefactor)
implicit none
integer :: li(3), i, kx, ky, kz, q(3), s
real(dp) :: bcBuf, prefactor
do i = 1, 3
li(i) = nBasisMax(i, 2) - nBasisMax(i, 1) + 1
end do
allocate(breathingCont(li(1) * li(2) * li(3) * 2), stat=s)
do s = 1, 2
do kz = 1, li(3)
do ky = 1, li(2)
do kx = 1, li(1)
! momentum is the only input to the matrix elements of the breathing
! contribution
q = (/kx, ky, kz/)
call MomPbcSym(q, nBasisMax)
bcBuf = 0.0_dp
do i = 1, 3
if (li(i) > 1) bcBuf = bcBuf + cos(2 * pi / li(i) * q(i))
end do
breathingCont(momIndexTable(kx, ky, kz, s)) = prefactor * bcBuf
end do
end do
end do
end do
end subroutine setupBreathingCont