(git:3f0d10b)
Loading...
Searching...
No Matches
bse_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief The BSE environment: the settings of the &BSE section and the state a GW path prepares
10!> for the solver core (window, energies, window-sized RI slabs, inverse dielectric matrix)
11!> \par History
12!> 09.2026 created from the bse_type of mp2_types [Maximilian Graml]
13! **************************************************************************************************
16 USE cp_dbcsr_api, ONLY: dbcsr_p_type
18 USE cp_fm_types, ONLY: cp_fm_release,&
22 USE kinds, ONLY: dp
24 USE pw_env_types, ONLY: pw_env_type
25 USE qs_mo_types, ONLY: mo_set_type
27#include "./base/base_uses.f90"
28
29 IMPLICIT NONE
30
31 PRIVATE
32
33 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'bse_types'
34
36
37! **************************************************************************************************
38!> \brief Settings of the &BSE section (read_bse_section, re-read before every BSE run, normalised in
39!> place by adapt_BSE_screening and adapt_BSE_input_params) and the state that the entry of the
40!> GW fills for bse_solve:
41!> prepare_bse_env_from_ri_rpa_gw for RI_RPA%GW, prepare_bse_env_from_bandstructure_gw for
42!> PROPERTIES%BANDSTRUCTURE%GW
43! **************************************************************************************************
45 ! --- settings, one field per keyword of the &BSE section; the reader sets them ---
46 INTEGER :: bse_spin_config = 0, &
47 bse_diag_method = 0, &
48 flag_tda = 0, &
49 num_exc_en = 0, &
50 num_print_exc = 0, &
51 num_print_exc_descr = 0, &
52 screening_method = 0, &
53 num_buffer_states = 0, &
54 block_size = 0, &
55 num_guess_transitions = 0, &
56 max_subspace_factor = 0, &
57 matvec_block_columns = -1, &
58 max_iter = 0, &
59 convergence_criterion = 0, &
60 preconditioner = 0, &
61 abba_solver = 0
62 REAL(kind=dp) :: eps_res = 0.0_dp, &
63 memory_per_proc_gb = -1.0_dp, &
64 eps_energy = 0.0_dp, &
65 eps_x = 0.0_dp, &
66 screening_factor = 0.0_dp, &
67 bse_cutoff_occ = 0.0_dp, &
68 bse_cutoff_empty = 0.0_dp
69 LOGICAL :: do_bse = .false., &
70 bse_debug_print = .false., &
71 print_directional_exc_descr = .false., &
72 print_directional_crosscorrelation = .false., &
73 use_ks_energies = .false.
74 !BSE optical spectrum
75 REAL(kind=dp) :: bse_spectrum_freq_step_size = 0.0_dp, &
76 bse_spectrum_freq_start = 0.0_dp, &
77 bse_spectrum_freq_end = 0.0_dp
78 LOGICAL :: bse_print_spectrum = .false.
79 REAL(kind=dp), DIMENSION(:), POINTER :: bse_eta_spectrum_list => null()
80
81 !BSE NTO prints
82 LOGICAL :: do_nto_analysis = .false., &
83 explicit_nto_list = .false.
84 REAL(kind=dp) :: eps_nto_eigval = 0.0_dp, &
85 eps_nto_osc_str = 0.0_dp
86 INTEGER :: num_print_exc_ntos = 0
87 INTEGER, DIMENSION(:), POINTER :: bse_nto_state_list => null()
88 INTEGER, DIMENSION(:), ALLOCATABLE :: bse_nto_state_list_final
89 TYPE(section_vals_type), POINTER :: bse_section => null()
90 ! --- state, unset until the entry of the GW (prepare_bse_env_from_...) fills it ---
91 LOGICAL :: do_tda = .false., &
92 do_abba = .false., &
93 do_fulldiag = .false., &
94 do_iterdiag = .false.
95 INTEGER :: nspins = 0, &
96 dimen_ri = 0, &
97 dimen_ri_red = 0, &
98 n_ov_joint = 0, &
99 gw_corr_lev_occ = 0
100 ! per spin: the window's occupied and virtual counts, the full occupied count (MO labels and
101 ! N_e), the GW-corrected virtual count
102 INTEGER, DIMENSION(:), ALLOCATABLE :: homo_red, virt_red, homo_full, &
103 gw_corr_lev_virt
104 ! windowed energies (level, spin), DFT and quasiparticle; bse_solve picks one by USE_KS_ENERGIES
105 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: eigenval_dft, eigenval_qp
106 ! window-sized RI slabs per spin, [1+Q(0)]^-1, and the screened slabs bse_solve forms
107 TYPE(cp_fm_type), DIMENSION(:), ALLOCATABLE :: fm_s_ia, fm_s_ij, fm_s_ab, &
108 fm_s_bar_ia, fm_s_bar_ij
109 TYPE(cp_fm_type) :: fm_eps_inv = cp_fm_type()
110 ! AO multipoles <φ_µ|(r - r_0)^k|φ_ν> from QS, dipoles always and quadrupoles for the exciton
111 ! descriptors, about r_0; the solver transforms them into the window
112 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_dipole_ao => null(), &
113 matrix_quadpole_ao => null()
114 REAL(kind=dp), DIMENSION(3) :: multipole_ref_point = 0.0_dp
115 ! periodic directions of the Poisson solver, read from the input: the grids may be released
116 INTEGER :: n_periodic_poisson = 0
117 ! QS objects the solver reads, none owned
118 TYPE(mp_para_env_type), POINTER :: para_env => null()
119 TYPE(qs_subsys_type), POINTER :: subsys => null()
120 TYPE(pw_env_type), POINTER :: pw_env => null()
121 TYPE(dft_control_type), POINTER :: dft_control => null()
122 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos => null()
123 TYPE(excited_energy_type), POINTER :: exstate_env => null()
124 END TYPE bse_env_type
125
126CONTAINS
127
128! **************************************************************************************************
129!> \brief Releases the state a GW path prepared and nullifies the QS pointers; the settings stay,
130!> including the section pointer and the two lists into the input tree, since
131!> prepare_bse_env_from_ri_rpa_gw re-reads them from the section when a later energy evaluation
132!> on the same environment runs the BSE again. Safe on an unprepared environment.
133!> \param bse_env the environment whose prepared state is released
134! **************************************************************************************************
135 SUBROUTINE bse_env_release(bse_env)
136 TYPE(bse_env_type), INTENT(INOUT) :: bse_env
137
138 CALL cp_fm_release(bse_env%fm_S_ia)
139 CALL cp_fm_release(bse_env%fm_S_ij)
140 CALL cp_fm_release(bse_env%fm_S_ab)
141 CALL cp_fm_release(bse_env%fm_S_bar_ia)
142 CALL cp_fm_release(bse_env%fm_S_bar_ij)
143 CALL cp_fm_release(bse_env%fm_eps_inv)
144 CALL dbcsr_deallocate_matrix_set(bse_env%matrix_dipole_ao)
145 CALL dbcsr_deallocate_matrix_set(bse_env%matrix_quadpole_ao)
146 IF (ALLOCATED(bse_env%homo_red)) DEALLOCATE (bse_env%homo_red)
147 IF (ALLOCATED(bse_env%virt_red)) DEALLOCATE (bse_env%virt_red)
148 IF (ALLOCATED(bse_env%homo_full)) DEALLOCATE (bse_env%homo_full)
149 IF (ALLOCATED(bse_env%gw_corr_lev_virt)) DEALLOCATE (bse_env%gw_corr_lev_virt)
150 IF (ALLOCATED(bse_env%eigenval_dft)) DEALLOCATE (bse_env%eigenval_dft)
151 IF (ALLOCATED(bse_env%eigenval_qp)) DEALLOCATE (bse_env%eigenval_qp)
152 IF (ALLOCATED(bse_env%bse_nto_state_list_final)) DEALLOCATE (bse_env%bse_nto_state_list_final)
153 NULLIFY (bse_env%para_env, bse_env%subsys, bse_env%pw_env, bse_env%dft_control, bse_env%mos, &
154 bse_env%exstate_env)
155
156 END SUBROUTINE bse_env_release
157
158END MODULE bse_types
The BSE environment: the settings of the &BSE section and the state a GW path prepares for the solver...
Definition bse_types.F:14
subroutine, public bse_env_release(bse_env)
Releases the state a GW path prepared and nullifies the QS pointers; the settings stay,...
Definition bse_types.F:136
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
DBCSR operations in CP2K.
represent a full matrix distributed on many processors
Definition cp_fm_types.F:15
Types for excited states potential energies.
objects that represent the structure of input sections and the data contained in an input section
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
computes preconditioners, and implements methods to apply them currently used in qs_ot
container for various plainwaves related things
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
types that represent a quickstep subsys
Settings of the &BSE section (read_bse_section, re-read before every BSE run, normalised in place by ...
Definition bse_types.F:44
represent a full matrix
Contains information on the excited states energy.
stores all the informations relevant to an mpi environment
contained for different pw related things