(git:374b731)
Loading...
Searching...
No Matches
qs_tddfpt2_stda_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7! **************************************************************************************************
8!> \brief Simplified Tamm Dancoff approach (sTDA).
9! **************************************************************************************************
11
22 USE kinds, ONLY: dp
23 USE physcon, ONLY: evolt
27#include "./base/base_uses.f90"
28
29 IMPLICIT NONE
30
31 PRIVATE
32
33 TYPE stda_kind_type
34 CHARACTER(LEN=2) :: symbol !element symbol
35 INTEGER :: z !atomic_number
36 INTEGER :: kind_number !kind number
37 REAL(KIND=dp) :: hardness_param !hardness_parameter eta
38 REAL(KIND=dp) :: rcut !cutoff radius for short-range Coulomb
39 END TYPE
40
41 TYPE stda_kind_p_type
42 TYPE(stda_kind_type), POINTER :: kind_param
43 END TYPE
44
46 !fraction of non-local HF exchange
47 REAL(kind=dp) :: hfx_fraction
48 LOGICAL :: do_exchange
49 ! empirical parameters
50 REAL(kind=dp) :: alpha_param
51 REAL(kind=dp) :: beta_param
52 ! filter for TD matrix
53 REAL(kind=dp) :: eps_td_filter
54 TYPE(stda_kind_p_type), DIMENSION(:), POINTER:: kind_param_set
55 !number of atomic orbitals, number of occupied orbitals
56 INTEGER, DIMENSION(2) :: n_ao
57 INTEGER, DIMENSION(2) :: nactive
58 END TYPE
59
60 !PARAMETERS
61!&<
62 INTEGER, PARAMETER, PRIVATE :: nelem = 103
63 ! H He
64 ! Li Be B C N O F Ne
65 ! Na Mg Al Si P S Cl Ar
66 ! K Ca Sc Ti V Cr Mn Fe Co Ni Cu Zn Ga Ge As Se Br Kr
67 ! Rb Sr Y Zr Nb Mo Tc Ru Rh Pd Ag Cd In Sn Sb Te I Xe
68 ! Cs Ba La Ce-Lu Hf Ta W Re Os Ir Pt Au Hg Tl Pb Bi Po At Rn
69 ! Fr Ra Ac Th Pa U Np Pu Am Cm Bk Cf Es Fm Md No Lr 103
70
71 REAL(kind=dp), DIMENSION(1:nelem), PARAMETER, PRIVATE:: hardness = &
72 (/6.4299544220_dp, 12.544911890_dp, & ! 2 H-He
73 2.3745866560_dp, 3.4967633530_dp, 4.6190089720_dp, 5.7409789220_dp, &
74 6.8624665290_dp, 7.9854357010_dp, 9.1064753720_dp, 10.23034050_dp, & ! 8 Li-Ne
75 2.444141360_dp, 3.0146513830_dp, 3.5849070740_dp, 4.15513090_dp, &
76 4.7258039740_dp, 5.2959792410_dp, 5.8661864840_dp, 6.4366187140_dp, & ! 8 Na-Ar
77 2.3273178360_dp, 2.7587238140_dp, 2.8581921140_dp, 2.9578300430_dp, &
78 3.0573410060_dp, 3.1567254290_dp, 3.2563827230_dp, 3.3559314050_dp, &
79 3.4556091170_dp, 3.5550133130_dp, 3.6544183480_dp, 3.7541601450_dp, &
80 4.1855197930_dp, 4.6166272460_dp, 5.0662145070_dp, 5.4794960970_dp, &
81 5.9110996450_dp, 6.3418467680_dp, & ! 18 K-Kr
82 2.1204582570_dp, 2.5373700480_dp, 2.6335468980_dp, 2.7297528930_dp, &
83 2.8259738860_dp, 2.9221296040_dp, 3.0183708780_dp, 3.1145981770_dp, &
84 3.210756280_dp, 3.3069474480_dp, 3.4031948570_dp, 3.4993761390_dp, &
85 3.9163692460_dp, 4.3332332190_dp, 4.7500787860_dp, 5.1669793270_dp, &
86 5.5838871020_dp, 6.000897330_dp, & ! 18 Rb-Xe
87 0.6829150240_dp, 0.9200946840_dp, 1.1570887860_dp, 1.39427570_dp, &
88 1.6314731730_dp, 1.8684389980_dp, 2.1056577930_dp, 2.3426646420_dp, &
89 2.5798149820_dp, 2.8170264230_dp, 3.0540365330_dp, 3.2911692310_dp, &
90 3.5282971610_dp, 3.7655249290_dp, 4.0025547030_dp, 4.2394783410_dp, &
91 4.4765830210_dp, 4.7065224490_dp, 4.9508466940_dp, 5.1879311720_dp, &
92 5.4256076210_dp, 5.6619144310_dp, 5.900042920_dp, 6.1367145320_dp, &
93 6.3741299770_dp, 6.6102656130_dp, 1.7043485810_dp, 1.9413526120_dp, &
94 2.178491510_dp, 2.4158121060_dp, 2.6527780840_dp, 2.8899554570_dp, & ! 32 Cs-Rn
95 0.9882529880_dp, 1.2819499970_dp, 1.3497250380_dp, 1.4175257380_dp, &
96 1.9368567520_dp, 2.2305576050_dp, 2.5241204960_dp, 3.0436128480_dp, &
97 3.4168675260_dp, 3.4049844440_dp, 3.9244199680_dp, 4.2180813280_dp, &
98 4.5115926320_dp, 4.8050928950_dp, 5.0989816210_dp, 5.3926054620_dp, &
99 5.4606987930_dp/) ! 17 Fr-Lr
100!&>
101
102 REAL(kind=dp), DIMENSION(2), PARAMETER, PRIVATE:: alpha = (/1.420_dp, 0.480_dp/)
103 REAL(kind=dp), DIMENSION(2), PARAMETER, PRIVATE:: beta = (/0.200_dp, 1.830_dp/)
104
105 CHARACTER(len=*), PARAMETER, PRIVATE :: modulen = 'qs_tddfpt2_stda_types'
106
107 PUBLIC:: stda_env_type, &
109
110CONTAINS
111
112! **************************************************************************************************
113!> \brief Get the parameters needed for an sTDA calculation
114!> \param qs_env ...
115!> \param stda_kernel ...
116!> \param stda_control ...
117! **************************************************************************************************
118 SUBROUTINE stda_init_param(qs_env, stda_kernel, stda_control)
119
120 TYPE(qs_environment_type), POINTER :: qs_env
121 TYPE(stda_env_type) :: stda_kernel
122 TYPE(stda_control_type) :: stda_control
123
124 INTEGER :: ikind, log_unit, nkind
125 REAL(kind=dp) :: eta, fxx, rcut
126 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
127 TYPE(atomic_kind_type), POINTER :: atomic_kind
128 TYPE(cp_logger_type), POINTER :: logger
129 TYPE(dft_control_type), POINTER :: dft_control
130 TYPE(section_vals_type), POINTER :: tddfpt_print_section
131 TYPE(stda_kind_type), POINTER :: kind_param
132
133 NULLIFY (logger)
134 logger => cp_get_default_logger()
135
136 cpassert(ASSOCIATED(stda_kernel%kind_param_set))
137
138 NULLIFY (atomic_kind_set)
139 CALL get_qs_env(qs_env, dft_control=dft_control, atomic_kind_set=atomic_kind_set)
140 nkind = SIZE(atomic_kind_set)
141
142 NULLIFY (tddfpt_print_section)
143 tddfpt_print_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT%PRINT")
144 log_unit = cp_print_key_unit_nr(logger, tddfpt_print_section, "PROGRAM_BANNER", extension=".tddfptLog")
145
146 DO ikind = 1, nkind
147 atomic_kind => atomic_kind_set(ikind)
148 kind_param => stda_kernel%kind_param_set(ikind)%kind_param
149 ! element symbol, kind_number, atomic number
150 CALL get_atomic_kind(atomic_kind, &
151 element_symbol=stda_kernel%kind_param_set(ikind)%kind_param%symbol, &
152 kind_number=stda_kernel%kind_param_set(ikind)%kind_param%kind_number, &
153 z=stda_kernel%kind_param_set(ikind)%kind_param%z)
154 END DO
155
156 IF (stda_control%do_exchange) THEN ! option to switch off exchange
157 ! HFx_fraction
158 stda_kernel%do_exchange = .true.
159 stda_kernel%hfx_fraction = stda_control%hfx_fraction
160 ELSE
161 stda_kernel%do_exchange = .false.
162 stda_kernel%hfx_fraction = 0.0_dp
163 END IF
164
165 ! alpha and beta parameter
166 IF (stda_control%mn_alpha < -98.0_dp) THEN
167 IF (dft_control%qs_control%xtb) THEN
168 stda_kernel%alpha_param = 2.0_dp
169 ELSE
170 stda_kernel%alpha_param = alpha(1) + stda_kernel%hfx_fraction*alpha(2)
171 END IF
172 ELSE
173 stda_kernel%alpha_param = stda_control%mn_alpha
174 END IF
175 IF (stda_control%mn_beta < -98.0_dp) THEN
176 IF (dft_control%qs_control%xtb) THEN
177 stda_kernel%beta_param = 4.0_dp
178 ELSE
179 stda_kernel%beta_param = beta(1) + stda_kernel%hfx_fraction*beta(2)
180 END IF
181 ELSE
182 stda_kernel%beta_param = stda_control%mn_beta
183 END IF
184
185 ! TD Filter
186 stda_kernel%eps_td_filter = stda_control%eps_td_filter
187
188 DO ikind = 1, nkind
189 ! hardness parameter
190 stda_kernel%kind_param_set(ikind)%kind_param%hardness_param = &
191 hardness(stda_kernel%kind_param_set(ikind)%kind_param%z)*2.0_dp/evolt
192 ! rcut parameter
193 eta = stda_kernel%kind_param_set(ikind)%kind_param%hardness_param
194 fxx = 2.0_dp*eta**2*stda_control%coulomb_sr_eps
195 fxx = 0.5_dp*(1.0_dp/fxx)**0.33333_dp
196 rcut = stda_control%coulomb_sr_cut
197 stda_kernel%kind_param_set(ikind)%kind_param%rcut = min(rcut, fxx)
198 END DO
199
200 IF (log_unit > 0) THEN
201 IF (.NOT. stda_kernel%do_exchange) THEN
202 WRITE (log_unit, "(T2,A,T78,A3)") "sTDA| Exchange term is not used!"
203 END IF
204 WRITE (log_unit, "(T2,A,T71,F10.4)") "sTDA| HFX Fraction", stda_kernel%hfx_fraction
205 WRITE (log_unit, "(T2,A,T71,F10.4)") "sTDA| Mataga-Nishimoto exponent (C)", stda_kernel%alpha_param
206 WRITE (log_unit, "(T2,A,T71,F10.4)") "sTDA| Mataga-Nishimoto exponent (X)", stda_kernel%beta_param
207 WRITE (log_unit, "(T2,A,T61,E20.8)") "sTDA| TD matrix filter", stda_kernel%eps_td_filter
208 END IF
209 CALL cp_print_key_finished_output(log_unit, logger, tddfpt_print_section, "PROGRAM_BANNER")
210
211 END SUBROUTINE stda_init_param
212! **************************************************************************************************
213!> \brief Allocate the sTDA environment
214!> \param qs_env ...
215!> \param stda_kernel ...
216!> \param n_ao ...
217!> \param nactive ...
218! **************************************************************************************************
219 SUBROUTINE allocate_stda_env(qs_env, stda_kernel, n_ao, nactive)
220
221 TYPE(qs_environment_type), POINTER :: qs_env
222 TYPE(stda_env_type) :: stda_kernel
223 INTEGER, INTENT(IN) :: n_ao
224 INTEGER, DIMENSION(:), INTENT(IN) :: nactive
225
226 INTEGER :: ii, nkind
227 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
228 TYPE(stda_kind_type), POINTER :: kind_param
229
230 stda_kernel%hfx_fraction = 0.0_dp
231 stda_kernel%alpha_param = 0.0_dp
232 stda_kernel%beta_param = 0.0_dp
233 stda_kernel%nactive = 0
234 stda_kernel%nactive(1:2) = nactive(1:2)
235 stda_kernel%n_ao = n_ao
236 NULLIFY (stda_kernel%kind_param_set)
237
238 ! initialize stda_kind_parameters
239 CALL get_qs_env(qs_env, qs_kind_set=qs_kind_set)
240 nkind = SIZE(qs_kind_set)
241
242 ALLOCATE (stda_kernel%kind_param_set(nkind))
243 DO ii = 1, nkind
244 NULLIFY (kind_param)
245 CALL allocate_stda_kind_param(kind_param)
246 stda_kernel%kind_param_set(ii)%kind_param => kind_param
247 END DO
248
249 END SUBROUTINE allocate_stda_env
250! **************************************************************************************************
251!> \brief Deallocate the sTDA environment
252!> \param stda_kernel ...
253! **************************************************************************************************
254 SUBROUTINE deallocate_stda_env(stda_kernel)
255
256 TYPE(stda_env_type) :: stda_kernel
257
258 INTEGER :: ii
259 TYPE(stda_kind_type), POINTER :: kind_param
260
261 ! deallocate stda_kind_parameters
262 IF (ASSOCIATED(stda_kernel%kind_param_set)) THEN
263 DO ii = 1, SIZE(stda_kernel%kind_param_set)
264 kind_param => stda_kernel%kind_param_set(ii)%kind_param
265 CALL deallocate_stda_kind_param(kind_param)
266 END DO
267 DEALLOCATE (stda_kernel%kind_param_set)
268 NULLIFY (stda_kernel%kind_param_set)
269 END IF
270
271 END SUBROUTINE deallocate_stda_env
272! **************************************************************************************************
273!> \brief Allocate sTDA kind parameter
274!> \param kind_param ...
275! **************************************************************************************************
276 SUBROUTINE allocate_stda_kind_param(kind_param)
277
278 TYPE(stda_kind_type), POINTER :: kind_param
279
280 IF (ASSOCIATED(kind_param)) &
281 CALL deallocate_stda_kind_param(kind_param)
282
283 ALLOCATE (kind_param)
284
285 kind_param%symbol = ""
286 kind_param%z = 0
287 kind_param%kind_number = 0
288 kind_param%hardness_param = 0.0_dp
289 kind_param%rcut = 0.0_dp
290
291 END SUBROUTINE allocate_stda_kind_param
292! **************************************************************************************************
293!> \brief Deallocate sTDA kind parameter
294!> \param kind_param ...
295! **************************************************************************************************
296 SUBROUTINE deallocate_stda_kind_param(kind_param)
297
298 TYPE(stda_kind_type), POINTER :: kind_param
299
300 cpassert(ASSOCIATED(kind_param))
301 DEALLOCATE (kind_param)
302 NULLIFY (kind_param)
303
304 END SUBROUTINE deallocate_stda_kind_param
305
306END MODULE qs_tddfpt2_stda_types
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Definition of physical constants:
Definition physcon.F:68
real(kind=dp), parameter, public evolt
Definition physcon.F:183
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, rhs)
Get the QUICKSTEP environment.
Define the quickstep kind type and their sub types.
Simplified Tamm Dancoff approach (sTDA).
subroutine, public stda_init_param(qs_env, stda_kernel, stda_control)
Get the parameters needed for an sTDA calculation.
subroutine, public deallocate_stda_env(stda_kernel)
Deallocate the sTDA environment.
subroutine, public allocate_stda_env(qs_env, stda_kernel, n_ao, nactive)
Allocate the sTDA environment.
Provides all information about an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Provides all information about a quickstep kind.