(git:cd2a8c4)
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 by prepare_bse_env, normalised in
39!> place by adapt_BSE_input_params) and the state prepare_bse_env fills for bse_solve
40! **************************************************************************************************
42 ! --- settings, one field per keyword of the &BSE section; the reader sets them ---
43 INTEGER :: bse_spin_config = 0, &
44 bse_diag_method = 0, &
45 flag_tda = 0, &
46 num_exc_en = 0, &
47 num_print_exc = 0, &
48 num_print_exc_descr = 0, &
49 screening_method = 0, &
50 num_buffer_states = 0, &
51 block_size = 0, &
52 num_guess_transitions = 0, &
53 max_subspace_factor = 0, &
54 matvec_block_columns = -1, &
55 memory_check = 0, &
56 max_iter = 0, &
57 convergence_criterion = 0, &
58 preconditioner = 0, &
59 abba_solver = 0
60 REAL(kind=dp) :: eps_res = 0.0_dp, &
61 memory_budget_gb = 0.0_dp, &
62 eps_energy = 0.0_dp, &
63 eps_x = 0.0_dp, &
64 screening_factor = 0.0_dp, &
65 bse_cutoff_occ = 0.0_dp, &
66 bse_cutoff_empty = 0.0_dp
67 LOGICAL :: do_bse = .false., &
68 bse_debug_print = .false., &
69 print_directional_exc_descr = .false., &
70 print_directional_crosscorrelation = .false., &
71 use_ks_energies = .false.
72 !BSE optical spectrum
73 REAL(kind=dp) :: bse_spectrum_freq_step_size = 0.0_dp, &
74 bse_spectrum_freq_start = 0.0_dp, &
75 bse_spectrum_freq_end = 0.0_dp
76 LOGICAL :: bse_print_spectrum = .false.
77 REAL(kind=dp), DIMENSION(:), POINTER :: bse_eta_spectrum_list => null()
78
79 !BSE NTO prints
80 LOGICAL :: do_nto_analysis = .false., &
81 explicit_nto_list = .false.
82 REAL(kind=dp) :: eps_nto_eigval = 0.0_dp, &
83 eps_nto_osc_str = 0.0_dp
84 INTEGER :: num_print_exc_ntos = 0
85 INTEGER, DIMENSION(:), POINTER :: bse_nto_state_list => null()
86 INTEGER, DIMENSION(:), ALLOCATABLE :: bse_nto_state_list_final
87 TYPE(section_vals_type), POINTER :: bse_section => null()
88 ! --- state, unset until prepare_bse_env fills it ---
89 LOGICAL :: do_tda = .false., &
90 do_abba = .false., &
91 do_fulldiag = .false., &
92 do_iterdiag = .false.
93 INTEGER :: nspins = 0, &
94 dimen_ri = 0, &
95 dimen_ri_red = 0, &
96 n_ov_joint = 0, &
97 gw_corr_lev_occ = 0
98 ! per spin: the window's occupied and virtual counts, the full occupied count (MO labels and
99 ! N_e), the GW-corrected virtual count
100 INTEGER, DIMENSION(:), ALLOCATABLE :: homo_red, virt_red, homo_full, &
101 gw_corr_lev_virt
102 ! windowed energies (level, spin), DFT and quasiparticle; bse_solve picks one by USE_KS_ENERGIES
103 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: eigenval_dft, eigenval_qp
104 ! window-sized RI slabs per spin, [1+Q(0)]^-1, and the screened slabs bse_solve forms
105 TYPE(cp_fm_type), DIMENSION(:), ALLOCATABLE :: fm_s_ia, fm_s_ij, fm_s_ab, &
106 fm_s_bar_ia, fm_s_bar_ij
107 TYPE(cp_fm_type) :: fm_eps_inv = cp_fm_type()
108 ! AO multipoles <φ_µ|(r - r_0)^k|φ_ν> from QS, dipoles always and quadrupoles for the exciton
109 ! descriptors, about r_0; the solver transforms them into the window
110 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_dipole_ao => null(), &
111 matrix_quadpole_ao => null()
112 REAL(kind=dp), DIMENSION(3) :: multipole_ref_point = 0.0_dp
113 ! QS objects the solver reads, none owned
114 TYPE(mp_para_env_type), POINTER :: para_env => null()
115 TYPE(qs_subsys_type), POINTER :: subsys => null()
116 TYPE(pw_env_type), POINTER :: pw_env => null()
117 TYPE(dft_control_type), POINTER :: dft_control => null()
118 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos => null()
119 TYPE(excited_energy_type), POINTER :: exstate_env => null()
120 END TYPE bse_env_type
121
122CONTAINS
123
124! **************************************************************************************************
125!> \brief Releases the state a GW path prepared and nullifies the QS pointers; the settings stay,
126!> including the section pointer and the two lists into the input tree, since prepare_bse_env
127!> re-reads them from the section when a later energy evaluation on the same environment runs
128!> the BSE again. Safe on an unprepared environment.
129!> \param bse_env the environment whose prepared state is released
130! **************************************************************************************************
131 SUBROUTINE bse_env_release(bse_env)
132 TYPE(bse_env_type), INTENT(INOUT) :: bse_env
133
134 CALL cp_fm_release(bse_env%fm_S_ia)
135 CALL cp_fm_release(bse_env%fm_S_ij)
136 CALL cp_fm_release(bse_env%fm_S_ab)
137 CALL cp_fm_release(bse_env%fm_S_bar_ia)
138 CALL cp_fm_release(bse_env%fm_S_bar_ij)
139 CALL cp_fm_release(bse_env%fm_eps_inv)
140 CALL dbcsr_deallocate_matrix_set(bse_env%matrix_dipole_ao)
141 CALL dbcsr_deallocate_matrix_set(bse_env%matrix_quadpole_ao)
142 IF (ALLOCATED(bse_env%homo_red)) DEALLOCATE (bse_env%homo_red)
143 IF (ALLOCATED(bse_env%virt_red)) DEALLOCATE (bse_env%virt_red)
144 IF (ALLOCATED(bse_env%homo_full)) DEALLOCATE (bse_env%homo_full)
145 IF (ALLOCATED(bse_env%gw_corr_lev_virt)) DEALLOCATE (bse_env%gw_corr_lev_virt)
146 IF (ALLOCATED(bse_env%eigenval_dft)) DEALLOCATE (bse_env%eigenval_dft)
147 IF (ALLOCATED(bse_env%eigenval_qp)) DEALLOCATE (bse_env%eigenval_qp)
148 IF (ALLOCATED(bse_env%bse_nto_state_list_final)) DEALLOCATE (bse_env%bse_nto_state_list_final)
149 NULLIFY (bse_env%para_env, bse_env%subsys, bse_env%pw_env, bse_env%dft_control, bse_env%mos, &
150 bse_env%exstate_env)
151
152 END SUBROUTINE bse_env_release
153
154END 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:132
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 by prepare_bse_env, normalised in place by ad...
Definition bse_types.F:41
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