(git:f2099e5)
Loading...
Searching...
No Matches
cp_control_utils.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Utilities to set up the control types
10! **************************************************************************************************
12 USE bibliography, ONLY: &
17 vandevondele2005b, yin2017, zhechkov2005, cite_reference
20 USE cp_control_types, ONLY: &
25 USE cp_files, ONLY: close_file,&
36 USE cp_spline_utils, ONLY: pw_interp
37 USE cp_units, ONLY: cp_unit_from_cp2k,&
39 USE eeq_input, ONLY: read_eeq_param
41 USE input_constants, ONLY: &
76 USE input_section_types, ONLY: &
79 USE kinds, ONLY: default_path_length,&
81 dp
82 USE mathconstants, ONLY: fourpi
88 USE util, ONLY: sort
93 USE xc_write_output, ONLY: xc_write
94#include "./base/base_uses.f90"
95
96 IMPLICIT NONE
97
98 PRIVATE
99
100 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'cp_control_utils'
101
102 PUBLIC :: read_dft_control, &
111CONTAINS
112
113! **************************************************************************************************
114!> \brief ...
115!> \param dft_control ...
116!> \param dft_section ...
117!> \param cell ...
118! **************************************************************************************************
119 SUBROUTINE read_dft_control(dft_control, dft_section, cell)
120 TYPE(dft_control_type), POINTER :: dft_control
121 TYPE(section_vals_type), POINTER :: dft_section
122 TYPE(cell_type), OPTIONAL, POINTER :: cell
123
124 CHARACTER(len=default_path_length) :: basis_set_file_name, gauxc_model_name, &
125 intensities_file_name, &
126 potential_file_name
127 CHARACTER(LEN=default_string_length), &
128 DIMENSION(:), POINTER :: tmpstringlist
129 INTEGER :: admmtype, irep, isize, kg_tnadd_method, &
130 method_id, nrep, xc_deriv_method_id
131 LOGICAL :: at_end, do_hfx, do_ot, do_rpa_admm, do_rtp, exopt1, exopt2, exopt3, explicit, &
132 is_present, l_param, local_moment_possible, native_skala_grid, not_se, was_present
133 REAL(kind=dp) :: density_cut, gradient_cut, tau_cut
134 REAL(kind=dp), DIMENSION(:), POINTER :: pol
135 TYPE(cp_logger_type), POINTER :: logger
136 TYPE(cp_parser_type) :: parser
137 TYPE(section_vals_type), POINTER :: hairy_probes_section, hfx_section, kg_xc_fun_section, &
138 kg_xc_section, maxwell_section, sccs_section, scf_section, tmp_section, xc_fun_section, &
139 xc_gauxc_subsection, xc_section
140
141 was_present = .false.
142
143 logger => cp_get_default_logger()
144
145 NULLIFY (kg_xc_fun_section, kg_xc_section, tmp_section, xc_fun_section, xc_section, xc_gauxc_subsection)
146 ALLOCATE (dft_control)
147 CALL dft_control_create(dft_control)
148 ! determine wheather this is a semiempirical or DFTB run
149 ! --> (no XC section needs to be provided)
150 not_se = .true.
151 CALL section_vals_val_get(dft_section, "QS%METHOD", i_val=method_id)
152 SELECT CASE (method_id)
155 not_se = .false.
156 END SELECT
157 ! Check for XC section and XC_FUNCTIONAL section
158 xc_section => section_vals_get_subs_vals(dft_section, "XC")
159 CALL section_vals_get(xc_section, explicit=is_present)
160 IF (.NOT. is_present .AND. not_se) THEN
161 cpabort("XC section missing.")
162 END IF
163 IF (is_present) THEN
164 CALL section_vals_val_get(xc_section, "density_cutoff", r_val=density_cut)
165 CALL section_vals_val_get(xc_section, "gradient_cutoff", r_val=gradient_cut)
166 CALL section_vals_val_get(xc_section, "tau_cutoff", r_val=tau_cut)
167 ! Perform numerical stability checks and possibly correct the issues
168 IF (density_cut <= epsilon(0.0_dp)*100.0_dp) THEN
169 CALL cp_warn(__location__, &
170 "DENSITY_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
171 "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
172 END IF
173 density_cut = max(epsilon(0.0_dp)*100.0_dp, density_cut)
174 IF (gradient_cut <= epsilon(0.0_dp)*100.0_dp) THEN
175 CALL cp_warn(__location__, &
176 "GRADIENT_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
177 "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
178 END IF
179 gradient_cut = max(epsilon(0.0_dp)*100.0_dp, gradient_cut)
180 IF (tau_cut <= epsilon(0.0_dp)*100.0_dp) THEN
181 CALL cp_warn(__location__, &
182 "TAU_CUTOFF lower than 100*EPSILON, where EPSILON is the machine precision. "// &
183 "This may lead to numerical problems. Setting up shake_tol to 100*EPSILON! ")
184 END IF
185 tau_cut = max(epsilon(0.0_dp)*100.0_dp, tau_cut)
186 CALL section_vals_val_set(xc_section, "density_cutoff", r_val=density_cut)
187 CALL section_vals_val_set(xc_section, "gradient_cutoff", r_val=gradient_cut)
188 CALL section_vals_val_set(xc_section, "tau_cutoff", r_val=tau_cut)
189 END IF
190 xc_fun_section => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
191 CALL section_vals_get(xc_fun_section, explicit=is_present)
192 IF (.NOT. is_present .AND. not_se) THEN
193 cpabort("XC_FUNCTIONAL section missing.")
194 END IF
195
196 dft_control%use_gauxc = .false.
197 IF (is_present) THEN
198 xc_gauxc_subsection => section_vals_get_subs_vals(xc_fun_section, "GAUXC")
199 CALL section_vals_get(xc_gauxc_subsection, explicit=dft_control%use_gauxc)
200 END IF
201
202 scf_section => section_vals_get_subs_vals(dft_section, "SCF")
203 CALL section_vals_val_get(dft_section, "UKS", l_val=dft_control%uks)
204 CALL section_vals_val_get(dft_section, "ROKS", l_val=dft_control%roks)
205 IF (dft_control%uks .OR. dft_control%roks) THEN
206 dft_control%nspins = 2
207 ELSE
208 dft_control%nspins = 1
209 END IF
210
211 dft_control%lsd = (dft_control%nspins > 1)
212 dft_control%use_kinetic_energy_density = xc_uses_kinetic_energy_density(xc_fun_section, dft_control%lsd)
213 IF (dft_control%use_gauxc) THEN
214 native_skala_grid = .false.
215 CALL section_vals_val_get(xc_gauxc_subsection, "NATIVE_GRID", l_val=native_skala_grid)
216 CALL section_vals_val_get(xc_gauxc_subsection, "MODEL", c_val=gauxc_model_name)
217 gauxc_model_name = adjustl(gauxc_model_name)
218 CALL uppercase(gauxc_model_name)
219 IF (native_skala_grid .OR. &
220 (trim(gauxc_model_name) /= "" .AND. trim(gauxc_model_name) /= "NONE")) THEN
221 dft_control%use_kinetic_energy_density = .true.
222 END IF
223 END IF
224 tmp_section => section_vals_get_subs_vals(dft_section, "KG_METHOD")
225 CALL section_vals_get(tmp_section, explicit=explicit)
226 IF (explicit) THEN
227 CALL section_vals_val_get(tmp_section, "TNADD_METHOD", i_val=kg_tnadd_method)
228 IF (kg_tnadd_method == kg_tnadd_embed .OR. kg_tnadd_method == kg_tnadd_embed_ri) THEN
229 kg_xc_section => section_vals_get_subs_vals(tmp_section, "XC")
230 kg_xc_fun_section => section_vals_get_subs_vals(kg_xc_section, "XC_FUNCTIONAL")
231 CALL section_vals_get(kg_xc_fun_section, explicit=is_present)
232 IF (is_present) THEN
233 dft_control%use_kinetic_energy_density = dft_control%use_kinetic_energy_density .OR. &
234 xc_uses_kinetic_energy_density(kg_xc_fun_section, &
235 dft_control%lsd)
236 END IF
237 END IF
238 END IF
239
240 tmp_section => section_vals_get_subs_vals(dft_section, "FDE")
241 CALL section_vals_get(tmp_section, explicit=explicit)
242 IF (explicit) THEN
243 CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", l_val=dft_control%do_fde)
244 END IF
245 IF (dft_control%do_fde) THEN
246 CALL fde_control_create(dft_control%fde_control)
247 associate(fde => dft_control%fde_control)
248 CALL section_vals_val_get(tmp_section, "FREEZE_AND_THAW", l_val=fde%freeze_and_thaw)
249 CALL section_vals_val_get(tmp_section, "MAX_FT_ITER", i_val=fde%max_ft_iter)
250 CALL section_vals_val_get(tmp_section, "EPS_FT_DENSITY", r_val=fde%eps_ft_density)
251 CALL section_vals_val_get(tmp_section, "EPS_FT_ENERGY", r_val=fde%eps_ft_energy)
252 CALL section_vals_val_get(tmp_section, "DENSITY_MIXING", r_val=fde%density_mixing)
253 CALL section_vals_val_get(tmp_section, "COMMAND", c_val=fde%command)
254 CALL section_vals_val_get(tmp_section, "PROJECT", c_val=fde%project)
255 CALL section_vals_val_get(tmp_section, "WORKDIR", c_val=fde%workdir)
256 CALL section_vals_val_get(tmp_section, "MOLCAS_INPUT_TEMPLATE", c_val=fde%molcas_input_template)
257 CALL section_vals_val_get(tmp_section, "POT_FILE", c_val=fde%pot_file)
258 CALL section_vals_val_get(tmp_section, "GRID_FILE", c_val=fde%grid_file)
259 CALL section_vals_val_get(tmp_section, "RHO_FILE", c_val=fde%rho_file)
260 CALL section_vals_val_get(tmp_section, "RESULT_FILE", c_val=fde%result_file)
261 END associate
262 END IF
263
264 xc_deriv_method_id = section_get_ival(xc_section, "XC_GRID%XC_DERIV")
265 dft_control%drho_by_collocation = (xc_uses_norm_drho(xc_fun_section, dft_control%lsd) &
266 .AND. (xc_deriv_method_id == xc_deriv_collocate))
267 IF (dft_control%drho_by_collocation) THEN
268 cpabort("derivatives by collocation not implemented")
269 END IF
270
271 ! Automatic auxiliary basis set generation
272 CALL section_vals_val_get(dft_section, "AUTO_BASIS", n_rep_val=nrep)
273 DO irep = 1, nrep
274 CALL section_vals_val_get(dft_section, "AUTO_BASIS", i_rep_val=irep, c_vals=tmpstringlist)
275 IF (SIZE(tmpstringlist) == 2) THEN
276 CALL uppercase(tmpstringlist(2))
277 SELECT CASE (tmpstringlist(2))
278 CASE ("X")
279 SELECT CASE (tmpstringlist(1))
280 CASE ("X")
281 ! Do nothing
282 CASE DEFAULT
283 CALL cp_abort(__location__, &
284 "AUTO_BASIS: the size <X> is invalid for the "// &
285 "type <"//trim(adjustl(tmpstringlist(1)))//">; "// &
286 "use one of SMALL, MEDIUM, LARGE, HUGE for "// &
287 "the size. The syntax AUTO_BASIS X X is a "// &
288 "reserved case for using NO automatically "// &
289 "generated basis sets.")
290 END SELECT
291 CASE ("SMALL")
292 isize = 0
293 CASE ("MEDIUM")
294 isize = 1
295 CASE ("LARGE")
296 isize = 2
297 CASE ("HUGE")
298 isize = 3
299 CASE DEFAULT
300 cpwarn("Unknown basis size in AUTO_BASIS keyword:"//trim(tmpstringlist(1)))
301 END SELECT
302 !
303 SELECT CASE (tmpstringlist(1))
304 CASE ("X")
305 CASE ("RI_AUX")
306 dft_control%auto_basis_ri_aux = isize
307 CASE ("AUX_FIT")
308 dft_control%auto_basis_aux_fit = isize
309 CASE ("LRI_AUX")
310 dft_control%auto_basis_lri_aux = isize
311 CASE ("P_LRI_AUX")
312 dft_control%auto_basis_p_lri_aux = isize
313 CASE ("RI_HXC")
314 dft_control%auto_basis_ri_hxc = isize
315 CASE ("RI_XAS")
316 dft_control%auto_basis_ri_xas = isize
317 CASE ("RI_HFX")
318 dft_control%auto_basis_ri_hfx = isize
319 CASE DEFAULT
320 cpwarn("Unknown basis type in AUTO_BASIS keyword:"//trim(tmpstringlist(1)))
321 END SELECT
322 ELSE
323 CALL cp_abort(__location__, &
324 "AUTO_BASIS keyword in &DFT section has a wrong number of arguments.")
325 END IF
326 END DO
327
328 !! check if we do wavefunction fitting
329 tmp_section => section_vals_get_subs_vals(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD")
330 CALL section_vals_get(tmp_section, explicit=is_present)
331 !
332 hfx_section => section_vals_get_subs_vals(xc_section, "HF")
333 CALL section_vals_get(hfx_section, explicit=do_hfx)
334 CALL section_vals_val_get(xc_section, "WF_CORRELATION%RI_RPA%ADMM", l_val=do_rpa_admm)
335 is_present = is_present .AND. (do_hfx .OR. do_rpa_admm)
336 !
337 dft_control%do_admm = is_present
338 dft_control%do_admm_mo = .false.
339 dft_control%do_admm_dm = .false.
340 IF (is_present) THEN
341 do_ot = .false.
342 CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=do_ot)
343 CALL admm_control_create(dft_control%admm_control)
344
345 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_TYPE", i_val=admmtype)
346 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", explicit=exopt1)
347 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%METHOD", explicit=exopt2)
348 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_SCALING_MODEL", explicit=exopt3)
349 dft_control%admm_control%admm_type = admmtype
350 SELECT CASE (admmtype)
351 CASE (no_admm_type)
352 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", i_val=method_id)
353 dft_control%admm_control%purification_method = method_id
354 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%METHOD", i_val=method_id)
355 dft_control%admm_control%method = method_id
356 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_SCALING_MODEL", i_val=method_id)
357 dft_control%admm_control%scaling_model = method_id
358 CASE (admm1_type)
359 ! METHOD BASIS_PROJECTION
360 ! ADMM_PURIFICATION_METHOD choose
361 ! EXCH_SCALING_MODEL NONE
362 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%ADMM_PURIFICATION_METHOD", i_val=method_id)
363 dft_control%admm_control%purification_method = method_id
364 dft_control%admm_control%method = do_admm_basis_projection
365 dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
366 CASE (admm2_type)
367 ! METHOD BASIS_PROJECTION
368 ! ADMM_PURIFICATION_METHOD NONE
369 ! EXCH_SCALING_MODEL NONE
370 dft_control%admm_control%purification_method = do_admm_purify_none
371 dft_control%admm_control%method = do_admm_basis_projection
372 dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
373 CASE (admms_type)
374 ! ADMM_PURIFICATION_METHOD NONE
375 ! METHOD CHARGE_CONSTRAINED_PROJECTION
376 ! EXCH_SCALING_MODEL MERLOT
377 dft_control%admm_control%purification_method = do_admm_purify_none
378 dft_control%admm_control%method = do_admm_charge_constrained_projection
379 dft_control%admm_control%scaling_model = do_admm_exch_scaling_merlot
380 CASE (admmp_type)
381 ! ADMM_PURIFICATION_METHOD NONE
382 ! METHOD BASIS_PROJECTION
383 ! EXCH_SCALING_MODEL MERLOT
384 dft_control%admm_control%purification_method = do_admm_purify_none
385 dft_control%admm_control%method = do_admm_basis_projection
386 dft_control%admm_control%scaling_model = do_admm_exch_scaling_merlot
387 CASE (admmq_type)
388 ! ADMM_PURIFICATION_METHOD NONE
389 ! METHOD CHARGE_CONSTRAINED_PROJECTION
390 ! EXCH_SCALING_MODEL NONE
391 dft_control%admm_control%purification_method = do_admm_purify_none
392 dft_control%admm_control%method = do_admm_charge_constrained_projection
393 dft_control%admm_control%scaling_model = do_admm_exch_scaling_none
394 CASE DEFAULT
395 CALL cp_abort(__location__, &
396 "ADMM_TYPE keyword in &AUXILIARY_DENSITY_MATRIX_METHOD section has a wrong value.")
397 END SELECT
398
399 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EPS_FILTER", &
400 r_val=dft_control%admm_control%eps_filter)
401
402 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%EXCH_CORRECTION_FUNC", i_val=method_id)
403 dft_control%admm_control%aux_exch_func = method_id
404
405 ! parameters for X functional
406 dft_control%admm_control%aux_exch_func_param = .false.
407 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_A1", explicit=explicit, &
408 r_val=dft_control%admm_control%aux_x_param(1))
409 IF (explicit) dft_control%admm_control%aux_exch_func_param = .true.
410 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_A2", explicit=explicit, &
411 r_val=dft_control%admm_control%aux_x_param(2))
412 IF (explicit) dft_control%admm_control%aux_exch_func_param = .true.
413 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%OPTX_GAMMA", explicit=explicit, &
414 r_val=dft_control%admm_control%aux_x_param(3))
415 IF (explicit) dft_control%admm_control%aux_exch_func_param = .true.
416
417 CALL read_admm_block_list(dft_control%admm_control, dft_section)
418
419 ! check for double assignments
420 SELECT CASE (admmtype)
421 CASE (admm2_type)
422 IF (exopt2) CALL cp_warn(__location__, &
423 "Value of ADMM_PURIFICATION_METHOD keyword will be overwritten with ADMM_TYPE selections.")
424 IF (exopt3) CALL cp_warn(__location__, &
425 "Value of EXCH_SCALING_MODEL keyword will be overwritten with ADMM_TYPE selections.")
427 IF (exopt1) CALL cp_warn(__location__, &
428 "Value of METHOD keyword will be overwritten with ADMM_TYPE selections.")
429 IF (exopt2) CALL cp_warn(__location__, &
430 "Value of METHOD keyword will be overwritten with ADMM_TYPE selections.")
431 IF (exopt3) CALL cp_warn(__location__, &
432 "Value of EXCH_SCALING_MODEL keyword will be overwritten with ADMM_TYPE selections.")
433 END SELECT
434
435 ! In the case of charge-constrained projection (e.g. according to Merlot),
436 ! there is no purification needed and hence, do_admm_purify_none has to be set.
437
438 IF ((dft_control%admm_control%method == do_admm_blocking_purify_full .OR. &
439 dft_control%admm_control%method == do_admm_blocked_projection) &
440 .AND. dft_control%admm_control%scaling_model == do_admm_exch_scaling_merlot) THEN
441 cpabort("ADMM: Blocking and Merlot scaling are mutually exclusive.")
442 END IF
443
444 IF (dft_control%admm_control%method == do_admm_charge_constrained_projection .AND. &
445 dft_control%admm_control%purification_method /= do_admm_purify_none) THEN
446 CALL cp_abort(__location__, &
447 "ADMM: In the case of METHOD=CHARGE_CONSTRAINED_PROJECTION, "// &
448 "ADMM_PURIFICATION_METHOD=NONE has to be set.")
449 END IF
450
451 IF (dft_control%admm_control%purification_method == do_admm_purify_mo_diag .OR. &
452 dft_control%admm_control%purification_method == do_admm_purify_mo_no_diag) THEN
453 IF (dft_control%admm_control%method /= do_admm_basis_projection) THEN
454 cpabort("ADMM: Chosen purification requires BASIS_PROJECTION")
455 END IF
456
457 IF (.NOT. do_ot) cpabort("ADMM: MO-based purification requires OT.")
458 END IF
459
460 IF (dft_control%admm_control%purification_method == do_admm_purify_none_dm .OR. &
461 dft_control%admm_control%purification_method == do_admm_purify_mcweeny) THEN
462 dft_control%do_admm_dm = .true.
463 ELSE
464 dft_control%do_admm_mo = .true.
465 END IF
466 END IF
467
468 ! Set restricted to true, if both OT and ROKS are requested
469 !MK in principle dft_control%restricted could be dropped completely like the
470 !MK input key by using only dft_control%roks now
471 CALL section_vals_val_get(scf_section, "OT%_SECTION_PARAMETERS_", l_val=l_param)
472 dft_control%restricted = (dft_control%roks .AND. l_param)
473
474 CALL section_vals_val_get(dft_section, "CHARGE", i_val=dft_control%charge)
475 CALL section_vals_val_get(dft_section, "MULTIPLICITY", i_val=dft_control%multiplicity)
476 CALL section_vals_val_get(dft_section, "RELAX_MULTIPLICITY", r_val=dft_control%relax_multiplicity)
477 IF (dft_control%relax_multiplicity > 0.0_dp) THEN
478 IF (.NOT. dft_control%uks) THEN
479 CALL cp_abort(__location__, "The option RELAX_MULTIPLICITY is only valid for "// &
480 "unrestricted Kohn-Sham (UKS) calculations")
481 END IF
482 END IF
483
484 !Read the HAIR PROBES input section if present
485 hairy_probes_section => section_vals_get_subs_vals(dft_section, "HAIRY_PROBES")
486 CALL section_vals_get(hairy_probes_section, n_repetition=nrep, explicit=is_present)
487
488 IF (is_present) THEN
489 dft_control%hairy_probes = .true.
490 ALLOCATE (dft_control%probe(nrep))
491 CALL read_hairy_probes_sections(dft_control, hairy_probes_section)
492 END IF
493
494 ! check for the presence of the low spin roks section
495 tmp_section => section_vals_get_subs_vals(dft_section, "LOW_SPIN_ROKS")
496 CALL section_vals_get(tmp_section, explicit=dft_control%low_spin_roks)
497
498 dft_control%sic_method_id = sic_none
499 dft_control%sic_scaling_a = 1.0_dp
500 dft_control%sic_scaling_b = 1.0_dp
501
502 ! DFT+U
503 dft_control%dft_plus_u = .false.
504 CALL section_vals_val_get(dft_section, "PLUS_U_METHOD", i_val=method_id)
505 dft_control%plus_u_method_id = method_id
506
507 ! Minimum tracking linear response U and J
508 CALL section_vals_val_get(dft_section, "EPS_U_J_LOOP", r_val=dft_control%eps_u_j_loop)
509 CALL section_vals_val_get(dft_section, "MAX_MTLR_LOOP", i_val=dft_control%max_mtlr_iter)
510 CALL section_vals_val_get(dft_section, "MTLR_REFERENCE_SCF", &
511 explicit=dft_control%mtlr_reference_scf_explicit)
512 IF (dft_control%mtlr_reference_scf_explicit) THEN
513 CALL section_vals_val_get(dft_section, "MTLR_REFERENCE_SCF", &
514 l_val=dft_control%mtlr_reference_scf)
515 END IF
516
517 ! Smearing in use
518 dft_control%smear = .false.
519
520 ! Surface dipole correction
521 dft_control%correct_surf_dip = .false.
522 CALL section_vals_val_get(dft_section, "SURFACE_DIPOLE_CORRECTION", l_val=dft_control%correct_surf_dip)
523 CALL section_vals_val_get(dft_section, "SURF_DIP_DIR", i_val=dft_control%dir_surf_dip)
524 dft_control%pos_dir_surf_dip = -1.0_dp
525 CALL section_vals_val_get(dft_section, "SURF_DIP_POS", r_val=dft_control%pos_dir_surf_dip)
526 ! another logical variable, surf_dip_correct_switch, is introduced for
527 ! implementation of "SURF_DIP_SWITCH" [SGh]
528 dft_control%switch_surf_dip = .false.
529 dft_control%surf_dip_correct_switch = dft_control%correct_surf_dip
530 CALL section_vals_val_get(dft_section, "SURF_DIP_SWITCH", l_val=dft_control%switch_surf_dip)
531 dft_control%correct_el_density_dip = .false.
532 CALL section_vals_val_get(dft_section, "CORE_CORR_DIP", l_val=dft_control%correct_el_density_dip)
533 IF (dft_control%correct_el_density_dip) THEN
534 IF (dft_control%correct_surf_dip) THEN
535 ! Do nothing, move on
536 ELSE
537 dft_control%correct_el_density_dip = .false.
538 cpwarn("CORE_CORR_DIP keyword is activated only if SURFACE_DIPOLE_CORRECTION is TRUE")
539 END IF
540 END IF
541
542 CALL section_vals_val_get(dft_section, "BASIS_SET_FILE_NAME", &
543 c_val=basis_set_file_name)
544 CALL section_vals_val_get(dft_section, "POTENTIAL_FILE_NAME", &
545 c_val=potential_file_name)
546
547 ! Read the input section
548 tmp_section => section_vals_get_subs_vals(dft_section, "sic")
549 CALL section_vals_val_get(tmp_section, "SIC_METHOD", &
550 i_val=dft_control%sic_method_id)
551 CALL section_vals_val_get(tmp_section, "ORBITAL_SET", &
552 i_val=dft_control%sic_list_id)
553 CALL section_vals_val_get(tmp_section, "SIC_SCALING_A", &
554 r_val=dft_control%sic_scaling_a)
555 CALL section_vals_val_get(tmp_section, "SIC_SCALING_B", &
556 r_val=dft_control%sic_scaling_b)
557
558 do_rtp = .false.
559 tmp_section => section_vals_get_subs_vals(dft_section, "REAL_TIME_PROPAGATION")
560 CALL section_vals_get(tmp_section, explicit=is_present)
561 IF (is_present) THEN
562 CALL read_rtp_section(dft_control, tmp_section)
563 do_rtp = .true.
564 END IF
565
566 ! Read the input section
567 tmp_section => section_vals_get_subs_vals(dft_section, "XAS")
568 CALL section_vals_get(tmp_section, explicit=dft_control%do_xas_calculation)
569 IF (dft_control%do_xas_calculation) THEN
570 ! Override with section parameter
571 CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
572 l_val=dft_control%do_xas_calculation)
573 END IF
574
575 tmp_section => section_vals_get_subs_vals(dft_section, "XAS_TDP")
576 CALL section_vals_get(tmp_section, explicit=dft_control%do_xas_tdp_calculation)
577 IF (dft_control%do_xas_tdp_calculation) THEN
578 ! Override with section parameter
579 CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
580 l_val=dft_control%do_xas_tdp_calculation)
581 END IF
582
583 ! Read the finite field input section
584 dft_control%apply_efield = .false.
585 dft_control%apply_efield_field = .false. !this is for RTP
586 dft_control%apply_vector_potential = .false. !this is for RTP
587 tmp_section => section_vals_get_subs_vals(dft_section, "EFIELD")
588 CALL section_vals_get(tmp_section, n_repetition=nrep, explicit=is_present)
589 IF (is_present) THEN
590 ALLOCATE (dft_control%efield_fields(nrep))
591 CALL read_efield_sections(dft_control, tmp_section, cell)
592 IF (do_rtp) THEN
593 IF (.NOT. dft_control%rtp_control%velocity_gauge) THEN
594 dft_control%apply_efield_field = .true.
595 ELSE
596 dft_control%apply_vector_potential = .true.
597 ! Use this input value of vector potential to (re)start RTP
598 dft_control%rtp_control%vec_pot = dft_control%efield_fields(1)%efield%vec_pot_initial
599 END IF
600 ELSE
601 dft_control%apply_efield = .true.
602 cpassert(nrep == 1)
603 END IF
604 END IF
605
606 ! Now, can try to guess polarisation in rtp
607 IF (do_rtp) THEN
608 ! tmp_section => section_vals_get_subs_vals(dft_section, "REAL_TIME_PROPAGATION%PRINT%POLARIZABILITY")
609 ! CALL section_vals_get(tmp_section, explicit=is_present)
610 local_moment_possible = (dft_control%rtp_control%rtp_method == rtp_method_bse .OR. &
611 dft_control%rtp_control%rtp_method == rtp_method_bse_linearized) .OR. &
612 ((.NOT. dft_control%rtp_control%periodic) .AND. dft_control%rtp_control%linear_scaling)
613 IF (local_moment_possible .AND. (.NOT. ASSOCIATED(dft_control%rtp_control%print_pol_elements))) THEN
614 tmp_section => section_vals_get_subs_vals(dft_section, "REAL_TIME_PROPAGATION")
615 CALL guess_pol_elements(dft_control, &
616 dft_control%rtp_control%print_pol_elements)
617 END IF
618 END IF
619
620 ! Read the finite field input section for periodic fields
621 tmp_section => section_vals_get_subs_vals(dft_section, "PERIODIC_EFIELD")
622 CALL section_vals_get(tmp_section, explicit=dft_control%apply_period_efield)
623 IF (dft_control%apply_period_efield) THEN
624 ALLOCATE (dft_control%period_efield)
625 CALL section_vals_val_get(tmp_section, "POLARISATION", r_vals=pol)
626 dft_control%period_efield%polarisation(1:3) = pol(1:3)
627 IF (PRESENT(cell)) THEN
628 IF (ASSOCIATED(cell)) THEN
629 CALL cell_transform_input_cartesian(cell, dft_control%period_efield%polarisation(1:3))
630 END IF
631 END IF
632 CALL section_vals_val_get(tmp_section, "D_FILTER", r_vals=pol)
633 dft_control%period_efield%d_filter(1:3) = pol(1:3)
634 IF (PRESENT(cell)) THEN
635 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, dft_control%period_efield%d_filter(1:3))
636 END IF
637 CALL section_vals_val_get(tmp_section, "INTENSITY", &
638 r_val=dft_control%period_efield%strength)
639 dft_control%period_efield%displacement_field = .false.
640 CALL section_vals_val_get(tmp_section, "DISPLACEMENT_FIELD", &
641 l_val=dft_control%period_efield%displacement_field)
642
643 CALL section_vals_val_get(tmp_section, "INTENSITY_LIST", r_vals=pol)
644
645 CALL section_vals_val_get(tmp_section, "INTENSITIES_FILE_NAME", c_val=intensities_file_name)
646
647 IF (SIZE(pol) > 1 .OR. pol(1) /= 0.0_dp) THEN
648 ! if INTENSITY_LIST is present, INTENSITY and INTENSITIES_FILE_NAME must not be present
649 IF (dft_control%period_efield%strength /= 0.0_dp .OR. intensities_file_name /= "") THEN
650 CALL cp_abort(__location__, "[PERIODIC FIELD] Only one of INTENSITY, INTENSITY_LIST "// &
651 "or INTENSITIES_FILE_NAME can be specified.")
652 END IF
653
654 ALLOCATE (dft_control%period_efield%strength_list(SIZE(pol)))
655 dft_control%period_efield%strength_list(1:SIZE(pol)) = pol(1:SIZE(pol))
656 END IF
657
658 IF (intensities_file_name /= "") THEN
659 ! if INTENSITIES_FILE_NAME is present, INTENSITY must not be present
660 IF (dft_control%period_efield%strength /= 0.0_dp) THEN
661 CALL cp_abort(__location__, "[PERIODIC FIELD] Only one of INTENSITY, INTENSITY_LIST "// &
662 "or INTENSITIES_FILE_NAME can be specified.")
663 END IF
664
665 CALL parser_create(parser, intensities_file_name)
666
667 nrep = 0
668 DO WHILE (.true.)
669 CALL parser_read_line(parser, 1, at_end)
670 IF (at_end) EXIT
671 nrep = nrep + 1
672 END DO
673
674 IF (nrep == 0) THEN
675 cpabort("[PERIODIC FIELD] No intensities found in INTENSITIES_FILE_NAME")
676 END IF
677
678 ALLOCATE (dft_control%period_efield%strength_list(nrep))
679
680 CALL parser_reset(parser)
681 DO irep = 1, nrep
682 CALL parser_read_line(parser, 1)
683 READ (parser%input_line, *) dft_control%period_efield%strength_list(irep)
684 END DO
685
686 CALL parser_release(parser)
687 END IF
688
689 CALL section_vals_val_get(tmp_section, "START_FRAME", &
690 i_val=dft_control%period_efield%start_frame)
691 CALL section_vals_val_get(tmp_section, "END_FRAME", &
692 i_val=dft_control%period_efield%end_frame)
693
694 IF (dft_control%period_efield%end_frame /= -1) THEN
695 ! check if valid bounds are given
696 ! if an end frame is given, the number of active frames must be a
697 ! multiple of the number of intensities
698 IF (dft_control%period_efield%start_frame > dft_control%period_efield%end_frame) THEN
699 cpabort("[PERIODIC FIELD] START_FRAME > END_FRAME")
700 ELSE IF (dft_control%period_efield%start_frame < 1) THEN
701 cpabort("[PERIODIC FIELD] START_FRAME < 1")
702 ELSE IF (mod(dft_control%period_efield%end_frame - &
703 dft_control%period_efield%start_frame + 1, SIZE(pol)) /= 0) THEN
704 CALL cp_abort(__location__, &
705 "[PERIODIC FIELD] Number of active frames must be a multiple of the number of intensities")
706 END IF
707 END IF
708
709 ! periodic fields don't work with RTP
710 IF (do_rtp) THEN
711 CALL cp_abort(__location__, &
712 "Periodic efield cannot be used with RTP. When restarting a "// &
713 "run with periodic efield, set RESTART_RTP under &EXT_RESTART "// &
714 "section to .FALSE. explicitly if RESTART_DEFAULT is .TRUE.")
715 END IF
716 IF (dft_control%period_efield%displacement_field) THEN
717 CALL cite_reference(stengel2009)
718 ELSE
719 CALL cite_reference(souza2002)
720 CALL cite_reference(umari2002)
721 END IF
722 END IF
723
724 ! Read the external potential input section
725 tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_POTENTIAL")
726 CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_potential)
727 IF (dft_control%apply_external_potential) THEN
728 CALL expot_control_create(dft_control%expot_control)
729 CALL section_vals_val_get(tmp_section, "READ_FROM_CUBE", &
730 l_val=dft_control%expot_control%read_from_cube)
731 CALL section_vals_val_get(tmp_section, "STATIC", &
732 l_val=dft_control%expot_control%static)
733 CALL section_vals_val_get(tmp_section, "SCALING_FACTOR", &
734 r_val=dft_control%expot_control%scaling_factor)
735 ! External potential using Maxwell equation
736 maxwell_section => section_vals_get_subs_vals(tmp_section, "MAXWELL")
737 CALL section_vals_get(maxwell_section, explicit=is_present)
738 IF (is_present) THEN
739 dft_control%expot_control%maxwell_solver = .true.
740 CALL maxwell_control_create(dft_control%maxwell_control)
741 ! read the input values from Maxwell section
742 CALL section_vals_val_get(maxwell_section, "TEST_REAL", &
743 r_val=dft_control%maxwell_control%real_test)
744 CALL section_vals_val_get(maxwell_section, "TEST_INTEGER", &
745 i_val=dft_control%maxwell_control%int_test)
746 CALL section_vals_val_get(maxwell_section, "TEST_LOGICAL", &
747 l_val=dft_control%maxwell_control%log_test)
748 ELSE
749 dft_control%expot_control%maxwell_solver = .false.
750 END IF
751 END IF
752
753 ! Read the SCCS input section if present
754 sccs_section => section_vals_get_subs_vals(dft_section, "SCCS")
755 CALL section_vals_get(sccs_section, explicit=is_present)
756 IF (is_present) THEN
757 ! Check section parameter if SCCS is activated
758 CALL section_vals_val_get(sccs_section, "_SECTION_PARAMETERS_", &
759 l_val=dft_control%do_sccs)
760 IF (dft_control%do_sccs) THEN
761 ALLOCATE (dft_control%sccs_control)
762 CALL section_vals_val_get(sccs_section, "RELATIVE_PERMITTIVITY", &
763 r_val=dft_control%sccs_control%epsilon_solvent)
764 CALL section_vals_val_get(sccs_section, "ALPHA", &
765 r_val=dft_control%sccs_control%alpha_solvent)
766 CALL section_vals_val_get(sccs_section, "BETA", &
767 r_val=dft_control%sccs_control%beta_solvent)
768 CALL section_vals_val_get(sccs_section, "DELTA_RHO", &
769 r_val=dft_control%sccs_control%delta_rho)
770 CALL section_vals_val_get(sccs_section, "DERIVATIVE_METHOD", &
771 i_val=dft_control%sccs_control%derivative_method)
772 CALL section_vals_val_get(sccs_section, "METHOD", &
773 i_val=dft_control%sccs_control%method_id)
774 CALL section_vals_val_get(sccs_section, "EPS_SCCS", &
775 r_val=dft_control%sccs_control%eps_sccs)
776 CALL section_vals_val_get(sccs_section, "EPS_SCF", &
777 r_val=dft_control%sccs_control%eps_scf)
778 CALL section_vals_val_get(sccs_section, "GAMMA", &
779 r_val=dft_control%sccs_control%gamma_solvent)
780 CALL section_vals_val_get(sccs_section, "MAX_ITER", &
781 i_val=dft_control%sccs_control%max_iter)
782 CALL section_vals_val_get(sccs_section, "MIXING", &
783 r_val=dft_control%sccs_control%mixing)
784 SELECT CASE (dft_control%sccs_control%method_id)
785 CASE (sccs_andreussi)
786 tmp_section => section_vals_get_subs_vals(sccs_section, "ANDREUSSI")
787 CALL section_vals_val_get(tmp_section, "RHO_MAX", &
788 r_val=dft_control%sccs_control%rho_max)
789 CALL section_vals_val_get(tmp_section, "RHO_MIN", &
790 r_val=dft_control%sccs_control%rho_min)
791 IF (dft_control%sccs_control%rho_max < dft_control%sccs_control%rho_min) THEN
792 CALL cp_abort(__location__, &
793 "The SCCS parameter RHO_MAX is smaller than RHO_MIN. "// &
794 "Please, check your input!")
795 END IF
796 CALL cite_reference(andreussi2012)
798 tmp_section => section_vals_get_subs_vals(sccs_section, "FATTEBERT-GYGI")
799 CALL section_vals_val_get(tmp_section, "BETA", &
800 r_val=dft_control%sccs_control%beta)
801 IF (dft_control%sccs_control%beta < 0.5_dp) THEN
802 CALL cp_abort(__location__, &
803 "A value smaller than 0.5 for the SCCS parameter beta "// &
804 "causes numerical problems. Please, check your input!")
805 END IF
806 CALL section_vals_val_get(tmp_section, "RHO_ZERO", &
807 r_val=dft_control%sccs_control%rho_zero)
808 CALL cite_reference(fattebert2002)
809 CASE (sccs_saa_andreussi)
810 tmp_section => section_vals_get_subs_vals(sccs_section, "SAA_ANDREUSSI")
811 CALL section_vals_get(tmp_section, explicit=is_present)
812 IF (.NOT. is_present) THEN
813 CALL cp_abort(__location__, &
814 "SCCS method SAA_ANDREUSSI requires the "// &
815 "SAA_ANDREUSSI section.")
816 END IF
817 IF (.NOT. all(cell%perd == 1)) THEN
818 CALL cp_abort(__location__, &
819 "SCCS method SAA_ANDREUSSI is only implemented for "// &
820 "3D periodic calculations.")
821 END IF
822 CALL section_vals_val_get(tmp_section, "RHO_MAX", &
823 r_val=dft_control%sccs_control%rho_max)
824 CALL section_vals_val_get(tmp_section, "RHO_MIN", &
825 r_val=dft_control%sccs_control%rho_min)
826 IF (dft_control%sccs_control%rho_max < dft_control%sccs_control%rho_min) THEN
827 CALL cp_abort(__location__, &
828 "The SCCS parameter RHO_MAX is smaller than RHO_MIN. "// &
829 "Please, check your input!")
830 END IF
831 CALL section_vals_val_get(tmp_section, "F0", &
832 r_val=dft_control%sccs_control%f0)
833 CALL section_vals_val_get(tmp_section, "DELTA_ETA", &
834 r_val=dft_control%sccs_control%delta_eta)
835 CALL section_vals_val_get(tmp_section, "DELTA_ZETA", &
836 r_val=dft_control%sccs_control%delta_zeta)
837 CALL section_vals_val_get(tmp_section, "R_SOLV", &
838 r_val=dft_control%sccs_control%r_solv)
839 CALL section_vals_val_get(tmp_section, "ALPHA_ZETA", &
840 r_val=dft_control%sccs_control%alpha_zeta)
841 CALL cite_reference(andreussi2019)
842 CALL cite_reference(chai2025a)
843 CASE DEFAULT
844 cpabort("Invalid SCCS model specified. Please, check your input!")
845 END SELECT
846 CALL cite_reference(yin2017)
847 END IF
848 END IF
849
850 ! Read the planar counter charge section
851 tmp_section => section_vals_get_subs_vals(dft_section, "PLANAR_COUNTER_CHARGE")
852 CALL section_vals_get(tmp_section, explicit=is_present)
853 IF (is_present) THEN
854 ! Check section parameter if planar counter charge is activated
855 CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
856 l_val=dft_control%do_pcc)
857 IF (dft_control%do_pcc) THEN
858 ALLOCATE (dft_control%pcc_control)
859 CALL section_vals_val_get(tmp_section, "DIST_EDGE", &
860 r_val=dft_control%pcc_control%dist_edge)
861 CALL section_vals_val_get(tmp_section, "GAU_C", &
862 r_val=dft_control%pcc_control%gau_c)
863 CALL section_vals_val_get(tmp_section, "PARALLEL_PLANE", &
864 i_val=dft_control%pcc_control%surf_normal)
865 END IF
866 END IF
867
868 ! Read the planar averaged Hartree potential section
869 tmp_section => section_vals_get_subs_vals(dft_section, "PLANAR_AVERAGED_V_HARTREE")
870 CALL section_vals_get(tmp_section, explicit=is_present)
871 IF (is_present) THEN
872 ! Check section parameter if the planar-averaged potential is activated
873 CALL section_vals_val_get(tmp_section, "_SECTION_PARAMETERS_", &
874 l_val=dft_control%do_paep)
875 IF (dft_control%do_paep) THEN
876 ALLOCATE (dft_control%paep_control)
877 CALL section_vals_val_get(tmp_section, "PARALLEL_PLANE", &
878 i_val=dft_control%paep_control%surf_normal)
879 END IF
880 END IF
881
882 ! ZMP added input sections
883 ! Read the external density input section
884 tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_DENSITY")
885 CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_density)
886
887 ! Read the external vxc input section
888 tmp_section => section_vals_get_subs_vals(dft_section, "EXTERNAL_VXC")
889 CALL section_vals_get(tmp_section, explicit=dft_control%apply_external_vxc)
890
891 tmp_section => section_vals_get_subs_vals(dft_section, "LOCALIZE")
892 CALL section_vals_val_get(tmp_section, "EACH", i_val=dft_control%localize_each)
893
894 ! SMEAGOL interface
895 tmp_section => section_vals_get_subs_vals(dft_section, "SMEAGOL")
896 CALL read_smeagol_control(dft_control%smeagol_control, tmp_section)
897
898 END SUBROUTINE read_dft_control
899
900! **************************************************************************************************
901!> \brief Reads the input and stores in the rixs_control_type
902!> \param rixs_control ...
903!> \param rixs_section ...
904!> \param qs_control ...
905! **************************************************************************************************
906 SUBROUTINE read_rixs_control(rixs_control, rixs_section, qs_control)
907 TYPE(rixs_control_type), POINTER :: rixs_control
908 TYPE(section_vals_type), POINTER :: rixs_section
909 TYPE(qs_control_type), POINTER :: qs_control
910
911 TYPE(section_vals_type), POINTER :: td_section, xas_section
912
913 CALL section_vals_val_get(rixs_section, "_SECTION_PARAMETERS_", l_val=rixs_control%enabled)
914
915 CALL section_vals_val_get(rixs_section, "CORE_STATES", i_val=rixs_control%core_states)
916 CALL section_vals_val_get(rixs_section, "VALENCE_STATES", i_val=rixs_control%valence_states)
917
918 td_section => section_vals_get_subs_vals(rixs_section, "TDDFPT")
919 CALL read_tddfpt2_control(rixs_control%tddfpt2_control, td_section, qs_control)
920
921 xas_section => section_vals_get_subs_vals(rixs_section, "XAS_TDP")
922 CALL read_xas_tdp_control(rixs_control%xas_tdp_control, xas_section)
923
924 END SUBROUTINE read_rixs_control
925
926! **************************************************************************************************
927!> \brief ...
928!> \param qs_control ...
929!> \param dft_section ...
930! **************************************************************************************************
931 SUBROUTINE read_mgrid_section(qs_control, dft_section)
932
933 TYPE(qs_control_type), INTENT(INOUT) :: qs_control
934 TYPE(section_vals_type), POINTER :: dft_section
935
936 CHARACTER(len=*), PARAMETER :: routinen = 'read_mgrid_section'
937
938 INTEGER :: handle, igrid_level, interp_kind, &
939 ngrid_level
940 LOGICAL :: explicit, multigrid_set
941 REAL(dp) :: cutoff
942 REAL(dp), DIMENSION(:), POINTER :: cutofflist
943 TYPE(section_vals_type), POINTER :: interp_section, mgrid_section
944
945 CALL timeset(routinen, handle)
946
947 NULLIFY (interp_section, mgrid_section, cutofflist)
948 mgrid_section => section_vals_get_subs_vals(dft_section, "MGRID")
949 interp_section => section_vals_get_subs_vals(mgrid_section, "INTERPOLATOR")
950
951 CALL section_vals_val_get(mgrid_section, "NGRIDS", i_val=ngrid_level)
952 CALL section_vals_val_get(mgrid_section, "MULTIGRID_SET", l_val=multigrid_set)
953 CALL section_vals_val_get(mgrid_section, "CUTOFF", r_val=cutoff)
954 CALL section_vals_val_get(mgrid_section, "PROGRESSION_FACTOR", r_val=qs_control%progression_factor)
955 CALL section_vals_val_get(mgrid_section, "COMMENSURATE", l_val=qs_control%commensurate_mgrids)
956 CALL section_vals_val_get(interp_section, "KIND", i_val=interp_kind)
957 IF (interp_kind /= pw_interp) qs_control%commensurate_mgrids = .true.
958 CALL section_vals_val_get(mgrid_section, "REALSPACE", l_val=qs_control%realspace_mgrids)
959 CALL section_vals_val_get(mgrid_section, "REL_CUTOFF", r_val=qs_control%relative_cutoff)
960 CALL section_vals_val_get(mgrid_section, "SKIP_LOAD_BALANCE_DISTRIBUTED", &
961 l_val=qs_control%skip_load_balance_distributed)
962
963 ! For SE and DFTB possibly override with new defaults
964 IF (qs_control%semi_empirical .OR. qs_control%dftb .OR. qs_control%xtb) THEN
965 ngrid_level = 1
966 multigrid_set = .false.
967 ! Override default cutoff value unless user specified an explicit argument..
968 CALL section_vals_val_get(mgrid_section, "CUTOFF", explicit=explicit, r_val=cutoff)
969 IF (.NOT. explicit) cutoff = 1.0_dp
970 END IF
971
972 ALLOCATE (qs_control%e_cutoff(ngrid_level))
973 qs_control%cutoff = cutoff
974
975 IF (multigrid_set) THEN
976 ! Read the values from input
977 IF (qs_control%commensurate_mgrids) THEN
978 cpabort("Do not specify cutoffs for the commensurate grids (NYI)")
979 END IF
980
981 CALL section_vals_val_get(mgrid_section, "MULTIGRID_CUTOFF", r_vals=cutofflist)
982 IF (ASSOCIATED(cutofflist)) THEN
983 IF (SIZE(cutofflist, 1) /= ngrid_level) THEN
984 cpabort("Number of multi-grids requested and number of cutoff values do not match")
985 END IF
986 DO igrid_level = 1, ngrid_level
987 qs_control%e_cutoff(igrid_level) = cutofflist(igrid_level)
988 END DO
989 END IF
990 ! set cutoff to smallest value in multgrid available with >= cutoff
991 DO igrid_level = ngrid_level, 1, -1
992 IF (qs_control%cutoff <= qs_control%e_cutoff(igrid_level)) THEN
993 qs_control%cutoff = qs_control%e_cutoff(igrid_level)
994 EXIT
995 END IF
996 ! set largest grid value to cutoff
997 IF (igrid_level == 1) THEN
998 qs_control%cutoff = qs_control%e_cutoff(1)
999 END IF
1000 END DO
1001 ELSE
1002 IF (qs_control%commensurate_mgrids) qs_control%progression_factor = 4.0_dp
1003 qs_control%e_cutoff(1) = qs_control%cutoff
1004 DO igrid_level = 2, ngrid_level
1005 qs_control%e_cutoff(igrid_level) = qs_control%e_cutoff(igrid_level - 1)/ &
1006 qs_control%progression_factor
1007 END DO
1008 END IF
1009 ! check that multigrids are ordered
1010 DO igrid_level = 2, ngrid_level
1011 IF (qs_control%e_cutoff(igrid_level) > qs_control%e_cutoff(igrid_level - 1)) THEN
1012 cpabort("The cutoff values for the multi-grids are not ordered from large to small")
1013 ELSE IF (qs_control%e_cutoff(igrid_level) == qs_control%e_cutoff(igrid_level - 1)) THEN
1014 cpabort("The same cutoff value was specified for two multi-grids")
1015 END IF
1016 END DO
1017 CALL timestop(handle)
1018 END SUBROUTINE read_mgrid_section
1019
1020! **************************************************************************************************
1021!> \brief ...
1022!> \param qs_control ...
1023!> \param qs_section ...
1024!> \param cell optional cell used to transform Cartesian input vectors
1025! **************************************************************************************************
1026 SUBROUTINE read_qs_section(qs_control, qs_section, cell)
1027
1028 TYPE(qs_control_type), INTENT(INOUT) :: qs_control
1029 TYPE(section_vals_type), POINTER :: qs_section
1030 TYPE(cell_type), OPTIONAL, POINTER :: cell
1031
1032 CHARACTER(len=*), PARAMETER :: routinen = 'read_qs_section'
1033
1034 CHARACTER(LEN=2) :: element_symbol
1035 CHARACTER(LEN=default_string_length) :: cval
1036 CHARACTER(LEN=default_string_length), &
1037 DIMENSION(:), POINTER :: clist
1038 INTEGER :: handle, itmp, j, jj, k, n_rep, n_var, &
1039 ngauss, ngp, nrep, znum
1040 INTEGER, DIMENSION(:), POINTER :: tmplist
1041 LOGICAL :: dftb_scc_mixer_explicit, dftb_tblite_mixer_explicit, explicit, &
1042 tblite_reference_cli, tblite_reference_cli_section, tblite_section_active, was_present, &
1043 xtb_scc_mixer_explicit, xtb_tblite_mixer_explicit
1044 REAL(dp) :: tmp, tmpsqrt, value
1045 REAL(dp), POINTER :: scal(:)
1046 TYPE(section_vals_type), POINTER :: cdft_control_section, ddapc_restraint_section, &
1047 dftb_parameter, dftb_section, dftb_tblite_mixer, eeq_section, genpot_section, &
1048 lri_optbas_section, mull_section, nonbonded_section, s2_restraint_section, se_section, &
1049 xtb_parameter, xtb_section, xtb_tblite, xtb_tblite_mixer, xtb_tblite_ref_cli
1050
1051 CALL timeset(routinen, handle)
1052
1053 was_present = .false.
1054 NULLIFY (mull_section, ddapc_restraint_section, s2_restraint_section, &
1055 se_section, dftb_section, xtb_section, dftb_parameter, xtb_parameter, lri_optbas_section, &
1056 cdft_control_section, genpot_section, eeq_section, dftb_tblite_mixer, &
1057 xtb_tblite_mixer, xtb_tblite_ref_cli)
1058
1059 mull_section => section_vals_get_subs_vals(qs_section, "MULLIKEN_RESTRAINT")
1060 ddapc_restraint_section => section_vals_get_subs_vals(qs_section, "DDAPC_RESTRAINT")
1061 s2_restraint_section => section_vals_get_subs_vals(qs_section, "S2_RESTRAINT")
1062 se_section => section_vals_get_subs_vals(qs_section, "SE")
1063 dftb_section => section_vals_get_subs_vals(qs_section, "DFTB")
1064 xtb_section => section_vals_get_subs_vals(qs_section, "xTB")
1065 dftb_parameter => section_vals_get_subs_vals(dftb_section, "PARAMETER")
1066 dftb_tblite_mixer => section_vals_get_subs_vals(dftb_section, "TBLITE_MIXER")
1067 xtb_parameter => section_vals_get_subs_vals(xtb_section, "PARAMETER")
1068 eeq_section => section_vals_get_subs_vals(xtb_section, "EEQ")
1069 lri_optbas_section => section_vals_get_subs_vals(qs_section, "OPTIMIZE_LRI_BASIS")
1070 cdft_control_section => section_vals_get_subs_vals(qs_section, "CDFT")
1071 nonbonded_section => section_vals_get_subs_vals(xtb_section, "NONBONDED")
1072 genpot_section => section_vals_get_subs_vals(nonbonded_section, "GENPOT")
1073 xtb_tblite_mixer => section_vals_get_subs_vals(xtb_section, "TBLITE_MIXER")
1074 xtb_tblite => section_vals_get_subs_vals(xtb_section, "TBLITE")
1075 xtb_tblite_ref_cli => section_vals_get_subs_vals(xtb_tblite, "REFERENCE_CLI")
1076
1077 ! Setup all defaults values and overwrite input parameters
1078 ! EPS_DEFAULT should set the target accuracy in the total energy (~per electron) or a closely related value
1079 CALL section_vals_val_get(qs_section, "EPS_DEFAULT", r_val=value)
1080 tmpsqrt = sqrt(value) ! a trick to work around a NAG 5.1 optimizer bug
1081
1082 ! random choice ?
1083 qs_control%eps_core_charge = value/100.0_dp
1084 ! correct if all Gaussians would have the same radius (overlap will be smaller than eps_pgf_orb**2).
1085 ! Can be significantly in error if not... requires fully new screening/pairlist procedures
1086 qs_control%eps_pgf_orb = tmpsqrt
1087 qs_control%eps_kg_orb = qs_control%eps_pgf_orb
1088 ! consistent since also a kind of overlap
1089 qs_control%eps_ppnl = qs_control%eps_pgf_orb/100.0_dp
1090 ! accuracy is basically set by the overlap, this sets an empirical shift
1091 qs_control%eps_ppl = 1.0e-2_dp
1092 !
1093 qs_control%gapw_control%eps_cpc = value
1094 ! expexted error in the density
1095 qs_control%eps_rho_gspace = value
1096 qs_control%eps_rho_rspace = value
1097 ! error in the gradient, can be the sqrt of the error in the energy, ignored if map_consistent
1098 qs_control%eps_gvg_rspace = tmpsqrt
1099 !
1100 CALL section_vals_val_get(qs_section, "EPS_CORE_CHARGE", n_rep_val=n_rep)
1101 IF (n_rep /= 0) THEN
1102 CALL section_vals_val_get(qs_section, "EPS_CORE_CHARGE", r_val=qs_control%eps_core_charge)
1103 END IF
1104 CALL section_vals_val_get(qs_section, "EPS_GVG_RSPACE", n_rep_val=n_rep)
1105 IF (n_rep /= 0) THEN
1106 CALL section_vals_val_get(qs_section, "EPS_GVG_RSPACE", r_val=qs_control%eps_gvg_rspace)
1107 END IF
1108 CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", n_rep_val=n_rep)
1109 IF (n_rep /= 0) THEN
1110 CALL section_vals_val_get(qs_section, "EPS_PGF_ORB", r_val=qs_control%eps_pgf_orb)
1111 END IF
1112 CALL section_vals_val_get(qs_section, "EPS_KG_ORB", n_rep_val=n_rep)
1113 IF (n_rep /= 0) THEN
1114 CALL section_vals_val_get(qs_section, "EPS_KG_ORB", r_val=tmp)
1115 qs_control%eps_kg_orb = sqrt(tmp)
1116 END IF
1117 CALL section_vals_val_get(qs_section, "EPS_PPL", n_rep_val=n_rep)
1118 IF (n_rep /= 0) THEN
1119 CALL section_vals_val_get(qs_section, "EPS_PPL", r_val=qs_control%eps_ppl)
1120 END IF
1121 CALL section_vals_val_get(qs_section, "EPS_PPNL", n_rep_val=n_rep)
1122 IF (n_rep /= 0) THEN
1123 CALL section_vals_val_get(qs_section, "EPS_PPNL", r_val=qs_control%eps_ppnl)
1124 END IF
1125 CALL section_vals_val_get(qs_section, "EPS_RHO", n_rep_val=n_rep)
1126 IF (n_rep /= 0) THEN
1127 CALL section_vals_val_get(qs_section, "EPS_RHO", r_val=qs_control%eps_rho_gspace)
1128 qs_control%eps_rho_rspace = qs_control%eps_rho_gspace
1129 END IF
1130 CALL section_vals_val_get(qs_section, "EPS_RHO_RSPACE", n_rep_val=n_rep)
1131 IF (n_rep /= 0) THEN
1132 CALL section_vals_val_get(qs_section, "EPS_RHO_RSPACE", r_val=qs_control%eps_rho_rspace)
1133 END IF
1134 CALL section_vals_val_get(qs_section, "EPS_RHO_GSPACE", n_rep_val=n_rep)
1135 IF (n_rep /= 0) THEN
1136 CALL section_vals_val_get(qs_section, "EPS_RHO_GSPACE", r_val=qs_control%eps_rho_gspace)
1137 END IF
1138 CALL section_vals_val_get(qs_section, "EPS_FILTER_MATRIX", n_rep_val=n_rep)
1139 IF (n_rep /= 0) THEN
1140 CALL section_vals_val_get(qs_section, "EPS_FILTER_MATRIX", r_val=qs_control%eps_filter_matrix)
1141 END IF
1142 CALL section_vals_val_get(qs_section, "EPS_CPC", n_rep_val=n_rep)
1143 IF (n_rep /= 0) THEN
1144 CALL section_vals_val_get(qs_section, "EPS_CPC", r_val=qs_control%gapw_control%eps_cpc)
1145 END IF
1146
1147 CALL section_vals_val_get(qs_section, "EPSFIT", r_val=qs_control%gapw_control%eps_fit)
1148 CALL section_vals_val_get(qs_section, "EPSISO", r_val=qs_control%gapw_control%eps_iso)
1149 CALL section_vals_val_get(qs_section, "EPSSVD", r_val=qs_control%gapw_control%eps_svd)
1150 CALL section_vals_val_get(qs_section, "EPSRHO0", r_val=qs_control%gapw_control%eps_Vrho0)
1151 CALL section_vals_val_get(qs_section, "ALPHA0_HARD", r_val=qs_control%gapw_control%alpha0_hard)
1152 qs_control%gapw_control%alpha0_hard_from_input = .false.
1153 IF (qs_control%gapw_control%alpha0_hard /= 0.0_dp) qs_control%gapw_control%alpha0_hard_from_input = .true.
1154 CALL section_vals_val_get(qs_section, "FORCE_PAW", l_val=qs_control%gapw_control%force_paw)
1155 CALL section_vals_val_get(qs_section, "MAX_RAD_LOCAL", r_val=qs_control%gapw_control%max_rad_local)
1156
1157 CALL section_vals_val_get(qs_section, "MIN_PAIR_LIST_RADIUS", r_val=qs_control%pairlist_radius)
1158
1159 CALL section_vals_val_get(qs_section, "LS_SCF", l_val=qs_control%do_ls_scf)
1160 CALL section_vals_val_get(qs_section, "ALMO_SCF", l_val=qs_control%do_almo_scf)
1161 CALL section_vals_val_get(qs_section, "KG_METHOD", l_val=qs_control%do_kg)
1162
1163 ! Logicals
1164 CALL section_vals_val_get(qs_section, "REF_EMBED_SUBSYS", l_val=qs_control%ref_embed_subsys)
1165 CALL section_vals_val_get(qs_section, "CLUSTER_EMBED_SUBSYS", l_val=qs_control%cluster_embed_subsys)
1166 CALL section_vals_val_get(qs_section, "HIGH_LEVEL_EMBED_SUBSYS", l_val=qs_control%high_level_embed_subsys)
1167 CALL section_vals_val_get(qs_section, "DFET_EMBEDDED", l_val=qs_control%dfet_embedded)
1168 CALL section_vals_val_get(qs_section, "DMFET_EMBEDDED", l_val=qs_control%dmfet_embedded)
1169
1170 ! Integers gapw
1171 CALL section_vals_val_get(qs_section, "LMAXN1", i_val=qs_control%gapw_control%lmax_sphere)
1172 CALL section_vals_val_get(qs_section, "LMAXN0", i_val=qs_control%gapw_control%lmax_rho0)
1173 CALL section_vals_val_get(qs_section, "LADDN0", i_val=qs_control%gapw_control%ladd_rho0)
1174 CALL section_vals_val_get(qs_section, "QUADRATURE", i_val=qs_control%gapw_control%quadrature)
1175 ! GAPW 1c basis
1176 CALL section_vals_val_get(qs_section, "GAPW_1C_BASIS", i_val=qs_control%gapw_control%basis_1c)
1177 IF (qs_control%gapw_control%basis_1c /= gapw_1c_orb) THEN
1178 qs_control%gapw_control%eps_svd = max(qs_control%gapw_control%eps_svd, 1.e-12_dp)
1179 END IF
1180 ! GAPW accurate integration
1181 CALL section_vals_val_get(qs_section, "GAPW_ACCURATE_XCINT", l_val=qs_control%gapw_control%accurate_xcint)
1182 CALL section_vals_val_get(qs_section, "ALPHA_WEIGHTS", r_val=qs_control%gapw_control%aweights)
1183 CALL section_vals_val_get(qs_section, "ORDER_WEIGHTS", i_val=qs_control%gapw_control%oweights)
1184
1185 ! Integers grids
1186 CALL section_vals_val_get(qs_section, "PW_GRID", i_val=itmp)
1187 SELECT CASE (itmp)
1188 CASE (do_pwgrid_spherical)
1189 qs_control%pw_grid_opt%spherical = .true.
1190 qs_control%pw_grid_opt%fullspace = .false.
1191 CASE (do_pwgrid_ns_fullspace)
1192 qs_control%pw_grid_opt%spherical = .false.
1193 qs_control%pw_grid_opt%fullspace = .true.
1194 CASE (do_pwgrid_ns_halfspace)
1195 qs_control%pw_grid_opt%spherical = .false.
1196 qs_control%pw_grid_opt%fullspace = .false.
1197 END SELECT
1198
1199 ! Method for PPL calculation
1200 CALL section_vals_val_get(qs_section, "CORE_PPL", i_val=itmp)
1201 qs_control%do_ppl_method = itmp
1202
1203 CALL section_vals_val_get(qs_section, "PW_GRID_LAYOUT", i_vals=tmplist)
1204 qs_control%pw_grid_opt%distribution_layout = tmplist
1205 CALL section_vals_val_get(qs_section, "PW_GRID_BLOCKED", i_val=qs_control%pw_grid_opt%blocked)
1206
1207 !Integers extrapolation
1208 CALL section_vals_val_get(qs_section, "EXTRAPOLATION", i_val=qs_control%wf_interpolation_method_nr)
1209 CALL section_vals_val_get(qs_section, "EXTRAPOLATION_ORDER", i_val=qs_control%wf_extrapolation_order)
1210
1211 !Method
1212 CALL section_vals_val_get(qs_section, "METHOD", i_val=qs_control%method_id)
1213 qs_control%gapw = .false.
1214 qs_control%gapw_xc = .false.
1215 qs_control%gpw = .false.
1216 qs_control%pao = .false.
1217 qs_control%dftb = .false.
1218 qs_control%xtb = .false.
1219 qs_control%semi_empirical = .false.
1220 qs_control%ofgpw = .false.
1221 qs_control%lrigpw = .false.
1222 qs_control%rigpw = .false.
1223 SELECT CASE (qs_control%method_id)
1224 CASE (do_method_gapw)
1225 CALL cite_reference(lippert1999)
1226 CALL cite_reference(krack2000)
1227 qs_control%gapw = .true.
1228 CASE (do_method_gapw_xc)
1229 qs_control%gapw_xc = .true.
1230 CASE (do_method_gpw)
1231 CALL cite_reference(lippert1997)
1232 CALL cite_reference(vandevondele2005a)
1233 qs_control%gpw = .true.
1234 CASE (do_method_ofgpw)
1235 qs_control%ofgpw = .true.
1236 CASE (do_method_lrigpw)
1237 qs_control%lrigpw = .true.
1238 CASE (do_method_rigpw)
1239 qs_control%rigpw = .true.
1240 CASE (do_method_dftb)
1241 qs_control%dftb = .true.
1242 CALL cite_reference(porezag1995)
1243 CALL cite_reference(seifert1996)
1244 CASE (do_method_xtb)
1245 qs_control%xtb = .true.
1246 CALL cite_reference(grimme2017)
1247 CALL cite_reference(pracht2019)
1248 CASE (do_method_mndo)
1249 CALL cite_reference(dewar1977)
1250 qs_control%semi_empirical = .true.
1251 CASE (do_method_am1)
1252 CALL cite_reference(dewar1985)
1253 qs_control%semi_empirical = .true.
1254 CASE (do_method_pm3)
1255 CALL cite_reference(stewart1989)
1256 qs_control%semi_empirical = .true.
1257 CASE (do_method_pnnl)
1258 CALL cite_reference(schenter2008)
1259 qs_control%semi_empirical = .true.
1260 CASE (do_method_pm6)
1261 CALL cite_reference(stewart2007)
1262 qs_control%semi_empirical = .true.
1263 CASE (do_method_pm6fm)
1264 CALL cite_reference(vanvoorhis2015)
1265 qs_control%semi_empirical = .true.
1266 CASE (do_method_pdg)
1267 CALL cite_reference(repasky2002)
1268 qs_control%semi_empirical = .true.
1269 CASE (do_method_rm1)
1270 CALL cite_reference(rocha2006)
1271 qs_control%semi_empirical = .true.
1272 CASE (do_method_mndod)
1273 CALL cite_reference(dewar1977)
1274 CALL cite_reference(thiel1992)
1275 qs_control%semi_empirical = .true.
1276 END SELECT
1277
1278 CALL section_vals_get(mull_section, explicit=qs_control%mulliken_restraint)
1279
1280 IF (qs_control%mulliken_restraint) THEN
1281 CALL section_vals_val_get(mull_section, "STRENGTH", r_val=qs_control%mulliken_restraint_control%strength)
1282 CALL section_vals_val_get(mull_section, "TARGET", r_val=qs_control%mulliken_restraint_control%target)
1283 CALL section_vals_val_get(mull_section, "ATOMS", n_rep_val=n_rep)
1284 jj = 0
1285 DO k = 1, n_rep
1286 CALL section_vals_val_get(mull_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
1287 jj = jj + SIZE(tmplist)
1288 END DO
1289 qs_control%mulliken_restraint_control%natoms = jj
1290 IF (qs_control%mulliken_restraint_control%natoms < 1) THEN
1291 cpabort("Need at least 1 atom to use mulliken constraints")
1292 END IF
1293 ALLOCATE (qs_control%mulliken_restraint_control%atoms(qs_control%mulliken_restraint_control%natoms))
1294 jj = 0
1295 DO k = 1, n_rep
1296 CALL section_vals_val_get(mull_section, "ATOMS", i_rep_val=k, i_vals=tmplist)
1297 DO j = 1, SIZE(tmplist)
1298 jj = jj + 1
1299 qs_control%mulliken_restraint_control%atoms(jj) = tmplist(j)
1300 END DO
1301 END DO
1302 END IF
1303 CALL section_vals_get(ddapc_restraint_section, n_repetition=nrep, explicit=qs_control%ddapc_restraint)
1304 IF (qs_control%ddapc_restraint) THEN
1305 ALLOCATE (qs_control%ddapc_restraint_control(nrep))
1306 CALL read_ddapc_section(qs_control, qs_section=qs_section)
1307 qs_control%ddapc_restraint_is_spin = .false.
1308 qs_control%ddapc_explicit_potential = .false.
1309 END IF
1310
1311 CALL section_vals_get(s2_restraint_section, explicit=qs_control%s2_restraint)
1312 IF (qs_control%s2_restraint) THEN
1313 CALL section_vals_val_get(s2_restraint_section, "STRENGTH", &
1314 r_val=qs_control%s2_restraint_control%strength)
1315 CALL section_vals_val_get(s2_restraint_section, "TARGET", &
1316 r_val=qs_control%s2_restraint_control%target)
1317 CALL section_vals_val_get(s2_restraint_section, "FUNCTIONAL_FORM", &
1318 i_val=qs_control%s2_restraint_control%functional_form)
1319 END IF
1320
1321 CALL section_vals_get(cdft_control_section, explicit=qs_control%cdft)
1322 IF (qs_control%cdft) THEN
1323 CALL read_cdft_control_section(qs_control, cdft_control_section)
1324 END IF
1325
1326 ! Semi-empirical code
1327 IF (qs_control%semi_empirical) THEN
1328 CALL section_vals_val_get(se_section, "ORTHOGONAL_BASIS", &
1329 l_val=qs_control%se_control%orthogonal_basis)
1330 CALL section_vals_val_get(se_section, "DELTA", &
1331 r_val=qs_control%se_control%delta)
1332 CALL section_vals_val_get(se_section, "ANALYTICAL_GRADIENTS", &
1333 l_val=qs_control%se_control%analytical_gradients)
1334 CALL section_vals_val_get(se_section, "FORCE_KDSO-D_EXCHANGE", &
1335 l_val=qs_control%se_control%force_kdsod_EX)
1336 ! Integral Screening
1337 CALL section_vals_val_get(se_section, "INTEGRAL_SCREENING", &
1338 i_val=qs_control%se_control%integral_screening)
1339 IF (qs_control%method_id == do_method_pnnl) THEN
1340 IF (qs_control%se_control%integral_screening /= do_se_is_slater) THEN
1341 CALL cp_warn(__location__, &
1342 "PNNL semi-empirical parameterization supports only the Slater type "// &
1343 "integral scheme. Revert to Slater and continue the calculation.")
1344 END IF
1345 qs_control%se_control%integral_screening = do_se_is_slater
1346 END IF
1347 ! Global Arrays variable
1348 CALL section_vals_val_get(se_section, "GA%NCELLS", &
1349 i_val=qs_control%se_control%ga_ncells)
1350 ! Long-Range correction
1351 CALL section_vals_val_get(se_section, "LR_CORRECTION%CUTOFF", &
1352 r_val=qs_control%se_control%cutoff_lrc)
1353 qs_control%se_control%taper_lrc = qs_control%se_control%cutoff_lrc
1354 CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_TAPER", &
1355 explicit=explicit)
1356 IF (explicit) THEN
1357 CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_TAPER", &
1358 r_val=qs_control%se_control%taper_lrc)
1359 END IF
1360 CALL section_vals_val_get(se_section, "LR_CORRECTION%RC_RANGE", &
1361 r_val=qs_control%se_control%range_lrc)
1362 ! Coulomb
1363 CALL section_vals_val_get(se_section, "COULOMB%CUTOFF", &
1364 r_val=qs_control%se_control%cutoff_cou)
1365 qs_control%se_control%taper_cou = qs_control%se_control%cutoff_cou
1366 CALL section_vals_val_get(se_section, "COULOMB%RC_TAPER", &
1367 explicit=explicit)
1368 IF (explicit) THEN
1369 CALL section_vals_val_get(se_section, "COULOMB%RC_TAPER", &
1370 r_val=qs_control%se_control%taper_cou)
1371 END IF
1372 CALL section_vals_val_get(se_section, "COULOMB%RC_RANGE", &
1373 r_val=qs_control%se_control%range_cou)
1374 ! Exchange
1375 CALL section_vals_val_get(se_section, "EXCHANGE%CUTOFF", &
1376 r_val=qs_control%se_control%cutoff_exc)
1377 qs_control%se_control%taper_exc = qs_control%se_control%cutoff_exc
1378 CALL section_vals_val_get(se_section, "EXCHANGE%RC_TAPER", &
1379 explicit=explicit)
1380 IF (explicit) THEN
1381 CALL section_vals_val_get(se_section, "EXCHANGE%RC_TAPER", &
1382 r_val=qs_control%se_control%taper_exc)
1383 END IF
1384 CALL section_vals_val_get(se_section, "EXCHANGE%RC_RANGE", &
1385 r_val=qs_control%se_control%range_exc)
1386 ! Screening (only if the integral scheme is of dumped type)
1387 IF (qs_control%se_control%integral_screening == do_se_is_kdso_d) THEN
1388 CALL section_vals_val_get(se_section, "SCREENING%RC_TAPER", &
1389 r_val=qs_control%se_control%taper_scr)
1390 CALL section_vals_val_get(se_section, "SCREENING%RC_RANGE", &
1391 r_val=qs_control%se_control%range_scr)
1392 END IF
1393 ! Periodic Type Calculation
1394 CALL section_vals_val_get(se_section, "PERIODIC", &
1395 i_val=qs_control%se_control%periodic_type)
1396 SELECT CASE (qs_control%se_control%periodic_type)
1397 CASE (do_se_lr_none)
1398 qs_control%se_control%do_ewald = .false.
1399 qs_control%se_control%do_ewald_r3 = .false.
1400 qs_control%se_control%do_ewald_gks = .false.
1401 CASE (do_se_lr_ewald)
1402 qs_control%se_control%do_ewald = .true.
1403 qs_control%se_control%do_ewald_r3 = .false.
1404 qs_control%se_control%do_ewald_gks = .false.
1405 CASE (do_se_lr_ewald_gks)
1406 qs_control%se_control%do_ewald = .false.
1407 qs_control%se_control%do_ewald_r3 = .false.
1408 qs_control%se_control%do_ewald_gks = .true.
1409 IF (qs_control%method_id /= do_method_pnnl) THEN
1410 CALL cp_abort(__location__, &
1411 "A periodic semi-empirical calculation was requested with a long-range "// &
1412 "summation on the single integral evaluation. This scheme is supported "// &
1413 "only by the PNNL parameterization.")
1414 END IF
1415 CASE (do_se_lr_ewald_r3)
1416 qs_control%se_control%do_ewald = .true.
1417 qs_control%se_control%do_ewald_r3 = .true.
1418 qs_control%se_control%do_ewald_gks = .false.
1419 IF (qs_control%se_control%integral_screening /= do_se_is_kdso) THEN
1420 CALL cp_abort(__location__, &
1421 "A periodic semi-empirical calculation was requested with a long-range "// &
1422 "summation for the slowly convergent part 1/R^3, which is not congruent "// &
1423 "with the integral screening chosen. The only integral screening supported "// &
1424 "by this periodic type calculation is the standard Klopman-Dewar-Sabelli-Ohno.")
1425 END IF
1426 END SELECT
1427
1428 ! dispersion pair potentials
1429 CALL section_vals_val_get(se_section, "DISPERSION", &
1430 l_val=qs_control%se_control%dispersion)
1431 CALL section_vals_val_get(se_section, "DISPERSION_RADIUS", &
1432 r_val=qs_control%se_control%rcdisp)
1433 CALL section_vals_val_get(se_section, "COORDINATION_CUTOFF", &
1434 r_val=qs_control%se_control%epscn)
1435 CALL section_vals_val_get(se_section, "D3_SCALING", r_vals=scal)
1436 qs_control%se_control%sd3(1) = scal(1)
1437 qs_control%se_control%sd3(2) = scal(2)
1438 qs_control%se_control%sd3(3) = scal(3)
1439 CALL section_vals_val_get(se_section, "DISPERSION_PARAMETER_FILE", &
1440 c_val=qs_control%se_control%dispersion_parameter_file)
1441
1442 ! Stop the execution for non-implemented features
1443 IF (qs_control%se_control%periodic_type == do_se_lr_ewald_r3) THEN
1444 cpabort("EWALD_R3 not implemented yet!")
1445 END IF
1446
1447 IF (qs_control%method_id == do_method_mndo .OR. &
1448 qs_control%method_id == do_method_am1 .OR. &
1449 qs_control%method_id == do_method_mndod .OR. &
1450 qs_control%method_id == do_method_pdg .OR. &
1451 qs_control%method_id == do_method_pm3 .OR. &
1452 qs_control%method_id == do_method_pm6 .OR. &
1453 qs_control%method_id == do_method_pm6fm .OR. &
1454 qs_control%method_id == do_method_pnnl .OR. &
1455 qs_control%method_id == do_method_rm1) THEN
1456 qs_control%se_control%orthogonal_basis = .true.
1457 END IF
1458 END IF
1459
1460 ! DFTB code
1461 IF (qs_control%dftb) THEN
1462 CALL section_vals_val_get(dftb_section, "ORTHOGONAL_BASIS", &
1463 l_val=qs_control%dftb_control%orthogonal_basis)
1464 CALL section_vals_val_get(dftb_section, "SELF_CONSISTENT", &
1465 l_val=qs_control%dftb_control%self_consistent)
1466 CALL section_vals_val_get(dftb_section, "DISPERSION", &
1467 l_val=qs_control%dftb_control%dispersion)
1468 CALL section_vals_val_get(dftb_section, "DIAGONAL_DFTB3", &
1469 l_val=qs_control%dftb_control%dftb3_diagonal)
1470 CALL section_vals_val_get(dftb_section, "HB_SR_GAMMA", &
1471 l_val=qs_control%dftb_control%hb_sr_damp)
1472 CALL section_vals_val_get(dftb_section, "SCC_MIXER", &
1473 explicit=dftb_scc_mixer_explicit)
1474 CALL section_vals_val_get(dftb_section, "SCC_MIXER", &
1475 i_val=qs_control%dftb_control%tblite_scc_mixer)
1476 CALL section_vals_get(dftb_tblite_mixer, explicit=dftb_tblite_mixer_explicit)
1477 CALL read_tblite_mixer_section(dftb_tblite_mixer, &
1478 qs_control%dftb_control%tblite_mixer_iterations, &
1479 qs_control%dftb_control%tblite_mixer_memory, &
1480 qs_control%dftb_control%tblite_mixer_solver, &
1481 qs_control%dftb_control%tblite_mixer_damping, &
1482 qs_control%dftb_control%tblite_mixer_omega0, &
1483 qs_control%dftb_control%tblite_mixer_min_weight, &
1484 qs_control%dftb_control%tblite_mixer_max_weight, &
1485 qs_control%dftb_control%tblite_mixer_weight_factor, &
1486 "DFTB/TBLITE_MIXER")
1487 IF (qs_control%do_ls_scf) THEN
1488 IF (dftb_scc_mixer_explicit .AND. &
1489 qs_control%dftb_control%tblite_scc_mixer /= tblite_scc_mixer_none) THEN
1490 CALL cp_warn(__location__, &
1491 "DFTB/SCC_MIXER is reset to NONE with QS/LS_SCF; LS_SCF optimizes "// &
1492 "the density matrix directly.")
1493 END IF
1494 IF (dftb_tblite_mixer_explicit) THEN
1495 CALL cp_warn(__location__, &
1496 "DFTB/TBLITE_MIXER settings are ignored with QS/LS_SCF; LS_SCF controls "// &
1497 "the density-matrix optimization.")
1498 END IF
1499 qs_control%dftb_control%tblite_scc_mixer = tblite_scc_mixer_none
1500 END IF
1501 IF (qs_control%dftb_control%tblite_mixer_damping <= 0.0_dp) THEN
1502 cpabort("DFTB/TBLITE_MIXER/DAMPING must be positive")
1503 END IF
1504 CALL section_vals_val_get(dftb_section, "EPS_DISP", &
1505 r_val=qs_control%dftb_control%eps_disp)
1506 CALL section_vals_val_get(dftb_section, "DO_EWALD", explicit=explicit)
1507 IF (explicit) THEN
1508 CALL section_vals_val_get(dftb_section, "DO_EWALD", &
1509 l_val=qs_control%dftb_control%do_ewald)
1510 ELSE
1511 qs_control%dftb_control%do_ewald = (qs_control%periodicity /= 0)
1512 END IF
1513 CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_PATH", &
1514 c_val=qs_control%dftb_control%sk_file_path)
1515 CALL section_vals_val_get(dftb_parameter, "PARAM_FILE_NAME", &
1516 c_val=qs_control%dftb_control%sk_file_list)
1517 CALL section_vals_val_get(dftb_parameter, "HB_SR_PARAM", &
1518 r_val=qs_control%dftb_control%hb_sr_para)
1519 CALL section_vals_val_get(dftb_parameter, "SK_FILE", n_rep_val=n_var)
1520 ALLOCATE (qs_control%dftb_control%sk_pair_list(3, n_var))
1521 DO k = 1, n_var
1522 CALL section_vals_val_get(dftb_parameter, "SK_FILE", i_rep_val=k, &
1523 c_vals=clist)
1524 qs_control%dftb_control%sk_pair_list(1:3, k) = clist(1:3)
1525 END DO
1526 ! Dispersion type
1527 CALL section_vals_val_get(dftb_parameter, "DISPERSION_TYPE", &
1528 i_val=qs_control%dftb_control%dispersion_type)
1529 CALL section_vals_val_get(dftb_parameter, "UFF_FORCE_FIELD", &
1530 c_val=qs_control%dftb_control%uff_force_field)
1531 ! D3 Dispersion
1532 CALL section_vals_val_get(dftb_parameter, "DISPERSION_RADIUS", &
1533 r_val=qs_control%dftb_control%rcdisp)
1534 CALL section_vals_val_get(dftb_parameter, "COORDINATION_CUTOFF", &
1535 r_val=qs_control%dftb_control%epscn)
1536 CALL section_vals_val_get(dftb_parameter, "D2_EXP_PRE", &
1537 r_val=qs_control%dftb_control%exp_pre)
1538 CALL section_vals_val_get(dftb_parameter, "D2_SCALING", &
1539 r_val=qs_control%dftb_control%scaling)
1540 CALL section_vals_val_get(dftb_parameter, "D3_SCALING", r_vals=scal)
1541 qs_control%dftb_control%sd3(1) = scal(1)
1542 qs_control%dftb_control%sd3(2) = scal(2)
1543 qs_control%dftb_control%sd3(3) = scal(3)
1544 CALL section_vals_val_get(dftb_parameter, "D3BJ_SCALING", r_vals=scal)
1545 qs_control%dftb_control%sd3bj(1) = scal(1)
1546 qs_control%dftb_control%sd3bj(2) = scal(2)
1547 qs_control%dftb_control%sd3bj(3) = scal(3)
1548 qs_control%dftb_control%sd3bj(4) = scal(4)
1549 CALL section_vals_val_get(dftb_parameter, "DISPERSION_PARAMETER_FILE", &
1550 c_val=qs_control%dftb_control%dispersion_parameter_file)
1551
1552 IF (qs_control%dftb_control%dispersion) CALL cite_reference(zhechkov2005)
1553 IF (qs_control%dftb_control%self_consistent) CALL cite_reference(elstner1998)
1554 IF (qs_control%dftb_control%hb_sr_damp) CALL cite_reference(hu2007)
1555 END IF
1556
1557 ! xTB code
1558 IF (qs_control%xtb) THEN
1559 CALL section_vals_val_get(xtb_section, "GFN_TYPE", i_val=qs_control%xtb_control%gfn_type)
1560 CALL section_vals_val_get(xtb_tblite, "_SECTION_PARAMETERS_", l_val=tblite_section_active)
1561 qs_control%xtb_control%do_tblite = (qs_control%xtb_control%gfn_type == gfn_tblite)
1562 IF (qs_control%xtb_control%do_tblite) THEN
1563 IF (.NOT. tblite_section_active) THEN
1564 cpabort("XTB/GFN_TYPE TBLITE requires an XTB/TBLITE section")
1565 END IF
1566 ! The CP2K-internal GFN1 defaults are still used to initialize shared xTB fields.
1567 qs_control%xtb_control%gfn_type = gfn1xtb
1568 ELSE IF (tblite_section_active) THEN
1569 cpabort("The XTB/TBLITE section requires XTB/GFN_TYPE TBLITE")
1570 END IF
1571 CALL section_vals_val_get(xtb_section, "SCC_MIXER", &
1572 explicit=xtb_scc_mixer_explicit)
1573 CALL section_vals_val_get(xtb_section, "SCC_MIXER", &
1574 i_val=qs_control%xtb_control%tblite_scc_mixer)
1575 CALL section_vals_get(xtb_tblite_mixer, explicit=xtb_tblite_mixer_explicit)
1576 CALL read_tblite_mixer_section(xtb_tblite_mixer, &
1577 qs_control%xtb_control%tblite_mixer_iterations, &
1578 qs_control%xtb_control%tblite_mixer_memory, &
1579 qs_control%xtb_control%tblite_mixer_solver, &
1580 qs_control%xtb_control%tblite_mixer_damping, &
1581 qs_control%xtb_control%tblite_mixer_omega0, &
1582 qs_control%xtb_control%tblite_mixer_min_weight, &
1583 qs_control%xtb_control%tblite_mixer_max_weight, &
1584 qs_control%xtb_control%tblite_mixer_weight_factor, &
1585 "XTB/TBLITE_MIXER")
1586 IF (xtb_tblite_mixer_explicit) THEN
1587 CALL section_vals_val_get(xtb_tblite_mixer, "DAMPING", &
1588 explicit=qs_control%xtb_control%tblite_mixer_damping_explicit)
1589 END IF
1590 IF ((.NOT. qs_control%xtb_control%do_tblite) .AND. &
1591 qs_control%xtb_control%gfn_type == 0) THEN
1592 IF (xtb_scc_mixer_explicit .AND. &
1593 qs_control%xtb_control%tblite_scc_mixer /= tblite_scc_mixer_auto .AND. &
1594 qs_control%xtb_control%tblite_scc_mixer /= tblite_scc_mixer_none) THEN
1595 CALL cp_warn(__location__, &
1596 "XTB/SCC_MIXER is reset to NONE for CP2K-internal GFN0-xTB; "// &
1597 "GFN0-xTB has no SCC variables to mix.")
1598 END IF
1599 IF (xtb_tblite_mixer_explicit) THEN
1600 CALL cp_warn(__location__, &
1601 "XTB/TBLITE_MIXER settings are ignored for CP2K-internal GFN0-xTB; "// &
1602 "GFN0-xTB has no SCC variables to mix.")
1603 END IF
1604 qs_control%xtb_control%tblite_scc_mixer = tblite_scc_mixer_none
1605 END IF
1606 IF (qs_control%do_ls_scf) THEN
1607 IF (xtb_scc_mixer_explicit .AND. &
1608 qs_control%xtb_control%tblite_scc_mixer /= tblite_scc_mixer_none) THEN
1609 CALL cp_warn(__location__, &
1610 "XTB/SCC_MIXER is reset to NONE with QS/LS_SCF; LS_SCF optimizes "// &
1611 "the density matrix directly.")
1612 END IF
1613 IF (xtb_tblite_mixer_explicit) THEN
1614 CALL cp_warn(__location__, &
1615 "XTB/TBLITE_MIXER settings are ignored with QS/LS_SCF; LS_SCF controls "// &
1616 "the density-matrix optimization.")
1617 END IF
1618 qs_control%xtb_control%tblite_scc_mixer = tblite_scc_mixer_none
1619 END IF
1620 IF (qs_control%xtb_control%tblite_mixer_damping <= 0.0_dp) THEN
1621 cpabort("XTB/TBLITE_MIXER/DAMPING must be positive")
1622 END IF
1623 CALL section_vals_val_get(xtb_section, "DO_EWALD", explicit=explicit)
1624 IF (explicit) THEN
1625 CALL section_vals_val_get(xtb_section, "DO_EWALD", &
1626 l_val=qs_control%xtb_control%do_ewald)
1627 ELSE
1628 qs_control%xtb_control%do_ewald = (qs_control%periodicity /= 0)
1629 END IF
1630 ! Spin Polarisation
1631 CALL section_vals_val_get(xtb_section, "SPIN_POLARISATION", &
1632 l_val=qs_control%xtb_control%do_spinpol)
1633 ! vdW
1634 CALL section_vals_val_get(xtb_section, "VDW_POTENTIAL", explicit=explicit)
1635 IF (explicit) THEN
1636 CALL section_vals_val_get(xtb_section, "VDW_POTENTIAL", c_val=cval)
1637 CALL uppercase(cval)
1638 SELECT CASE (cval)
1639 CASE ("NONE")
1640 qs_control%xtb_control%vdw_type = xtb_vdw_type_none
1641 CASE ("DFTD3")
1642 qs_control%xtb_control%vdw_type = xtb_vdw_type_d3
1643 CASE ("DFTD4")
1644 qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1645 CASE DEFAULT
1646 cpabort("vdW type")
1647 END SELECT
1648 ELSE
1649 SELECT CASE (qs_control%xtb_control%gfn_type)
1650 CASE (0)
1651 qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1652 CASE (1)
1653 qs_control%xtb_control%vdw_type = xtb_vdw_type_d3
1654 CASE (2)
1655 qs_control%xtb_control%vdw_type = xtb_vdw_type_d4
1656 cpabort("gfn2-xtb tbd")
1657 CASE DEFAULT
1658 cpabort("GFN type")
1659 END SELECT
1660 END IF
1661 !
1662 CALL section_vals_val_get(xtb_section, "STO_NG", i_val=ngauss)
1663 qs_control%xtb_control%sto_ng = ngauss
1664 CALL section_vals_val_get(xtb_section, "HYDROGEN_STO_NG", i_val=ngauss)
1665 qs_control%xtb_control%h_sto_ng = ngauss
1666 CALL section_vals_val_get(xtb_section, "STO_FLEX", explicit=explicit)
1667 IF (explicit) THEN
1668 CALL section_vals_val_get(xtb_section, "STO_FLEX", &
1669 l_val=qs_control%xtb_control%sto_flex)
1670 ELSE
1671 qs_control%xtb_control%sto_flex = .false.
1672 END IF
1673 CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_PATH", &
1674 c_val=qs_control%xtb_control%parameter_file_path)
1675 CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_NAME", explicit=explicit)
1676 IF (explicit) THEN
1677 CALL section_vals_val_get(xtb_parameter, "PARAM_FILE_NAME", &
1678 c_val=qs_control%xtb_control%parameter_file_name)
1679 ELSE
1680 SELECT CASE (qs_control%xtb_control%gfn_type)
1681 CASE (0)
1682 qs_control%xtb_control%parameter_file_name = "xTB0_parameters"
1683 CASE (1)
1684 qs_control%xtb_control%parameter_file_name = "xTB1_parameters"
1685 CASE (2)
1686 cpabort("gfn2-xtb tbd")
1687 CASE DEFAULT
1688 cpabort("GFN type")
1689 END SELECT
1690 END IF
1691 !
1692 CALL section_vals_val_get(xtb_parameter, "SPINPOL_PARAM_FILE_NAME", &
1693 c_val=qs_control%xtb_control%spinpol_param_file_name)
1694 ! D3 Dispersion
1695 CALL section_vals_val_get(xtb_parameter, "DISPERSION_RADIUS", &
1696 r_val=qs_control%xtb_control%rcdisp)
1697 CALL section_vals_val_get(xtb_parameter, "COORDINATION_CUTOFF", &
1698 r_val=qs_control%xtb_control%epscn)
1699 CALL section_vals_val_get(xtb_parameter, "D3BJ_SCALING", explicit=explicit)
1700 IF (explicit) THEN
1701 CALL section_vals_val_get(xtb_parameter, "D3BJ_SCALING", r_vals=scal)
1702 qs_control%xtb_control%s6 = scal(1)
1703 qs_control%xtb_control%s8 = scal(2)
1704 ELSE
1705 SELECT CASE (qs_control%xtb_control%gfn_type)
1706 CASE (0)
1707 qs_control%xtb_control%s6 = 1.00_dp
1708 qs_control%xtb_control%s8 = 2.85_dp
1709 CASE (1)
1710 qs_control%xtb_control%s6 = 1.00_dp
1711 qs_control%xtb_control%s8 = 2.40_dp
1712 CASE (2)
1713 cpabort("gfn2-xtb tbd")
1714 CASE DEFAULT
1715 cpabort("GFN type")
1716 END SELECT
1717 END IF
1718 CALL section_vals_val_get(xtb_parameter, "D3BJ_PARAM", explicit=explicit)
1719 IF (explicit) THEN
1720 CALL section_vals_val_get(xtb_parameter, "D3BJ_PARAM", r_vals=scal)
1721 qs_control%xtb_control%a1 = scal(1)
1722 qs_control%xtb_control%a2 = scal(2)
1723 ELSE
1724 SELECT CASE (qs_control%xtb_control%gfn_type)
1725 CASE (0)
1726 qs_control%xtb_control%a1 = 0.80_dp
1727 qs_control%xtb_control%a2 = 4.60_dp
1728 CASE (1)
1729 qs_control%xtb_control%a1 = 0.63_dp
1730 qs_control%xtb_control%a2 = 5.00_dp
1731 CASE (2)
1732 cpabort("gfn2-xtb tbd")
1733 CASE DEFAULT
1734 cpabort("GFN type")
1735 END SELECT
1736 END IF
1737 CALL section_vals_val_get(xtb_parameter, "DISPERSION_PARAMETER_FILE", &
1738 c_val=qs_control%xtb_control%dispersion_parameter_file)
1739 ! global parameters
1740 CALL section_vals_val_get(xtb_parameter, "HUCKEL_CONSTANTS", explicit=explicit)
1741 IF (explicit) THEN
1742 CALL section_vals_val_get(xtb_parameter, "HUCKEL_CONSTANTS", r_vals=scal)
1743 qs_control%xtb_control%ks = scal(1)
1744 qs_control%xtb_control%kp = scal(2)
1745 qs_control%xtb_control%kd = scal(3)
1746 qs_control%xtb_control%ksp = scal(4)
1747 qs_control%xtb_control%k2sh = scal(5)
1748 IF (qs_control%xtb_control%gfn_type == 0) THEN
1749 ! enforce ksp for gfn0
1750 qs_control%xtb_control%ksp = 0.5_dp*(scal(1) + scal(2))
1751 END IF
1752 ELSE
1753 SELECT CASE (qs_control%xtb_control%gfn_type)
1754 CASE (0)
1755 qs_control%xtb_control%ks = 2.00_dp
1756 qs_control%xtb_control%kp = 2.4868_dp
1757 qs_control%xtb_control%kd = 2.27_dp
1758 qs_control%xtb_control%ksp = 2.2434_dp
1759 qs_control%xtb_control%k2sh = 1.1241_dp
1760 CASE (1)
1761 qs_control%xtb_control%ks = 1.85_dp
1762 qs_control%xtb_control%kp = 2.25_dp
1763 qs_control%xtb_control%kd = 2.00_dp
1764 qs_control%xtb_control%ksp = 2.08_dp
1765 qs_control%xtb_control%k2sh = 2.85_dp
1766 CASE (2)
1767 cpabort("gfn2-xtb tbd")
1768 CASE DEFAULT
1769 cpabort("GFN type")
1770 END SELECT
1771 END IF
1772 CALL section_vals_val_get(xtb_parameter, "COULOMB_CONSTANTS", explicit=explicit)
1773 IF (explicit) THEN
1774 CALL section_vals_val_get(xtb_parameter, "COULOMB_CONSTANTS", r_vals=scal)
1775 qs_control%xtb_control%kg = scal(1)
1776 qs_control%xtb_control%kf = scal(2)
1777 ELSE
1778 SELECT CASE (qs_control%xtb_control%gfn_type)
1779 CASE (0)
1780 qs_control%xtb_control%kg = 2.00_dp
1781 qs_control%xtb_control%kf = 1.50_dp
1782 CASE (1)
1783 qs_control%xtb_control%kg = 2.00_dp
1784 qs_control%xtb_control%kf = 1.50_dp
1785 CASE (2)
1786 cpabort("gfn2-xtb tbd")
1787 CASE DEFAULT
1788 cpabort("GFN type")
1789 END SELECT
1790 END IF
1791 CALL section_vals_val_get(xtb_parameter, "CN_CONSTANTS", r_vals=scal)
1792 qs_control%xtb_control%kcns = scal(1)
1793 qs_control%xtb_control%kcnp = scal(2)
1794 qs_control%xtb_control%kcnd = scal(3)
1795 !
1796 CALL section_vals_val_get(xtb_parameter, "EN_CONSTANTS", explicit=explicit)
1797 IF (explicit) THEN
1798 CALL section_vals_val_get(xtb_parameter, "EN_CONSTANTS", r_vals=scal)
1799 SELECT CASE (qs_control%xtb_control%gfn_type)
1800 CASE (0)
1801 qs_control%xtb_control%ksen = scal(1)
1802 qs_control%xtb_control%kpen = scal(2)
1803 qs_control%xtb_control%kden = scal(3)
1804 CASE (1)
1805 qs_control%xtb_control%ken = scal(1)
1806 CASE (2)
1807 cpabort("gfn2-xtb tbd")
1808 CASE DEFAULT
1809 cpabort("GFN type")
1810 END SELECT
1811 ELSE
1812 SELECT CASE (qs_control%xtb_control%gfn_type)
1813 CASE (0)
1814 qs_control%xtb_control%ksen = 0.006_dp
1815 qs_control%xtb_control%kpen = -0.001_dp
1816 qs_control%xtb_control%kden = -0.002_dp
1817 CASE (1)
1818 qs_control%xtb_control%ken = -0.007_dp
1819 CASE (2)
1820 cpabort("gfn2-xtb tbd")
1821 CASE DEFAULT
1822 cpabort("GFN type")
1823 END SELECT
1824 END IF
1825 ! ben
1826 CALL section_vals_val_get(xtb_parameter, "BEN_CONSTANT", r_vals=scal)
1827 qs_control%xtb_control%ben = scal(1)
1828 ! enscale (hidden parameter in repulsion
1829 CALL section_vals_val_get(xtb_parameter, "ENSCALE", explicit=explicit)
1830 IF (explicit) THEN
1831 CALL section_vals_val_get(xtb_parameter, "ENSCALE", &
1832 r_val=qs_control%xtb_control%enscale)
1833 ELSE
1834 SELECT CASE (qs_control%xtb_control%gfn_type)
1835 CASE (0)
1836 qs_control%xtb_control%enscale = -0.09_dp
1837 CASE (1)
1838 qs_control%xtb_control%enscale = 0._dp
1839 CASE (2)
1840 cpabort("gfn2-xtb tbd")
1841 CASE DEFAULT
1842 cpabort("GFN type")
1843 END SELECT
1844 END IF
1845 ! XB
1846 CALL section_vals_val_get(xtb_section, "USE_HALOGEN_CORRECTION", &
1847 l_val=qs_control%xtb_control%xb_interaction)
1848 CALL section_vals_val_get(xtb_parameter, "HALOGEN_BINDING", r_vals=scal)
1849 qs_control%xtb_control%kxr = scal(1)
1850 qs_control%xtb_control%kx2 = scal(2)
1851 ! NONBONDED interactions
1852 CALL section_vals_val_get(xtb_section, "DO_NONBONDED", &
1853 l_val=qs_control%xtb_control%do_nonbonded)
1854 CALL section_vals_get(nonbonded_section, explicit=explicit)
1855 IF (explicit .AND. qs_control%xtb_control%do_nonbonded) THEN
1856 CALL section_vals_get(genpot_section, explicit=explicit, n_repetition=ngp)
1857 IF (explicit) THEN
1858 CALL pair_potential_reallocate(qs_control%xtb_control%nonbonded, 1, ngp, gp=.true.)
1859 CALL read_gp_section(qs_control%xtb_control%nonbonded, genpot_section, 0)
1860 END IF
1861 END IF !nonbonded
1862 CALL section_vals_val_get(xtb_section, "EPS_PAIRPOTENTIAL", &
1863 r_val=qs_control%xtb_control%eps_pair)
1864 ! SR Coulomb
1865 CALL section_vals_val_get(xtb_parameter, "COULOMB_SR_CUT", r_vals=scal)
1866 qs_control%xtb_control%coulomb_sr_cut = scal(1)
1867 CALL section_vals_val_get(xtb_parameter, "COULOMB_SR_EPS", r_vals=scal)
1868 qs_control%xtb_control%coulomb_sr_eps = scal(1)
1869 ! XB_radius
1870 CALL section_vals_val_get(xtb_parameter, "XB_RADIUS", r_val=qs_control%xtb_control%xb_radius)
1871 ! Kab
1872 CALL section_vals_val_get(xtb_parameter, "KAB_PARAM", n_rep_val=n_rep)
1873 ! Coulomb
1874 SELECT CASE (qs_control%xtb_control%gfn_type)
1875 CASE (0)
1876 qs_control%xtb_control%coulomb_interaction = .false.
1877 qs_control%xtb_control%coulomb_lr = .false.
1878 qs_control%xtb_control%tb3_interaction = .false.
1879 qs_control%xtb_control%check_atomic_charges = .false.
1880 CALL section_vals_val_get(xtb_section, "VARIATIONAL_DIPOLE", &
1881 l_val=qs_control%xtb_control%var_dipole)
1882 CASE (1)
1883 ! For debugging purposes
1884 CALL section_vals_val_get(xtb_section, "COULOMB_INTERACTION", &
1885 l_val=qs_control%xtb_control%coulomb_interaction)
1886 CALL section_vals_val_get(xtb_section, "COULOMB_LR", &
1887 l_val=qs_control%xtb_control%coulomb_lr)
1888 CALL section_vals_val_get(xtb_section, "TB3_INTERACTION", &
1889 l_val=qs_control%xtb_control%tb3_interaction)
1890 ! Check for bad atomic charges
1891 CALL section_vals_val_get(xtb_section, "CHECK_ATOMIC_CHARGES", &
1892 l_val=qs_control%xtb_control%check_atomic_charges)
1893 qs_control%xtb_control%var_dipole = .false.
1894 CASE (2)
1895 cpabort("gfn2-xtb tbd")
1896 CASE DEFAULT
1897 cpabort("GFN type")
1898 END SELECT
1899 qs_control%xtb_control%kab_nval = n_rep
1900 IF (n_rep > 0) THEN
1901 ALLOCATE (qs_control%xtb_control%kab_param(3, n_rep))
1902 ALLOCATE (qs_control%xtb_control%kab_types(2, n_rep))
1903 ALLOCATE (qs_control%xtb_control%kab_vals(n_rep))
1904 DO j = 1, n_rep
1905 CALL section_vals_val_get(xtb_parameter, "KAB_PARAM", i_rep_val=j, c_vals=clist)
1906 qs_control%xtb_control%kab_param(1, j) = clist(1)
1907 CALL get_ptable_info(clist(1) (1:2), &
1908 ielement=qs_control%xtb_control%kab_types(1, j))
1909 qs_control%xtb_control%kab_param(2, j) = clist(2)
1910 CALL get_ptable_info(clist(2) (1:2), &
1911 ielement=qs_control%xtb_control%kab_types(2, j))
1912 qs_control%xtb_control%kab_param(3, j) = clist(3)
1913 READ (clist(3), '(F10.0)') qs_control%xtb_control%kab_vals(j)
1914 END DO
1915 END IF
1916
1917 ! Spin Polarisation
1918 CALL section_vals_val_get(xtb_parameter, "SPIN_POL_PARAM", n_rep_val=n_rep)
1919 IF (n_rep > 0) THEN
1920 ALLOCATE (qs_control%xtb_control%spinpol_type(n_rep))
1921 ALLOCATE (qs_control%xtb_control%spinpol_vals(6, n_rep))
1922 DO j = 1, n_rep
1923 CALL section_vals_val_get(xtb_parameter, "SPIN_POL_PARAM", i_rep_val=j, c_vals=clist)
1924 READ (clist(1), '(A)') cval
1925 element_symbol = adjustl(trim(cval))
1926 CALL get_ptable_info(element_symbol, znum)
1927 qs_control%xtb_control%spinpol_type(j) = znum
1928 READ (clist(2), '(F20.8)') qs_control%xtb_control%spinpol_vals(1, j)
1929 READ (clist(3), '(F20.8)') qs_control%xtb_control%spinpol_vals(2, j)
1930 READ (clist(4), '(F20.8)') qs_control%xtb_control%spinpol_vals(3, j)
1931 READ (clist(5), '(F20.8)') qs_control%xtb_control%spinpol_vals(4, j)
1932 READ (clist(6), '(F20.8)') qs_control%xtb_control%spinpol_vals(5, j)
1933 READ (clist(7), '(F20.8)') qs_control%xtb_control%spinpol_vals(6, j)
1934 END DO
1935 END IF
1936
1937 IF (qs_control%xtb_control%gfn_type == 0) THEN
1938 CALL section_vals_val_get(xtb_parameter, "SRB_PARAMETER", r_vals=scal)
1939 qs_control%xtb_control%ksrb = scal(1)
1940 qs_control%xtb_control%esrb = scal(2)
1941 qs_control%xtb_control%gscal = scal(3)
1942 qs_control%xtb_control%c1srb = scal(4)
1943 qs_control%xtb_control%c2srb = scal(5)
1944 qs_control%xtb_control%shift = scal(6)
1945 END IF
1946
1947 CALL section_vals_val_get(xtb_section, "EN_SHIFT_TYPE", c_val=cval)
1948 CALL uppercase(cval)
1949 SELECT CASE (trim(cval))
1950 CASE ("SELECT")
1951 qs_control%xtb_control%enshift_type = 0
1952 CASE ("MOLECULE")
1953 qs_control%xtb_control%enshift_type = 1
1954 CASE ("CRYSTAL")
1955 qs_control%xtb_control%enshift_type = 2
1956 CASE DEFAULT
1957 cpabort("Unknown value for EN_SHIFT_TYPE")
1958 END SELECT
1959
1960 ! EEQ solver params
1961 CALL read_eeq_param(eeq_section, qs_control%xtb_control%eeq_sparam)
1962 END IF
1963
1964 ! Optimize LRI basis set
1965 CALL section_vals_get(lri_optbas_section, explicit=qs_control%lri_optbas)
1966
1967 ! Use tblite if selected through XTB/GFN_TYPE TBLITE.
1968 IF (qs_control%xtb_control%do_tblite) THEN
1969 CALL section_vals_val_get(xtb_tblite, "METHOD", &
1970 i_val=qs_control%xtb_control%tblite_method)
1971 CALL section_vals_val_get(xtb_tblite, "PARAM", &
1972 c_val=qs_control%xtb_control%tblite_param_file)
1973 CALL section_vals_val_get(xtb_tblite, "ACCURACY", &
1974 r_val=qs_control%xtb_control%tblite_accuracy)
1975 IF (qs_control%xtb_control%tblite_accuracy <= 0.0_dp) THEN
1976 cpabort("XTB/TBLITE/ACCURACY must be positive")
1977 END IF
1978 IF (qs_control%xtb_control%tblite_mixer_damping <= 0.0_dp) THEN
1979 cpabort("XTB/TBLITE_MIXER/DAMPING must be positive")
1980 END IF
1981 CALL section_vals_val_get(xtb_tblite, "REFERENCE_CLI", l_val=tblite_reference_cli)
1982 CALL section_vals_get(xtb_tblite_ref_cli, explicit=tblite_reference_cli_section)
1983 IF (tblite_reference_cli .AND. (.NOT. tblite_reference_cli_section)) THEN
1984 cpabort("XTB/TBLITE/REFERENCE_CLI keyword requires an XTB/TBLITE/REFERENCE_CLI section")
1985 END IF
1986 IF (tblite_reference_cli .OR. tblite_reference_cli_section) THEN
1987 CALL read_xtb_reference_cli_section(xtb_tblite_ref_cli, qs_control%xtb_control%reference_cli, cell)
1988 qs_control%xtb_control%reference_cli%enabled = .true.
1989 END IF
1990 CALL cite_reference(katbashev2025)
1991 ! tblite handles periodic long-range terms internally from the CP2K cell periodicity.
1992 ! Keep xtb_control%do_ewald as read above from XTB/DO_EWALD or SUBSYS/CELL/PERIODIC,
1993 ! matching the DFTB and CP2K-internal xTB setup.
1994 END IF
1995
1996 CALL timestop(handle)
1997 END SUBROUTINE read_qs_section
1998
1999! **************************************************************************************************
2000!> \brief Read a TBLITE_MIXER section.
2001!> \param mixer_section input section
2002!> \param iterations tblite SCC iteration limit
2003!> \param memory Broyden history length
2004!> \param solver native tblite electronic solver id
2005!> \param damping mixer damping parameter
2006!> \param omega0 Broyden regularization weight
2007!> \param min_weight minimum dynamic Broyden weight
2008!> \param max_weight maximum dynamic Broyden weight
2009!> \param weight_factor residual-to-weight scaling factor
2010!> \param section_name diagnostic section name
2011! **************************************************************************************************
2012 SUBROUTINE read_tblite_mixer_section(mixer_section, iterations, memory, solver, damping, omega0, min_weight, &
2013 max_weight, weight_factor, section_name)
2014 TYPE(section_vals_type), POINTER :: mixer_section
2015 INTEGER, INTENT(INOUT) :: iterations, memory, solver
2016 REAL(kind=dp), INTENT(INOUT) :: damping, omega0, min_weight, max_weight, &
2017 weight_factor
2018 CHARACTER(LEN=*), INTENT(IN) :: section_name
2019
2020 LOGICAL :: explicit, memory_explicit
2021
2022 CALL section_vals_get(mixer_section, explicit=explicit)
2023 IF (.NOT. explicit) RETURN
2024
2025 CALL section_vals_val_get(mixer_section, "ITERATIONS", i_val=iterations)
2026 CALL section_vals_val_get(mixer_section, "MEMORY", explicit=memory_explicit)
2027 IF (memory_explicit) CALL section_vals_val_get(mixer_section, "MEMORY", i_val=memory)
2028 IF (.NOT. memory_explicit .OR. memory == tblite_mixer_memory_inherit) THEN
2029 memory = iterations
2030 END IF
2031 CALL section_vals_val_get(mixer_section, "SOLVER", i_val=solver)
2032 CALL section_vals_val_get(mixer_section, "DAMPING", r_val=damping)
2033 CALL section_vals_val_get(mixer_section, "OMEGA0", r_val=omega0)
2034 CALL section_vals_val_get(mixer_section, "MIN_WEIGHT", r_val=min_weight)
2035 CALL section_vals_val_get(mixer_section, "MAX_WEIGHT", r_val=max_weight)
2036 CALL section_vals_val_get(mixer_section, "WEIGHT_FACTOR", r_val=weight_factor)
2037
2038 IF (iterations < 1) cpabort(trim(section_name)//"/ITERATIONS must be positive")
2039 IF (memory < 1) cpabort(trim(section_name)//"/MEMORY must be positive")
2040 SELECT CASE (solver)
2041 CASE (tblite_solver_gvd, tblite_solver_gvr)
2042 CASE DEFAULT
2043 cpabort(trim(section_name)//"/SOLVER must be GVD or GVR")
2044 END SELECT
2045 IF (damping <= 0.0_dp) cpabort(trim(section_name)//"/DAMPING must be positive")
2046 IF (omega0 <= 0.0_dp) cpabort(trim(section_name)//"/OMEGA0 must be positive")
2047 IF (min_weight <= 0.0_dp) cpabort(trim(section_name)//"/MIN_WEIGHT must be positive")
2048 IF (max_weight <= 0.0_dp) cpabort(trim(section_name)//"/MAX_WEIGHT must be positive")
2049 IF (max_weight < min_weight) THEN
2050 cpabort(trim(section_name)//"/MAX_WEIGHT must not be smaller than MIN_WEIGHT")
2051 END IF
2052 IF (weight_factor <= 0.0_dp) cpabort(trim(section_name)//"/WEIGHT_FACTOR must be positive")
2053
2054 END SUBROUTINE read_tblite_mixer_section
2055
2056! **************************************************************************************************
2057!> \brief Read native tblite CLI reference options.
2058!> \param ref_cli_section input section
2059!> \param ref_cli reference CLI control data
2060!> \param cell optional cell used to transform Cartesian input vectors
2061! **************************************************************************************************
2062 SUBROUTINE read_xtb_reference_cli_section(ref_cli_section, ref_cli, cell)
2063 TYPE(section_vals_type), POINTER :: ref_cli_section
2064 TYPE(xtb_reference_cli_type), INTENT(INOUT) :: ref_cli
2065 TYPE(cell_type), OPTIONAL, POINTER :: cell
2066
2067 REAL(kind=dp), DIMENSION(:), POINTER :: efield
2068 TYPE(section_vals_type), POINTER :: fit_section, guess_section, &
2069 param_section, solvation_section, &
2070 tagdiff_section
2071
2072 CALL section_vals_val_get(ref_cli_section, "_SECTION_PARAMETERS_", l_val=ref_cli%enabled)
2073 CALL section_vals_val_get(ref_cli_section, "PROGRAM_NAME", c_val=ref_cli%program_name)
2074 CALL section_vals_val_get(ref_cli_section, "GUESS", i_val=ref_cli%guess)
2075 CALL section_vals_val_get(ref_cli_section, "WORK_DIRECTORY", c_val=ref_cli%work_directory)
2076 CALL section_vals_val_get(ref_cli_section, "PREFIX", c_val=ref_cli%prefix)
2077 CALL section_vals_val_get(ref_cli_section, "INPUT_FORMAT", c_val=ref_cli%input_format)
2078 CALL section_vals_val_get(ref_cli_section, "RESTART", c_val=ref_cli%restart_file)
2079 CALL section_vals_val_get(ref_cli_section, "GRAD", c_val=ref_cli%grad_file)
2080 CALL section_vals_val_get(ref_cli_section, "JSON", c_val=ref_cli%json_file)
2081 CALL section_vals_val_get(ref_cli_section, "POST_PROCESSING", c_val=ref_cli%post_processing)
2082 CALL section_vals_val_get(ref_cli_section, "POST_PROCESSING_OUTPUT", &
2083 c_val=ref_cli%post_processing_output_file)
2084 CALL section_vals_val_get(ref_cli_section, "EFIELD", explicit=ref_cli%efield_active)
2085 IF (ref_cli%efield_active) THEN
2086 NULLIFY (efield)
2087 CALL section_vals_val_get(ref_cli_section, "EFIELD", r_vals=efield)
2088 ref_cli%efield = efield(1:3)
2089 IF (PRESENT(cell)) THEN
2090 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, ref_cli%efield)
2091 END IF
2092 END IF
2093 solvation_section => section_vals_get_subs_vals(ref_cli_section, "IMPLICIT_SOLVATION")
2094 CALL section_vals_get(solvation_section, explicit=ref_cli%solvation_active)
2095 IF (ref_cli%solvation_active) THEN
2096 CALL section_vals_val_get(solvation_section, "MODEL", i_val=ref_cli%solvation_model)
2097 CALL section_vals_val_get(solvation_section, "SOLVENT", c_val=ref_cli%solvation_solvent)
2098 CALL section_vals_val_get(solvation_section, "BORN_KERNEL", i_val=ref_cli%solvation_born_kernel)
2099 CALL section_vals_val_get(solvation_section, "SOLUTION_STATE", i_val=ref_cli%solvation_state)
2100 IF (len_trim(ref_cli%solvation_solvent) == 0) THEN
2101 cpabort("REFERENCE_CLI implicit solvation needs SOLVENT")
2102 END IF
2103 IF (ref_cli%solvation_model == tblite_cli_solvation_cpcm .AND. &
2104 ref_cli%solvation_born_kernel /= tblite_cli_born_kernel_auto) THEN
2105 cpabort("BORN_KERNEL is invalid with MODEL CPCM")
2106 END IF
2107 IF (ref_cli%solvation_state /= tblite_cli_solution_state_gsolv) THEN
2108 SELECT CASE (ref_cli%solvation_model)
2109 CASE (tblite_cli_solvation_alpb, tblite_cli_solvation_gbsa)
2110 ! Native tblite supports solution-state shifts for parametrized named-solvent ALPB/GBSA.
2111 CASE (tblite_cli_solvation_gbe, tblite_cli_solvation_gb, tblite_cli_solvation_cpcm)
2112 cpabort("SOLUTION_STATE is valid only for ALPB/GBSA")
2113 END SELECT
2114 END IF
2115 END IF
2116 CALL section_vals_val_get(ref_cli_section, "ELECTRONIC_TEMPERATURE_GUESS", &
2117 r_val=ref_cli%electronic_temperature_guess)
2118 IF (ref_cli%electronic_temperature_guess < 0.0_dp) THEN
2119 cpabort("XTB/TBLITE/REFERENCE_CLI/ELECTRONIC_TEMPERATURE_GUESS must not be negative")
2120 END IF
2121 IF (ref_cli%electronic_temperature_guess > 0.0_dp .AND. ref_cli%guess /= tblite_guess_ceh) THEN
2122 cpabort("XTB/TBLITE/REFERENCE_CLI/ELECTRONIC_TEMPERATURE_GUESS requires GUESS CEH")
2123 END IF
2124 guess_section => section_vals_get_subs_vals(ref_cli_section, "GUESS_CLI")
2125 CALL section_vals_get(guess_section, explicit=ref_cli%guess_cli%enabled)
2126 IF (ref_cli%guess_cli%enabled) THEN
2127 CALL section_vals_val_get(guess_section, "METHOD", i_val=ref_cli%guess_cli%method)
2128 CALL section_vals_val_get(guess_section, "ELECTRONIC_TEMPERATURE_GUESS", &
2129 r_val=ref_cli%guess_cli%electronic_temperature_guess)
2130 IF (ref_cli%guess_cli%electronic_temperature_guess < 0.0_dp) THEN
2131 cpabort("REFERENCE_CLI/GUESS_CLI/ELECTRONIC_TEMPERATURE_GUESS must not be negative")
2132 END IF
2133 CALL section_vals_val_get(guess_section, "SOLVER", i_val=ref_cli%guess_cli%solver)
2134 CALL section_vals_val_get(guess_section, "EFIELD", explicit=ref_cli%guess_cli%efield_active)
2135 IF (ref_cli%guess_cli%efield_active) THEN
2136 NULLIFY (efield)
2137 CALL section_vals_val_get(guess_section, "EFIELD", r_vals=efield)
2138 ref_cli%guess_cli%efield = efield(1:3)
2139 IF (PRESENT(cell)) THEN
2140 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, ref_cli%guess_cli%efield)
2141 END IF
2142 END IF
2143 CALL section_vals_val_get(guess_section, "GRAD", l_val=ref_cli%guess_cli%grad)
2144 CALL section_vals_val_get(guess_section, "JSON", c_val=ref_cli%guess_cli%json_file)
2145 CALL section_vals_val_get(guess_section, "INPUT_FORMAT", c_val=ref_cli%guess_cli%input_format)
2146 CALL section_vals_val_get(guess_section, "INPUT_FILE", c_val=ref_cli%guess_cli%input_file)
2147 END IF
2148 param_section => section_vals_get_subs_vals(ref_cli_section, "PARAM_CLI")
2149 CALL section_vals_get(param_section, explicit=ref_cli%param_cli%enabled)
2150 IF (ref_cli%param_cli%enabled) THEN
2151 CALL section_vals_val_get(param_section, "METHOD", explicit=ref_cli%param_cli%method_explicit, &
2152 i_val=ref_cli%param_cli%method)
2153 CALL section_vals_val_get(param_section, "OUTPUT", c_val=ref_cli%param_cli%output_file)
2154 CALL section_vals_val_get(param_section, "INPUT_FILE", c_val=ref_cli%param_cli%input_file)
2155 END IF
2156 fit_section => section_vals_get_subs_vals(ref_cli_section, "FIT_CLI")
2157 CALL section_vals_get(fit_section, explicit=ref_cli%fit_cli%enabled)
2158 IF (ref_cli%fit_cli%enabled) THEN
2159 CALL section_vals_val_get(fit_section, "PARAM_FILE", c_val=ref_cli%fit_cli%param_file)
2160 CALL section_vals_val_get(fit_section, "INPUT_FILE", c_val=ref_cli%fit_cli%input_file)
2161 CALL section_vals_val_get(fit_section, "DRY_RUN", l_val=ref_cli%fit_cli%dry_run)
2162 CALL section_vals_val_get(fit_section, "COPY", c_val=ref_cli%fit_cli%copy_file)
2163 IF (len_trim(ref_cli%fit_cli%param_file) == 0) THEN
2164 cpabort("XTB/TBLITE/REFERENCE_CLI/FIT_CLI needs PARAM_FILE")
2165 END IF
2166 IF (len_trim(ref_cli%fit_cli%input_file) == 0) THEN
2167 cpabort("XTB/TBLITE/REFERENCE_CLI/FIT_CLI needs INPUT_FILE")
2168 END IF
2169 END IF
2170 tagdiff_section => section_vals_get_subs_vals(ref_cli_section, "TAGDIFF_CLI")
2171 CALL section_vals_get(tagdiff_section, explicit=ref_cli%tagdiff_cli%enabled)
2172 IF (ref_cli%tagdiff_cli%enabled) THEN
2173 CALL section_vals_val_get(tagdiff_section, "ACTUAL", c_val=ref_cli%tagdiff_cli%actual_file)
2174 CALL section_vals_val_get(tagdiff_section, "REFERENCE", c_val=ref_cli%tagdiff_cli%reference_file)
2175 CALL section_vals_val_get(tagdiff_section, "FIT", l_val=ref_cli%tagdiff_cli%fit)
2176 IF (len_trim(ref_cli%tagdiff_cli%actual_file) == 0) THEN
2177 cpabort("XTB/TBLITE/REFERENCE_CLI/TAGDIFF_CLI needs ACTUAL")
2178 END IF
2179 IF (len_trim(ref_cli%tagdiff_cli%reference_file) == 0) THEN
2180 cpabort("XTB/TBLITE/REFERENCE_CLI/TAGDIFF_CLI needs REFERENCE")
2181 END IF
2182 END IF
2183 CALL section_vals_val_get(ref_cli_section, "KEEP_FILES", l_val=ref_cli%keep_files)
2184 CALL section_vals_val_get(ref_cli_section, "ERROR_LIMIT", r_val=ref_cli%error_limit)
2185 CALL section_vals_val_get(ref_cli_section, "STOP_ON_ERROR", l_val=ref_cli%stop_on_error)
2186 CALL section_vals_val_get(ref_cli_section, "CHECK_ENERGY", l_val=ref_cli%check_energy)
2187 CALL section_vals_val_get(ref_cli_section, "CHECK_FORCES", l_val=ref_cli%check_forces)
2188 CALL section_vals_val_get(ref_cli_section, "CHECK_VIRIAL", l_val=ref_cli%check_virial)
2189
2190 END SUBROUTINE read_xtb_reference_cli_section
2191
2192! **************************************************************************************************
2193!> \brief Read TDDFPT-related input parameters.
2194!> \param t_control TDDFPT control parameters
2195!> \param t_section TDDFPT input section
2196!> \param qs_control Quickstep control parameters
2197! **************************************************************************************************
2198 SUBROUTINE read_tddfpt2_control(t_control, t_section, qs_control)
2199 TYPE(tddfpt2_control_type), POINTER :: t_control
2200 TYPE(section_vals_type), POINTER :: t_section
2201 TYPE(qs_control_type), POINTER :: qs_control
2202
2203 CHARACTER(LEN=*), PARAMETER :: routinen = 'read_tddfpt2_control'
2204
2205 CHARACTER(LEN=default_string_length), &
2206 DIMENSION(:), POINTER :: tmpstringlist
2207 INTEGER :: handle, irep, isize, nrep
2208 INTEGER, ALLOCATABLE, DIMENSION(:) :: inds
2209 LOGICAL :: do_ewald, do_exchange, expl, explicit, &
2210 multigrid_set
2211 REAL(kind=dp) :: filter, fval, hfx
2212 TYPE(section_vals_type), POINTER :: dipole_section, mgrid_section, &
2213 soc_section, stda_section, xc_func, &
2214 xc_section
2215
2216 CALL timeset(routinen, handle)
2217
2218 CALL section_vals_val_get(t_section, "_SECTION_PARAMETERS_", l_val=t_control%enabled)
2219
2220 CALL section_vals_val_get(t_section, "NSTATES", i_val=t_control%nstates)
2221 CALL section_vals_val_get(t_section, "MAX_ITER", i_val=t_control%niters)
2222 CALL section_vals_val_get(t_section, "MAX_KV", i_val=t_control%nkvs)
2223 CALL section_vals_val_get(t_section, "NLUMO", i_val=t_control%nlumo)
2224 CALL section_vals_val_get(t_section, "NPROC_STATE", i_val=t_control%nprocs)
2225 CALL section_vals_val_get(t_section, "KERNEL", i_val=t_control%kernel)
2226 CALL section_vals_val_get(t_section, "SPINFLIP", i_val=t_control%spinflip)
2227 CALL section_vals_val_get(t_section, "OE_CORR", i_val=t_control%oe_corr)
2228 CALL section_vals_val_get(t_section, "EV_SHIFT", r_val=t_control%ev_shift)
2229 CALL section_vals_val_get(t_section, "EOS_SHIFT", r_val=t_control%eos_shift)
2230
2231 CALL section_vals_val_get(t_section, "CONVERGENCE", r_val=t_control%conv)
2232 CALL section_vals_val_get(t_section, "MIN_AMPLITUDE", r_val=t_control%min_excitation_amplitude)
2233 CALL section_vals_val_get(t_section, "ORTHOGONAL_EPS", r_val=t_control%orthogonal_eps)
2234
2235 CALL section_vals_val_get(t_section, "RESTART", l_val=t_control%is_restart)
2236 CALL section_vals_val_get(t_section, "RKS_TRIPLETS", l_val=t_control%rks_triplets)
2237 CALL section_vals_val_get(t_section, "DO_LRIGPW", l_val=t_control%do_lrigpw)
2238 CALL section_vals_val_get(t_section, "DO_SMEARING", l_val=t_control%do_smearing)
2239 CALL section_vals_val_get(t_section, "DO_BSE", l_val=t_control%do_bse)
2240 CALL section_vals_val_get(t_section, "DO_BSE_W_ONLY", l_val=t_control%do_bse_w_only)
2241 CALL section_vals_val_get(t_section, "DO_BSE_GW_ONLY", l_val=t_control%do_bse_gw_only)
2242 CALL section_vals_val_get(t_section, "ADMM_KERNEL_CORRECTION_SYMMETRIC", l_val=t_control%admm_symm)
2243 CALL section_vals_val_get(t_section, "ADMM_KERNEL_XC_CORRECTION", l_val=t_control%admm_xc_correction)
2244 CALL section_vals_val_get(t_section, "EXCITON_DESCRIPTORS", l_val=t_control%do_exciton_descriptors)
2245 CALL section_vals_val_get(t_section, "DIRECTIONAL_EXCITON_DESCRIPTORS", l_val=t_control%do_directional_exciton_descriptors)
2246 CALL section_vals_val_get(t_section, "DIRECTIONAL_EXCITON_CROSSCORRELATION", &
2247 l_val=t_control%do_directional_exciton_crosscorrelation, explicit=explicit)
2248 IF (explicit .AND. t_control%do_directional_exciton_crosscorrelation .AND. &
2249 .NOT. t_control%do_directional_exciton_descriptors) THEN
2250 CALL cp_warn(__location__, &
2251 "DIRECTIONAL_EXCITON_CROSSCORRELATION has no effect without DIRECTIONAL_EXCITON_DESCRIPTORS.")
2252 END IF
2253
2254 ! read automatically generated auxiliary basis for LRI
2255 CALL section_vals_val_get(t_section, "AUTO_BASIS", n_rep_val=nrep)
2256 DO irep = 1, nrep
2257 CALL section_vals_val_get(t_section, "AUTO_BASIS", i_rep_val=irep, c_vals=tmpstringlist)
2258 IF (SIZE(tmpstringlist) == 2) THEN
2259 CALL uppercase(tmpstringlist(2))
2260 SELECT CASE (tmpstringlist(2))
2261 CASE ("X")
2262 SELECT CASE (tmpstringlist(1))
2263 CASE ("X")
2264 ! Do nothing
2265 CASE DEFAULT
2266 CALL cp_abort(__location__, &
2267 "AUTO_BASIS: the size <X> is invalid for the "// &
2268 "type <"//trim(adjustl(tmpstringlist(1)))//">; "// &
2269 "use one of SMALL, MEDIUM, LARGE, HUGE for "// &
2270 "the size. The syntax AUTO_BASIS X X is a "// &
2271 "reserved case for using NO automatically "// &
2272 "generated basis sets.")
2273 END SELECT
2274 CASE ("SMALL")
2275 isize = 0
2276 CASE ("MEDIUM")
2277 isize = 1
2278 CASE ("LARGE")
2279 isize = 2
2280 CASE ("HUGE")
2281 isize = 3
2282 CASE DEFAULT
2283 cpabort("Unknown basis size in AUTO_BASIS keyword:"//trim(tmpstringlist(1)))
2284 END SELECT
2285 !
2286 SELECT CASE (tmpstringlist(1))
2287 CASE ("X")
2288 CASE ("P_LRI_AUX")
2289 t_control%auto_basis_p_lri_aux = isize
2290 CASE DEFAULT
2291 cpabort("Unknown basis type in AUTO_BASIS keyword:"//trim(tmpstringlist(1)))
2292 END SELECT
2293 ELSE
2294 CALL cp_abort(__location__, &
2295 "AUTO_BASIS keyword in &PROPERTIES &TDDFT section has a wrong number of arguments.")
2296 END IF
2297 END DO
2298
2299 IF (t_control%conv < 0) THEN
2300 t_control%conv = abs(t_control%conv)
2301 END IF
2302
2303 ! DIPOLE_MOMENTS subsection
2304 dipole_section => section_vals_get_subs_vals(t_section, "DIPOLE_MOMENTS")
2305 CALL section_vals_val_get(dipole_section, "DIPOLE_FORM", explicit=explicit)
2306 IF (explicit) THEN
2307 CALL section_vals_val_get(dipole_section, "DIPOLE_FORM", i_val=t_control%dipole_form)
2308 ELSE
2309 t_control%dipole_form = 0
2310 END IF
2311 CALL section_vals_val_get(dipole_section, "REFERENCE", i_val=t_control%dipole_reference)
2312 CALL section_vals_val_get(dipole_section, "REFERENCE_POINT", explicit=explicit)
2313 IF (explicit) THEN
2314 CALL section_vals_val_get(dipole_section, "REFERENCE_POINT", r_vals=t_control%dipole_ref_point)
2315 ELSE
2316 NULLIFY (t_control%dipole_ref_point)
2317 IF (t_control%dipole_form == tddfpt_dipole_length .AND. t_control%dipole_reference == use_mom_ref_user) THEN
2318 cpabort("User-defined reference point should be given explicitly")
2319 END IF
2320 END IF
2321
2322 !SOC subsection
2323 soc_section => section_vals_get_subs_vals(t_section, "SOC")
2324 CALL section_vals_get(soc_section, explicit=explicit)
2325 IF (explicit) THEN
2326 t_control%do_soc = .true.
2327 END IF
2328
2329 ! MGRID subsection
2330 mgrid_section => section_vals_get_subs_vals(t_section, "MGRID")
2331 CALL section_vals_get(mgrid_section, explicit=t_control%mgrid_is_explicit)
2332
2333 IF (t_control%mgrid_is_explicit) THEN
2334 CALL section_vals_val_get(mgrid_section, "NGRIDS", i_val=t_control%mgrid_ngrids, explicit=explicit)
2335 IF (.NOT. explicit) t_control%mgrid_ngrids = SIZE(qs_control%e_cutoff)
2336
2337 CALL section_vals_val_get(mgrid_section, "CUTOFF", r_val=t_control%mgrid_cutoff, explicit=explicit)
2338 IF (.NOT. explicit) t_control%mgrid_cutoff = qs_control%cutoff
2339
2340 CALL section_vals_val_get(mgrid_section, "PROGRESSION_FACTOR", &
2341 r_val=t_control%mgrid_progression_factor, explicit=explicit)
2342 IF (explicit) THEN
2343 IF (t_control%mgrid_progression_factor <= 1.0_dp) THEN
2344 CALL cp_abort(__location__, &
2345 "Progression factor should be greater then 1.0 to ensure multi-grid ordering")
2346 END IF
2347 ELSE
2348 t_control%mgrid_progression_factor = qs_control%progression_factor
2349 END IF
2350
2351 CALL section_vals_val_get(mgrid_section, "COMMENSURATE", l_val=t_control%mgrid_commensurate_mgrids, explicit=explicit)
2352 IF (.NOT. explicit) t_control%mgrid_commensurate_mgrids = qs_control%commensurate_mgrids
2353 IF (t_control%mgrid_commensurate_mgrids) THEN
2354 IF (explicit) THEN
2355 t_control%mgrid_progression_factor = 4.0_dp
2356 ELSE
2357 t_control%mgrid_progression_factor = qs_control%progression_factor
2358 END IF
2359 END IF
2360
2361 CALL section_vals_val_get(mgrid_section, "REL_CUTOFF", r_val=t_control%mgrid_relative_cutoff, explicit=explicit)
2362 IF (.NOT. explicit) t_control%mgrid_relative_cutoff = qs_control%relative_cutoff
2363
2364 CALL section_vals_val_get(mgrid_section, "MULTIGRID_SET", l_val=multigrid_set, explicit=explicit)
2365 IF (.NOT. explicit) multigrid_set = .false.
2366 IF (multigrid_set) THEN
2367 CALL section_vals_val_get(mgrid_section, "MULTIGRID_CUTOFF", r_vals=t_control%mgrid_e_cutoff)
2368 ELSE
2369 NULLIFY (t_control%mgrid_e_cutoff)
2370 END IF
2371
2372 CALL section_vals_val_get(mgrid_section, "REALSPACE", l_val=t_control%mgrid_realspace_mgrids, explicit=explicit)
2373 IF (.NOT. explicit) t_control%mgrid_realspace_mgrids = qs_control%realspace_mgrids
2374
2375 CALL section_vals_val_get(mgrid_section, "SKIP_LOAD_BALANCE_DISTRIBUTED", &
2376 l_val=t_control%mgrid_skip_load_balance, explicit=explicit)
2377 IF (.NOT. explicit) t_control%mgrid_skip_load_balance = qs_control%skip_load_balance_distributed
2378
2379 IF (ASSOCIATED(t_control%mgrid_e_cutoff)) THEN
2380 IF (SIZE(t_control%mgrid_e_cutoff) /= t_control%mgrid_ngrids) THEN
2381 cpabort("Inconsistent values for number of multi-grids")
2382 END IF
2383
2384 ! sort multi-grids in descending order according to their cutoff values
2385 t_control%mgrid_e_cutoff = -t_control%mgrid_e_cutoff
2386 ALLOCATE (inds(t_control%mgrid_ngrids))
2387 CALL sort(t_control%mgrid_e_cutoff, t_control%mgrid_ngrids, inds)
2388 DEALLOCATE (inds)
2389 t_control%mgrid_e_cutoff = -t_control%mgrid_e_cutoff
2390 END IF
2391 END IF
2392
2393 ! expand XC subsection (if given explicitly)
2394 xc_section => section_vals_get_subs_vals(t_section, "XC")
2395 xc_func => section_vals_get_subs_vals(xc_section, "XC_FUNCTIONAL")
2396 CALL section_vals_get(xc_func, explicit=explicit)
2397 IF (explicit) THEN
2398 CALL xc_functionals_expand(xc_func, xc_section)
2399 END IF
2400
2401 ! sTDA subsection
2402 stda_section => section_vals_get_subs_vals(t_section, "STDA")
2403 IF (t_control%kernel == tddfpt_kernel_stda) THEN
2404 t_control%stda_control%hfx_fraction = 0.0_dp
2405 t_control%stda_control%do_exchange = .true.
2406 t_control%stda_control%eps_td_filter = 1.e-10_dp
2407 t_control%stda_control%mn_alpha = -99.0_dp
2408 t_control%stda_control%mn_beta = -99.0_dp
2409 ! set default for Ewald method (on/off) dependent on periodicity
2410 SELECT CASE (qs_control%periodicity)
2411 CASE (0)
2412 t_control%stda_control%do_ewald = .false.
2413 CASE (1)
2414 t_control%stda_control%do_ewald = .true.
2415 CASE (2)
2416 t_control%stda_control%do_ewald = .true.
2417 CASE (3)
2418 t_control%stda_control%do_ewald = .true.
2419 CASE DEFAULT
2420 cpabort("Illegal value for periodiciy")
2421 END SELECT
2422 CALL section_vals_get(stda_section, explicit=explicit)
2423 IF (explicit) THEN
2424 CALL section_vals_val_get(stda_section, "HFX_FRACTION", r_val=hfx, explicit=expl)
2425 IF (expl) t_control%stda_control%hfx_fraction = hfx
2426 CALL section_vals_val_get(stda_section, "EPS_TD_FILTER", r_val=filter, explicit=expl)
2427 IF (expl) t_control%stda_control%eps_td_filter = filter
2428 CALL section_vals_val_get(stda_section, "DO_EWALD", l_val=do_ewald, explicit=expl)
2429 IF (expl) t_control%stda_control%do_ewald = do_ewald
2430 CALL section_vals_val_get(stda_section, "DO_EXCHANGE", l_val=do_exchange, explicit=expl)
2431 IF (expl) t_control%stda_control%do_exchange = do_exchange
2432 CALL section_vals_val_get(stda_section, "MATAGA_NISHIMOTO_CEXP", r_val=fval)
2433 t_control%stda_control%mn_alpha = fval
2434 CALL section_vals_val_get(stda_section, "MATAGA_NISHIMOTO_XEXP", r_val=fval)
2435 t_control%stda_control%mn_beta = fval
2436 END IF
2437 CALL section_vals_val_get(stda_section, "COULOMB_SR_CUT", r_val=fval)
2438 t_control%stda_control%coulomb_sr_cut = fval
2439 CALL section_vals_val_get(stda_section, "COULOMB_SR_EPS", r_val=fval)
2440 t_control%stda_control%coulomb_sr_eps = fval
2441 END IF
2442
2443 CALL timestop(handle)
2444 END SUBROUTINE read_tddfpt2_control
2445
2446! **************************************************************************************************
2447!> \brief Write the DFT control parameters to the output unit.
2448!> \param dft_control ...
2449!> \param dft_section ...
2450! **************************************************************************************************
2451 SUBROUTINE write_dft_control(dft_control, dft_section)
2452 TYPE(dft_control_type), POINTER :: dft_control
2453 TYPE(section_vals_type), POINTER :: dft_section
2454
2455 CHARACTER(len=*), PARAMETER :: routinen = 'write_dft_control'
2456
2457 CHARACTER(LEN=20) :: tmpstr
2458 INTEGER :: handle, i, i_rep, max_mtlr_iter, n_rep, &
2459 output_unit
2460 REAL(kind=dp) :: density_cut, density_smooth_cut_range, &
2461 eps_u_j_loop, gradient_cut, tau_cut
2462 TYPE(cp_logger_type), POINTER :: logger
2463 TYPE(enumeration_type), POINTER :: enum
2464 TYPE(keyword_type), POINTER :: keyword
2465 TYPE(section_type), POINTER :: section
2466 TYPE(section_vals_type), POINTER :: xc_section
2467
2468 IF (dft_control%qs_control%semi_empirical) RETURN
2469 IF (dft_control%qs_control%dftb) RETURN
2470 IF (dft_control%qs_control%xtb) THEN
2471 CALL write_xtb_control(dft_control%qs_control%xtb_control, dft_section)
2472 RETURN
2473 END IF
2474 CALL timeset(routinen, handle)
2475
2476 NULLIFY (logger)
2477 logger => cp_get_default_logger()
2478
2479 output_unit = cp_print_key_unit_nr(logger, dft_section, &
2480 "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
2481
2482 IF (output_unit > 0) THEN
2483
2484 xc_section => section_vals_get_subs_vals(dft_section, "XC")
2485
2486 IF (dft_control%uks) THEN
2487 WRITE (unit=output_unit, fmt="(/,T2,A,T78,A)") &
2488 "DFT| Spin unrestricted (spin-polarized) Kohn-Sham calculation", "UKS"
2489 ELSE IF (dft_control%roks) THEN
2490 WRITE (unit=output_unit, fmt="(/,T2,A,T77,A)") &
2491 "DFT| Spin restricted open Kohn-Sham calculation", "ROKS"
2492 ELSE
2493 WRITE (unit=output_unit, fmt="(/,T2,A,T78,A)") &
2494 "DFT| Spin restricted Kohn-Sham (RKS) calculation", "RKS"
2495 END IF
2496
2497 WRITE (unit=output_unit, fmt="(T2,A,T76,I5)") &
2498 "DFT| Multiplicity", dft_control%multiplicity
2499 WRITE (unit=output_unit, fmt="(T2,A,T76,I5)") &
2500 "DFT| Number of spin states", dft_control%nspins
2501
2502 WRITE (unit=output_unit, fmt="(T2,A,T76,I5)") &
2503 "DFT| Charge", dft_control%charge
2504
2505 IF (dft_control%sic_method_id /= sic_none) CALL cite_reference(vandevondele2005b)
2506 SELECT CASE (dft_control%sic_method_id)
2507 CASE (sic_none)
2508 tmpstr = "NO"
2509 CASE (sic_mauri_spz)
2510 tmpstr = "SPZ/MAURI SIC"
2511 CASE (sic_mauri_us)
2512 tmpstr = "US/MAURI SIC"
2513 CASE (sic_ad)
2514 tmpstr = "AD SIC"
2515 CASE (sic_eo)
2516 tmpstr = "Explicit Orbital SIC"
2517 CASE DEFAULT
2518 ! fix throughout the cp2k for this option
2519 cpabort("SIC option unknown")
2520 END SELECT
2521
2522 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
2523 "DFT| Self-interaction correction (SIC)", adjustr(trim(tmpstr))
2524
2525 IF (dft_control%sic_method_id /= sic_none) THEN
2526 WRITE (unit=output_unit, fmt="(T2,A,T66,ES15.6)") &
2527 "DFT| SIC scaling parameter a", dft_control%sic_scaling_a, &
2528 "DFT| SIC scaling parameter b", dft_control%sic_scaling_b
2529 END IF
2530
2531 IF (dft_control%sic_method_id == sic_eo) THEN
2532 IF (dft_control%sic_list_id == sic_list_all) THEN
2533 WRITE (unit=output_unit, fmt="(T2,A,T66,A)") &
2534 "DFT| SIC orbitals", "ALL"
2535 END IF
2536 IF (dft_control%sic_list_id == sic_list_unpaired) THEN
2537 WRITE (unit=output_unit, fmt="(T2,A,T66,A)") &
2538 "DFT| SIC orbitals", "UNPAIRED"
2539 END IF
2540 END IF
2541
2542 CALL section_vals_val_get(xc_section, "density_cutoff", r_val=density_cut)
2543 CALL section_vals_val_get(xc_section, "gradient_cutoff", r_val=gradient_cut)
2544 CALL section_vals_val_get(xc_section, "tau_cutoff", r_val=tau_cut)
2545 CALL section_vals_val_get(xc_section, "density_smooth_cutoff_range", r_val=density_smooth_cut_range)
2546
2547 WRITE (unit=output_unit, fmt="(T2,A,T66,ES15.6)") &
2548 "DFT| Cutoffs: density ", density_cut, &
2549 "DFT| gradient", gradient_cut, &
2550 "DFT| tau ", tau_cut, &
2551 "DFT| cutoff_smoothing_range", density_smooth_cut_range
2552 CALL section_vals_val_get(xc_section, "XC_GRID%XC_SMOOTH_RHO", &
2553 c_val=tmpstr)
2554 WRITE (output_unit, '( A, T61, A )') &
2555 " DFT| XC density smoothing ", adjustr(tmpstr)
2556 CALL section_vals_val_get(xc_section, "XC_GRID%XC_DERIV", &
2557 c_val=tmpstr)
2558 WRITE (output_unit, '( A, T61, A )') &
2559 " DFT| XC derivatives ", adjustr(tmpstr)
2560 IF (dft_control%dft_plus_u) THEN
2561 NULLIFY (enum, keyword, section)
2562 CALL create_dft_section(section)
2563 keyword => section_get_keyword(section, "PLUS_U_METHOD")
2564 CALL keyword_get(keyword, enum=enum)
2565 WRITE (unit=output_unit, fmt="(/,T2,A,T41,A40)") &
2566 "DFT+U| Method", adjustr(trim(enum_i2c(enum, dft_control%plus_u_method_id)))
2567 WRITE (unit=output_unit, fmt="(T2,A)") &
2568 "DFT+U| Check atomic kind information for details"
2569 IF (dft_control%mtlr_u_j) THEN
2570 CALL section_vals_val_get(dft_section, "EPS_U_J_LOOP", r_val=eps_u_j_loop)
2571 WRITE (unit=output_unit, fmt="(T2,A,T67,ES14.7E3)") &
2572 "MTLR U J| EPS_U_J_LOOP", eps_u_j_loop
2573 CALL section_vals_val_get(dft_section, "MAX_MTLR_LOOP", i_val=max_mtlr_iter)
2574 WRITE (unit=output_unit, fmt="(T2,A,T67,I10)") &
2575 "MTLR U J| MAX_MTLR_LOOP", max_mtlr_iter
2576 END IF
2577 CALL section_release(section)
2578 END IF
2579
2580 WRITE (unit=output_unit, fmt="(A)") ""
2581 CALL xc_write(output_unit, xc_section, dft_control%lsd)
2582
2583 IF (dft_control%apply_period_efield) THEN
2584 WRITE (unit=output_unit, fmt="(A)") ""
2585 IF (dft_control%period_efield%displacement_field) THEN
2586 WRITE (unit=output_unit, fmt="(T2,A)") &
2587 "PERIODIC_EFIELD| Use displacement field formulation"
2588 WRITE (unit=output_unit, fmt="(T2,A,T66,1X,ES14.6)") &
2589 "PERIODIC_EFIELD| Displacement field filter: x", &
2590 dft_control%period_efield%d_filter(1), &
2591 "PERIODIC_EFIELD| y", &
2592 dft_control%period_efield%d_filter(2), &
2593 "PERIODIC_EFIELD| z", &
2594 dft_control%period_efield%d_filter(3)
2595 END IF
2596 WRITE (unit=output_unit, fmt="(T2,A,T66,1X,ES14.6)") &
2597 "PERIODIC_EFIELD| Polarisation vector: x", &
2598 dft_control%period_efield%polarisation(1), &
2599 "PERIODIC_EFIELD| y", &
2600 dft_control%period_efield%polarisation(2), &
2601 "PERIODIC_EFIELD| z", &
2602 dft_control%period_efield%polarisation(3)
2603
2604 WRITE (unit=output_unit, fmt="(T2,A,T66,1X,I14)") &
2605 "PERIODIC_EFIELD| Start Frame:", &
2606 dft_control%period_efield%start_frame, &
2607 "PERIODIC_EFIELD| End Frame:", &
2608 dft_control%period_efield%end_frame
2609
2610 IF (ALLOCATED(dft_control%period_efield%strength_list)) THEN
2611 WRITE (unit=output_unit, fmt="(T2,A,T66,1X,I14)") &
2612 "PERIODIC_EFIELD| Number of Intensities:", &
2613 SIZE(dft_control%period_efield%strength_list)
2614 WRITE (unit=output_unit, fmt="(T2,A,I10,T66,1X,ES14.6)") &
2615 "PERIODIC_EFIELD| Intensity List [a.u.] ", &
2616 1, dft_control%period_efield%strength_list(1)
2617 DO i = 2, SIZE(dft_control%period_efield%strength_list)
2618 WRITE (unit=output_unit, fmt="(T2,A,I10,T66,1X,ES14.6)") &
2619 "PERIODIC_EFIELD| ", &
2620 i, dft_control%period_efield%strength_list(i)
2621 END DO
2622 ELSE
2623 WRITE (unit=output_unit, fmt="(T2,A,T66,1X,ES14.6)") &
2624 "PERIODIC_EFIELD| Intensity [a.u.]:", &
2625 dft_control%period_efield%strength
2626 END IF
2627
2628 IF (norm2(dft_control%period_efield%polarisation) < epsilon(0.0_dp)) THEN
2629 cpabort("Invalid (too small) polarisation vector specified for PERIODIC_EFIELD")
2630 END IF
2631 END IF
2632
2633 IF (dft_control%do_sccs) THEN
2634 WRITE (unit=output_unit, fmt="(/,T2,A)") &
2635 "SCCS| Self-consistent continuum solvation model"
2636 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2637 "SCCS| Relative permittivity of the solvent (medium)", &
2638 dft_control%sccs_control%epsilon_solvent, &
2639 "SCCS| Absolute permittivity [a.u.]", &
2640 dft_control%sccs_control%epsilon_solvent/fourpi
2641 SELECT CASE (dft_control%sccs_control%method_id)
2642 CASE (sccs_andreussi)
2643 WRITE (unit=output_unit, fmt="(T2,A,/,(T2,A,T61,ES20.6))") &
2644 "SCCS| Dielectric function proposed by Andreussi et al.", &
2645 "SCCS| rho_max", dft_control%sccs_control%rho_max, &
2646 "SCCS| rho_min", dft_control%sccs_control%rho_min
2647 CASE (sccs_fattebert_gygi)
2648 WRITE (unit=output_unit, fmt="(T2,A,/,(T2,A,T61,ES20.6))") &
2649 "SCCS| Dielectric function proposed by Fattebert and Gygi", &
2650 "SCCS| beta", dft_control%sccs_control%beta, &
2651 "SCCS| rho_zero", dft_control%sccs_control%rho_zero
2652 CASE (sccs_saa_andreussi)
2653 WRITE (unit=output_unit, fmt="(T2,A,/,A,/,(T2,A,T61,ES20.6))") &
2654 "SCCS| Dielectric function of the solvent aware algorithm", &
2655 "SCCS| proposed by Andreussi et al.", &
2656 "SCCS| rho_max", dft_control%sccs_control%rho_max, &
2657 "SCCS| rho_min", dft_control%sccs_control%rho_min, &
2658 "SCCS| f0", dft_control%sccs_control%f0, &
2659 "SCCS| delta_eta", dft_control%sccs_control%delta_eta, &
2660 "SCCS| alpha_zeta", dft_control%sccs_control%alpha_zeta, &
2661 "SCCS| delta_zeta", dft_control%sccs_control%delta_zeta, &
2662 "SCCS| R_solv", dft_control%sccs_control%R_solv
2663 CASE DEFAULT
2664 cpabort("Invalid SCCS model specified. Please, check your input!")
2665 END SELECT
2666 SELECT CASE (dft_control%sccs_control%derivative_method)
2667 CASE (sccs_derivative_fft)
2668 WRITE (unit=output_unit, fmt="(T2,A,T46,A35)") &
2669 "SCCS| Numerical derivative calculation", &
2670 adjustr("FFT")
2671 CASE (sccs_derivative_cd3)
2672 WRITE (unit=output_unit, fmt="(T2,A,T46,A35)") &
2673 "SCCS| Numerical derivative calculation", &
2674 adjustr("3-point stencil central differences")
2675 CASE (sccs_derivative_cd5)
2676 WRITE (unit=output_unit, fmt="(T2,A,T46,A35)") &
2677 "SCCS| Numerical derivative calculation", &
2678 adjustr("5-point stencil central differences")
2679 CASE (sccs_derivative_cd7)
2680 WRITE (unit=output_unit, fmt="(T2,A,T46,A35)") &
2681 "SCCS| Numerical derivative calculation", &
2682 adjustr("7-point stencil central differences")
2683 CASE DEFAULT
2684 CALL cp_abort(__location__, &
2685 "Invalid derivative method specified for SCCS model. "// &
2686 "Please, check your input!")
2687 END SELECT
2688 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2689 "SCCS| Repulsion parameter alpha [mN/m] = [dyn/cm]", &
2690 cp_unit_from_cp2k(dft_control%sccs_control%alpha_solvent, "mN/m")
2691 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2692 "SCCS| Dispersion parameter beta [GPa]", &
2693 cp_unit_from_cp2k(dft_control%sccs_control%beta_solvent, "GPa")
2694 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2695 "SCCS| Surface tension gamma [mN/m] = [dyn/cm]", &
2696 cp_unit_from_cp2k(dft_control%sccs_control%gamma_solvent, "mN/m")
2697 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2698 "SCCS| Mixing parameter applied during the iteration cycle", &
2699 dft_control%sccs_control%mixing
2700 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2701 "SCCS| Tolerance for the convergence of the SCCS iteration cycle", &
2702 dft_control%sccs_control%eps_sccs
2703 WRITE (unit=output_unit, fmt="(T2,A,T61,I20)") &
2704 "SCCS| Maximum number of iteration steps", &
2705 dft_control%sccs_control%max_iter
2706 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2707 "SCCS| SCF convergence threshold for starting the SCCS iteration", &
2708 dft_control%sccs_control%eps_scf
2709 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2710 "SCCS| Numerical increment for the cavity surface calculation", &
2711 dft_control%sccs_control%delta_rho
2712 END IF
2713
2714 WRITE (unit=output_unit, fmt="(A)") ""
2715
2716 END IF
2717
2718 IF (dft_control%hairy_probes .EQV. .true.) THEN
2719 n_rep = SIZE(dft_control%probe)
2720 IF (output_unit > 0) THEN
2721 DO i_rep = 1, n_rep
2722 WRITE (unit=output_unit, fmt="(T2,A,I5)") &
2723 "HP | hair probe set", i_rep
2724 WRITE (unit=output_unit, fmt="(T2,A,T61,*(I5))") &
2725 "HP| atom indexes", &
2726 (dft_control%probe(i_rep)%atom_ids(i), i=1, dft_control%probe(i_rep)%natoms)
2727 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2728 "HP| potential", dft_control%probe(i_rep)%mu
2729 WRITE (unit=output_unit, fmt="(T2,A,T61,F20.2)") &
2730 "HP| temperature", dft_control%probe(i_rep)%T
2731 WRITE (unit=output_unit, fmt="(T2,A,T61,ES20.6)") &
2732 "HP| eps_hp", dft_control%probe(i_rep)%eps_hp
2733 END DO
2734 END IF
2735 END IF
2736
2737 CALL cp_print_key_finished_output(output_unit, logger, dft_section, &
2738 "PRINT%DFT_CONTROL_PARAMETERS")
2739
2740 CALL timestop(handle)
2741
2742 END SUBROUTINE write_dft_control
2743
2744! **************************************************************************************************
2745!> \brief Write the ADMM control parameters to the output unit.
2746!> \param admm_control ...
2747!> \param dft_section ...
2748! **************************************************************************************************
2749 SUBROUTINE write_admm_control(admm_control, dft_section)
2750 TYPE(admm_control_type), POINTER :: admm_control
2751 TYPE(section_vals_type), POINTER :: dft_section
2752
2753 INTEGER :: iounit
2754 TYPE(cp_logger_type), POINTER :: logger
2755
2756 NULLIFY (logger)
2757 logger => cp_get_default_logger()
2758
2759 iounit = cp_print_key_unit_nr(logger, dft_section, &
2760 "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
2761
2762 IF (iounit > 0) THEN
2763
2764 SELECT CASE (admm_control%admm_type)
2765 CASE (no_admm_type)
2766 WRITE (unit=iounit, fmt="(/,T2,A,T77,A)") "ADMM| Specific ADMM type specified", "NONE"
2767 CASE (admm1_type)
2768 WRITE (unit=iounit, fmt="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMM1"
2769 CASE (admm2_type)
2770 WRITE (unit=iounit, fmt="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMM2"
2771 CASE (admms_type)
2772 WRITE (unit=iounit, fmt="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMS"
2773 CASE (admmp_type)
2774 WRITE (unit=iounit, fmt="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMP"
2775 CASE (admmq_type)
2776 WRITE (unit=iounit, fmt="(/,T2,A,T76,A)") "ADMM| Specific ADMM type specified", "ADMMQ"
2777 CASE DEFAULT
2778 cpabort("admm_type")
2779 END SELECT
2780
2781 SELECT CASE (admm_control%purification_method)
2782 CASE (do_admm_purify_none)
2783 WRITE (unit=iounit, fmt="(T2,A,T77,A)") "ADMM| Density matrix purification method", "NONE"
2784 CASE (do_admm_purify_cauchy)
2785 WRITE (unit=iounit, fmt="(T2,A,T75,A)") "ADMM| Density matrix purification method", "Cauchy"
2786 CASE (do_admm_purify_cauchy_subspace)
2787 WRITE (unit=iounit, fmt="(T2,A,T66,A)") "ADMM| Density matrix purification method", "Cauchy subspace"
2788 CASE (do_admm_purify_mo_diag)
2789 WRITE (unit=iounit, fmt="(T2,A,T63,A)") "ADMM| Density matrix purification method", "MO diagonalization"
2790 CASE (do_admm_purify_mo_no_diag)
2791 WRITE (unit=iounit, fmt="(T2,A,T71,A)") "ADMM| Density matrix purification method", "MO no diag"
2792 CASE (do_admm_purify_mcweeny)
2793 WRITE (unit=iounit, fmt="(T2,A,T74,A)") "ADMM| Density matrix purification method", "McWeeny"
2794 CASE (do_admm_purify_none_dm)
2795 WRITE (unit=iounit, fmt="(T2,A,T73,A)") "ADMM| Density matrix purification method", "NONE(DM)"
2796 CASE DEFAULT
2797 cpabort("admm_purification_method")
2798 END SELECT
2799
2800 SELECT CASE (admm_control%method)
2801 CASE (do_admm_basis_projection)
2802 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| Orbital projection on ADMM basis"
2803 CASE (do_admm_blocking_purify_full)
2804 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| Blocked Fock matrix projection with full purification"
2805 CASE (do_admm_blocked_projection)
2806 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| Blocked Fock matrix projection"
2807 CASE (do_admm_charge_constrained_projection)
2808 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| Orbital projection with charge constrain"
2809 CASE DEFAULT
2810 cpabort("admm method")
2811 END SELECT
2812
2813 SELECT CASE (admm_control%scaling_model)
2814 CASE (do_admm_exch_scaling_none)
2815 CASE (do_admm_exch_scaling_merlot)
2816 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| Use Merlot (2014) scaling model"
2817 CASE DEFAULT
2818 cpabort("admm scaling_model")
2819 END SELECT
2820
2821 WRITE (unit=iounit, fmt="(T2,A,T61,G20.10)") "ADMM| eps_filter", admm_control%eps_filter
2822
2823 SELECT CASE (admm_control%aux_exch_func)
2824 CASE (do_admm_aux_exch_func_none)
2825 WRITE (unit=iounit, fmt="(T2,A)") "ADMM| No exchange functional correction term used"
2826 CASE (do_admm_aux_exch_func_default, do_admm_aux_exch_func_default_libxc)
2827 WRITE (unit=iounit, fmt="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "(W)PBEX"
2828 CASE (do_admm_aux_exch_func_pbex, do_admm_aux_exch_func_pbex_libxc)
2829 WRITE (unit=iounit, fmt="(T2,A,T77,A)") "ADMM| Exchange functional in correction term", "PBEX"
2830 CASE (do_admm_aux_exch_func_opt, do_admm_aux_exch_func_opt_libxc)
2831 WRITE (unit=iounit, fmt="(T2,A,T77,A)") "ADMM| Exchange functional in correction term", "OPTX"
2832 CASE (do_admm_aux_exch_func_bee, do_admm_aux_exch_func_bee_libxc)
2833 WRITE (unit=iounit, fmt="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "Becke88"
2834 CASE (do_admm_aux_exch_func_sx_libxc)
2835 WRITE (unit=iounit, fmt="(T2,A,T74,A)") "ADMM| Exchange functional in correction term", "SlaterX"
2836 CASE DEFAULT
2837 cpabort("admm aux_exch_func")
2838 END SELECT
2839
2840 WRITE (unit=iounit, fmt="(A)") ""
2841
2842 END IF
2843
2844 CALL cp_print_key_finished_output(iounit, logger, dft_section, &
2845 "PRINT%DFT_CONTROL_PARAMETERS")
2846 END SUBROUTINE write_admm_control
2847
2848! **************************************************************************************************
2849!> \brief Write the xTB control parameters to the output unit.
2850!> \param xtb_control ...
2851!> \param dft_section ...
2852! **************************************************************************************************
2853 SUBROUTINE write_xtb_control(xtb_control, dft_section)
2854 TYPE(xtb_control_type), POINTER :: xtb_control
2855 TYPE(section_vals_type), POINTER :: dft_section
2856
2857 CHARACTER(len=*), PARAMETER :: routinen = 'write_xtb_control'
2858
2859 CHARACTER(LEN=16) :: scc_mixer_name, solver_name
2860 INTEGER :: handle, output_unit
2861 TYPE(cp_logger_type), POINTER :: logger
2862
2863 CALL timeset(routinen, handle)
2864 NULLIFY (logger)
2865 logger => cp_get_default_logger()
2866
2867 output_unit = cp_print_key_unit_nr(logger, dft_section, &
2868 "PRINT%DFT_CONTROL_PARAMETERS", extension=".Log")
2869
2870 IF (output_unit > 0) THEN
2871
2872 WRITE (unit=output_unit, fmt="(/,T2,A,T31,A50)") &
2873 "xTB| Parameter file", adjustr(trim(xtb_control%parameter_file_name))
2874 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
2875 "xTB| Basis expansion STO-NG", xtb_control%sto_ng
2876 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
2877 "xTB| Basis expansion STO-NG for Hydrogen", xtb_control%h_sto_ng
2878 WRITE (unit=output_unit, fmt="(T2,A,T71,E10.4)") &
2879 "xTB| Repulsive pair potential accuracy", xtb_control%eps_pair
2880 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.6)") &
2881 "xTB| Repulsive enhancement factor", xtb_control%enscale
2882 WRITE (unit=output_unit, fmt="(T2,A,T71,L10)") &
2883 "xTB| Halogen interaction potential", xtb_control%xb_interaction
2884 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.3)") &
2885 "xTB| Halogen interaction potential cutoff radius", xtb_control%xb_radius
2886 WRITE (unit=output_unit, fmt="(T2,A,T71,L10)") &
2887 "xTB| Nonbonded interactions", xtb_control%do_nonbonded
2888 SELECT CASE (xtb_control%vdw_type)
2889 CASE (xtb_vdw_type_none)
2890 WRITE (unit=output_unit, fmt="(T2,A)") "xTB| No vdW potential selected"
2891 CASE (xtb_vdw_type_d3)
2892 WRITE (unit=output_unit, fmt="(T2,A,T72,A)") "xTB| vdW potential type:", "DFTD3(BJ)"
2893 WRITE (unit=output_unit, fmt="(T2,A,T31,A50)") &
2894 "xTB| D3 Dispersion: Parameter file", adjustr(trim(xtb_control%dispersion_parameter_file))
2895 CASE (xtb_vdw_type_d4)
2896 WRITE (unit=output_unit, fmt="(T2,A,T76,A)") "xTB| vdW potential type:", "DFTD4"
2897 WRITE (unit=output_unit, fmt="(T2,A,T31,A50)") &
2898 "xTB| D4 Dispersion: Parameter file", adjustr(trim(xtb_control%dispersion_parameter_file))
2899 CASE DEFAULT
2900 cpabort("vdw type")
2901 END SELECT
2902 WRITE (unit=output_unit, fmt="(T2,A,T51,3F10.3)") &
2903 "xTB| Huckel constants ks kp kd", xtb_control%ks, xtb_control%kp, xtb_control%kd
2904 WRITE (unit=output_unit, fmt="(T2,A,T61,2F10.3)") &
2905 "xTB| Huckel constants ksp k2sh", xtb_control%ksp, xtb_control%k2sh
2906 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.3)") &
2907 "xTB| Mataga-Nishimoto exponent", xtb_control%kg
2908 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.3)") &
2909 "xTB| Repulsion potential exponent", xtb_control%kf
2910 WRITE (unit=output_unit, fmt="(T2,A,T51,3F10.3)") &
2911 "xTB| Coordination number scaling kcn(s) kcn(p) kcn(d)", &
2912 xtb_control%kcns, xtb_control%kcnp, xtb_control%kcnd
2913 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.3)") &
2914 "xTB| Electronegativity scaling", xtb_control%ken
2915 WRITE (unit=output_unit, fmt="(T2,A,T61,2F10.3)") &
2916 "xTB| Halogen potential scaling kxr kx2", xtb_control%kxr, xtb_control%kx2
2917 SELECT CASE (xtb_control%tblite_scc_mixer)
2918 CASE (tblite_scc_mixer_auto)
2919 scc_mixer_name = "AUTO"
2920 CASE (tblite_scc_mixer_tblite)
2921 scc_mixer_name = "TBLITE"
2922 CASE (tblite_scc_mixer_cp2k)
2923 scc_mixer_name = "CP2K"
2924 CASE (tblite_scc_mixer_none)
2925 scc_mixer_name = "NONE"
2926 CASE DEFAULT
2927 cpabort("Unknown tblite SCC mixer")
2928 END SELECT
2929 SELECT CASE (xtb_control%tblite_mixer_solver)
2930 CASE (tblite_solver_gvd)
2931 solver_name = "GVD"
2932 CASE (tblite_solver_gvr)
2933 solver_name = "GVR"
2934 CASE DEFAULT
2935 cpabort("Unknown tblite SCC mixer solver")
2936 END SELECT
2937 WRITE (unit=output_unit, fmt="(T2,A,T72,A)") &
2938 "xTB| SCC mixer:", trim(scc_mixer_name)
2939 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
2940 "xTB| tblite accuracy:", xtb_control%tblite_accuracy
2941 IF (len_trim(xtb_control%tblite_param_file) > 0) THEN
2942 WRITE (unit=output_unit, fmt="(T2,A,T33,A)") &
2943 "xTB| tblite parameter file:", trim(xtb_control%tblite_param_file)
2944 END IF
2945 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.3)") &
2946 "xTB| tblite SCC mixer damping:", xtb_control%tblite_mixer_damping
2947 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
2948 "xTB| tblite SCC mixer iterations:", xtb_control%tblite_mixer_iterations
2949 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
2950 "xTB| tblite SCC mixer memory:", xtb_control%tblite_mixer_memory
2951 WRITE (unit=output_unit, fmt="(T2,A,T72,A)") &
2952 "xTB| tblite SCC mixer solver:", trim(solver_name)
2953 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
2954 "xTB| tblite SCC mixer omega0:", xtb_control%tblite_mixer_omega0
2955 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
2956 "xTB| tblite SCC mixer min weight:", xtb_control%tblite_mixer_min_weight
2957 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
2958 "xTB| tblite SCC mixer max weight:", xtb_control%tblite_mixer_max_weight
2959 WRITE (unit=output_unit, fmt="(T2,A,T71,ES10.3)") &
2960 "xTB| tblite SCC mixer weight factor:", xtb_control%tblite_mixer_weight_factor
2961 WRITE (unit=output_unit, fmt="(/)")
2962
2963 END IF
2964
2965 CALL cp_print_key_finished_output(output_unit, logger, dft_section, &
2966 "PRINT%DFT_CONTROL_PARAMETERS")
2967
2968 CALL timestop(handle)
2969
2970 END SUBROUTINE write_xtb_control
2971
2972! **************************************************************************************************
2973!> \brief Purpose: Write the QS control parameters to the output unit.
2974!> \param qs_control ...
2975!> \param dft_section ...
2976! **************************************************************************************************
2977 SUBROUTINE write_qs_control(qs_control, dft_section)
2978 TYPE(qs_control_type), INTENT(IN) :: qs_control
2979 TYPE(section_vals_type), POINTER :: dft_section
2980
2981 CHARACTER(len=*), PARAMETER :: routinen = 'write_qs_control'
2982
2983 CHARACTER(len=20) :: method, quadrature
2984 INTEGER :: handle, i, igrid_level, ngrid_level, &
2985 output_unit
2986 TYPE(cp_logger_type), POINTER :: logger
2987 TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
2988 TYPE(enumeration_type), POINTER :: enum
2989 TYPE(keyword_type), POINTER :: keyword
2990 TYPE(section_type), POINTER :: qs_section
2991 TYPE(section_vals_type), POINTER :: print_section_vals, qs_section_vals
2992
2993 IF (qs_control%semi_empirical) RETURN
2994 IF (qs_control%dftb) RETURN
2995 IF (qs_control%xtb) RETURN
2996 CALL timeset(routinen, handle)
2997 NULLIFY (logger, print_section_vals, qs_section, qs_section_vals)
2998 logger => cp_get_default_logger()
2999 print_section_vals => section_vals_get_subs_vals(dft_section, "PRINT")
3000 qs_section_vals => section_vals_get_subs_vals(dft_section, "QS")
3001 CALL section_vals_get(qs_section_vals, section=qs_section)
3002
3003 NULLIFY (enum, keyword)
3004 keyword => section_get_keyword(qs_section, "METHOD")
3005 CALL keyword_get(keyword, enum=enum)
3006 method = trim(enum_i2c(enum, qs_control%method_id))
3007
3008 NULLIFY (enum, keyword)
3009 keyword => section_get_keyword(qs_section, "QUADRATURE")
3010 CALL keyword_get(keyword, enum=enum)
3011 quadrature = trim(enum_i2c(enum, qs_control%gapw_control%quadrature))
3012
3013 output_unit = cp_print_key_unit_nr(logger, print_section_vals, &
3014 "DFT_CONTROL_PARAMETERS", extension=".Log")
3015 IF (output_unit > 0) THEN
3016 ngrid_level = SIZE(qs_control%e_cutoff)
3017 WRITE (unit=output_unit, fmt="(/,T2,A,T61,A20)") &
3018 "QS| Method:", adjustr(method)
3019 IF (qs_control%pw_grid_opt%spherical) THEN
3020 WRITE (unit=output_unit, fmt="(T2,A,T61,A)") &
3021 "QS| Density plane wave grid type", " SPHERICAL HALFSPACE"
3022 ELSE IF (qs_control%pw_grid_opt%fullspace) THEN
3023 WRITE (unit=output_unit, fmt="(T2,A,T57,A)") &
3024 "QS| Density plane wave grid type", " NON-SPHERICAL FULLSPACE"
3025 ELSE
3026 WRITE (unit=output_unit, fmt="(T2,A,T57,A)") &
3027 "QS| Density plane wave grid type", " NON-SPHERICAL HALFSPACE"
3028 END IF
3029 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
3030 "QS| Number of grid levels:", SIZE(qs_control%e_cutoff)
3031 IF (ngrid_level == 1) THEN
3032 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.1)") &
3033 "QS| Density cutoff [a.u.]:", qs_control%e_cutoff(1)
3034 ELSE
3035 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.1)") &
3036 "QS| Density cutoff [a.u.]:", qs_control%cutoff
3037 IF (qs_control%commensurate_mgrids) THEN
3038 WRITE (unit=output_unit, fmt="(T2,A)") "QS| Using commensurate multigrids"
3039 END IF
3040 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.1)") &
3041 "QS| Multi grid cutoff [a.u.]: 1) grid level", qs_control%e_cutoff(1)
3042 WRITE (unit=output_unit, fmt="(T2,A,I3,A,T71,F10.1)") &
3043 ("QS| ", igrid_level, ") grid level", &
3044 qs_control%e_cutoff(igrid_level), &
3045 igrid_level=2, SIZE(qs_control%e_cutoff))
3046 END IF
3047 IF (qs_control%pao) THEN
3048 WRITE (unit=output_unit, fmt="(T2,A)") "QS| PAO active"
3049 END IF
3050 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.1)") &
3051 "QS| Grid level progression factor:", qs_control%progression_factor
3052 WRITE (unit=output_unit, fmt="(T2,A,T71,F10.1)") &
3053 "QS| Relative density cutoff [a.u.]:", qs_control%relative_cutoff
3054 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3055 "QS| Interaction thresholds: eps_pgf_orb:", &
3056 qs_control%eps_pgf_orb, &
3057 "QS| eps_filter_matrix:", &
3058 qs_control%eps_filter_matrix, &
3059 "QS| eps_core_charge:", &
3060 qs_control%eps_core_charge, &
3061 "QS| eps_rho_gspace:", &
3062 qs_control%eps_rho_gspace, &
3063 "QS| eps_rho_rspace:", &
3064 qs_control%eps_rho_rspace, &
3065 "QS| eps_gvg_rspace:", &
3066 qs_control%eps_gvg_rspace, &
3067 "QS| eps_ppl:", &
3068 qs_control%eps_ppl, &
3069 "QS| eps_ppnl:", &
3070 qs_control%eps_ppnl
3071 IF (qs_control%gapw) THEN
3072 IF (qs_control%gapw_control%accurate_xcint) THEN
3073 WRITE (unit=output_unit, fmt="(T2,A,T79,I2)") &
3074 "QS| GAPW| XC integration using accurate scheme: Polynomial order (2n) =", &
3075 qs_control%gapw_control%oweights
3076 WRITE (unit=output_unit, fmt="(T2,A,T69,F12.6)") &
3077 "QS| GAPW| Ref. exponent =", &
3078 qs_control%gapw_control%aweights
3079 END IF
3080 !
3081 SELECT CASE (qs_control%gapw_control%basis_1c)
3082 CASE (gapw_1c_orb)
3083 WRITE (unit=output_unit, fmt="(T2,A)") &
3084 "QS| GAPW| One center basis from orbital basis primitives"
3085 CASE (gapw_1c_small)
3086 WRITE (unit=output_unit, fmt="(T2,A)") &
3087 "QS| GAPW| One center basis extended with primitives (small:s)"
3088 CASE (gapw_1c_medium)
3089 WRITE (unit=output_unit, fmt="(T2,A)") &
3090 "QS| GAPW| One center basis extended with primitives (medium:sp)"
3091 CASE (gapw_1c_large)
3092 WRITE (unit=output_unit, fmt="(T2,A)") &
3093 "QS| GAPW| One center basis extended with primitives (large:spd)"
3094 CASE (gapw_1c_very_large)
3095 WRITE (unit=output_unit, fmt="(T2,A)") &
3096 "QS| GAPW| One center basis extended with primitives (very large:spdf)"
3097 CASE DEFAULT
3098 cpabort("basis_1c incorrect")
3099 END SELECT
3100 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3101 "QS| GAPW| eps_fit:", &
3102 qs_control%gapw_control%eps_fit, &
3103 "QS| GAPW| eps_iso:", &
3104 qs_control%gapw_control%eps_iso, &
3105 "QS| GAPW| eps_svd:", &
3106 qs_control%gapw_control%eps_svd, &
3107 "QS| GAPW| eps_cpc:", &
3108 qs_control%gapw_control%eps_cpc
3109 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
3110 "QS| GAPW| atom-r-grid: quadrature:", &
3111 adjustr(quadrature)
3112 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
3113 "QS| GAPW| atom-s-grid: max l :", &
3114 qs_control%gapw_control%lmax_sphere, &
3115 "QS| GAPW| max_l_rho0 :", &
3116 qs_control%gapw_control%lmax_rho0
3117 IF (qs_control%gapw_control%non_paw_atoms) THEN
3118 WRITE (unit=output_unit, fmt="(T2,A)") &
3119 "QS| GAPW| At least one kind is NOT PAW, i.e. it has only soft AO "
3120 END IF
3121 IF (qs_control%gapw_control%nopaw_as_gpw) THEN
3122 WRITE (unit=output_unit, fmt="(T2,A)") &
3123 "QS| GAPW| The NOT PAW atoms are treated fully GPW"
3124 END IF
3125 END IF
3126 IF (qs_control%gapw_xc) THEN
3127 SELECT CASE (qs_control%gapw_control%basis_1c)
3128 CASE (gapw_1c_orb)
3129 WRITE (unit=output_unit, fmt="(T2,A)") &
3130 "QS| GAPW_XC| One center basis from orbital basis primitives"
3131 CASE (gapw_1c_small)
3132 WRITE (unit=output_unit, fmt="(T2,A)") &
3133 "QS| GAPW_XC| One center basis extended with primitives (small:s)"
3134 CASE (gapw_1c_medium)
3135 WRITE (unit=output_unit, fmt="(T2,A)") &
3136 "QS| GAPW_XC| One center basis extended with primitives (medium:sp)"
3137 CASE (gapw_1c_large)
3138 WRITE (unit=output_unit, fmt="(T2,A)") &
3139 "QS| GAPW_XC| One center basis extended with primitives (large:spd)"
3140 CASE (gapw_1c_very_large)
3141 WRITE (unit=output_unit, fmt="(T2,A)") &
3142 "QS| GAPW_XC| One center basis extended with primitives (very large:spdf)"
3143 CASE DEFAULT
3144 cpabort("basis_1c incorrect")
3145 END SELECT
3146 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3147 "QS| GAPW_XC| eps_fit:", &
3148 qs_control%gapw_control%eps_fit, &
3149 "QS| GAPW_XC| eps_iso:", &
3150 qs_control%gapw_control%eps_iso, &
3151 "QS| GAPW_XC| eps_svd:", &
3152 qs_control%gapw_control%eps_svd
3153 WRITE (unit=output_unit, fmt="(T2,A,T55,A30)") &
3154 "QS| GAPW_XC|atom-r-grid: quadrature:", &
3155 enum_i2c(enum, qs_control%gapw_control%quadrature)
3156 WRITE (unit=output_unit, fmt="(T2,A,T71,I10)") &
3157 "QS| GAPW_XC| atom-s-grid: max l :", &
3158 qs_control%gapw_control%lmax_sphere
3159 END IF
3160 IF (qs_control%mulliken_restraint) THEN
3161 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3162 "QS| Mulliken restraint target", qs_control%mulliken_restraint_control%target
3163 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3164 "QS| Mulliken restraint strength", qs_control%mulliken_restraint_control%strength
3165 WRITE (unit=output_unit, fmt="(T2,A,T73,I8)") &
3166 "QS| Mulliken restraint atoms: ", qs_control%mulliken_restraint_control%natoms
3167 WRITE (unit=output_unit, fmt="(5I8)") qs_control%mulliken_restraint_control%atoms
3168 END IF
3169 IF (qs_control%ddapc_restraint) THEN
3170 DO i = 1, SIZE(qs_control%ddapc_restraint_control)
3171 ddapc_restraint_control => qs_control%ddapc_restraint_control(i)
3172 IF (SIZE(qs_control%ddapc_restraint_control) > 1) THEN
3173 WRITE (unit=output_unit, fmt="(T2,A,T3,I8)") &
3174 "QS| parameters for DDAPC restraint number", i
3175 END IF
3176 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3177 "QS| ddapc restraint target", ddapc_restraint_control%target
3178 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3179 "QS| ddapc restraint strength", ddapc_restraint_control%strength
3180 WRITE (unit=output_unit, fmt="(T2,A,T73,I8)") &
3181 "QS| ddapc restraint atoms: ", ddapc_restraint_control%natoms
3182 WRITE (unit=output_unit, fmt="(5I8)") ddapc_restraint_control%atoms
3183 WRITE (unit=output_unit, fmt="(T2,A)") "Coefficients:"
3184 WRITE (unit=output_unit, fmt="(5F6.2)") ddapc_restraint_control%coeff
3185 SELECT CASE (ddapc_restraint_control%functional_form)
3186 CASE (do_ddapc_restraint)
3187 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
3188 "QS| ddapc restraint functional form :", "RESTRAINT"
3189 CASE (do_ddapc_constraint)
3190 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
3191 "QS| ddapc restraint functional form :", "CONSTRAINT"
3192 CASE DEFAULT
3193 cpabort("Unknown ddapc restraint")
3194 END SELECT
3195 END DO
3196 END IF
3197 IF (qs_control%s2_restraint) THEN
3198 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3199 "QS| s2 restraint target", qs_control%s2_restraint_control%target
3200 WRITE (unit=output_unit, fmt="(T2,A,T73,ES8.1)") &
3201 "QS| s2 restraint strength", qs_control%s2_restraint_control%strength
3202 SELECT CASE (qs_control%s2_restraint_control%functional_form)
3203 CASE (do_s2_restraint)
3204 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
3205 "QS| s2 restraint functional form :", "RESTRAINT"
3206 cpabort("Not yet implemented")
3207 CASE (do_s2_constraint)
3208 WRITE (unit=output_unit, fmt="(T2,A,T61,A20)") &
3209 "QS| s2 restraint functional form :", "CONSTRAINT"
3210 CASE DEFAULT
3211 cpabort("Unknown ddapc restraint")
3212 END SELECT
3213 END IF
3214 END IF
3215 CALL cp_print_key_finished_output(output_unit, logger, print_section_vals, &
3216 "DFT_CONTROL_PARAMETERS")
3217
3218 CALL timestop(handle)
3219
3220 END SUBROUTINE write_qs_control
3221
3222! **************************************************************************************************
3223!> \brief reads the input parameters needed for ddapc.
3224!> \param qs_control ...
3225!> \param qs_section ...
3226!> \param ddapc_restraint_section ...
3227!> \author fschiff
3228!> \note
3229!> either reads DFT%QS%DDAPC_RESTRAINT or PROPERTIES%ET_coupling
3230!> if(qs_section is present the DFT part is read, if ddapc_restraint_section
3231!> is present ET_COUPLING is read. Avoid having both!!!
3232! **************************************************************************************************
3233 SUBROUTINE read_ddapc_section(qs_control, qs_section, ddapc_restraint_section)
3234
3235 TYPE(qs_control_type), INTENT(INOUT) :: qs_control
3236 TYPE(section_vals_type), OPTIONAL, POINTER :: qs_section, ddapc_restraint_section
3237
3238 INTEGER :: i, j, jj, k, n_rep
3239 INTEGER, DIMENSION(:), POINTER :: tmplist
3240 REAL(kind=dp), DIMENSION(:), POINTER :: rtmplist
3241 TYPE(ddapc_restraint_type), POINTER :: ddapc_restraint_control
3242 TYPE(section_vals_type), POINTER :: ddapc_section
3243
3244 IF (PRESENT(ddapc_restraint_section)) THEN
3245 IF (ASSOCIATED(qs_control%ddapc_restraint_control)) THEN
3246 IF (SIZE(qs_control%ddapc_restraint_control) >= 2) THEN
3247 cpabort("ET_COUPLING cannot be used in combination with a normal restraint")
3248 END IF
3249 ELSE
3250 ddapc_section => ddapc_restraint_section
3251 ALLOCATE (qs_control%ddapc_restraint_control(1))
3252 END IF
3253 END IF
3254
3255 IF (PRESENT(qs_section)) THEN
3256 NULLIFY (ddapc_section)
3257 ddapc_section => section_vals_get_subs_vals(qs_section, &
3258 "DDAPC_RESTRAINT")
3259 END IF
3260
3261 DO i = 1, SIZE(qs_control%ddapc_restraint_control)
3262
3263 CALL ddapc_control_create(qs_control%ddapc_restraint_control(i))
3264 ddapc_restraint_control => qs_control%ddapc_restraint_control(i)
3265
3266 CALL section_vals_val_get(ddapc_section, "STRENGTH", i_rep_section=i, &
3267 r_val=ddapc_restraint_control%strength)
3268 CALL section_vals_val_get(ddapc_section, "TARGET", i_rep_section=i, &
3269 r_val=ddapc_restraint_control%target)
3270 CALL section_vals_val_get(ddapc_section, "FUNCTIONAL_FORM", i_rep_section=i, &
3271 i_val=ddapc_restraint_control%functional_form)
3272 CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
3273 n_rep_val=n_rep)
3274 CALL section_vals_val_get(ddapc_section, "TYPE_OF_DENSITY", i_rep_section=i, &
3275 i_val=ddapc_restraint_control%density_type)
3276
3277 jj = 0
3278 DO k = 1, n_rep
3279 CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
3280 i_rep_val=k, i_vals=tmplist)
3281 DO j = 1, SIZE(tmplist)
3282 jj = jj + 1
3283 END DO
3284 END DO
3285 IF (jj < 1) cpabort("Need at least 1 atom to use ddapc constraints")
3286 ddapc_restraint_control%natoms = jj
3287 IF (ASSOCIATED(ddapc_restraint_control%atoms)) THEN
3288 DEALLOCATE (ddapc_restraint_control%atoms)
3289 END IF
3290 ALLOCATE (ddapc_restraint_control%atoms(ddapc_restraint_control%natoms))
3291 jj = 0
3292 DO k = 1, n_rep
3293 CALL section_vals_val_get(ddapc_section, "ATOMS", i_rep_section=i, &
3294 i_rep_val=k, i_vals=tmplist)
3295 DO j = 1, SIZE(tmplist)
3296 jj = jj + 1
3297 ddapc_restraint_control%atoms(jj) = tmplist(j)
3298 END DO
3299 END DO
3300
3301 IF (ASSOCIATED(ddapc_restraint_control%coeff)) THEN
3302 DEALLOCATE (ddapc_restraint_control%coeff)
3303 END IF
3304 ALLOCATE (ddapc_restraint_control%coeff(ddapc_restraint_control%natoms))
3305 ddapc_restraint_control%coeff = 1.0_dp
3306
3307 CALL section_vals_val_get(ddapc_section, "COEFF", i_rep_section=i, &
3308 n_rep_val=n_rep)
3309 jj = 0
3310 DO k = 1, n_rep
3311 CALL section_vals_val_get(ddapc_section, "COEFF", i_rep_section=i, &
3312 i_rep_val=k, r_vals=rtmplist)
3313 DO j = 1, SIZE(rtmplist)
3314 jj = jj + 1
3315 IF (jj > ddapc_restraint_control%natoms) THEN
3316 cpabort("Need the same number of coeff as there are atoms ")
3317 END IF
3318 ddapc_restraint_control%coeff(jj) = rtmplist(j)
3319 END DO
3320 END DO
3321 IF (jj < ddapc_restraint_control%natoms .AND. jj /= 0) THEN
3322 cpabort("Need no or the same number of coeff as there are atoms.")
3323 END IF
3324 END DO
3325 k = 0
3326 DO i = 1, SIZE(qs_control%ddapc_restraint_control)
3327 IF (qs_control%ddapc_restraint_control(i)%functional_form == &
3328 do_ddapc_constraint) k = k + 1
3329 END DO
3330 IF (k == 2) CALL cp_abort(__location__, &
3331 "Only a single constraint possible yet, try to use restraints instead ")
3332
3333 END SUBROUTINE read_ddapc_section
3334
3335! **************************************************************************************************
3336!> \brief ...
3337!> \param dft_control ...
3338!> \param efield_section ...
3339!> \param cell ...
3340! **************************************************************************************************
3341 SUBROUTINE read_efield_sections(dft_control, efield_section, cell)
3342 TYPE(dft_control_type), POINTER :: dft_control
3343 TYPE(section_vals_type), POINTER :: efield_section
3344 TYPE(cell_type), OPTIONAL, POINTER :: cell
3345
3346 CHARACTER(len=default_path_length) :: file_name
3347 INTEGER :: i, io, j, n, unit_nr
3348 LOGICAL :: amplitude_explicit, intensity_explicit
3349 REAL(kind=dp), DIMENSION(:), POINTER :: tmp_vals
3350 TYPE(efield_type), POINTER :: efield
3351 TYPE(section_vals_type), POINTER :: tmp_section
3352
3353 DO i = 1, SIZE(dft_control%efield_fields)
3354 NULLIFY (dft_control%efield_fields(i)%efield)
3355 ALLOCATE (dft_control%efield_fields(i)%efield)
3356 efield => dft_control%efield_fields(i)%efield
3357 NULLIFY (efield%envelop_i_vars, efield%envelop_r_vars)
3358 CALL section_vals_val_get(efield_section, "INTENSITY", i_rep_section=i, &
3359 r_val=efield%strength, explicit=intensity_explicit)
3360 CALL section_vals_val_get(efield_section, "AMPLITUDE", i_rep_section=i, &
3361 r_val=efield%amplitude, explicit=amplitude_explicit)
3362
3363 IF (intensity_explicit .AND. amplitude_explicit) THEN
3364 cpabort("Both INTENSITY and AMPLITUDE provided in EFIELD section.")
3365 END IF
3366
3367 IF (intensity_explicit) THEN
3368 efield%amplitude = sqrt(efield%strength/(3.50944_dp*10.0_dp**16))
3369 END IF
3370
3371 IF (amplitude_explicit) THEN
3372 efield%strength = (3.50944_dp*10.0_dp**16)*(efield%amplitude)**2
3373 END IF
3374
3375 CALL section_vals_val_get(efield_section, "POLARISATION", i_rep_section=i, &
3376 r_vals=tmp_vals)
3377 ALLOCATE (efield%polarisation(SIZE(tmp_vals)))
3378 efield%polarisation = tmp_vals
3379 IF (PRESENT(cell)) THEN
3380 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%polarisation(1:3))
3381 END IF
3382 CALL section_vals_val_get(efield_section, "PHASE", i_rep_section=i, &
3383 r_val=efield%phase_offset)
3384 CALL section_vals_val_get(efield_section, "ENVELOP", i_rep_section=i, &
3385 i_val=efield%envelop_id)
3386 CALL section_vals_val_get(efield_section, "WAVELENGTH", i_rep_section=i, &
3387 r_val=efield%wavelength)
3388 CALL section_vals_val_get(efield_section, "VEC_POT_INITIAL", i_rep_section=i, &
3389 r_vals=tmp_vals)
3390 efield%vec_pot_initial = tmp_vals
3391 IF (PRESENT(cell)) THEN
3392 IF (ASSOCIATED(cell)) CALL cell_transform_input_cartesian(cell, efield%vec_pot_initial(1:3))
3393 END IF
3394
3395 IF (efield%envelop_id == constant_env) THEN
3396 ALLOCATE (efield%envelop_i_vars(2))
3397 tmp_section => section_vals_get_subs_vals(efield_section, "CONSTANT_ENV", i_rep_section=i)
3398 CALL section_vals_val_get(tmp_section, "START_STEP", &
3399 i_val=efield%envelop_i_vars(1))
3400 CALL section_vals_val_get(tmp_section, "END_STEP", &
3401 i_val=efield%envelop_i_vars(2))
3402 ELSE IF (efield%envelop_id == gaussian_env) THEN
3403 ALLOCATE (efield%envelop_r_vars(2))
3404 tmp_section => section_vals_get_subs_vals(efield_section, "GAUSSIAN_ENV", i_rep_section=i)
3405 CALL section_vals_val_get(tmp_section, "T0", &
3406 r_val=efield%envelop_r_vars(1))
3407 CALL section_vals_val_get(tmp_section, "SIGMA", &
3408 r_val=efield%envelop_r_vars(2))
3409 ELSE IF (efield%envelop_id == ramp_env) THEN
3410 ALLOCATE (efield%envelop_i_vars(4))
3411 tmp_section => section_vals_get_subs_vals(efield_section, "RAMP_ENV", i_rep_section=i)
3412 CALL section_vals_val_get(tmp_section, "START_STEP_IN", &
3413 i_val=efield%envelop_i_vars(1))
3414 CALL section_vals_val_get(tmp_section, "END_STEP_IN", &
3415 i_val=efield%envelop_i_vars(2))
3416 CALL section_vals_val_get(tmp_section, "START_STEP_OUT", &
3417 i_val=efield%envelop_i_vars(3))
3418 CALL section_vals_val_get(tmp_section, "END_STEP_OUT", &
3419 i_val=efield%envelop_i_vars(4))
3420 ELSE IF (efield%envelop_id == custom_env) THEN
3421 tmp_section => section_vals_get_subs_vals(efield_section, "CUSTOM_ENV", i_rep_section=i)
3422 CALL section_vals_val_get(tmp_section, "EFIELD_FILE_NAME", c_val=file_name)
3423 CALL open_file(file_name=trim(file_name), file_action="READ", file_status="OLD", unit_number=unit_nr)
3424 !Determine the number of lines in file
3425 n = 0
3426 DO WHILE (.true.)
3427 READ (unit_nr, *, iostat=io)
3428 IF (io /= 0) EXIT
3429 n = n + 1
3430 END DO
3431 rewind(unit_nr)
3432 ALLOCATE (efield%envelop_r_vars(n + 1))
3433 !Store the timestep of the list in the first entry of the r_vars
3434 CALL section_vals_val_get(tmp_section, "TIMESTEP", r_val=efield%envelop_r_vars(1))
3435 !Read the file
3436 DO j = 2, n + 1
3437 READ (unit_nr, *) efield%envelop_r_vars(j)
3438 efield%envelop_r_vars(j) = cp_unit_to_cp2k(efield%envelop_r_vars(j), "volt/m")
3439 END DO
3440 CALL close_file(unit_nr)
3441 END IF
3442 END DO
3443 END SUBROUTINE read_efield_sections
3444
3445! **************************************************************************************************
3446!> \brief reads the input parameters needed real time propagation
3447!> \param dft_control ...
3448!> \param rtp_section ...
3449!> \author fschiff
3450! **************************************************************************************************
3451 SUBROUTINE read_rtp_section(dft_control, rtp_section)
3452
3453 TYPE(dft_control_type), INTENT(INOUT) :: dft_control
3454 TYPE(section_vals_type), POINTER :: rtp_section
3455
3456 INTEGER :: i, j, n_elems
3457 INTEGER, DIMENSION(:), POINTER :: tmp
3458 LOGICAL :: is_present, linearize_bse_propagation, &
3459 local_moment_possible
3460 TYPE(section_vals_type), POINTER :: proj_mo_section, subsection
3461
3462 ALLOCATE (dft_control%rtp_control)
3463 CALL section_vals_val_get(rtp_section, "MAX_ITER", &
3464 i_val=dft_control%rtp_control%max_iter)
3465 CALL section_vals_val_get(rtp_section, "MAT_EXP", &
3466 i_val=dft_control%rtp_control%mat_exp)
3467 CALL section_vals_val_get(rtp_section, "ASPC_ORDER", &
3468 i_val=dft_control%rtp_control%aspc_order)
3469 CALL section_vals_val_get(rtp_section, "EXP_ACCURACY", &
3470 r_val=dft_control%rtp_control%eps_exp)
3471 CALL section_vals_val_get(rtp_section, "RTBSE%_SECTION_PARAMETERS_", &
3472 i_val=dft_control%rtp_control%rtp_method)
3473 CALL section_vals_val_get(rtp_section, "RTBSE%RTBSE_HAMILTONIAN", &
3474 i_val=dft_control%rtp_control%rtbse_ham)
3475 CALL section_vals_val_get(rtp_section, "RTBSE%LINEARIZED_BSE_PROPAGATION", &
3476 l_val=linearize_bse_propagation)
3477 ! Change rtp_method to linearized bse. The section parameter also feeds bs_env%rtp_method,
3478 ! which gates the W(w=0) build in the GW step - TDDFT there would dispatch the linearized
3479 ! propagator with no screened interaction to propagate with, so reject the combination.
3480 IF (linearize_bse_propagation) THEN
3481 IF (dft_control%rtp_control%rtp_method /= rtp_method_bse) THEN
3482 CALL cp_abort(__location__, &
3483 "LINEARIZED_BSE_PROPAGATION requires the RTBSE section opened as "// &
3484 "'&RTBSE' or '&RTBSE RTBSE', not '&RTBSE TDDFT'.")
3485 END IF
3486 dft_control%rtp_control%rtp_method = rtp_method_bse_linearized
3487 END IF
3488
3489 CALL section_vals_val_get(rtp_section, "PROPAGATOR", &
3490 i_val=dft_control%rtp_control%propagator)
3491 CALL section_vals_val_get(rtp_section, "EPS_ITER", &
3492 r_val=dft_control%rtp_control%eps_ener)
3493 CALL section_vals_val_get(rtp_section, "INITIAL_WFN", &
3494 i_val=dft_control%rtp_control%initial_wfn)
3495 CALL section_vals_val_get(rtp_section, "HFX_BALANCE_IN_CORE", &
3496 l_val=dft_control%rtp_control%hfx_redistribute)
3497 CALL section_vals_val_get(rtp_section, "APPLY_WFN_MIX_INIT_RESTART", &
3498 l_val=dft_control%rtp_control%apply_wfn_mix_init_restart)
3499 CALL section_vals_val_get(rtp_section, "APPLY_DELTA_PULSE", &
3500 l_val=dft_control%rtp_control%apply_delta_pulse)
3501 CALL section_vals_val_get(rtp_section, "APPLY_DELTA_PULSE_MAG", &
3502 l_val=dft_control%rtp_control%apply_delta_pulse_mag)
3503 CALL section_vals_val_get(rtp_section, "VELOCITY_GAUGE", &
3504 l_val=dft_control%rtp_control%velocity_gauge)
3505 CALL section_vals_val_get(rtp_section, "VG_COM_NL", &
3506 l_val=dft_control%rtp_control%nl_gauge_transform)
3507 CALL section_vals_val_get(rtp_section, "PERIODIC", &
3508 l_val=dft_control%rtp_control%periodic)
3509 CALL section_vals_val_get(rtp_section, "DENSITY_PROPAGATION", &
3510 l_val=dft_control%rtp_control%linear_scaling)
3511 CALL section_vals_val_get(rtp_section, "MCWEENY_MAX_ITER", &
3512 i_val=dft_control%rtp_control%mcweeny_max_iter)
3513 CALL section_vals_val_get(rtp_section, "ACCURACY_REFINEMENT", &
3514 i_val=dft_control%rtp_control%acc_ref)
3515 CALL section_vals_val_get(rtp_section, "MCWEENY_EPS", &
3516 r_val=dft_control%rtp_control%mcweeny_eps)
3517 CALL section_vals_val_get(rtp_section, "DELTA_PULSE_SCALE", &
3518 r_val=dft_control%rtp_control%delta_pulse_scale)
3519 CALL section_vals_val_get(rtp_section, "DELTA_PULSE_DIRECTION", &
3520 i_vals=tmp)
3521 dft_control%rtp_control%delta_pulse_direction = tmp
3522 CALL section_vals_val_get(rtp_section, "SC_CHECK_START", &
3523 i_val=dft_control%rtp_control%sc_check_start)
3524 proj_mo_section => section_vals_get_subs_vals(rtp_section, "PRINT%PROJECTION_MO")
3525 CALL section_vals_get(proj_mo_section, explicit=is_present)
3526 IF (is_present) THEN
3527 IF (dft_control%rtp_control%linear_scaling) THEN
3528 CALL cp_abort(__location__, &
3529 "You have defined a time dependent projection of mos, but "// &
3530 "only the density matrix is propagated (DENSITY_PROPAGATION "// &
3531 ".TRUE.). Please either use MO-based real time DFT or do not "// &
3532 "define any PRINT%PROJECTION_MO section")
3533 END IF
3534 dft_control%rtp_control%is_proj_mo = .true.
3535 ELSE
3536 dft_control%rtp_control%is_proj_mo = .false.
3537 END IF
3538 ! Moment trace
3539 local_moment_possible = (dft_control%rtp_control%rtp_method == rtp_method_bse .OR. &
3540 dft_control%rtp_control%rtp_method == rtp_method_bse_linearized) .OR. &
3541 ((.NOT. dft_control%rtp_control%periodic) .AND. dft_control%rtp_control%linear_scaling)
3542 ! TODO : Implement for other moment operators
3543 subsection => section_vals_get_subs_vals(rtp_section, "PRINT%MOMENTS")
3544 CALL section_vals_get(subsection, explicit=is_present)
3545 ! Trigger the flag
3546 dft_control%rtp_control%save_local_moments = &
3547 is_present .OR. dft_control%rtp_control%save_local_moments
3548 IF (is_present .AND. (.NOT. local_moment_possible)) THEN
3549 CALL cp_abort(__location__, "Moments trace printing only "// &
3550 "implemented in non-periodic systems in linear scaling. "// &
3551 "Please use DFT%PRINT%MOMENTS for other printing.")
3552 END IF
3553 CALL section_vals_val_get(rtp_section, "PRINT%MOMENTS%REFERENCE", &
3554 i_val=dft_control%rtp_control%moment_trace_ref_type)
3555 CALL section_vals_val_get(rtp_section, "PRINT%MOMENTS%REFERENCE_POINT", &
3556 r_vals=dft_control%rtp_control%moment_trace_user_ref_point)
3557 ! Moment Fourier transform
3558 subsection => section_vals_get_subs_vals(rtp_section, "PRINT%MOMENTS_FT")
3559 CALL section_vals_get(subsection, explicit=is_present)
3560 ! Trigger the flag
3561 dft_control%rtp_control%save_local_moments = &
3562 is_present .OR. dft_control%rtp_control%save_local_moments
3563 IF (is_present .AND. (.NOT. local_moment_possible)) THEN
3564 ! Not implemented
3565 CALL cp_abort(__location__, "Moments Fourier transform printing "// &
3566 "implemented only for non-periodic systems in linear scaling.")
3567 END IF
3568 ! General FT settings
3569 CALL section_vals_val_get(rtp_section, "FT%DAMPING", &
3570 r_val=dft_control%rtp_control%ft_damping)
3571 CALL section_vals_val_get(rtp_section, "FT%START_TIME", &
3572 r_val=dft_control%rtp_control%ft_t0)
3573 ! Padé settings
3574 subsection => section_vals_get_subs_vals(rtp_section, "FT%PADE")
3575 CALL section_vals_val_get(subsection, "_SECTION_PARAMETERS_", &
3576 l_val=dft_control%rtp_control%pade_requested)
3577 CALL section_vals_val_get(subsection, "E_MIN", &
3578 r_val=dft_control%rtp_control%pade_e_min)
3579 CALL section_vals_val_get(subsection, "E_STEP", &
3580 r_val=dft_control%rtp_control%pade_e_step)
3581 CALL section_vals_val_get(subsection, "E_MAX", &
3582 r_val=dft_control%rtp_control%pade_e_max)
3583 CALL section_vals_val_get(subsection, "FIT_E_MIN", &
3584 r_val=dft_control%rtp_control%pade_fit_e_min)
3585 CALL section_vals_val_get(subsection, "FIT_E_MAX", &
3586 r_val=dft_control%rtp_control%pade_fit_e_max)
3587 ! If default settings used for fit_e_min/max, rewrite with appropriate values
3588 IF (dft_control%rtp_control%pade_fit_e_min < 0) THEN
3589 dft_control%rtp_control%pade_fit_e_min = dft_control%rtp_control%pade_e_min
3590 END IF
3591 IF (dft_control%rtp_control%pade_fit_e_max < 0) THEN
3592 dft_control%rtp_control%pade_fit_e_max = dft_control%rtp_control%pade_e_max
3593 END IF
3594 ! Polarizability settings
3595 subsection => section_vals_get_subs_vals(rtp_section, "PRINT%POLARIZABILITY")
3596 CALL section_vals_get(subsection, explicit=is_present)
3597 ! Trigger the flag
3598 dft_control%rtp_control%save_local_moments = &
3599 is_present .OR. dft_control%rtp_control%save_local_moments
3600 IF (is_present .AND. (.NOT. local_moment_possible)) THEN
3601 ! Not implemented
3602 CALL cp_abort(__location__, "Polarizability printing "// &
3603 "implemented only for non-periodic systems.")
3604 END IF
3605 CALL section_vals_val_get(subsection, "ELEMENT", explicit=is_present, n_rep_val=n_elems)
3606 NULLIFY (dft_control%rtp_control%print_pol_elements)
3607 IF (is_present) THEN
3608 ! Explicit list of elements
3609 ! Allocate the array
3610 ALLOCATE (dft_control%rtp_control%print_pol_elements(n_elems, 2))
3611 DO i = 1, n_elems
3612 CALL section_vals_val_get(subsection, "ELEMENT", i_vals=tmp, i_rep_val=i)
3613 dft_control%rtp_control%print_pol_elements(i, :) = tmp(:)
3614 END DO
3615 ! Do basic sanity checks for pol_element
3616 DO i = 1, n_elems
3617 DO j = 1, 2
3618 IF (dft_control%rtp_control%print_pol_elements(i, j) > 3 .OR. &
3619 dft_control%rtp_control%print_pol_elements(i, j) < 1) THEN
3620 cpabort("Polarisation tensor element not 1,2 or 3 in at least one index")
3621 END IF
3622 END DO
3623 END DO
3624 END IF
3625
3626 ! Finally, allow printing of FT observables also in the case when they are not explicitly
3627 ! required, but they are available, i.e. non-periodic linear scaling calculation
3628 dft_control%rtp_control%save_local_moments = &
3629 dft_control%rtp_control%save_local_moments .OR. &
3630 ((.NOT. dft_control%rtp_control%periodic) .AND. dft_control%rtp_control%linear_scaling)
3631
3632 END SUBROUTINE read_rtp_section
3633! **************************************************************************************************
3634!> \brief Tries to guess the elements of polarization to print
3635!> \param dftc DFT parameters
3636!> \param elems 2D array, where the guessed element indeces are stored
3637!> \date 11.2025
3638!> \author Stepan Marek
3639! **************************************************************************************************
3640 SUBROUTINE guess_pol_elements(dftc, elems)
3641 TYPE(dft_control_type) :: dftc
3642 INTEGER, DIMENSION(:, :), POINTER :: elems
3643
3644 INTEGER :: i, i_nonzero, n_nonzero
3645 LOGICAL :: pol_vector_known
3646 REAL(kind=dp), DIMENSION(3) :: pol_vector
3647
3648 pol_vector_known = .false.
3649
3650 ! TODO : More relevant elements for magnetic pulse?
3651 IF (dftc%rtp_control%apply_delta_pulse .OR. dftc%rtp_control%apply_delta_pulse_mag) THEN
3652 pol_vector(:) = real(dftc%rtp_control%delta_pulse_direction(:), kind=dp)
3653 ELSE
3654 ! Maybe RT field is applied?
3655 pol_vector(:) = dftc%efield_fields(1)%efield%polarisation(:)
3656 END IF
3657 IF (dot_product(pol_vector, pol_vector) > 0.0_dp) pol_vector_known = .true.
3658
3659 IF (.NOT. pol_vector_known) THEN
3660 cpabort("Cannot guess polarization elements - please specify!")
3661 ELSE
3662 ! Check whether just one element is non-zero
3663 n_nonzero = 0
3664 DO i = 1, 3
3665 IF (pol_vector(i) /= 0.0_dp) THEN
3666 n_nonzero = n_nonzero + 1
3667 i_nonzero = i
3668 END IF
3669 END DO
3670 IF (n_nonzero > 1) THEN
3671 CALL cp_abort(__location__, &
3672 "More than one non-zero field elements - "// &
3673 "cannot guess polarizability elements - please specify!")
3674 ELSE IF (n_nonzero == 0) THEN
3675 CALL cp_abort(__location__, &
3676 "No non-zero field elements - "// &
3677 "cannot guess polarizability elements - please specify!")
3678 ELSE
3679 ! Clear guess can be made
3680 NULLIFY (elems)
3681 ALLOCATE (elems(3, 2))
3682 DO i = 1, 3
3683 elems(i, 1) = i
3684 elems(i, 2) = i_nonzero
3685 END DO
3686 END IF
3687 END IF
3688 END SUBROUTINE guess_pol_elements
3689
3690! **************************************************************************************************
3691!> \brief Parses the BLOCK_LIST keywords from the ADMM section
3692!> \param admm_control ...
3693!> \param dft_section ...
3694! **************************************************************************************************
3695 SUBROUTINE read_admm_block_list(admm_control, dft_section)
3696 TYPE(admm_control_type), POINTER :: admm_control
3697 TYPE(section_vals_type), POINTER :: dft_section
3698
3699 INTEGER :: irep, list_size, n_rep
3700 INTEGER, DIMENSION(:), POINTER :: tmplist
3701
3702 NULLIFY (tmplist)
3703
3704 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%BLOCK_LIST", &
3705 n_rep_val=n_rep)
3706
3707 ALLOCATE (admm_control%blocks(n_rep))
3708
3709 DO irep = 1, n_rep
3710 CALL section_vals_val_get(dft_section, "AUXILIARY_DENSITY_MATRIX_METHOD%BLOCK_LIST", &
3711 i_rep_val=irep, i_vals=tmplist)
3712 list_size = SIZE(tmplist)
3713 ALLOCATE (admm_control%blocks(irep)%list(list_size))
3714 admm_control%blocks(irep)%list(:) = tmplist(:)
3715 END DO
3716
3717 END SUBROUTINE read_admm_block_list
3718
3719! **************************************************************************************************
3720!> \brief ...
3721!> \param dft_control ...
3722!> \param hairy_probes_section ...
3723!> \param
3724!> \param
3725! **************************************************************************************************
3726 SUBROUTINE read_hairy_probes_sections(dft_control, hairy_probes_section)
3727 TYPE(dft_control_type), POINTER :: dft_control
3728 TYPE(section_vals_type), POINTER :: hairy_probes_section
3729
3730 INTEGER :: i, j, jj, kk, n_rep
3731 INTEGER, DIMENSION(:), POINTER :: tmplist
3732
3733 DO i = 1, SIZE(dft_control%probe)
3734 NULLIFY (dft_control%probe(i)%atom_ids)
3735
3736 CALL section_vals_val_get(hairy_probes_section, "ATOM_IDS", i_rep_section=i, n_rep_val=n_rep)
3737 jj = 0
3738 DO kk = 1, n_rep
3739 CALL section_vals_val_get(hairy_probes_section, "ATOM_IDS", i_rep_section=i, i_rep_val=kk, i_vals=tmplist)
3740 jj = jj + SIZE(tmplist)
3741 END DO
3742
3743 dft_control%probe(i)%natoms = jj
3744 IF (dft_control%probe(i)%natoms < 1) THEN
3745 cpabort("Need at least 1 atom to use hair probes formalism")
3746 END IF
3747 ALLOCATE (dft_control%probe(i)%atom_ids(dft_control%probe(i)%natoms))
3748
3749 jj = 0
3750 DO kk = 1, n_rep
3751 CALL section_vals_val_get(hairy_probes_section, "ATOM_IDS", i_rep_section=i, i_rep_val=kk, i_vals=tmplist)
3752 DO j = 1, SIZE(tmplist)
3753 jj = jj + 1
3754 dft_control%probe(i)%atom_ids(jj) = tmplist(j)
3755 END DO
3756 END DO
3757
3758 CALL section_vals_val_get(hairy_probes_section, "MU", i_rep_section=i, r_val=dft_control%probe(i)%mu)
3759
3760 CALL section_vals_val_get(hairy_probes_section, "T", i_rep_section=i, r_val=dft_control%probe(i)%T)
3761
3762 CALL section_vals_val_get(hairy_probes_section, "ALPHA", i_rep_section=i, r_val=dft_control%probe(i)%alpha)
3763
3764 CALL section_vals_val_get(hairy_probes_section, "eps_hp", i_rep_section=i, r_val=dft_control%probe(i)%eps_hp)
3765 END DO
3766
3767 END SUBROUTINE read_hairy_probes_sections
3768! **************************************************************************************************
3769
3770END MODULE cp_control_utils
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public vandevondele2005b
integer, save, public umari2002
integer, save, public katbashev2025
integer, save, public yin2017
integer, save, public stewart2007
integer, save, public stengel2009
integer, save, public vandevondele2005a
integer, save, public andreussi2019
integer, save, public grimme2017
integer, save, public lippert1999
integer, save, public dewar1977
integer, save, public elstner1998
integer, save, public vanvoorhis2015
integer, save, public repasky2002
integer, save, public hu2007
integer, save, public andreussi2012
integer, save, public rocha2006
integer, save, public lippert1997
integer, save, public chai2025a
integer, save, public fattebert2002
integer, save, public thiel1992
integer, save, public pracht2019
integer, save, public porezag1995
integer, save, public souza2002
integer, save, public schenter2008
integer, save, public krack2000
integer, save, public dewar1985
integer, save, public stewart1989
integer, save, public seifert1996
integer, save, public zhechkov2005
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_transform_input_cartesian(cell, vector)
Transform a Cartesian real-space vector from the user input cell frame into CP2K's canonical internal...
Definition cell_types.F:284
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dft_control_create(dft_control)
allocates and perform a very basic initialization
subroutine, public fde_control_create(fde_control)
...
subroutine, public expot_control_create(expot_control)
...
subroutine, public maxwell_control_create(maxwell_control)
...
subroutine, public ddapc_control_create(ddapc_restraint_control)
create the ddapc_restraint_type
subroutine, public admm_control_create(admm_control)
...
Utilities to set up the control types.
subroutine, public write_qs_control(qs_control, dft_section)
Purpose: Write the QS control parameters to the output unit.
subroutine, public read_rixs_control(rixs_control, rixs_section, qs_control)
Reads the input and stores in the rixs_control_type.
subroutine, public read_qs_section(qs_control, qs_section, cell)
...
subroutine, public read_tddfpt2_control(t_control, t_section, qs_control)
Read TDDFPT-related input parameters.
subroutine, public read_dft_control(dft_control, dft_section, cell)
...
subroutine, public write_admm_control(admm_control, dft_section)
Write the ADMM control parameters to the output unit.
subroutine, public write_dft_control(dft_control, dft_section)
Write the DFT control parameters to the output unit.
subroutine, public read_ddapc_section(qs_control, qs_section, ddapc_restraint_section)
reads the input parameters needed for ddapc.
subroutine, public read_mgrid_section(qs_control, dft_section)
...
Utility routines to open and close files. Tracking of preconnections.
Definition cp_files.F:16
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
Definition cp_files.F:323
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
Definition cp_files.F:123
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_read_line(parser, nline, at_end)
Read the next line from a logical unit "unit" (I/O node only). Skip (nline-1) lines and skip also all...
Utility routines to read data from files. Kept as close as possible to the old parser because.
subroutine, public parser_reset(parser)
Resets the parser: rewinding the unit and re-initializing all parser structures.
subroutine, public parser_release(parser)
releases the parser
subroutine, public parser_create(parser, file_name, unit_nr, para_env, end_section_label, separator_chars, comment_char, continuation_char, quote_char, section_char, parse_white_lines, initial_variables, apply_preprocessing)
Start a parser run. Initial variables allow to @SET stuff before opening the file.
utils to manipulate splines on the regular grid of a pw
integer, parameter, public pw_interp
unit conversion facility
Definition cp_units.F:30
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
Definition cp_units.F:1251
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Definition cp_units.F:1222
Input definition and setup for EEQ model.
Definition eeq_input.F:12
subroutine, public read_eeq_param(eeq_section, eeq_sparam)
...
Definition eeq_input.F:123
subroutine, public read_gp_section(nonbonded, section, start)
Reads the GENPOT - generic potential section.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public sic_list_unpaired
integer, parameter, public sic_mauri_spz
integer, parameter, public rtp_method_bse_linearized
integer, parameter, public do_method_ofgpw
integer, parameter, public do_admm_purify_mo_no_diag
integer, parameter, public do_se_lr_ewald_gks
integer, parameter, public do_admm_aux_exch_func_opt_libxc
integer, parameter, public gfn1xtb
integer, parameter, public do_s2_restraint
integer, parameter, public do_admm_purify_none
integer, parameter, public do_method_rigpw
integer, parameter, public do_s2_constraint
integer, parameter, public use_mom_ref_user
integer, parameter, public do_method_gpw
integer, parameter, public gapw_1c_large
integer, parameter, public tblite_scc_mixer_cp2k
integer, parameter, public do_method_pdg
integer, parameter, public do_admm_purify_none_dm
integer, parameter, public do_method_pnnl
integer, parameter, public do_ddapc_constraint
integer, parameter, public tblite_scc_mixer_none
integer, parameter, public tblite_mixer_memory_inherit
integer, parameter, public do_se_lr_none
integer, parameter, public do_admm_purify_mcweeny
integer, parameter, public do_se_lr_ewald
integer, parameter, public do_admm_blocking_purify_full
integer, parameter, public ramp_env
integer, parameter, public tblite_solver_gvd
integer, parameter, public do_se_is_kdso_d
integer, parameter, public gapw_1c_medium
integer, parameter, public do_admm_aux_exch_func_sx_libxc
integer, parameter, public tblite_cli_solution_state_gsolv
integer, parameter, public admm2_type
integer, parameter, public xtb_vdw_type_d3
integer, parameter, public sic_list_all
integer, parameter, public constant_env
integer, parameter, public kg_tnadd_embed_ri
integer, parameter, public tblite_cli_solvation_gb
integer, parameter, public kg_tnadd_embed
integer, parameter, public sic_eo
integer, parameter, public sccs_derivative_cd5
integer, parameter, public do_admm_aux_exch_func_bee
integer, parameter, public tblite_solver_gvr
integer, parameter, public sccs_saa_andreussi
integer, parameter, public no_admm_type
integer, parameter, public do_admm_blocked_projection
integer, parameter, public tblite_scc_mixer_tblite
integer, parameter, public do_admm_basis_projection
integer, parameter, public do_method_rm1
integer, parameter, public do_admm_aux_exch_func_default_libxc
integer, parameter, public do_admm_aux_exch_func_opt
integer, parameter, public gapw_1c_small
integer, parameter, public do_admm_aux_exch_func_none
integer, parameter, public do_admm_purify_cauchy_subspace
integer, parameter, public do_method_pm3
integer, parameter, public do_admm_aux_exch_func_bee_libxc
integer, parameter, public tblite_cli_solvation_alpb
integer, parameter, public admm1_type
integer, parameter, public do_admm_aux_exch_func_pbex_libxc
integer, parameter, public tblite_cli_born_kernel_auto
integer, parameter, public do_method_mndo
integer, parameter, public gapw_1c_orb
integer, parameter, public do_admm_aux_exch_func_default
integer, parameter, public xtb_vdw_type_d4
integer, parameter, public do_pwgrid_ns_fullspace
integer, parameter, public gapw_1c_very_large
integer, parameter, public rtp_method_bse
integer, parameter, public do_method_gapw
integer, parameter, public admms_type
integer, parameter, public do_admm_charge_constrained_projection
integer, parameter, public do_admm_purify_cauchy
integer, parameter, public sccs_fattebert_gygi
integer, parameter, public tblite_scc_mixer_auto
integer, parameter, public gaussian_env
integer, parameter, public tblite_cli_solvation_cpcm
integer, parameter, public sccs_derivative_cd7
integer, parameter, public do_method_mndod
integer, parameter, public xtb_vdw_type_none
integer, parameter, public do_method_am1
integer, parameter, public do_method_dftb
integer, parameter, public tddfpt_dipole_length
integer, parameter, public tblite_cli_solvation_gbe
integer, parameter, public sccs_derivative_fft
integer, parameter, public tddfpt_kernel_stda
integer, parameter, public do_pwgrid_spherical
integer, parameter, public gfn_tblite
integer, parameter, public do_se_lr_ewald_r3
integer, parameter, public do_se_is_kdso
integer, parameter, public do_admm_purify_mo_diag
integer, parameter, public do_method_lrigpw
integer, parameter, public tblite_cli_solvation_gbsa
integer, parameter, public sic_mauri_us
integer, parameter, public sic_none
integer, parameter, public do_se_is_slater
integer, parameter, public custom_env
integer, parameter, public tblite_guess_ceh
integer, parameter, public do_method_xtb
integer, parameter, public do_ddapc_restraint
integer, parameter, public do_pwgrid_ns_halfspace
integer, parameter, public sccs_derivative_cd3
integer, parameter, public do_method_pm6fm
integer, parameter, public admmq_type
integer, parameter, public sccs_andreussi
integer, parameter, public sic_ad
integer, parameter, public do_admm_exch_scaling_none
integer, parameter, public admmp_type
integer, parameter, public do_method_gapw_xc
integer, parameter, public do_admm_exch_scaling_merlot
integer, parameter, public real_time_propagation
integer, parameter, public numerical
integer, parameter, public do_method_pm6
integer, parameter, public do_admm_aux_exch_func_pbex
integer, parameter, public slater
checks the input and perform some automatic "magic" on it
subroutine, public xc_functionals_expand(functionals, xc_section)
expand a shortcutted functional section
function that build the dft section of the input
subroutine, public create_dft_section(section)
creates the dft section
represents an enumeration, i.e. a mapping between integers and strings
character(len=default_string_length) function, public enum_i2c(enum, i)
maps an integer to a string
represents keywords in an input
subroutine, public keyword_get(keyword, names, usage, description, type_of_var, n_var, default_value, lone_keyword_value, repeats, enum, citations)
...
objects that represent the structure of input sections and the data contained in an input section
subroutine, public section_vals_val_set(section_vals, keyword_name, i_rep_section, i_rep_val, val, l_val, i_val, r_val, c_val, l_vals_ptr, i_vals_ptr, r_vals_ptr, c_vals_ptr)
sets the requested value
integer function, public section_get_ival(section_vals, keyword_name)
...
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
recursive subroutine, public section_release(section)
releases the given keyword list (see doc/ReferenceCounting.html)
recursive type(keyword_type) function, pointer, public section_get_keyword(section, keyword_name)
returns the requested keyword
subroutine, public section_vals_get(section_vals, ref_count, n_repetition, n_subs_vals_rep, section, explicit)
returns various attributes about the section_vals
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public default_path_length
Definition kinds.F:58
Definition of mathematical constants and functions.
real(kind=dp), parameter, public fourpi
subroutine, public pair_potential_reallocate(p, lb1_new, ub1_new, lj, lj_charmm, williams, goodwin, eam, nequip, bmhft, bmhftd, ipbv, buck4r, buckmo, gp, tersoff, siepmann, gal, gal21, tab, deepmd, ace)
Cleans the potential parameter type.
Periodic Table related data definitions.
subroutine, public get_ptable_info(symbol, number, amass, ielement, covalent_radius, metallic_radius, vdw_radius, found)
Pass information about the kind given the element symbol.
Utility subroutines for CDFT calculations.
subroutine, public read_cdft_control_section(qs_control, cdft_control_section)
reads the input parameters needed for CDFT with OT
Input control types for NEGF/SMEAGOL transport calculations.
subroutine, public read_smeagol_control(smeagol_control, smeagol_section)
Read SMEAGOL-related input parameters.
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
All kind of helpful little routines.
Definition util.F:14
Define XAS TDP control type and associated create, release, etc subroutines, as well as XAS TDP envir...
subroutine, public read_xas_tdp_control(xas_tdp_control, xas_tdp_section)
Reads the inputs and stores in xas_tdp_control_type.
input constants for xc
integer, parameter, public xc_deriv_collocate
Writes information on XC functionals to output.
subroutine, public xc_write(iounit, xc_section, lsd)
...
Exchange and Correlation functional calculations.
Definition xc.F:17
logical function, public xc_uses_norm_drho(xc_fun_section, lsd)
...
Definition xc.F:119
logical function, public xc_uses_kinetic_energy_density(xc_fun_section, lsd)
...
Definition xc.F:99
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represent a keyword in the input
represent a section of the input file