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