@@ -409,9 +409,7 @@ to the Hamiltonian change `δH` represented by the matrix-vector products `δHψ
409409 # We then use the extra information we have from these additional bands,
410410 # non-necessarily converged, to split the Sternheimer_solver with a Schur
411411 # complement.
412- occ_thresh = occupation_threshold
413- mask_occ = map (occk -> findall (occnk -> abs (occnk) ≥ occ_thresh, occk), occupation)
414- mask_extra = map (occk -> findall (occnk -> abs (occnk) < occ_thresh, occk), occupation)
412+ (mask_occ, mask_extra) = occupied_empty_masks (occupation, occupation_threshold)
415413
416414 ψ_occ = [ψ[ik][:, maskk] for (ik, maskk) in enumerate (mask_occ)]
417415 ψ_extra = [ψ[ik][:, maskk] for (ik, maskk) in enumerate (mask_extra)]
@@ -563,7 +561,7 @@ function construct_bandtol(Bandtol::Type, basis::PlaneWaveBasis, ψ, occupation:
563561 Ω = basis. model. unit_cell_volume
564562 Ng = prod (basis. fft_size)
565563 Nk = length (basis. kpoints)
566- mask_occ = map (ok -> findall (onk -> abs (onk) ≥ occupation_threshold, ok), occupation)
564+ mask_occ = occupied_empty_masks (occupation, occupation_threshold) . mask_occ
567565
568566 # Including k-points the expression (3.11) in 2505.02319 becomes
569567 # with Φk = (ψ_{1,k} … ψ_{n,k})_k (Concatenation of all occupied orbitals for this k)
0 commit comments