(git:d18deda)
Loading...
Searching...
No Matches
qs_environment.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2025 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> - Merged with the Quickstep MODULE method_specification (17.01.2002,MK)
11!> - USE statements cleaned, added
12!> (25.09.2002,MK)
13!> - Added more LSD structure (01.2003,Joost VandeVondele)
14!> - New molecule data types introduced (Sep. 2003,MK)
15!> - Cleaning; getting rid of pnode (02.10.2003,MK)
16!> - Sub-system setup added (08.10.2003,MK)
17!> \author MK (18.05.2000)
18! **************************************************************************************************
30 USE bibliography, ONLY: iannuzzi2006,&
32 cite_reference,&
34 USE cell_types, ONLY: cell_type
56 USE cp_output_handling, ONLY: cp_p_file,&
66 USE ec_environment, ONLY: ec_env_create,&
85 USE gamma, ONLY: init_md_ftable
88 USE header, ONLY: dftb_header,&
89 qs_header,&
90 se_header,&
94 USE input_constants, ONLY: &
109 USE kinds, ONLY: default_string_length,&
110 dp
114 USE kpoint_types, ONLY: get_kpoint_info,&
122 USE machine, ONLY: m_flush
123 USE mathconstants, ONLY: pi
128 USE mp2_setup, ONLY: read_mp2_section
129 USE mp2_types, ONLY: mp2_env_create,&
138 USE pw_env_types, ONLY: pw_env_type
155 USE qs_gcp_types, ONLY: qs_gcp_type
156 USE qs_gcp_utils, ONLY: qs_gcp_env_set,&
169 USE qs_kind_types, ONLY: &
172 USE qs_ks_types, ONLY: qs_ks_env_create,&
176 USE qs_mo_types, ONLY: allocate_mo_set,&
179 USE qs_rho0_methods, ONLY: init_rho0
184 USE qs_subsys_types, ONLY: qs_subsys_get,&
208 USE xtb_parameters, ONLY: init_xtb_basis,&
213#include "./base/base_uses.f90"
214
215 IMPLICIT NONE
216
217 PRIVATE
218
219 ! *** Global parameters ***
220 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_environment'
221
222 ! *** Public subroutines ***
223 PUBLIC :: qs_init
224
225CONTAINS
226
227! **************************************************************************************************
228!> \brief Read the input and the database files for the setup of the
229!> QUICKSTEP environment.
230!> \param qs_env ...
231!> \param para_env ...
232!> \param root_section ...
233!> \param globenv ...
234!> \param cp_subsys ...
235!> \param kpoint_env ...
236!> \param cell ...
237!> \param cell_ref ...
238!> \param qmmm ...
239!> \param qmmm_env_qm ...
240!> \param force_env_section ...
241!> \param subsys_section ...
242!> \param use_motion_section ...
243!> \param silent ...
244!> \author Creation (22.05.2000,MK)
245! **************************************************************************************************
246 SUBROUTINE qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, cell, cell_ref, &
247 qmmm, qmmm_env_qm, force_env_section, subsys_section, &
248 use_motion_section, silent)
249
250 TYPE(qs_environment_type), POINTER :: qs_env
251 TYPE(mp_para_env_type), POINTER :: para_env
252 TYPE(section_vals_type), OPTIONAL, POINTER :: root_section
253 TYPE(global_environment_type), OPTIONAL, POINTER :: globenv
254 TYPE(cp_subsys_type), OPTIONAL, POINTER :: cp_subsys
255 TYPE(kpoint_type), OPTIONAL, POINTER :: kpoint_env
256 TYPE(cell_type), OPTIONAL, POINTER :: cell, cell_ref
257 LOGICAL, INTENT(IN), OPTIONAL :: qmmm
258 TYPE(qmmm_env_qm_type), OPTIONAL, POINTER :: qmmm_env_qm
259 TYPE(section_vals_type), POINTER :: force_env_section, subsys_section
260 LOGICAL, INTENT(IN) :: use_motion_section
261 LOGICAL, INTENT(IN), OPTIONAL :: silent
262
263 CHARACTER(LEN=default_string_length) :: basis_type
264 INTEGER :: ikind, method_id, nelectron_total, &
265 nkind, nkp_grid(3)
266 LOGICAL :: do_admm_rpa, do_ec_hfx, do_et, do_exx, do_hfx, do_kpoints, is_identical, is_semi, &
267 mp2_present, my_qmmm, qmmm_decoupl, same_except_frac, use_ref_cell
268 REAL(kind=dp), DIMENSION(:, :), POINTER :: rtmat
269 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
270 TYPE(cell_type), POINTER :: my_cell, my_cell_ref
271 TYPE(cp_blacs_env_type), POINTER :: blacs_env
272 TYPE(dft_control_type), POINTER :: dft_control
273 TYPE(distribution_1d_type), POINTER :: local_particles
274 TYPE(energy_correction_type), POINTER :: ec_env
275 TYPE(excited_energy_type), POINTER :: exstate_env
276 TYPE(harris_type), POINTER :: harris_env
277 TYPE(kpoint_type), POINTER :: kpoints
278 TYPE(lri_environment_type), POINTER :: lri_env
279 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
280 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
281 TYPE(qs_ks_env_type), POINTER :: ks_env
282 TYPE(qs_subsys_type), POINTER :: subsys
283 TYPE(qs_wf_history_type), POINTER :: wf_history
284 TYPE(rel_control_type), POINTER :: rel_control
285 TYPE(scf_control_type), POINTER :: scf_control
286 TYPE(section_vals_type), POINTER :: dft_section, ec_hfx_section, ec_section, &
287 et_coupling_section, hfx_section, kpoint_section, mp2_section, rpa_hfx_section, &
288 transport_section
289
290 NULLIFY (my_cell, my_cell_ref, atomic_kind_set, particle_set, &
291 qs_kind_set, kpoint_section, dft_section, ec_section, &
292 subsys, ks_env, dft_control, blacs_env)
293
294 CALL set_qs_env(qs_env, input=force_env_section)
295 IF (.NOT. ASSOCIATED(subsys_section)) THEN
296 subsys_section => section_vals_get_subs_vals(force_env_section, "SUBSYS")
297 END IF
298
299 ! QMMM
300 my_qmmm = .false.
301 IF (PRESENT(qmmm)) my_qmmm = qmmm
302 qmmm_decoupl = .false.
303 IF (PRESENT(qmmm_env_qm)) THEN
304 IF (qmmm_env_qm%qmmm_coupl_type == do_qmmm_gauss .OR. &
305 qmmm_env_qm%qmmm_coupl_type == do_qmmm_swave) THEN
306 ! For GAUSS/SWAVE methods there could be a DDAPC decoupling requested
307 qmmm_decoupl = my_qmmm .AND. qmmm_env_qm%periodic .AND. qmmm_env_qm%multipole
308 END IF
309 qs_env%qmmm_env_qm => qmmm_env_qm
310 END IF
311 CALL set_qs_env(qs_env=qs_env, qmmm=my_qmmm)
312
313 ! Possibly initialize arrays for SE
314 CALL section_vals_val_get(force_env_section, "DFT%QS%METHOD", i_val=method_id)
315 SELECT CASE (method_id)
318 CALL init_se_intd_array()
319 is_semi = .true.
321 is_semi = .true.
322 CASE DEFAULT
323 is_semi = .false.
324 END SELECT
325
326 ALLOCATE (subsys)
327 CALL qs_subsys_create(subsys, para_env, &
328 force_env_section=force_env_section, &
329 subsys_section=subsys_section, &
330 use_motion_section=use_motion_section, &
331 root_section=root_section, &
332 cp_subsys=cp_subsys, cell=cell, cell_ref=cell_ref, &
333 elkind=is_semi, silent=silent)
334
335 ALLOCATE (ks_env)
336 CALL qs_ks_env_create(ks_env)
337 CALL set_ks_env(ks_env, subsys=subsys)
338 CALL set_qs_env(qs_env, ks_env=ks_env)
339
340 CALL qs_subsys_get(subsys, &
341 cell=my_cell, &
342 cell_ref=my_cell_ref, &
343 use_ref_cell=use_ref_cell, &
344 atomic_kind_set=atomic_kind_set, &
345 qs_kind_set=qs_kind_set, &
346 particle_set=particle_set)
347
348 CALL set_ks_env(ks_env, para_env=para_env)
349 IF (PRESENT(globenv)) THEN
350 CALL cp_blacs_env_create(blacs_env, para_env, globenv%blacs_grid_layout, &
351 globenv%blacs_repeatable)
352 ELSE
353 CALL cp_blacs_env_create(blacs_env, para_env)
354 END IF
355 CALL set_ks_env(ks_env, blacs_env=blacs_env)
356 CALL cp_blacs_env_release(blacs_env)
357
358 ! *** Setup the grids for the G-space Interpolation if any
359 CALL cp_ddapc_ewald_create(qs_env%cp_ddapc_ewald, qmmm_decoupl, my_cell, &
360 force_env_section, subsys_section, para_env)
361
362 ! kpoints
363 IF (PRESENT(kpoint_env)) THEN
364 kpoints => kpoint_env
365 CALL set_qs_env(qs_env=qs_env, kpoints=kpoints)
366 CALL kpoint_initialize(kpoints, particle_set, my_cell)
367 ELSE
368 NULLIFY (kpoints)
369 CALL kpoint_create(kpoints)
370 CALL set_qs_env(qs_env=qs_env, kpoints=kpoints)
371 kpoint_section => section_vals_get_subs_vals(qs_env%input, "DFT%KPOINTS")
372 CALL read_kpoint_section(kpoints, kpoint_section, my_cell%hmat)
373 CALL kpoint_initialize(kpoints, particle_set, my_cell)
374 dft_section => section_vals_get_subs_vals(qs_env%input, "DFT")
375 CALL write_kpoint_info(kpoints, dft_section)
376 END IF
377
378 CALL qs_init_subsys(qs_env, para_env, subsys, my_cell, my_cell_ref, use_ref_cell, &
379 subsys_section, silent=silent)
380
381 CALL get_qs_env(qs_env, dft_control=dft_control)
382 IF (method_id == do_method_lrigpw .OR. dft_control%qs_control%lri_optbas) THEN
383 CALL get_qs_env(qs_env=qs_env, lri_env=lri_env)
384 CALL lri_env_basis("LRI", qs_env, lri_env, qs_kind_set)
385 ELSE IF (method_id == do_method_rigpw) THEN
386 CALL cp_warn(__location__, "Experimental code: "// &
387 "RIGPW should only be used for testing.")
388 CALL get_qs_env(qs_env=qs_env, lri_env=lri_env)
389 CALL lri_env_basis("RI", qs_env, lri_env, qs_kind_set)
390 END IF
391
392 IF (my_qmmm .AND. PRESENT(qmmm_env_qm) .AND. .NOT. dft_control%qs_control%commensurate_mgrids) THEN
393 IF (qmmm_env_qm%qmmm_coupl_type == do_qmmm_gauss .OR. qmmm_env_qm%qmmm_coupl_type == do_qmmm_swave) THEN
394 CALL cp_abort(__location__, "QM/MM with coupling GAUSS or S-WAVE requires "// &
395 "keyword FORCE_EVAL/DFT/MGRID/COMMENSURATE to be enabled.")
396 END IF
397 END IF
398
399 ! more kpoint stuff
400 CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints, blacs_env=blacs_env)
401 IF (do_kpoints) THEN
402 CALL kpoint_env_initialize(kpoints, para_env, blacs_env, with_aux_fit=dft_control%do_admm)
403 CALL kpoint_initialize_mos(kpoints, qs_env%mos)
404 CALL get_qs_env(qs_env=qs_env, wf_history=wf_history)
405 CALL wfi_create_for_kp(wf_history)
406 END IF
407 ! basis set symmetry rotations
408 IF (do_kpoints) THEN
409 CALL qs_basis_rotation(qs_env, kpoints)
410 END IF
411
412 do_hfx = .false.
413 hfx_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%HF")
414 CALL section_vals_get(hfx_section, explicit=do_hfx)
415 CALL get_qs_env(qs_env, dft_control=dft_control, scf_control=scf_control, nelectron_total=nelectron_total)
416 IF (do_hfx) THEN
417 ! Retrieve particle_set and atomic_kind_set (needed for both kinds of initialization)
418 nkp_grid = 1
419 IF (do_kpoints) CALL get_kpoint_info(kpoints, nkp_grid=nkp_grid)
420 IF (dft_control%do_admm) THEN
421 basis_type = 'AUX_FIT'
422 ELSE
423 basis_type = 'ORB'
424 END IF
425 CALL hfx_create(qs_env%x_data, para_env, hfx_section, atomic_kind_set, &
426 qs_kind_set, particle_set, dft_control, my_cell, orb_basis=basis_type, &
427 nelectron_total=nelectron_total, nkp_grid=nkp_grid)
428 END IF
429
430 mp2_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%WF_CORRELATION")
431 CALL section_vals_get(mp2_section, explicit=mp2_present)
432 IF (mp2_present) THEN
433 cpassert(ASSOCIATED(qs_env%mp2_env))
434 CALL read_mp2_section(qs_env%input, qs_env%mp2_env)
435 ! create the EXX section if necessary
436 do_exx = .false.
437 rpa_hfx_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%WF_CORRELATION%RI_RPA%HF")
438 CALL section_vals_get(rpa_hfx_section, explicit=do_exx)
439 IF (do_exx) THEN
440
441 ! do_exx in call of hfx_create decides whether to go without ADMM (do_exx=.TRUE.) or with
442 ! ADMM (do_exx=.FALSE.)
443 CALL section_vals_val_get(mp2_section, "RI_RPA%ADMM", l_val=do_admm_rpa)
444
445 ! Reuse the HFX integrals from the qs_env if applicable
446 qs_env%mp2_env%ri_rpa%reuse_hfx = .true.
447 IF (.NOT. do_hfx) qs_env%mp2_env%ri_rpa%reuse_hfx = .false.
448 CALL compare_hfx_sections(hfx_section, rpa_hfx_section, is_identical, same_except_frac)
449 IF (.NOT. (is_identical .OR. same_except_frac)) qs_env%mp2_env%ri_rpa%reuse_hfx = .false.
450 IF (dft_control%do_admm .AND. .NOT. do_admm_rpa) qs_env%mp2_env%ri_rpa%reuse_hfx = .false.
451
452 IF (.NOT. qs_env%mp2_env%ri_rpa%reuse_hfx) THEN
453 IF (do_admm_rpa) THEN
454 basis_type = 'AUX_FIT'
455 ELSE
456 basis_type = 'ORB'
457 END IF
458 CALL hfx_create(qs_env%mp2_env%ri_rpa%x_data, para_env, rpa_hfx_section, atomic_kind_set, &
459 qs_kind_set, particle_set, dft_control, my_cell, orb_basis=basis_type, &
460 nelectron_total=nelectron_total)
461 ELSE
462 qs_env%mp2_env%ri_rpa%x_data => qs_env%x_data
463 END IF
464 END IF
465 END IF
466
467 IF (dft_control%qs_control%do_kg) THEN
468 CALL cite_reference(iannuzzi2006)
469 CALL kg_env_create(qs_env, qs_env%kg_env, qs_kind_set, qs_env%input)
470 END IF
471
472 dft_section => section_vals_get_subs_vals(qs_env%input, "DFT")
473 CALL section_vals_val_get(dft_section, "EXCITED_STATES%_SECTION_PARAMETERS_", &
474 l_val=qs_env%excited_state)
475 NULLIFY (exstate_env)
476 CALL exstate_create(exstate_env, qs_env%excited_state, dft_section)
477 CALL set_qs_env(qs_env, exstate_env=exstate_env)
478
479 et_coupling_section => section_vals_get_subs_vals(qs_env%input, &
480 "PROPERTIES%ET_COUPLING")
481 CALL section_vals_get(et_coupling_section, explicit=do_et)
482 IF (do_et) CALL et_coupling_create(qs_env%et_coupling)
483
484 transport_section => section_vals_get_subs_vals(qs_env%input, "DFT%TRANSPORT")
485 CALL section_vals_get(transport_section, explicit=qs_env%do_transport)
486 IF (qs_env%do_transport) THEN
487 CALL transport_env_create(qs_env)
488 END IF
489
490 CALL get_qs_env(qs_env, harris_env=harris_env)
491 IF (qs_env%harris_method) THEN
492 ! initialize the Harris input density and potential integrals
493 CALL get_qs_env(qs_env, local_particles=local_particles)
494 CALL harris_rhoin_init(harris_env%rhoin, "RHOIN", qs_kind_set, atomic_kind_set, &
495 local_particles, dft_control%nspins)
496 ! Print information of the HARRIS section
497 CALL harris_write_input(harris_env)
498 END IF
499
500 NULLIFY (ec_env)
501 dft_section => section_vals_get_subs_vals(qs_env%input, "DFT")
502 CALL section_vals_val_get(dft_section, "ENERGY_CORRECTION%_SECTION_PARAMETERS_", &
503 l_val=qs_env%energy_correction)
504 ec_section => section_vals_get_subs_vals(qs_env%input, "DFT%ENERGY_CORRECTION")
505 CALL ec_env_create(qs_env, ec_env, dft_section, ec_section)
506 CALL set_qs_env(qs_env, ec_env=ec_env)
507
508 IF (qs_env%energy_correction) THEN
509 ! Energy correction with Hartree-Fock exchange
510 ec_hfx_section => section_vals_get_subs_vals(ec_section, "XC%HF")
511 CALL section_vals_get(ec_hfx_section, explicit=do_ec_hfx)
512
513 IF (ec_env%do_ec_hfx) THEN
514
515 ! Hybrid functionals require same basis
516 IF (ec_env%basis_inconsistent) THEN
517 CALL cp_abort(__location__, &
518 "Energy correction methods with hybrid functionals: "// &
519 "correction and ground state need to use the same basis. "// &
520 "Checked by comparing basis set names only.")
521 END IF
522
523 ! Similar to RPA_HFX we can check if HFX integrals from the qs_env can be reused
524 IF (ec_env%do_ec_admm .AND. .NOT. dft_control%do_admm) THEN
525 CALL cp_abort(__location__, "Need an ADMM input section for ADMM EC to work")
526 END IF
527
528 ec_env%reuse_hfx = .true.
529 IF (.NOT. do_hfx) ec_env%reuse_hfx = .false.
530 CALL compare_hfx_sections(hfx_section, ec_hfx_section, is_identical, same_except_frac)
531 IF (.NOT. (is_identical .OR. same_except_frac)) ec_env%reuse_hfx = .false.
532 IF (dft_control%do_admm .AND. .NOT. ec_env%do_ec_admm) ec_env%reuse_hfx = .false.
533
534 IF (.NOT. ec_env%reuse_hfx) THEN
535 IF (ec_env%do_ec_admm) THEN
536 basis_type = 'AUX_FIT'
537 ELSE
538 basis_type = 'ORB'
539 END IF
540 CALL hfx_create(ec_env%x_data, para_env, ec_hfx_section, atomic_kind_set, &
541 qs_kind_set, particle_set, dft_control, my_cell, orb_basis=basis_type, &
542 nelectron_total=nelectron_total)
543 ELSE
544 ec_env%x_data => qs_env%x_data
545 END IF
546 END IF
547
548 ! Print information of the EC section
549 CALL ec_write_input(ec_env)
550
551 END IF
552
553 IF (dft_control%qs_control%do_almo_scf) THEN
554 CALL almo_scf_env_create(qs_env)
555 END IF
556
557 ! see if we have atomic relativistic corrections
558 CALL get_qs_env(qs_env, rel_control=rel_control)
559 IF (rel_control%rel_method /= rel_none) THEN
560 IF (rel_control%rel_transformation == rel_trans_atom) THEN
561 nkind = SIZE(atomic_kind_set)
562 DO ikind = 1, nkind
563 NULLIFY (rtmat)
564 CALL calculate_atomic_relkin(atomic_kind_set(ikind), qs_kind_set(ikind), rel_control, rtmat)
565 IF (ASSOCIATED(rtmat)) CALL set_qs_kind(qs_kind_set(ikind), reltmat=rtmat)
566 END DO
567 END IF
568 END IF
569
570 END SUBROUTINE qs_init
571
572! **************************************************************************************************
573!> \brief Initialize the qs environment (subsys)
574!> \param qs_env ...
575!> \param para_env ...
576!> \param subsys ...
577!> \param cell ...
578!> \param cell_ref ...
579!> \param use_ref_cell ...
580!> \param subsys_section ...
581!> \param silent ...
582!> \author Creation (22.05.2000,MK)
583! **************************************************************************************************
584 SUBROUTINE qs_init_subsys(qs_env, para_env, subsys, cell, cell_ref, use_ref_cell, subsys_section, &
585 silent)
586
587 TYPE(qs_environment_type), POINTER :: qs_env
588 TYPE(mp_para_env_type), POINTER :: para_env
589 TYPE(qs_subsys_type), POINTER :: subsys
590 TYPE(cell_type), POINTER :: cell, cell_ref
591 LOGICAL, INTENT(in) :: use_ref_cell
592 TYPE(section_vals_type), POINTER :: subsys_section
593 LOGICAL, INTENT(in), OPTIONAL :: silent
594
595 CHARACTER(len=*), PARAMETER :: routinen = 'qs_init_subsys'
596
597 CHARACTER(len=2) :: element_symbol
598 INTEGER :: gfn_type, handle, ikind, ispin, iw, lmax_sphere, maxl, maxlgto, maxlgto_lri, &
599 maxlppl, maxlppnl, method_id, multiplicity, my_ival, n_ao, n_mo_add, natom, nelectron, &
600 ngauss, nkind, output_unit, sort_basis, tnadd_method
601 INTEGER, DIMENSION(2) :: n_mo, nelectron_spin
602 LOGICAL :: all_potential_present, be_silent, do_kpoints, do_ri_hfx, do_ri_mp2, do_ri_rpa, &
603 do_ri_sos_mp2, do_rpa_ri_exx, do_wfc_im_time, e1terms, has_unit_metric, lribas, &
604 mp2_present, orb_gradient
605 REAL(kind=dp) :: alpha, ccore, ewald_rcut, fxx, maxocc, &
606 rcut, total_zeff_corr, verlet_skin, &
607 zeff_correction
608 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
609 TYPE(cp_logger_type), POINTER :: logger
610 TYPE(dft_control_type), POINTER :: dft_control
611 TYPE(dftb_control_type), POINTER :: dftb_control
612 TYPE(distribution_1d_type), POINTER :: local_molecules, local_particles
613 TYPE(ewald_environment_type), POINTER :: ewald_env
614 TYPE(ewald_pw_type), POINTER :: ewald_pw
615 TYPE(fist_nonbond_env_type), POINTER :: se_nonbond_env
616 TYPE(gapw_control_type), POINTER :: gapw_control
617 TYPE(gto_basis_set_type), POINTER :: aux_fit_basis, lri_aux_basis, &
618 rhoin_basis, ri_aux_basis_set, &
619 ri_hfx_basis, ri_xas_basis, &
620 tmp_basis_set
621 TYPE(harris_type), POINTER :: harris_env
622 TYPE(local_rho_type), POINTER :: local_rho_set
623 TYPE(lri_environment_type), POINTER :: lri_env
624 TYPE(mo_set_type), DIMENSION(:), POINTER :: mos, mos_last_converged
625 TYPE(molecule_kind_type), DIMENSION(:), POINTER :: molecule_kind_set
626 TYPE(molecule_type), DIMENSION(:), POINTER :: molecule_set
627 TYPE(mp2_type), POINTER :: mp2_env
628 TYPE(nddo_mpole_type), POINTER :: se_nddo_mpole
629 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
630 TYPE(pw_env_type), POINTER :: pw_env
631 TYPE(qs_control_type), POINTER :: qs_control
632 TYPE(qs_dftb_pairpot_type), DIMENSION(:, :), &
633 POINTER :: dftb_potential
634 TYPE(qs_dispersion_type), POINTER :: dispersion_env
635 TYPE(qs_energy_type), POINTER :: energy
636 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
637 TYPE(qs_gcp_type), POINTER :: gcp_env
638 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
639 TYPE(qs_kind_type), POINTER :: qs_kind
640 TYPE(qs_ks_env_type), POINTER :: ks_env
641 TYPE(qs_wf_history_type), POINTER :: wf_history
642 TYPE(rho0_mpole_type), POINTER :: rho0_mpole
643 TYPE(rho_atom_type), DIMENSION(:), POINTER :: rho_atom_set
644 TYPE(scf_control_type), POINTER :: scf_control
645 TYPE(se_taper_type), POINTER :: se_taper
646 TYPE(section_vals_type), POINTER :: dft_section, et_coupling_section, et_ddapc_section, &
647 ewald_section, harris_section, lri_section, mp2_section, nl_section, poisson_section, &
648 pp_section, print_section, qs_section, se_section, tddfpt_section, xc_section
649 TYPE(semi_empirical_control_type), POINTER :: se_control
650 TYPE(semi_empirical_si_type), POINTER :: se_store_int_env
651 TYPE(xtb_control_type), POINTER :: xtb_control
652
653 CALL timeset(routinen, handle)
654 NULLIFY (logger)
655 logger => cp_get_default_logger()
656 output_unit = cp_logger_get_default_io_unit(logger)
657
658 be_silent = .false.
659 IF (PRESENT(silent)) be_silent = silent
660
661 CALL cite_reference(cp2kqs2020)
662
663 ! Initialise the Quickstep environment
664 NULLIFY (mos, se_taper)
665 NULLIFY (dft_control)
666 NULLIFY (energy)
667 NULLIFY (force)
668 NULLIFY (local_molecules)
669 NULLIFY (local_particles)
670 NULLIFY (scf_control)
671 NULLIFY (dft_section)
672 NULLIFY (et_coupling_section)
673 NULLIFY (ks_env)
674 NULLIFY (mos_last_converged)
675 dft_section => section_vals_get_subs_vals(qs_env%input, "DFT")
676 qs_section => section_vals_get_subs_vals(dft_section, "QS")
677 et_coupling_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%ET_COUPLING")
678 ! reimplemented TDDFPT
679 tddfpt_section => section_vals_get_subs_vals(qs_env%input, "PROPERTIES%TDDFPT")
680
681 CALL qs_subsys_get(subsys, particle_set=particle_set, &
682 qs_kind_set=qs_kind_set, &
683 atomic_kind_set=atomic_kind_set, &
684 molecule_set=molecule_set, &
685 molecule_kind_set=molecule_kind_set)
686
687 ! *** Read the input section with the DFT control parameters ***
688 CALL read_dft_control(dft_control, dft_section)
689
690 ! set periodicity flag
691 dft_control%qs_control%periodicity = sum(cell%perd)
692
693 ! Read the input section with the Quickstep control parameters
694 CALL read_qs_section(dft_control%qs_control, qs_section)
695
696 ! *** Print the Quickstep program banner (copyright and version number) ***
697 IF (.NOT. be_silent) THEN
698 iw = cp_print_key_unit_nr(logger, dft_section, "PRINT%PROGRAM_BANNER", extension=".Log")
699 CALL section_vals_val_get(qs_section, "METHOD", i_val=method_id)
700 SELECT CASE (method_id)
701 CASE DEFAULT
702 CALL qs_header(iw)
705 CALL se_header(iw)
706 CASE (do_method_dftb)
707 CALL dftb_header(iw)
708 CASE (do_method_xtb)
709 gfn_type = dft_control%qs_control%xtb_control%gfn_type
710 CALL xtb_header(iw, gfn_type)
711 END SELECT
712 CALL cp_print_key_finished_output(iw, logger, dft_section, &
713 "PRINT%PROGRAM_BANNER")
714 END IF
715
716 IF (dft_control%do_sccs .AND. dft_control%qs_control%gapw) THEN
717 cpabort("SCCS is not yet implemented with GAPW")
718 END IF
719 CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints)
720 IF (do_kpoints) THEN
721 ! reset some of the settings for wfn extrapolation for kpoints
722 SELECT CASE (dft_control%qs_control%wf_interpolation_method_nr)
724 dft_control%qs_control%wf_interpolation_method_nr = wfi_use_guess_method_nr
725 END SELECT
726 END IF
727
728 ! ******* check if any kind of electron transfer calculation has to be performed
729 CALL section_vals_val_get(et_coupling_section, "TYPE_OF_CONSTRAINT", i_val=my_ival)
730 dft_control%qs_control%et_coupling_calc = .false.
731 IF (my_ival == do_et_ddapc) THEN
732 et_ddapc_section => section_vals_get_subs_vals(et_coupling_section, "DDAPC_RESTRAINT_A")
733 dft_control%qs_control%et_coupling_calc = .true.
734 dft_control%qs_control%ddapc_restraint = .true.
735 CALL read_ddapc_section(dft_control%qs_control, ddapc_restraint_section=et_ddapc_section)
736 END IF
737
738 CALL read_mgrid_section(dft_control%qs_control, dft_section)
739
740 ! reimplemented TDDFPT
741 CALL read_tddfpt2_control(dft_control%tddfpt2_control, tddfpt_section, dft_control%qs_control)
742
743 ! Create relativistic control section
744 block
745 TYPE(rel_control_type), POINTER :: rel_control
746 ALLOCATE (rel_control)
747 CALL rel_c_create(rel_control)
748 CALL rel_c_read_parameters(rel_control, dft_section)
749 CALL set_qs_env(qs_env, rel_control=rel_control)
750 END block
751
752 ! *** Read DFTB parameter files ***
753 IF (dft_control%qs_control%method_id == do_method_dftb) THEN
754 NULLIFY (ewald_env, ewald_pw, dftb_potential)
755 dftb_control => dft_control%qs_control%dftb_control
756 CALL qs_dftb_param_init(atomic_kind_set, qs_kind_set, dftb_control, dftb_potential, &
757 subsys_section=subsys_section, para_env=para_env)
758 CALL set_qs_env(qs_env, dftb_potential=dftb_potential)
759 ! check for Ewald
760 IF (dftb_control%do_ewald) THEN
761 ALLOCATE (ewald_env)
762 CALL ewald_env_create(ewald_env, para_env)
763 poisson_section => section_vals_get_subs_vals(dft_section, "POISSON")
764 CALL ewald_env_set(ewald_env, poisson_section=poisson_section)
765 ewald_section => section_vals_get_subs_vals(poisson_section, "EWALD")
766 print_section => section_vals_get_subs_vals(qs_env%input, "PRINT%GRID_INFORMATION")
767 CALL get_qs_kind_set(qs_kind_set, basis_rcut=ewald_rcut)
768 CALL read_ewald_section_tb(ewald_env, ewald_section, cell_ref%hmat)
769 ALLOCATE (ewald_pw)
770 CALL ewald_pw_create(ewald_pw, ewald_env, cell, cell_ref, print_section=print_section)
771 CALL set_qs_env(qs_env, ewald_env=ewald_env, ewald_pw=ewald_pw)
772 END IF
773 ELSEIF (dft_control%qs_control%method_id == do_method_xtb) THEN
774 ! *** Read xTB parameter file ***
775 xtb_control => dft_control%qs_control%xtb_control
776 NULLIFY (ewald_env, ewald_pw)
777 CALL get_qs_env(qs_env, nkind=nkind)
778 DO ikind = 1, nkind
779 qs_kind => qs_kind_set(ikind)
780 ! Setup proper xTB parameters
781 cpassert(.NOT. ASSOCIATED(qs_kind%xtb_parameter))
782 CALL allocate_xtb_atom_param(qs_kind%xtb_parameter)
783 ! Set default parameters
784 gfn_type = dft_control%qs_control%xtb_control%gfn_type
785 CALL get_qs_kind(qs_kind, element_symbol=element_symbol)
786 CALL xtb_parameters_init(qs_kind%xtb_parameter, gfn_type, element_symbol, &
787 xtb_control%parameter_file_path, xtb_control%parameter_file_name, &
788 para_env)
789 ! set dependent parameters
790 CALL xtb_parameters_set(qs_kind%xtb_parameter)
791 ! Generate basis set
792 NULLIFY (tmp_basis_set)
793 IF (qs_kind%xtb_parameter%z == 1) THEN
794 ! special case hydrogen
795 ngauss = xtb_control%h_sto_ng
796 ELSE
797 ngauss = xtb_control%sto_ng
798 END IF
799 IF (qs_kind%xtb_parameter%defined) THEN
800 CALL init_xtb_basis(qs_kind%xtb_parameter, tmp_basis_set, ngauss)
801 CALL add_basis_set_to_container(qs_kind%basis_sets, tmp_basis_set, "ORB")
802 ELSE
803 CALL set_qs_kind(qs_kind, ghost=.true.)
804 IF (ASSOCIATED(qs_kind%all_potential)) THEN
805 DEALLOCATE (qs_kind%all_potential%elec_conf)
806 DEALLOCATE (qs_kind%all_potential)
807 END IF
808 END IF
809 ! potential
810 IF (qs_kind%xtb_parameter%defined) THEN
811 zeff_correction = 0.0_dp
812 CALL init_potential(qs_kind%all_potential, itype="BARE", &
813 zeff=qs_kind%xtb_parameter%zeff, zeff_correction=zeff_correction)
814 CALL get_potential(qs_kind%all_potential, alpha_core_charge=alpha)
815 ccore = qs_kind%xtb_parameter%zeff*sqrt((alpha/pi)**3)
816 CALL set_potential(qs_kind%all_potential, ccore_charge=ccore)
817 qs_kind%xtb_parameter%zeff = qs_kind%xtb_parameter%zeff - zeff_correction
818 END IF
819 END DO
820 !
821 ! set repulsive potential range
822 !
823 ALLOCATE (xtb_control%rcpair(nkind, nkind))
824 CALL xtb_pp_radius(qs_kind_set, xtb_control%rcpair, xtb_control%eps_pair, xtb_control%kf)
825 ! check for Ewald
826 IF (xtb_control%do_ewald) THEN
827 ALLOCATE (ewald_env)
828 CALL ewald_env_create(ewald_env, para_env)
829 poisson_section => section_vals_get_subs_vals(dft_section, "POISSON")
830 CALL ewald_env_set(ewald_env, poisson_section=poisson_section)
831 ewald_section => section_vals_get_subs_vals(poisson_section, "EWALD")
832 print_section => section_vals_get_subs_vals(qs_env%input, "PRINT%GRID_INFORMATION")
833 IF (gfn_type == 0) THEN
834 CALL read_ewald_section_tb(ewald_env, ewald_section, cell_ref%hmat, &
835 silent=silent, pset="EEQ")
836 ELSE
837 CALL read_ewald_section_tb(ewald_env, ewald_section, cell_ref%hmat, &
838 silent=silent)
839 END IF
840 ALLOCATE (ewald_pw)
841 CALL ewald_pw_create(ewald_pw, ewald_env, cell, cell_ref, print_section=print_section)
842 CALL set_qs_env(qs_env, ewald_env=ewald_env, ewald_pw=ewald_pw)
843 END IF
844 END IF
845
846 ! lri or ri env initialization
847 lri_section => section_vals_get_subs_vals(qs_section, "LRIGPW")
848 IF (dft_control%qs_control%method_id == do_method_lrigpw .OR. &
849 dft_control%qs_control%lri_optbas .OR. &
850 dft_control%qs_control%method_id == do_method_rigpw) THEN
851 CALL lri_env_init(lri_env, lri_section)
852 CALL set_qs_env(qs_env, lri_env=lri_env)
853 END IF
854
855 ! *** Check basis and fill in missing parts ***
856 CALL check_qs_kind_set(qs_kind_set, dft_control, subsys_section=subsys_section)
857
858 ! *** Check that no all-electron potential is present if GPW or GAPW_XC
859 CALL get_qs_kind_set(qs_kind_set, all_potential_present=all_potential_present)
860 IF ((dft_control%qs_control%method_id == do_method_gpw) .OR. &
861 (dft_control%qs_control%method_id == do_method_gapw_xc) .OR. &
862 (dft_control%qs_control%method_id == do_method_ofgpw)) THEN
863 IF (all_potential_present) THEN
864 cpabort("All-electron calculations with GPW, GAPW_XC, and OFGPW are not implemented")
865 END IF
866 END IF
867
868 ! DFT+U
869 CALL get_qs_kind_set(qs_kind_set, dft_plus_u_atom_present=dft_control%dft_plus_u)
870
871 IF (dft_control%do_admm) THEN
872 ! Check if ADMM basis is available
873 CALL get_qs_env(qs_env, nkind=nkind)
874 DO ikind = 1, nkind
875 NULLIFY (aux_fit_basis)
876 qs_kind => qs_kind_set(ikind)
877 CALL get_qs_kind(qs_kind, basis_set=aux_fit_basis, basis_type="AUX_FIT")
878 IF (.NOT. (ASSOCIATED(aux_fit_basis))) THEN
879 ! AUX_FIT basis set is not available
880 cpabort("AUX_FIT basis set is not defined. ")
881 END IF
882 END DO
883 END IF
884
885 lribas = .false.
886 e1terms = .false.
887 IF (dft_control%qs_control%method_id == do_method_lrigpw) THEN
888 lribas = .true.
889 CALL get_qs_env(qs_env, lri_env=lri_env)
890 e1terms = lri_env%exact_1c_terms
891 END IF
892 IF (dft_control%qs_control%do_kg) THEN
893 CALL section_vals_val_get(dft_section, "KG_METHOD%TNADD_METHOD", i_val=tnadd_method)
894 IF (tnadd_method == kg_tnadd_embed_ri) lribas = .true.
895 END IF
896 IF (lribas) THEN
897 ! Check if LRI_AUX basis is available, auto-generate if needed
898 CALL get_qs_env(qs_env, nkind=nkind)
899 DO ikind = 1, nkind
900 NULLIFY (lri_aux_basis)
901 qs_kind => qs_kind_set(ikind)
902 CALL get_qs_kind(qs_kind, basis_set=lri_aux_basis, basis_type="LRI_AUX")
903 IF (.NOT. (ASSOCIATED(lri_aux_basis))) THEN
904 ! LRI_AUX basis set is not yet loaded
905 CALL cp_warn(__location__, "Automatic Generation of LRI_AUX basis. "// &
906 "This is experimental code.")
907 ! Generate a default basis
908 CALL create_lri_aux_basis_set(lri_aux_basis, qs_kind, dft_control%auto_basis_lri_aux, e1terms)
909 CALL add_basis_set_to_container(qs_kind%basis_sets, lri_aux_basis, "LRI_AUX")
910 END IF
911 END DO
912 END IF
913
914 CALL section_vals_val_get(qs_env%input, "DFT%XC%HF%RI%_SECTION_PARAMETERS_", l_val=do_ri_hfx)
915 CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_RPA%HF%RI%_SECTION_PARAMETERS_", &
916 l_val=do_rpa_ri_exx)
917 IF (do_ri_hfx .OR. do_rpa_ri_exx) THEN
918 CALL get_qs_env(qs_env, nkind=nkind)
919 CALL section_vals_val_get(qs_env%input, "DFT%SORT_BASIS", i_val=sort_basis)
920 DO ikind = 1, nkind
921 NULLIFY (ri_hfx_basis)
922 qs_kind => qs_kind_set(ikind)
923 CALL get_qs_kind(qs_kind=qs_kind, basis_set=ri_hfx_basis, &
924 basis_type="RI_HFX")
925 IF (.NOT. (ASSOCIATED(ri_hfx_basis))) THEN
926 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto)
927 IF (dft_control%do_admm) THEN
928 CALL create_ri_aux_basis_set(ri_hfx_basis, qs_kind, dft_control%auto_basis_ri_hfx, &
929 basis_type="AUX_FIT", basis_sort=sort_basis)
930 ELSE
931 CALL create_ri_aux_basis_set(ri_hfx_basis, qs_kind, dft_control%auto_basis_ri_hfx, &
932 basis_sort=sort_basis)
933 END IF
934 CALL add_basis_set_to_container(qs_kind%basis_sets, ri_hfx_basis, "RI_HFX")
935 END IF
936 END DO
937 END IF
938
939 IF (dft_control%qs_control%method_id == do_method_rigpw) THEN
940 ! Check if RI_HXC basis is available, auto-generate if needed
941 CALL get_qs_env(qs_env, nkind=nkind)
942 DO ikind = 1, nkind
943 NULLIFY (ri_hfx_basis)
944 qs_kind => qs_kind_set(ikind)
945 CALL get_qs_kind(qs_kind, basis_set=ri_hfx_basis, basis_type="RI_HXC")
946 IF (.NOT. (ASSOCIATED(ri_hfx_basis))) THEN
947 ! Generate a default basis
948 CALL create_ri_aux_basis_set(ri_hfx_basis, qs_kind, dft_control%auto_basis_ri_hxc)
949 CALL add_basis_set_to_container(qs_kind%basis_sets, ri_hfx_basis, "RI_HXC")
950 END IF
951 END DO
952 END IF
953
954 ! Harris method
955 NULLIFY (harris_env)
956 CALL section_vals_val_get(dft_section, "HARRIS_METHOD%_SECTION_PARAMETERS_", &
957 l_val=qs_env%harris_method)
958 harris_section => section_vals_get_subs_vals(dft_section, "HARRIS_METHOD")
959 CALL harris_env_create(qs_env, harris_env, harris_section)
960 CALL set_qs_env(qs_env, harris_env=harris_env)
961 !
962 IF (qs_env%harris_method) THEN
963 CALL get_qs_env(qs_env, nkind=nkind)
964 ! Check if RI_HXC basis is available, auto-generate if needed
965 DO ikind = 1, nkind
966 NULLIFY (tmp_basis_set)
967 qs_kind => qs_kind_set(ikind)
968 CALL get_qs_kind(qs_kind, basis_set=rhoin_basis, basis_type="RHOIN")
969 IF (.NOT. (ASSOCIATED(rhoin_basis))) THEN
970 ! Generate a default basis
971 CALL create_ri_aux_basis_set(tmp_basis_set, qs_kind, dft_control%auto_basis_ri_hxc)
972 IF (qs_env%harris_env%density_source == hden_atomic) THEN
973 CALL create_primitive_basis_set(tmp_basis_set, rhoin_basis, lmax=0)
974 CALL deallocate_gto_basis_set(tmp_basis_set)
975 ELSE
976 rhoin_basis => tmp_basis_set
977 END IF
978 CALL add_basis_set_to_container(qs_kind%basis_sets, rhoin_basis, "RHOIN")
979 END IF
980 END DO
981 END IF
982
983 mp2_section => section_vals_get_subs_vals(qs_env%input, "DFT%XC%WF_CORRELATION")
984 CALL section_vals_get(mp2_section, explicit=mp2_present)
985 IF (mp2_present) THEN
986
987 ! basis should be sorted for imaginary time RPA/GW
988 CALL section_vals_val_get(qs_env%input, "DFT%SORT_BASIS", i_val=sort_basis)
989 CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%LOW_SCALING%_SECTION_PARAMETERS_", &
990 l_val=do_wfc_im_time)
991
992 IF (do_wfc_im_time .AND. sort_basis /= basis_sort_zet) THEN
993 CALL cp_warn(__location__, &
994 "Low-scaling RPA requires SORT_BASIS EXP keyword (in DFT input section) for good performance")
995 END IF
996
997 ! Check if RI_AUX basis (for MP2/RPA) is given, auto-generate if not
998 CALL mp2_env_create(qs_env%mp2_env)
999 CALL get_qs_env(qs_env, mp2_env=mp2_env, nkind=nkind)
1000 CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_MP2%_SECTION_PARAMETERS_", l_val=do_ri_mp2)
1001 CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_SOS_MP2%_SECTION_PARAMETERS_", l_val=do_ri_sos_mp2)
1002 CALL section_vals_val_get(qs_env%input, "DFT%XC%WF_CORRELATION%RI_RPA%_SECTION_PARAMETERS_", l_val=do_ri_rpa)
1003 IF (do_ri_mp2 .OR. do_ri_sos_mp2 .OR. do_ri_rpa) THEN
1004 DO ikind = 1, nkind
1005 NULLIFY (ri_aux_basis_set)
1006 qs_kind => qs_kind_set(ikind)
1007 CALL get_qs_kind(qs_kind=qs_kind, basis_set=ri_aux_basis_set, &
1008 basis_type="RI_AUX")
1009 IF (.NOT. (ASSOCIATED(ri_aux_basis_set))) THEN
1010 ! RI_AUX basis set is not yet loaded
1011 ! Generate a default basis
1012 CALL create_ri_aux_basis_set(ri_aux_basis_set, qs_kind, dft_control%auto_basis_ri_aux, basis_sort=sort_basis)
1013 CALL add_basis_set_to_container(qs_kind%basis_sets, ri_aux_basis_set, "RI_AUX")
1014 ! Add a flag, which allows to check if the basis was generated
1015 ! when applying ERI_METHOD OS to mp2, ri-rpa, gw etc
1016 qs_env%mp2_env%ri_aux_auto_generated = .true.
1017 END IF
1018 END DO
1019 END IF
1020
1021 END IF
1022
1023 IF (dft_control%do_xas_tdp_calculation) THEN
1024 ! Check if RI_XAS basis is given, auto-generate if not
1025 CALL get_qs_env(qs_env, nkind=nkind)
1026 DO ikind = 1, nkind
1027 NULLIFY (ri_xas_basis)
1028 qs_kind => qs_kind_set(ikind)
1029 CALL get_qs_kind(qs_kind, basis_set=ri_xas_basis, basis_type="RI_XAS")
1030 IF (.NOT. ASSOCIATED(ri_xas_basis)) THEN
1031 ! Generate a default basis
1032 CALL create_ri_aux_basis_set(ri_xas_basis, qs_kind, dft_control%auto_basis_ri_xas)
1033 CALL add_basis_set_to_container(qs_kind%basis_sets, ri_xas_basis, "RI_XAS")
1034 END IF
1035 END DO
1036 END IF
1037
1038 ! *** Initialize the spherical harmonics and ***
1039 ! *** the orbital transformation matrices ***
1040 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto, maxlppl=maxlppl, maxlppnl=maxlppnl)
1041
1042 lmax_sphere = dft_control%qs_control%gapw_control%lmax_sphere
1043 IF (lmax_sphere .LT. 0) THEN
1044 lmax_sphere = 2*maxlgto
1045 dft_control%qs_control%gapw_control%lmax_sphere = lmax_sphere
1046 END IF
1047 IF (dft_control%qs_control%method_id == do_method_lrigpw .OR. dft_control%qs_control%lri_optbas) THEN
1048 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto_lri, basis_type="LRI_AUX")
1049 !take maxlgto from lri basis if larger (usually)
1050 maxlgto = max(maxlgto, maxlgto_lri)
1051 ELSE IF (dft_control%qs_control%method_id == do_method_rigpw) THEN
1052 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto_lri, basis_type="RI_HXC")
1053 maxlgto = max(maxlgto, maxlgto_lri)
1054 END IF
1055 IF (dft_control%do_xas_tdp_calculation) THEN
1056 !done as a precaution
1057 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto_lri, basis_type="RI_XAS")
1058 maxlgto = max(maxlgto, maxlgto_lri)
1059 END IF
1060 maxl = max(2*maxlgto, maxlppl, maxlppnl, lmax_sphere) + 1
1061
1062 CALL init_orbital_pointers(maxl)
1063
1064 CALL init_spherical_harmonics(maxl, 0)
1065
1066 ! *** Initialise the qs_kind_set ***
1067 CALL init_qs_kind_set(qs_kind_set)
1068
1069 ! *** Initialise GAPW soft basis and projectors
1070 IF (dft_control%qs_control%method_id == do_method_gapw .OR. &
1071 dft_control%qs_control%method_id == do_method_gapw_xc) THEN
1072 qs_control => dft_control%qs_control
1073 CALL init_gapw_basis_set(qs_kind_set, qs_control, qs_env%input)
1074 END IF
1075
1076 ! *** Initialize the pretabulation for the calculation of the ***
1077 ! *** incomplete Gamma function F_n(t) after McMurchie-Davidson ***
1078 CALL get_qs_kind_set(qs_kind_set, maxlgto=maxlgto)
1079 maxl = max(3*maxlgto + 1, 0)
1080 CALL init_md_ftable(maxl)
1081
1082 ! *** Initialize the atomic interaction radii ***
1083 CALL init_interaction_radii(dft_control%qs_control, qs_kind_set)
1084 !
1085 IF (dft_control%qs_control%method_id == do_method_xtb) THEN
1086 ! cutoff radius
1087 DO ikind = 1, nkind
1088 qs_kind => qs_kind_set(ikind)
1089 IF (qs_kind%xtb_parameter%defined) THEN
1090 CALL get_qs_kind(qs_kind, basis_set=tmp_basis_set)
1091 rcut = xtb_control%coulomb_sr_cut
1092 fxx = 2.0_dp*xtb_control%coulomb_sr_eps*qs_kind%xtb_parameter%eta**2
1093 fxx = 0.80_dp*(1.0_dp/fxx)**0.3333_dp
1094 rcut = min(rcut, xtb_control%coulomb_sr_cut)
1095 qs_kind%xtb_parameter%rcut = min(rcut, fxx)
1096 ELSE
1097 qs_kind%xtb_parameter%rcut = 0.0_dp
1098 END IF
1099 END DO
1100 END IF
1101
1102 IF (.NOT. be_silent) THEN
1103 CALL write_pgf_orb_radii("orb", atomic_kind_set, qs_kind_set, subsys_section)
1104 CALL write_pgf_orb_radii("aux", atomic_kind_set, qs_kind_set, subsys_section)
1105 CALL write_pgf_orb_radii("lri", atomic_kind_set, qs_kind_set, subsys_section)
1106 CALL write_core_charge_radii(atomic_kind_set, qs_kind_set, subsys_section)
1107 CALL write_ppl_radii(atomic_kind_set, qs_kind_set, subsys_section)
1108 CALL write_ppnl_radii(atomic_kind_set, qs_kind_set, subsys_section)
1109 CALL write_paw_radii(atomic_kind_set, qs_kind_set, subsys_section)
1110 END IF
1111
1112 ! *** Distribute molecules and atoms using the new data structures ***
1113 CALL distribute_molecules_1d(atomic_kind_set=atomic_kind_set, &
1114 particle_set=particle_set, &
1115 local_particles=local_particles, &
1116 molecule_kind_set=molecule_kind_set, &
1117 molecule_set=molecule_set, &
1118 local_molecules=local_molecules, &
1119 force_env_section=qs_env%input)
1120
1121 ! *** SCF parameters ***
1122 ALLOCATE (scf_control)
1123 ! set (non)-self consistency
1124 IF (dft_control%qs_control%dftb) THEN
1125 scf_control%non_selfconsistent = .NOT. dft_control%qs_control%dftb_control%self_consistent
1126 END IF
1127 IF (dft_control%qs_control%xtb) THEN
1128 scf_control%non_selfconsistent = (dft_control%qs_control%xtb_control%gfn_type == 0)
1129 END IF
1130 IF (qs_env%harris_method) THEN
1131 scf_control%non_selfconsistent = .true.
1132 END IF
1133 CALL scf_c_create(scf_control)
1134 CALL scf_c_read_parameters(scf_control, dft_section)
1135 ! *** Allocate the data structure for Quickstep energies ***
1136 CALL allocate_qs_energy(energy)
1137
1138 ! check for orthogonal basis
1139 has_unit_metric = .false.
1140 IF (dft_control%qs_control%semi_empirical) THEN
1141 IF (dft_control%qs_control%se_control%orthogonal_basis) has_unit_metric = .true.
1142 END IF
1143 IF (dft_control%qs_control%dftb) THEN
1144 IF (dft_control%qs_control%dftb_control%orthogonal_basis) has_unit_metric = .true.
1145 END IF
1146 CALL set_qs_env(qs_env, has_unit_metric=has_unit_metric)
1147
1148 ! *** Activate the interpolation ***
1149 CALL wfi_create(wf_history, &
1150 interpolation_method_nr= &
1151 dft_control%qs_control%wf_interpolation_method_nr, &
1152 extrapolation_order=dft_control%qs_control%wf_extrapolation_order, &
1153 has_unit_metric=has_unit_metric)
1154
1155 ! *** Set the current Quickstep environment ***
1156 CALL set_qs_env(qs_env=qs_env, &
1157 scf_control=scf_control, &
1158 wf_history=wf_history)
1159
1160 CALL qs_subsys_set(subsys, &
1161 cell_ref=cell_ref, &
1162 use_ref_cell=use_ref_cell, &
1163 energy=energy, &
1164 force=force)
1165
1166 CALL get_qs_env(qs_env, ks_env=ks_env)
1167 CALL set_ks_env(ks_env, dft_control=dft_control)
1168
1169 CALL qs_subsys_set(subsys, local_molecules=local_molecules, &
1170 local_particles=local_particles, cell=cell)
1171
1172 CALL distribution_1d_release(local_particles)
1173 CALL distribution_1d_release(local_molecules)
1174 CALL wfi_release(wf_history)
1175
1176 CALL get_qs_env(qs_env=qs_env, &
1177 atomic_kind_set=atomic_kind_set, &
1178 dft_control=dft_control, &
1179 scf_control=scf_control)
1180
1181 ! decide what conditions need mo_derivs
1182 ! right now, this only appears to be OT
1183 IF (dft_control%qs_control%do_ls_scf .OR. &
1184 dft_control%qs_control%do_almo_scf) THEN
1185 CALL set_qs_env(qs_env=qs_env, requires_mo_derivs=.false.)
1186 ELSE
1187 IF (scf_control%use_ot) THEN
1188 CALL set_qs_env(qs_env=qs_env, requires_mo_derivs=.true.)
1189 ELSE
1190 CALL set_qs_env(qs_env=qs_env, requires_mo_derivs=.false.)
1191 END IF
1192 END IF
1193
1194 ! XXXXXXX this is backwards XXXXXXXX
1195 dft_control%smear = scf_control%smear%do_smear
1196
1197 ! Periodic efield needs equal occupation and orbital gradients
1198 IF (.NOT. (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)) THEN
1199 IF (dft_control%apply_period_efield) THEN
1200 CALL get_qs_env(qs_env=qs_env, requires_mo_derivs=orb_gradient)
1201 IF (.NOT. orb_gradient) THEN
1202 CALL cp_abort(__location__, "Periodic Efield needs orbital gradient and direct optimization."// &
1203 " Use the OT optimization method.")
1204 END IF
1205 IF (dft_control%smear) THEN
1206 CALL cp_abort(__location__, "Periodic Efield needs equal occupation numbers."// &
1207 " Smearing option is not possible.")
1208 END IF
1209 END IF
1210 END IF
1211
1212 ! Initialize the GAPW local densities and potentials
1213 IF (dft_control%qs_control%method_id == do_method_gapw .OR. &
1214 dft_control%qs_control%method_id == do_method_gapw_xc) THEN
1215 ! *** Allocate and initialize the set of atomic densities ***
1216 NULLIFY (rho_atom_set)
1217 gapw_control => dft_control%qs_control%gapw_control
1218 CALL init_rho_atom(rho_atom_set, atomic_kind_set, qs_kind_set, dft_control, para_env)
1219 CALL set_qs_env(qs_env=qs_env, rho_atom_set=rho_atom_set)
1220 IF (dft_control%qs_control%method_id /= do_method_gapw_xc) THEN
1221 CALL get_qs_env(qs_env=qs_env, local_rho_set=local_rho_set, natom=natom)
1222 ! *** Allocate and initialize the compensation density rho0 ***
1223 CALL init_rho0(local_rho_set, qs_env, gapw_control)
1224 ! *** Allocate and Initialize the local coulomb term ***
1225 CALL init_coulomb_local(qs_env%hartree_local, natom)
1226 END IF
1227 ! NLCC
1228 CALL init_gapw_nlcc(qs_kind_set)
1229 ELSE IF (dft_control%qs_control%method_id == do_method_lrigpw) THEN
1230 ! allocate local ri environment
1231 ! nothing to do here?
1232 ELSE IF (dft_control%qs_control%method_id == do_method_rigpw) THEN
1233 ! allocate ri environment
1234 ! nothing to do here?
1235 ELSE IF (dft_control%qs_control%semi_empirical) THEN
1236 NULLIFY (se_store_int_env, se_nddo_mpole, se_nonbond_env)
1237 natom = SIZE(particle_set)
1238 se_section => section_vals_get_subs_vals(qs_section, "SE")
1239 se_control => dft_control%qs_control%se_control
1240
1241 ! Make the cutoff radii choice a bit smarter
1242 CALL se_cutoff_compatible(se_control, se_section, cell, output_unit)
1243
1244 SELECT CASE (dft_control%qs_control%method_id)
1245 CASE DEFAULT
1248 ! Neighbor lists have to be MAX(interaction range, orbital range)
1249 ! set new kind radius
1250 CALL init_se_nlradius(se_control, atomic_kind_set, qs_kind_set, subsys_section)
1251 END SELECT
1252 ! Initialize to zero the max multipole to treat in the EWALD scheme..
1253 se_control%max_multipole = do_multipole_none
1254 ! check for Ewald
1255 IF (se_control%do_ewald .OR. se_control%do_ewald_gks) THEN
1256 ALLOCATE (ewald_env)
1257 CALL ewald_env_create(ewald_env, para_env)
1258 poisson_section => section_vals_get_subs_vals(dft_section, "POISSON")
1259 CALL ewald_env_set(ewald_env, poisson_section=poisson_section)
1260 ewald_section => section_vals_get_subs_vals(poisson_section, "EWALD")
1261 print_section => section_vals_get_subs_vals(qs_env%input, &
1262 "PRINT%GRID_INFORMATION")
1263 CALL read_ewald_section(ewald_env, ewald_section)
1264 ! Create ewald grids
1265 ALLOCATE (ewald_pw)
1266 CALL ewald_pw_create(ewald_pw, ewald_env, cell, cell_ref, &
1267 print_section=print_section)
1268 ! Initialize ewald grids
1269 CALL ewald_pw_grid_update(ewald_pw, ewald_env, cell%hmat)
1270 ! Setup the nonbond environment (real space part of Ewald)
1271 CALL ewald_env_get(ewald_env, rcut=ewald_rcut)
1272 ! Setup the maximum level of multipoles to be treated in the periodic SE scheme
1273 IF (se_control%do_ewald) THEN
1274 CALL ewald_env_get(ewald_env, max_multipole=se_control%max_multipole)
1275 END IF
1276 CALL section_vals_val_get(se_section, "NEIGHBOR_LISTS%VERLET_SKIN", &
1277 r_val=verlet_skin)
1278 ALLOCATE (se_nonbond_env)
1279 CALL fist_nonbond_env_create(se_nonbond_env, atomic_kind_set, do_nonbonded=.true., &
1280 do_electrostatics=.true., verlet_skin=verlet_skin, ewald_rcut=ewald_rcut, &
1281 ei_scale14=0.0_dp, vdw_scale14=0.0_dp, shift_cutoff=.false.)
1282 ! Create and Setup NDDO multipole environment
1283 CALL nddo_mpole_setup(se_nddo_mpole, natom)
1284 CALL set_qs_env(qs_env, ewald_env=ewald_env, ewald_pw=ewald_pw, &
1285 se_nonbond_env=se_nonbond_env, se_nddo_mpole=se_nddo_mpole)
1286 ! Handle the residual integral part 1/R^3
1287 CALL semi_empirical_expns3_setup(qs_kind_set, se_control, &
1288 dft_control%qs_control%method_id)
1289 END IF
1290 ! Taper function
1291 CALL se_taper_create(se_taper, se_control%integral_screening, se_control%do_ewald, &
1292 se_control%taper_cou, se_control%range_cou, &
1293 se_control%taper_exc, se_control%range_exc, &
1294 se_control%taper_scr, se_control%range_scr, &
1295 se_control%taper_lrc, se_control%range_lrc)
1296 CALL set_qs_env(qs_env, se_taper=se_taper)
1297 ! Store integral environment
1298 CALL semi_empirical_si_create(se_store_int_env, se_section)
1299 CALL set_qs_env(qs_env, se_store_int_env=se_store_int_env)
1300 END IF
1301
1302 ! Initialize possible dispersion parameters
1303 IF (dft_control%qs_control%method_id == do_method_gpw .OR. &
1304 dft_control%qs_control%method_id == do_method_gapw .OR. &
1305 dft_control%qs_control%method_id == do_method_gapw_xc .OR. &
1306 dft_control%qs_control%method_id == do_method_lrigpw .OR. &
1307 dft_control%qs_control%method_id == do_method_rigpw .OR. &
1308 dft_control%qs_control%method_id == do_method_ofgpw) THEN
1309 ALLOCATE (dispersion_env)
1310 NULLIFY (xc_section)
1311 xc_section => section_vals_get_subs_vals(dft_section, "XC")
1312 CALL qs_dispersion_env_set(dispersion_env, xc_section)
1313 IF (dispersion_env%type == xc_vdw_fun_pairpot) THEN
1314 NULLIFY (pp_section)
1315 pp_section => section_vals_get_subs_vals(xc_section, "VDW_POTENTIAL%PAIR_POTENTIAL")
1316 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, pp_section, para_env)
1317 ELSE IF (dispersion_env%type == xc_vdw_fun_nonloc) THEN
1318 NULLIFY (nl_section)
1319 nl_section => section_vals_get_subs_vals(xc_section, "VDW_POTENTIAL%NON_LOCAL")
1320 CALL qs_dispersion_nonloc_init(dispersion_env, para_env)
1321 END IF
1322 CALL set_qs_env(qs_env, dispersion_env=dispersion_env)
1323 ELSE IF (dft_control%qs_control%method_id == do_method_dftb) THEN
1324 ALLOCATE (dispersion_env)
1325 ! set general defaults
1326 dispersion_env%doabc = .false.
1327 dispersion_env%c9cnst = .false.
1328 dispersion_env%lrc = .false.
1329 dispersion_env%srb = .false.
1330 dispersion_env%verbose = .false.
1331 NULLIFY (dispersion_env%c6ab, dispersion_env%maxci, dispersion_env%r0ab, dispersion_env%rcov, &
1332 dispersion_env%r2r4, dispersion_env%cn, dispersion_env%cnkind, dispersion_env%cnlist, &
1333 dispersion_env%d3_exclude_pair)
1334 NULLIFY (dispersion_env%q_mesh, dispersion_env%kernel, dispersion_env%d2phi_dk2, &
1335 dispersion_env%d2y_dx2, dispersion_env%dftd_section)
1336 NULLIFY (dispersion_env%sab_vdw, dispersion_env%sab_cn)
1337 IF (dftb_control%dispersion .AND. dftb_control%dispersion_type == dispersion_d3) THEN
1338 dispersion_env%type = xc_vdw_fun_pairpot
1339 dispersion_env%pp_type = vdw_pairpot_dftd3
1340 dispersion_env%eps_cn = dftb_control%epscn
1341 dispersion_env%s6 = dftb_control%sd3(1)
1342 dispersion_env%sr6 = dftb_control%sd3(2)
1343 dispersion_env%s8 = dftb_control%sd3(3)
1344 dispersion_env%domol = .false.
1345 dispersion_env%kgc8 = 0._dp
1346 dispersion_env%rc_disp = dftb_control%rcdisp
1347 dispersion_env%exp_pre = 0._dp
1348 dispersion_env%scaling = 0._dp
1349 dispersion_env%nd3_exclude_pair = 0
1350 dispersion_env%parameter_file_name = dftb_control%dispersion_parameter_file
1351 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, para_env=para_env)
1352 ELSEIF (dftb_control%dispersion .AND. dftb_control%dispersion_type == dispersion_d3bj) THEN
1353 dispersion_env%type = xc_vdw_fun_pairpot
1354 dispersion_env%pp_type = vdw_pairpot_dftd3bj
1355 dispersion_env%eps_cn = dftb_control%epscn
1356 dispersion_env%s6 = dftb_control%sd3bj(1)
1357 dispersion_env%a1 = dftb_control%sd3bj(2)
1358 dispersion_env%s8 = dftb_control%sd3bj(3)
1359 dispersion_env%a2 = dftb_control%sd3bj(4)
1360 dispersion_env%domol = .false.
1361 dispersion_env%kgc8 = 0._dp
1362 dispersion_env%rc_disp = dftb_control%rcdisp
1363 dispersion_env%exp_pre = 0._dp
1364 dispersion_env%scaling = 0._dp
1365 dispersion_env%nd3_exclude_pair = 0
1366 dispersion_env%parameter_file_name = dftb_control%dispersion_parameter_file
1367 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, para_env=para_env)
1368 ELSEIF (dftb_control%dispersion .AND. dftb_control%dispersion_type == dispersion_d2) THEN
1369 dispersion_env%type = xc_vdw_fun_pairpot
1370 dispersion_env%pp_type = vdw_pairpot_dftd2
1371 dispersion_env%exp_pre = dftb_control%exp_pre
1372 dispersion_env%scaling = dftb_control%scaling
1373 dispersion_env%parameter_file_name = dftb_control%dispersion_parameter_file
1374 dispersion_env%rc_disp = dftb_control%rcdisp
1375 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, para_env=para_env)
1376 ELSE
1377 dispersion_env%type = xc_vdw_fun_none
1378 END IF
1379 CALL set_qs_env(qs_env, dispersion_env=dispersion_env)
1380 ELSE IF (dft_control%qs_control%method_id == do_method_xtb) THEN
1381 ALLOCATE (dispersion_env)
1382 ! set general defaults
1383 dispersion_env%doabc = .false.
1384 dispersion_env%c9cnst = .false.
1385 dispersion_env%lrc = .false.
1386 dispersion_env%srb = .false.
1387 dispersion_env%verbose = .false.
1388 NULLIFY (dispersion_env%c6ab, dispersion_env%maxci, &
1389 dispersion_env%r0ab, dispersion_env%rcov, &
1390 dispersion_env%r2r4, dispersion_env%cn, &
1391 dispersion_env%cnkind, dispersion_env%cnlist, &
1392 dispersion_env%d3_exclude_pair)
1393 NULLIFY (dispersion_env%q_mesh, dispersion_env%kernel, dispersion_env%d2phi_dk2, &
1394 dispersion_env%d2y_dx2, dispersion_env%dftd_section)
1395 NULLIFY (dispersion_env%sab_vdw, dispersion_env%sab_cn)
1396 dispersion_env%type = xc_vdw_fun_pairpot
1397 dispersion_env%eps_cn = xtb_control%epscn
1398 dispersion_env%s6 = xtb_control%s6
1399 dispersion_env%s8 = xtb_control%s8
1400 dispersion_env%a1 = xtb_control%a1
1401 dispersion_env%a2 = xtb_control%a2
1402 dispersion_env%domol = .false.
1403 dispersion_env%kgc8 = 0._dp
1404 dispersion_env%rc_disp = xtb_control%rcdisp
1405 dispersion_env%rc_d4 = xtb_control%rcdisp
1406 dispersion_env%exp_pre = 0._dp
1407 dispersion_env%scaling = 0._dp
1408 dispersion_env%nd3_exclude_pair = 0
1409 dispersion_env%parameter_file_name = xtb_control%dispersion_parameter_file
1410 !
1411 SELECT CASE (xtb_control%vdw_type)
1413 dispersion_env%pp_type = vdw_pairpot_dftd3bj
1414 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, para_env=para_env)
1415 IF (xtb_control%vdw_type == xtb_vdw_type_none) dispersion_env%type = xc_vdw_fun_none
1416 CASE (xtb_vdw_type_d4)
1417 dispersion_env%pp_type = vdw_pairpot_dftd4
1418 dispersion_env%ref_functional = "none"
1419 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, &
1420 dispersion_env, para_env=para_env)
1421 dispersion_env%cnfun = 2
1422 CASE DEFAULT
1423 cpabort("vdw type")
1424 END SELECT
1425 CALL set_qs_env(qs_env, dispersion_env=dispersion_env)
1426 ELSE IF (dft_control%qs_control%semi_empirical) THEN
1427 ALLOCATE (dispersion_env)
1428 ! set general defaults
1429 dispersion_env%doabc = .false.
1430 dispersion_env%c9cnst = .false.
1431 dispersion_env%lrc = .false.
1432 dispersion_env%srb = .false.
1433 dispersion_env%verbose = .false.
1434 NULLIFY (dispersion_env%c6ab, dispersion_env%maxci, dispersion_env%r0ab, dispersion_env%rcov, &
1435 dispersion_env%r2r4, dispersion_env%cn, dispersion_env%cnkind, dispersion_env%cnlist, &
1436 dispersion_env%d3_exclude_pair)
1437 NULLIFY (dispersion_env%q_mesh, dispersion_env%kernel, dispersion_env%d2phi_dk2, &
1438 dispersion_env%d2y_dx2, dispersion_env%dftd_section)
1439 NULLIFY (dispersion_env%sab_vdw, dispersion_env%sab_cn)
1440 IF (se_control%dispersion) THEN
1441 dispersion_env%type = xc_vdw_fun_pairpot
1442 dispersion_env%pp_type = vdw_pairpot_dftd3
1443 dispersion_env%eps_cn = se_control%epscn
1444 dispersion_env%s6 = se_control%sd3(1)
1445 dispersion_env%sr6 = se_control%sd3(2)
1446 dispersion_env%s8 = se_control%sd3(3)
1447 dispersion_env%domol = .false.
1448 dispersion_env%kgc8 = 0._dp
1449 dispersion_env%rc_disp = se_control%rcdisp
1450 dispersion_env%exp_pre = 0._dp
1451 dispersion_env%scaling = 0._dp
1452 dispersion_env%nd3_exclude_pair = 0
1453 dispersion_env%parameter_file_name = se_control%dispersion_parameter_file
1454 CALL qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, para_env=para_env)
1455 ELSE
1456 dispersion_env%type = xc_vdw_fun_none
1457 END IF
1458 CALL set_qs_env(qs_env, dispersion_env=dispersion_env)
1459 END IF
1460
1461 ! Initialize possible geomertical counterpoise correction potential
1462 IF (dft_control%qs_control%method_id == do_method_gpw .OR. &
1463 dft_control%qs_control%method_id == do_method_gapw .OR. &
1464 dft_control%qs_control%method_id == do_method_gapw_xc .OR. &
1465 dft_control%qs_control%method_id == do_method_lrigpw .OR. &
1466 dft_control%qs_control%method_id == do_method_rigpw .OR. &
1467 dft_control%qs_control%method_id == do_method_ofgpw) THEN
1468 ALLOCATE (gcp_env)
1469 NULLIFY (xc_section)
1470 xc_section => section_vals_get_subs_vals(dft_section, "XC")
1471 CALL qs_gcp_env_set(gcp_env, xc_section)
1472 CALL qs_gcp_init(qs_env, gcp_env)
1473 CALL set_qs_env(qs_env, gcp_env=gcp_env)
1474 END IF
1475
1476 ! *** Allocate the MO data types ***
1477 CALL get_qs_kind_set(qs_kind_set, nsgf=n_ao, nelectron=nelectron)
1478
1479 ! the total number of electrons
1480 nelectron = nelectron - dft_control%charge
1481
1482 IF (dft_control%multiplicity == 0) THEN
1483 IF (modulo(nelectron, 2) == 0) THEN
1484 dft_control%multiplicity = 1
1485 ELSE
1486 dft_control%multiplicity = 2
1487 END IF
1488 END IF
1489
1490 multiplicity = dft_control%multiplicity
1491
1492 IF ((dft_control%nspins < 1) .OR. (dft_control%nspins > 2)) THEN
1493 cpabort("nspins should be 1 or 2 for the time being ...")
1494 END IF
1495
1496 IF ((modulo(nelectron, 2) /= 0) .AND. (dft_control%nspins == 1)) THEN
1497 IF (.NOT. dft_control%qs_control%ofgpw .AND. .NOT. dft_control%smear) THEN
1498 cpabort("Use the LSD option for an odd number of electrons")
1499 END IF
1500 END IF
1501
1502 ! The transition potential method to calculate XAS needs LSD
1503 IF (dft_control%do_xas_calculation) THEN
1504 IF (dft_control%nspins == 1) THEN
1505 cpabort("Use the LSD option for XAS with transition potential")
1506 END IF
1507 END IF
1508
1509 ! assigning the number of states per spin initial version, not yet very
1510 ! general. Should work for an even number of electrons and a single
1511 ! additional electron this set of options that requires full matrices,
1512 ! however, makes things a bit ugly right now.... we try to make a
1513 ! distinction between the number of electrons per spin and the number of
1514 ! MOs per spin this should allow the use of fractional occupations later
1515 ! on
1516 IF (dft_control%qs_control%ofgpw) THEN
1517
1518 IF (dft_control%nspins == 1) THEN
1519 maxocc = nelectron
1520 nelectron_spin(1) = nelectron
1521 nelectron_spin(2) = 0
1522 n_mo(1) = 1
1523 n_mo(2) = 0
1524 ELSE
1525 IF (modulo(nelectron + multiplicity - 1, 2) /= 0) THEN
1526 cpabort("LSD: try to use a different multiplicity")
1527 END IF
1528 nelectron_spin(1) = (nelectron + multiplicity - 1)/2
1529 nelectron_spin(2) = (nelectron - multiplicity + 1)/2
1530 IF (nelectron_spin(1) < 0) THEN
1531 cpabort("LSD: too few electrons for this multiplicity")
1532 END IF
1533 maxocc = maxval(nelectron_spin)
1534 n_mo(1) = min(nelectron_spin(1), 1)
1535 n_mo(2) = min(nelectron_spin(2), 1)
1536 END IF
1537
1538 ELSE
1539
1540 IF (dft_control%nspins == 1) THEN
1541 maxocc = 2.0_dp
1542 nelectron_spin(1) = nelectron
1543 nelectron_spin(2) = 0
1544 IF (modulo(nelectron, 2) == 0) THEN
1545 n_mo(1) = nelectron/2
1546 ELSE
1547 n_mo(1) = int(nelectron/2._dp) + 1
1548 END IF
1549 n_mo(2) = 0
1550 ELSE
1551 maxocc = 1.0_dp
1552
1553 ! The simplist spin distribution is written here. Special cases will
1554 ! need additional user input
1555 IF (modulo(nelectron + multiplicity - 1, 2) /= 0) THEN
1556 cpabort("LSD: try to use a different multiplicity")
1557 END IF
1558
1559 nelectron_spin(1) = (nelectron + multiplicity - 1)/2
1560 nelectron_spin(2) = (nelectron - multiplicity + 1)/2
1561
1562 IF (nelectron_spin(2) < 0) THEN
1563 cpabort("LSD: too few electrons for this multiplicity")
1564 END IF
1565
1566 n_mo(1) = nelectron_spin(1)
1567 n_mo(2) = nelectron_spin(2)
1568
1569 END IF
1570
1571 END IF
1572
1573 ! Read the total_zeff_corr here [SGh]
1574 CALL get_qs_kind_set(qs_kind_set, total_zeff_corr=total_zeff_corr)
1575 ! store it in qs_env
1576 qs_env%total_zeff_corr = total_zeff_corr
1577
1578 ! store the number of electrons once an for all
1579 CALL qs_subsys_set(subsys, &
1580 nelectron_total=nelectron, &
1581 nelectron_spin=nelectron_spin)
1582
1583 ! Check and set number of added (unoccupied) MOs
1584 IF (dft_control%nspins == 2) THEN
1585 IF (scf_control%added_mos(2) < 0) THEN
1586 n_mo_add = n_ao - n_mo(2) ! use all available MOs
1587 ELSEIF (scf_control%added_mos(2) > 0) THEN
1588 n_mo_add = scf_control%added_mos(2)
1589 ELSE
1590 n_mo_add = scf_control%added_mos(1)
1591 END IF
1592 IF (n_mo_add > n_ao - n_mo(2)) THEN
1593 cpwarn("More ADDED_MOs requested for beta spin than available.")
1594 END IF
1595 scf_control%added_mos(2) = min(n_mo_add, n_ao - n_mo(2))
1596 n_mo(2) = n_mo(2) + scf_control%added_mos(2)
1597 END IF
1598
1599 ! proceed alpha orbitals after the beta orbitals; this is essential to avoid
1600 ! reduction in the number of available unoccupied molecular orbitals.
1601 ! E.g. n_ao = 10, nelectrons = 10, multiplicity = 3 implies n_mo(1) = 6, n_mo(2) = 4;
1602 ! added_mos(1:2) = (6,undef) should increase the number of molecular orbitals as
1603 ! n_mo(1) = min(n_ao, n_mo(1) + added_mos(1)) = 10, n_mo(2) = 10.
1604 ! However, if we try to proceed alpha orbitals first, this leads us n_mo(1:2) = (10,8)
1605 ! due to the following assignment instruction above:
1606 ! IF (scf_control%added_mos(2) > 0) THEN ... ELSE; n_mo_add = scf_control%added_mos(1); END IF
1607 IF (scf_control%added_mos(1) < 0) THEN
1608 scf_control%added_mos(1) = n_ao - n_mo(1) ! use all available MOs
1609 ELSEIF (scf_control%added_mos(1) > n_ao - n_mo(1)) THEN
1610 CALL cp_warn(__location__, &
1611 "More added MOs requested than available. "// &
1612 "The full set of unoccupied MOs will be used. "// &
1613 "Use 'ADDED_MOS -1' to always use all available MOs "// &
1614 "and to get rid of this warning.")
1615 END IF
1616 scf_control%added_mos(1) = min(scf_control%added_mos(1), n_ao - n_mo(1))
1617 n_mo(1) = n_mo(1) + scf_control%added_mos(1)
1618
1619 IF (dft_control%nspins == 2) THEN
1620 IF (n_mo(2) > n_mo(1)) &
1621 CALL cp_warn(__location__, &
1622 "More beta than alpha MOs requested. "// &
1623 "The number of beta MOs will be reduced to the number alpha MOs.")
1624 n_mo(2) = min(n_mo(1), n_mo(2))
1625 cpassert(n_mo(1) >= nelectron_spin(1))
1626 cpassert(n_mo(2) >= nelectron_spin(2))
1627 END IF
1628
1629 ! kpoints
1630 CALL get_qs_env(qs_env=qs_env, do_kpoints=do_kpoints)
1631 IF (do_kpoints .AND. dft_control%nspins == 2) THEN
1632 ! we need equal number of calculated states
1633 IF (n_mo(2) /= n_mo(1)) &
1634 CALL cp_warn(__location__, &
1635 "Kpoints: Different number of MOs requested. "// &
1636 "The number of beta MOs will be set to the number alpha MOs.")
1637 n_mo(2) = n_mo(1)
1638 cpassert(n_mo(1) >= nelectron_spin(1))
1639 cpassert(n_mo(2) >= nelectron_spin(2))
1640 END IF
1641
1642 ! Compatibility checks for smearing
1643 IF (scf_control%smear%do_smear) THEN
1644 IF (scf_control%added_mos(1) == 0) THEN
1645 cpabort("Extra MOs (ADDED_MOS) are required for smearing")
1646 END IF
1647 END IF
1648
1649 ! *** Some options require that all MOs are computed ... ***
1650 IF (btest(cp_print_key_should_output(logger%iter_info, dft_section, &
1651 "PRINT%MO/CARTESIAN"), &
1652 cp_p_file) .OR. &
1653 (scf_control%level_shift /= 0.0_dp) .OR. &
1654 (scf_control%diagonalization%eps_jacobi /= 0.0_dp) .OR. &
1655 (dft_control%roks .AND. (.NOT. scf_control%use_ot))) THEN
1656 n_mo(:) = n_ao
1657 END IF
1658
1659 ! Compatibility checks for ROKS
1660 IF (dft_control%roks .AND. (.NOT. scf_control%use_ot)) THEN
1661 IF (scf_control%roks_scheme == general_roks) THEN
1662 cpwarn("General ROKS scheme is not yet tested!")
1663 END IF
1664 IF (scf_control%smear%do_smear) THEN
1665 CALL cp_abort(__location__, &
1666 "The options ROKS and SMEAR are not compatible. "// &
1667 "Try UKS instead of ROKS")
1668 END IF
1669 END IF
1670 IF (dft_control%low_spin_roks) THEN
1671 SELECT CASE (dft_control%qs_control%method_id)
1672 CASE DEFAULT
1674 CALL cp_abort(__location__, &
1675 "xTB/DFTB methods are not compatible with low spin ROKS.")
1678 CALL cp_abort(__location__, &
1679 "SE methods are not compatible with low spin ROKS.")
1680 END SELECT
1681 END IF
1682
1683 ! in principle the restricted calculation could be performed
1684 ! using just one set of MOs and special casing most of the code
1685 ! right now we'll just take care of what is effectively an additional constraint
1686 ! at as few places as possible, just duplicating the beta orbitals
1687 IF (dft_control%restricted .AND. (output_unit > 0)) THEN
1688 ! it is really not yet tested till the end ! Joost
1689 WRITE (output_unit, *) ""
1690 WRITE (output_unit, *) " **************************************"
1691 WRITE (output_unit, *) " restricted calculation cutting corners"
1692 WRITE (output_unit, *) " experimental feature, check code "
1693 WRITE (output_unit, *) " **************************************"
1694 END IF
1695
1696 ! no point in allocating these things here ?
1697 IF (dft_control%qs_control%do_ls_scf) THEN
1698 NULLIFY (mos)
1699 ELSE
1700 ALLOCATE (mos(dft_control%nspins))
1701 DO ispin = 1, dft_control%nspins
1702 CALL allocate_mo_set(mo_set=mos(ispin), &
1703 nao=n_ao, &
1704 nmo=n_mo(ispin), &
1705 nelectron=nelectron_spin(ispin), &
1706 n_el_f=real(nelectron_spin(ispin), dp), &
1707 maxocc=maxocc, &
1708 flexible_electron_count=dft_control%relax_multiplicity)
1709 END DO
1710 END IF
1711
1712 CALL set_qs_env(qs_env, mos=mos)
1713
1714 ! allocate mos when switch_surf_dip is triggered [SGh]
1715 IF (dft_control%switch_surf_dip) THEN
1716 ALLOCATE (mos_last_converged(dft_control%nspins))
1717 DO ispin = 1, dft_control%nspins
1718 CALL allocate_mo_set(mo_set=mos_last_converged(ispin), &
1719 nao=n_ao, &
1720 nmo=n_mo(ispin), &
1721 nelectron=nelectron_spin(ispin), &
1722 n_el_f=real(nelectron_spin(ispin), dp), &
1723 maxocc=maxocc, &
1724 flexible_electron_count=dft_control%relax_multiplicity)
1725 END DO
1726 CALL set_qs_env(qs_env, mos_last_converged=mos_last_converged)
1727 END IF
1728
1729 IF (.NOT. be_silent) THEN
1730 ! Print the DFT control parameters
1731 CALL write_dft_control(dft_control, dft_section)
1732
1733 ! Print the vdW control parameters
1734 IF (dft_control%qs_control%method_id == do_method_gpw .OR. &
1735 dft_control%qs_control%method_id == do_method_gapw .OR. &
1736 dft_control%qs_control%method_id == do_method_gapw_xc .OR. &
1737 dft_control%qs_control%method_id == do_method_lrigpw .OR. &
1738 dft_control%qs_control%method_id == do_method_rigpw .OR. &
1739 dft_control%qs_control%method_id == do_method_dftb .OR. &
1740 dft_control%qs_control%method_id == do_method_xtb .OR. &
1741 dft_control%qs_control%method_id == do_method_ofgpw) THEN
1742 CALL get_qs_env(qs_env, dispersion_env=dispersion_env)
1743 CALL qs_write_dispersion(qs_env, dispersion_env)
1744 END IF
1745
1746 ! Print the Quickstep control parameters
1747 CALL write_qs_control(dft_control%qs_control, dft_section)
1748
1749 ! Print the ADMM control parameters
1750 IF (dft_control%do_admm) THEN
1751 CALL write_admm_control(dft_control%admm_control, dft_section)
1752 END IF
1753
1754 ! Print XES/XAS control parameters
1755 IF (dft_control%do_xas_calculation) THEN
1756 CALL cite_reference(iannuzzi2007)
1757 !CALL write_xas_control(dft_control%xas_control,dft_section)
1758 END IF
1759
1760 ! Print the unnormalized basis set information (input data)
1761 CALL write_gto_basis_sets(qs_kind_set, subsys_section)
1762
1763 ! Print the atomic kind set
1764 CALL write_qs_kind_set(qs_kind_set, subsys_section)
1765
1766 ! Print the molecule kind set
1767 CALL write_molecule_kind_set(molecule_kind_set, subsys_section)
1768
1769 ! Print the total number of kinds, atoms, basis functions etc.
1770 CALL write_total_numbers(qs_kind_set, particle_set, qs_env%input)
1771
1772 ! Print the atomic coordinates
1773 CALL write_qs_particle_coordinates(particle_set, qs_kind_set, subsys_section, label="QUICKSTEP")
1774
1775 ! Print the interatomic distances
1776 CALL write_particle_distances(particle_set, cell, subsys_section)
1777
1778 ! Print the requested structure data
1779 CALL write_structure_data(particle_set, cell, subsys_section)
1780
1781 ! Print symmetry information
1782 CALL write_symmetry(particle_set, cell, subsys_section)
1783
1784 ! Print the SCF parameters
1785 IF ((.NOT. dft_control%qs_control%do_ls_scf) .AND. &
1786 (.NOT. dft_control%qs_control%do_almo_scf)) THEN
1787 CALL scf_c_write_parameters(scf_control, dft_section)
1788 END IF
1789 END IF
1790
1791 ! Sets up pw_env, qs_charges, mpools ...
1792 CALL qs_env_setup(qs_env)
1793
1794 ! Allocate and initialise rho0 soft on the global grid
1795 IF (dft_control%qs_control%method_id == do_method_gapw) THEN
1796 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env, rho0_mpole=rho0_mpole)
1797 CALL rho0_s_grid_create(pw_env, rho0_mpole)
1798 END IF
1799
1800 IF (output_unit > 0) CALL m_flush(output_unit)
1801 CALL timestop(handle)
1802
1803 END SUBROUTINE qs_init_subsys
1804
1805! **************************************************************************************************
1806!> \brief Write the total number of kinds, atoms, etc. to the logical unit
1807!> number lunit.
1808!> \param qs_kind_set ...
1809!> \param particle_set ...
1810!> \param force_env_section ...
1811!> \author Creation (06.10.2000)
1812! **************************************************************************************************
1813 SUBROUTINE write_total_numbers(qs_kind_set, particle_set, force_env_section)
1814
1815 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
1816 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
1817 TYPE(section_vals_type), POINTER :: force_env_section
1818
1819 INTEGER :: maxlgto, maxlppl, maxlppnl, natom, ncgf, &
1820 nkind, npgf, nset, nsgf, nshell, &
1821 output_unit
1822 TYPE(cp_logger_type), POINTER :: logger
1823
1824 NULLIFY (logger)
1825 logger => cp_get_default_logger()
1826 output_unit = cp_print_key_unit_nr(logger, force_env_section, "PRINT%TOTAL_NUMBERS", &
1827 extension=".Log")
1828
1829 IF (output_unit > 0) THEN
1830 natom = SIZE(particle_set)
1831 nkind = SIZE(qs_kind_set)
1832
1833 CALL get_qs_kind_set(qs_kind_set, &
1834 maxlgto=maxlgto, &
1835 ncgf=ncgf, &
1836 npgf=npgf, &
1837 nset=nset, &
1838 nsgf=nsgf, &
1839 nshell=nshell, &
1840 maxlppl=maxlppl, &
1841 maxlppnl=maxlppnl)
1842
1843 WRITE (unit=output_unit, fmt="(/,/,T2,A)") &
1844 "TOTAL NUMBERS AND MAXIMUM NUMBERS"
1845
1846 IF (nset + npgf + ncgf > 0) THEN
1847 WRITE (unit=output_unit, fmt="(/,T3,A,(T30,A,T71,I10))") &
1848 "Total number of", &
1849 "- Atomic kinds: ", nkind, &
1850 "- Atoms: ", natom, &
1851 "- Shell sets: ", nset, &
1852 "- Shells: ", nshell, &
1853 "- Primitive Cartesian functions: ", npgf, &
1854 "- Cartesian basis functions: ", ncgf, &
1855 "- Spherical basis functions: ", nsgf
1856 ELSE IF (nshell + nsgf > 0) THEN
1857 WRITE (unit=output_unit, fmt="(/,T3,A,(T30,A,T71,I10))") &
1858 "Total number of", &
1859 "- Atomic kinds: ", nkind, &
1860 "- Atoms: ", natom, &
1861 "- Shells: ", nshell, &
1862 "- Spherical basis functions: ", nsgf
1863 ELSE
1864 WRITE (unit=output_unit, fmt="(/,T3,A,(T30,A,T71,I10))") &
1865 "Total number of", &
1866 "- Atomic kinds: ", nkind, &
1867 "- Atoms: ", natom
1868 END IF
1869
1870 IF ((maxlppl > -1) .AND. (maxlppnl > -1)) THEN
1871 WRITE (unit=output_unit, fmt="(/,T3,A,(T30,A,T75,I6))") &
1872 "Maximum angular momentum of the", &
1873 "- Orbital basis functions: ", maxlgto, &
1874 "- Local part of the GTH pseudopotential: ", maxlppl, &
1875 "- Non-local part of the GTH pseudopotential: ", maxlppnl
1876 ELSEIF (maxlppl > -1) THEN
1877 WRITE (unit=output_unit, fmt="(/,T3,A,(T30,A,T75,I6))") &
1878 "Maximum angular momentum of the", &
1879 "- Orbital basis functions: ", maxlgto, &
1880 "- Local part of the GTH pseudopotential: ", maxlppl
1881 ELSE
1882 WRITE (unit=output_unit, fmt="(/,T3,A,T75,I6)") &
1883 "Maximum angular momentum of the orbital basis functions: ", maxlgto
1884 END IF
1885
1886 ! LRI_AUX BASIS
1887 CALL get_qs_kind_set(qs_kind_set, &
1888 maxlgto=maxlgto, &
1889 ncgf=ncgf, &
1890 npgf=npgf, &
1891 nset=nset, &
1892 nsgf=nsgf, &
1893 nshell=nshell, &
1894 basis_type="LRI_AUX")
1895 IF (nset + npgf + ncgf > 0) THEN
1896 WRITE (unit=output_unit, fmt="(/,T3,A,/,T3,A,(T30,A,T71,I10))") &
1897 "LRI_AUX Basis: ", &
1898 "Total number of", &
1899 "- Shell sets: ", nset, &
1900 "- Shells: ", nshell, &
1901 "- Primitive Cartesian functions: ", npgf, &
1902 "- Cartesian basis functions: ", ncgf, &
1903 "- Spherical basis functions: ", nsgf
1904 WRITE (unit=output_unit, fmt="(T30,A,T75,I6)") &
1905 " Maximum angular momentum ", maxlgto
1906 END IF
1907
1908 ! RI_HXC BASIS
1909 CALL get_qs_kind_set(qs_kind_set, &
1910 maxlgto=maxlgto, &
1911 ncgf=ncgf, &
1912 npgf=npgf, &
1913 nset=nset, &
1914 nsgf=nsgf, &
1915 nshell=nshell, &
1916 basis_type="RI_HXC")
1917 IF (nset + npgf + ncgf > 0) THEN
1918 WRITE (unit=output_unit, fmt="(/,T3,A,/,T3,A,(T30,A,T71,I10))") &
1919 "RI_HXC Basis: ", &
1920 "Total number of", &
1921 "- Shell sets: ", nset, &
1922 "- Shells: ", nshell, &
1923 "- Primitive Cartesian functions: ", npgf, &
1924 "- Cartesian basis functions: ", ncgf, &
1925 "- Spherical basis functions: ", nsgf
1926 WRITE (unit=output_unit, fmt="(T30,A,T75,I6)") &
1927 " Maximum angular momentum ", maxlgto
1928 END IF
1929
1930 ! AUX_FIT BASIS
1931 CALL get_qs_kind_set(qs_kind_set, &
1932 maxlgto=maxlgto, &
1933 ncgf=ncgf, &
1934 npgf=npgf, &
1935 nset=nset, &
1936 nsgf=nsgf, &
1937 nshell=nshell, &
1938 basis_type="AUX_FIT")
1939 IF (nset + npgf + ncgf > 0) THEN
1940 WRITE (unit=output_unit, fmt="(/,T3,A,/,T3,A,(T30,A,T71,I10))") &
1941 "AUX_FIT ADMM-Basis: ", &
1942 "Total number of", &
1943 "- Shell sets: ", nset, &
1944 "- Shells: ", nshell, &
1945 "- Primitive Cartesian functions: ", npgf, &
1946 "- Cartesian basis functions: ", ncgf, &
1947 "- Spherical basis functions: ", nsgf
1948 WRITE (unit=output_unit, fmt="(T30,A,T75,I6)") &
1949 " Maximum angular momentum ", maxlgto
1950 END IF
1951
1952 END IF
1953 CALL cp_print_key_finished_output(output_unit, logger, force_env_section, &
1954 "PRINT%TOTAL_NUMBERS")
1955
1956 END SUBROUTINE write_total_numbers
1957
1958END MODULE qs_environment
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
almo_scf_env methods
subroutine, public almo_scf_env_create(qs_env)
Creation and basic initialization of the almo environment.
calculate the orbitals for a given atomic kind type
subroutine, public calculate_atomic_relkin(atomic_kind, qs_kind, rel_control, rtmat)
...
Define the atomic kind types and their sub types.
Automatic generation of auxiliary basis sets of different kind.
Definition auto_basis.F:15
subroutine, public create_lri_aux_basis_set(lri_aux_basis_set, qs_kind, basis_cntrl, exact_1c_terms, tda_kernel)
Create a LRI_AUX basis set using some heuristics.
Definition auto_basis.F:224
subroutine, public create_ri_aux_basis_set(ri_aux_basis_set, qs_kind, basis_cntrl, basis_type, basis_sort)
Create a RI_AUX basis set using some heuristics.
Definition auto_basis.F:57
subroutine, public add_basis_set_to_container(container, basis_set, basis_set_type)
...
integer, parameter, public basis_sort_zet
subroutine, public deallocate_gto_basis_set(gto_basis_set)
...
subroutine, public create_primitive_basis_set(basis_set, pbasis, lmax)
...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public cp2kqs2020
integer, save, public iannuzzi2007
integer, save, public iannuzzi2006
Handles all functions related to the CELL.
Definition cell_types.F:15
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public cp_blacs_env_create(blacs_env, para_env, blacs_grid_layout, blacs_repeatable, row_major, grid_2d)
allocates and initializes a type that represent a blacs context
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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_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)
...
contains information regarding the decoupling/recoupling method of Bloechl
subroutine, public cp_ddapc_ewald_create(cp_ddapc_ewald, qmmm_decoupl, qm_cell, force_env_section, subsys_section, para_env)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
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,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
types that represent a subsys, i.e. a part of the system
Work with symmetry.
Definition cp_symmetry.F:13
subroutine, public write_symmetry(particle_set, cell, input_section)
Write symmetry information to output.
Definition cp_symmetry.F:61
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public distribution_1d_release(distribution_1d)
releases the given distribution_1d
Distribution methods for atoms, particles, or molecules.
subroutine, public distribute_molecules_1d(atomic_kind_set, particle_set, local_particles, molecule_kind_set, molecule_set, local_molecules, force_env_section, prev_molecule_kind_set, prev_local_molecules)
Distribute molecules and particles.
Types needed for a for a Energy Correction.
Energy correction environment setup and handling.
subroutine, public ec_write_input(ec_env)
Print out the energy correction input section.
subroutine, public ec_env_create(qs_env, ec_env, dft_section, ec_section)
Allocates and intitializes ec_env.
Definition and initialisation of the et_coupling data type.
subroutine, public et_coupling_create(et_coupling)
...
subroutine, public ewald_env_set(ewald_env, ewald_type, alpha, epsilon, eps_pol, gmax, ns_max, precs, o_spline, para_env, poisson_section, interaction_cutoffs, cell_hmat)
Purpose: Set the EWALD environment.
subroutine, public ewald_env_create(ewald_env, para_env)
allocates and intitializes a ewald_env
subroutine, public read_ewald_section(ewald_env, ewald_section)
Purpose: read the EWALD section.
subroutine, public read_ewald_section_tb(ewald_env, ewald_section, hmat, silent, pset)
Purpose: read the EWALD section for TB methods.
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
subroutine, public ewald_pw_grid_update(ewald_pw, ewald_env, cell_hmat)
Rescales pw_grids for given box, if necessary.
subroutine, public ewald_pw_create(ewald_pw, ewald_env, cell, cell_ref, print_section)
creates the structure ewald_pw_type
Types for excited states potential energies.
subroutine, public exstate_create(ex_env, excited_state, dft_section)
Allocates and intitializes exstate_env.
Definition of the atomic potential types.
subroutine, public fist_nonbond_env_create(fist_nonbond_env, atomic_kind_set, potparm14, potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, ei_scale14, vdw_scale14, shift_cutoff)
allocates and intitializes a fist_nonbond_env
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Definition gamma.F:15
subroutine, public init_md_ftable(nmax)
Initialize a table of F_n(t) values in the range 0 <= t <= 12 with a stepsize of 0....
Definition gamma.F:540
Define type storing the global information of a run. Keep the amount of stored data small....
subroutine, public init_coulomb_local(hartree_local, natom)
...
subroutine, public dftb_header(iw)
...
Definition header.F:193
subroutine, public qs_header(iw)
...
Definition header.F:274
subroutine, public se_header(iw)
...
Definition header.F:250
subroutine, public xtb_header(iw, gfn_type)
...
Definition header.F:217
Types and set/get functions for HFX.
Definition hfx_types.F:15
subroutine, public hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, particle_set, dft_control, cell, orb_basis, ri_basis, nelectron_total, nkp_grid)
This routine allocates and initializes all types in hfx_data
Definition hfx_types.F:594
subroutine, public compare_hfx_sections(hfx_section1, hfx_section2, is_identical, same_except_frac)
Compares the non-technical parts of two HFX input section and check whether they are the same Ignore ...
Definition hfx_types.F:2952
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_method_ofgpw
integer, parameter, public xc_vdw_fun_none
integer, parameter, public dispersion_d3
integer, parameter, public do_method_rigpw
integer, parameter, public do_method_gpw
integer, parameter, public vdw_pairpot_dftd3
integer, parameter, public do_method_pdg
integer, parameter, public wfi_linear_wf_method_nr
integer, parameter, public wfi_linear_ps_method_nr
integer, parameter, public do_method_pnnl
integer, parameter, public xc_vdw_fun_nonloc
integer, parameter, public vdw_pairpot_dftd4
integer, parameter, public xtb_vdw_type_d3
integer, parameter, public wfi_use_guess_method_nr
integer, parameter, public kg_tnadd_embed_ri
integer, parameter, public dispersion_d3bj
integer, parameter, public do_method_rm1
integer, parameter, public do_qmmm_swave
integer, parameter, public do_method_pm3
integer, parameter, public do_method_mndo
integer, parameter, public xtb_vdw_type_d4
integer, parameter, public do_method_gapw
integer, parameter, public do_method_mndod
integer, parameter, public rel_trans_atom
integer, parameter, public xtb_vdw_type_none
integer, parameter, public do_method_am1
integer, parameter, public do_method_dftb
integer, parameter, public do_qmmm_gauss
integer, parameter, public wfi_ps_method_nr
integer, parameter, public rel_none
integer, parameter, public general_roks
integer, parameter, public vdw_pairpot_dftd2
integer, parameter, public do_method_lrigpw
integer, parameter, public dispersion_d2
integer, parameter, public wfi_aspc_nr
integer, parameter, public do_method_xtb
integer, parameter, public do_method_pm6fm
integer, parameter, public xc_vdw_fun_pairpot
integer, parameter, public do_et_ddapc
integer, parameter, public vdw_pairpot_dftd3bj
integer, parameter, public do_method_gapw_xc
integer, parameter, public do_method_pm6
integer, parameter, public hden_atomic
objects that represent the structure of input sections and the data contained in an input section
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
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
Routines for a Kim-Gordon-like partitioning into molecular subunits.
subroutine, public kg_env_create(qs_env, kg_env, qs_kind_set, input)
Allocates and intitializes kg_env.
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
Routines needed for kpoint calculation.
subroutine, public kpoint_initialize_mos(kpoint, mos, added_mos, for_aux_fit)
Initialize a set of MOs and density matrix for each kpoint (kpoint group)
subroutine, public kpoint_initialize(kpoint, particle_set, cell)
Generate the kpoints and initialize the kpoint environment.
subroutine, public kpoint_env_initialize(kpoint, para_env, blacs_env, with_aux_fit)
Initialize the kpoint environment.
Types and basic routines needed for a kpoint calculation.
subroutine, public read_kpoint_section(kpoint, kpoint_section, a_vec)
Read the kpoint input section.
subroutine, public write_kpoint_info(kpoint, dft_section)
Write information on the kpoints to output.
subroutine, public kpoint_create(kpoint)
Create a kpoint environment.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym)
Retrieve information from a kpoint environment.
initializes the environment for lri lri : local resolution of the identity
subroutine, public lri_env_init(lri_env, lri_section)
initializes the lri env
subroutine, public lri_env_basis(ri_type, qs_env, lri_env, qs_kind_set)
initializes the lri env
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:130
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Interface to the message passing library MPI.
Define the molecule kind structure types and the corresponding functionality.
subroutine, public write_molecule_kind_set(molecule_kind_set, subsys_section)
Write a moleculeatomic kind set data set to the output unit.
Define the data structure for the molecule information.
Types needed for MP2 calculations.
Definition mp2_setup.F:14
subroutine, public read_mp2_section(input, mp2_env)
...
Definition mp2_setup.F:62
Types needed for MP2 calculations.
Definition mp2_types.F:14
subroutine, public mp2_env_create(mp2_env)
...
Definition mp2_types.F:471
Multipole structure: for multipole (fixed and induced) in FF based MD.
integer, parameter, public do_multipole_none
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
Calculation of the spherical harmonics and the corresponding orbital transformation matrices.
subroutine, public init_spherical_harmonics(maxl, output_unit)
Initialize or update the orbital transformation matrices.
Define methods related to particle_type.
subroutine, public write_qs_particle_coordinates(particle_set, qs_kind_set, subsys_section, label)
Write the atomic coordinates to the output unit.
subroutine, public write_structure_data(particle_set, cell, input_section)
Write structure data requested by a separate structure data input section to the output unit....
subroutine, public write_particle_distances(particle_set, cell, subsys_section)
Write the matrix of the particle distances to the output unit.
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public qs_basis_rotation(qs_env, kpoints)
Construct basis set rotation matrices.
subroutine, public qs_dftb_param_init(atomic_kind_set, qs_kind_set, dftb_control, dftb_potential, subsys_section, para_env)
...
Definition of the DFTB parameter types.
Calculation of non local dispersion functionals Some routines adapted from: Copyright (C) 2001-2009 Q...
subroutine, public qs_dispersion_nonloc_init(dispersion_env, para_env)
...
Calculation of dispersion using pair potentials.
subroutine, public qs_dispersion_pairpot_init(atomic_kind_set, qs_kind_set, dispersion_env, pp_section, para_env)
...
Definition of disperson types for DFT calculations.
Set disperson types for DFT calculations.
subroutine, public qs_dispersion_env_set(dispersion_env, xc_section)
...
subroutine, public qs_write_dispersion(qs_env, dispersion_env, ounit)
...
subroutine, public allocate_qs_energy(qs_energy)
Allocate and/or initialise a Quickstep energy data structure.
qs_environment methods that use many other modules
subroutine, public qs_env_setup(qs_env)
initializes various components of the qs_env, that need only atomic_kind_set, cell,...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Set the QUICKSTEP environment.
subroutine, public qs_init(qs_env, para_env, root_section, globenv, cp_subsys, kpoint_env, cell, cell_ref, qmmm, qmmm_env_qm, force_env_section, subsys_section, use_motion_section, silent)
Read the input and the database files for the setup of the QUICKSTEP environment.
Definition of gCP types for DFT calculations.
Set disperson types for DFT calculations.
subroutine, public qs_gcp_env_set(gcp_env, xc_section)
...
subroutine, public qs_gcp_init(qs_env, gcp_env)
...
Types needed for a for a Harris model calculation.
subroutine, public harris_rhoin_init(rhoin, basis_type, qs_kind_set, atomic_kind_set, local_particles, nspin)
...
Harris method environment setup and handling.
subroutine, public harris_write_input(harris_env)
Print out the Harris method input section.
subroutine, public harris_env_create(qs_env, harris_env, harris_section)
Allocates and intitializes harris_env.
Calculate the interaction radii for the operator matrix calculation.
subroutine, public write_pgf_orb_radii(basis, atomic_kind_set, qs_kind_set, subsys_section)
Write the orbital basis function radii to the output unit.
subroutine, public write_paw_radii(atomic_kind_set, qs_kind_set, subsys_section)
Write the radii of the one center projector.
subroutine, public write_ppnl_radii(atomic_kind_set, qs_kind_set, subsys_section)
Write the radii of the projector functions of the Goedecker pseudopotential (GTH, non-local part) to ...
subroutine, public init_se_nlradius(se_control, atomic_kind_set, qs_kind_set, subsys_section)
...
subroutine, public write_ppl_radii(atomic_kind_set, qs_kind_set, subsys_section)
Write the radii of the exponential functions of the Goedecker pseudopotential (GTH,...
subroutine, public init_interaction_radii(qs_control, qs_kind_set)
Initialize all the atomic kind radii for a given threshold value.
subroutine, public write_core_charge_radii(atomic_kind_set, qs_kind_set, subsys_section)
Write the radii of the core charge distributions to the output unit.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public init_gapw_nlcc(qs_kind_set)
...
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg)
Get attributes of an atomic kind set.
subroutine, public set_qs_kind(qs_kind, paw_atom, ghost, floating, hard_radius, hard0_radius, covalent_radius, vdw_radius, lmax_rho0, zeff, no_optimize, dispersion, u_minus_j, reltmat, dftb_parameter, xtb_parameter, elec_conf, pao_basis_size)
Set the components of an atomic kind data set.
subroutine, public write_qs_kind_set(qs_kind_set, subsys_section)
Write an atomic kind set data set to the output unit.
subroutine, public init_gapw_basis_set(qs_kind_set, qs_control, force_env_section, modify_qs_control)
...
subroutine, public init_qs_kind_set(qs_kind_set)
Initialise an atomic kind set data set.
subroutine, public check_qs_kind_set(qs_kind_set, dft_control, subsys_section)
...
subroutine, public write_gto_basis_sets(qs_kind_set, subsys_section)
Write all the GTO basis sets of an atomic kind set to the output unit (for the printing of the unnorm...
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public qs_ks_env_create(ks_env)
Allocates a new instance of ks_env.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public allocate_mo_set(mo_set, nao, nmo, nelectron, n_el_f, maxocc, flexible_electron_count)
Allocates a mo set and partially initializes it (nao,nmo,nelectron, and flexible_electron_count are v...
subroutine, public rho0_s_grid_create(pw_env, rho0_mpole)
...
subroutine, public init_rho0(local_rho_set, qs_env, gapw_control, zcore)
...
subroutine, public init_rho_atom(rho_atom_set, atomic_kind_set, qs_kind_set, dft_control, para_env)
...
Routines that work on qs_subsys_type.
subroutine, public qs_subsys_create(subsys, para_env, root_section, force_env_section, subsys_section, use_motion_section, cp_subsys, cell, cell_ref, elkind, silent)
Creates a qs_subsys. Optionally an existsing cp_subsys is used.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
subroutine, public qs_subsys_set(subsys, cp_subsys, local_particles, local_molecules, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, nelectron_total, nelectron_spin)
...
Storage of past states of the qs_env. Methods to interpolate (or actually normally extrapolate) the n...
subroutine, public wfi_create_for_kp(wf_history)
...
subroutine, public wfi_create(wf_history, interpolation_method_nr, extrapolation_order, has_unit_metric)
...
interpolate the wavefunctions to speed up the convergence when doing MD
subroutine, public wfi_release(wf_history)
releases a wf_history of a wavefunction (see doc/ReferenceCounting.html)
parameters that control a relativistic calculation
subroutine, public rel_c_create(rel_control)
allocates and initializes an rel control object with the default values
subroutine, public rel_c_read_parameters(rel_control, dft_section)
reads the parameters of the relativistic section into the given rel_control
parameters that control an scf iteration
subroutine, public scf_c_read_parameters(scf_control, inp_section)
reads the parameters of the scf section into the given scf_control
subroutine, public scf_c_write_parameters(scf_control, dft_section)
writes out the scf parameters
subroutine, public scf_c_create(scf_control)
allocates and initializes an scf control object with the default values
Methods for handling the 1/R^3 residual integral part.
subroutine, public semi_empirical_expns3_setup(qs_kind_set, se_control, method_id)
Setup the quantity necessary to handle the slowly convergent residual integral term 1/R^3.
Arrays of parameters used in the semi-empirical calculations \References Everywhere in this module TC...
subroutine, public init_se_intd_array()
Initialize all arrays used for the evaluation of the integrals.
Setup and Methods for semi-empirical multipole types.
subroutine, public nddo_mpole_setup(nddo_mpole, natom)
Setup NDDO multipole type.
Definition of the semi empirical multipole integral expansions types.
Type to store integrals for semi-empirical calculations.
subroutine, public semi_empirical_si_create(store_int_env, se_section, compression)
Allocate semi-empirical store integrals type.
Definition of the semi empirical parameter types.
subroutine, public se_taper_create(se_taper, integral_screening, do_ewald, taper_cou, range_cou, taper_exc, range_exc, taper_scr, range_scr, taper_lrc, range_lrc)
Creates the taper type used in SE calculations.
Working with the semi empirical parameter types.
subroutine, public se_cutoff_compatible(se_control, se_section, cell, output_unit)
Reset cutoffs trying to be somehow a bit smarter.
routines for DFT+NEGF calculations (coupling with the quantum transport code OMEN)
Definition transport.F:19
subroutine, public transport_env_create(qs_env)
creates the transport environment
Definition transport.F:124
Read xTB parameters.
subroutine, public xtb_parameters_set(param)
Read atom parameters for xTB Hamiltonian from input file.
subroutine, public xtb_parameters_init(param, gfn_type, element_symbol, parameter_file_path, parameter_file_name, para_env)
...
subroutine, public init_xtb_basis(param, gto_basis_set, ngauss)
...
xTB (repulsive) pair potentials Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public xtb_pp_radius(qs_kind_set, ppradius, eps_pair, kfparam)
...
Definition of the xTB parameter types.
Definition xtb_types.F:20
subroutine, public allocate_xtb_atom_param(xtb_parameter)
...
Definition xtb_types.F:99
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
type of a logger, at the moment it contains just a print level starting at which level it should be l...
represents a system: atoms, molecules, their pos,vel,...
structure to store local (to a processor) ordered lists of integers.
Contains information on the energy correction functional for KG.
Contains information on the excited states energy.
contains the initially parsed file and the initial parallel environment
Contains information about kpoints.
stores all the informations relevant to an mpi environment
contained for different pw related things
Contains information on the Harris method.
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps track of the previous wavefunctions and can extrapolate them for the next step of md
contains the parameters needed by a relativistic calculation
Global Multipolar NDDO information type.
Taper type use in semi-empirical calculations.