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