35 #include "./base/base_uses.f90"
40 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'negf_green_methods'
41 LOGICAL,
PARAMETER,
PRIVATE :: debug_this_module = .true.
46 TYPE sancho_work_matrices_type
48 TYPE(cp_cfm_type),
POINTER :: a
50 TYPE(cp_cfm_type),
POINTER :: a0
52 TYPE(cp_cfm_type),
POINTER :: a_inv
54 TYPE(cp_cfm_type),
POINTER :: b
56 TYPE(cp_cfm_type),
POINTER :: c
58 TYPE(cp_cfm_type),
POINTER :: d
60 TYPE(cp_cfm_type),
POINTER :: e
62 TYPE(cp_cfm_type),
POINTER :: scratch
63 END TYPE sancho_work_matrices_type
73 TYPE(sancho_work_matrices_type),
INTENT(inout) :: work
74 TYPE(cp_fm_struct_type),
POINTER :: fm_struct
76 CHARACTER(len=*),
PARAMETER :: routinen =
'sancho_work_matrices_create'
78 INTEGER :: handle, ncols, nrows
80 CALL timeset(routinen, handle)
81 cpassert(
ASSOCIATED(fm_struct))
84 cpassert(nrows == ncols)
86 NULLIFY (work%a, work%a0, work%a_inv, work%b, work%c, work%d, work%e, work%scratch)
87 ALLOCATE (work%a, work%a0, work%a_inv, work%b, work%c, work%d, work%e, work%scratch)
106 TYPE(sancho_work_matrices_type),
INTENT(inout) :: work
108 CHARACTER(len=*),
PARAMETER :: routinen =
'sancho_work_matrices_release'
112 CALL timeset(routinen, handle)
114 IF (
ASSOCIATED(work%a))
THEN
119 IF (
ASSOCIATED(work%a0))
THEN
124 IF (
ASSOCIATED(work%a_inv))
THEN
126 DEALLOCATE (work%a_inv)
129 IF (
ASSOCIATED(work%b))
THEN
134 IF (
ASSOCIATED(work%c))
THEN
139 IF (
ASSOCIATED(work%d))
THEN
144 IF (
ASSOCIATED(work%e))
THEN
149 IF (
ASSOCIATED(work%scratch))
THEN
151 DEALLOCATE (work%scratch)
152 NULLIFY (work%scratch)
155 CALL timestop(handle)
171 SUBROUTINE do_sancho(g_surf, omega, h0, s0, h1, s1, conv, transp, work)
172 TYPE(cp_cfm_type),
INTENT(IN) :: g_surf
173 COMPLEX(kind=dp),
INTENT(in) :: omega
174 TYPE(cp_fm_type),
INTENT(IN) :: h0, s0, h1, s1
175 REAL(kind=
dp),
INTENT(in) :: conv
176 LOGICAL,
INTENT(in) :: transp
177 TYPE(sancho_work_matrices_type),
INTENT(in) :: work
179 CHARACTER(len=*),
PARAMETER :: routinen =
'do_sancho'
181 INTEGER :: handle, ncols, nrows
183 CALL timeset(routinen, handle)
187 IF (debug_this_module)
THEN
188 cpassert(nrows == ncols)
195 CALL cp_cfm_to_cfm(work%a, work%a0)
218 CALL cp_cfm_to_cfm(work%a, work%a_inv)
222 CALL parallel_gemm(
'N',
'N', nrows, nrows, nrows,
z_one, work%a_inv, work%b,
z_zero, work%scratch)
227 CALL parallel_gemm(
'N',
'N', nrows, nrows, nrows,
z_one, work%b, work%scratch,
z_zero, g_surf)
230 CALL parallel_gemm(
'N',
'N', nrows, nrows, nrows,
z_one, work%a_inv, work%c,
z_zero, work%scratch)
234 CALL cp_cfm_to_cfm(g_surf, work%b)
236 CALL parallel_gemm(
'N',
'N', nrows, nrows, nrows,
z_one, work%c, work%scratch,
z_zero, g_surf)
237 CALL cp_cfm_to_cfm(g_surf, work%c)
248 CALL cp_cfm_to_cfm(work%a0, g_surf)
251 CALL timestop(handle)
270 TYPE(cp_cfm_type),
INTENT(IN) :: self_energy_c
271 COMPLEX(kind=dp),
INTENT(in) :: omega
272 TYPE(cp_cfm_type),
INTENT(IN) :: g_surf_c
273 TYPE(cp_fm_type),
INTENT(IN) :: h_sc0, s_sc0
274 TYPE(cp_cfm_type),
INTENT(IN) :: zwork1, zwork2
275 LOGICAL,
INTENT(in) :: transp
277 CHARACTER(len=*),
PARAMETER :: routinen =
'negf_contact_self_energy'
279 INTEGER :: handle, nao_contact, nao_scattering
281 CALL timeset(routinen, handle)
289 CALL cp_fm_get_info(s_sc0, nrow_global=nao_contact, ncol_global=nao_scattering)
292 CALL parallel_gemm(
'N',
'N', nao_contact, nao_scattering, nao_contact,
z_one, g_surf_c, zwork1,
z_zero, zwork2)
294 CALL parallel_gemm(
'T',
'N', nao_scattering, nao_scattering, nao_contact,
z_one, zwork1, zwork2,
z_zero, self_energy_c)
296 CALL cp_fm_get_info(s_sc0, nrow_global=nao_scattering, ncol_global=nao_contact)
299 CALL parallel_gemm(
'N',
'N', nao_scattering, nao_contact, nao_contact,
z_one, zwork1, g_surf_c,
z_zero, zwork2)
301 CALL parallel_gemm(
'N',
'T', nao_scattering, nao_scattering, nao_contact,
z_one, zwork2, zwork1,
z_zero, self_energy_c)
304 CALL timestop(handle)
315 TYPE(cp_cfm_type),
INTENT(IN) :: gamma_c, self_energy_c
317 CHARACTER(len=*),
PARAMETER :: routinen =
'negf_contact_broadening_matrix'
321 CALL timeset(routinen, handle)
332 CALL cp_cfm_scale(
gaussi, gamma_c)
334 CALL timestop(handle)
349 TYPE(cp_cfm_type),
INTENT(IN) :: g_ret_s
350 COMPLEX(kind=dp),
INTENT(in) :: omega
351 TYPE(cp_cfm_type),
INTENT(IN) :: self_energy_ret_sum
352 TYPE(cp_fm_type),
INTENT(IN) :: h_s, s_s
353 TYPE(cp_fm_type),
INTENT(IN),
OPTIONAL :: v_hartree_s
355 CHARACTER(len=*),
PARAMETER :: routinen =
'negf_retarded_green_function'
359 CALL timeset(routinen, handle)
366 IF (
PRESENT(v_hartree_s)) &
374 CALL timestop(handle)
Basic linear algebra operations for complex full matrices.
subroutine, public cp_cfm_scale_and_add(alpha, matrix_a, beta, matrix_b)
Scale and add two BLACS matrices (a = alpha*a + beta*b).
subroutine, public cp_cfm_lu_invert(matrix, info_out)
Inverts a matrix using LU decomposition. The input matrix will be overwritten.
real(kind=dp) function, public cp_cfm_norm(matrix, mode)
Norm of matrix using (p)zlange.
subroutine, public cp_cfm_gemm(transa, transb, m, n, k, alpha, matrix_a, matrix_b, beta, matrix_c, a_first_col, a_first_row, b_first_col, b_first_row, c_first_col, c_first_row)
Performs one of the matrix-matrix operations: matrix_c = alpha * op1( matrix_a ) * op2( matrix_b ) + ...
subroutine, public cp_cfm_transpose(matrix, trans, matrixt)
Transposes a BLACS distributed complex matrix.
subroutine, public cp_cfm_scale_and_add_fm(alpha, matrix_a, beta, matrix_b)
Scale and add two BLACS matrices (a = alpha*a + beta*b). where b is a real matrix (adapted from cp_cf...
Represents a complex full matrix distributed on many processors.
subroutine, public cp_cfm_create(matrix, matrix_struct, name)
Creates a new full matrix with the given structure.
subroutine, public cp_cfm_release(matrix)
Releases a full matrix.
subroutine, public cp_fm_to_cfm(msourcer, msourcei, mtarget)
Construct a complex full matrix by taking its real and imaginary parts from two separate real-value f...
subroutine, public cp_cfm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, matrix_struct, para_env)
Returns information about a full matrix.
represent the structure of a full matrix
subroutine, public cp_fm_struct_get(fmstruct, para_env, context, descriptor, ncol_block, nrow_block, nrow_global, ncol_global, first_p_pos, row_indices, col_indices, nrow_local, ncol_local, nrow_locals, ncol_locals, local_leading_dimension)
returns the values of various attributes of the matrix structure
represent a full matrix distributed on many processors
subroutine, public cp_fm_get_info(matrix, name, nrow_global, ncol_global, nrow_block, ncol_block, nrow_local, ncol_local, row_indices, col_indices, local_data, context, nrow_locals, ncol_locals, matrix_struct, para_env)
returns all kind of information about the full matrix
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
complex(kind=dp), parameter, public z_mone
complex(kind=dp), parameter, public z_one
complex(kind=dp), parameter, public gaussi
complex(kind=dp), parameter, public z_zero
Subroutines to compute Green functions.
subroutine, public sancho_work_matrices_create(work, fm_struct)
Create work matrices required for the Lopez-Sancho algorithm.
subroutine, public sancho_work_matrices_release(work)
Release work matrices.
subroutine, public negf_contact_self_energy(self_energy_c, omega, g_surf_c, h_sc0, s_sc0, zwork1, zwork2, transp)
Compute the contact self energy at point 'omega' as self_energy_C = [omega * S_SC0 - KS_SC0] * g_surf...
subroutine, public negf_contact_broadening_matrix(gamma_c, self_energy_c)
Compute contact broadening matrix as gamma_C = i (self_energy_c^{ret.} - (self_energy_c^{ret....
subroutine, public do_sancho(g_surf, omega, h0, s0, h1, s1, conv, transp, work)
Iterative method to compute a retarded surface Green's function at the point omega.
subroutine, public negf_retarded_green_function(g_ret_s, omega, self_energy_ret_sum, h_s, s_s, v_hartree_s)
Compute the retarded Green's function at point 'omega' as G_S^{ret.} = [ omega * S_S - KS_S - \sum_{c...
basic linear algebra operations for full matrixes