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