Branch data Line data Source code
1 : : !!****m* ABINIT/m_gwls_GWanalyticPart
2 : : !! NAME
3 : : !! m_gwls_GWanalyticPart
4 : : !!
5 : : !! FUNCTION
6 : : !! .
7 : : !!
8 : : !! COPYRIGHT
9 : : !! Copyright (C) 2009-2026 ABINIT group (JLJ, BR, MC)
10 : : !! This file is distributed under the terms of the
11 : : !! GNU General Public License, see ~abinit/COPYING
12 : : !! or http://www.gnu.org/copyleft/gpl.txt .
13 : : !!
14 : : !! SOURCE
15 : :
16 : : #if defined HAVE_CONFIG_H
17 : : #include "config.h"
18 : : #endif
19 : :
20 : : #include "abi_common.h"
21 : :
22 : :
23 : : module m_gwls_GWanalyticPart
24 : : !----------------------------------------------------------------------------------------------------
25 : : ! This module contains routines to compute the contribution to the GW correlation energy coming
26 : : ! from the analytic integral of the trial frequency function.
27 : : !----------------------------------------------------------------------------------------------------
28 : : ! local modules
29 : : use m_gwls_utility
30 : : use m_gwls_wf
31 : : use m_gwls_hamiltonian
32 : : use m_gwls_lineqsolver
33 : : use m_gwls_GWlanczos
34 : : use m_gwls_GenerateEpsilon
35 : : use m_gwls_LanczosBasis
36 : : use m_gwls_model_polarisability
37 : : use m_gwls_polarisability
38 : : !use m_gwls_ComplementSpacePolarizability
39 : : use m_gwls_GWlanczos
40 : : use m_gwls_TimingLog
41 : :
42 : : ! abinit modules
43 : : use defs_basis
44 : : use m_abicore
45 : :
46 : : implicit none
47 : : save
48 : : private
49 : : !!***
50 : :
51 : : !real(dp),allocatable :: epsilon_eigenvalues_complement(:)
52 : : !real(dp),allocatable :: lanczos_basis_complement(:,:,:)
53 : :
54 : :
55 : : complex(dp),public, allocatable :: A_array(:,:)
56 : :
57 : : integer, public :: model_number
58 : : real(dp),public :: model_parameter
59 : :
60 : : real(dp), public :: G0_model_epsilon_0 ! model parameter
61 : : !!***
62 : :
63 : : public :: get_projection_band_indices
64 : : !!***
65 : :
66 : : contains
67 : :
68 : : !!****f* m_hamiltonian/get_projection_band_indices
69 : : !! NAME
70 : : !! get_projection_band_indices
71 : : !!
72 : : !! FUNCTION
73 : : !! .
74 : : !!
75 : : !! INPUTS
76 : : !!
77 : : !! OUTPUT
78 : : !!
79 : : !! SOURCE
80 : :
81 : 65 : subroutine get_projection_band_indices(omega,band_index_below, band_index_above)
82 : : !----------------------------------------------------------------------------------------------------
83 : : ! This subroutine computes the band indices necessary for properly projecting the Sternheimer equations
84 : : ! where
85 : : ! Pe : projection on states such that epsilon_n < omega
86 : : ! Qe : projection on states such that epsilon_n > omega
87 : : !----------------------------------------------------------------------------------------------------
88 : : real(dp),intent(in) :: omega
89 : : integer, intent(out) :: band_index_below, band_index_above
90 : :
91 : : ! *************************************************************************
92 : :
93 : : ! First, find the indices for the projections
94 : :
95 : 65 : band_index_below = 1
96 : : ! it is assumed that the eigenvalues are sorted. As soon as the current eigenvalue
97 : : ! is equal or larger than epsilon_e, exit!
98 : : do
99 [ - + ]: 65 : if ( omega - eig(band_index_below) <= 1.0e-8 ) exit
100 : 0 : band_index_below = band_index_below + 1
101 : :
102 [ - - ]: 65 : if (band_index_below > size(eig)) then
103 : :
104 : 0 : write(std_out,*) '************************************************************'
105 : 0 : write(std_out,*) '*** ERROR IN ROUTINE get_projection_band_indices ***'
106 : 0 : write(std_out,*) '*** ***'
107 : 0 : write(std_out,*) '*** The index of the DFT eigenvalue larger than ***'
108 : 0 : write(std_out,*) '*** the target frequency is larger than the number ***'
109 : 0 : write(std_out,*) '*** of explicitly calculated DFT eigenvalues. ***'
110 : 0 : write(std_out,*) '*** The computation cannot go on to produce a ***'
111 : 0 : write(std_out,*) '*** meaningful result: review your input! ***'
112 : 0 : write(std_out,*) '*** ***'
113 : 0 : write(std_out,*) '*** program stops. ***'
114 : 0 : write(std_out,*) '************************************************************'
115 : 0 : stop
116 : : end if
117 : : end do
118 : : ! We have overshooted in order to exit the do loop , so decrement by 1
119 : 65 : band_index_below = band_index_below - 1
120 : :
121 : : ! band_index_below is now the index of the highest eigenvalue BELOW omega
122 : : ! NOTE THAT band_index_below = 0 if omega is smaller than all eigenvalues!
123 : : ! A test should be performed on the indices obtained from this routine
124 : :
125 : 65 : band_index_above = band_index_below+1
126 : 0 : do
127 [ - + ]: 65 : if ( eig(band_index_above)-omega > 1.0e-8 ) exit
128 : 0 : band_index_above = band_index_above + 1
129 : : end do
130 : : ! band_index_above is now the index of the lowest eigenvalue ABOVE eig(e)
131 : 65 : band_index_above = band_index_above - 1
132 : : ! band_index_above is now the highest index with eigenvalue equal to eig(e).
133 : : ! This is the correct index to remove the states with energy <= eig(e)
134 : :
135 : 65 : end subroutine get_projection_band_indices
136 : : !!***
137 : :
138 : : end module m_gwls_GWanalyticPart
139 : : !!***
|