13#include "./base/base_uses.f90"
19 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'mo_window'
22 INTEGER :: first_mo = 1
23 INTEGER :: last_mo = 0
44 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: eigenvalues
45 INTEGER,
INTENT(IN) :: n_mo, n_occ
46 REAL(kind=
dp),
INTENT(IN) :: cutoff_occ, cutoff_empty
51 IF (n_mo < 1 .OR. n_mo >
SIZE(eigenvalues))
THEN
52 CALL cp_abort(__location__,
"determine_mo_window: invalid number of physical MOs")
54 IF (n_occ < 1 .OR. n_occ >= n_mo)
THEN
55 CALL cp_abort(__location__,
"determine_mo_window: invalid occupied-state boundary")
61 IF (cutoff_occ > 0.0_dp .OR. cutoff_empty > 0.0_dp)
THEN
63 IF (eigenvalues(i) < eigenvalues(i - 1))
THEN
64 CALL cp_abort(__location__, &
65 "determine_mo_window: reference eigenvalues are not ascending. "// &
66 "Use the DFT/SCF energy axis; the G0W0 axis is not ordered.")
70 IF (cutoff_occ > 0.0_dp)
THEN
72 IF (eigenvalues(n_occ) - eigenvalues(i) <= cutoff_occ)
THEN
79 IF (cutoff_empty > 0.0_dp)
THEN
80 DO i = n_occ + 1, n_mo
81 IF (eigenvalues(i) - eigenvalues(n_occ + 1) > cutoff_empty)
THEN
82 window%last_mo = i - 1
100 LOGICAL,
INTENT(OUT) :: windows_differ
104 IF (
SIZE(spin_windows) < 1)
THEN
105 CALL cp_abort(__location__,
"combine_mo_windows: no spin windows supplied")
108 combined_window%first_mo = spin_windows(1)%first_mo
109 combined_window%last_mo = spin_windows(1)%last_mo
110 windows_differ = .false.
112 DO i = 2,
SIZE(spin_windows)
113 combined_window%first_mo = min(combined_window%first_mo, spin_windows(i)%first_mo)
114 combined_window%last_mo = max(combined_window%last_mo, spin_windows(i)%last_mo)
115 windows_differ = windows_differ .OR. &
116 spin_windows(i)%first_mo /= spin_windows(1)%first_mo .OR. &
117 spin_windows(i)%last_mo /= spin_windows(1)%last_mo
Defines the basic variable types.
integer, parameter, public dp
Common selection and union operations for contiguous molecular-orbital windows.
subroutine, public combine_mo_windows(spin_windows, combined_window, windows_differ)
Forms the smallest contiguous window covering all supplied spin windows.
subroutine, public determine_mo_window(eigenvalues, n_mo, n_occ, cutoff_occ, cutoff_empty, window)
Selects one contiguous MO window from an ordered reference spectrum.