118#include "./base/base_uses.f90"
126 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_kind_types'
134 INTEGER :: max_scf = -1
135 REAL(KIND=
dp) :: eps_u_ramping = 0.0_dp
136 REAL(KIND=
dp) :: eps_scf = huge(0.0_dp)
137 REAL(KIND=
dp) :: u_minus_j_target = 0.0_dp
138 REAL(KIND=
dp) :: u_minus_j = 0.0_dp
139 REAL(KIND=
dp) :: u_ramping = 0.0_dp
140 REAL(KIND=
dp) :: u = 0.0_dp
141 REAL(KIND=
dp) :: j = 0.0_dp
142 REAL(KIND=
dp) :: alpha = 0.0_dp
143 REAL(KIND=
dp) :: beta = 0.0_dp
144 REAL(KIND=
dp) :: j0 = 0.0_dp
145 REAL(KIND=
dp) :: occupation = -1.0_dp
146 INTEGER,
DIMENSION(:),
POINTER :: orbitals => null()
147 LOGICAL :: init_u_ramping_each_scf = .false.
148 LOGICAL :: smear = .false.
149 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: nelec => null()
150 END TYPE dft_plus_u_type
157 REAL(kind=
dp) :: beta = 0.0_dp
158 REAL(kind=
dp) :: weight = 0.0_dp
159 INTEGER :: max_projector = -1
160 REAL(kind=
dp) :: beta_radius = huge(
dp)
167 REAL(kind=
dp) :: beta = 0.0_dp
168 REAL(kind=
dp) :: beta_radius = huge(
dp)
169 REAL(kind=
dp) :: weight = 0.0_dp
170 REAL(kind=
dp) :: screening = 0.0_dp
171 REAL(kind=
dp) :: screening_radius = huge(
dp)
178 CHARACTER(LEN=default_string_length) :: name =
""
179 CHARACTER(LEN=2) :: element_symbol =
""
180 INTEGER :: natom = -1
195 REAL(kind=
dp) :: covalent_radius = 0.0_dp
196 REAL(kind=
dp) :: vdw_radius = 0.0_dp
199 REAL(kind=
dp) :: hard_radius = 0.8_dp*
bohr
200 REAL(kind=
dp) :: hard0_radius = 0.8_dp*
bohr
201 REAL(kind=
dp) :: max_rad_local = 13.2_dp*
bohr
202 LOGICAL :: paw_atom = .false.
203 LOGICAL :: gpw_type_forced = .false.
205 LOGICAL :: ghost = .false.
206 LOGICAL :: floating = .false.
207 INTEGER :: lmax_dftb = -1
208 REAL(kind=
dp) :: dudq_dftb3 = 0.0_dp
209 REAL(kind=
dp) :: magnetization = 0.0_dp
210 INTEGER,
DIMENSION(:, :),
POINTER :: addel => null()
211 INTEGER,
DIMENSION(:, :),
POINTER :: laddel => null()
212 INTEGER,
DIMENSION(:, :),
POINTER :: naddel => null()
215 INTEGER :: ngrid_rad = 50
216 INTEGER :: ngrid_ang = 50
217 INTEGER :: lmax_rho0 = 0
219 INTEGER,
DIMENSION(:),
POINTER :: elec_conf => null()
220 LOGICAL :: bs_occupation = .false.
222 LOGICAL :: no_optimize = .true.
224 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: nlcc_pot => null()
227 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: reltmat => null()
228 INTEGER :: pao_basis_size = -1
229 CHARACTER(LEN=default_path_length) :: pao_model_file =
""
239 POINTER :: qs_kind_set => null()
240 END TYPE qs_kind_p_type
273 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
275 INTEGER :: ikind, nkind
277 IF (
ASSOCIATED(qs_kind_set))
THEN
279 nkind =
SIZE(qs_kind_set)
282 IF (
ASSOCIATED(qs_kind_set(ikind)%all_potential))
THEN
285 IF (
ASSOCIATED(qs_kind_set(ikind)%tnadd_potential))
THEN
288 IF (
ASSOCIATED(qs_kind_set(ikind)%gth_potential))
THEN
291 IF (
ASSOCIATED(qs_kind_set(ikind)%sgp_potential))
THEN
294 IF (
ASSOCIATED(qs_kind_set(ikind)%upf_potential))
THEN
296 DEALLOCATE (qs_kind_set(ikind)%upf_potential)
298 IF (
ASSOCIATED(qs_kind_set(ikind)%cneo_potential))
THEN
301 IF (
ASSOCIATED(qs_kind_set(ikind)%se_parameter))
THEN
304 IF (
ASSOCIATED(qs_kind_set(ikind)%dftb_parameter))
THEN
307 IF (
ASSOCIATED(qs_kind_set(ikind)%xtb_parameter))
THEN
310 IF (
ASSOCIATED(qs_kind_set(ikind)%paw_proj_set))
THEN
313 IF (
ASSOCIATED(qs_kind_set(ikind)%harmonics))
THEN
316 IF (
ASSOCIATED(qs_kind_set(ikind)%grid_atom))
THEN
319 IF (
ASSOCIATED(qs_kind_set(ikind)%elec_conf))
THEN
320 DEALLOCATE (qs_kind_set(ikind)%elec_conf)
323 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u))
THEN
324 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%orbitals))
THEN
325 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%orbitals)
327 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%nelec))
THEN
328 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%nelec)
330 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u)
333 IF (
ASSOCIATED(qs_kind_set(ikind)%nlcc_pot))
THEN
334 DEALLOCATE (qs_kind_set(ikind)%nlcc_pot)
337 IF (
ASSOCIATED(qs_kind_set(ikind)%dispersion))
THEN
338 DEALLOCATE (qs_kind_set(ikind)%dispersion)
340 IF (
ASSOCIATED(qs_kind_set(ikind)%addel))
THEN
341 DEALLOCATE (qs_kind_set(ikind)%addel)
343 IF (
ASSOCIATED(qs_kind_set(ikind)%naddel))
THEN
344 DEALLOCATE (qs_kind_set(ikind)%naddel)
346 IF (
ASSOCIATED(qs_kind_set(ikind)%laddel))
THEN
347 DEALLOCATE (qs_kind_set(ikind)%laddel)
349 IF (
ASSOCIATED(qs_kind_set(ikind)%reltmat))
THEN
350 DEALLOCATE (qs_kind_set(ikind)%reltmat)
353 IF (
ASSOCIATED(qs_kind_set(ikind)%pao_potentials))
THEN
354 DEALLOCATE (qs_kind_set(ikind)%pao_potentials)
356 IF (
ASSOCIATED(qs_kind_set(ikind)%pao_descriptors))
THEN
357 DEALLOCATE (qs_kind_set(ikind)%pao_descriptors)
363 DEALLOCATE (qs_kind_set)
365 CALL cp_abort(__location__, &
366 "The pointer qs_kind_set is not associated and "// &
367 "cannot be deallocated")
450 basis_set, basis_type, ncgf, nsgf, &
451 all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, &
452 cneo_potential, se_parameter, dftb_parameter, xtb_parameter, &
453 dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, &
454 alpha_core_charge, ccore_charge, core_charge, core_charge_radius, &
455 paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, &
456 covalent_radius, vdw_radius, &
457 gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, &
458 ngrid_ang, ngrid_rad, lmax_rho0, &
459 dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, &
460 u_minus_j, U_of_dft_plus_u, J_of_dft_plus_u, &
461 alpha_of_dft_plus_u, beta_of_dft_plus_u, J0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, &
462 bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, &
463 max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, &
464 init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, &
465 pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
469 CHARACTER(len=*),
OPTIONAL :: basis_type
470 INTEGER,
INTENT(OUT),
OPTIONAL :: ncgf, nsgf
480 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: dftb3_param
481 INTEGER,
INTENT(OUT),
OPTIONAL :: zatom
482 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: zeff
483 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: elec_conf
484 INTEGER,
INTENT(OUT),
OPTIONAL :: mao, lmax_dftb
485 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: alpha_core_charge, ccore_charge, &
486 core_charge, core_charge_radius
488 LOGICAL,
INTENT(OUT),
OPTIONAL :: paw_atom
489 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: hard_radius, hard0_radius, &
490 max_rad_local, covalent_radius, &
492 LOGICAL,
INTENT(OUT),
OPTIONAL :: gpw_type_forced
494 INTEGER,
INTENT(OUT),
OPTIONAL :: max_iso_not0, max_s_harm
496 INTEGER,
INTENT(OUT),
OPTIONAL :: ngrid_ang, ngrid_rad, lmax_rho0
497 LOGICAL,
INTENT(OUT),
OPTIONAL :: dft_plus_u_atom
498 INTEGER,
INTENT(OUT),
OPTIONAL :: l_of_dft_plus_u, n_of_dft_plus_u
499 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, &
500 alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u
502 LOGICAL,
INTENT(OUT),
OPTIONAL :: bs_occupation
503 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: magnetization
504 LOGICAL,
INTENT(OUT),
OPTIONAL :: no_optimize
505 INTEGER,
DIMENSION(:, :),
OPTIONAL,
POINTER :: addel, laddel, naddel
506 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: orbitals
507 INTEGER,
OPTIONAL :: max_scf
508 REAL(kind=
dp),
OPTIONAL :: eps_scf
509 LOGICAL,
OPTIONAL :: smear
510 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: u_ramping, u_minus_j_target, &
512 LOGICAL,
OPTIONAL :: init_u_ramping_each_scf
513 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: reltmat
514 LOGICAL,
OPTIONAL :: ghost, floating
515 CHARACTER(LEN=default_string_length), &
516 INTENT(OUT),
OPTIONAL :: name
517 CHARACTER(LEN=2),
INTENT(OUT),
OPTIONAL :: element_symbol
518 INTEGER,
INTENT(OUT),
OPTIONAL :: pao_basis_size
519 CHARACTER(LEN=default_path_length),
INTENT(OUT), &
520 OPTIONAL :: pao_model_file
524 OPTIONAL,
POINTER :: pao_descriptors
525 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: nelec
527 CHARACTER(LEN=default_string_length) :: my_basis_type
533 IF (
PRESENT(basis_type))
THEN
534 my_basis_type = basis_type
536 my_basis_type =
"ORB"
539 IF (
PRESENT(basis_set))
THEN
541 basis_type=my_basis_type)
544 IF (
PRESENT(ncgf))
THEN
546 basis_type=my_basis_type)
547 IF (
ASSOCIATED(tmp_basis_set))
THEN
549 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
550 l = qs_kind%dftb_parameter%lmax
551 ncgf = ((l + 1)*(l + 2)*(l + 3))/6
557 IF (
PRESENT(nsgf))
THEN
559 basis_type=my_basis_type)
560 IF (
ASSOCIATED(tmp_basis_set))
THEN
562 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
563 nsgf = qs_kind%dftb_parameter%natorb
569 IF (
PRESENT(all_potential)) all_potential => qs_kind%all_potential
570 IF (
PRESENT(tnadd_potential)) tnadd_potential => qs_kind%tnadd_potential
571 IF (
PRESENT(gth_potential)) gth_potential => qs_kind%gth_potential
572 IF (
PRESENT(sgp_potential)) sgp_potential => qs_kind%sgp_potential
573 IF (
PRESENT(upf_potential)) upf_potential => qs_kind%upf_potential
574 IF (
PRESENT(cneo_potential)) cneo_potential => qs_kind%cneo_potential
575 IF (
PRESENT(se_parameter)) se_parameter => qs_kind%se_parameter
576 IF (
PRESENT(dftb_parameter)) dftb_parameter => qs_kind%dftb_parameter
577 IF (
PRESENT(xtb_parameter)) xtb_parameter => qs_kind%xtb_parameter
578 IF (
PRESENT(element_symbol)) element_symbol = qs_kind%element_symbol
579 IF (
PRESENT(name)) name = qs_kind%name
580 IF (
PRESENT(dftb3_param)) dftb3_param = qs_kind%dudq_dftb3
581 IF (
PRESENT(elec_conf)) elec_conf => qs_kind%elec_conf
582 IF (
PRESENT(alpha_core_charge))
THEN
583 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
585 alpha_core_charge=alpha_core_charge)
586 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
588 alpha_core_charge=alpha_core_charge)
589 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
591 alpha_core_charge=alpha_core_charge)
592 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
593 cpabort(
"CNEO ALPHA CORE CHARGE NOT AVAILABLE")
595 alpha_core_charge = 1.0_dp
598 IF (
PRESENT(ccore_charge))
THEN
599 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
601 ccore_charge=ccore_charge)
602 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
604 ccore_charge=ccore_charge)
605 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
607 ccore_charge=ccore_charge)
608 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
609 cpabort(
"UPF CCORE CHARGE NOT AVAILABLE")
610 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
611 cpabort(
"CNEO CCORE CHARGE NOT AVAILABLE")
613 ccore_charge = 0.0_dp
616 IF (
PRESENT(core_charge_radius))
THEN
617 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
619 core_charge_radius=core_charge_radius)
620 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
622 core_charge_radius=core_charge_radius)
623 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
625 core_charge_radius=core_charge_radius)
626 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
627 cpabort(
"UPF CORE CHARGE RADIUS NOT AVAILABLE")
628 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
629 cpabort(
"CNEO CORE CHARGE RADIUS NOT AVAILABLE")
631 core_charge_radius = 0.0_dp
634 IF (
PRESENT(core_charge))
THEN
635 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
638 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
641 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
644 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
645 cpabort(
"UPF CORE CHARGE NOT AVAILABLE")
646 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
654 IF (
PRESENT(zatom))
THEN
656 CALL get_ptable_info(qs_kind%element_symbol, ielement=zatom, found=found)
660 IF (
PRESENT(zeff))
THEN
661 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
662 CALL get_potential(potential=qs_kind%all_potential, zeff=zeff)
663 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
664 CALL get_potential(potential=qs_kind%gth_potential, zeff=zeff)
665 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
666 CALL get_potential(potential=qs_kind%sgp_potential, zeff=zeff)
667 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
668 zeff = qs_kind%upf_potential%zion
669 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
676 IF (
PRESENT(covalent_radius)) covalent_radius = qs_kind%covalent_radius
677 IF (
PRESENT(vdw_radius)) vdw_radius = qs_kind%vdw_radius
679 IF (
PRESENT(paw_proj_set)) paw_proj_set => qs_kind%paw_proj_set
680 IF (
PRESENT(paw_atom)) paw_atom = qs_kind%paw_atom
681 IF (
PRESENT(gpw_type_forced)) gpw_type_forced = qs_kind%gpw_type_forced
682 IF (
PRESENT(hard_radius)) hard_radius = qs_kind%hard_radius
683 IF (
PRESENT(hard0_radius)) hard0_radius = qs_kind%hard0_radius
684 IF (
PRESENT(max_rad_local)) max_rad_local = qs_kind%max_rad_local
685 IF (
PRESENT(harmonics)) harmonics => qs_kind%harmonics
686 IF (
PRESENT(max_s_harm))
THEN
687 IF (
ASSOCIATED(qs_kind%harmonics))
THEN
688 max_s_harm = qs_kind%harmonics%max_s_harm
693 IF (
PRESENT(max_iso_not0))
THEN
694 IF (
ASSOCIATED(qs_kind%harmonics))
THEN
695 max_iso_not0 = qs_kind%harmonics%max_iso_not0
700 IF (
PRESENT(grid_atom)) grid_atom => qs_kind%grid_atom
701 IF (
PRESENT(ngrid_ang)) ngrid_ang = qs_kind%ngrid_ang
702 IF (
PRESENT(ngrid_rad)) ngrid_rad = qs_kind%ngrid_rad
703 IF (
PRESENT(lmax_rho0)) lmax_rho0 = qs_kind%lmax_rho0
704 IF (
PRESENT(ghost)) ghost = qs_kind%ghost
705 IF (
PRESENT(floating)) floating = qs_kind%floating
706 IF (
PRESENT(dft_plus_u_atom)) dft_plus_u_atom =
ASSOCIATED(qs_kind%dft_plus_u)
707 IF (
PRESENT(l_of_dft_plus_u))
THEN
708 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
709 l_of_dft_plus_u = qs_kind%dft_plus_u%l
714 IF (
PRESENT(n_of_dft_plus_u))
THEN
715 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
716 n_of_dft_plus_u = qs_kind%dft_plus_u%n
721 IF (
PRESENT(u_minus_j))
THEN
722 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
723 u_minus_j = qs_kind%dft_plus_u%u_minus_j
728 IF (
PRESENT(u_minus_j_target))
THEN
729 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
730 u_minus_j_target = qs_kind%dft_plus_u%u_minus_j_target
732 u_minus_j_target = 0.0_dp
735 IF (
PRESENT(u_of_dft_plus_u))
THEN
736 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
737 u_of_dft_plus_u = qs_kind%dft_plus_u%U
739 u_of_dft_plus_u = 0.0_dp
742 IF (
PRESENT(j_of_dft_plus_u))
THEN
743 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
744 j_of_dft_plus_u = qs_kind%dft_plus_u%J
746 j_of_dft_plus_u = 0.0_dp
749 IF (
PRESENT(alpha_of_dft_plus_u))
THEN
750 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
751 alpha_of_dft_plus_u = qs_kind%dft_plus_u%alpha
753 alpha_of_dft_plus_u = 0.0_dp
756 IF (
PRESENT(beta_of_dft_plus_u))
THEN
757 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
758 beta_of_dft_plus_u = qs_kind%dft_plus_u%beta
760 beta_of_dft_plus_u = 0.0_dp
763 IF (
PRESENT(j0_of_dft_plus_u))
THEN
764 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
765 j0_of_dft_plus_u = qs_kind%dft_plus_u%J0
767 j0_of_dft_plus_u = 0.0_dp
770 IF (
PRESENT(occupation_of_dft_plus_u))
THEN
771 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
772 occupation_of_dft_plus_u = qs_kind%dft_plus_u%occupation
774 occupation_of_dft_plus_u = -1.0_dp
778 IF (
PRESENT(init_u_ramping_each_scf))
THEN
779 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
780 init_u_ramping_each_scf = qs_kind%dft_plus_u%init_u_ramping_each_scf
782 init_u_ramping_each_scf = .false.
785 IF (
PRESENT(u_ramping))
THEN
786 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
787 u_ramping = qs_kind%dft_plus_u%u_ramping
792 IF (
PRESENT(eps_u_ramping))
THEN
793 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
794 eps_u_ramping = qs_kind%dft_plus_u%eps_u_ramping
796 eps_u_ramping = 1.0e-5_dp
799 IF (
PRESENT(nelec))
THEN
801 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
802 IF (
ASSOCIATED(qs_kind%dft_plus_u%nelec))
THEN
803 nelec => qs_kind%dft_plus_u%nelec
807 IF (
PRESENT(orbitals))
THEN
809 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
810 IF (
ASSOCIATED(qs_kind%dft_plus_u%orbitals))
THEN
811 orbitals => qs_kind%dft_plus_u%orbitals
815 IF (
PRESENT(eps_scf))
THEN
816 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
817 eps_scf = qs_kind%dft_plus_u%eps_scf
822 IF (
PRESENT(max_scf))
THEN
823 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
824 max_scf = qs_kind%dft_plus_u%max_scf
829 IF (
PRESENT(smear))
THEN
830 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
831 smear = qs_kind%dft_plus_u%smear
836 IF (
PRESENT(dispersion)) dispersion => qs_kind%dispersion
837 IF (
PRESENT(bs_occupation)) bs_occupation = qs_kind%bs_occupation
838 IF (
PRESENT(addel)) addel => qs_kind%addel
839 IF (
PRESENT(laddel)) laddel => qs_kind%laddel
840 IF (
PRESENT(naddel)) naddel => qs_kind%naddel
842 IF (
PRESENT(magnetization)) magnetization = qs_kind%magnetization
844 IF (
PRESENT(no_optimize)) no_optimize = qs_kind%no_optimize
846 IF (
PRESENT(reltmat)) reltmat => qs_kind%reltmat
848 IF (
PRESENT(mao)) mao = qs_kind%mao
850 IF (
PRESENT(lmax_dftb)) lmax_dftb = qs_kind%lmax_dftb
852 IF (
PRESENT(pao_basis_size)) pao_basis_size = qs_kind%pao_basis_size
853 IF (
PRESENT(pao_model_file)) pao_model_file = qs_kind%pao_model_file
855 IF (
PRESENT(pao_descriptors)) pao_descriptors => qs_kind%pao_descriptors
900 all_potential_present, tnadd_potential_present, gth_potential_present, &
901 sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, &
902 maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, &
903 ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, &
904 nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, &
906 basis_type, total_zeff_corr, npgf_seg, &
907 cneo_potential_present, nkind_q, natom_q)
909 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
910 LOGICAL,
INTENT(OUT),
OPTIONAL :: all_potential_present, tnadd_potential_present, &
911 gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present
912 INTEGER,
INTENT(OUT),
OPTIONAL :: maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, &
913 maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, &
915 INTEGER,
INTENT(IN),
OPTIONAL :: maxder
916 INTEGER,
INTENT(OUT),
OPTIONAL :: max_ngrid_rad, max_sph_harm, &
917 maxg_iso_not0, lmax_rho0
918 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: basis_rcut
919 CHARACTER(len=*),
OPTIONAL :: basis_type
920 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: total_zeff_corr
921 INTEGER,
INTENT(OUT),
OPTIONAL :: npgf_seg
922 LOGICAL,
INTENT(OUT),
OPTIONAL :: cneo_potential_present
923 INTEGER,
INTENT(OUT),
OPTIONAL :: nkind_q, natom_q
925 CHARACTER(len=default_string_length) :: my_basis_type
926 INTEGER :: ikind,
imax, lmax_rho0_kind, &
927 max_iso_not0, max_s_harm, n, &
928 ngrid_rad, nkind, nrloc(10), &
930 LOGICAL :: dft_plus_u_atom, ecp_semi_local, paw_atom
931 REAL(kind=
dp) :: brcut, zeff, zeff_correction
942 IF (
PRESENT(basis_type))
THEN
943 my_basis_type = basis_type
945 my_basis_type =
"ORB"
948 IF (
ASSOCIATED(qs_kind_set))
THEN
950 IF (
PRESENT(maxcgf)) maxcgf = 0
951 IF (
PRESENT(maxco)) maxco = 0
952 IF (
PRESENT(maxco_proj)) maxco_proj = 0
953 IF (
PRESENT(maxg_iso_not0)) maxg_iso_not0 = 0
954 IF (
PRESENT(maxgtops)) maxgtops = 0
955 IF (
PRESENT(maxlgto)) maxlgto = -1
956 IF (
PRESENT(maxlppl)) maxlppl = -1
957 IF (
PRESENT(maxlppnl)) maxlppnl = -1
958 IF (
PRESENT(maxpol)) maxpol = -1
959 IF (
PRESENT(maxlprj)) maxlprj = -1
960 IF (
PRESENT(maxnset)) maxnset = 0
961 IF (
PRESENT(maxppnl)) maxppnl = 0
962 IF (
PRESENT(maxsgf)) maxsgf = 0
963 IF (
PRESENT(maxsgf_set)) maxsgf_set = 0
964 IF (
PRESENT(ncgf)) ncgf = 0
965 IF (
PRESENT(nelectron)) nelectron = 0
966 IF (
PRESENT(npgf)) npgf = 0
967 IF (
PRESENT(nset)) nset = 0
968 IF (
PRESENT(nsgf)) nsgf = 0
969 IF (
PRESENT(nshell)) nshell = 0
970 IF (
PRESENT(all_potential_present)) all_potential_present = .false.
971 IF (
PRESENT(tnadd_potential_present)) tnadd_potential_present = .false.
972 IF (
PRESENT(gth_potential_present)) gth_potential_present = .false.
973 IF (
PRESENT(sgp_potential_present)) sgp_potential_present = .false.
974 IF (
PRESENT(cneo_potential_present)) cneo_potential_present = .false.
975 IF (
PRESENT(nkind_q)) nkind_q = 0
976 IF (
PRESENT(natom_q)) natom_q = 0
977 IF (
PRESENT(paw_atom_present)) paw_atom_present = .false.
978 IF (
PRESENT(max_ngrid_rad)) max_ngrid_rad = 0
979 IF (
PRESENT(max_sph_harm)) max_sph_harm = 0
980 IF (
PRESENT(lmax_rho0)) lmax_rho0 = 0
981 IF (
PRESENT(basis_rcut)) basis_rcut = 0.0_dp
982 IF (
PRESENT(total_zeff_corr)) total_zeff_corr = 0.0_dp
983 IF (
PRESENT(npgf_seg)) npgf_seg = 0
985 nkind =
SIZE(qs_kind_set)
987 qs_kind => qs_kind_set(ikind)
989 all_potential=all_potential, &
990 tnadd_potential=tnadd_potential, &
991 gth_potential=gth_potential, &
992 sgp_potential=sgp_potential, &
993 cneo_potential=cneo_potential, &
994 paw_proj_set=paw_proj_set, &
995 dftb_parameter=dftb_parameter, &
996 ngrid_rad=ngrid_rad, &
997 max_s_harm=max_s_harm, &
998 max_iso_not0=max_iso_not0, &
1000 dft_plus_u_atom=dft_plus_u_atom, &
1001 lmax_rho0=lmax_rho0_kind)
1003 IF (
PRESENT(maxlppl) .AND.
ASSOCIATED(gth_potential))
THEN
1005 maxlppl = max(maxlppl, 2*(n - 1))
1006 ELSEIF (
PRESENT(maxlppl) .AND.
ASSOCIATED(sgp_potential))
THEN
1007 CALL get_potential(potential=sgp_potential, nrloc=nrloc, ecp_semi_local=ecp_semi_local)
1008 n = maxval(nrloc) - 2
1009 maxlppl = max(maxlppl, 2*(n - 1))
1010 IF (ecp_semi_local)
THEN
1012 n = maxval(nrpot) - 2
1013 n = 2*(n - 1) +
imax
1014 maxlppl = max(maxlppl, n)
1018 IF (
PRESENT(maxlppnl) .AND.
ASSOCIATED(gth_potential))
THEN
1020 maxlppnl = max(maxlppnl,
imax)
1021 ELSEIF (
PRESENT(maxlppnl) .AND.
ASSOCIATED(sgp_potential))
THEN
1023 maxlppnl = max(maxlppnl,
imax)
1026 IF (
PRESENT(maxpol) .AND.
ASSOCIATED(tnadd_potential))
THEN
1028 maxpol = max(maxpol, 2*(n - 1))
1031 IF (
PRESENT(maxco_proj) .AND.
ASSOCIATED(paw_proj_set))
THEN
1033 maxco_proj = max(maxco_proj,
imax)
1036 IF (
PRESENT(maxlprj) .AND.
ASSOCIATED(paw_proj_set))
THEN
1038 maxlprj = max(maxlprj,
imax)
1041 IF (
PRESENT(maxppnl) .AND.
ASSOCIATED(gth_potential))
THEN
1043 maxppnl = max(maxppnl,
imax)
1044 ELSEIF (
PRESENT(maxppnl) .AND.
ASSOCIATED(sgp_potential))
THEN
1046 maxppnl = max(maxppnl,
imax)
1049 IF (my_basis_type(1:3) ==
"NUC" .AND. .NOT.
ASSOCIATED(cneo_potential))
THEN
1050 NULLIFY (tmp_basis_set)
1053 basis_type=my_basis_type)
1056 IF (
PRESENT(maxcgf))
THEN
1057 IF (
ASSOCIATED(tmp_basis_set))
THEN
1059 maxcgf = max(maxcgf,
imax)
1060 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1063 maxcgf = max(maxcgf,
imax)
1067 IF (
PRESENT(maxco))
THEN
1068 IF (
ASSOCIATED(tmp_basis_set))
THEN
1069 IF (
PRESENT(maxder))
THEN
1071 maxco=
imax, maxder=maxder)
1075 maxco = max(maxco,
imax)
1077 IF (
ASSOCIATED(gth_potential))
THEN
1081 IF (
ASSOCIATED(sgp_potential))
THEN
1089 IF (
PRESENT(maxgtops))
THEN
1090 IF (
ASSOCIATED(tmp_basis_set))
THEN
1092 maxgtops = max(maxgtops, n*
imax)
1096 IF (
PRESENT(maxlgto))
THEN
1097 IF (
ASSOCIATED(tmp_basis_set))
THEN
1099 maxlgto = max(maxlgto,
imax)
1100 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1102 maxlgto = max(maxlgto,
imax)
1106 IF (
PRESENT(maxnset))
THEN
1107 IF (
ASSOCIATED(tmp_basis_set))
THEN
1109 maxnset = max(maxnset, n)
1113 IF (
PRESENT(maxsgf))
THEN
1114 IF (
ASSOCIATED(tmp_basis_set))
THEN
1116 maxsgf = max(maxsgf,
imax)
1120 IF (
PRESENT(maxsgf_set))
THEN
1121 IF (
ASSOCIATED(tmp_basis_set))
THEN
1123 maxsgf_set = max(maxsgf_set,
imax)
1127 IF (
PRESENT(ncgf))
THEN
1128 IF (
ASSOCIATED(tmp_basis_set))
THEN
1130 ncgf = ncgf + n*qs_kind_set(ikind)%natom
1131 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1134 ncgf = ncgf + n*qs_kind_set(ikind)%natom
1138 IF (
PRESENT(npgf))
THEN
1139 IF (
ASSOCIATED(tmp_basis_set))
THEN
1141 npgf = npgf + n*qs_kind_set(ikind)%natom
1145 IF (
PRESENT(nset))
THEN
1146 IF (
ASSOCIATED(tmp_basis_set))
THEN
1148 nset = nset + n*qs_kind_set(ikind)%natom
1152 IF (
PRESENT(nsgf))
THEN
1153 IF (
ASSOCIATED(tmp_basis_set))
THEN
1155 nsgf = nsgf + n*qs_kind_set(ikind)%natom
1156 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1158 nsgf = nsgf + n*qs_kind_set(ikind)%natom
1162 IF (
PRESENT(nshell))
THEN
1163 IF (
ASSOCIATED(tmp_basis_set))
THEN
1165 nshell = nshell + n*qs_kind_set(ikind)%natom
1166 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1168 nshell = nshell + (n + 1)*qs_kind_set(ikind)%natom
1172 IF (
PRESENT(nelectron))
THEN
1173 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
1175 zeff=zeff, zeff_correction=zeff_correction)
1176 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1178 zeff=zeff, zeff_correction=zeff_correction)
1179 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1181 zeff=zeff, zeff_correction=zeff_correction)
1182 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
1185 zeff_correction = 0.0_dp
1188 zeff_correction = 0.0_dp
1190 nelectron = nelectron + qs_kind_set(ikind)%natom*nint(zeff - zeff_correction)
1193 IF (
PRESENT(basis_rcut))
THEN
1194 IF (
ASSOCIATED(tmp_basis_set))
THEN
1196 basis_rcut = max(basis_rcut, brcut)
1197 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1199 basis_rcut = max(basis_rcut, brcut)
1203 IF (
PRESENT(total_zeff_corr))
THEN
1204 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
1206 zeff=zeff, zeff_correction=zeff_correction)
1207 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1209 zeff=zeff, zeff_correction=zeff_correction)
1210 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1212 zeff=zeff, zeff_correction=zeff_correction)
1215 zeff_correction = 0.0_dp
1217 total_zeff_corr = total_zeff_corr + qs_kind_set(ikind)%natom*zeff_correction
1220 IF (
PRESENT(all_potential_present))
THEN
1221 IF (
ASSOCIATED(all_potential))
THEN
1222 all_potential_present = .true.
1226 IF (
PRESENT(tnadd_potential_present))
THEN
1227 IF (
ASSOCIATED(tnadd_potential))
THEN
1228 tnadd_potential_present = .true.
1232 IF (
PRESENT(gth_potential_present))
THEN
1233 IF (
ASSOCIATED(gth_potential))
THEN
1234 gth_potential_present = .true.
1238 IF (
PRESENT(sgp_potential_present))
THEN
1239 IF (
ASSOCIATED(sgp_potential))
THEN
1240 sgp_potential_present = .true.
1244 IF (
PRESENT(cneo_potential_present))
THEN
1245 IF (
ASSOCIATED(cneo_potential))
THEN
1246 cneo_potential_present = .true.
1250 IF (
PRESENT(nkind_q))
THEN
1251 IF (
ASSOCIATED(cneo_potential))
THEN
1252 nkind_q = nkind_q + 1
1256 IF (
PRESENT(natom_q))
THEN
1257 IF (
ASSOCIATED(cneo_potential))
THEN
1258 natom_q = natom_q + qs_kind_set(ikind)%natom
1262 IF (
PRESENT(paw_atom_present))
THEN
1264 paw_atom_present = .true.
1268 IF (
PRESENT(dft_plus_u_atom_present))
THEN
1269 IF (dft_plus_u_atom)
THEN
1270 dft_plus_u_atom_present = .true.
1274 IF (
PRESENT(max_ngrid_rad))
THEN
1275 max_ngrid_rad = max(max_ngrid_rad, ngrid_rad)
1278 IF (
PRESENT(max_sph_harm))
THEN
1279 max_sph_harm = max(max_sph_harm, max_s_harm)
1282 IF (
PRESENT(maxg_iso_not0))
THEN
1283 maxg_iso_not0 = max(maxg_iso_not0, max_iso_not0)
1286 IF (
PRESENT(lmax_rho0))
THEN
1287 lmax_rho0 = max(lmax_rho0, lmax_rho0_kind)
1290 IF (
PRESENT(npgf_seg))
THEN
1291 IF (
ASSOCIATED(tmp_basis_set))
THEN
1293 npgf_seg = npgf_seg + n*qs_kind_set(ikind)%natom
1299 cpabort(
"The pointer qs_kind_set is not associated")
1310 SUBROUTINE init_qs_kind(qs_kind)
1313 CHARACTER(len=*),
PARAMETER :: routinen =
'init_qs_kind'
1315 CHARACTER(LEN=default_string_length) :: basis_type
1316 INTEGER :: handle, i
1319 CALL timeset(routinen, handle)
1321 cpassert(
ASSOCIATED(qs_kind))
1323 IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1325 ELSEIF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1329 DO i = 1,
SIZE(qs_kind%basis_sets, 1)
1330 NULLIFY (tmp_basis_set)
1332 inumbas=i, basis_type=basis_type)
1333 IF (basis_type ==
"") cycle
1334 IF (basis_type ==
"AUX")
THEN
1335 IF (tmp_basis_set%norm_type < 0) tmp_basis_set%norm_type = 1
1338 IF (tmp_basis_set%norm_type < 0) tmp_basis_set%norm_type = 2
1343 CALL timestop(handle)
1345 END SUBROUTINE init_qs_kind
1355 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1357 CHARACTER(len=*),
PARAMETER :: routinen =
'init_qs_kind_set'
1359 INTEGER :: handle, ikind
1362 CALL timeset(routinen, handle)
1364 IF (.NOT.
ASSOCIATED(qs_kind_set))
THEN
1365 cpabort(
"init_qs_kind_set: The pointer qs_kind_set is not associated")
1368 DO ikind = 1,
SIZE(qs_kind_set)
1369 qs_kind => qs_kind_set(ikind)
1370 CALL init_qs_kind(qs_kind)
1373 CALL timestop(handle)
1386 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1389 LOGICAL,
OPTIONAL :: modify_qs_control
1391 CHARACTER(LEN=default_string_length) :: bsname
1392 INTEGER :: bas1c, ikind, ilevel, nkind
1393 LOGICAL :: gpw, my_mod_control, paw_atom
1394 REAL(
dp) :: max_rad_local_type, rc
1399 my_mod_control = .true.
1400 IF (
PRESENT(modify_qs_control))
THEN
1401 my_mod_control = modify_qs_control
1404 IF (
ASSOCIATED(qs_kind_set))
THEN
1406 IF (my_mod_control) qs_control%gapw_control%non_paw_atoms = .false.
1407 nkind =
SIZE(qs_kind_set)
1411 qs_kind => qs_kind_set(ikind)
1413 CALL get_qs_kind(qs_kind=qs_kind, basis_set=orb_basis)
1414 CALL get_qs_kind(qs_kind=qs_kind, hard_radius=rc, &
1415 max_rad_local=max_rad_local_type, gpw_type_forced=gpw)
1417 NULLIFY (soft_basis)
1423 qs_control%gapw_control%eps_fit, rc, paw_atom, &
1424 (qs_control%gapw_control%force_paw .OR. &
1425 ASSOCIATED(qs_kind%cneo_potential)), gpw)
1427 CALL set_qs_kind(qs_kind=qs_kind, paw_atom=paw_atom)
1429 bas1c = qs_control%gapw_control%basis_1c
1443 cpabort(
"basis_1c type")
1448 basis_1c%name = trim(bsname)//
"_1c"
1452 CALL get_qs_kind(qs_kind=qs_kind, paw_proj_set=paw_proj)
1453 CALL projectors(paw_proj, basis_1c, orb_basis, rc, qs_control, &
1454 max_rad_local_type, force_env_section)
1456 IF (my_mod_control) qs_control%gapw_control%non_paw_atoms = .true.
1460 NULLIFY (qs_kind%grid_atom, qs_kind%harmonics)
1466 IF (my_mod_control)
THEN
1467 IF (qs_control%gapw_control%non_paw_atoms)
THEN
1468 qs_control%gapw_control%nopaw_as_gpw = .true.
1470 qs_control%gapw_control%nopaw_as_gpw = .false.
1474 cpabort(
"The pointer qs_kind_set is not associated")
1484 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1486 INTEGER :: i, ic, ikind, n_nlcc, nc, nexp_nlcc, &
1488 INTEGER,
DIMENSION(:),
POINTER :: nct_nlcc
1489 LOGICAL :: nlcc, nlcc_type, paw_atom
1490 REAL(
dp) :: alpha, coa, cval
1491 REAL(kind=
dp),
DIMENSION(:),
POINTER :: a_nlcc, alpha_nlcc, c_nlcc, fe, rc, rr
1492 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: cval_nlcc, den
1497 IF (
ASSOCIATED(qs_kind_set))
THEN
1500 nkind =
SIZE(qs_kind_set)
1502 qs_kind => qs_kind_set(ikind)
1505 CALL get_qs_kind(qs_kind, gth_potential=gth_potential)
1506 CALL get_qs_kind(qs_kind, sgp_potential=sgp_potential)
1507 IF (
ASSOCIATED(gth_potential))
THEN
1508 CALL get_potential(potential=gth_potential, nlcc_present=nlcc_type, &
1509 nexp_nlcc=nexp_nlcc, alpha_nlcc=alpha_nlcc, nct_nlcc=nct_nlcc, cval_nlcc=cval_nlcc)
1511 nr = qs_kind%grid_atom%nr
1512 rr => qs_kind%grid_atom%rad
1513 ALLOCATE (qs_kind%nlcc_pot(nr, 2), rc(nr), fe(nr))
1514 den => qs_kind%nlcc_pot
1517 alpha = alpha_nlcc(i)
1519 fe(:) = exp(-0.5_dp*rc(:)*rc(:))
1522 cval = cval_nlcc(ic, i)
1524 den(:, 1) = den(:, 1) + fe(:)*rc**(2*ic - 2)*cval
1525 den(:, 2) = den(:, 2) - fe(:)*rc**(2*ic - 1)*coa
1527 den(:, 2) = den(:, 2) + real(2*ic - 2,
dp)*fe(:)*rc**(2*ic - 3)*coa
1533 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
1535 n_nlcc=n_nlcc, a_nlcc=a_nlcc, c_nlcc=c_nlcc)
1537 nr = qs_kind%grid_atom%nr
1538 rr => qs_kind%grid_atom%rad
1539 ALLOCATE (qs_kind%nlcc_pot(nr, 2), rc(nr), fe(nr))
1540 den => qs_kind%nlcc_pot
1544 fe(:) = exp(-alpha*rr(:)*rr(:))
1546 den(:, 1) = den(:, 1) + cval*fe(:)
1547 den(:, 2) = den(:, 2) - 2.0_dp*alpha*cval*rr(:)*fe(:)
1558 cpabort(
"The pointer qs_kind_set is not associated")
1570 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1573 INTEGER :: ikind, nkind
1579 IF (
ASSOCIATED(qs_kind_set))
THEN
1581 nkind =
SIZE(qs_kind_set)
1585 qs_kind => qs_kind_set(ikind)
1587 IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
1588 CALL get_qs_kind(qs_kind=qs_kind, basis_set=orb_basis, basis_type=
"NUC", &
1591 NULLIFY (soft_basis)
1594 qs_control%gapw_control%eps_fit/ &
1595 sqrt(qs_kind%cneo_potential%zeff), &
1596 rc, paw_atom, .true., .false.)
1603 cpabort(
"The pointer qs_kind_set is not associated")
1622 SUBROUTINE read_qs_kind(qs_kind, kind_section, para_env, force_env_section, &
1623 no_fail, method_id, silent)
1629 LOGICAL,
INTENT(IN) :: no_fail
1630 INTEGER,
INTENT(IN) :: method_id
1631 LOGICAL,
INTENT(IN) :: silent
1633 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_qs_kind'
1634 INTEGER,
PARAMETER :: maxbas = 20
1636 CHARACTER(LEN=2) :: element_symbol
1637 CHARACTER(len=default_path_length) :: kg_potential_fn_kind, &
1638 potential_file_name, potential_fn_kind
1639 CHARACTER(LEN=default_string_length) :: akind_name, basis_type, keyword, &
1640 kgpot_name, kgpot_type, &
1641 potential_name, potential_type, tmp
1642 CHARACTER(LEN=default_string_length),
DIMENSION(4) :: description
1643 CHARACTER(LEN=default_string_length), &
1644 DIMENSION(:),
POINTER :: tmpstringlist
1645 CHARACTER(LEN=default_string_length), &
1646 DIMENSION(maxbas) :: basis_set_form, basis_set_name, &
1648 INTEGER :: handle, i, i_rep, iounit, ipaodesc, ipaopot, ipos, j, jj, k_rep, l, m, n_rep, &
1649 nb_rep, nexp, ngauss, nlcc, nloc, nnl, norbitals, npaodesc, npaopot, nppnl, nspin, nu, z
1650 INTEGER,
DIMENSION(:),
POINTER :: add_el, elec_conf, orbitals
1651 LOGICAL :: check, ecp_semi_local, explicit, explicit_basis, explicit_j, explicit_kgpot, &
1652 explicit_potential, explicit_u, explicit_u_m_j, nobasis, nobasis_nuc, section_enabled, &
1653 subsection_enabled, update_input
1654 REAL(kind=
dp) :: alpha, ccore, mass, r, rc, &
1656 REAL(kind=
dp),
DIMENSION(6) :: error
1657 REAL(kind=
dp),
DIMENSION(:),
POINTER :: a_nl, aloc, anlcc, cloc, cnlcc, nelec
1658 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_nl
1659 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: c_nl
1666 TYPE(
section_vals_type),
POINTER :: basis_section, bs_section, dft_plus_u_section, &
1667 dft_section, enforce_occupation_section, kgpot_section, pao_desc_section, &
1668 pao_pot_section, potential_section, spin_section
1671 CALL timeset(routinen, handle)
1679 update_input = .true.
1680 basis_set_name(:) =
""
1681 basis_set_type(:) =
""
1682 basis_set_form(:) =
""
1688 zeff_correction = 0.0_dp
1690 explicit_basis = .false.
1691 explicit_j = .false.
1692 explicit_kgpot = .false.
1693 explicit_potential = .false.
1694 explicit_u = .false.
1695 explicit_u_m_j = .false.
1700 akind_name = qs_kind%name
1705 c_val=keyword, i_rep_section=i_rep)
1707 IF (keyword == akind_name)
THEN
1714 ipos = index(qs_kind%name,
"_")
1715 IF (((ipos == 2) .OR. (ipos == 3)) .AND. (index(qs_kind%name,
"_ghost") == 0))
THEN
1718 akind_name = qs_kind%name(1:ipos - 1)
1722 c_val=keyword, i_rep_section=i_rep)
1724 IF (keyword == akind_name)
THEN
1735 element_symbol = qs_kind%element_symbol(1:2)
1739 c_val=keyword, i_rep_section=i_rep)
1741 IF (keyword == element_symbol)
THEN
1752 c_val=keyword, i_rep_section=i_rep)
1754 IF (keyword ==
"DEFAULT")
THEN
1755 update_input = .false.
1761 IF (k_rep < 0 .AND. (.NOT. no_fail))
THEN
1762 CALL cp_abort(__location__, &
1763 "No &KIND section was possible to associate to the atomic kind <"// &
1764 trim(akind_name)//
">. The KIND section were also scanned for the"// &
1765 " corresponding element <"//trim(qs_kind%element_symbol)//
">"// &
1766 " and for the DEFAULT section but no match was found. Check your input file!")
1775 keyword_name=
"BASIS_SET", &
1776 explicit=explicit, &
1778 IF (.NOT. explicit) nb_rep = 0
1779 cpassert(nb_rep <= maxbas)
1782 keyword_name=
"BASIS_SET", i_rep_val=i, c_vals=tmpstringlist)
1783 IF (
SIZE(tmpstringlist) == 1)
THEN
1785 basis_set_type(i) =
"ORB"
1786 basis_set_form(i) =
"GTO"
1787 basis_set_name(i) = tmpstringlist(1)
1788 ELSEIF (
SIZE(tmpstringlist) == 2)
THEN
1790 basis_set_type(i) = tmpstringlist(1)
1791 basis_set_form(i) =
"GTO"
1792 basis_set_name(i) = tmpstringlist(2)
1793 ELSEIF (
SIZE(tmpstringlist) == 3)
THEN
1794 basis_set_type(i) = tmpstringlist(1)
1795 basis_set_form(i) = tmpstringlist(2)
1796 basis_set_name(i) = tmpstringlist(3)
1798 CALL cp_abort(__location__, &
1799 "invalid number of BASIS_SET keyword parameters: BASIS_SET [<TYPE>] [<FORM>] <NAME>")
1802 IF (basis_set_form(i) /=
"GTO" .AND. basis_set_form(i) /=
"STO")
THEN
1803 cpabort(
"invalid BASIS_SET FORM parameter")
1809 i_val=qs_kind%pao_basis_size)
1814 c_val=qs_kind%pao_model_file)
1820 ALLOCATE (qs_kind%pao_potentials(npaopot))
1821 DO ipaopot = 1, npaopot
1823 i_val=qs_kind%pao_potentials(ipaopot)%maxl)
1824 CALL section_vals_val_get(pao_pot_section, keyword_name=
"MAX_PROJECTOR", i_rep_section=ipaopot, &
1825 i_val=qs_kind%pao_potentials(ipaopot)%max_projector)
1827 r_val=qs_kind%pao_potentials(ipaopot)%beta)
1829 r_val=qs_kind%pao_potentials(ipaopot)%weight)
1835 ALLOCATE (qs_kind%pao_descriptors(npaodesc))
1836 DO ipaodesc = 1, npaodesc
1838 r_val=qs_kind%pao_descriptors(ipaodesc)%beta)
1839 CALL section_vals_val_get(pao_desc_section, keyword_name=
"SCREENING", i_rep_section=ipaodesc, &
1840 r_val=qs_kind%pao_descriptors(ipaodesc)%screening)
1842 r_val=qs_kind%pao_descriptors(ipaodesc)%weight)
1847 keyword_name=
"ELEC_CONF", n_rep_val=i)
1850 keyword_name=
"ELEC_CONF", i_vals=elec_conf)
1854 keyword_name=
"CORE_CORRECTION", r_val=zeff_correction)
1857 keyword_name=
"POTENTIAL_FILE_NAME", c_val=potential_fn_kind)
1859 keyword_name=
"POTENTIAL_TYPE", c_val=potential_type)
1861 explicit=explicit, keyword_name=
"POTENTIAL", c_vals=tmpstringlist)
1863 IF (
SIZE(tmpstringlist) == 1)
THEN
1865 potential_name = tmpstringlist(1)
1866 IF (potential_type ==
"")
THEN
1867 ipos = index(potential_name,
"-")
1869 potential_type = potential_name(:ipos - 1)
1871 potential_type = potential_name
1874 ELSEIF (
SIZE(tmpstringlist) == 2)
THEN
1875 potential_type = tmpstringlist(1)
1876 potential_name = tmpstringlist(2)
1878 cpabort(
"POTENTIAL input list is not correct")
1885 keyword_name=
"KG_POTENTIAL_FILE_NAME", c_val=kg_potential_fn_kind)
1887 keyword_name=
"KG_POTENTIAL", c_val=kgpot_name)
1891 keyword_name=
"ECP_SEMI_LOCAL", l_val=ecp_semi_local)
1894 qs_kind%covalent_radius =
ptable(z)%covalent_radius*
bohr
1896 keyword_name=
"COVALENT_RADIUS", r_val=r)
1897 IF (r > 0.0_dp) qs_kind%covalent_radius = r
1900 qs_kind%vdw_radius =
ptable(z)%vdw_radius*
bohr
1902 keyword_name=
"VDW_RADIUS", r_val=r)
1903 IF (r > 0.0_dp) qs_kind%vdw_radius = r
1907 keyword_name=
"HARD_EXP_RADIUS")
1910 qs_kind%hard_radius = 1.2_dp
1912 qs_kind%hard_radius = 0.8_dp*
bohr
1916 keyword_name=
"HARD_EXP_RADIUS", r_val=qs_kind%hard_radius)
1921 keyword_name=
"RHO0_EXP_RADIUS")
1923 qs_kind%hard0_radius = qs_kind%hard_radius
1926 keyword_name=
"RHO0_EXP_RADIUS", r_val=qs_kind%hard0_radius)
1928 IF (qs_kind%hard_radius < qs_kind%hard0_radius) &
1929 cpabort(
"rc0 should be <= rc")
1932 keyword_name=
"MAX_RAD_LOCAL", r_val=qs_kind%max_rad_local)
1934 keyword_name=
"LEBEDEV_GRID", i_val=qs_kind%ngrid_ang)
1935 IF (qs_kind%ngrid_ang <= 0) &
1936 cpabort(
"# point lebedev grid < 0")
1938 keyword_name=
"RADIAL_GRID", i_val=qs_kind%ngrid_rad)
1939 IF (qs_kind%ngrid_rad <= 0) &
1940 cpabort(
"# point radial grid < 0")
1942 keyword_name=
"GPW_TYPE", l_val=qs_kind%gpw_type_forced)
1944 keyword_name=
"GHOST", l_val=qs_kind%ghost)
1946 keyword_name=
"FLOATING_BASIS_CENTER", l_val=qs_kind%floating)
1948 keyword_name=
"NO_OPTIMIZE", l_val=qs_kind%no_optimize)
1952 keyword_name=
"MAGNETIZATION", r_val=qs_kind%magnetization)
1955 keyword_name=
"DFTB3_PARAM", r_val=qs_kind%dudq_dftb3)
1957 keyword_name=
"LMAX_DFTB", i_val=qs_kind%lmax_dftb)
1961 keyword_name=
"MAO", i_val=qs_kind%mao)
1964 NULLIFY (bs_section)
1966 i_rep_section=k_rep)
1967 section_enabled = .false.
1969 l_val=section_enabled)
1970 IF (section_enabled)
THEN
1972 IF (qs_kind%magnetization /= 0.0_dp)
THEN
1973 CALL cp_abort(__location__,
"BS Section is in conflict with non-zero magnetization "// &
1974 "for this atom kind.")
1976 qs_kind%bs_occupation = .true.
1978 NULLIFY (spin_section)
1984 keyword_name=
"NEL", i_vals=add_el)
1985 cpassert(
ASSOCIATED(add_el))
1986 ALLOCATE (qs_kind%addel(
SIZE(add_el), 2))
1988 qs_kind%addel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
1991 keyword_name=
"L", i_vals=add_el)
1992 cpassert(
ASSOCIATED(add_el))
1993 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
1994 ALLOCATE (qs_kind%laddel(
SIZE(add_el), 2))
1996 qs_kind%laddel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
1997 ALLOCATE (qs_kind%naddel(
SIZE(add_el), 2))
2001 keyword_name=
"N", n_rep_val=i)
2004 keyword_name=
"N", i_vals=add_el)
2005 IF (
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
THEN
2006 qs_kind%naddel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
2011 NULLIFY (spin_section)
2017 keyword_name=
"NEL", i_vals=add_el)
2018 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
2019 qs_kind%addel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
2020 qs_kind%addel(:, :) = qs_kind%addel(:, :)
2023 keyword_name=
"L", i_vals=add_el)
2024 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
2025 qs_kind%laddel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
2028 keyword_name=
"N", n_rep_val=i)
2032 keyword_name=
"N", i_vals=add_el)
2033 IF (
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
THEN
2034 qs_kind%naddel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
2042 NULLIFY (dft_plus_u_section)
2044 subsection_name=
"DFT_PLUS_U", &
2045 i_rep_section=k_rep)
2046 section_enabled = .false.
2048 keyword_name=
"_SECTION_PARAMETERS_", &
2049 l_val=section_enabled)
2050 IF (section_enabled)
THEN
2051 ALLOCATE (qs_kind%dft_plus_u)
2052 NULLIFY (qs_kind%dft_plus_u%nelec)
2053 NULLIFY (qs_kind%dft_plus_u%orbitals)
2057 qs_kind%dft_plus_u%l = l
2058#if defined(__SIRIUS)
2062 qs_kind%dft_plus_u%n = nu
2066 r_val=qs_kind%dft_plus_u%U, &
2067 explicit=explicit_u)
2071 r_val=qs_kind%dft_plus_u%J, &
2072 explicit=explicit_j)
2075 keyword_name=
"alpha", &
2076 r_val=qs_kind%dft_plus_u%alpha)
2079 keyword_name=
"beta", &
2080 r_val=qs_kind%dft_plus_u%beta)
2083 keyword_name=
"J0", &
2084 r_val=qs_kind%dft_plus_u%J0)
2087 keyword_name=
"occupation", &
2088 r_val=qs_kind%dft_plus_u%occupation)
2094 keyword_name=
"U_MINUS_J", &
2095 r_val=qs_kind%dft_plus_u%u_minus_j_target, &
2096 explicit=explicit_u_m_j)
2098 IF ((explicit_u .OR. explicit_j) .AND. explicit_u_m_j)
THEN
2099 cpabort(
"DFT+U| specifying U or J and U_MINUS_J parameters are mutually exclusive.")
2103 keyword_name=
"U_RAMPING", &
2104 r_val=qs_kind%dft_plus_u%u_ramping)
2106 keyword_name=
"INIT_U_RAMPING_EACH_SCF", &
2107 l_val=qs_kind%dft_plus_u%init_u_ramping_each_scf)
2108 IF (qs_kind%dft_plus_u%u_ramping > 0.0_dp)
THEN
2109 qs_kind%dft_plus_u%u_minus_j = 0.0_dp
2111 qs_kind%dft_plus_u%u_minus_j = qs_kind%dft_plus_u%u_minus_j_target
2114 keyword_name=
"EPS_U_RAMPING", &
2115 r_val=qs_kind%dft_plus_u%eps_u_ramping)
2117 NULLIFY (enforce_occupation_section)
2119 subsection_name=
"ENFORCE_OCCUPATION")
2120 subsection_enabled = .false.
2122 keyword_name=
"_SECTION_PARAMETERS_", &
2123 l_val=subsection_enabled)
2124 IF (subsection_enabled)
THEN
2127 keyword_name=
"NELEC", &
2130 ALLOCATE (qs_kind%dft_plus_u%nelec(nspin))
2131 qs_kind%dft_plus_u%nelec(:) = nelec(:)
2134 keyword_name=
"ORBITALS", &
2136 norbitals =
SIZE(orbitals)
2137 IF (norbitals <= 0 .OR. norbitals > 2*l + 1) &
2138 CALL cp_abort(__location__,
"DFT+U| Invalid number of ORBITALS specified: "// &
2139 "1 to 2*L+1 integer numbers are expected")
2140 ALLOCATE (qs_kind%dft_plus_u%orbitals(norbitals))
2141 qs_kind%dft_plus_u%orbitals(:) = orbitals(:)
2144 IF (qs_kind%dft_plus_u%orbitals(m) > l) &
2145 cpabort(
"DFT+U| Invalid orbital magnetic quantum number specified: m > l")
2146 IF (qs_kind%dft_plus_u%orbitals(m) < -l) &
2147 cpabort(
"DFT+U| Invalid orbital magnetic quantum number specified: m < -l")
2150 IF (qs_kind%dft_plus_u%orbitals(j) == qs_kind%dft_plus_u%orbitals(m)) &
2151 cpabort(
"DFT+U| An orbital magnetic quantum number was specified twice")
2156 keyword_name=
"EPS_SCF", &
2157 r_val=qs_kind%dft_plus_u%eps_scf)
2159 keyword_name=
"MAX_SCF", &
2161 qs_kind%dft_plus_u%max_scf = max(-1, i)
2163 keyword_name=
"SMEAR", &
2164 l_val=qs_kind%dft_plus_u%smear)
2175 explicit_basis = .false.
2178 can_return_null=.true.)
2182 explicit_potential = .false.
2185 i_rep_section=k_rep, can_return_null=.true.)
2189 explicit_kgpot = .false.
2192 i_rep_section=k_rep, can_return_null=.true.)
2196 SELECT CASE (method_id)
2203 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2204 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2207 cpassert(.NOT. qs_kind%floating)
2208 IF (qs_kind%ghost)
THEN
2209 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2212 elec_conf=elec_conf)
2216 zeff_correction=0.0_dp)
2221 check = .NOT.
ASSOCIATED(qs_kind%se_parameter)
2229 keyword_name=
"SE_P_ORBITALS_ON_H", l_val=qs_kind%se_parameter%p_orbitals_on_h)
2237 NULLIFY (tmp_basis_set)
2238 CALL init_se_param(qs_kind%se_parameter, tmp_basis_set, ngauss)
2241 zeff=qs_kind%se_parameter%zeff, zeff_correction=zeff_correction)
2242 qs_kind%se_parameter%zeff = qs_kind%se_parameter%zeff - zeff_correction
2244 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2246 CALL cp_warn(__location__, &
2247 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2248 trim(qs_kind%name)//
"> will be ignored!")
2250 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2252 CALL cp_warn(__location__, &
2253 "Information provided in the input file regarding BASIS for KIND <"// &
2254 trim(qs_kind%name)//
"> will be ignored!")
2261 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2262 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2265 cpassert(.NOT. qs_kind%floating)
2266 IF (qs_kind%ghost)
THEN
2267 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2270 elec_conf=elec_conf)
2274 zeff_correction=0.0_dp)
2277 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2279 CALL cp_warn(__location__, &
2280 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2281 trim(qs_kind%name)//
"> will be ignored!")
2283 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2285 CALL cp_warn(__location__, &
2286 "Information provided in the input file regarding BASIS for KIND <"// &
2287 trim(qs_kind%name)//
"> will be ignored!")
2294 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2295 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2298 cpassert(.NOT. qs_kind%floating)
2299 IF (qs_kind%ghost)
THEN
2300 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2303 elec_conf=elec_conf)
2307 zeff_correction=0.0_dp)
2310 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2312 CALL cp_warn(__location__, &
2313 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2314 trim(qs_kind%name)//
"> will be ignored!")
2316 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2318 CALL cp_warn(__location__, &
2319 "Information provided in the input file regarding BASIS for KIND <"// &
2320 trim(qs_kind%name)//
"> will be ignored!")
2325 IF (potential_name /=
'')
THEN
2326 SELECT CASE (trim(potential_type))
2327 CASE (
"ALL",
"ECP",
"CNEO")
2328 CALL cp_abort(__location__, &
2329 "PW DFT calculations only with potential type UPF or GTH possible."// &
2330 " <"//trim(potential_type)//
"> was specified "// &
2331 "for the atomic kind <"//trim(qs_kind%name))
2333 IF (potential_fn_kind ==
"-")
THEN
2336 potential_file_name = potential_fn_kind
2340 qs_kind%gth_potential, zeff_correction, para_env, &
2341 potential_file_name, potential_section, update_input)
2344 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2345 CALL get_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2348 CALL set_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2351 ALLOCATE (qs_kind%upf_potential)
2352 qs_kind%upf_potential%zion = 0
2353 qs_kind%upf_potential%filename = adjustl(trim(potential_name))
2355 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2356 CALL set_qs_kind(qs_kind, elec_conf=qs_kind%upf_potential%econf)
2359 CALL cp_abort(__location__, &
2360 "An invalid potential type <"// &
2361 trim(potential_type)//
"> was specified "// &
2362 "for the atomic kind <"// &
2366 CALL cp_abort(__location__, &
2367 "No potential type was defined for the "// &
2368 "atomic kind <"//trim(qs_kind%name)//
">")
2378 SELECT CASE (basis_set_form(i))
2380 NULLIFY (tmp_basis_set)
2383 tmp_basis_set, para_env, dft_section)
2385 NULLIFY (sto_basis_set)
2388 sto_basis_set, para_env, dft_section)
2389 NULLIFY (tmp_basis_set)
2393 CALL cp_abort(__location__, &
2394 "Invalid basis set form "//trim(basis_set_form(i))// &
2395 "for atomic kind <"//trim(qs_kind%name)//
">")
2397 tmp = basis_set_type(i)
2402 IF (explicit_basis)
THEN
2405 NULLIFY (tmp_basis_set)
2408 tmp_basis_set, basis_section, i, dft_section)
2415 DO i = 1,
SIZE(qs_kind%basis_sets)
2416 NULLIFY (tmp_basis_set)
2418 inumbas=i, basis_type=basis_type)
2419 IF (basis_type ==
"") cycle
2421 DO j = i + 1,
SIZE(qs_kind%basis_sets)
2423 NULLIFY (sup_basis_set)
2425 inumbas=jj, basis_type=tmp)
2426 IF (basis_type == tmp)
THEN
2433 NULLIFY (sup_basis_set)
2438 DO i = 1,
SIZE(qs_kind%basis_sets)
2439 NULLIFY (tmp_basis_set)
2441 inumbas=i, basis_type=basis_type)
2442 IF (basis_type ==
"ORB") nobasis = .false.
2445 CALL cp_abort(__location__, &
2446 "No basis set type was defined for the "// &
2447 "atomic kind <"//trim(qs_kind%name)//
">")
2451 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
2452 IF (
ASSOCIATED(qs_kind%elec_conf)) qs_kind%elec_conf = 0
2455 IF ((potential_name /=
'') .OR. explicit_potential)
THEN
2457 IF (potential_fn_kind ==
"-")
THEN
2460 potential_file_name = potential_fn_kind
2463 SELECT CASE (trim(potential_type))
2467 qs_kind%all_potential, zeff_correction, para_env, &
2468 potential_file_name, potential_section, update_input)
2471 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2472 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2475 CALL set_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2480 qs_kind%gth_potential, zeff_correction, para_env, &
2481 potential_file_name, potential_section, update_input)
2484 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2485 CALL get_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2488 CALL set_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2492 CALL get_potential(qs_kind%sgp_potential, description=description)
2494 potential_name, potential_file_name, potential_section)
2495 IF (ecp_semi_local)
THEN
2496 description(1) =
"Semi-local Gaussian pseudopotential "
2497 description(2) =
"ECP "//trim(potential_name)
2498 description(3) =
"LIBGRPP: A. V. Oleynichenko et al., Symmetry 15 197 2023"
2499 description(4) =
" "
2501 description(4) =
"ECP "//trim(potential_name)
2503 CALL set_potential(qs_kind%sgp_potential, name=ecppot%pname, description=description, &
2504 zeff=ecppot%zion, z=z, ecp_local=.true., ecp_semi_local=ecp_semi_local, &
2505 nloc=ecppot%nloc, nrloc=ecppot%nrloc, aloc=ecppot%aloc, bloc=ecppot%bloc, &
2507 CALL set_potential(qs_kind%sgp_potential, sl_lmax=ecppot%lmax, &
2508 npot=ecppot%npot, nrpot=ecppot%nrpot, apot=ecppot%apot, bpot=ecppot%bpot)
2510 IF (.NOT. ecp_semi_local)
THEN
2511 cpabort(
"ECPs are only well tested in their semi-local form")
2512 CALL get_qs_kind(qs_kind, basis_set=orb_basis_set)
2513 CALL sgp_construction(sgp_pot=sgppot, ecp_pot=ecppot, orb_basis=orb_basis_set, error=error)
2514 IF (iounit > 0 .AND. .NOT. silent)
THEN
2515 WRITE (iounit,
"(/,T2,'PP Transformation for ',A)") trim(ecppot%pname)
2516 IF (sgppot%has_local)
THEN
2517 WRITE (iounit,
"(T8,'Accuracy for local part:',T41,F10.3,'%',T61,F20.12)") error(4), error(1)
2519 IF (sgppot%has_nonlocal)
THEN
2520 WRITE (iounit,
"(T8,'Accuracy for nonlocal part:',T41,F10.3,'%',T61,F20.12)") error(5), error(2)
2522 IF (sgppot%has_nlcc)
THEN
2523 WRITE (iounit,
"(T8,'Accuracy for NLCC density:',T61,F20.12)") error(3)
2527 IF (sgppot%has_nonlocal)
THEN
2528 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=sgppot%n_nonlocal, lmax=sgppot%lmax, &
2529 is_nonlocal=sgppot%is_nonlocal)
2530 nnl = sgppot%n_nonlocal
2532 DO l = 0, sgppot%lmax
2533 nppnl = nppnl + nnl*
nco(l)
2536 ALLOCATE (a_nl(nnl), h_nl(nnl, 0:l), c_nl(nnl, nnl, 0:l))
2537 a_nl(:) = sgppot%a_nonlocal(:)
2538 h_nl(:, :) = sgppot%h_nonlocal(:, :)
2539 DO l = 0, sgppot%lmax
2540 c_nl(:, :, l) = sgppot%c_nonlocal(:, :, l)*sqrt(2._dp*l + 1.0_dp)
2542 CALL set_potential(qs_kind%sgp_potential, nppnl=nppnl, a_nonlocal=a_nl, h_nonlocal=h_nl, c_nonlocal=c_nl)
2544 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=0, lmax=-1, is_nonlocal=sgppot%is_nonlocal)
2548 cpassert(.NOT. sgppot%has_local)
2549 cpassert(.NOT. sgppot%has_nlcc)
2551 rc = 0.5_dp*qs_kind%covalent_radius*
angstrom
2552 rc = max(rc, 0.2_dp)
2553 rc = min(rc, 1.0_dp)
2554 alpha = 1.0_dp/(2.0_dp*rc**2)
2555 ccore = ecppot%zion*sqrt((alpha/
pi)**3)
2556 CALL set_potential(qs_kind%sgp_potential, alpha_core_charge=alpha, ccore_charge=ccore, &
2557 core_charge_radius=rc)
2560 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2564 CALL set_potential(qs_kind%sgp_potential, elec_conf=elec_conf)
2567 CALL get_potential(qs_kind%sgp_potential, description=description)
2568 description(4) =
"UPF "//trim(potential_name)
2570 CALL set_potential(qs_kind%sgp_potential, name=upfpot%pname, description=description, &
2571 zeff=upfpot%zion, z=z,
has_nlcc=upfpot%core_correction)
2574 IF (iounit > 0 .AND. .NOT. silent)
THEN
2575 WRITE (iounit,
"(/,T2,'PP Transformation for ',A)") trim(upfpot%pname)
2576 IF (sgppot%has_local)
THEN
2577 WRITE (iounit,
"(T8,'Accuracy for local part:',T61,F20.12)") error(1)
2579 IF (sgppot%has_nonlocal)
THEN
2580 WRITE (iounit,
"(T8,'Accuracy for nonlocal part:',T61,F20.12)") error(2)
2582 IF (sgppot%has_nlcc)
THEN
2583 WRITE (iounit,
"(T8,'Accuracy for NLCC density:',T61,F20.12)") error(3)
2586 IF (sgppot%has_nonlocal)
THEN
2587 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=sgppot%n_nonlocal, lmax=sgppot%lmax, &
2588 is_nonlocal=sgppot%is_nonlocal)
2589 nnl = sgppot%n_nonlocal
2591 DO l = 0, sgppot%lmax
2592 nppnl = nppnl + nnl*
nco(l)
2595 ALLOCATE (a_nl(nnl), h_nl(nnl, 0:l), c_nl(nnl, nnl, 0:l))
2596 a_nl(:) = sgppot%a_nonlocal(:)
2597 h_nl(:, :) = sgppot%h_nonlocal(:, :)
2598 c_nl(:, :, :) = sgppot%c_nonlocal(:, :, :)
2599 CALL set_potential(qs_kind%sgp_potential, nppnl=nppnl, a_nonlocal=a_nl, h_nonlocal=h_nl, c_nonlocal=c_nl)
2601 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=0, lmax=-1, is_nonlocal=sgppot%is_nonlocal)
2604 cpassert(sgppot%has_local)
2606 rc = sgppot%ac_local
2607 alpha = 1.0_dp/(2.0_dp*rc**2)
2608 ccore = upfpot%zion*sqrt((alpha/
pi)**3)
2609 CALL set_potential(qs_kind%sgp_potential, alpha_core_charge=alpha, ccore_charge=ccore, &
2610 core_charge_radius=rc)
2612 nloc = sgppot%n_local
2613 ALLOCATE (aloc(nloc), cloc(nloc))
2614 aloc(1:nloc) = sgppot%a_local(1:nloc)
2615 cloc(1:nloc) = sgppot%c_local(1:nloc)
2616 CALL set_potential(qs_kind%sgp_potential, n_local=nloc, a_local=aloc, c_local=cloc)
2617 IF (sgppot%has_nlcc)
THEN
2618 nlcc = sgppot%n_nlcc
2619 ALLOCATE (anlcc(nlcc), cnlcc(nlcc))
2620 anlcc(1:nlcc) = sgppot%a_nlcc(1:nlcc)
2621 cnlcc(1:nlcc) = sgppot%c_nlcc(1:nlcc)
2626 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2630 CALL set_potential(qs_kind%sgp_potential, elec_conf=elec_conf)
2634 IF (zeff_correction /= 0.0_dp) &
2635 cpabort(
"CORE_CORRECTION is not compatible with CNEO")
2644 keyword_name=
"MASS", n_rep_val=i)
2646 keyword_name=
"MASS", r_val=mass)
2649 IF (mass - real(z,
dp)*0.000548579909_dp > 0.0_dp)
THEN
2650 mass = mass - real(z,
dp)*0.000548579909_dp
2656 IF (abs(mass + real(z,
dp)*0.000548579909_dp -
ptable(z)%amass) < 1.e-4_dp)
THEN
2657 CALL cp_warn(__location__, &
2658 "Atomic mass of the atomic kind <"//trim(qs_kind%name)// &
2659 "> is very close to its average mass. Is it a pure isotope? "// &
2660 "Pure isotopes are preferable for CNEO. "// &
2661 "(e.g., mass of 1H is 1.007825, not 1.00794)")
2664 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2671 CALL cp_abort(__location__, &
2672 "An invalid potential type <"// &
2673 trim(potential_name)//
"> was specified "// &
2674 "for the atomic kind <"// &
2678 CALL cp_abort(__location__, &
2679 "No potential type was defined for the "// &
2680 "atomic kind <"//trim(qs_kind%name)//
">")
2683 CALL check_potential_basis_compatibility(qs_kind)
2686 IF ((kgpot_name /=
'') .OR. explicit_kgpot)
THEN
2687 ipos = index(kgpot_name,
"-")
2689 kgpot_type = kgpot_name(:ipos - 1)
2691 kgpot_type = kgpot_name
2695 SELECT CASE (trim(kgpot_type))
2698 IF (kg_potential_fn_kind ==
"-")
THEN
2701 potential_file_name = kg_potential_fn_kind
2705 qs_kind%tnadd_potential, para_env, &
2706 potential_file_name, kgpot_section, update_input)
2708 NULLIFY (qs_kind%tnadd_potential)
2710 CALL cp_abort(__location__, &
2711 "An invalid kg_potential type <"// &
2712 trim(potential_name)//
"> was specified "// &
2713 "for the atomic kind <"// &
2720 nobasis_nuc =
ASSOCIATED(qs_kind%cneo_potential)
2721 DO i = 1,
SIZE(qs_kind%basis_sets)
2722 NULLIFY (tmp_basis_set)
2724 inumbas=i, basis_type=basis_type)
2725 IF (basis_type ==
"NUC")
THEN
2726 nobasis_nuc = .false.
2727 IF (.NOT.
ASSOCIATED(qs_kind%cneo_potential))
THEN
2728 CALL cp_warn(__location__, &
2729 "POTENTIAL is not set to CNEO, NUC type basis set for KIND <"// &
2730 trim(qs_kind%name)//
"> will be ignored!")
2734 IF (nobasis_nuc)
THEN
2735 CALL cp_abort(__location__, &
2736 "No NUC type basis set was defined for the "// &
2737 "atomic kind <"//trim(qs_kind%name)//
">, which is required by "// &
2742 CALL timestop(handle)
2744 END SUBROUTINE read_qs_kind
2751 SUBROUTINE check_potential_basis_compatibility(qs_kind)
2754 CHARACTER(LEN=default_string_length) :: name
2759 CALL get_qs_kind(qs_kind, name=name, gth_potential=gth_potential, basis_set=basis_set)
2762 IF (
ASSOCIATED(gth_potential)) &
2763 npp = parse_valence_electrons(gth_potential%aliases)
2764 IF (
ASSOCIATED(basis_set)) &
2765 nbs = parse_valence_electrons(basis_set%aliases)
2767 IF (npp >= 0 .AND. nbs >= 0 .AND. npp /= nbs) &
2768 CALL cp_abort(__location__,
"Basis-set and pseudo-potential of atomic kind '"//trim(name)//
"'"// &
2769 " were optimized for different valence electron numbers.")
2771 END SUBROUTINE check_potential_basis_compatibility
2779 FUNCTION parse_valence_electrons(string)
RESULT(n)
2780 CHARACTER(*) :: string
2783 INTEGER :: i, istat, j
2785 i = index(string,
"-Q", .true.)
2789 j = scan(string(i + 2:),
"- ")
2790 READ (string(i + 2:i + j),
'(I3)', iostat=istat) n
2791 IF (istat /= 0) n = -1
2806 force_env_section, silent)
2808 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2813 LOGICAL,
INTENT(IN) :: silent
2815 CHARACTER(len=*),
PARAMETER :: routinen =
'create_qs_kind_set'
2817 INTEGER :: handle, ikind, method, nkind, qs_method
2820 CALL timeset(routinen, handle)
2822 IF (
ASSOCIATED(qs_kind_set)) cpabort(
"create_qs_kind_set: qs_kind_set already associated")
2823 IF (.NOT.
ASSOCIATED(atomic_kind_set)) cpabort(
"create_qs_kind_set: atomic_kind_set not associated")
2829 IF (method ==
do_qs)
THEN
2831 SELECT CASE (qs_method)
2846 nkind =
SIZE(atomic_kind_set)
2847 ALLOCATE (qs_kind_set(nkind))
2850 qs_kind_set(ikind)%name = atomic_kind_set(ikind)%name
2851 qs_kind_set(ikind)%element_symbol = atomic_kind_set(ikind)%element_symbol
2852 qs_kind_set(ikind)%natom = atomic_kind_set(ikind)%natom
2853 CALL read_qs_kind(qs_kind_set(ikind), kind_section, para_env, force_env_section, &
2854 no_fail, qs_method, silent)
2857 CALL timestop(handle)
2868 SUBROUTINE check_qs_kind(qs_kind, dft_control, subsys_section)
2880 IF (dft_control%qs_control%semi_empirical)
THEN
2881 CALL get_qs_kind(qs_kind, se_parameter=se_parameter)
2882 cpassert(
ASSOCIATED(se_parameter))
2886 ELSE IF (dft_control%qs_control%dftb)
THEN
2887 CALL get_qs_kind(qs_kind, dftb_parameter=dftb_parameter)
2888 cpassert(
ASSOCIATED(dftb_parameter))
2892 ELSE IF (dft_control%qs_control%xtb)
THEN
2893 IF (.NOT. (dft_control%qs_control%xtb_control%do_tblite))
THEN
2894 CALL get_qs_kind(qs_kind, xtb_parameter=xtb_parameter)
2895 cpassert(
ASSOCIATED(xtb_parameter))
2896 gfn_type = dft_control%qs_control%xtb_control%gfn_type
2901 END SUBROUTINE check_qs_kind
2911 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2915 CHARACTER(len=*),
PARAMETER :: routinen =
'check_qs_kind_set'
2917 INTEGER :: handle, ikind, nkind
2920 CALL timeset(routinen, handle)
2921 IF (
ASSOCIATED(qs_kind_set))
THEN
2922 nkind =
SIZE(qs_kind_set)
2924 qs_kind => qs_kind_set(ikind)
2925 CALL check_qs_kind(qs_kind, dft_control, subsys_section)
2927 IF (dft_control%qs_control%xtb)
THEN
2928 CALL write_xtb_kab_param(qs_kind_set, subsys_section, &
2929 dft_control%qs_control%xtb_control)
2932 cpabort(
"The pointer qs_kind_set is not associated")
2934 CALL timestop(handle)
2943 SUBROUTINE write_xtb_kab_param(qs_kind_set, subsys_section, xtb_control)
2945 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2949 CHARACTER(LEN=default_string_length) :: aname, bname
2950 INTEGER :: ikind, io_unit, jkind, nkind, za, zb
2953 TYPE(
xtb_atom_type),
POINTER :: xtb_parameter_a, xtb_parameter_b
2958 "PRINT%KINDS/POTENTIAL"),
cp_p_file))
THEN
2961 IF (io_unit > 0)
THEN
2963 WRITE (io_unit,
"(/,T2,A)")
"xTB| Kab parameters"
2964 nkind =
SIZE(qs_kind_set)
2966 qs_kinda => qs_kind_set(ikind)
2967 CALL get_qs_kind(qs_kinda, xtb_parameter=xtb_parameter_a)
2969 DO jkind = ikind, nkind
2970 qs_kindb => qs_kind_set(jkind)
2971 CALL get_qs_kind(qs_kindb, xtb_parameter=xtb_parameter_b)
2973 WRITE (io_unit,
"(A,T10,A15,T25,A15,T71,F10.3)") &
2974 " Kab:", trim(aname), trim(bname),
xtb_set_kab(za, zb, xtb_control)
2984 END SUBROUTINE write_xtb_kab_param
3007 SUBROUTINE set_qs_kind(qs_kind, paw_atom, ghost, floating, hard_radius, hard0_radius, &
3008 covalent_radius, vdw_radius, lmax_rho0, zeff, &
3009 no_optimize, dispersion, u_minus_j, reltmat, &
3010 dftb_parameter, xtb_parameter, &
3011 elec_conf, pao_basis_size)
3014 LOGICAL,
INTENT(IN),
OPTIONAL :: paw_atom, ghost, floating
3015 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: hard_radius, hard0_radius, &
3016 covalent_radius, vdw_radius
3017 INTEGER,
INTENT(IN),
OPTIONAL :: lmax_rho0
3018 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: zeff
3019 LOGICAL,
INTENT(IN),
OPTIONAL :: no_optimize
3021 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: u_minus_j
3022 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: reltmat
3025 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: elec_conf
3026 INTEGER,
INTENT(IN),
OPTIONAL :: pao_basis_size
3028 IF (
PRESENT(dftb_parameter)) qs_kind%dftb_parameter => dftb_parameter
3029 IF (
PRESENT(xtb_parameter)) qs_kind%xtb_parameter => xtb_parameter
3030 IF (
PRESENT(elec_conf))
THEN
3031 IF (
ASSOCIATED(qs_kind%elec_conf))
THEN
3032 DEALLOCATE (qs_kind%elec_conf)
3034 ALLOCATE (qs_kind%elec_conf(0:
SIZE(elec_conf) - 1))
3035 qs_kind%elec_conf(:) = elec_conf(:)
3037 IF (
PRESENT(paw_atom)) qs_kind%paw_atom = paw_atom
3038 IF (
PRESENT(hard_radius)) qs_kind%hard_radius = hard_radius
3039 IF (
PRESENT(hard0_radius)) qs_kind%hard0_radius = hard0_radius
3040 IF (
PRESENT(covalent_radius)) qs_kind%covalent_radius = covalent_radius
3041 IF (
PRESENT(vdw_radius)) qs_kind%vdw_radius = vdw_radius
3042 IF (
PRESENT(lmax_rho0)) qs_kind%lmax_rho0 = lmax_rho0
3043 IF (
PRESENT(zeff))
THEN
3044 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
3045 CALL set_potential(potential=qs_kind%all_potential, zeff=zeff)
3046 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
3047 CALL set_potential(potential=qs_kind%gth_potential, zeff=zeff)
3048 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
3049 CALL set_potential(potential=qs_kind%sgp_potential, zeff=zeff)
3050 ELSE IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
3051 cpabort(
"CNEO potential ZEFF should not be manually set")
3054 IF (
PRESENT(ghost)) qs_kind%ghost = ghost
3056 IF (
PRESENT(floating)) qs_kind%floating = floating
3058 IF (
PRESENT(no_optimize)) qs_kind%no_optimize = no_optimize
3060 IF (
PRESENT(dispersion)) qs_kind%dispersion => dispersion
3062 IF (
PRESENT(u_minus_j))
THEN
3063 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
3064 qs_kind%dft_plus_u%u_minus_j = u_minus_j
3068 IF (
PRESENT(reltmat)) qs_kind%reltmat => reltmat
3070 IF (
PRESENT(pao_basis_size)) qs_kind%pao_basis_size = pao_basis_size
3082 SUBROUTINE write_qs_kind(qs_kind, kind_number, output_unit)
3085 INTEGER,
INTENT(in) :: kind_number, output_unit
3087 CHARACTER(LEN=3) :: yon
3088 CHARACTER(LEN=default_string_length) :: basis_type, bstring
3093 IF (output_unit > 0)
THEN
3095 IF (
ASSOCIATED(qs_kind))
THEN
3096 WRITE (unit=output_unit, fmt=
"(/,T2,I2,A,T57,A,T75,I6)") &
3097 kind_number,
". Atomic kind: "//trim(qs_kind%name), &
3098 "Number of atoms: ", qs_kind%natom
3100 DO ibas = 1,
SIZE(qs_kind%basis_sets, 1)
3103 inumbas=ibas, basis_type=basis_type)
3105 SELECT CASE (basis_type)
3107 bstring =
"Basis Set"
3110 bstring =
"Orbital Basis Set"
3112 bstring =
"GAPW Soft Basis Set"
3115 bstring =
"Auxiliary Basis Set"
3117 bstring =
"Minimal Basis Set"
3119 bstring =
"RI Auxiliary Basis Set"
3121 bstring =
"Auxiliary Fit Basis Set"
3123 bstring =
"LRI Basis Set"
3125 bstring =
"LRI Basis Set for TDDFPT"
3127 bstring =
"RI XAS Basis Set"
3129 bstring =
"RI HFX Basis Set"
3131 bstring =
"Nuclear Basis Set"
3134 bstring =
"Nuclear Soft Basis Set"
3144 IF (qs_kind%ghost)
THEN
3145 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
3146 "The atoms of this atomic kind are GHOST atoms!"
3148 IF (qs_kind%floating)
THEN
3149 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
3150 "The atoms of this atomic kind are FLOATING BASIS FUNCTIONS."
3152 IF (qs_kind%covalent_radius > 0.0_dp)
THEN
3153 WRITE (unit=output_unit, fmt=
"(/,T8,A,T71,F10.3)") &
3154 "Atomic covalent radius [Angstrom]:", &
3157 IF (qs_kind%vdw_radius > 0.0_dp)
THEN
3158 WRITE (unit=output_unit, fmt=
"(/,T8,A,T71,F10.3)") &
3159 "Atomic van der Waals radius [Angstrom]:", &
3162 IF (qs_kind%paw_atom)
THEN
3163 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
3164 "The atoms of this atomic kind are PAW atoms (GAPW):"
3165 WRITE (unit=output_unit, fmt=
"(T8,A,T71,F10.3)") &
3166 "Hard Gaussian function radius:", qs_kind%hard_radius, &
3167 "Rho0 radius:", qs_kind%hard0_radius, &
3168 "Maximum GTO radius used for PAW projector construction:", &
3169 qs_kind%max_rad_local
3172 basis_type=
"ORB_SOFT")
3176 IF (
ASSOCIATED(qs_kind%all_potential))
CALL write_potential(qs_kind%all_potential, output_unit)
3177 IF (
ASSOCIATED(qs_kind%gth_potential))
CALL write_potential(qs_kind%gth_potential, output_unit)
3178 IF (
ASSOCIATED(qs_kind%sgp_potential))
CALL write_potential(qs_kind%sgp_potential, output_unit)
3179 IF (
ASSOCIATED(qs_kind%tnadd_potential))
CALL write_potential(qs_kind%tnadd_potential, output_unit)
3180 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
3181 WRITE (unit=output_unit, fmt=
"(/,T6,A,/,T8,A,T76,I5,/,T8,A,T73,F8.3)") &
3182 "A DFT+U correction is applied to atoms of this atomic kind:", &
3183 "Angular quantum momentum number L:", qs_kind%dft_plus_u%l, &
3184 "U(eff) = (U - J) value in [eV]:", qs_kind%dft_plus_u%u_minus_j_target*
evolt
3185 IF (qs_kind%dft_plus_u%u_ramping > 0.0_dp)
THEN
3186 IF (qs_kind%dft_plus_u%init_u_ramping_each_scf)
THEN
3191 WRITE (unit=output_unit, fmt=
"(T8,A,T73,F8.3,/,T8,A,T73,ES8.1,/,T8,A,T78,A3)") &
3192 "Increment for U ramping in [eV]:", qs_kind%dft_plus_u%u_ramping*
evolt, &
3193 "SCF threshold value for U ramping:", qs_kind%dft_plus_u%eps_u_ramping, &
3194 "Set U ramping value to zero before each wavefunction optimisation:", yon
3196 IF (
ASSOCIATED(qs_kind%dft_plus_u%orbitals))
THEN
3197 WRITE (unit=output_unit, fmt=
"(T8,A)") &
3198 "An initial orbital occupation is requested:"
3199 IF (
ASSOCIATED(qs_kind%dft_plus_u%nelec))
THEN
3200 IF (any(qs_kind%dft_plus_u%nelec(:) >= 0.5_dp))
THEN
3201 IF (
SIZE(qs_kind%dft_plus_u%nelec) > 1)
THEN
3202 WRITE (unit=output_unit, fmt=
"(T9,A,T75,F6.2)") &
3203 "Number of alpha electrons:", &
3204 qs_kind%dft_plus_u%nelec(1), &
3205 "Number of beta electrons:", &
3206 qs_kind%dft_plus_u%nelec(2)
3208 WRITE (unit=output_unit, fmt=
"(T9,A,T75,F6.2)") &
3209 "Number of electrons:", &
3210 qs_kind%dft_plus_u%nelec(1)
3214 WRITE (unit=output_unit, fmt=
"(T9,A,(T78,I3))") &
3215 "Preferred (initial) orbital occupation order (orbital M values):", &
3216 qs_kind%dft_plus_u%orbitals(:)
3217 WRITE (unit=output_unit, fmt=
"(T9,A,T71,ES10.3,/,T9,A,T76,I5)") &
3218 "Threshold value for the SCF convergence criterion:", &
3219 qs_kind%dft_plus_u%eps_scf, &
3220 "Number of initial SCF iterations:", &
3221 qs_kind%dft_plus_u%max_scf
3222 IF (qs_kind%dft_plus_u%smear)
THEN
3223 WRITE (unit=output_unit, fmt=
"(T9,A)") &
3224 "A smearing of the orbital occupations will be performed"
3228 IF (
ASSOCIATED(qs_kind%cneo_potential))
THEN
3229 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
3230 "The nuclei of this atomic kind are quantum mechanical (CNEO)"
3238 basis_type=
"NUC_SOFT")
3247 END SUBROUTINE write_qs_kind
3257 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
3260 CHARACTER(len=*),
PARAMETER :: routinen =
'write_qs_kind_set'
3262 INTEGER :: handle, ikind, nkind, output_unit
3266 CALL timeset(routinen, handle)
3271 "PRINT%KINDS", extension=
".Log")
3272 IF (output_unit > 0)
THEN
3273 IF (
ASSOCIATED(qs_kind_set))
THEN
3274 WRITE (unit=output_unit, fmt=
"(/,/,T2,A)")
"ATOMIC KIND INFORMATION"
3275 nkind =
SIZE(qs_kind_set)
3277 qs_kind => qs_kind_set(ikind)
3278 CALL write_qs_kind(qs_kind, ikind, output_unit)
3288 CALL timestop(handle)
3303 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
3306 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_gto_basis_sets'
3308 CHARACTER(LEN=default_string_length) :: basis_type, bstring
3309 INTEGER :: handle, ibas, ikind, nkind, output_unit
3314 CALL timeset(routinen, handle)
3319 "PRINT%KINDS/BASIS_SET", &
3321 IF (output_unit > 0)
THEN
3322 IF (
ASSOCIATED(qs_kind_set))
THEN
3323 WRITE (unit=output_unit, fmt=
"(/,/,T2,A)") &
3324 "BASIS SET INFORMATION (Unnormalised Gaussian-type functions)"
3325 nkind =
SIZE(qs_kind_set)
3327 qs_kind => qs_kind_set(ikind)
3328 WRITE (unit=output_unit, fmt=
"(/,T2,I2,A)") &
3329 ikind,
". Atomic kind: "//trim(qs_kind%name)
3331 DO ibas = 1,
SIZE(qs_kind%basis_sets, 1)
3334 inumbas=ibas, basis_type=basis_type)
3335 IF (basis_type ==
"") cycle
3336 SELECT CASE (basis_type)
3338 bstring =
"Basis Set"
3340 bstring =
"Orbital Basis Set"
3342 bstring =
"GAPW Soft Basis Set"
3344 bstring =
"Auxiliary Basis Set"
3346 bstring =
"Minimal Basis Set"
3348 bstring =
"RI Auxiliary Basis Set"
3350 bstring =
"Auxiliary Fit Basis Set"
3352 bstring =
"LRI Basis Set"
3354 bstring =
"LRI Basis Set for TDDFPT"
3356 bstring =
"RI HFX Basis Set"
3358 bstring =
"Nuclear Basis Set"
3359 IF (.NOT.
ASSOCIATED(qs_kind%cneo_potential))
NULLIFY (tmp_basis)
3361 bstring =
"Nuclear Soft Basis Set"
3362 IF (.NOT.
ASSOCIATED(qs_kind%cneo_potential))
NULLIFY (tmp_basis)
3376 "PRINT%KINDS/BASIS_SET")
3378 CALL timestop(handle)
3395 INTEGER,
DIMENSION(0:lmat, 10),
INTENT(OUT) :: ncalc, ncore,
nelem
3396 REAL(kind=
dp),
DIMENSION(0:lmat, 10, 2), &
3397 INTENT(OUT) :: edelta
3399 INTEGER :: i, ii, is, l, ll, ne, nn, z
3400 INTEGER,
DIMENSION(:),
POINTER :: econf
3401 INTEGER,
DIMENSION(:, :),
POINTER :: addel, laddel, naddel
3402 LOGICAL :: bs_occupation
3403 REAL(kind=
dp) :: dmag, magnetization
3408 NULLIFY (gth_potential)
3410 gth_potential=gth_potential, &
3411 sgp_potential=sgp_potential, &
3412 magnetization=magnetization, &
3413 bs_occupation=bs_occupation, &
3414 addel=addel, laddel=laddel, naddel=naddel)
3421 IF (
ASSOCIATED(gth_potential))
THEN
3424 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
3428 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
3443 ncalc =
nelem - ncore
3449 IF (bs_occupation)
THEN
3451 DO i = 1,
SIZE(addel, 1)
3454 nn = naddel(i, is) - l
3457 DO ii =
SIZE(
nelem, 2), 1, -1
3458 IF (ncalc(l, ii) > 0)
THEN
3459 IF ((ncalc(l, ii) + ne) < 2*(2*l + 1) + 1)
THEN
3460 edelta(l, ii, is) = edelta(l, ii, is) + ne
3463 edelta(l, ii + 1, is) = edelta(l, ii + 1, is) + ne
3467 ELSE IF (ii == 1)
THEN
3468 edelta(l, ii, is) = edelta(l, ii, is) + ne
3473 edelta(l, nn, is) = edelta(l, nn, is) + ne
3475 IF (ncalc(l, nn) + edelta(l, nn, is) < 0)
THEN
3476 edelta(l, nn, is) = -ncalc(l, nn)
3481 edelta = 0.5_dp*edelta
3482 ELSE IF (magnetization /= 0.0_dp)
THEN
3483 dmag = 0.5_dp*abs(magnetization)
3484 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
3487 DO i = 1,
SIZE(ncalc, 2)
3488 IF (ncalc(l, i) == 0) cycle
3489 IF (ncalc(l, i) == ll) cycle
3490 IF (ncalc(l, i) > dmag .AND. (ll - ncalc(l, i)) > dmag)
THEN
3496 edelta(l, ii, 1) = magnetization*0.5_dp
3497 edelta(l, ii, 2) = -magnetization*0.5_dp
3502 CALL cp_abort(__location__, &
3503 "Magnetization value cannot be imposed for this atom type")
3507 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
3525 INTEGER,
DIMENSION(:),
POINTER :: econf
3526 INTEGER,
INTENT(IN) :: z
3527 INTEGER,
DIMENSION(0:lmat, 10),
INTENT(OUT) :: ncalc, ncore,
nelem
3529 CHARACTER(LEN=default_string_length) :: message
3530 INTEGER :: ii, iounit, l, ll, lmin, nc, nn
3531 INTEGER,
DIMENSION(0:lmat) :: econfx
3539 econfx(0:
SIZE(econf) - 1) = econf
3540 IF (sum(econf) >= 0)
THEN
3541 lmin = min(
lmat, ubound(
ptable(z)%e_conv, 1))
3852 IF (z == 65 .AND. econfx(3) == 0)
THEN
3858 IF (ncore(0, 1) <= 0)
THEN
3859 IF (z >= 58 .AND. z <= 71)
THEN
3872 ncore(3, 1) = nc - 28
3873 message =
"A small-core pseudopotential with 4f-in-core is used for the lanthanide "// &
3875 cphint(trim(message))
3886 ncore(3, 1) = nc - 46
3887 message =
"A medium-core pseudopotential with 4f-in-core is used for the lanthanide "// &
3889 cphint(trim(message))
3896 IF (ncore(0, 1) >= 0)
THEN
3899 nn = sum(ncore(l, :)) + econfx(l)
3912 ncalc =
nelem - ncore
3915 IF (iounit > 0)
THEN
3916 WRITE (iounit,
"(/,A,A2)")
"WARNING: Core states irregular for atom type ",
ptable(z)%symbol
3917 WRITE (iounit,
"(A,10I3)")
"WARNING: Redefine ELEC_CONF in the KIND section"
3918 cpabort(
"Incompatible Atomic Occupations Detected")
3922 lmin = min(
lmat, ubound(
ptable(z)%e_conv, 1))
3956 LOGICAL :: nlcc_present
3962 DO ikind = 1,
SIZE(qs_kind_set)
3963 CALL get_qs_kind(qs_kind_set(ikind), gth_potential=gth_potential, sgp_potential=sgp_potential)
3964 IF (
ASSOCIATED(gth_potential))
THEN
3965 CALL get_potential(potential=gth_potential, nlcc_present=nlcc_present)
3966 nlcc = nlcc .OR. nlcc_present
3967 ELSEIF (
ASSOCIATED(sgp_potential))
THEN
3969 nlcc = nlcc .OR. nlcc_present
static int imax(int x, int y)
Returns the larger of two given integers (missing from the C standard)
subroutine, public atom_sgp_release(sgp_pot)
...
subroutine, public sgp_construction(sgp_pot, ecp_pot, upf_pot, orb_basis, error)
...
Define the atom type and its sub types.
integer, parameter, public lmat
subroutine, public read_ecp_potential(element_symbol, potential, pseudo_name, pseudo_file, potential_section)
...
Routines that process Quantum Espresso UPF files.
subroutine, public atom_read_upf(pot, upf_filename, read_header)
...
pure subroutine, public atom_release_upf(upfpot)
...
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public remove_basis_set_container(basis)
...
subroutine, public remove_basis_from_container(container, inum, basis_type)
...
subroutine, public get_basis_from_container(container, basis_set, inumbas, basis_type)
Retrieve a basis set from the container.
subroutine, public add_basis_set_to_container(container, basis_set, basis_set_type)
...
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum)
...
subroutine, public write_orb_basis_set(orb_basis_set, output_unit, header)
Write a Gaussian-type orbital (GTO) basis set data set to the output unit.
subroutine, public deallocate_sto_basis_set(sto_basis_set)
...
subroutine, public init_aux_basis_set(gto_basis_set)
...
subroutine, public allocate_gto_basis_set(gto_basis_set)
...
subroutine, public combine_basis_sets(basis_set, basis_set_add)
...
subroutine, public write_gto_basis_set(gto_basis_set, output_unit, header)
Write a Gaussian-type orbital (GTO) basis set data set to the output unit.
subroutine, public allocate_sto_basis_set(sto_basis_set)
...
subroutine, public create_gto_from_sto_basis(sto_basis_set, gto_basis_set, ngauss, ortho)
...
subroutine, public read_sto_basis_set(element_symbol, basis_set_name, sto_basis_set, para_env, dft_section)
...
subroutine, public init_orb_basis_set(gto_basis_set)
Initialise a Gaussian-type orbital (GTO) basis set data set.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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...
Add the DFT+U contribution to the Hamiltonian matrix.
Definition of the atomic potential types.
subroutine, public set_default_all_potential(potential, z, zeff_correction)
...
subroutine, public create_1c_basis(orb_basis, soft_basis, gapw_1c_basis, basis_1c_level)
create the one center basis from the orbital basis
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public ncoset
Factory routines for potentials used e.g. by pao_param_exp and pao_ml.
subroutine, public get_paw_proj_set(paw_proj_set, csprj, chprj, first_prj, first_prjs, last_prj, local_oce_sphi_h, local_oce_sphi_s, maxl, ncgauprj, nsgauprj, nsatbas, nsotot, nprj, o2nindex, n2oindex, rcprj, rzetprj, zisomin, zetprj)
Get informations about a paw projectors set.
subroutine, public allocate_paw_proj_set(paw_proj_set)
Allocate projector type for GAPW.
subroutine, public projectors(paw_proj, basis_1c, orb_basis, rc, qs_control, max_rad_local_type, force_env_section)
Initialize the projector-type set data set.
subroutine, public deallocate_paw_proj_set(paw_proj_set)
Deallocate a projector-type set data set.
Periodic Table related data definitions.
type(atom), dimension(0:nelem), public ptable
integer, parameter, public nelem
subroutine, public get_ptable_info(symbol, number, amass, ielement, covalent_radius, metallic_radius, vdw_radius, found)
Pass information about the kind given the element symbol.
Definition of physical constants:
real(kind=dp), parameter, public evolt
real(kind=dp), parameter, public angstrom
real(kind=dp), parameter, public bohr
Types used by CNEO-DFT (see J. Chem. Theory Comput. 2025, 21, 16, 7865–7877)
subroutine, public allocate_cneo_potential(potential)
...
subroutine, public write_cneo_potential(potential, output_unit)
...
subroutine, public deallocate_cneo_potential(potential)
...
subroutine, public set_cneo_potential(potential, z, mass, elec_conf, nsgf, nne, npsgf, nsotot, my_gcc_h, my_gcc_s, ovlp, kin, utrans, distance, harmonics, qlm_gg, gg, vgg, n2oindex, o2nindex, rad2l, oorad2l)
...
subroutine, public get_cneo_potential(potential, z, zeff, mass, elec_conf, nsgf, nne, npsgf, nsotot, my_gcc_h, my_gcc_s, ovlp, kin, utrans, distance, harmonics, qlm_gg, gg, vgg, n2oindex, o2nindex, rad2l, oorad2l)
...
Definition of the DFTB parameter types.
Working with the DFTB parameter types.
subroutine, public deallocate_dftb_atom_param(dftb_parameter)
...
subroutine, public write_dftb_atom_param(dftb_parameter, subsys_section)
...
subroutine, public get_dftb_atom_param(dftb_parameter, name, typ, defined, z, zeff, natorb, lmax, skself, occupation, eta, energy, cutoff, xi, di, rcdisp, dudq)
...
Definition of disperson types for DFT calculations.
subroutine, public deallocate_grid_atom(grid_atom)
Deallocate a Gaussian-type orbital (GTO) basis set data set.
subroutine, public allocate_grid_atom(grid_atom)
Initialize components of the grid_atom_type structure.
subroutine, public allocate_harmonics_atom(harmonics)
Allocate a spherical harmonics set for the atom grid.
subroutine, public deallocate_harmonics_atom(harmonics)
Deallocate the spherical harmonics set for the atom grid.
Define the quickstep kind type and their sub types.
subroutine, public set_pseudo_state(econf, z, ncalc, ncore, nelem)
...
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_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.
logical function, public has_nlcc(qs_kind_set)
finds if a given qs run needs to use nlcc
subroutine, public deallocate_qs_kind_set(qs_kind_set)
Destructor routine for a set of qs kinds.
subroutine, public init_atom_electronic_state(atomic_kind, qs_kind, ncalc, ncore, nelem, edelta)
...
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, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
subroutine, public init_gapw_nlcc(qs_kind_set)
...
subroutine, public init_cneo_basis_set(qs_kind_set, qs_control)
...
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 create_qs_kind_set(qs_kind_set, atomic_kind_set, kind_section, para_env, force_env_section, silent)
Read an atomic kind set data set from the input file.
Definition of the semi empirical parameter types.
subroutine, public write_se_param(sep, subsys_section)
Writes the semi-empirical type.
subroutine, public semi_empirical_create(sep)
Allocate semi-empirical type.
subroutine, public get_se_param(sep, name, typ, defined, z, zeff, natorb, eheat, beta, sto_exponents, uss, upp, udd, uff, alp, eisol, gss, gsp, gpp, gp2, acoul, nr, de, ass, asp, app, hsp, gsd, gpd, gdd, ppddg, dpddg, ngauss)
Get info from the semi-empirical type.
subroutine, public semi_empirical_release(sep)
Deallocate the semi-empirical type.
Working with the semi empirical parameter types.
subroutine, public se_param_set_default(sep, z, method)
Initialize parameter for a semi_empirival type.
subroutine, public init_se_param(sep, orb_basis_set, ngauss)
Initialize semi_empirical type.
subroutine, public create_soft_basis(orb_basis, soft_basis, eps_fit, rc, paw_atom, paw_type_forced, gpw_r3d_rs_type_forced)
create the soft basis from a GTO basis
Utilities for string manipulations.
elemental subroutine, public uppercase(string)
Convert all lower case characters in a string to upper case.
real(kind=dp) function, public xtb_set_kab(za, zb, xtb_control)
...
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
subroutine, public deallocate_xtb_atom_param(xtb_parameter)
...
subroutine, public write_xtb_atom_param(xtb_parameter, gfn_type, subsys_section)
...
Provides all information about an atomic kind.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Holds information about a PAO descriptor.
Holds information about a PAO potential.
Provides all information about a quickstep kind.