Line data Source code
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 : ! **************************************************************************************************
9 : !> \brief Utilities to set up the control types
10 : ! **************************************************************************************************
11 : MODULE cp_control_utils
12 : USE bibliography, ONLY: &
13 : Andreussi2012, Dewar1977, Dewar1985, Elstner1998, Fattebert2002, Grimme2017, Hu2007, &
14 : Krack2000, Lippert1997, Lippert1999, Porezag1995, Pracht2019, Repasky2002, Rocha2006, &
15 : Schenter2008, Seifert1996, Souza2002, Stengel2009, Stewart1989, Stewart2007, Thiel1992, &
16 : Umari2002, VanVoorhis2015, VandeVondele2005a, VandeVondele2005b, Yin2017, Zhechkov2005, &
17 : cite_reference
18 : USE cp_control_types, ONLY: &
19 : admm_control_create, admm_control_type, ddapc_control_create, ddapc_restraint_type, &
20 : dft_control_create, dft_control_type, efield_type, expot_control_create, &
21 : maxwell_control_create, qs_control_type, tddfpt2_control_type, tddfpt_control_create, &
22 : tddfpt_control_type, xtb_control_type
23 : USE cp_files, ONLY: close_file,&
24 : open_file
25 : USE cp_log_handling, ONLY: cp_get_default_logger,&
26 : cp_logger_type
27 : USE cp_output_handling, ONLY: cp_print_key_finished_output,&
28 : cp_print_key_unit_nr
29 : USE cp_units, ONLY: cp_unit_from_cp2k,&
30 : cp_unit_to_cp2k
31 : USE eeq_input, ONLY: read_eeq_param
32 : USE force_fields_input, ONLY: read_gp_section
33 : USE input_constants, ONLY: &
34 : admm1_type, admm2_type, admmp_type, admmq_type, admms_type, constant_env, custom_env, &
35 : do_admm_aux_exch_func_bee, do_admm_aux_exch_func_bee_libxc, do_admm_aux_exch_func_default, &
36 : do_admm_aux_exch_func_default_libxc, do_admm_aux_exch_func_none, &
37 : do_admm_aux_exch_func_opt, do_admm_aux_exch_func_opt_libxc, do_admm_aux_exch_func_pbex, &
38 : do_admm_aux_exch_func_pbex_libxc, do_admm_aux_exch_func_sx_libxc, &
39 : do_admm_basis_projection, do_admm_blocked_projection, do_admm_blocking_purify_full, &
40 : do_admm_charge_constrained_projection, do_admm_exch_scaling_merlot, &
41 : do_admm_exch_scaling_none, do_admm_purify_cauchy, do_admm_purify_cauchy_subspace, &
42 : do_admm_purify_mcweeny, do_admm_purify_mo_diag, do_admm_purify_mo_no_diag, &
43 : do_admm_purify_none, do_admm_purify_none_dm, do_ddapc_constraint, do_ddapc_restraint, &
44 : do_method_am1, do_method_dftb, do_method_gapw, do_method_gapw_xc, do_method_gpw, &
45 : do_method_lrigpw, do_method_mndo, do_method_mndod, do_method_ofgpw, do_method_pdg, &
46 : do_method_pm3, do_method_pm6, do_method_pm6fm, do_method_pnnl, do_method_rigpw, &
47 : do_method_rm1, do_method_xtb, do_pwgrid_ns_fullspace, do_pwgrid_ns_halfspace, &
48 : do_pwgrid_spherical, do_s2_constraint, do_s2_restraint, do_se_is_kdso, do_se_is_kdso_d, &
49 : do_se_is_slater, do_se_lr_ewald, do_se_lr_ewald_gks, do_se_lr_ewald_r3, do_se_lr_none, &
50 : gapw_1c_large, gapw_1c_medium, gapw_1c_orb, gapw_1c_small, gapw_1c_very_large, &
51 : gaussian_env, no_admm_type, numerical, ramp_env, real_time_propagation, sccs_andreussi, &
52 : sccs_derivative_cd3, sccs_derivative_cd5, sccs_derivative_cd7, sccs_derivative_fft, &
53 : sccs_fattebert_gygi, sic_ad, sic_eo, sic_list_all, sic_list_unpaired, sic_mauri_spz, &
54 : sic_mauri_us, sic_none, slater, tddfpt_dipole_length, tddfpt_excitations, &
55 : tddfpt_kernel_stda, use_mom_ref_user, xtb_vdw_type_d3, xtb_vdw_type_d4, xtb_vdw_type_none
56 : USE input_cp2k_check, ONLY: xc_functionals_expand
57 : USE input_cp2k_dft, ONLY: create_dft_section
58 : USE input_enumeration_types, ONLY: enum_i2c,&
59 : enumeration_type
60 : USE input_keyword_types, ONLY: keyword_get,&
61 : keyword_type
62 : USE input_section_types, ONLY: &
63 : section_get_ival, section_get_keyword, section_release, section_type, section_vals_get, &
64 : section_vals_get_subs_vals, section_vals_type, section_vals_val_get, section_vals_val_set
65 : USE kinds, ONLY: default_path_length,&
66 : default_string_length,&
67 : dp
68 : USE mathconstants, ONLY: fourpi
69 : USE pair_potential_types, ONLY: pair_potential_reallocate
70 : USE periodic_table, ONLY: get_ptable_info
71 : USE qs_cdft_utils, ONLY: read_cdft_control_section
72 : USE smeagol_control_types, ONLY: read_smeagol_control
73 : USE string_utilities, ONLY: uppercase
74 : USE util, ONLY: sort
75 : USE xc, ONLY: xc_uses_kinetic_energy_density,&
76 : xc_uses_norm_drho
77 : USE xc_input_constants, ONLY: xc_deriv_collocate
78 : USE xc_write_output, ONLY: xc_write
79 : #include "./base/base_uses.f90"
80 :
81 : IMPLICIT NONE
82 :
83 : PRIVATE
84 :
85 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_control_utils'
86 :
87 : PUBLIC :: read_dft_control, &
88 : read_mgrid_section, &
89 : read_qs_section, &
90 : read_tddfpt_control, &
91 : read_tddfpt2_control, &
92 : write_dft_control, &
93 : write_qs_control, &
94 : write_admm_control, &
95 : read_ddapc_section
96 : CONTAINS
97 :
98 : ! **************************************************************************************************
99 : !> \brief ...
100 : !> \param dft_control ...
101 : !> \param dft_section ...
102 : ! **************************************************************************************************
103 86918 : SUBROUTINE read_dft_control(dft_control, dft_section)
104 : TYPE(dft_control_type), POINTER :: dft_control
105 : TYPE(section_vals_type), POINTER :: dft_section
106 :
107 : CHARACTER(len=default_path_length) :: basis_set_file_name, potential_file_name
108 : CHARACTER(LEN=default_string_length), &
109 6686 : DIMENSION(:), POINTER :: tmpstringlist
110 : INTEGER :: admmtype, excitations, irep, isize, &
111 : method_id, nrep, xc_deriv_method_id
112 : LOGICAL :: do_ot, do_rtp, exopt1, exopt2, exopt3, &
113 : explicit, is_present, l_param, not_SE, &
114 : was_present
115 : REAL(KIND=dp) :: density_cut, gradient_cut, tau_cut
116 6686 : REAL(KIND=dp), DIMENSION(:), POINTER :: pol
117 : TYPE(cp_logger_type), POINTER :: logger
118 : TYPE(section_vals_type), POINTER :: maxwell_section, sccs_section, &
119 : scf_section, tmp_section, &
120 : xc_fun_section, xc_section
121 :
122 6686 : was_present = .FALSE.
123 :
124 6686 : logger => cp_get_default_logger()
125 :
126 6686 : NULLIFY (tmp_section, xc_fun_section, xc_section)
127 6686 : ALLOCATE (dft_control)
128 6686 : CALL dft_control_create(dft_control)
129 : ! determine wheather this is a semiempirical or DFTB run
130 : ! --> (no XC section needs to be provided)
131 6686 : not_SE = .TRUE.
132 6686 : CALL section_vals_val_get(dft_section, "QS%METHOD", i_val=method_id)
133 1504 : SELECT CASE (method_id)
134 : CASE (do_method_dftb, do_method_xtb, do_method_mndo, do_method_am1, do_method_pm3, do_method_pnnl, &
135 : do_method_pm6, do_method_pm6fm, do_method_pdg, do_method_rm1, do_method_mndod)
136 6686 : not_SE = .FALSE.
137 : END SELECT
138 : ! Check for XC section and XC_FUNCTIONAL section
139 6686 : xc_section => section_vals_get_subs_vals(dft_section, "XC")
140 6686 : CALL section_vals_get(xc_section, explicit=is_present)
141 6686 : IF (.NOT. is_present .AND. not_SE) THEN
142 0 : CPABORT("XC section missing.")
143 : END IF
144 6686 : IF (is_present) THEN
145 5194 : CALL section_vals_val_get(xc_section, "density_cutoff", r_val=density_cut)
146 5194 : CALL section_vals_val_get(xc_section, "gradient_cutoff", r_val=gradient_cut)
147 5194 : CALL section_vals_val_get(xc_section, "tau_cutoff", r_val=tau_cut)
148 : ! Perform numerical stability checks and possibly correct the issues
149 5194 : IF (density_cut <= EPSILON(0.0_dp)*100.0_dp) &
150 : CALL cp_warn(__LOCATION__, &
151 : "DENSITY_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
152 0 : "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
153 5194 : density_cut = MAX(EPSILON(0.0_dp)*100.0_dp, density_cut)
154 5194 : IF (gradient_cut <= EPSILON(0.0_dp)*100.0_dp) &
155 : CALL cp_warn(__LOCATION__, &
156 : "GRADIENT_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
157 0 : "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
158 5194 : gradient_cut = MAX(EPSILON(0.0_dp)*100.0_dp, gradient_cut)
159 5194 : IF (tau_cut <= EPSILON(0.0_dp)*100.0_dp) &
160 : CALL cp_warn(__LOCATION__, &
161 : "TAU_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
162 0 : "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
163 5194 : tau_cut = MAX(EPSILON(0.0_dp)*100.0_dp, tau_cut)
164 5194 : CALL section_vals_val_set(xc_section, "density_cutoff", r_val=density_cut)
165 5194 : CALL section_vals_val_set(xc_section, "gradient_cutoff", r_val=gradient_cut)
166 5194 : CALL section_vals_val_set(xc_section, "tau_cutoff", r_val=tau_cut)
167 : END IF
168 6686 : xc_fun_section => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
169 6686 : CALL section_vals_get(xc_fun_section, explicit=is_present)
170 6686 : IF (.NOT. is_present .AND. not_SE) THEN
171 0 : CPABORT("XC_FUNCTIONAL section missing.")
172 : END IF
173 6686 : scf_section => section_vals_get_subs_vals(dft_section, "SCF")
174 6686 : CALL section_vals_val_get(dft_section, "UKS", l_val=dft_control%uks)
175 6686 : CALL section_vals_val_get(dft_section, "ROKS", l_val=dft_control%roks)
176 6686 : IF (dft_control%uks .OR. dft_control%roks) THEN
177 1483 : dft_control%nspins = 2
178 : ELSE
179 5203 : dft_control%nspins = 1
180 : END IF
181 :
182 6686 : dft_control%lsd = (dft_control%nspins > 1)
183 6686 : dft_control%use_kinetic_energy_density = xc_uses_kinetic_energy_density(xc_fun_section, dft_control%lsd)
184 :
185 6686 : xc_deriv_method_id = section_get_ival(xc_section, "XC_GRID%XC_DERIV")
186 : dft_control%drho_by_collocation = (xc_uses_norm_drho(xc_fun_section, dft_control%lsd) &
187 6686 : .AND. (xc_deriv_method_id == xc_deriv_collocate))
188 6686 : IF (dft_control%drho_by_collocation) THEN
189 0 : CPABORT("derivatives by collocation not implemented")
190 : END IF
191 :
192 : ! Automatic auxiliary basis set generation
193 6686 : CALL section_vals_val_get(dft_section, "AUTO_BASIS", n_rep_val=nrep)
194 13372 : DO irep = 1, nrep
195 6686 : CALL section_vals_val_get(dft_section, "AUTO_BASIS", i_rep_val=irep, c_vals=tmpstringlist)
196 13372 : IF (SIZE(tmpstringlist) == 2) THEN
197 6686 : CALL uppercase(tmpstringlist(2))
198 6686 : SELECT CASE (tmpstringlist(2))
199 : CASE ("X")
200 78 : isize = -1
201 : CASE ("SMALL")
202 78 : isize = 0
203 : CASE ("MEDIUM")
204 48 : isize = 1
205 : CASE ("LARGE")
206 0 : isize = 2
207 : CASE ("HUGE")
208 2 : isize = 3
209 : CASE DEFAULT
210 6686 : CPWARN("Unknown basis size in AUTO_BASIS keyword:"//TRIM(tmpstringlist(1)))
211 : END SELECT
212 : !
213 6688 : SELECT CASE (tmpstringlist(1))
214 : CASE ("X")
215 : CASE ("RI_AUX")
216 2 : dft_control%auto_basis_ri_aux = isize
217 : CASE ("AUX_FIT")
218 0 : dft_control%auto_basis_aux_fit = isize
219 : CASE ("LRI_AUX")
220 0 : dft_control%auto_basis_lri_aux = isize
221 : CASE ("P_LRI_AUX")
222 0 : dft_control%auto_basis_p_lri_aux = isize
223 : CASE ("RI_HXC")
224 0 : dft_control%auto_basis_ri_hxc = isize
225 : CASE ("RI_XAS")
226 48 : dft_control%auto_basis_ri_xas = isize
227 : CASE ("RI_HFX")
228 78 : dft_control%auto_basis_ri_hfx = isize
229 : CASE DEFAULT
230 6686 : CPWARN("Unknown basis type in AUTO_BASIS keyword:"//TRIM(tmpstringlist(1)))
231 : END SELECT
232 : ELSE
233 : CALL cp_abort(__LOCATION__, &
234 0 : "AUTO_BASIS keyword in &DFT section has a wrong number of arguments.")
235 : END IF
236 : END DO
237 :
238 : !! check if we do wavefunction fitting
239 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD")
240 6686 : CALL section_vals_get(tmp_section, explicit=is_present)
241 6686 : dft_control%do_admm = is_present
242 6686 : dft_control%do_admm_mo = .FALSE.
243 6686 : dft_control%do_admm_dm = .FALSE.
244 6686 : IF (is_present) THEN
245 : do_ot = .FALSE.
246 442 : CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=do_ot)
247 442 : CALL admm_control_create(dft_control%admm_control)
248 :
249 442 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_TYPE", i_val=admmtype)
250 442 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", explicit=exopt1)
251 442 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%METHOD", explicit=exopt2)
252 442 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_SCALING_MODEL", explicit=exopt3)
253 442 : dft_control%admm_control%admm_type = admmtype
254 432 : SELECT CASE (admmtype)
255 : CASE (no_admm_type)
256 432 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", i_val=method_id)
257 432 : dft_control%admm_control%purification_method = method_id
258 432 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%METHOD", i_val=method_id)
259 432 : dft_control%admm_control%method = method_id
260 432 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_SCALING_MODEL", i_val=method_id)
261 432 : dft_control%admm_control%scaling_model = method_id
262 : CASE (admm1_type)
263 : ! METHOD BASIS_PROJECTION
264 : ! ADMM_PURIFICATION_METHOD choose
265 : ! EXCH_SCALING_MODEL NONE
266 2 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", i_val=method_id)
267 2 : dft_control%admm_control%purification_method = method_id
268 2 : dft_control%admm_control%method = do_admm_basis_projection
269 2 : dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
270 : CASE (admm2_type)
271 : ! METHOD BASIS_PROJECTION
272 : ! ADMM_PURIFICATION_METHOD NONE
273 : ! EXCH_SCALING_MODEL NONE
274 2 : dft_control%admm_control%purification_method = do_admm_purify_none
275 2 : dft_control%admm_control%method = do_admm_basis_projection
276 2 : dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
277 : CASE (admms_type)
278 : ! ADMM_PURIFICATION_METHOD NONE
279 : ! METHOD CHARGE_CONSTRAINED_PROJECTION
280 : ! EXCH_SCALING_MODEL MERLOT
281 2 : dft_control%admm_control%purification_method = do_admm_purify_none
282 2 : dft_control%admm_control%method = do_admm_charge_constrained_projection
283 2 : dft_control%admm_control%scaling_model = do_admm_exch_scaling_merlot
284 : CASE (admmp_type)
285 : ! ADMM_PURIFICATION_METHOD NONE
286 : ! METHOD BASIS_PROJECTION
287 : ! EXCH_SCALING_MODEL MERLOT
288 2 : dft_control%admm_control%purification_method = do_admm_purify_none
289 2 : dft_control%admm_control%method = do_admm_basis_projection
290 2 : dft_control%admm_control%scaling_model = do_admm_exch_scaling_merlot
291 : CASE (admmq_type)
292 : ! ADMM_PURIFICATION_METHOD NONE
293 : ! METHOD CHARGE_CONSTRAINED_PROJECTION
294 : ! EXCH_SCALING_MODEL NONE
295 2 : dft_control%admm_control%purification_method = do_admm_purify_none
296 2 : dft_control%admm_control%method = do_admm_charge_constrained_projection
297 2 : dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
298 : CASE DEFAULT
299 : CALL cp_abort(__LOCATION__, &
300 442 : "ADMM_TYPE keyword in &AUXILIARY_DENSITY_MATRIX_METHOD section has a wrong value.")
301 : END SELECT
302 :
303 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EPS_FILTER", &
304 442 : r_val=dft_control%admm_control%eps_filter)
305 :
306 442 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_CORRECTION_FUNC", i_val=method_id)
307 442 : dft_control%admm_control%aux_exch_func = method_id
308 :
309 : ! parameters for X functional
310 442 : dft_control%admm_control%aux_exch_func_param = .FALSE.
311 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_A1", explicit=explicit, &
312 442 : r_val=dft_control%admm_control%aux_x_param(1))
313 442 : IF (explicit) dft_control%admm_control%aux_exch_func_param = .TRUE.
314 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_A2", explicit=explicit, &
315 442 : r_val=dft_control%admm_control%aux_x_param(2))
316 442 : IF (explicit) dft_control%admm_control%aux_exch_func_param = .TRUE.
317 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_GAMMA", explicit=explicit, &
318 442 : r_val=dft_control%admm_control%aux_x_param(3))
319 442 : IF (explicit) dft_control%admm_control%aux_exch_func_param = .TRUE.
320 :
321 442 : CALL read_admm_block_list(dft_control%admm_control, dft_section)
322 :
323 : ! check for double assignments
324 2 : SELECT CASE (admmtype)
325 : CASE (admm2_type)
326 2 : IF (exopt2) CALL cp_warn(__LOCATION__, &
327 0 : "Value of ADMM_PURIFICATION_METHOD keyword will be overwritten with ADMM_TYPE selections.")
328 2 : IF (exopt3) CALL cp_warn(__LOCATION__, &
329 0 : "Value of EXCH_SCALING_MODEL keyword will be overwritten with ADMM_TYPE selections.")
330 : CASE (admm1_type, admms_type, admmp_type, admmq_type)
331 8 : IF (exopt1) CALL cp_warn(__LOCATION__, &
332 0 : "Value of METHOD keyword will be overwritten with ADMM_TYPE selections.")
333 8 : IF (exopt2) CALL cp_warn(__LOCATION__, &
334 0 : "Value of METHOD keyword will be overwritten with ADMM_TYPE selections.")
335 8 : IF (exopt3) CALL cp_warn(__LOCATION__, &
336 442 : "Value of EXCH_SCALING_MODEL keyword will be overwritten with ADMM_TYPE selections.")
337 : END SELECT
338 :
339 : ! In the case of charge-constrained projection (e.g. according to Merlot),
340 : ! there is no purification needed and hence, do_admm_purify_none has to be set.
341 :
342 : IF ((dft_control%admm_control%method == do_admm_blocking_purify_full .OR. &
343 : dft_control%admm_control%method == do_admm_blocked_projection) &
344 442 : .AND. dft_control%admm_control%scaling_model == do_admm_exch_scaling_merlot) THEN
345 0 : CPABORT("ADMM: Blocking and Merlot scaling are mutually exclusive.")
346 : END IF
347 :
348 442 : IF (dft_control%admm_control%method == do_admm_charge_constrained_projection .AND. &
349 : dft_control%admm_control%purification_method /= do_admm_purify_none) THEN
350 : CALL cp_abort(__LOCATION__, &
351 : "ADMM: In the case of METHOD=CHARGE_CONSTRAINED_PROJECTION, "// &
352 0 : "ADMM_PURIFICATION_METHOD=NONE has to be set.")
353 : END IF
354 :
355 442 : IF (dft_control%admm_control%purification_method == do_admm_purify_mo_diag .OR. &
356 : dft_control%admm_control%purification_method == do_admm_purify_mo_no_diag) THEN
357 60 : IF (dft_control%admm_control%method /= do_admm_basis_projection) &
358 0 : CPABORT("ADMM: Chosen purification requires BASIS_PROJECTION")
359 :
360 60 : IF (.NOT. do_ot) CPABORT("ADMM: MO-based purification requires OT.")
361 : END IF
362 :
363 442 : IF (dft_control%admm_control%purification_method == do_admm_purify_none_dm .OR. &
364 : dft_control%admm_control%purification_method == do_admm_purify_mcweeny) THEN
365 14 : dft_control%do_admm_dm = .TRUE.
366 : ELSE
367 428 : dft_control%do_admm_mo = .TRUE.
368 : END IF
369 : END IF
370 :
371 : ! Set restricted to true, if both OT and ROKS are requested
372 : !MK in principle dft_control%restricted could be dropped completely like the
373 : !MK input key by using only dft_control%roks now
374 6686 : CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=l_param)
375 6686 : dft_control%restricted = (dft_control%roks .AND. l_param)
376 :
377 6686 : CALL section_vals_val_get(dft_section, "CHARGE", i_val=dft_control%charge)
378 6686 : CALL section_vals_val_get(dft_section, "MULTIPLICITY", i_val=dft_control%multiplicity)
379 6686 : CALL section_vals_val_get(dft_section, "RELAX_MULTIPLICITY", r_val=dft_control%relax_multiplicity)
380 6686 : IF (dft_control%relax_multiplicity > 0.0_dp) THEN
381 8 : IF (.NOT. dft_control%uks) &
382 : CALL cp_abort(__LOCATION__, "The option RELAX_MULTIPLICITY is only valid for "// &
383 0 : "unrestricted Kohn-Sham (UKS) calculations")
384 : END IF
385 :
386 : ! check for the presence of the low spin roks section
387 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "LOW_SPIN_ROKS")
388 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%low_spin_roks)
389 :
390 6686 : dft_control%sic_method_id = sic_none
391 6686 : dft_control%sic_scaling_a = 1.0_dp
392 6686 : dft_control%sic_scaling_b = 1.0_dp
393 :
394 : ! DFT+U
395 6686 : dft_control%dft_plus_u = .FALSE.
396 6686 : CALL section_vals_val_get(dft_section, "PLUS_U_METHOD", i_val=method_id)
397 6686 : dft_control%plus_u_method_id = method_id
398 :
399 : ! Smearing in use
400 6686 : dft_control%smear = .FALSE.
401 :
402 : ! Surface dipole correction
403 6686 : dft_control%correct_surf_dip = .FALSE.
404 6686 : CALL section_vals_val_get(dft_section, "SURFACE_DIPOLE_CORRECTION", l_val=dft_control%correct_surf_dip)
405 6686 : CALL section_vals_val_get(dft_section, "SURF_DIP_DIR", i_val=dft_control%dir_surf_dip)
406 6686 : dft_control%pos_dir_surf_dip = -1.0_dp
407 6686 : CALL section_vals_val_get(dft_section, "SURF_DIP_POS", r_val=dft_control%pos_dir_surf_dip)
408 : ! another logical variable, surf_dip_correct_switch, is introduced for
409 : ! implementation of "SURF_DIP_SWITCH" [SGh]
410 6686 : dft_control%switch_surf_dip = .FALSE.
411 6686 : dft_control%surf_dip_correct_switch = dft_control%correct_surf_dip
412 6686 : CALL section_vals_val_get(dft_section, "SURF_DIP_SWITCH", l_val=dft_control%switch_surf_dip)
413 6686 : dft_control%correct_el_density_dip = .FALSE.
414 6686 : CALL section_vals_val_get(dft_section, "CORE_CORR_DIP", l_val=dft_control%correct_el_density_dip)
415 6686 : IF (dft_control%correct_el_density_dip) THEN
416 4 : IF (dft_control%correct_surf_dip) THEN
417 : ! Do nothing, move on
418 : ELSE
419 0 : dft_control%correct_el_density_dip = .FALSE.
420 0 : CPWARN("CORE_CORR_DIP keyword is activated only if SURFACE_DIPOLE_CORRECTION is TRUE")
421 : END IF
422 : END IF
423 :
424 : CALL section_vals_val_get(dft_section, "BASIS_SET_FILE_NAME", &
425 6686 : c_val=basis_set_file_name)
426 : CALL section_vals_val_get(dft_section, "POTENTIAL_FILE_NAME", &
427 6686 : c_val=potential_file_name)
428 :
429 : ! Read the input section
430 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "sic")
431 : CALL section_vals_val_get(tmp_section, "SIC_METHOD", &
432 6686 : i_val=dft_control%sic_method_id)
433 : CALL section_vals_val_get(tmp_section, "ORBITAL_SET", &
434 6686 : i_val=dft_control%sic_list_id)
435 : CALL section_vals_val_get(tmp_section, "SIC_SCALING_A", &
436 6686 : r_val=dft_control%sic_scaling_a)
437 : CALL section_vals_val_get(tmp_section, "SIC_SCALING_B", &
438 6686 : r_val=dft_control%sic_scaling_b)
439 :
440 : ! Determine if this is a TDDFPT run
441 6686 : CALL section_vals_val_get(dft_section, "EXCITATIONS", i_val=excitations)
442 6686 : dft_control%do_tddfpt_calculation = (excitations == tddfpt_excitations)
443 6686 : IF (dft_control%do_tddfpt_calculation) THEN
444 12 : CALL tddfpt_control_create(dft_control%tddfpt_control)
445 : END IF
446 :
447 6686 : do_rtp = .FALSE.
448 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "REAL_TIME_PROPAGATION")
449 6686 : CALL section_vals_get(tmp_section, explicit=is_present)
450 6686 : IF (is_present) THEN
451 248 : CALL read_rtp_section(dft_control, tmp_section)
452 248 : do_rtp = .TRUE.
453 : END IF
454 :
455 : ! Read the input section
456 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "XAS")
457 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%do_xas_calculation)
458 6686 : IF (dft_control%do_xas_calculation) THEN
459 : ! Override with section parameter
460 : CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
461 42 : l_val=dft_control%do_xas_calculation)
462 : END IF
463 :
464 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "XAS_TDP")
465 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%do_xas_tdp_calculation)
466 6686 : IF (dft_control%do_xas_tdp_calculation) THEN
467 : ! Override with section parameter
468 : CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
469 50 : l_val=dft_control%do_xas_tdp_calculation)
470 : END IF
471 :
472 : ! Read the finite field input section
473 6686 : dft_control%apply_efield = .FALSE.
474 6686 : dft_control%apply_efield_field = .FALSE. !this is for RTP
475 6686 : dft_control%apply_vector_potential = .FALSE. !this is for RTP
476 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "EFIELD")
477 6686 : CALL section_vals_get(tmp_section, n_repetition=nrep, explicit=is_present)
478 6686 : IF (is_present) THEN
479 1008 : ALLOCATE (dft_control%efield_fields(nrep))
480 252 : CALL read_efield_sections(dft_control, tmp_section)
481 252 : IF (do_rtp) THEN
482 24 : IF (.NOT. dft_control%rtp_control%velocity_gauge) THEN
483 16 : dft_control%apply_efield_field = .TRUE.
484 : ELSE
485 8 : dft_control%apply_vector_potential = .TRUE.
486 : ! Use this input value of vector potential to (re)start RTP
487 32 : dft_control%rtp_control%vec_pot = dft_control%efield_fields(1)%efield%vec_pot_initial
488 : END IF
489 : ELSE
490 228 : dft_control%apply_efield = .TRUE.
491 228 : CPASSERT(nrep == 1)
492 : END IF
493 : END IF
494 :
495 : ! Read the finite field input section for periodic fields
496 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "PERIODIC_EFIELD")
497 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%apply_period_efield)
498 6686 : IF (dft_control%apply_period_efield) THEN
499 406 : ALLOCATE (dft_control%period_efield)
500 58 : CALL section_vals_val_get(tmp_section, "POLARISATION", r_vals=pol)
501 406 : dft_control%period_efield%polarisation(1:3) = pol(1:3)
502 58 : CALL section_vals_val_get(tmp_section, "D_FILTER", r_vals=pol)
503 406 : dft_control%period_efield%d_filter(1:3) = pol(1:3)
504 : CALL section_vals_val_get(tmp_section, "INTENSITY", &
505 58 : r_val=dft_control%period_efield%strength)
506 58 : dft_control%period_efield%displacement_field = .FALSE.
507 : CALL section_vals_val_get(tmp_section, "DISPLACEMENT_FIELD", &
508 58 : l_val=dft_control%period_efield%displacement_field)
509 : ! periodic fields don't work with RTP
510 58 : CPASSERT(.NOT. do_rtp)
511 58 : IF (dft_control%period_efield%displacement_field) THEN
512 16 : CALL cite_reference(Stengel2009)
513 : ELSE
514 42 : CALL cite_reference(Souza2002)
515 42 : CALL cite_reference(Umari2002)
516 : END IF
517 : END IF
518 :
519 : ! Read the external potential input section
520 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_POTENTIAL")
521 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_potential)
522 6686 : IF (dft_control%apply_external_potential) THEN
523 16 : CALL expot_control_create(dft_control%expot_control)
524 : CALL section_vals_val_get(tmp_section, "READ_FROM_CUBE", &
525 16 : l_val=dft_control%expot_control%read_from_cube)
526 : CALL section_vals_val_get(tmp_section, "STATIC", &
527 16 : l_val=dft_control%expot_control%static)
528 : CALL section_vals_val_get(tmp_section, "SCALING_FACTOR", &
529 16 : r_val=dft_control%expot_control%scaling_factor)
530 : ! External potential using Maxwell equation
531 16 : maxwell_section => section_vals_get_subs_vals(tmp_section, "MAXWELL")
532 16 : CALL section_vals_get(maxwell_section, explicit=is_present)
533 16 : IF (is_present) THEN
534 0 : dft_control%expot_control%maxwell_solver = .TRUE.
535 0 : CALL maxwell_control_create(dft_control%maxwell_control)
536 : ! read the input values from Maxwell section
537 : CALL section_vals_val_get(maxwell_section, "TEST_REAL", &
538 0 : r_val=dft_control%maxwell_control%real_test)
539 : CALL section_vals_val_get(maxwell_section, "TEST_INTEGER", &
540 0 : i_val=dft_control%maxwell_control%int_test)
541 : CALL section_vals_val_get(maxwell_section, "TEST_LOGICAL", &
542 0 : l_val=dft_control%maxwell_control%log_test)
543 : ELSE
544 16 : dft_control%expot_control%maxwell_solver = .FALSE.
545 : END IF
546 : END IF
547 :
548 : ! Read the SCCS input section if present
549 6686 : sccs_section => section_vals_get_subs_vals(dft_section, "SCCS")
550 6686 : CALL section_vals_get(sccs_section, explicit=is_present)
551 6686 : IF (is_present) THEN
552 : ! Check section parameter if SCCS is activated
553 : CALL section_vals_val_get(sccs_section, "_SECTION_PARAMETERS_", &
554 10 : l_val=dft_control%do_sccs)
555 10 : IF (dft_control%do_sccs) THEN
556 10 : ALLOCATE (dft_control%sccs_control)
557 : CALL section_vals_val_get(sccs_section, "RELATIVE_PERMITTIVITY", &
558 10 : r_val=dft_control%sccs_control%epsilon_solvent)
559 : CALL section_vals_val_get(sccs_section, "ALPHA", &
560 10 : r_val=dft_control%sccs_control%alpha_solvent)
561 : CALL section_vals_val_get(sccs_section, "BETA", &
562 10 : r_val=dft_control%sccs_control%beta_solvent)
563 : CALL section_vals_val_get(sccs_section, "DELTA_RHO", &
564 10 : r_val=dft_control%sccs_control%delta_rho)
565 : CALL section_vals_val_get(sccs_section, "DERIVATIVE_METHOD", &
566 10 : i_val=dft_control%sccs_control%derivative_method)
567 : CALL section_vals_val_get(sccs_section, "METHOD", &
568 10 : i_val=dft_control%sccs_control%method_id)
569 : CALL section_vals_val_get(sccs_section, "EPS_SCCS", &
570 10 : r_val=dft_control%sccs_control%eps_sccs)
571 : CALL section_vals_val_get(sccs_section, "EPS_SCF", &
572 10 : r_val=dft_control%sccs_control%eps_scf)
573 : CALL section_vals_val_get(sccs_section, "GAMMA", &
574 10 : r_val=dft_control%sccs_control%gamma_solvent)
575 : CALL section_vals_val_get(sccs_section, "MAX_ITER", &
576 10 : i_val=dft_control%sccs_control%max_iter)
577 : CALL section_vals_val_get(sccs_section, "MIXING", &
578 10 : r_val=dft_control%sccs_control%mixing)
579 18 : SELECT CASE (dft_control%sccs_control%method_id)
580 : CASE (sccs_andreussi)
581 8 : tmp_section => section_vals_get_subs_vals(sccs_section, "ANDREUSSI")
582 : CALL section_vals_val_get(tmp_section, "RHO_MAX", &
583 8 : r_val=dft_control%sccs_control%rho_max)
584 : CALL section_vals_val_get(tmp_section, "RHO_MIN", &
585 8 : r_val=dft_control%sccs_control%rho_min)
586 8 : IF (dft_control%sccs_control%rho_max < dft_control%sccs_control%rho_min) THEN
587 : CALL cp_abort(__LOCATION__, &
588 : "The SCCS parameter RHO_MAX is smaller than RHO_MIN. "// &
589 0 : "Please, check your input!")
590 : END IF
591 8 : CALL cite_reference(Andreussi2012)
592 : CASE (sccs_fattebert_gygi)
593 2 : tmp_section => section_vals_get_subs_vals(sccs_section, "FATTEBERT-GYGI")
594 : CALL section_vals_val_get(tmp_section, "BETA", &
595 2 : r_val=dft_control%sccs_control%beta)
596 2 : IF (dft_control%sccs_control%beta < 0.5_dp) THEN
597 : CALL cp_abort(__LOCATION__, &
598 : "A value smaller than 0.5 for the SCCS parameter beta "// &
599 0 : "causes numerical problems. Please, check your input!")
600 : END IF
601 : CALL section_vals_val_get(tmp_section, "RHO_ZERO", &
602 2 : r_val=dft_control%sccs_control%rho_zero)
603 2 : CALL cite_reference(Fattebert2002)
604 : CASE DEFAULT
605 10 : CPABORT("Invalid SCCS model specified. Please, check your input!")
606 : END SELECT
607 10 : CALL cite_reference(Yin2017)
608 : END IF
609 : END IF
610 :
611 : ! ZMP added input sections
612 : ! Read the external density input section
613 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_DENSITY")
614 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_density)
615 :
616 : ! Read the external vxc input section
617 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_VXC")
618 6686 : CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_vxc)
619 :
620 : ! SMEAGOL interface
621 6686 : tmp_section => section_vals_get_subs_vals(dft_section, "SMEAGOL")
622 6686 : CALL read_smeagol_control(dft_control%smeagol_control, tmp_section)
623 :
624 6686 : END SUBROUTINE read_dft_control
625 :
626 : ! **************************************************************************************************
627 : !> \brief ...
628 : !> \param qs_control ...
629 : !> \param dft_section ...
630 : ! **************************************************************************************************
631 6686 : SUBROUTINE read_mgrid_section(qs_control, dft_section)
632 :
633 : TYPE(qs_control_type), INTENT(INOUT) :: qs_control
634 : TYPE(section_vals_type), POINTER :: dft_section
635 :
636 : CHARACTER(len=*), PARAMETER :: routineN = 'read_mgrid_section'
637 :
638 : INTEGER :: handle, igrid_level, ngrid_level
639 : LOGICAL :: explicit, multigrid_set
640 : REAL(dp) :: cutoff
641 6686 : REAL(dp), DIMENSION(:), POINTER :: cutofflist
642 : TYPE(section_vals_type), POINTER :: mgrid_section
643 :
644 6686 : CALL timeset(routineN, handle)
645 :
646 6686 : NULLIFY (mgrid_section, cutofflist)
647 6686 : mgrid_section => section_vals_get_subs_vals(dft_section, "MGRID")
648 :
649 6686 : CALL section_vals_val_get(mgrid_section, "NGRIDS", i_val=ngrid_level)
650 6686 : CALL section_vals_val_get(mgrid_section, "MULTIGRID_SET", l_val=multigrid_set)
651 6686 : CALL section_vals_val_get(mgrid_section, "CUTOFF", r_val=cutoff)
652 6686 : CALL section_vals_val_get(mgrid_section, "PROGRESSION_FACTOR", r_val=qs_control%progression_factor)
653 6686 : CALL section_vals_val_get(mgrid_section, "COMMENSURATE", l_val=qs_control%commensurate_mgrids)
654 6686 : CALL section_vals_val_get(mgrid_section, "REALSPACE", l_val=qs_control%realspace_mgrids)
655 6686 : CALL section_vals_val_get(mgrid_section, "REL_CUTOFF", r_val=qs_control%relative_cutoff)
656 : CALL section_vals_val_get(mgrid_section, "SKIP_LOAD_BALANCE_DISTRIBUTED", &
657 6686 : l_val=qs_control%skip_load_balance_distributed)
658 :
659 : ! For SE and DFTB possibly override with new defaults
660 6686 : IF (qs_control%semi_empirical .OR. qs_control%dftb .OR. qs_control%xtb) THEN
661 1504 : ngrid_level = 1
662 1504 : multigrid_set = .FALSE.
663 : ! Override default cutoff value unless user specified an explicit argument..
664 1504 : CALL section_vals_val_get(mgrid_section, "CUTOFF", explicit=explicit, r_val=cutoff)
665 1504 : IF (.NOT. explicit) cutoff = 1.0_dp
666 : END IF
667 :
668 20058 : ALLOCATE (qs_control%e_cutoff(ngrid_level))
669 6686 : qs_control%cutoff = cutoff
670 :
671 6686 : IF (multigrid_set) THEN
672 : ! Read the values from input
673 4 : IF (qs_control%commensurate_mgrids) THEN
674 0 : CPABORT("Do not specify cutoffs for the commensurate grids (NYI)")
675 : END IF
676 :
677 4 : CALL section_vals_val_get(mgrid_section, "MULTIGRID_CUTOFF", r_vals=cutofflist)
678 4 : IF (ASSOCIATED(cutofflist)) THEN
679 4 : IF (SIZE(cutofflist, 1) /= ngrid_level) THEN
680 0 : CPABORT("Number of multi-grids requested and number of cutoff values do not match")
681 : END IF
682 20 : DO igrid_level = 1, ngrid_level
683 20 : qs_control%e_cutoff(igrid_level) = cutofflist(igrid_level)
684 : END DO
685 : END IF
686 : ! set cutoff to smallest value in multgrid available with >= cutoff
687 20 : DO igrid_level = ngrid_level, 1, -1
688 16 : IF (qs_control%cutoff <= qs_control%e_cutoff(igrid_level)) THEN
689 0 : qs_control%cutoff = qs_control%e_cutoff(igrid_level)
690 0 : EXIT
691 : END IF
692 : ! set largest grid value to cutoff
693 20 : IF (igrid_level == 1) THEN
694 4 : qs_control%cutoff = qs_control%e_cutoff(1)
695 : END IF
696 : END DO
697 : ELSE
698 6682 : IF (qs_control%commensurate_mgrids) qs_control%progression_factor = 4.0_dp
699 6682 : qs_control%e_cutoff(1) = qs_control%cutoff
700 22082 : DO igrid_level = 2, ngrid_level
701 : qs_control%e_cutoff(igrid_level) = qs_control%e_cutoff(igrid_level - 1)/ &
702 22082 : qs_control%progression_factor
703 : END DO
704 : END IF
705 : ! check that multigrids are ordered
706 22098 : DO igrid_level = 2, ngrid_level
707 22098 : IF (qs_control%e_cutoff(igrid_level) > qs_control%e_cutoff(igrid_level - 1)) THEN
708 0 : CPABORT("The cutoff values for the multi-grids are not ordered from large to small")
709 15412 : ELSE IF (qs_control%e_cutoff(igrid_level) == qs_control%e_cutoff(igrid_level - 1)) THEN
710 0 : CPABORT("The same cutoff value was specified for two multi-grids")
711 : END IF
712 : END DO
713 6686 : CALL timestop(handle)
714 13372 : END SUBROUTINE read_mgrid_section
715 :
716 : ! **************************************************************************************************
717 : !> \brief ...
718 : !> \param qs_control ...
719 : !> \param qs_section ...
720 : ! **************************************************************************************************
721 106976 : SUBROUTINE read_qs_section(qs_control, qs_section)
722 :
723 : TYPE(qs_control_type), INTENT(INOUT) :: qs_control
724 : TYPE(section_vals_type), POINTER :: qs_section
725 :
726 : CHARACTER(len=*), PARAMETER :: routineN = 'read_qs_section'
727 :
728 : CHARACTER(LEN=default_string_length) :: cval
729 : CHARACTER(LEN=default_string_length), &
730 6686 : DIMENSION(:), POINTER :: clist
731 : INTEGER :: handle, itmp, j, jj, k, n_rep, n_var, &
732 : ngauss, ngp, nrep
733 6686 : INTEGER, DIMENSION(:), POINTER :: tmplist
734 : LOGICAL :: explicit, was_present
735 : REAL(dp) :: tmp, tmpsqrt, value
736 6686 : REAL(dp), POINTER :: scal(:)
737 : TYPE(section_vals_type), POINTER :: cdft_control_section, ddapc_restraint_section, &
738 : dftb_parameter, dftb_section, eeq_section, genpot_section, lri_optbas_section, &
739 : mull_section, nonbonded_section, s2_restraint_section, se_section, xtb_parameter, &
740 : xtb_section
741 :
742 6686 : CALL timeset(routineN, handle)
743 :
744 6686 : was_present = .FALSE.
745 6686 : NULLIFY (mull_section, ddapc_restraint_section, s2_restraint_section, &
746 6686 : se_section, dftb_section, xtb_section, dftb_parameter, xtb_parameter, lri_optbas_section, &
747 6686 : cdft_control_section, genpot_section, eeq_section)
748 :
749 6686 : mull_section => section_vals_get_subs_vals(qs_section, "MULLIKEN_RESTRAINT")
750 6686 : ddapc_restraint_section => section_vals_get_subs_vals(qs_section, "DDAPC_RESTRAINT")
751 6686 : s2_restraint_section => section_vals_get_subs_vals(qs_section, "S2_RESTRAINT")
752 6686 : se_section => section_vals_get_subs_vals(qs_section, "SE")
753 6686 : dftb_section => section_vals_get_subs_vals(qs_section, "DFTB")
754 6686 : xtb_section => section_vals_get_subs_vals(qs_section, "xTB")
755 6686 : dftb_parameter => section_vals_get_subs_vals(dftb_section, "PARAMETER")
756 6686 : xtb_parameter => section_vals_get_subs_vals(xtb_section, "PARAMETER")
757 6686 : eeq_section => section_vals_get_subs_vals(xtb_section, "EEQ")
758 6686 : lri_optbas_section => section_vals_get_subs_vals(qs_section, "OPTIMIZE_LRI_BASIS")
759 6686 : cdft_control_section => section_vals_get_subs_vals(qs_section, "CDFT")
760 6686 : nonbonded_section => section_vals_get_subs_vals(xtb_section, "NONBONDED")
761 6686 : genpot_section => section_vals_get_subs_vals(nonbonded_section, "GENPOT")
762 :
763 : ! Setup all defaults values and overwrite input parameters
764 : ! EPS_DEFAULT should set the target accuracy in the total energy (~per electron) or a closely related value
765 6686 : CALL section_vals_val_get(qs_section, "EPS_DEFAULT", r_val=value)
766 6686 : tmpsqrt = SQRT(value) ! a trick to work around a NAG 5.1 optimizer bug
767 :
768 : ! random choice ?
769 6686 : qs_control%eps_core_charge = value/100.0_dp
770 : ! correct if all Gaussians would have the same radius (overlap will be smaller than eps_pgf_orb**2).
771 : ! Can be significantly in error if not... requires fully new screening/pairlist procedures
772 6686 : qs_control%eps_pgf_orb = tmpsqrt
773 6686 : qs_control%eps_kg_orb = qs_control%eps_pgf_orb
774 : ! consistent since also a kind of overlap
775 6686 : qs_control%eps_ppnl = qs_control%eps_pgf_orb/100.0_dp
776 : ! accuracy is basically set by the overlap, this sets an empirical shift
777 6686 : qs_control%eps_ppl = 1.0E-2_dp
778 : !
779 6686 : qs_control%gapw_control%eps_cpc = value
780 : ! expexted error in the density
781 6686 : qs_control%eps_rho_gspace = value
782 6686 : qs_control%eps_rho_rspace = value
783 : ! error in the gradient, can be the sqrt of the error in the energy, ignored if map_consistent
784 6686 : qs_control%eps_gvg_rspace = tmpsqrt
785 : !
786 6686 : CALL section_vals_val_get(qs_section, "EPS_CORE_CHARGE", n_rep_val=n_rep)
787 6686 : IF (n_rep /= 0) THEN
788 0 : CALL section_vals_val_get(qs_section, "EPS_CORE_CHARGE", r_val=qs_control%eps_core_charge)
789 : END IF
790 6686 : CALL section_vals_val_get(qs_section, "EPS_GVG_RSPACE", n_rep_val=n_rep)
791 6686 : IF (n_rep /= 0) THEN
792 132 : CALL section_vals_val_get(qs_section, "EPS_GVG_RSPACE", r_val=qs_control%eps_gvg_rspace)
793 : END IF
794 6686 : CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", n_rep_val=n_rep)
795 6686 : IF (n_rep /= 0) THEN
796 612 : CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", r_val=qs_control%eps_pgf_orb)
797 : END IF
798 6686 : CALL section_vals_val_get(qs_section, "EPS_KG_ORB", n_rep_val=n_rep)
799 6686 : IF (n_rep /= 0) THEN
800 62 : CALL section_vals_val_get(qs_section, "EPS_KG_ORB", r_val=tmp)
801 62 : qs_control%eps_kg_orb = SQRT(tmp)
802 : END IF
803 6686 : CALL section_vals_val_get(qs_section, "EPS_PPL", n_rep_val=n_rep)
804 6686 : IF (n_rep /= 0) THEN
805 6686 : CALL section_vals_val_get(qs_section, "EPS_PPL", r_val=qs_control%eps_ppl)
806 : END IF
807 6686 : CALL section_vals_val_get(qs_section, "EPS_PPNL", n_rep_val=n_rep)
808 6686 : IF (n_rep /= 0) THEN
809 0 : CALL section_vals_val_get(qs_section, "EPS_PPNL", r_val=qs_control%eps_ppnl)
810 : END IF
811 6686 : CALL section_vals_val_get(qs_section, "EPS_RHO", n_rep_val=n_rep)
812 6686 : IF (n_rep /= 0) THEN
813 30 : CALL section_vals_val_get(qs_section, "EPS_RHO", r_val=qs_control%eps_rho_gspace)
814 30 : qs_control%eps_rho_rspace = qs_control%eps_rho_gspace
815 : END IF
816 6686 : CALL section_vals_val_get(qs_section, "EPS_RHO_RSPACE", n_rep_val=n_rep)
817 6686 : IF (n_rep /= 0) THEN
818 2 : CALL section_vals_val_get(qs_section, "EPS_RHO_RSPACE", r_val=qs_control%eps_rho_rspace)
819 : END IF
820 6686 : CALL section_vals_val_get(qs_section, "EPS_RHO_GSPACE", n_rep_val=n_rep)
821 6686 : IF (n_rep /= 0) THEN
822 2 : CALL section_vals_val_get(qs_section, "EPS_RHO_GSPACE", r_val=qs_control%eps_rho_gspace)
823 : END IF
824 6686 : CALL section_vals_val_get(qs_section, "EPS_FILTER_MATRIX", n_rep_val=n_rep)
825 6686 : IF (n_rep /= 0) THEN
826 6686 : CALL section_vals_val_get(qs_section, "EPS_FILTER_MATRIX", r_val=qs_control%eps_filter_matrix)
827 : END IF
828 6686 : CALL section_vals_val_get(qs_section, "EPS_CPC", n_rep_val=n_rep)
829 6686 : IF (n_rep /= 0) THEN
830 0 : CALL section_vals_val_get(qs_section, "EPS_CPC", r_val=qs_control%gapw_control%eps_cpc)
831 : END IF
832 :
833 6686 : CALL section_vals_val_get(qs_section, "EPSFIT", r_val=qs_control%gapw_control%eps_fit)
834 6686 : CALL section_vals_val_get(qs_section, "EPSISO", r_val=qs_control%gapw_control%eps_iso)
835 6686 : CALL section_vals_val_get(qs_section, "EPSSVD", r_val=qs_control%gapw_control%eps_svd)
836 6686 : CALL section_vals_val_get(qs_section, "EPSRHO0", r_val=qs_control%gapw_control%eps_Vrho0)
837 6686 : CALL section_vals_val_get(qs_section, "ALPHA0_HARD", r_val=qs_control%gapw_control%alpha0_hard)
838 6686 : qs_control%gapw_control%lrho1_eq_lrho0 = .FALSE.
839 6686 : qs_control%gapw_control%alpha0_hard_from_input = .FALSE.
840 6686 : IF (qs_control%gapw_control%alpha0_hard /= 0.0_dp) qs_control%gapw_control%alpha0_hard_from_input = .TRUE.
841 6686 : CALL section_vals_val_get(qs_section, "FORCE_PAW", l_val=qs_control%gapw_control%force_paw)
842 6686 : CALL section_vals_val_get(qs_section, "MAX_RAD_LOCAL", r_val=qs_control%gapw_control%max_rad_local)
843 :
844 6686 : CALL section_vals_val_get(qs_section, "MIN_PAIR_LIST_RADIUS", r_val=qs_control%pairlist_radius)
845 :
846 6686 : CALL section_vals_val_get(qs_section, "LS_SCF", l_val=qs_control%do_ls_scf)
847 6686 : CALL section_vals_val_get(qs_section, "ALMO_SCF", l_val=qs_control%do_almo_scf)
848 6686 : CALL section_vals_val_get(qs_section, "KG_METHOD", l_val=qs_control%do_kg)
849 :
850 : ! Logicals
851 6686 : CALL section_vals_val_get(qs_section, "REF_EMBED_SUBSYS", l_val=qs_control%ref_embed_subsys)
852 6686 : CALL section_vals_val_get(qs_section, "CLUSTER_EMBED_SUBSYS", l_val=qs_control%cluster_embed_subsys)
853 6686 : CALL section_vals_val_get(qs_section, "HIGH_LEVEL_EMBED_SUBSYS", l_val=qs_control%high_level_embed_subsys)
854 6686 : CALL section_vals_val_get(qs_section, "DFET_EMBEDDED", l_val=qs_control%dfet_embedded)
855 6686 : CALL section_vals_val_get(qs_section, "DMFET_EMBEDDED", l_val=qs_control%dmfet_embedded)
856 :
857 : ! Integers gapw
858 6686 : CALL section_vals_val_get(qs_section, "LMAXN1", i_val=qs_control%gapw_control%lmax_sphere)
859 6686 : CALL section_vals_val_get(qs_section, "LMAXN0", i_val=qs_control%gapw_control%lmax_rho0)
860 6686 : CALL section_vals_val_get(qs_section, "LADDN0", i_val=qs_control%gapw_control%ladd_rho0)
861 6686 : CALL section_vals_val_get(qs_section, "QUADRATURE", i_val=qs_control%gapw_control%quadrature)
862 : ! GAPW 1c basis
863 6686 : CALL section_vals_val_get(qs_section, "GAPW_1C_BASIS", i_val=qs_control%gapw_control%basis_1c)
864 6686 : IF (qs_control%gapw_control%basis_1c /= gapw_1c_orb) THEN
865 18 : qs_control%gapw_control%eps_svd = MAX(qs_control%gapw_control%eps_svd, 1.E-12_dp)
866 : END IF
867 :
868 : ! Integers grids
869 6686 : CALL section_vals_val_get(qs_section, "PW_GRID", i_val=itmp)
870 0 : SELECT CASE (itmp)
871 : CASE (do_pwgrid_spherical)
872 0 : qs_control%pw_grid_opt%spherical = .TRUE.
873 0 : qs_control%pw_grid_opt%fullspace = .FALSE.
874 : CASE (do_pwgrid_ns_fullspace)
875 6686 : qs_control%pw_grid_opt%spherical = .FALSE.
876 6686 : qs_control%pw_grid_opt%fullspace = .TRUE.
877 : CASE (do_pwgrid_ns_halfspace)
878 0 : qs_control%pw_grid_opt%spherical = .FALSE.
879 6686 : qs_control%pw_grid_opt%fullspace = .FALSE.
880 : END SELECT
881 :
882 : ! Method for PPL calculation
883 6686 : CALL section_vals_val_get(qs_section, "CORE_PPL", i_val=itmp)
884 6686 : qs_control%do_ppl_method = itmp
885 :
886 6686 : CALL section_vals_val_get(qs_section, "PW_GRID_LAYOUT", i_vals=tmplist)
887 20058 : qs_control%pw_grid_opt%distribution_layout = tmplist
888 6686 : CALL section_vals_val_get(qs_section, "PW_GRID_BLOCKED", i_val=qs_control%pw_grid_opt%blocked)
889 :
890 : !Integers extrapolation
891 6686 : CALL section_vals_val_get(qs_section, "EXTRAPOLATION", i_val=qs_control%wf_interpolation_method_nr)
892 6686 : CALL section_vals_val_get(qs_section, "EXTRAPOLATION_ORDER", i_val=qs_control%wf_extrapolation_order)
893 :
894 : !Method
895 6686 : CALL section_vals_val_get(qs_section, "METHOD", i_val=qs_control%method_id)
896 6686 : qs_control%gapw = .FALSE.
897 6686 : qs_control%gapw_xc = .FALSE.
898 6686 : qs_control%gpw = .FALSE.
899 6686 : qs_control%pao = .FALSE.
900 6686 : qs_control%dftb = .FALSE.
901 6686 : qs_control%xtb = .FALSE.
902 6686 : qs_control%semi_empirical = .FALSE.
903 6686 : qs_control%ofgpw = .FALSE.
904 6686 : qs_control%lrigpw = .FALSE.
905 6686 : qs_control%rigpw = .FALSE.
906 7500 : SELECT CASE (qs_control%method_id)
907 : CASE (do_method_gapw)
908 814 : CALL cite_reference(Lippert1999)
909 814 : CALL cite_reference(Krack2000)
910 814 : qs_control%gapw = .TRUE.
911 : CASE (do_method_gapw_xc)
912 106 : qs_control%gapw_xc = .TRUE.
913 : CASE (do_method_gpw)
914 4222 : CALL cite_reference(Lippert1997)
915 4222 : CALL cite_reference(VandeVondele2005a)
916 4222 : qs_control%gpw = .TRUE.
917 : CASE (do_method_ofgpw)
918 0 : qs_control%ofgpw = .TRUE.
919 : CASE (do_method_lrigpw)
920 40 : qs_control%lrigpw = .TRUE.
921 : CASE (do_method_rigpw)
922 0 : qs_control%rigpw = .TRUE.
923 : CASE (do_method_dftb)
924 222 : qs_control%dftb = .TRUE.
925 222 : CALL cite_reference(Porezag1995)
926 222 : CALL cite_reference(Seifert1996)
927 : CASE (do_method_xtb)
928 284 : qs_control%xtb = .TRUE.
929 284 : CALL cite_reference(Grimme2017)
930 284 : CALL cite_reference(Pracht2019)
931 : CASE (do_method_mndo)
932 52 : CALL cite_reference(Dewar1977)
933 52 : qs_control%semi_empirical = .TRUE.
934 : CASE (do_method_am1)
935 112 : CALL cite_reference(Dewar1985)
936 112 : qs_control%semi_empirical = .TRUE.
937 : CASE (do_method_pm3)
938 46 : CALL cite_reference(Stewart1989)
939 46 : qs_control%semi_empirical = .TRUE.
940 : CASE (do_method_pnnl)
941 14 : CALL cite_reference(Schenter2008)
942 14 : qs_control%semi_empirical = .TRUE.
943 : CASE (do_method_pm6)
944 754 : CALL cite_reference(Stewart2007)
945 754 : qs_control%semi_empirical = .TRUE.
946 : CASE (do_method_pm6fm)
947 0 : CALL cite_reference(VanVoorhis2015)
948 0 : qs_control%semi_empirical = .TRUE.
949 : CASE (do_method_pdg)
950 2 : CALL cite_reference(Repasky2002)
951 2 : qs_control%semi_empirical = .TRUE.
952 : CASE (do_method_rm1)
953 2 : CALL cite_reference(Rocha2006)
954 2 : qs_control%semi_empirical = .TRUE.
955 : CASE (do_method_mndod)
956 16 : CALL cite_reference(Dewar1977)
957 16 : CALL cite_reference(Thiel1992)
958 6702 : qs_control%semi_empirical = .TRUE.
959 : END SELECT
960 :
961 6686 : CALL section_vals_get(mull_section, explicit=qs_control%mulliken_restraint)
962 :
963 6686 : IF (qs_control%mulliken_restraint) THEN
964 2 : CALL section_vals_val_get(mull_section, "STRENGTH", r_val=qs_control%mulliken_restraint_control%strength)
965 2 : CALL section_vals_val_get(mull_section, "TARGET", r_val=qs_control%mulliken_restraint_control%target)
966 2 : CALL section_vals_val_get(mull_section, "ATOMS", n_rep_val=n_rep)
967 2 : jj = 0
968 4 : DO k = 1, n_rep
969 2 : CALL section_vals_val_get(mull_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
970 4 : jj = jj + SIZE(tmplist)
971 : END DO
972 2 : qs_control%mulliken_restraint_control%natoms = jj
973 2 : IF (qs_control%mulliken_restraint_control%natoms < 1) &
974 0 : CPABORT("Need at least 1 atom to use mulliken constraints")
975 6 : ALLOCATE (qs_control%mulliken_restraint_control%atoms(qs_control%mulliken_restraint_control%natoms))
976 2 : jj = 0
977 6 : DO k = 1, n_rep
978 2 : CALL section_vals_val_get(mull_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
979 6 : DO j = 1, SIZE(tmplist)
980 2 : jj = jj + 1
981 4 : qs_control%mulliken_restraint_control%atoms(jj) = tmplist(j)
982 : END DO
983 : END DO
984 : END IF
985 6686 : CALL section_vals_get(ddapc_restraint_section, n_repetition=nrep, explicit=qs_control%ddapc_restraint)
986 6686 : IF (qs_control%ddapc_restraint) THEN
987 60 : ALLOCATE (qs_control%ddapc_restraint_control(nrep))
988 14 : CALL read_ddapc_section(qs_control, qs_section=qs_section)
989 14 : qs_control%ddapc_restraint_is_spin = .FALSE.
990 14 : qs_control%ddapc_explicit_potential = .FALSE.
991 : END IF
992 :
993 6686 : CALL section_vals_get(s2_restraint_section, explicit=qs_control%s2_restraint)
994 6686 : IF (qs_control%s2_restraint) THEN
995 : CALL section_vals_val_get(s2_restraint_section, "STRENGTH", &
996 0 : r_val=qs_control%s2_restraint_control%strength)
997 : CALL section_vals_val_get(s2_restraint_section, "TARGET", &
998 0 : r_val=qs_control%s2_restraint_control%target)
999 : CALL section_vals_val_get(s2_restraint_section, "FUNCTIONAL_FORM", &
1000 0 : i_val=qs_control%s2_restraint_control%functional_form)
1001 : END IF
1002 :
1003 6686 : CALL section_vals_get(cdft_control_section, explicit=qs_control%cdft)
1004 6686 : IF (qs_control%cdft) THEN
1005 264 : CALL read_cdft_control_section(qs_control, cdft_control_section)
1006 : END IF
1007 :
1008 : ! Semi-empirical code
1009 6686 : IF (qs_control%semi_empirical) THEN
1010 : CALL section_vals_val_get(se_section, "ORTHOGONAL_BASIS", &
1011 998 : l_val=qs_control%se_control%orthogonal_basis)
1012 : CALL section_vals_val_get(se_section, "DELTA", &
1013 998 : r_val=qs_control%se_control%delta)
1014 : CALL section_vals_val_get(se_section, "ANALYTICAL_GRADIENTS", &
1015 998 : l_val=qs_control%se_control%analytical_gradients)
1016 : CALL section_vals_val_get(se_section, "FORCE_KDSO-D_EXCHANGE", &
1017 998 : l_val=qs_control%se_control%force_kdsod_EX)
1018 : ! Integral Screening
1019 : CALL section_vals_val_get(se_section, "INTEGRAL_SCREENING", &
1020 998 : i_val=qs_control%se_control%integral_screening)
1021 998 : IF (qs_control%method_id == do_method_pnnl) THEN
1022 14 : IF (qs_control%se_control%integral_screening /= do_se_IS_slater) &
1023 : CALL cp_warn(__LOCATION__, &
1024 : "PNNL semi-empirical parameterization supports only the Slater type "// &
1025 0 : "integral scheme. Revert to Slater and continue the calculation.")
1026 14 : qs_control%se_control%integral_screening = do_se_IS_slater
1027 : END IF
1028 : ! Global Arrays variable
1029 : CALL section_vals_val_get(se_section, "GA%NCELLS", &
1030 998 : i_val=qs_control%se_control%ga_ncells)
1031 : ! Long-Range correction
1032 : CALL section_vals_val_get(se_section, "LR_CORRECTION%CUTOFF", &
1033 998 : r_val=qs_control%se_control%cutoff_lrc)
1034 998 : qs_control%se_control%taper_lrc = qs_control%se_control%cutoff_lrc
1035 : CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_TAPER", &
1036 998 : explicit=explicit)
1037 998 : IF (explicit) THEN
1038 : CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_TAPER", &
1039 0 : r_val=qs_control%se_control%taper_lrc)
1040 : END IF
1041 : CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_RANGE", &
1042 998 : r_val=qs_control%se_control%range_lrc)
1043 : ! Coulomb
1044 : CALL section_vals_val_get(se_section, "COULOMB%CUTOFF", &
1045 998 : r_val=qs_control%se_control%cutoff_cou)
1046 998 : qs_control%se_control%taper_cou = qs_control%se_control%cutoff_cou
1047 : CALL section_vals_val_get(se_section, "COULOMB%RC_TAPER", &
1048 998 : explicit=explicit)
1049 998 : IF (explicit) THEN
1050 : CALL section_vals_val_get(se_section, "COULOMB%RC_TAPER", &
1051 0 : r_val=qs_control%se_control%taper_cou)
1052 : END IF
1053 : CALL section_vals_val_get(se_section, "COULOMB%RC_RANGE", &
1054 998 : r_val=qs_control%se_control%range_cou)
1055 : ! Exchange
1056 : CALL section_vals_val_get(se_section, "EXCHANGE%CUTOFF", &
1057 998 : r_val=qs_control%se_control%cutoff_exc)
1058 998 : qs_control%se_control%taper_exc = qs_control%se_control%cutoff_exc
1059 : CALL section_vals_val_get(se_section, "EXCHANGE%RC_TAPER", &
1060 998 : explicit=explicit)
1061 998 : IF (explicit) THEN
1062 : CALL section_vals_val_get(se_section, "EXCHANGE%RC_TAPER", &
1063 38 : r_val=qs_control%se_control%taper_exc)
1064 : END IF
1065 : CALL section_vals_val_get(se_section, "EXCHANGE%RC_RANGE", &
1066 998 : r_val=qs_control%se_control%range_exc)
1067 : ! Screening (only if the integral scheme is of dumped type)
1068 998 : IF (qs_control%se_control%integral_screening == do_se_IS_kdso_d) THEN
1069 : CALL section_vals_val_get(se_section, "SCREENING%RC_TAPER", &
1070 14 : r_val=qs_control%se_control%taper_scr)
1071 : CALL section_vals_val_get(se_section, "SCREENING%RC_RANGE", &
1072 14 : r_val=qs_control%se_control%range_scr)
1073 : END IF
1074 : ! Periodic Type Calculation
1075 : CALL section_vals_val_get(se_section, "PERIODIC", &
1076 998 : i_val=qs_control%se_control%periodic_type)
1077 1964 : SELECT CASE (qs_control%se_control%periodic_type)
1078 : CASE (do_se_lr_none)
1079 966 : qs_control%se_control%do_ewald = .FALSE.
1080 966 : qs_control%se_control%do_ewald_r3 = .FALSE.
1081 966 : qs_control%se_control%do_ewald_gks = .FALSE.
1082 : CASE (do_se_lr_ewald)
1083 30 : qs_control%se_control%do_ewald = .TRUE.
1084 30 : qs_control%se_control%do_ewald_r3 = .FALSE.
1085 30 : qs_control%se_control%do_ewald_gks = .FALSE.
1086 : CASE (do_se_lr_ewald_gks)
1087 2 : qs_control%se_control%do_ewald = .FALSE.
1088 2 : qs_control%se_control%do_ewald_r3 = .FALSE.
1089 2 : qs_control%se_control%do_ewald_gks = .TRUE.
1090 2 : IF (qs_control%method_id /= do_method_pnnl) &
1091 : CALL cp_abort(__LOCATION__, &
1092 : "A periodic semi-empirical calculation was requested with a long-range "// &
1093 : "summation on the single integral evaluation. This scheme is supported "// &
1094 0 : "only by the PNNL parameterization.")
1095 : CASE (do_se_lr_ewald_r3)
1096 0 : qs_control%se_control%do_ewald = .TRUE.
1097 0 : qs_control%se_control%do_ewald_r3 = .TRUE.
1098 0 : qs_control%se_control%do_ewald_gks = .FALSE.
1099 0 : IF (qs_control%se_control%integral_screening /= do_se_IS_kdso) &
1100 : CALL cp_abort(__LOCATION__, &
1101 : "A periodic semi-empirical calculation was requested with a long-range "// &
1102 : "summation for the slowly convergent part 1/R^3, which is not congruent "// &
1103 : "with the integral screening chosen. The only integral screening supported "// &
1104 998 : "by this periodic type calculation is the standard Klopman-Dewar-Sabelli-Ohno.")
1105 : END SELECT
1106 :
1107 : ! dispersion pair potentials
1108 : CALL section_vals_val_get(se_section, "DISPERSION", &
1109 998 : l_val=qs_control%se_control%dispersion)
1110 : CALL section_vals_val_get(se_section, "DISPERSION_RADIUS", &
1111 998 : r_val=qs_control%se_control%rcdisp)
1112 : CALL section_vals_val_get(se_section, "COORDINATION_CUTOFF", &
1113 998 : r_val=qs_control%se_control%epscn)
1114 998 : CALL section_vals_val_get(se_section, "D3_SCALING", r_vals=scal)
1115 998 : qs_control%se_control%sd3(1) = scal(1)
1116 998 : qs_control%se_control%sd3(2) = scal(2)
1117 998 : qs_control%se_control%sd3(3) = scal(3)
1118 : CALL section_vals_val_get(se_section, "DISPERSION_PARAMETER_FILE", &
1119 998 : c_val=qs_control%se_control%dispersion_parameter_file)
1120 :
1121 : ! Stop the execution for non-implemented features
1122 998 : IF (qs_control%se_control%periodic_type == do_se_lr_ewald_r3) THEN
1123 0 : CPABORT("EWALD_R3 not implemented yet!")
1124 : END IF
1125 :
1126 : IF (qs_control%method_id == do_method_mndo .OR. &
1127 : qs_control%method_id == do_method_am1 .OR. &
1128 : qs_control%method_id == do_method_mndod .OR. &
1129 : qs_control%method_id == do_method_pdg .OR. &
1130 : qs_control%method_id == do_method_pm3 .OR. &
1131 : qs_control%method_id == do_method_pm6 .OR. &
1132 : qs_control%method_id == do_method_pm6fm .OR. &
1133 998 : qs_control%method_id == do_method_pnnl .OR. &
1134 : qs_control%method_id == do_method_rm1) THEN
1135 998 : qs_control%se_control%orthogonal_basis = .TRUE.
1136 : END IF
1137 : END IF
1138 :
1139 : ! DFTB code
1140 6686 : IF (qs_control%dftb) THEN
1141 : CALL section_vals_val_get(dftb_section, "ORTHOGONAL_BASIS", &
1142 222 : l_val=qs_control%dftb_control%orthogonal_basis)
1143 : CALL section_vals_val_get(dftb_section, "SELF_CONSISTENT", &
1144 222 : l_val=qs_control%dftb_control%self_consistent)
1145 : CALL section_vals_val_get(dftb_section, "DISPERSION", &
1146 222 : l_val=qs_control%dftb_control%dispersion)
1147 : CALL section_vals_val_get(dftb_section, "DIAGONAL_DFTB3", &
1148 222 : l_val=qs_control%dftb_control%dftb3_diagonal)
1149 : CALL section_vals_val_get(dftb_section, "HB_SR_GAMMA", &
1150 222 : l_val=qs_control%dftb_control%hb_sr_damp)
1151 : CALL section_vals_val_get(dftb_section, "EPS_DISP", &
1152 222 : r_val=qs_control%dftb_control%eps_disp)
1153 222 : CALL section_vals_val_get(dftb_section, "DO_EWALD", explicit=explicit)
1154 222 : IF (explicit) THEN
1155 : CALL section_vals_val_get(dftb_section, "DO_EWALD", &
1156 166 : l_val=qs_control%dftb_control%do_ewald)
1157 : ELSE
1158 56 : qs_control%dftb_control%do_ewald = (qs_control%periodicity /= 0)
1159 : END IF
1160 : CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_PATH", &
1161 222 : c_val=qs_control%dftb_control%sk_file_path)
1162 : CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_NAME", &
1163 222 : c_val=qs_control%dftb_control%sk_file_list)
1164 : CALL section_vals_val_get(dftb_parameter, "HB_SR_PARAM", &
1165 222 : r_val=qs_control%dftb_control%hb_sr_para)
1166 222 : CALL section_vals_val_get(dftb_parameter, "SK_FILE", n_rep_val=n_var)
1167 470 : ALLOCATE (qs_control%dftb_control%sk_pair_list(3, n_var))
1168 284 : DO k = 1, n_var
1169 : CALL section_vals_val_get(dftb_parameter, "SK_FILE", i_rep_val=k, &
1170 62 : c_vals=clist)
1171 470 : qs_control%dftb_control%sk_pair_list(1:3, k) = clist(1:3)
1172 : END DO
1173 : ! Dispersion type
1174 : CALL section_vals_val_get(dftb_parameter, "DISPERSION_TYPE", &
1175 222 : i_val=qs_control%dftb_control%dispersion_type)
1176 : CALL section_vals_val_get(dftb_parameter, "UFF_FORCE_FIELD", &
1177 222 : c_val=qs_control%dftb_control%uff_force_field)
1178 : ! D3 Dispersion
1179 : CALL section_vals_val_get(dftb_parameter, "DISPERSION_RADIUS", &
1180 222 : r_val=qs_control%dftb_control%rcdisp)
1181 : CALL section_vals_val_get(dftb_parameter, "COORDINATION_CUTOFF", &
1182 222 : r_val=qs_control%dftb_control%epscn)
1183 : CALL section_vals_val_get(dftb_parameter, "D2_EXP_PRE", &
1184 222 : r_val=qs_control%dftb_control%exp_pre)
1185 : CALL section_vals_val_get(dftb_parameter, "D2_SCALING", &
1186 222 : r_val=qs_control%dftb_control%scaling)
1187 222 : CALL section_vals_val_get(dftb_parameter, "D3_SCALING", r_vals=scal)
1188 222 : qs_control%dftb_control%sd3(1) = scal(1)
1189 222 : qs_control%dftb_control%sd3(2) = scal(2)
1190 222 : qs_control%dftb_control%sd3(3) = scal(3)
1191 222 : CALL section_vals_val_get(dftb_parameter, "D3BJ_SCALING", r_vals=scal)
1192 222 : qs_control%dftb_control%sd3bj(1) = scal(1)
1193 222 : qs_control%dftb_control%sd3bj(2) = scal(2)
1194 222 : qs_control%dftb_control%sd3bj(3) = scal(3)
1195 222 : qs_control%dftb_control%sd3bj(4) = scal(4)
1196 : CALL section_vals_val_get(dftb_parameter, "DISPERSION_PARAMETER_FILE", &
1197 222 : c_val=qs_control%dftb_control%dispersion_parameter_file)
1198 :
1199 222 : IF (qs_control%dftb_control%dispersion) CALL cite_reference(Zhechkov2005)
1200 222 : IF (qs_control%dftb_control%self_consistent) CALL cite_reference(Elstner1998)
1201 666 : IF (qs_control%dftb_control%hb_sr_damp) CALL cite_reference(Hu2007)
1202 : END IF
1203 :
1204 : ! xTB code
1205 6686 : IF (qs_control%xtb) THEN
1206 284 : CALL section_vals_val_get(xtb_section, "GFN_TYPE", i_val=qs_control%xtb_control%gfn_type)
1207 284 : CALL section_vals_val_get(xtb_section, "DO_EWALD", explicit=explicit)
1208 284 : IF (explicit) THEN
1209 : CALL section_vals_val_get(xtb_section, "DO_EWALD", &
1210 134 : l_val=qs_control%xtb_control%do_ewald)
1211 : ELSE
1212 150 : qs_control%xtb_control%do_ewald = (qs_control%periodicity /= 0)
1213 : END IF
1214 : ! vdW
1215 284 : CALL section_vals_val_get(xtb_section, "VDW_POTENTIAL", explicit=explicit)
1216 284 : IF (explicit) THEN
1217 34 : CALL section_vals_val_get(xtb_section, "VDW_POTENTIAL", c_val=cval)
1218 34 : CALL uppercase(cval)
1219 0 : SELECT CASE (cval)
1220 : CASE ("NONE")
1221 0 : qs_control%xtb_control%vdw_type = xtb_vdw_type_none
1222 : CASE ("DFTD3")
1223 32 : qs_control%xtb_control%vdw_type = xtb_vdw_type_d3
1224 : CASE ("DFTD4")
1225 2 : qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1226 : CASE DEFAULT
1227 34 : CPABORT("vdW type")
1228 : END SELECT
1229 : ELSE
1230 252 : SELECT CASE (qs_control%xtb_control%gfn_type)
1231 : CASE (0)
1232 2 : qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1233 : CASE (1)
1234 248 : qs_control%xtb_control%vdw_type = xtb_vdw_type_d3
1235 : CASE (2)
1236 0 : qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1237 0 : CPABORT("gfn2-xtb tbd")
1238 : CASE DEFAULT
1239 250 : CPABORT("GFN type")
1240 : END SELECT
1241 : END IF
1242 : !
1243 284 : CALL section_vals_val_get(xtb_section, "STO_NG", i_val=ngauss)
1244 284 : qs_control%xtb_control%sto_ng = ngauss
1245 284 : CALL section_vals_val_get(xtb_section, "HYDROGEN_STO_NG", i_val=ngauss)
1246 284 : qs_control%xtb_control%h_sto_ng = ngauss
1247 : CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_PATH", &
1248 284 : c_val=qs_control%xtb_control%parameter_file_path)
1249 284 : CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_NAME", explicit=explicit)
1250 284 : IF (explicit) THEN
1251 : CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_NAME", &
1252 0 : c_val=qs_control%xtb_control%parameter_file_name)
1253 : ELSE
1254 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1255 : CASE (0)
1256 34 : qs_control%xtb_control%parameter_file_name = "xTB0_parameters"
1257 : CASE (1)
1258 250 : qs_control%xtb_control%parameter_file_name = "xTB1_parameters"
1259 : CASE (2)
1260 0 : CPABORT("gfn2-xtb tbd")
1261 : CASE DEFAULT
1262 284 : CPABORT("GFN type")
1263 : END SELECT
1264 : END IF
1265 : ! D3 Dispersion
1266 : CALL section_vals_val_get(xtb_parameter, "DISPERSION_RADIUS", &
1267 284 : r_val=qs_control%xtb_control%rcdisp)
1268 : CALL section_vals_val_get(xtb_parameter, "COORDINATION_CUTOFF", &
1269 284 : r_val=qs_control%xtb_control%epscn)
1270 284 : CALL section_vals_val_get(xtb_parameter, "D3BJ_SCALING", explicit=explicit)
1271 284 : IF (explicit) THEN
1272 0 : CALL section_vals_val_get(xtb_parameter, "D3BJ_SCALING", r_vals=scal)
1273 0 : qs_control%xtb_control%s6 = scal(1)
1274 0 : qs_control%xtb_control%s8 = scal(2)
1275 : ELSE
1276 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1277 : CASE (0)
1278 34 : qs_control%xtb_control%s6 = 1.00_dp
1279 34 : qs_control%xtb_control%s8 = 2.85_dp
1280 : CASE (1)
1281 250 : qs_control%xtb_control%s6 = 1.00_dp
1282 250 : qs_control%xtb_control%s8 = 2.40_dp
1283 : CASE (2)
1284 0 : CPABORT("gfn2-xtb tbd")
1285 : CASE DEFAULT
1286 284 : CPABORT("GFN type")
1287 : END SELECT
1288 : END IF
1289 284 : CALL section_vals_val_get(xtb_parameter, "D3BJ_PARAM", explicit=explicit)
1290 284 : IF (explicit) THEN
1291 0 : CALL section_vals_val_get(xtb_parameter, "D3BJ_PARAM", r_vals=scal)
1292 0 : qs_control%xtb_control%a1 = scal(1)
1293 0 : qs_control%xtb_control%a2 = scal(2)
1294 : ELSE
1295 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1296 : CASE (0)
1297 34 : qs_control%xtb_control%a1 = 0.80_dp
1298 34 : qs_control%xtb_control%a2 = 4.60_dp
1299 : CASE (1)
1300 250 : qs_control%xtb_control%a1 = 0.63_dp
1301 250 : qs_control%xtb_control%a2 = 5.00_dp
1302 : CASE (2)
1303 0 : CPABORT("gfn2-xtb tbd")
1304 : CASE DEFAULT
1305 284 : CPABORT("GFN type")
1306 : END SELECT
1307 : END IF
1308 : CALL section_vals_val_get(xtb_parameter, "DISPERSION_PARAMETER_FILE", &
1309 284 : c_val=qs_control%xtb_control%dispersion_parameter_file)
1310 : ! global parameters
1311 284 : CALL section_vals_val_get(xtb_parameter, "HUCKEL_CONSTANTS", explicit=explicit)
1312 284 : IF (explicit) THEN
1313 0 : CALL section_vals_val_get(xtb_parameter, "HUCKEL_CONSTANTS", r_vals=scal)
1314 0 : qs_control%xtb_control%ks = scal(1)
1315 0 : qs_control%xtb_control%kp = scal(2)
1316 0 : qs_control%xtb_control%kd = scal(3)
1317 0 : qs_control%xtb_control%ksp = scal(4)
1318 0 : qs_control%xtb_control%k2sh = scal(5)
1319 0 : IF (qs_control%xtb_control%gfn_type == 0) THEN
1320 : ! enforce ksp for gfn0
1321 0 : qs_control%xtb_control%ksp = 0.5_dp*(scal(1) + scal(2))
1322 : END IF
1323 : ELSE
1324 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1325 : CASE (0)
1326 34 : qs_control%xtb_control%ks = 2.00_dp
1327 34 : qs_control%xtb_control%kp = 2.4868_dp
1328 34 : qs_control%xtb_control%kd = 2.27_dp
1329 34 : qs_control%xtb_control%ksp = 2.2434_dp
1330 34 : qs_control%xtb_control%k2sh = 1.1241_dp
1331 : CASE (1)
1332 250 : qs_control%xtb_control%ks = 1.85_dp
1333 250 : qs_control%xtb_control%kp = 2.25_dp
1334 250 : qs_control%xtb_control%kd = 2.00_dp
1335 250 : qs_control%xtb_control%ksp = 2.08_dp
1336 250 : qs_control%xtb_control%k2sh = 2.85_dp
1337 : CASE (2)
1338 0 : CPABORT("gfn2-xtb tbd")
1339 : CASE DEFAULT
1340 284 : CPABORT("GFN type")
1341 : END SELECT
1342 : END IF
1343 284 : CALL section_vals_val_get(xtb_parameter, "COULOMB_CONSTANTS", explicit=explicit)
1344 284 : IF (explicit) THEN
1345 0 : CALL section_vals_val_get(xtb_parameter, "COULOMB_CONSTANTS", r_vals=scal)
1346 0 : qs_control%xtb_control%kg = scal(1)
1347 0 : qs_control%xtb_control%kf = scal(2)
1348 : ELSE
1349 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1350 : CASE (0)
1351 34 : qs_control%xtb_control%kg = 2.00_dp
1352 34 : qs_control%xtb_control%kf = 1.50_dp
1353 : CASE (1)
1354 250 : qs_control%xtb_control%kg = 2.00_dp
1355 250 : qs_control%xtb_control%kf = 1.50_dp
1356 : CASE (2)
1357 0 : CPABORT("gfn2-xtb tbd")
1358 : CASE DEFAULT
1359 284 : CPABORT("GFN type")
1360 : END SELECT
1361 : END IF
1362 284 : CALL section_vals_val_get(xtb_parameter, "CN_CONSTANTS", r_vals=scal)
1363 284 : qs_control%xtb_control%kcns = scal(1)
1364 284 : qs_control%xtb_control%kcnp = scal(2)
1365 284 : qs_control%xtb_control%kcnd = scal(3)
1366 : !
1367 284 : CALL section_vals_val_get(xtb_parameter, "EN_CONSTANTS", explicit=explicit)
1368 284 : IF (explicit) THEN
1369 0 : CALL section_vals_val_get(xtb_parameter, "EN_CONSTANTS", r_vals=scal)
1370 0 : SELECT CASE (qs_control%xtb_control%gfn_type)
1371 : CASE (0)
1372 0 : qs_control%xtb_control%ksen = scal(1)
1373 0 : qs_control%xtb_control%kpen = scal(2)
1374 0 : qs_control%xtb_control%kden = scal(3)
1375 : CASE (1)
1376 0 : qs_control%xtb_control%ken = scal(1)
1377 : CASE (2)
1378 0 : CPABORT("gfn2-xtb tbd")
1379 : CASE DEFAULT
1380 0 : CPABORT("GFN type")
1381 : END SELECT
1382 : ELSE
1383 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1384 : CASE (0)
1385 34 : qs_control%xtb_control%ksen = 0.006_dp
1386 34 : qs_control%xtb_control%kpen = -0.001_dp
1387 34 : qs_control%xtb_control%kden = -0.002_dp
1388 : CASE (1)
1389 250 : qs_control%xtb_control%ken = -0.007_dp
1390 : CASE (2)
1391 0 : CPABORT("gfn2-xtb tbd")
1392 : CASE DEFAULT
1393 284 : CPABORT("GFN type")
1394 : END SELECT
1395 : END IF
1396 : ! ben
1397 284 : CALL section_vals_val_get(xtb_parameter, "BEN_CONSTANT", r_vals=scal)
1398 284 : qs_control%xtb_control%ben = scal(1)
1399 : ! enscale (hidden parameter in repulsion
1400 284 : CALL section_vals_val_get(xtb_parameter, "ENSCALE", explicit=explicit)
1401 284 : IF (explicit) THEN
1402 : CALL section_vals_val_get(xtb_parameter, "ENSCALE", &
1403 0 : r_val=qs_control%xtb_control%enscale)
1404 : ELSE
1405 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1406 : CASE (0)
1407 34 : qs_control%xtb_control%enscale = -0.09_dp
1408 : CASE (1)
1409 250 : qs_control%xtb_control%enscale = 0._dp
1410 : CASE (2)
1411 0 : CPABORT("gfn2-xtb tbd")
1412 : CASE DEFAULT
1413 284 : CPABORT("GFN type")
1414 : END SELECT
1415 : END IF
1416 : ! XB
1417 : CALL section_vals_val_get(xtb_section, "USE_HALOGEN_CORRECTION", &
1418 284 : l_val=qs_control%xtb_control%xb_interaction)
1419 284 : CALL section_vals_val_get(xtb_parameter, "HALOGEN_BINDING", r_vals=scal)
1420 284 : qs_control%xtb_control%kxr = scal(1)
1421 284 : qs_control%xtb_control%kx2 = scal(2)
1422 : ! NONBONDED interactions
1423 : CALL section_vals_val_get(xtb_section, "DO_NONBONDED", &
1424 284 : l_val=qs_control%xtb_control%do_nonbonded)
1425 284 : CALL section_vals_get(nonbonded_section, explicit=explicit)
1426 284 : IF (explicit .AND. qs_control%xtb_control%do_nonbonded) THEN
1427 6 : CALL section_vals_get(genpot_section, explicit=explicit, n_repetition=ngp)
1428 6 : IF (explicit) THEN
1429 6 : CALL pair_potential_reallocate(qs_control%xtb_control%nonbonded, 1, ngp, gp=.TRUE.)
1430 6 : CALL read_gp_section(qs_control%xtb_control%nonbonded, genpot_section, 0)
1431 : END IF
1432 : END IF !nonbonded
1433 : CALL section_vals_val_get(xtb_section, "EPS_PAIRPOTENTIAL", &
1434 284 : r_val=qs_control%xtb_control%eps_pair)
1435 : ! SR Coulomb
1436 284 : CALL section_vals_val_get(xtb_parameter, "COULOMB_SR_CUT", r_vals=scal)
1437 284 : qs_control%xtb_control%coulomb_sr_cut = scal(1)
1438 284 : CALL section_vals_val_get(xtb_parameter, "COULOMB_SR_EPS", r_vals=scal)
1439 284 : qs_control%xtb_control%coulomb_sr_eps = scal(1)
1440 : ! XB_radius
1441 284 : CALL section_vals_val_get(xtb_parameter, "XB_RADIUS", r_val=qs_control%xtb_control%xb_radius)
1442 : ! Kab
1443 284 : CALL section_vals_val_get(xtb_parameter, "KAB_PARAM", n_rep_val=n_rep)
1444 : ! Coulomb
1445 318 : SELECT CASE (qs_control%xtb_control%gfn_type)
1446 : CASE (0)
1447 34 : qs_control%xtb_control%coulomb_interaction = .FALSE.
1448 34 : qs_control%xtb_control%coulomb_lr = .FALSE.
1449 34 : qs_control%xtb_control%tb3_interaction = .FALSE.
1450 34 : qs_control%xtb_control%check_atomic_charges = .FALSE.
1451 : CASE (1)
1452 : ! For debugging purposes
1453 : CALL section_vals_val_get(xtb_section, "COULOMB_INTERACTION", &
1454 250 : l_val=qs_control%xtb_control%coulomb_interaction)
1455 : CALL section_vals_val_get(xtb_section, "COULOMB_LR", &
1456 250 : l_val=qs_control%xtb_control%coulomb_lr)
1457 : CALL section_vals_val_get(xtb_section, "TB3_INTERACTION", &
1458 250 : l_val=qs_control%xtb_control%tb3_interaction)
1459 : ! Check for bad atomic charges
1460 : CALL section_vals_val_get(xtb_section, "CHECK_ATOMIC_CHARGES", &
1461 250 : l_val=qs_control%xtb_control%check_atomic_charges)
1462 : CASE (2)
1463 0 : CPABORT("gfn2-xtb tbd")
1464 : CASE DEFAULT
1465 284 : CPABORT("GFN type")
1466 : END SELECT
1467 284 : qs_control%xtb_control%kab_nval = n_rep
1468 284 : IF (n_rep > 0) THEN
1469 6 : ALLOCATE (qs_control%xtb_control%kab_param(3, n_rep))
1470 6 : ALLOCATE (qs_control%xtb_control%kab_types(2, n_rep))
1471 6 : ALLOCATE (qs_control%xtb_control%kab_vals(n_rep))
1472 4 : DO j = 1, n_rep
1473 2 : CALL section_vals_val_get(xtb_parameter, "KAB_PARAM", i_rep_val=j, c_vals=clist)
1474 2 : qs_control%xtb_control%kab_param(1, j) = clist(1)
1475 : CALL get_ptable_info(clist(1), &
1476 2 : ielement=qs_control%xtb_control%kab_types(1, j))
1477 2 : qs_control%xtb_control%kab_param(2, j) = clist(2)
1478 : CALL get_ptable_info(clist(2), &
1479 2 : ielement=qs_control%xtb_control%kab_types(2, j))
1480 2 : qs_control%xtb_control%kab_param(3, j) = clist(3)
1481 4 : READ (clist(3), '(F10.0)') qs_control%xtb_control%kab_vals(j)
1482 : END DO
1483 : END IF
1484 :
1485 284 : IF (qs_control%xtb_control%gfn_type == 0) THEN
1486 34 : CALL section_vals_val_get(xtb_parameter, "SRB_PARAMETER", r_vals=scal)
1487 34 : qs_control%xtb_control%ksrb = scal(1)
1488 34 : qs_control%xtb_control%esrb = scal(2)
1489 34 : qs_control%xtb_control%gscal = scal(3)
1490 34 : qs_control%xtb_control%c1srb = scal(4)
1491 34 : qs_control%xtb_control%c2srb = scal(5)
1492 34 : qs_control%xtb_control%shift = scal(6)
1493 : END IF
1494 :
1495 284 : CALL section_vals_val_get(xtb_section, "EN_SHIFT_TYPE", c_val=cval)
1496 284 : CALL uppercase(cval)
1497 284 : SELECT CASE (TRIM(cval))
1498 : CASE ("SELECT")
1499 0 : qs_control%xtb_control%enshift_type = 0
1500 : CASE ("MOLECULE")
1501 284 : qs_control%xtb_control%enshift_type = 1
1502 : CASE ("CRYSTAL")
1503 0 : qs_control%xtb_control%enshift_type = 2
1504 : CASE DEFAULT
1505 284 : CPABORT("Unknown value for EN_SHIFT_TYPE")
1506 : END SELECT
1507 :
1508 : ! EEQ solver params
1509 284 : CALL read_eeq_param(eeq_section, qs_control%xtb_control%eeq_sparam)
1510 :
1511 : END IF
1512 :
1513 : ! Optimize LRI basis set
1514 6686 : CALL section_vals_get(lri_optbas_section, explicit=qs_control%lri_optbas)
1515 :
1516 6686 : CALL timestop(handle)
1517 6686 : END SUBROUTINE read_qs_section
1518 :
1519 : ! **************************************************************************************************
1520 : !> \brief ...
1521 : !> \param t_control ...
1522 : !> \param dft_section ...
1523 : ! **************************************************************************************************
1524 12 : SUBROUTINE read_tddfpt_control(t_control, dft_section)
1525 : TYPE(tddfpt_control_type) :: t_control
1526 : TYPE(section_vals_type), POINTER :: dft_section
1527 :
1528 : LOGICAL :: kenergy_den
1529 : TYPE(section_vals_type), POINTER :: sic_section, t_section
1530 :
1531 12 : kenergy_den = .FALSE.
1532 12 : NULLIFY (sic_section, t_section)
1533 12 : t_section => section_vals_get_subs_vals(dft_section, "TDDFPT")
1534 :
1535 12 : CALL section_vals_val_get(t_section, "CONVERGENCE", r_val=t_control%tolerance)
1536 12 : CALL section_vals_val_get(t_section, "NEV", i_val=t_control%n_ev)
1537 12 : CALL section_vals_val_get(t_section, "MAX_KV", i_val=t_control%max_kv)
1538 12 : CALL section_vals_val_get(t_section, "RESTARTS", i_val=t_control%n_restarts)
1539 12 : CALL section_vals_val_get(t_section, "NREORTHO", i_val=t_control%n_reortho)
1540 12 : CALL section_vals_val_get(t_section, "RES_ETYPE", i_val=t_control%res_etype)
1541 12 : CALL section_vals_val_get(t_section, "DIAG_METHOD", i_val=t_control%diag_method)
1542 12 : CALL section_vals_val_get(t_section, "KERNEL", l_val=t_control%do_kernel)
1543 12 : CALL section_vals_val_get(t_section, "LSD_SINGLETS", l_val=t_control%lsd_singlets)
1544 12 : CALL section_vals_val_get(t_section, "INVERT_S", l_val=t_control%invert_S)
1545 12 : CALL section_vals_val_get(t_section, "PRECOND", l_val=t_control%precond)
1546 12 : CALL section_vals_val_get(t_section, "OE_CORR", i_val=t_control%oe_corr)
1547 :
1548 12 : t_control%use_kinetic_energy_density = .FALSE.
1549 12 : sic_section => section_vals_get_subs_vals(t_section, "SIC")
1550 12 : CALL section_vals_val_get(sic_section, "SIC_METHOD", i_val=t_control%sic_method_id)
1551 12 : CALL section_vals_val_get(sic_section, "ORBITAL_SET", i_val=t_control%sic_list_id)
1552 12 : CALL section_vals_val_get(sic_section, "SIC_SCALING_A", r_val=t_control%sic_scaling_a)
1553 12 : CALL section_vals_val_get(sic_section, "SIC_SCALING_B", r_val=t_control%sic_scaling_b)
1554 :
1555 12 : END SUBROUTINE read_tddfpt_control
1556 :
1557 : ! **************************************************************************************************
1558 : !> \brief Read TDDFPT-related input parameters.
1559 : !> \param t_control TDDFPT control parameters
1560 : !> \param t_section TDDFPT input section
1561 : !> \param qs_control Quickstep control parameters
1562 : ! **************************************************************************************************
1563 6686 : SUBROUTINE read_tddfpt2_control(t_control, t_section, qs_control)
1564 : TYPE(tddfpt2_control_type), POINTER :: t_control
1565 : TYPE(section_vals_type), POINTER :: t_section
1566 : TYPE(qs_control_type), POINTER :: qs_control
1567 :
1568 : CHARACTER(LEN=*), PARAMETER :: routineN = 'read_tddfpt2_control'
1569 :
1570 : CHARACTER(LEN=default_string_length), &
1571 6686 : DIMENSION(:), POINTER :: tmpstringlist
1572 : INTEGER :: handle, irep, isize, nrep
1573 6686 : INTEGER, ALLOCATABLE, DIMENSION(:) :: inds
1574 : LOGICAL :: do_ewald, do_exchange, expl, explicit, &
1575 : multigrid_set
1576 : REAL(KIND=dp) :: filter, fval, hfx
1577 : TYPE(section_vals_type), POINTER :: dipole_section, mgrid_section, &
1578 : soc_section, stda_section, xc_func, &
1579 : xc_section
1580 :
1581 6686 : CALL timeset(routineN, handle)
1582 :
1583 6686 : CALL section_vals_val_get(t_section, "_SECTION_PARAMETERS_", l_val=t_control%enabled)
1584 :
1585 6686 : CALL section_vals_val_get(t_section, "NSTATES", i_val=t_control%nstates)
1586 6686 : CALL section_vals_val_get(t_section, "MAX_ITER", i_val=t_control%niters)
1587 6686 : CALL section_vals_val_get(t_section, "MAX_KV", i_val=t_control%nkvs)
1588 6686 : CALL section_vals_val_get(t_section, "NLUMO", i_val=t_control%nlumo)
1589 6686 : CALL section_vals_val_get(t_section, "NPROC_STATE", i_val=t_control%nprocs)
1590 6686 : CALL section_vals_val_get(t_section, "KERNEL", i_val=t_control%kernel)
1591 6686 : CALL section_vals_val_get(t_section, "OE_CORR", i_val=t_control%oe_corr)
1592 6686 : CALL section_vals_val_get(t_section, "EV_SHIFT", r_val=t_control%ev_shift)
1593 6686 : CALL section_vals_val_get(t_section, "EOS_SHIFT", r_val=t_control%eos_shift)
1594 :
1595 6686 : CALL section_vals_val_get(t_section, "CONVERGENCE", r_val=t_control%conv)
1596 6686 : CALL section_vals_val_get(t_section, "MIN_AMPLITUDE", r_val=t_control%min_excitation_amplitude)
1597 6686 : CALL section_vals_val_get(t_section, "ORTHOGONAL_EPS", r_val=t_control%orthogonal_eps)
1598 :
1599 6686 : CALL section_vals_val_get(t_section, "RESTART", l_val=t_control%is_restart)
1600 6686 : CALL section_vals_val_get(t_section, "RKS_TRIPLETS", l_val=t_control%rks_triplets)
1601 6686 : CALL section_vals_val_get(t_section, "DO_LRIGPW", l_val=t_control%do_lrigpw)
1602 6686 : CALL section_vals_val_get(t_section, "ADMM_KERNEL_CORRECTION_SYMMETRIC", l_val=t_control%admm_symm)
1603 6686 : CALL section_vals_val_get(t_section, "ADMM_KERNEL_XC_CORRECTION", l_val=t_control%admm_xc_correction)
1604 :
1605 : ! read automatically generated auxiliary basis for LRI
1606 6686 : CALL section_vals_val_get(t_section, "AUTO_BASIS", n_rep_val=nrep)
1607 13372 : DO irep = 1, nrep
1608 6686 : CALL section_vals_val_get(t_section, "AUTO_BASIS", i_rep_val=irep, c_vals=tmpstringlist)
1609 13372 : IF (SIZE(tmpstringlist) == 2) THEN
1610 6686 : CALL uppercase(tmpstringlist(2))
1611 6686 : SELECT CASE (tmpstringlist(2))
1612 : CASE ("X")
1613 0 : isize = -1
1614 : CASE ("SMALL")
1615 0 : isize = 0
1616 : CASE ("MEDIUM")
1617 0 : isize = 1
1618 : CASE ("LARGE")
1619 0 : isize = 2
1620 : CASE ("HUGE")
1621 0 : isize = 3
1622 : CASE DEFAULT
1623 6686 : CPABORT("Unknown basis size in AUTO_BASIS keyword:"//TRIM(tmpstringlist(1)))
1624 : END SELECT
1625 : !
1626 6686 : SELECT CASE (tmpstringlist(1))
1627 : CASE ("X")
1628 : CASE ("P_LRI_AUX")
1629 0 : t_control%auto_basis_p_lri_aux = isize
1630 : CASE DEFAULT
1631 6686 : CPABORT("Unknown basis type in AUTO_BASIS keyword:"//TRIM(tmpstringlist(1)))
1632 : END SELECT
1633 : ELSE
1634 : CALL cp_abort(__LOCATION__, &
1635 0 : "AUTO_BASIS keyword in &PROPERTIES &TDDFT section has a wrong number of arguments.")
1636 : END IF
1637 : END DO
1638 :
1639 6686 : IF (t_control%conv < 0) &
1640 0 : t_control%conv = ABS(t_control%conv)
1641 :
1642 : ! DIPOLE_MOMENTS subsection
1643 6686 : dipole_section => section_vals_get_subs_vals(t_section, "DIPOLE_MOMENTS")
1644 6686 : CALL section_vals_val_get(dipole_section, "DIPOLE_FORM", explicit=explicit)
1645 6686 : IF (explicit) THEN
1646 10 : CALL section_vals_val_get(dipole_section, "DIPOLE_FORM", i_val=t_control%dipole_form)
1647 : ELSE
1648 6676 : t_control%dipole_form = 0
1649 : END IF
1650 6686 : CALL section_vals_val_get(dipole_section, "REFERENCE", i_val=t_control%dipole_reference)
1651 6686 : CALL section_vals_val_get(dipole_section, "REFERENCE_POINT", explicit=explicit)
1652 6686 : IF (explicit) THEN
1653 0 : CALL section_vals_val_get(dipole_section, "REFERENCE_POINT", r_vals=t_control%dipole_ref_point)
1654 : ELSE
1655 6686 : NULLIFY (t_control%dipole_ref_point)
1656 6686 : IF (t_control%dipole_form == tddfpt_dipole_length .AND. t_control%dipole_reference == use_mom_ref_user) THEN
1657 0 : CPABORT("User-defined reference point should be given explicitly")
1658 : END IF
1659 : END IF
1660 :
1661 : !SOC subsection
1662 6686 : soc_section => section_vals_get_subs_vals(t_section, "SOC")
1663 6686 : CALL section_vals_get(soc_section, explicit=explicit)
1664 6686 : IF (explicit) THEN
1665 8 : t_control%do_soc = .TRUE.
1666 : END IF
1667 :
1668 : ! MGRID subsection
1669 6686 : mgrid_section => section_vals_get_subs_vals(t_section, "MGRID")
1670 6686 : CALL section_vals_get(mgrid_section, explicit=t_control%mgrid_is_explicit)
1671 :
1672 6686 : IF (t_control%mgrid_is_explicit) THEN
1673 2 : CALL section_vals_val_get(mgrid_section, "NGRIDS", i_val=t_control%mgrid_ngrids, explicit=explicit)
1674 2 : IF (.NOT. explicit) t_control%mgrid_ngrids = SIZE(qs_control%e_cutoff)
1675 :
1676 2 : CALL section_vals_val_get(mgrid_section, "CUTOFF", r_val=t_control%mgrid_cutoff, explicit=explicit)
1677 2 : IF (.NOT. explicit) t_control%mgrid_cutoff = qs_control%cutoff
1678 :
1679 : CALL section_vals_val_get(mgrid_section, "PROGRESSION_FACTOR", &
1680 2 : r_val=t_control%mgrid_progression_factor, explicit=explicit)
1681 2 : IF (explicit) THEN
1682 0 : IF (t_control%mgrid_progression_factor <= 1.0_dp) &
1683 : CALL cp_abort(__LOCATION__, &
1684 0 : "Progression factor should be greater then 1.0 to ensure multi-grid ordering")
1685 : ELSE
1686 2 : t_control%mgrid_progression_factor = qs_control%progression_factor
1687 : END IF
1688 :
1689 2 : CALL section_vals_val_get(mgrid_section, "COMMENSURATE", l_val=t_control%mgrid_commensurate_mgrids, explicit=explicit)
1690 2 : IF (.NOT. explicit) t_control%mgrid_commensurate_mgrids = qs_control%commensurate_mgrids
1691 2 : IF (t_control%mgrid_commensurate_mgrids) THEN
1692 0 : IF (explicit) THEN
1693 0 : t_control%mgrid_progression_factor = 4.0_dp
1694 : ELSE
1695 0 : t_control%mgrid_progression_factor = qs_control%progression_factor
1696 : END IF
1697 : END IF
1698 :
1699 2 : CALL section_vals_val_get(mgrid_section, "REL_CUTOFF", r_val=t_control%mgrid_relative_cutoff, explicit=explicit)
1700 2 : IF (.NOT. explicit) t_control%mgrid_relative_cutoff = qs_control%relative_cutoff
1701 :
1702 2 : CALL section_vals_val_get(mgrid_section, "MULTIGRID_SET", l_val=multigrid_set, explicit=explicit)
1703 2 : IF (.NOT. explicit) multigrid_set = .FALSE.
1704 2 : IF (multigrid_set) THEN
1705 0 : CALL section_vals_val_get(mgrid_section, "MULTIGRID_CUTOFF", r_vals=t_control%mgrid_e_cutoff)
1706 : ELSE
1707 2 : NULLIFY (t_control%mgrid_e_cutoff)
1708 : END IF
1709 :
1710 2 : CALL section_vals_val_get(mgrid_section, "REALSPACE", l_val=t_control%mgrid_realspace_mgrids, explicit=explicit)
1711 2 : IF (.NOT. explicit) t_control%mgrid_realspace_mgrids = qs_control%realspace_mgrids
1712 :
1713 : CALL section_vals_val_get(mgrid_section, "SKIP_LOAD_BALANCE_DISTRIBUTED", &
1714 2 : l_val=t_control%mgrid_skip_load_balance, explicit=explicit)
1715 2 : IF (.NOT. explicit) t_control%mgrid_skip_load_balance = qs_control%skip_load_balance_distributed
1716 :
1717 2 : IF (ASSOCIATED(t_control%mgrid_e_cutoff)) THEN
1718 0 : IF (SIZE(t_control%mgrid_e_cutoff) /= t_control%mgrid_ngrids) &
1719 0 : CPABORT("Inconsistent values for number of multi-grids")
1720 :
1721 : ! sort multi-grids in descending order according to their cutoff values
1722 0 : t_control%mgrid_e_cutoff = -t_control%mgrid_e_cutoff
1723 0 : ALLOCATE (inds(t_control%mgrid_ngrids))
1724 0 : CALL sort(t_control%mgrid_e_cutoff, t_control%mgrid_ngrids, inds)
1725 0 : DEALLOCATE (inds)
1726 0 : t_control%mgrid_e_cutoff = -t_control%mgrid_e_cutoff
1727 : END IF
1728 : END IF
1729 :
1730 : ! expand XC subsection (if given explicitly)
1731 6686 : xc_section => section_vals_get_subs_vals(t_section, "XC")
1732 6686 : xc_func => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
1733 6686 : CALL section_vals_get(xc_func, explicit=explicit)
1734 6686 : IF (explicit) &
1735 192 : CALL xc_functionals_expand(xc_func, xc_section)
1736 :
1737 : ! sTDA subsection
1738 6686 : stda_section => section_vals_get_subs_vals(t_section, "STDA")
1739 6686 : IF (t_control%kernel == tddfpt_kernel_stda) THEN
1740 118 : t_control%stda_control%hfx_fraction = 0.0_dp
1741 118 : t_control%stda_control%do_exchange = .TRUE.
1742 118 : t_control%stda_control%eps_td_filter = 1.e-10_dp
1743 118 : t_control%stda_control%mn_alpha = -99.0_dp
1744 118 : t_control%stda_control%mn_beta = -99.0_dp
1745 : ! set default for Ewald method (on/off) dependent on periodicity
1746 212 : SELECT CASE (qs_control%periodicity)
1747 : CASE (0)
1748 94 : t_control%stda_control%do_ewald = .FALSE.
1749 : CASE (1)
1750 0 : t_control%stda_control%do_ewald = .TRUE.
1751 : CASE (2)
1752 0 : t_control%stda_control%do_ewald = .TRUE.
1753 : CASE (3)
1754 24 : t_control%stda_control%do_ewald = .TRUE.
1755 : CASE DEFAULT
1756 118 : CPABORT("Illegal value for periodiciy")
1757 : END SELECT
1758 118 : CALL section_vals_get(stda_section, explicit=explicit)
1759 118 : IF (explicit) THEN
1760 104 : CALL section_vals_val_get(stda_section, "HFX_FRACTION", r_val=hfx, explicit=expl)
1761 104 : IF (expl) t_control%stda_control%hfx_fraction = hfx
1762 104 : CALL section_vals_val_get(stda_section, "EPS_TD_FILTER", r_val=filter, explicit=expl)
1763 104 : IF (expl) t_control%stda_control%eps_td_filter = filter
1764 104 : CALL section_vals_val_get(stda_section, "DO_EWALD", l_val=do_ewald, explicit=expl)
1765 104 : IF (expl) t_control%stda_control%do_ewald = do_ewald
1766 104 : CALL section_vals_val_get(stda_section, "DO_EXCHANGE", l_val=do_exchange, explicit=expl)
1767 104 : IF (expl) t_control%stda_control%do_exchange = do_exchange
1768 104 : CALL section_vals_val_get(stda_section, "MATAGA_NISHIMOTO_CEXP", r_val=fval)
1769 104 : t_control%stda_control%mn_alpha = fval
1770 104 : CALL section_vals_val_get(stda_section, "MATAGA_NISHIMOTO_XEXP", r_val=fval)
1771 104 : t_control%stda_control%mn_beta = fval
1772 : END IF
1773 118 : CALL section_vals_val_get(stda_section, "COULOMB_SR_CUT", r_val=fval)
1774 118 : t_control%stda_control%coulomb_sr_cut = fval
1775 118 : CALL section_vals_val_get(stda_section, "COULOMB_SR_EPS", r_val=fval)
1776 118 : t_control%stda_control%coulomb_sr_eps = fval
1777 : END IF
1778 :
1779 6686 : CALL timestop(handle)
1780 6686 : END SUBROUTINE read_tddfpt2_control
1781 :
1782 : ! **************************************************************************************************
1783 : !> \brief Write the DFT control parameters to the output unit.
1784 : !> \param dft_control ...
1785 : !> \param dft_section ...
1786 : ! **************************************************************************************************
1787 11864 : SUBROUTINE write_dft_control(dft_control, dft_section)
1788 : TYPE(dft_control_type), POINTER :: dft_control
1789 : TYPE(section_vals_type), POINTER :: dft_section
1790 :
1791 : CHARACTER(len=*), PARAMETER :: routineN = 'write_dft_control'
1792 :
1793 : CHARACTER(LEN=20) :: tmpStr
1794 : INTEGER :: handle, output_unit
1795 : REAL(kind=dp) :: density_cut, density_smooth_cut_range, &
1796 : gradient_cut, tau_cut
1797 : TYPE(cp_logger_type), POINTER :: logger
1798 : TYPE(enumeration_type), POINTER :: enum
1799 : TYPE(keyword_type), POINTER :: keyword
1800 : TYPE(section_type), POINTER :: section
1801 : TYPE(section_vals_type), POINTER :: xc_section
1802 :
1803 7190 : IF (dft_control%qs_control%semi_empirical) RETURN
1804 5686 : IF (dft_control%qs_control%dftb) RETURN
1805 5464 : IF (dft_control%qs_control%xtb) THEN
1806 284 : CALL write_xtb_control(dft_control%qs_control%xtb_control, dft_section)
1807 284 : RETURN
1808 : END IF
1809 5180 : CALL timeset(routineN, handle)
1810 :
1811 5180 : NULLIFY (logger)
1812 5180 : logger => cp_get_default_logger()
1813 :
1814 : output_unit = cp_print_key_unit_nr(logger, dft_section, &
1815 5180 : "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
1816 :
1817 5180 : IF (output_unit > 0) THEN
1818 :
1819 1336 : xc_section => section_vals_get_subs_vals(dft_section, "XC")
1820 :
1821 1336 : IF (dft_control%uks) THEN
1822 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T78,A)") &
1823 411 : "DFT| Spin unrestricted (spin-polarized) Kohn-Sham calculation", "UKS"
1824 925 : ELSE IF (dft_control%roks) THEN
1825 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T77,A)") &
1826 15 : "DFT| Spin restricted open Kohn-Sham calculation", "ROKS"
1827 : ELSE
1828 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T78,A)") &
1829 910 : "DFT| Spin restricted Kohn-Sham (RKS) calculation", "RKS"
1830 : END IF
1831 :
1832 : WRITE (UNIT=output_unit, FMT="(T2,A,T76,I5)") &
1833 1336 : "DFT| Multiplicity", dft_control%multiplicity
1834 : WRITE (UNIT=output_unit, FMT="(T2,A,T76,I5)") &
1835 1336 : "DFT| Number of spin states", dft_control%nspins
1836 :
1837 : WRITE (UNIT=output_unit, FMT="(T2,A,T76,I5)") &
1838 1336 : "DFT| Charge", dft_control%charge
1839 :
1840 1336 : IF (dft_control%sic_method_id .NE. sic_none) CALL cite_reference(VandeVondele2005b)
1841 2658 : SELECT CASE (dft_control%sic_method_id)
1842 : CASE (sic_none)
1843 1322 : tmpstr = "NO"
1844 : CASE (sic_mauri_spz)
1845 6 : tmpstr = "SPZ/MAURI SIC"
1846 : CASE (sic_mauri_us)
1847 3 : tmpstr = "US/MAURI SIC"
1848 : CASE (sic_ad)
1849 3 : tmpstr = "AD SIC"
1850 : CASE (sic_eo)
1851 2 : tmpstr = "Explicit Orbital SIC"
1852 : CASE DEFAULT
1853 : ! fix throughout the cp2k for this option
1854 1336 : CPABORT("SIC option unknown")
1855 : END SELECT
1856 :
1857 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
1858 1336 : "DFT| Self-interaction correction (SIC)", ADJUSTR(TRIM(tmpstr))
1859 :
1860 1336 : IF (dft_control%sic_method_id /= sic_none) THEN
1861 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,ES15.6)") &
1862 14 : "DFT| SIC scaling parameter a", dft_control%sic_scaling_a, &
1863 28 : "DFT| SIC scaling parameter b", dft_control%sic_scaling_b
1864 : END IF
1865 :
1866 1336 : IF (dft_control%sic_method_id == sic_eo) THEN
1867 2 : IF (dft_control%sic_list_id == sic_list_all) THEN
1868 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,A)") &
1869 1 : "DFT| SIC orbitals", "ALL"
1870 : END IF
1871 2 : IF (dft_control%sic_list_id == sic_list_unpaired) THEN
1872 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,A)") &
1873 1 : "DFT| SIC orbitals", "UNPAIRED"
1874 : END IF
1875 : END IF
1876 :
1877 1336 : CALL section_vals_val_get(xc_section, "density_cutoff", r_val=density_cut)
1878 1336 : CALL section_vals_val_get(xc_section, "gradient_cutoff", r_val=gradient_cut)
1879 1336 : CALL section_vals_val_get(xc_section, "tau_cutoff", r_val=tau_cut)
1880 1336 : CALL section_vals_val_get(xc_section, "density_smooth_cutoff_range", r_val=density_smooth_cut_range)
1881 :
1882 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,ES15.6)") &
1883 1336 : "DFT| Cutoffs: density ", density_cut, &
1884 1336 : "DFT| gradient", gradient_cut, &
1885 1336 : "DFT| tau ", tau_cut, &
1886 2672 : "DFT| cutoff_smoothing_range", density_smooth_cut_range
1887 : CALL section_vals_val_get(xc_section, "XC_GRID%XC_SMOOTH_RHO", &
1888 1336 : c_val=tmpStr)
1889 : WRITE (output_unit, '( A, T61, A )') &
1890 1336 : " DFT| XC density smoothing ", ADJUSTR(tmpStr)
1891 : CALL section_vals_val_get(xc_section, "XC_GRID%XC_DERIV", &
1892 1336 : c_val=tmpStr)
1893 : WRITE (output_unit, '( A, T61, A )') &
1894 1336 : " DFT| XC derivatives ", ADJUSTR(tmpStr)
1895 1336 : IF (dft_control%dft_plus_u) THEN
1896 16 : NULLIFY (enum, keyword, section)
1897 16 : CALL create_dft_section(section)
1898 16 : keyword => section_get_keyword(section, "PLUS_U_METHOD")
1899 16 : CALL keyword_get(keyword, enum=enum)
1900 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T41,A40)") &
1901 16 : "DFT+U| Method", ADJUSTR(TRIM(enum_i2c(enum, dft_control%plus_u_method_id)))
1902 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
1903 16 : "DFT+U| Check atomic kind information for details"
1904 16 : CALL section_release(section)
1905 : END IF
1906 :
1907 1336 : WRITE (UNIT=output_unit, FMT="(A)") ""
1908 1336 : CALL xc_write(output_unit, xc_section, dft_control%lsd)
1909 :
1910 1336 : IF (dft_control%apply_period_efield) THEN
1911 4 : WRITE (UNIT=output_unit, FMT="(A)") ""
1912 4 : IF (dft_control%period_efield%displacement_field) THEN
1913 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
1914 0 : "PERIODIC_EFIELD| Use displacement field formulation"
1915 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,1X,ES14.6)") &
1916 0 : "PERIODIC_EFIELD| Displacement field filter: x", &
1917 0 : dft_control%period_efield%d_filter(1), &
1918 0 : "PERIODIC_EFIELD| y", &
1919 0 : dft_control%period_efield%d_filter(2), &
1920 0 : "PERIODIC_EFIELD| z", &
1921 0 : dft_control%period_efield%d_filter(3)
1922 : END IF
1923 : WRITE (UNIT=output_unit, FMT="(T2,A,T66,1X,ES14.6)") &
1924 4 : "PERIODIC_EFIELD| Polarisation vector: x", &
1925 4 : dft_control%period_efield%polarisation(1), &
1926 4 : "PERIODIC_EFIELD| y", &
1927 4 : dft_control%period_efield%polarisation(2), &
1928 4 : "PERIODIC_EFIELD| z", &
1929 4 : dft_control%period_efield%polarisation(3), &
1930 4 : "PERIODIC_EFIELD| Intensity [a.u.]:", &
1931 8 : dft_control%period_efield%strength
1932 16 : IF (SQRT(DOT_PRODUCT(dft_control%period_efield%polarisation, &
1933 : dft_control%period_efield%polarisation)) < EPSILON(0.0_dp)) THEN
1934 0 : CPABORT("Invalid (too small) polarisation vector specified for PERIODIC_EFIELD")
1935 : END IF
1936 : END IF
1937 :
1938 1336 : IF (dft_control%do_sccs) THEN
1939 : WRITE (UNIT=output_unit, FMT="(/,T2,A)") &
1940 5 : "SCCS| Self-consistent continuum solvation model"
1941 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1942 5 : "SCCS| Relative permittivity of the solvent (medium)", &
1943 5 : dft_control%sccs_control%epsilon_solvent, &
1944 5 : "SCCS| Absolute permittivity [a.u.]", &
1945 10 : dft_control%sccs_control%epsilon_solvent/fourpi
1946 9 : SELECT CASE (dft_control%sccs_control%method_id)
1947 : CASE (sccs_andreussi)
1948 : WRITE (UNIT=output_unit, FMT="(T2,A,/,(T2,A,T61,ES20.6))") &
1949 4 : "SCCS| Dielectric function proposed by Andreussi et al.", &
1950 4 : "SCCS| rho_max", dft_control%sccs_control%rho_max, &
1951 8 : "SCCS| rho_min", dft_control%sccs_control%rho_min
1952 : CASE (sccs_fattebert_gygi)
1953 : WRITE (UNIT=output_unit, FMT="(T2,A,/,(T2,A,T61,ES20.6))") &
1954 1 : "SCCS| Dielectric function proposed by Fattebert and Gygi", &
1955 1 : "SCCS| beta", dft_control%sccs_control%beta, &
1956 2 : "SCCS| rho_zero", dft_control%sccs_control%rho_zero
1957 : CASE DEFAULT
1958 5 : CPABORT("Invalid SCCS model specified. Please, check your input!")
1959 : END SELECT
1960 6 : SELECT CASE (dft_control%sccs_control%derivative_method)
1961 : CASE (sccs_derivative_fft)
1962 : WRITE (UNIT=output_unit, FMT="(T2,A,T46,A35)") &
1963 1 : "SCCS| Numerical derivative calculation", &
1964 2 : ADJUSTR("FFT")
1965 : CASE (sccs_derivative_cd3)
1966 : WRITE (UNIT=output_unit, FMT="(T2,A,T46,A35)") &
1967 0 : "SCCS| Numerical derivative calculation", &
1968 0 : ADJUSTR("3-point stencil central differences")
1969 : CASE (sccs_derivative_cd5)
1970 : WRITE (UNIT=output_unit, FMT="(T2,A,T46,A35)") &
1971 4 : "SCCS| Numerical derivative calculation", &
1972 8 : ADJUSTR("5-point stencil central differences")
1973 : CASE (sccs_derivative_cd7)
1974 : WRITE (UNIT=output_unit, FMT="(T2,A,T46,A35)") &
1975 0 : "SCCS| Numerical derivative calculation", &
1976 0 : ADJUSTR("7-point stencil central differences")
1977 : CASE DEFAULT
1978 : CALL cp_abort(__LOCATION__, &
1979 : "Invalid derivative method specified for SCCS model. "// &
1980 5 : "Please, check your input!")
1981 : END SELECT
1982 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1983 5 : "SCCS| Repulsion parameter alpha [mN/m] = [dyn/cm]", &
1984 10 : cp_unit_from_cp2k(dft_control%sccs_control%alpha_solvent, "mN/m")
1985 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1986 5 : "SCCS| Dispersion parameter beta [GPa]", &
1987 10 : cp_unit_from_cp2k(dft_control%sccs_control%beta_solvent, "GPa")
1988 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1989 5 : "SCCS| Surface tension gamma [mN/m] = [dyn/cm]", &
1990 10 : cp_unit_from_cp2k(dft_control%sccs_control%gamma_solvent, "mN/m")
1991 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1992 5 : "SCCS| Mixing parameter applied during the iteration cycle", &
1993 10 : dft_control%sccs_control%mixing
1994 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
1995 5 : "SCCS| Tolerance for the convergence of the SCCS iteration cycle", &
1996 10 : dft_control%sccs_control%eps_sccs
1997 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,I20)") &
1998 5 : "SCCS| Maximum number of iteration steps", &
1999 10 : dft_control%sccs_control%max_iter
2000 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
2001 5 : "SCCS| SCF convergence threshold for starting the SCCS iteration", &
2002 10 : dft_control%sccs_control%eps_scf
2003 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.6)") &
2004 5 : "SCCS| Numerical increment for the cavity surface calculation", &
2005 10 : dft_control%sccs_control%delta_rho
2006 : END IF
2007 :
2008 1336 : WRITE (UNIT=output_unit, FMT="(A)") ""
2009 :
2010 : END IF
2011 :
2012 : CALL cp_print_key_finished_output(output_unit, logger, dft_section, &
2013 5180 : "PRINT%DFT_CONTROL_PARAMETERS")
2014 :
2015 5180 : CALL timestop(handle)
2016 :
2017 : END SUBROUTINE write_dft_control
2018 :
2019 : ! **************************************************************************************************
2020 : !> \brief Write the ADMM control parameters to the output unit.
2021 : !> \param admm_control ...
2022 : !> \param dft_section ...
2023 : ! **************************************************************************************************
2024 442 : SUBROUTINE write_admm_control(admm_control, dft_section)
2025 : TYPE(admm_control_type), POINTER :: admm_control
2026 : TYPE(section_vals_type), POINTER :: dft_section
2027 :
2028 : INTEGER :: iounit
2029 : TYPE(cp_logger_type), POINTER :: logger
2030 :
2031 442 : NULLIFY (logger)
2032 442 : logger => cp_get_default_logger()
2033 :
2034 : iounit = cp_print_key_unit_nr(logger, dft_section, &
2035 442 : "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
2036 :
2037 442 : IF (iounit > 0) THEN
2038 :
2039 233 : SELECT CASE (admm_control%admm_type)
2040 : CASE (no_admm_type)
2041 114 : WRITE (UNIT=iounit, FMT="(/,T2,A,T77,A)") "ADMM| Specific ADMM type specified", "NONE"
2042 : CASE (admm1_type)
2043 1 : WRITE (UNIT=iounit, FMT="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMM1"
2044 : CASE (admm2_type)
2045 1 : WRITE (UNIT=iounit, FMT="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMM2"
2046 : CASE (admms_type)
2047 1 : WRITE (UNIT=iounit, FMT="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMS"
2048 : CASE (admmp_type)
2049 1 : WRITE (UNIT=iounit, FMT="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMP"
2050 : CASE (admmq_type)
2051 1 : WRITE (UNIT=iounit, FMT="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMQ"
2052 : CASE DEFAULT
2053 119 : CPABORT("admm_type")
2054 : END SELECT
2055 :
2056 189 : SELECT CASE (admm_control%purification_method)
2057 : CASE (do_admm_purify_none)
2058 70 : WRITE (UNIT=iounit, FMT="(T2,A,T77,A)") "ADMM| Density matrix purification method", "NONE"
2059 : CASE (do_admm_purify_cauchy)
2060 9 : WRITE (UNIT=iounit, FMT="(T2,A,T75,A)") "ADMM| Density matrix purification method", "Cauchy"
2061 : CASE (do_admm_purify_cauchy_subspace)
2062 5 : WRITE (UNIT=iounit, FMT="(T2,A,T66,A)") "ADMM| Density matrix purification method", "Cauchy subspace"
2063 : CASE (do_admm_purify_mo_diag)
2064 25 : WRITE (UNIT=iounit, FMT="(T2,A,T63,A)") "ADMM| Density matrix purification method", "MO diagonalization"
2065 : CASE (do_admm_purify_mo_no_diag)
2066 3 : WRITE (UNIT=iounit, FMT="(T2,A,T71,A)") "ADMM| Density matrix purification method", "MO no diag"
2067 : CASE (do_admm_purify_mcweeny)
2068 1 : WRITE (UNIT=iounit, FMT="(T2,A,T74,A)") "ADMM| Density matrix purification method", "McWeeny"
2069 : CASE (do_admm_purify_none_dm)
2070 6 : WRITE (UNIT=iounit, FMT="(T2,A,T73,A)") "ADMM| Density matrix purification method", "NONE(DM)"
2071 : CASE DEFAULT
2072 119 : CPABORT("admm_purification_method")
2073 : END SELECT
2074 :
2075 214 : SELECT CASE (admm_control%method)
2076 : CASE (do_admm_basis_projection)
2077 95 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| Orbital projection on ADMM basis"
2078 : CASE (do_admm_blocking_purify_full)
2079 3 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| Blocked Fock matrix projection with full purification"
2080 : CASE (do_admm_blocked_projection)
2081 6 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| Blocked Fock matrix projection"
2082 : CASE (do_admm_charge_constrained_projection)
2083 15 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| Orbital projection with charge constrain"
2084 : CASE DEFAULT
2085 119 : CPABORT("admm method")
2086 : END SELECT
2087 :
2088 136 : SELECT CASE (admm_control%scaling_model)
2089 : CASE (do_admm_exch_scaling_none)
2090 : CASE (do_admm_exch_scaling_merlot)
2091 17 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| Use Merlot (2014) scaling model"
2092 : CASE DEFAULT
2093 119 : CPABORT("admm scaling_model")
2094 : END SELECT
2095 :
2096 119 : WRITE (UNIT=iounit, FMT="(T2,A,T61,G20.10)") "ADMM| eps_filter", admm_control%eps_filter
2097 :
2098 127 : SELECT CASE (admm_control%aux_exch_func)
2099 : CASE (do_admm_aux_exch_func_none)
2100 8 : WRITE (UNIT=iounit, FMT="(T2,A)") "ADMM| No exchange functional correction term used"
2101 : CASE (do_admm_aux_exch_func_default, do_admm_aux_exch_func_default_libxc)
2102 85 : WRITE (UNIT=iounit, FMT="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "(W)PBEX"
2103 : CASE (do_admm_aux_exch_func_pbex, do_admm_aux_exch_func_pbex_libxc)
2104 17 : WRITE (UNIT=iounit, FMT="(T2,A,T77,A)") "ADMM| Exchange functional in correction term", "PBEX"
2105 : CASE (do_admm_aux_exch_func_opt, do_admm_aux_exch_func_opt_libxc)
2106 8 : WRITE (UNIT=iounit, FMT="(T2,A,T77,A)") "ADMM| Exchange functional in correction term", "OPTX"
2107 : CASE (do_admm_aux_exch_func_bee, do_admm_aux_exch_func_bee_libxc)
2108 1 : WRITE (UNIT=iounit, FMT="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "Becke88"
2109 : CASE (do_admm_aux_exch_func_sx_libxc)
2110 0 : WRITE (UNIT=iounit, FMT="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "SlaterX"
2111 : CASE DEFAULT
2112 119 : CPABORT("admm aux_exch_func")
2113 : END SELECT
2114 :
2115 119 : WRITE (UNIT=iounit, FMT="(A)") ""
2116 :
2117 : END IF
2118 :
2119 : CALL cp_print_key_finished_output(iounit, logger, dft_section, &
2120 442 : "PRINT%DFT_CONTROL_PARAMETERS")
2121 442 : END SUBROUTINE write_admm_control
2122 :
2123 : ! **************************************************************************************************
2124 : !> \brief Write the xTB control parameters to the output unit.
2125 : !> \param xtb_control ...
2126 : !> \param dft_section ...
2127 : ! **************************************************************************************************
2128 284 : SUBROUTINE write_xtb_control(xtb_control, dft_section)
2129 : TYPE(xtb_control_type), POINTER :: xtb_control
2130 : TYPE(section_vals_type), POINTER :: dft_section
2131 :
2132 : CHARACTER(len=*), PARAMETER :: routineN = 'write_xtb_control'
2133 :
2134 : INTEGER :: handle, output_unit
2135 : TYPE(cp_logger_type), POINTER :: logger
2136 :
2137 284 : CALL timeset(routineN, handle)
2138 284 : NULLIFY (logger)
2139 284 : logger => cp_get_default_logger()
2140 :
2141 : output_unit = cp_print_key_unit_nr(logger, dft_section, &
2142 284 : "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
2143 :
2144 284 : IF (output_unit > 0) THEN
2145 :
2146 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T31,A50)") &
2147 37 : "xTB| Parameter file", ADJUSTR(TRIM(xtb_control%parameter_file_name))
2148 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,I10)") &
2149 37 : "xTB| Basis expansion STO-NG", xtb_control%sto_ng
2150 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,I10)") &
2151 37 : "xTB| Basis expansion STO-NG for Hydrogen", xtb_control%h_sto_ng
2152 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,E10.4)") &
2153 37 : "xTB| Repulsive pair potential accuracy", xtb_control%eps_pair
2154 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.6)") &
2155 37 : "xTB| Repulsive enhancement factor", xtb_control%enscale
2156 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,L10)") &
2157 37 : "xTB| Halogen interaction potential", xtb_control%xb_interaction
2158 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.3)") &
2159 37 : "xTB| Halogen interaction potential cutoff radius", xtb_control%xb_radius
2160 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,L10)") &
2161 37 : "xTB| Nonbonded interactions", xtb_control%do_nonbonded
2162 37 : SELECT CASE (xtb_control%vdw_type)
2163 : CASE (xtb_vdw_type_none)
2164 0 : WRITE (UNIT=output_unit, FMT="(T2,A)") "xTB| No vdW potential selected"
2165 : CASE (xtb_vdw_type_d3)
2166 37 : WRITE (UNIT=output_unit, FMT="(T2,A,T72,A)") "xTB| vdW potential type:", "DFTD3(BJ)"
2167 : WRITE (UNIT=output_unit, FMT="(T2,A,T31,A50)") &
2168 37 : "xTB| D3 Dispersion: Parameter file", ADJUSTR(TRIM(xtb_control%dispersion_parameter_file))
2169 : CASE (xtb_vdw_type_d4)
2170 0 : WRITE (UNIT=output_unit, FMT="(T2,A,T76,A)") "xTB| vdW potential type:", "DFTD4"
2171 : WRITE (UNIT=output_unit, FMT="(T2,A,T31,A50)") &
2172 0 : "xTB| D4 Dispersion: Parameter file", ADJUSTR(TRIM(xtb_control%dispersion_parameter_file))
2173 : CASE DEFAULT
2174 37 : CPABORT("vdw type")
2175 : END SELECT
2176 : WRITE (UNIT=output_unit, FMT="(T2,A,T51,3F10.3)") &
2177 37 : "xTB| Huckel constants ks kp kd", xtb_control%ks, xtb_control%kp, xtb_control%kd
2178 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,2F10.3)") &
2179 37 : "xTB| Huckel constants ksp k2sh", xtb_control%ksp, xtb_control%k2sh
2180 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.3)") &
2181 37 : "xTB| Mataga-Nishimoto exponent", xtb_control%kg
2182 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.3)") &
2183 37 : "xTB| Repulsion potential exponent", xtb_control%kf
2184 : WRITE (UNIT=output_unit, FMT="(T2,A,T51,3F10.3)") &
2185 37 : "xTB| Coordination number scaling kcn(s) kcn(p) kcn(d)", &
2186 74 : xtb_control%kcns, xtb_control%kcnp, xtb_control%kcnd
2187 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.3)") &
2188 37 : "xTB| Electronegativity scaling", xtb_control%ken
2189 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,2F10.3)") &
2190 37 : "xTB| Halogen potential scaling kxr kx2", xtb_control%kxr, xtb_control%kx2
2191 37 : WRITE (UNIT=output_unit, FMT="(/)")
2192 :
2193 : END IF
2194 :
2195 : CALL cp_print_key_finished_output(output_unit, logger, dft_section, &
2196 284 : "PRINT%DFT_CONTROL_PARAMETERS")
2197 :
2198 284 : CALL timestop(handle)
2199 :
2200 284 : END SUBROUTINE write_xtb_control
2201 :
2202 : ! **************************************************************************************************
2203 : !> \brief Purpose: Write the QS control parameters to the output unit.
2204 : !> \param qs_control ...
2205 : !> \param dft_section ...
2206 : ! **************************************************************************************************
2207 11864 : SUBROUTINE write_qs_control(qs_control, dft_section)
2208 : TYPE(qs_control_type), INTENT(IN) :: qs_control
2209 : TYPE(section_vals_type), POINTER :: dft_section
2210 :
2211 : CHARACTER(len=*), PARAMETER :: routineN = 'write_qs_control'
2212 :
2213 : CHARACTER(len=20) :: method, quadrature
2214 : INTEGER :: handle, i, igrid_level, ngrid_level, &
2215 : output_unit
2216 : TYPE(cp_logger_type), POINTER :: logger
2217 : TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
2218 : TYPE(enumeration_type), POINTER :: enum
2219 : TYPE(keyword_type), POINTER :: keyword
2220 : TYPE(section_type), POINTER :: qs_section
2221 : TYPE(section_vals_type), POINTER :: print_section_vals, qs_section_vals
2222 :
2223 7190 : IF (qs_control%semi_empirical) RETURN
2224 5686 : IF (qs_control%dftb) RETURN
2225 5464 : IF (qs_control%xtb) RETURN
2226 5180 : CALL timeset(routineN, handle)
2227 5180 : NULLIFY (logger, print_section_vals, qs_section, qs_section_vals)
2228 5180 : logger => cp_get_default_logger()
2229 5180 : print_section_vals => section_vals_get_subs_vals(dft_section, "PRINT")
2230 5180 : qs_section_vals => section_vals_get_subs_vals(dft_section, "QS")
2231 5180 : CALL section_vals_get(qs_section_vals, section=qs_section)
2232 :
2233 5180 : NULLIFY (enum, keyword)
2234 5180 : keyword => section_get_keyword(qs_section, "METHOD")
2235 5180 : CALL keyword_get(keyword, enum=enum)
2236 5180 : method = enum_i2c(enum, qs_control%method_id)
2237 :
2238 5180 : NULLIFY (enum, keyword)
2239 5180 : keyword => section_get_keyword(qs_section, "QUADRATURE")
2240 5180 : CALL keyword_get(keyword, enum=enum)
2241 5180 : quadrature = enum_i2c(enum, qs_control%gapw_control%quadrature)
2242 :
2243 : output_unit = cp_print_key_unit_nr(logger, print_section_vals, &
2244 5180 : "DFT_CONTROL_PARAMETERS", extension=".Log")
2245 5180 : IF (output_unit > 0) THEN
2246 1336 : ngrid_level = SIZE(qs_control%e_cutoff)
2247 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T61,A20)") &
2248 1336 : "QS| Method:", ADJUSTR(method)
2249 1336 : IF (qs_control%pw_grid_opt%spherical) THEN
2250 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A)") &
2251 0 : "QS| Density plane wave grid type", " SPHERICAL HALFSPACE"
2252 1336 : ELSE IF (qs_control%pw_grid_opt%fullspace) THEN
2253 : WRITE (UNIT=output_unit, FMT="(T2,A,T57,A)") &
2254 1336 : "QS| Density plane wave grid type", " NON-SPHERICAL FULLSPACE"
2255 : ELSE
2256 : WRITE (UNIT=output_unit, FMT="(T2,A,T57,A)") &
2257 0 : "QS| Density plane wave grid type", " NON-SPHERICAL HALFSPACE"
2258 : END IF
2259 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,I10)") &
2260 1336 : "QS| Number of grid levels:", SIZE(qs_control%e_cutoff)
2261 1336 : IF (ngrid_level == 1) THEN
2262 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.1)") &
2263 69 : "QS| Density cutoff [a.u.]:", qs_control%e_cutoff(1)
2264 : ELSE
2265 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.1)") &
2266 1267 : "QS| Density cutoff [a.u.]:", qs_control%cutoff
2267 1267 : IF (qs_control%commensurate_mgrids) &
2268 131 : WRITE (UNIT=output_unit, FMT="(T2,A)") "QS| Using commensurate multigrids"
2269 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.1)") &
2270 1267 : "QS| Multi grid cutoff [a.u.]: 1) grid level", qs_control%e_cutoff(1)
2271 : WRITE (UNIT=output_unit, FMT="(T2,A,I3,A,T71,F10.1)") &
2272 3964 : ("QS| ", igrid_level, ") grid level", &
2273 5231 : qs_control%e_cutoff(igrid_level), &
2274 6498 : igrid_level=2, SIZE(qs_control%e_cutoff))
2275 : END IF
2276 1336 : IF (qs_control%pao) THEN
2277 0 : WRITE (UNIT=output_unit, FMT="(T2,A)") "QS| PAO active"
2278 : END IF
2279 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.1)") &
2280 1336 : "QS| Grid level progression factor:", qs_control%progression_factor
2281 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,F10.1)") &
2282 1336 : "QS| Relative density cutoff [a.u.]:", qs_control%relative_cutoff
2283 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2284 1336 : "QS| Interaction thresholds: eps_pgf_orb:", &
2285 1336 : qs_control%eps_pgf_orb, &
2286 1336 : "QS| eps_filter_matrix:", &
2287 1336 : qs_control%eps_filter_matrix, &
2288 1336 : "QS| eps_core_charge:", &
2289 1336 : qs_control%eps_core_charge, &
2290 1336 : "QS| eps_rho_gspace:", &
2291 1336 : qs_control%eps_rho_gspace, &
2292 1336 : "QS| eps_rho_rspace:", &
2293 1336 : qs_control%eps_rho_rspace, &
2294 1336 : "QS| eps_gvg_rspace:", &
2295 1336 : qs_control%eps_gvg_rspace, &
2296 1336 : "QS| eps_ppl:", &
2297 1336 : qs_control%eps_ppl, &
2298 1336 : "QS| eps_ppnl:", &
2299 2672 : qs_control%eps_ppnl
2300 1336 : IF (qs_control%gapw) THEN
2301 388 : SELECT CASE (qs_control%gapw_control%basis_1c)
2302 : CASE (gapw_1c_orb)
2303 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2304 191 : "QS| GAPW| One center basis from orbital basis primitives"
2305 : CASE (gapw_1c_small)
2306 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2307 2 : "QS| GAPW| One center basis extended with primitives (small:s)"
2308 : CASE (gapw_1c_medium)
2309 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2310 1 : "QS| GAPW| One center basis extended with primitives (medium:sp)"
2311 : CASE (gapw_1c_large)
2312 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2313 2 : "QS| GAPW| One center basis extended with primitives (large:spd)"
2314 : CASE (gapw_1c_very_large)
2315 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2316 1 : "QS| GAPW| One center basis extended with primitives (very large:spdf)"
2317 : CASE DEFAULT
2318 197 : CPABORT("basis_1c incorrect")
2319 : END SELECT
2320 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2321 197 : "QS| GAPW| eps_fit:", &
2322 197 : qs_control%gapw_control%eps_fit, &
2323 197 : "QS| GAPW| eps_iso:", &
2324 197 : qs_control%gapw_control%eps_iso, &
2325 197 : "QS| GAPW| eps_svd:", &
2326 197 : qs_control%gapw_control%eps_svd, &
2327 197 : "QS| GAPW| eps_cpc:", &
2328 394 : qs_control%gapw_control%eps_cpc
2329 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
2330 197 : "QS| GAPW| atom-r-grid: quadrature:", &
2331 394 : ADJUSTR(quadrature)
2332 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,I10)") &
2333 197 : "QS| GAPW| atom-s-grid: max l :", &
2334 197 : qs_control%gapw_control%lmax_sphere, &
2335 197 : "QS| GAPW| max_l_rho0 :", &
2336 394 : qs_control%gapw_control%lmax_rho0
2337 197 : IF (qs_control%gapw_control%non_paw_atoms) THEN
2338 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2339 29 : "QS| GAPW| At least one kind is NOT PAW, i.e. it has only soft AO "
2340 : END IF
2341 197 : IF (qs_control%gapw_control%nopaw_as_gpw) THEN
2342 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2343 29 : "QS| GAPW| The NOT PAW atoms are treated fully GPW"
2344 : END IF
2345 : END IF
2346 1336 : IF (qs_control%gapw_xc) THEN
2347 50 : SELECT CASE (qs_control%gapw_control%basis_1c)
2348 : CASE (gapw_1c_orb)
2349 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2350 25 : "QS| GAPW_XC| One center basis from orbital basis primitives"
2351 : CASE (gapw_1c_small)
2352 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2353 0 : "QS| GAPW_XC| One center basis extended with primitives (small:s)"
2354 : CASE (gapw_1c_medium)
2355 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2356 0 : "QS| GAPW_XC| One center basis extended with primitives (medium:sp)"
2357 : CASE (gapw_1c_large)
2358 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2359 0 : "QS| GAPW_XC| One center basis extended with primitives (large:spd)"
2360 : CASE (gapw_1c_very_large)
2361 : WRITE (UNIT=output_unit, FMT="(T2,A)") &
2362 0 : "QS| GAPW_XC| One center basis extended with primitives (very large:spdf)"
2363 : CASE DEFAULT
2364 25 : CPABORT("basis_1c incorrect")
2365 : END SELECT
2366 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2367 25 : "QS| GAPW_XC| eps_fit:", &
2368 25 : qs_control%gapw_control%eps_fit, &
2369 25 : "QS| GAPW_XC| eps_iso:", &
2370 25 : qs_control%gapw_control%eps_iso, &
2371 25 : "QS| GAPW_XC| eps_svd:", &
2372 50 : qs_control%gapw_control%eps_svd
2373 : WRITE (UNIT=output_unit, FMT="(T2,A,T55,A30)") &
2374 25 : "QS| GAPW_XC|atom-r-grid: quadrature:", &
2375 50 : enum_i2c(enum, qs_control%gapw_control%quadrature)
2376 : WRITE (UNIT=output_unit, FMT="(T2,A,T71,I10)") &
2377 25 : "QS| GAPW_XC| atom-s-grid: max l :", &
2378 50 : qs_control%gapw_control%lmax_sphere
2379 : END IF
2380 1336 : IF (qs_control%mulliken_restraint) THEN
2381 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2382 1 : "QS| Mulliken restraint target", qs_control%mulliken_restraint_control%target
2383 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2384 1 : "QS| Mulliken restraint strength", qs_control%mulliken_restraint_control%strength
2385 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,I8)") &
2386 1 : "QS| Mulliken restraint atoms: ", qs_control%mulliken_restraint_control%natoms
2387 2 : WRITE (UNIT=output_unit, FMT="(5I8)") qs_control%mulliken_restraint_control%atoms
2388 : END IF
2389 1336 : IF (qs_control%ddapc_restraint) THEN
2390 14 : DO i = 1, SIZE(qs_control%ddapc_restraint_control)
2391 8 : ddapc_restraint_control => qs_control%ddapc_restraint_control(i)
2392 8 : IF (SIZE(qs_control%ddapc_restraint_control) .GT. 1) &
2393 : WRITE (UNIT=output_unit, FMT="(T2,A,T3,I8)") &
2394 3 : "QS| parameters for DDAPC restraint number", i
2395 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2396 8 : "QS| ddapc restraint target", ddapc_restraint_control%target
2397 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2398 8 : "QS| ddapc restraint strength", ddapc_restraint_control%strength
2399 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,I8)") &
2400 8 : "QS| ddapc restraint atoms: ", ddapc_restraint_control%natoms
2401 17 : WRITE (UNIT=output_unit, FMT="(5I8)") ddapc_restraint_control%atoms
2402 8 : WRITE (UNIT=output_unit, FMT="(T2,A)") "Coefficients:"
2403 17 : WRITE (UNIT=output_unit, FMT="(5F6.2)") ddapc_restraint_control%coeff
2404 6 : SELECT CASE (ddapc_restraint_control%functional_form)
2405 : CASE (do_ddapc_restraint)
2406 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
2407 3 : "QS| ddapc restraint functional form :", "RESTRAINT"
2408 : CASE (do_ddapc_constraint)
2409 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
2410 5 : "QS| ddapc restraint functional form :", "CONSTRAINT"
2411 : CASE DEFAULT
2412 8 : CPABORT("Unknown ddapc restraint")
2413 : END SELECT
2414 : END DO
2415 : END IF
2416 1336 : IF (qs_control%s2_restraint) THEN
2417 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2418 0 : "QS| s2 restraint target", qs_control%s2_restraint_control%target
2419 : WRITE (UNIT=output_unit, FMT="(T2,A,T73,ES8.1)") &
2420 0 : "QS| s2 restraint strength", qs_control%s2_restraint_control%strength
2421 0 : SELECT CASE (qs_control%s2_restraint_control%functional_form)
2422 : CASE (do_s2_restraint)
2423 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
2424 0 : "QS| s2 restraint functional form :", "RESTRAINT"
2425 0 : CPABORT("Not yet implemented")
2426 : CASE (do_s2_constraint)
2427 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,A20)") &
2428 0 : "QS| s2 restraint functional form :", "CONSTRAINT"
2429 : CASE DEFAULT
2430 0 : CPABORT("Unknown ddapc restraint")
2431 : END SELECT
2432 : END IF
2433 : END IF
2434 : CALL cp_print_key_finished_output(output_unit, logger, print_section_vals, &
2435 5180 : "DFT_CONTROL_PARAMETERS")
2436 :
2437 5180 : CALL timestop(handle)
2438 :
2439 : END SUBROUTINE write_qs_control
2440 :
2441 : ! **************************************************************************************************
2442 : !> \brief reads the input parameters needed for ddapc.
2443 : !> \param qs_control ...
2444 : !> \param qs_section ...
2445 : !> \param ddapc_restraint_section ...
2446 : !> \author fschiff
2447 : !> \note
2448 : !> either reads DFT%QS%DDAPC_RESTRAINT or PROPERTIES%ET_coupling
2449 : !> if(qs_section is present the DFT part is read, if ddapc_restraint_section
2450 : !> is present ET_COUPLING is read. Avoid having both!!!
2451 : ! **************************************************************************************************
2452 14 : SUBROUTINE read_ddapc_section(qs_control, qs_section, ddapc_restraint_section)
2453 :
2454 : TYPE(qs_control_type), INTENT(INOUT) :: qs_control
2455 : TYPE(section_vals_type), OPTIONAL, POINTER :: qs_section, ddapc_restraint_section
2456 :
2457 : INTEGER :: i, j, jj, k, n_rep
2458 14 : INTEGER, DIMENSION(:), POINTER :: tmplist
2459 14 : REAL(KIND=dp), DIMENSION(:), POINTER :: rtmplist
2460 : TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
2461 : TYPE(section_vals_type), POINTER :: ddapc_section
2462 :
2463 14 : IF (PRESENT(ddapc_restraint_section)) THEN
2464 0 : IF (ASSOCIATED(qs_control%ddapc_restraint_control)) THEN
2465 0 : IF (SIZE(qs_control%ddapc_restraint_control) .GE. 2) &
2466 0 : CPABORT("ET_COUPLING cannot be used in combination with a normal restraint")
2467 : ELSE
2468 0 : ddapc_section => ddapc_restraint_section
2469 0 : ALLOCATE (qs_control%ddapc_restraint_control(1))
2470 : END IF
2471 : END IF
2472 :
2473 14 : IF (PRESENT(qs_section)) THEN
2474 14 : NULLIFY (ddapc_section)
2475 : ddapc_section => section_vals_get_subs_vals(qs_section, &
2476 14 : "DDAPC_RESTRAINT")
2477 : END IF
2478 :
2479 32 : DO i = 1, SIZE(qs_control%ddapc_restraint_control)
2480 :
2481 18 : CALL ddapc_control_create(qs_control%ddapc_restraint_control(i))
2482 18 : ddapc_restraint_control => qs_control%ddapc_restraint_control(i)
2483 :
2484 : CALL section_vals_val_get(ddapc_section, "STRENGTH", i_rep_section=i, &
2485 18 : r_val=ddapc_restraint_control%strength)
2486 : CALL section_vals_val_get(ddapc_section, "TARGET", i_rep_section=i, &
2487 18 : r_val=ddapc_restraint_control%target)
2488 : CALL section_vals_val_get(ddapc_section, "FUNCTIONAL_FORM", i_rep_section=i, &
2489 18 : i_val=ddapc_restraint_control%functional_form)
2490 : CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
2491 18 : n_rep_val=n_rep)
2492 : CALL section_vals_val_get(ddapc_section, "TYPE_OF_DENSITY", i_rep_section=i, &
2493 18 : i_val=ddapc_restraint_control%density_type)
2494 :
2495 18 : jj = 0
2496 36 : DO k = 1, n_rep
2497 : CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
2498 18 : i_rep_val=k, i_vals=tmplist)
2499 56 : DO j = 1, SIZE(tmplist)
2500 38 : jj = jj + 1
2501 : END DO
2502 : END DO
2503 18 : IF (jj < 1) CPABORT("Need at least 1 atom to use ddapc constraints")
2504 18 : ddapc_restraint_control%natoms = jj
2505 18 : IF (ASSOCIATED(ddapc_restraint_control%atoms)) &
2506 0 : DEALLOCATE (ddapc_restraint_control%atoms)
2507 54 : ALLOCATE (ddapc_restraint_control%atoms(ddapc_restraint_control%natoms))
2508 18 : jj = 0
2509 36 : DO k = 1, n_rep
2510 : CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
2511 18 : i_rep_val=k, i_vals=tmplist)
2512 56 : DO j = 1, SIZE(tmplist)
2513 20 : jj = jj + 1
2514 38 : ddapc_restraint_control%atoms(jj) = tmplist(j)
2515 : END DO
2516 : END DO
2517 :
2518 18 : IF (ASSOCIATED(ddapc_restraint_control%coeff)) &
2519 0 : DEALLOCATE (ddapc_restraint_control%coeff)
2520 54 : ALLOCATE (ddapc_restraint_control%coeff(ddapc_restraint_control%natoms))
2521 38 : ddapc_restraint_control%coeff = 1.0_dp
2522 :
2523 : CALL section_vals_val_get(ddapc_section, "COEFF", i_rep_section=i, &
2524 18 : n_rep_val=n_rep)
2525 18 : jj = 0
2526 20 : DO k = 1, n_rep
2527 : CALL section_vals_val_get(ddapc_section, "COEFF", i_rep_section=i, &
2528 2 : i_rep_val=k, r_vals=rtmplist)
2529 22 : DO j = 1, SIZE(rtmplist)
2530 2 : jj = jj + 1
2531 2 : IF (jj > ddapc_restraint_control%natoms) &
2532 0 : CPABORT("Need the same number of coeff as there are atoms ")
2533 4 : ddapc_restraint_control%coeff(jj) = rtmplist(j)
2534 : END DO
2535 : END DO
2536 18 : IF (jj < ddapc_restraint_control%natoms .AND. jj .NE. 0) &
2537 50 : CPABORT("Need no or the same number of coeff as there are atoms.")
2538 : END DO
2539 14 : k = 0
2540 32 : DO i = 1, SIZE(qs_control%ddapc_restraint_control)
2541 18 : IF (qs_control%ddapc_restraint_control(i)%functional_form == &
2542 24 : do_ddapc_constraint) k = k + 1
2543 : END DO
2544 14 : IF (k == 2) CALL cp_abort(__LOCATION__, &
2545 0 : "Only a single constraint possible yet, try to use restraints instead ")
2546 :
2547 14 : END SUBROUTINE read_ddapc_section
2548 :
2549 : ! **************************************************************************************************
2550 : !> \brief ...
2551 : !> \param dft_control ...
2552 : !> \param efield_section ...
2553 : ! **************************************************************************************************
2554 252 : SUBROUTINE read_efield_sections(dft_control, efield_section)
2555 : TYPE(dft_control_type), POINTER :: dft_control
2556 : TYPE(section_vals_type), POINTER :: efield_section
2557 :
2558 : CHARACTER(len=default_path_length) :: file_name
2559 : INTEGER :: i, io, j, n, unit_nr
2560 252 : REAL(KIND=dp), DIMENSION(:), POINTER :: tmp_vals
2561 : TYPE(efield_type), POINTER :: efield
2562 : TYPE(section_vals_type), POINTER :: tmp_section
2563 :
2564 504 : DO i = 1, SIZE(dft_control%efield_fields)
2565 252 : NULLIFY (dft_control%efield_fields(i)%efield)
2566 1260 : ALLOCATE (dft_control%efield_fields(i)%efield)
2567 252 : efield => dft_control%efield_fields(i)%efield
2568 252 : NULLIFY (efield%envelop_i_vars, efield%envelop_r_vars)
2569 : CALL section_vals_val_get(efield_section, "INTENSITY", i_rep_section=i, &
2570 252 : r_val=efield%strength)
2571 :
2572 : CALL section_vals_val_get(efield_section, "POLARISATION", i_rep_section=i, &
2573 252 : r_vals=tmp_vals)
2574 756 : ALLOCATE (efield%polarisation(SIZE(tmp_vals)))
2575 2016 : efield%polarisation = tmp_vals
2576 : CALL section_vals_val_get(efield_section, "PHASE", i_rep_section=i, &
2577 252 : r_val=efield%phase_offset)
2578 : CALL section_vals_val_get(efield_section, "ENVELOP", i_rep_section=i, &
2579 252 : i_val=efield%envelop_id)
2580 : CALL section_vals_val_get(efield_section, "WAVELENGTH", i_rep_section=i, &
2581 252 : r_val=efield%wavelength)
2582 : CALL section_vals_val_get(efield_section, "VEC_POT_INITIAL", i_rep_section=i, &
2583 252 : r_vals=tmp_vals)
2584 2016 : efield%vec_pot_initial = tmp_vals
2585 :
2586 504 : IF (efield%envelop_id == constant_env) THEN
2587 240 : ALLOCATE (efield%envelop_i_vars(2))
2588 240 : tmp_section => section_vals_get_subs_vals(efield_section, "CONSTANT_ENV", i_rep_section=i)
2589 : CALL section_vals_val_get(tmp_section, "START_STEP", &
2590 240 : i_val=efield%envelop_i_vars(1))
2591 : CALL section_vals_val_get(tmp_section, "END_STEP", &
2592 240 : i_val=efield%envelop_i_vars(2))
2593 12 : ELSE IF (efield%envelop_id == gaussian_env) THEN
2594 8 : ALLOCATE (efield%envelop_r_vars(2))
2595 8 : tmp_section => section_vals_get_subs_vals(efield_section, "GAUSSIAN_ENV", i_rep_section=i)
2596 : CALL section_vals_val_get(tmp_section, "T0", &
2597 8 : r_val=efield%envelop_r_vars(1))
2598 : CALL section_vals_val_get(tmp_section, "SIGMA", &
2599 8 : r_val=efield%envelop_r_vars(2))
2600 4 : ELSE IF (efield%envelop_id == ramp_env) THEN
2601 2 : ALLOCATE (efield%envelop_i_vars(4))
2602 2 : tmp_section => section_vals_get_subs_vals(efield_section, "RAMP_ENV", i_rep_section=i)
2603 : CALL section_vals_val_get(tmp_section, "START_STEP_IN", &
2604 2 : i_val=efield%envelop_i_vars(1))
2605 : CALL section_vals_val_get(tmp_section, "END_STEP_IN", &
2606 2 : i_val=efield%envelop_i_vars(2))
2607 : CALL section_vals_val_get(tmp_section, "START_STEP_OUT", &
2608 2 : i_val=efield%envelop_i_vars(3))
2609 : CALL section_vals_val_get(tmp_section, "END_STEP_OUT", &
2610 2 : i_val=efield%envelop_i_vars(4))
2611 2 : ELSE IF (efield%envelop_id == custom_env) THEN
2612 2 : tmp_section => section_vals_get_subs_vals(efield_section, "CUSTOM_ENV", i_rep_section=i)
2613 2 : CALL section_vals_val_get(tmp_section, "EFIELD_FILE_NAME", c_val=file_name)
2614 2 : CALL open_file(file_name=TRIM(file_name), file_action="READ", file_status="OLD", unit_number=unit_nr)
2615 : !Determine the number of lines in file
2616 2 : n = 0
2617 10 : DO WHILE (.TRUE.)
2618 12 : READ (unit_nr, *, iostat=io)
2619 12 : IF (io /= 0) EXIT
2620 10 : n = n + 1
2621 : END DO
2622 2 : REWIND (unit_nr)
2623 6 : ALLOCATE (efield%envelop_r_vars(n + 1))
2624 : !Store the timestep of the list in the first entry of the r_vars
2625 2 : CALL section_vals_val_get(tmp_section, "TIMESTEP", r_val=efield%envelop_r_vars(1))
2626 : !Read the file
2627 12 : DO j = 2, n + 1
2628 10 : READ (unit_nr, *) efield%envelop_r_vars(j)
2629 12 : efield%envelop_r_vars(j) = cp_unit_to_cp2k(efield%envelop_r_vars(j), "volt/m")
2630 : END DO
2631 2 : CALL close_file(unit_nr)
2632 : END IF
2633 : END DO
2634 252 : END SUBROUTINE read_efield_sections
2635 :
2636 : ! **************************************************************************************************
2637 : !> \brief reads the input parameters needed real time propagation
2638 : !> \param dft_control ...
2639 : !> \param rtp_section ...
2640 : !> \author fschiff
2641 : ! **************************************************************************************************
2642 496 : SUBROUTINE read_rtp_section(dft_control, rtp_section)
2643 :
2644 : TYPE(dft_control_type), INTENT(INOUT) :: dft_control
2645 : TYPE(section_vals_type), POINTER :: rtp_section
2646 :
2647 248 : INTEGER, DIMENSION(:), POINTER :: tmp
2648 : LOGICAL :: is_present
2649 : TYPE(section_vals_type), POINTER :: proj_mo_section
2650 :
2651 2976 : ALLOCATE (dft_control%rtp_control)
2652 : CALL section_vals_val_get(rtp_section, "MAX_ITER", &
2653 248 : i_val=dft_control%rtp_control%max_iter)
2654 : CALL section_vals_val_get(rtp_section, "MAT_EXP", &
2655 248 : i_val=dft_control%rtp_control%mat_exp)
2656 : CALL section_vals_val_get(rtp_section, "ASPC_ORDER", &
2657 248 : i_val=dft_control%rtp_control%aspc_order)
2658 : CALL section_vals_val_get(rtp_section, "EXP_ACCURACY", &
2659 248 : r_val=dft_control%rtp_control%eps_exp)
2660 : CALL section_vals_val_get(rtp_section, "RTP_METHOD", &
2661 248 : i_val=dft_control%rtp_control%rtp_method)
2662 : CALL section_vals_val_get(rtp_section, "RTBSE_HAMILTONIAN", &
2663 248 : i_val=dft_control%rtp_control%rtbse_ham)
2664 : CALL section_vals_val_get(rtp_section, "PROPAGATOR", &
2665 248 : i_val=dft_control%rtp_control%propagator)
2666 : CALL section_vals_val_get(rtp_section, "EPS_ITER", &
2667 248 : r_val=dft_control%rtp_control%eps_ener)
2668 : CALL section_vals_val_get(rtp_section, "INITIAL_WFN", &
2669 248 : i_val=dft_control%rtp_control%initial_wfn)
2670 : CALL section_vals_val_get(rtp_section, "HFX_BALANCE_IN_CORE", &
2671 248 : l_val=dft_control%rtp_control%hfx_redistribute)
2672 : CALL section_vals_val_get(rtp_section, "APPLY_WFN_MIX_INIT_RESTART", &
2673 248 : l_val=dft_control%rtp_control%apply_wfn_mix_init_restart)
2674 : CALL section_vals_val_get(rtp_section, "APPLY_DELTA_PULSE", &
2675 248 : l_val=dft_control%rtp_control%apply_delta_pulse)
2676 : CALL section_vals_val_get(rtp_section, "APPLY_DELTA_PULSE_MAG", &
2677 248 : l_val=dft_control%rtp_control%apply_delta_pulse_mag)
2678 : CALL section_vals_val_get(rtp_section, "VELOCITY_GAUGE", &
2679 248 : l_val=dft_control%rtp_control%velocity_gauge)
2680 : CALL section_vals_val_get(rtp_section, "VG_COM_NL", &
2681 248 : l_val=dft_control%rtp_control%nl_gauge_transform)
2682 : CALL section_vals_val_get(rtp_section, "PERIODIC", &
2683 248 : l_val=dft_control%rtp_control%periodic)
2684 : CALL section_vals_val_get(rtp_section, "DENSITY_PROPAGATION", &
2685 248 : l_val=dft_control%rtp_control%linear_scaling)
2686 : CALL section_vals_val_get(rtp_section, "MCWEENY_MAX_ITER", &
2687 248 : i_val=dft_control%rtp_control%mcweeny_max_iter)
2688 : CALL section_vals_val_get(rtp_section, "ACCURACY_REFINEMENT", &
2689 248 : i_val=dft_control%rtp_control%acc_ref)
2690 : CALL section_vals_val_get(rtp_section, "MCWEENY_EPS", &
2691 248 : r_val=dft_control%rtp_control%mcweeny_eps)
2692 : CALL section_vals_val_get(rtp_section, "DELTA_PULSE_SCALE", &
2693 248 : r_val=dft_control%rtp_control%delta_pulse_scale)
2694 : CALL section_vals_val_get(rtp_section, "DELTA_PULSE_DIRECTION", &
2695 248 : i_vals=tmp)
2696 992 : dft_control%rtp_control%delta_pulse_direction = tmp
2697 : CALL section_vals_val_get(rtp_section, "SC_CHECK_START", &
2698 248 : i_val=dft_control%rtp_control%sc_check_start)
2699 248 : proj_mo_section => section_vals_get_subs_vals(rtp_section, "PRINT%PROJECTION_MO")
2700 248 : CALL section_vals_get(proj_mo_section, explicit=is_present)
2701 248 : IF (is_present) THEN
2702 4 : IF (dft_control%rtp_control%linear_scaling) &
2703 : CALL cp_abort(__LOCATION__, &
2704 : "You have defined a time dependent projection of mos, but "// &
2705 : "only the density matrix is propagated (DENSITY_PROPAGATION "// &
2706 : ".TRUE.). Please either use MO-based real time DFT or do not "// &
2707 0 : "define any PRINT%PROJECTION_MO section")
2708 4 : dft_control%rtp_control%is_proj_mo = .TRUE.
2709 : ELSE
2710 244 : dft_control%rtp_control%is_proj_mo = .FALSE.
2711 : END IF
2712 :
2713 248 : END SUBROUTINE read_rtp_section
2714 :
2715 : ! **************************************************************************************************
2716 : !> \brief Parses the BLOCK_LIST keywords from the ADMM section
2717 : !> \param admm_control ...
2718 : !> \param dft_section ...
2719 : ! **************************************************************************************************
2720 442 : SUBROUTINE read_admm_block_list(admm_control, dft_section)
2721 : TYPE(admm_control_type), POINTER :: admm_control
2722 : TYPE(section_vals_type), POINTER :: dft_section
2723 :
2724 : INTEGER :: irep, list_size, n_rep
2725 442 : INTEGER, DIMENSION(:), POINTER :: tmplist
2726 :
2727 442 : NULLIFY (tmplist)
2728 :
2729 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%BLOCK_LIST", &
2730 442 : n_rep_val=n_rep)
2731 :
2732 938 : ALLOCATE (admm_control%blocks(n_rep))
2733 :
2734 478 : DO irep = 1, n_rep
2735 : CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%BLOCK_LIST", &
2736 36 : i_rep_val=irep, i_vals=tmplist)
2737 36 : list_size = SIZE(tmplist)
2738 108 : ALLOCATE (admm_control%blocks(irep)%list(list_size))
2739 650 : admm_control%blocks(irep)%list(:) = tmplist(:)
2740 : END DO
2741 :
2742 442 : END SUBROUTINE read_admm_block_list
2743 :
2744 : END MODULE cp_control_utils
|