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