diff --git a/src/states/states_elec.F90 b/src/states/states_elec.F90 index a56add3b5c29e7c71899db07000f67b50e3a302c..767a56eb016247c661a18155f4fda7dca14fc8b4 100644 --- a/src/states/states_elec.F90 +++ b/src/states/states_elec.F90 @@ -86,6 +86,7 @@ module states_elec_oct_m states_elec_calc_quantities, & state_is_local, & state_kpt_is_local, & + kpt_is_local, & states_elec_choose_kpoints, & states_elec_distribute_nodes, & states_elec_wfns_memory, & @@ -2324,12 +2325,25 @@ contains PUSH_SUB(state_kpt_is_local) - state_kpt_is_local = ist >= st%st_start .and. ist <= st%st_end .and. & - ik >= st%d%kpt%start .and. ik <= st%d%kpt%end + state_kpt_is_local = state_is_local(st, ist) .and. kpt_is_local(st, ik) POP_SUB(state_kpt_is_local) end function state_kpt_is_local + ! --------------------------------------------------------- + !> check whether a given kpoint (ik) is on the local node + ! + logical function kpt_is_local(st, ik) + type(states_elec_t), intent(in) :: st + integer, intent(in) :: ik + + PUSH_SUB(kpt_is_local) + + kpt_is_local = ik >= st%d%kpt%start .and. ik <= st%d%kpt%end + + POP_SUB(kpt_is_local) + end function kpt_is_local + ! --------------------------------------------------------- !> return the memory usage of a states_elec_t object