112#include "./base/base_uses.f90"
120 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_kind_types'
128 INTEGER :: max_scf = -1
129 REAL(KIND=
dp) :: eps_u_ramping = 0.0_dp
130 REAL(KIND=
dp) :: eps_scf = huge(0.0_dp)
131 REAL(KIND=
dp) :: u_minus_j_target = 0.0_dp
132 REAL(KIND=
dp) :: u_minus_j = 0.0_dp
133 REAL(KIND=
dp) :: u_ramping = 0.0_dp
134 REAL(KIND=
dp) :: u = 0.0_dp
135 REAL(KIND=
dp) :: j = 0.0_dp
136 REAL(KIND=
dp) :: alpha = 0.0_dp
137 REAL(KIND=
dp) :: beta = 0.0_dp
138 REAL(KIND=
dp) :: j0 = 0.0_dp
139 REAL(KIND=
dp) :: occupation = -1.0_dp
140 INTEGER,
DIMENSION(:),
POINTER :: orbitals => null()
141 LOGICAL :: init_u_ramping_each_scf = .false.
142 LOGICAL :: smear = .false.
143 REAL(KIND=
dp),
DIMENSION(:),
POINTER :: nelec => null()
144 END TYPE dft_plus_u_type
151 REAL(kind=
dp) :: beta = 0.0_dp
152 REAL(kind=
dp) :: weight = 0.0_dp
153 INTEGER :: max_projector = -1
154 REAL(kind=
dp) :: beta_radius = huge(
dp)
161 REAL(kind=
dp) :: beta = 0.0_dp
162 REAL(kind=
dp) :: beta_radius = huge(
dp)
163 REAL(kind=
dp) :: weight = 0.0_dp
164 REAL(kind=
dp) :: screening = 0.0_dp
165 REAL(kind=
dp) :: screening_radius = huge(
dp)
172 CHARACTER(LEN=default_string_length) :: name =
""
173 CHARACTER(LEN=2) :: element_symbol =
""
174 INTEGER :: natom = -1
188 REAL(kind=
dp) :: covalent_radius = 0.0_dp
189 REAL(kind=
dp) :: vdw_radius = 0.0_dp
192 REAL(kind=
dp) :: hard_radius = 0.8_dp*
bohr
193 REAL(kind=
dp) :: hard0_radius = 0.8_dp*
bohr
194 REAL(kind=
dp) :: max_rad_local = 13.2_dp*
bohr
195 LOGICAL :: paw_atom = .false.
196 LOGICAL :: gpw_type_forced = .false.
198 LOGICAL :: ghost = .false.
199 LOGICAL :: floating = .false.
200 INTEGER :: lmax_dftb = -1
201 REAL(kind=
dp) :: dudq_dftb3 = 0.0_dp
202 REAL(kind=
dp) :: magnetization = 0.0_dp
203 INTEGER,
DIMENSION(:, :),
POINTER :: addel => null()
204 INTEGER,
DIMENSION(:, :),
POINTER :: laddel => null()
205 INTEGER,
DIMENSION(:, :),
POINTER :: naddel => null()
208 INTEGER :: ngrid_rad = 50
209 INTEGER :: ngrid_ang = 50
210 INTEGER :: lmax_rho0 = 0
212 INTEGER,
DIMENSION(:),
POINTER :: elec_conf => null()
213 LOGICAL :: bs_occupation = .false.
215 LOGICAL :: no_optimize = .true.
217 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: nlcc_pot => null()
220 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: reltmat => null()
221 INTEGER :: pao_basis_size = -1
222 CHARACTER(LEN=default_path_length) :: pao_model_file =
""
232 POINTER :: qs_kind_set => null()
233 END TYPE qs_kind_p_type
265 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
267 INTEGER :: ikind, nkind
269 IF (
ASSOCIATED(qs_kind_set))
THEN
271 nkind =
SIZE(qs_kind_set)
274 IF (
ASSOCIATED(qs_kind_set(ikind)%all_potential))
THEN
277 IF (
ASSOCIATED(qs_kind_set(ikind)%tnadd_potential))
THEN
280 IF (
ASSOCIATED(qs_kind_set(ikind)%gth_potential))
THEN
283 IF (
ASSOCIATED(qs_kind_set(ikind)%sgp_potential))
THEN
286 IF (
ASSOCIATED(qs_kind_set(ikind)%upf_potential))
THEN
288 DEALLOCATE (qs_kind_set(ikind)%upf_potential)
290 IF (
ASSOCIATED(qs_kind_set(ikind)%se_parameter))
THEN
293 IF (
ASSOCIATED(qs_kind_set(ikind)%dftb_parameter))
THEN
296 IF (
ASSOCIATED(qs_kind_set(ikind)%xtb_parameter))
THEN
299 IF (
ASSOCIATED(qs_kind_set(ikind)%paw_proj_set))
THEN
302 IF (
ASSOCIATED(qs_kind_set(ikind)%harmonics))
THEN
305 IF (
ASSOCIATED(qs_kind_set(ikind)%grid_atom))
THEN
308 IF (
ASSOCIATED(qs_kind_set(ikind)%elec_conf))
THEN
309 DEALLOCATE (qs_kind_set(ikind)%elec_conf)
312 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u))
THEN
313 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%orbitals))
THEN
314 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%orbitals)
316 IF (
ASSOCIATED(qs_kind_set(ikind)%dft_plus_u%nelec))
THEN
317 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u%nelec)
319 DEALLOCATE (qs_kind_set(ikind)%dft_plus_u)
322 IF (
ASSOCIATED(qs_kind_set(ikind)%nlcc_pot))
THEN
323 DEALLOCATE (qs_kind_set(ikind)%nlcc_pot)
326 IF (
ASSOCIATED(qs_kind_set(ikind)%dispersion))
THEN
327 DEALLOCATE (qs_kind_set(ikind)%dispersion)
329 IF (
ASSOCIATED(qs_kind_set(ikind)%addel))
THEN
330 DEALLOCATE (qs_kind_set(ikind)%addel)
332 IF (
ASSOCIATED(qs_kind_set(ikind)%naddel))
THEN
333 DEALLOCATE (qs_kind_set(ikind)%naddel)
335 IF (
ASSOCIATED(qs_kind_set(ikind)%laddel))
THEN
336 DEALLOCATE (qs_kind_set(ikind)%laddel)
338 IF (
ASSOCIATED(qs_kind_set(ikind)%reltmat))
THEN
339 DEALLOCATE (qs_kind_set(ikind)%reltmat)
342 IF (
ASSOCIATED(qs_kind_set(ikind)%pao_potentials))
THEN
343 DEALLOCATE (qs_kind_set(ikind)%pao_potentials)
345 IF (
ASSOCIATED(qs_kind_set(ikind)%pao_descriptors))
THEN
346 DEALLOCATE (qs_kind_set(ikind)%pao_descriptors)
352 DEALLOCATE (qs_kind_set)
354 CALL cp_abort(__location__, &
355 "The pointer qs_kind_set is not associated and "// &
356 "cannot be deallocated")
438 basis_set, basis_type, ncgf, nsgf, &
439 all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, &
440 se_parameter, dftb_parameter, xtb_parameter, &
441 dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, &
442 alpha_core_charge, ccore_charge, core_charge, core_charge_radius, &
443 paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, &
444 covalent_radius, vdw_radius, &
445 gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, &
446 ngrid_ang, ngrid_rad, lmax_rho0, &
447 dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, &
448 u_minus_j, U_of_dft_plus_u, J_of_dft_plus_u, &
449 alpha_of_dft_plus_u, beta_of_dft_plus_u, J0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, &
450 bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, &
451 max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, &
452 init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, &
453 pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
457 CHARACTER(len=*),
OPTIONAL :: basis_type
458 INTEGER,
INTENT(OUT),
OPTIONAL :: ncgf, nsgf
467 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: dftb3_param
468 INTEGER,
INTENT(OUT),
OPTIONAL :: zatom
469 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: zeff
470 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: elec_conf
471 INTEGER,
INTENT(OUT),
OPTIONAL :: mao, lmax_dftb
472 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: alpha_core_charge, ccore_charge, &
473 core_charge, core_charge_radius
475 LOGICAL,
INTENT(OUT),
OPTIONAL :: paw_atom
476 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: hard_radius, hard0_radius, &
477 max_rad_local, covalent_radius, &
479 LOGICAL,
INTENT(OUT),
OPTIONAL :: gpw_type_forced
481 INTEGER,
INTENT(OUT),
OPTIONAL :: max_iso_not0, max_s_harm
483 INTEGER,
INTENT(OUT),
OPTIONAL :: ngrid_ang, ngrid_rad, lmax_rho0
484 LOGICAL,
INTENT(OUT),
OPTIONAL :: dft_plus_u_atom
485 INTEGER,
INTENT(OUT),
OPTIONAL :: l_of_dft_plus_u, n_of_dft_plus_u
486 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, &
487 alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u
489 LOGICAL,
INTENT(OUT),
OPTIONAL :: bs_occupation
490 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: magnetization
491 LOGICAL,
INTENT(OUT),
OPTIONAL :: no_optimize
492 INTEGER,
DIMENSION(:, :),
OPTIONAL,
POINTER :: addel, laddel, naddel
493 INTEGER,
DIMENSION(:),
OPTIONAL,
POINTER :: orbitals
494 INTEGER,
OPTIONAL :: max_scf
495 REAL(kind=
dp),
OPTIONAL :: eps_scf
496 LOGICAL,
OPTIONAL :: smear
497 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: u_ramping, u_minus_j_target, &
499 LOGICAL,
OPTIONAL :: init_u_ramping_each_scf
500 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: reltmat
501 LOGICAL,
OPTIONAL :: ghost, floating
502 CHARACTER(LEN=default_string_length), &
503 INTENT(OUT),
OPTIONAL :: name
504 CHARACTER(LEN=2),
INTENT(OUT),
OPTIONAL :: element_symbol
505 INTEGER,
INTENT(OUT),
OPTIONAL :: pao_basis_size
506 CHARACTER(LEN=default_path_length),
INTENT(OUT), &
507 OPTIONAL :: pao_model_file
511 OPTIONAL,
POINTER :: pao_descriptors
512 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: nelec
514 CHARACTER(LEN=default_string_length) :: my_basis_type
520 IF (
PRESENT(basis_type))
THEN
521 my_basis_type = basis_type
523 my_basis_type =
"ORB"
526 IF (
PRESENT(basis_set))
THEN
528 basis_type=my_basis_type)
531 IF (
PRESENT(ncgf))
THEN
533 basis_type=my_basis_type)
534 IF (
ASSOCIATED(tmp_basis_set))
THEN
536 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
537 l = qs_kind%dftb_parameter%lmax
538 ncgf = ((l + 1)*(l + 2)*(l + 3))/6
544 IF (
PRESENT(nsgf))
THEN
546 basis_type=my_basis_type)
547 IF (
ASSOCIATED(tmp_basis_set))
THEN
549 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
550 nsgf = qs_kind%dftb_parameter%natorb
556 IF (
PRESENT(all_potential)) all_potential => qs_kind%all_potential
557 IF (
PRESENT(tnadd_potential)) tnadd_potential => qs_kind%tnadd_potential
558 IF (
PRESENT(gth_potential)) gth_potential => qs_kind%gth_potential
559 IF (
PRESENT(sgp_potential)) sgp_potential => qs_kind%sgp_potential
560 IF (
PRESENT(upf_potential)) upf_potential => qs_kind%upf_potential
561 IF (
PRESENT(se_parameter)) se_parameter => qs_kind%se_parameter
562 IF (
PRESENT(dftb_parameter)) dftb_parameter => qs_kind%dftb_parameter
563 IF (
PRESENT(xtb_parameter)) xtb_parameter => qs_kind%xtb_parameter
564 IF (
PRESENT(element_symbol)) element_symbol = qs_kind%element_symbol
565 IF (
PRESENT(name)) name = qs_kind%name
566 IF (
PRESENT(dftb3_param)) dftb3_param = qs_kind%dudq_dftb3
567 IF (
PRESENT(elec_conf)) elec_conf => qs_kind%elec_conf
568 IF (
PRESENT(alpha_core_charge))
THEN
569 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
571 alpha_core_charge=alpha_core_charge)
572 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
574 alpha_core_charge=alpha_core_charge)
575 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
577 alpha_core_charge=alpha_core_charge)
579 alpha_core_charge = 1.0_dp
582 IF (
PRESENT(ccore_charge))
THEN
583 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
585 ccore_charge=ccore_charge)
586 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
588 ccore_charge=ccore_charge)
589 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
591 ccore_charge=ccore_charge)
592 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
593 cpabort(
"UPF CCORE CHARGE RADIUS NOT AVAILABLE")
595 ccore_charge = 0.0_dp
598 IF (
PRESENT(core_charge_radius))
THEN
599 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
601 core_charge_radius=core_charge_radius)
602 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
604 core_charge_radius=core_charge_radius)
605 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
607 core_charge_radius=core_charge_radius)
608 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
609 cpabort(
"UPF CORE CHARGE RADIUS NOT AVAILABLE")
611 core_charge_radius = 0.0_dp
614 IF (
PRESENT(core_charge))
THEN
615 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
618 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
621 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
624 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
625 cpabort(
"UPF CORE CHARGE NOT AVAILABLE")
631 IF (
PRESENT(zatom))
THEN
633 CALL get_ptable_info(qs_kind%element_symbol, ielement=zatom, found=found)
637 IF (
PRESENT(zeff))
THEN
638 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
639 CALL get_potential(potential=qs_kind%all_potential, zeff=zeff)
640 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
641 CALL get_potential(potential=qs_kind%gth_potential, zeff=zeff)
642 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
643 CALL get_potential(potential=qs_kind%sgp_potential, zeff=zeff)
644 ELSE IF (
ASSOCIATED(qs_kind%upf_potential))
THEN
645 zeff = qs_kind%upf_potential%zion
651 IF (
PRESENT(covalent_radius)) covalent_radius = qs_kind%covalent_radius
652 IF (
PRESENT(vdw_radius)) vdw_radius = qs_kind%vdw_radius
654 IF (
PRESENT(paw_proj_set)) paw_proj_set => qs_kind%paw_proj_set
655 IF (
PRESENT(paw_atom)) paw_atom = qs_kind%paw_atom
656 IF (
PRESENT(gpw_type_forced)) gpw_type_forced = qs_kind%gpw_type_forced
657 IF (
PRESENT(hard_radius)) hard_radius = qs_kind%hard_radius
658 IF (
PRESENT(hard0_radius)) hard0_radius = qs_kind%hard0_radius
659 IF (
PRESENT(max_rad_local)) max_rad_local = qs_kind%max_rad_local
660 IF (
PRESENT(harmonics)) harmonics => qs_kind%harmonics
661 IF (
PRESENT(max_s_harm))
THEN
662 IF (
ASSOCIATED(qs_kind%harmonics))
THEN
663 max_s_harm = qs_kind%harmonics%max_s_harm
668 IF (
PRESENT(max_iso_not0))
THEN
669 IF (
ASSOCIATED(qs_kind%harmonics))
THEN
670 max_iso_not0 = qs_kind%harmonics%max_iso_not0
675 IF (
PRESENT(grid_atom)) grid_atom => qs_kind%grid_atom
676 IF (
PRESENT(ngrid_ang)) ngrid_ang = qs_kind%ngrid_ang
677 IF (
PRESENT(ngrid_rad)) ngrid_rad = qs_kind%ngrid_rad
678 IF (
PRESENT(lmax_rho0)) lmax_rho0 = qs_kind%lmax_rho0
679 IF (
PRESENT(ghost)) ghost = qs_kind%ghost
680 IF (
PRESENT(floating)) floating = qs_kind%floating
681 IF (
PRESENT(dft_plus_u_atom)) dft_plus_u_atom =
ASSOCIATED(qs_kind%dft_plus_u)
682 IF (
PRESENT(l_of_dft_plus_u))
THEN
683 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
684 l_of_dft_plus_u = qs_kind%dft_plus_u%l
689 IF (
PRESENT(n_of_dft_plus_u))
THEN
690 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
691 n_of_dft_plus_u = qs_kind%dft_plus_u%n
696 IF (
PRESENT(u_minus_j))
THEN
697 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
698 u_minus_j = qs_kind%dft_plus_u%u_minus_j
703 IF (
PRESENT(u_minus_j_target))
THEN
704 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
705 u_minus_j_target = qs_kind%dft_plus_u%u_minus_j_target
707 u_minus_j_target = 0.0_dp
710 IF (
PRESENT(u_of_dft_plus_u))
THEN
711 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
712 u_of_dft_plus_u = qs_kind%dft_plus_u%U
714 u_of_dft_plus_u = 0.0_dp
717 IF (
PRESENT(j_of_dft_plus_u))
THEN
718 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
719 j_of_dft_plus_u = qs_kind%dft_plus_u%J
721 j_of_dft_plus_u = 0.0_dp
724 IF (
PRESENT(alpha_of_dft_plus_u))
THEN
725 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
726 alpha_of_dft_plus_u = qs_kind%dft_plus_u%alpha
728 alpha_of_dft_plus_u = 0.0_dp
731 IF (
PRESENT(beta_of_dft_plus_u))
THEN
732 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
733 beta_of_dft_plus_u = qs_kind%dft_plus_u%beta
735 beta_of_dft_plus_u = 0.0_dp
738 IF (
PRESENT(j0_of_dft_plus_u))
THEN
739 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
740 j0_of_dft_plus_u = qs_kind%dft_plus_u%J0
742 j0_of_dft_plus_u = 0.0_dp
745 IF (
PRESENT(occupation_of_dft_plus_u))
THEN
746 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
747 occupation_of_dft_plus_u = qs_kind%dft_plus_u%occupation
749 occupation_of_dft_plus_u = -1.0_dp
753 IF (
PRESENT(init_u_ramping_each_scf))
THEN
754 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
755 init_u_ramping_each_scf = qs_kind%dft_plus_u%init_u_ramping_each_scf
757 init_u_ramping_each_scf = .false.
760 IF (
PRESENT(u_ramping))
THEN
761 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
762 u_ramping = qs_kind%dft_plus_u%u_ramping
767 IF (
PRESENT(eps_u_ramping))
THEN
768 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
769 eps_u_ramping = qs_kind%dft_plus_u%eps_u_ramping
771 eps_u_ramping = 1.0e-5_dp
774 IF (
PRESENT(nelec))
THEN
776 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
777 IF (
ASSOCIATED(qs_kind%dft_plus_u%nelec))
THEN
778 nelec => qs_kind%dft_plus_u%nelec
782 IF (
PRESENT(orbitals))
THEN
784 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
785 IF (
ASSOCIATED(qs_kind%dft_plus_u%orbitals))
THEN
786 orbitals => qs_kind%dft_plus_u%orbitals
790 IF (
PRESENT(eps_scf))
THEN
791 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
792 eps_scf = qs_kind%dft_plus_u%eps_scf
797 IF (
PRESENT(max_scf))
THEN
798 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
799 max_scf = qs_kind%dft_plus_u%max_scf
804 IF (
PRESENT(smear))
THEN
805 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
806 smear = qs_kind%dft_plus_u%smear
811 IF (
PRESENT(dispersion)) dispersion => qs_kind%dispersion
812 IF (
PRESENT(bs_occupation)) bs_occupation = qs_kind%bs_occupation
813 IF (
PRESENT(addel)) addel => qs_kind%addel
814 IF (
PRESENT(laddel)) laddel => qs_kind%laddel
815 IF (
PRESENT(naddel)) naddel => qs_kind%naddel
817 IF (
PRESENT(magnetization)) magnetization = qs_kind%magnetization
819 IF (
PRESENT(no_optimize)) no_optimize = qs_kind%no_optimize
821 IF (
PRESENT(reltmat)) reltmat => qs_kind%reltmat
823 IF (
PRESENT(mao)) mao = qs_kind%mao
825 IF (
PRESENT(lmax_dftb)) lmax_dftb = qs_kind%lmax_dftb
827 IF (
PRESENT(pao_basis_size)) pao_basis_size = qs_kind%pao_basis_size
828 IF (
PRESENT(pao_model_file)) pao_model_file = qs_kind%pao_model_file
830 IF (
PRESENT(pao_descriptors)) pao_descriptors => qs_kind%pao_descriptors
872 all_potential_present, tnadd_potential_present, gth_potential_present, &
873 sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, &
874 maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, &
875 ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, &
876 nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, &
878 basis_type, total_zeff_corr, npgf_seg)
880 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
881 LOGICAL,
INTENT(OUT),
OPTIONAL :: all_potential_present, tnadd_potential_present, &
882 gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present
883 INTEGER,
INTENT(OUT),
OPTIONAL :: maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, &
884 maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, &
886 INTEGER,
INTENT(IN),
OPTIONAL :: maxder
887 INTEGER,
INTENT(OUT),
OPTIONAL :: max_ngrid_rad, max_sph_harm, &
888 maxg_iso_not0, lmax_rho0
889 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: basis_rcut
890 CHARACTER(len=*),
OPTIONAL :: basis_type
891 REAL(kind=
dp),
INTENT(OUT),
OPTIONAL :: total_zeff_corr
892 INTEGER,
INTENT(OUT),
OPTIONAL :: npgf_seg
894 CHARACTER(len=default_string_length) :: my_basis_type
895 INTEGER :: ikind,
imax, lmax_rho0_kind, &
896 max_iso_not0, max_s_harm, n, &
897 ngrid_rad, nkind, nrloc(10), &
899 LOGICAL :: dft_plus_u_atom, ecp_semi_local, paw_atom
900 REAL(kind=
dp) :: brcut, zeff, zeff_correction
910 IF (
PRESENT(basis_type))
THEN
911 my_basis_type = basis_type
913 my_basis_type =
"ORB"
916 IF (
ASSOCIATED(qs_kind_set))
THEN
918 IF (
PRESENT(maxcgf)) maxcgf = 0
919 IF (
PRESENT(maxco)) maxco = 0
920 IF (
PRESENT(maxco_proj)) maxco_proj = 0
921 IF (
PRESENT(maxg_iso_not0)) maxg_iso_not0 = 0
922 IF (
PRESENT(maxgtops)) maxgtops = 0
923 IF (
PRESENT(maxlgto)) maxlgto = -1
924 IF (
PRESENT(maxlppl)) maxlppl = -1
925 IF (
PRESENT(maxlppnl)) maxlppnl = -1
926 IF (
PRESENT(maxpol)) maxpol = -1
927 IF (
PRESENT(maxlprj)) maxlprj = -1
928 IF (
PRESENT(maxnset)) maxnset = 0
929 IF (
PRESENT(maxppnl)) maxppnl = 0
930 IF (
PRESENT(maxsgf)) maxsgf = 0
931 IF (
PRESENT(maxsgf_set)) maxsgf_set = 0
932 IF (
PRESENT(ncgf)) ncgf = 0
933 IF (
PRESENT(nelectron)) nelectron = 0
934 IF (
PRESENT(npgf)) npgf = 0
935 IF (
PRESENT(nset)) nset = 0
936 IF (
PRESENT(nsgf)) nsgf = 0
937 IF (
PRESENT(nshell)) nshell = 0
938 IF (
PRESENT(all_potential_present)) all_potential_present = .false.
939 IF (
PRESENT(tnadd_potential_present)) tnadd_potential_present = .false.
940 IF (
PRESENT(gth_potential_present)) gth_potential_present = .false.
941 IF (
PRESENT(sgp_potential_present)) sgp_potential_present = .false.
942 IF (
PRESENT(paw_atom_present)) paw_atom_present = .false.
943 IF (
PRESENT(max_ngrid_rad)) max_ngrid_rad = 0
944 IF (
PRESENT(max_sph_harm)) max_sph_harm = 0
945 IF (
PRESENT(lmax_rho0)) lmax_rho0 = 0
946 IF (
PRESENT(basis_rcut)) basis_rcut = 0.0_dp
947 IF (
PRESENT(total_zeff_corr)) total_zeff_corr = 0.0_dp
948 IF (
PRESENT(npgf_seg)) npgf_seg = 0
950 nkind =
SIZE(qs_kind_set)
952 qs_kind => qs_kind_set(ikind)
954 all_potential=all_potential, &
955 tnadd_potential=tnadd_potential, &
956 gth_potential=gth_potential, &
957 sgp_potential=sgp_potential, &
958 paw_proj_set=paw_proj_set, &
959 dftb_parameter=dftb_parameter, &
960 ngrid_rad=ngrid_rad, &
961 max_s_harm=max_s_harm, &
962 max_iso_not0=max_iso_not0, &
964 dft_plus_u_atom=dft_plus_u_atom, &
965 lmax_rho0=lmax_rho0_kind)
967 IF (
PRESENT(maxlppl) .AND.
ASSOCIATED(gth_potential))
THEN
969 maxlppl = max(maxlppl, 2*(n - 1))
970 ELSEIF (
PRESENT(maxlppl) .AND.
ASSOCIATED(sgp_potential))
THEN
971 CALL get_potential(potential=sgp_potential, nrloc=nrloc, ecp_semi_local=ecp_semi_local)
972 n = maxval(nrloc) - 2
973 maxlppl = max(maxlppl, 2*(n - 1))
974 IF (ecp_semi_local)
THEN
976 n = maxval(nrpot) - 2
978 maxlppl = max(maxlppl, n)
982 IF (
PRESENT(maxlppnl) .AND.
ASSOCIATED(gth_potential))
THEN
984 maxlppnl = max(maxlppnl,
imax)
985 ELSEIF (
PRESENT(maxlppnl) .AND.
ASSOCIATED(sgp_potential))
THEN
987 maxlppnl = max(maxlppnl,
imax)
990 IF (
PRESENT(maxpol) .AND.
ASSOCIATED(tnadd_potential))
THEN
992 maxpol = max(maxpol, 2*(n - 1))
995 IF (
PRESENT(maxco_proj) .AND.
ASSOCIATED(paw_proj_set))
THEN
997 maxco_proj = max(maxco_proj,
imax)
1000 IF (
PRESENT(maxlprj) .AND.
ASSOCIATED(paw_proj_set))
THEN
1002 maxlprj = max(maxlprj,
imax)
1005 IF (
PRESENT(maxppnl) .AND.
ASSOCIATED(gth_potential))
THEN
1007 maxppnl = max(maxppnl,
imax)
1008 ELSEIF (
PRESENT(maxppnl) .AND.
ASSOCIATED(sgp_potential))
THEN
1010 maxppnl = max(maxppnl,
imax)
1014 basis_type=my_basis_type)
1016 IF (
PRESENT(maxcgf))
THEN
1017 IF (
ASSOCIATED(tmp_basis_set))
THEN
1019 maxcgf = max(maxcgf,
imax)
1020 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1023 maxcgf = max(maxcgf,
imax)
1027 IF (
PRESENT(maxco))
THEN
1028 IF (
ASSOCIATED(tmp_basis_set))
THEN
1029 IF (
PRESENT(maxder))
THEN
1031 maxco=
imax, maxder=maxder)
1035 maxco = max(maxco,
imax)
1037 IF (
ASSOCIATED(gth_potential))
THEN
1041 IF (
ASSOCIATED(sgp_potential))
THEN
1049 IF (
PRESENT(maxgtops))
THEN
1050 IF (
ASSOCIATED(tmp_basis_set))
THEN
1052 maxgtops = max(maxgtops, n*
imax)
1056 IF (
PRESENT(maxlgto))
THEN
1057 IF (
ASSOCIATED(tmp_basis_set))
THEN
1059 maxlgto = max(maxlgto,
imax)
1060 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1062 maxlgto = max(maxlgto,
imax)
1066 IF (
PRESENT(maxnset))
THEN
1067 IF (
ASSOCIATED(tmp_basis_set))
THEN
1069 maxnset = max(maxnset, n)
1073 IF (
PRESENT(maxsgf))
THEN
1074 IF (
ASSOCIATED(tmp_basis_set))
THEN
1076 maxsgf = max(maxsgf,
imax)
1080 IF (
PRESENT(maxsgf_set))
THEN
1081 IF (
ASSOCIATED(tmp_basis_set))
THEN
1083 maxsgf_set = max(maxsgf_set,
imax)
1087 IF (
PRESENT(ncgf))
THEN
1088 IF (
ASSOCIATED(tmp_basis_set))
THEN
1090 ncgf = ncgf + n*qs_kind_set(ikind)%natom
1091 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1094 ncgf = ncgf + n*qs_kind_set(ikind)%natom
1098 IF (
PRESENT(npgf))
THEN
1099 IF (
ASSOCIATED(tmp_basis_set))
THEN
1101 npgf = npgf + n*qs_kind_set(ikind)%natom
1105 IF (
PRESENT(nset))
THEN
1106 IF (
ASSOCIATED(tmp_basis_set))
THEN
1108 nset = nset + n*qs_kind_set(ikind)%natom
1112 IF (
PRESENT(nsgf))
THEN
1113 IF (
ASSOCIATED(tmp_basis_set))
THEN
1115 nsgf = nsgf + n*qs_kind_set(ikind)%natom
1116 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1118 nsgf = nsgf + n*qs_kind_set(ikind)%natom
1122 IF (
PRESENT(nshell))
THEN
1123 IF (
ASSOCIATED(tmp_basis_set))
THEN
1125 nshell = nshell + n*qs_kind_set(ikind)%natom
1126 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1128 nshell = nshell + (n + 1)*qs_kind_set(ikind)%natom
1132 IF (
PRESENT(nelectron))
THEN
1133 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
1135 zeff=zeff, zeff_correction=zeff_correction)
1136 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1138 zeff=zeff, zeff_correction=zeff_correction)
1139 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1141 zeff=zeff, zeff_correction=zeff_correction)
1144 zeff_correction = 0.0_dp
1146 nelectron = nelectron + qs_kind_set(ikind)%natom*nint(zeff - zeff_correction)
1149 IF (
PRESENT(basis_rcut))
THEN
1150 IF (
ASSOCIATED(tmp_basis_set))
THEN
1152 basis_rcut = max(basis_rcut, brcut)
1153 ELSE IF (
ASSOCIATED(qs_kind%dftb_parameter))
THEN
1155 basis_rcut = max(basis_rcut, brcut)
1159 IF (
PRESENT(total_zeff_corr))
THEN
1160 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
1162 zeff=zeff, zeff_correction=zeff_correction)
1163 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1165 zeff=zeff, zeff_correction=zeff_correction)
1166 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1168 zeff=zeff, zeff_correction=zeff_correction)
1171 zeff_correction = 0.0_dp
1173 total_zeff_corr = total_zeff_corr + qs_kind_set(ikind)%natom*zeff_correction
1176 IF (
PRESENT(all_potential_present))
THEN
1177 IF (
ASSOCIATED(all_potential))
THEN
1178 all_potential_present = .true.
1182 IF (
PRESENT(tnadd_potential_present))
THEN
1183 IF (
ASSOCIATED(tnadd_potential))
THEN
1184 tnadd_potential_present = .true.
1188 IF (
PRESENT(gth_potential_present))
THEN
1189 IF (
ASSOCIATED(gth_potential))
THEN
1190 gth_potential_present = .true.
1194 IF (
PRESENT(sgp_potential_present))
THEN
1195 IF (
ASSOCIATED(sgp_potential))
THEN
1196 sgp_potential_present = .true.
1200 IF (
PRESENT(paw_atom_present))
THEN
1202 paw_atom_present = .true.
1206 IF (
PRESENT(dft_plus_u_atom_present))
THEN
1207 IF (dft_plus_u_atom)
THEN
1208 dft_plus_u_atom_present = .true.
1212 IF (
PRESENT(max_ngrid_rad))
THEN
1213 max_ngrid_rad = max(max_ngrid_rad, ngrid_rad)
1216 IF (
PRESENT(max_sph_harm))
THEN
1217 max_sph_harm = max(max_sph_harm, max_s_harm)
1220 IF (
PRESENT(maxg_iso_not0))
THEN
1221 maxg_iso_not0 = max(maxg_iso_not0, max_iso_not0)
1224 IF (
PRESENT(lmax_rho0))
THEN
1225 lmax_rho0 = max(lmax_rho0, lmax_rho0_kind)
1228 IF (
PRESENT(npgf_seg))
THEN
1229 IF (
ASSOCIATED(tmp_basis_set))
THEN
1231 npgf_seg = npgf_seg + n*qs_kind_set(ikind)%natom
1237 cpabort(
"The pointer qs_kind_set is not associated")
1248 SUBROUTINE init_qs_kind(qs_kind)
1251 CHARACTER(len=*),
PARAMETER :: routinen =
'init_qs_kind'
1253 CHARACTER(LEN=default_string_length) :: basis_type
1254 INTEGER :: handle, i
1257 CALL timeset(routinen, handle)
1259 cpassert(
ASSOCIATED(qs_kind))
1261 IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
1263 ELSEIF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
1267 DO i = 1,
SIZE(qs_kind%basis_sets, 1)
1268 NULLIFY (tmp_basis_set)
1270 inumbas=i, basis_type=basis_type)
1271 IF (basis_type ==
"") cycle
1272 IF (basis_type ==
"AUX")
THEN
1273 IF (tmp_basis_set%norm_type < 0) tmp_basis_set%norm_type = 1
1276 IF (tmp_basis_set%norm_type < 0) tmp_basis_set%norm_type = 2
1281 CALL timestop(handle)
1283 END SUBROUTINE init_qs_kind
1293 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1295 CHARACTER(len=*),
PARAMETER :: routinen =
'init_qs_kind_set'
1297 INTEGER :: handle, ikind
1300 CALL timeset(routinen, handle)
1302 IF (.NOT.
ASSOCIATED(qs_kind_set))
THEN
1303 cpabort(
"init_qs_kind_set: The pointer qs_kind_set is not associated")
1306 DO ikind = 1,
SIZE(qs_kind_set)
1307 qs_kind => qs_kind_set(ikind)
1308 CALL init_qs_kind(qs_kind)
1311 CALL timestop(handle)
1324 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1327 LOGICAL,
OPTIONAL :: modify_qs_control
1329 CHARACTER(LEN=default_string_length) :: bsname
1330 INTEGER :: bas1c, ikind, ilevel, nkind
1331 LOGICAL :: gpw, my_mod_control, paw_atom
1332 REAL(
dp) :: max_rad_local_type, rc
1337 my_mod_control = .true.
1338 IF (
PRESENT(modify_qs_control))
THEN
1339 my_mod_control = modify_qs_control
1342 IF (
ASSOCIATED(qs_kind_set))
THEN
1344 IF (my_mod_control) qs_control%gapw_control%non_paw_atoms = .false.
1345 nkind =
SIZE(qs_kind_set)
1349 qs_kind => qs_kind_set(ikind)
1351 CALL get_qs_kind(qs_kind=qs_kind, basis_set=orb_basis)
1352 CALL get_qs_kind(qs_kind=qs_kind, hard_radius=rc, &
1353 max_rad_local=max_rad_local_type, gpw_type_forced=gpw)
1355 NULLIFY (soft_basis)
1358 qs_control%gapw_control%eps_fit, rc, paw_atom, &
1359 qs_control%gapw_control%force_paw, gpw)
1361 CALL set_qs_kind(qs_kind=qs_kind, paw_atom=paw_atom)
1363 bas1c = qs_control%gapw_control%basis_1c
1377 cpabort(
"basis_1c type")
1382 basis_1c%name = trim(bsname)//
"_1c"
1386 CALL get_qs_kind(qs_kind=qs_kind, paw_proj_set=paw_proj)
1387 CALL projectors(paw_proj, basis_1c, orb_basis, rc, qs_control, &
1388 max_rad_local_type, force_env_section)
1390 IF (my_mod_control) qs_control%gapw_control%non_paw_atoms = .true.
1394 NULLIFY (qs_kind%grid_atom, qs_kind%harmonics)
1400 IF (my_mod_control)
THEN
1401 IF (qs_control%gapw_control%non_paw_atoms)
THEN
1402 qs_control%gapw_control%nopaw_as_gpw = .true.
1404 qs_control%gapw_control%nopaw_as_gpw = .false.
1408 cpabort(
"The pointer qs_kind_set is not associated")
1418 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1420 INTEGER :: i, ic, ikind, n_nlcc, nc, nexp_nlcc, &
1422 INTEGER,
DIMENSION(:),
POINTER :: nct_nlcc
1423 LOGICAL :: nlcc, nlcc_type, paw_atom
1424 REAL(
dp) :: alpha, coa, cval
1425 REAL(kind=
dp),
DIMENSION(:),
POINTER :: a_nlcc, alpha_nlcc, c_nlcc, fe, rc, rr
1426 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: cval_nlcc, den
1431 IF (
ASSOCIATED(qs_kind_set))
THEN
1434 nkind =
SIZE(qs_kind_set)
1436 qs_kind => qs_kind_set(ikind)
1439 CALL get_qs_kind(qs_kind, gth_potential=gth_potential)
1440 CALL get_qs_kind(qs_kind, sgp_potential=sgp_potential)
1441 IF (
ASSOCIATED(gth_potential))
THEN
1442 CALL get_potential(potential=gth_potential, nlcc_present=nlcc_type, &
1443 nexp_nlcc=nexp_nlcc, alpha_nlcc=alpha_nlcc, nct_nlcc=nct_nlcc, cval_nlcc=cval_nlcc)
1445 nr = qs_kind%grid_atom%nr
1446 rr => qs_kind%grid_atom%rad
1447 ALLOCATE (qs_kind%nlcc_pot(nr, 2), rc(nr), fe(nr))
1448 den => qs_kind%nlcc_pot
1451 alpha = alpha_nlcc(i)
1453 fe(:) = exp(-0.5_dp*rc(:)*rc(:))
1456 cval = cval_nlcc(ic, i)
1458 den(:, 1) = den(:, 1) + fe(:)*rc**(2*ic - 2)*cval
1459 den(:, 2) = den(:, 2) - fe(:)*rc**(2*ic - 1)*coa
1461 den(:, 2) = den(:, 2) + real(2*ic - 2,
dp)*fe(:)*rc**(2*ic - 3)*coa
1467 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
1469 n_nlcc=n_nlcc, a_nlcc=a_nlcc, c_nlcc=c_nlcc)
1471 nr = qs_kind%grid_atom%nr
1472 rr => qs_kind%grid_atom%rad
1473 ALLOCATE (qs_kind%nlcc_pot(nr, 2), rc(nr), fe(nr))
1474 den => qs_kind%nlcc_pot
1478 fe(:) = exp(-alpha*rr(:)*rr(:))
1480 den(:, 1) = den(:, 1) + cval*fe(:)
1481 den(:, 2) = den(:, 2) - 2.0_dp*alpha*cval*rr(:)*fe(:)
1492 cpabort(
"The pointer qs_kind_set is not associated")
1511 SUBROUTINE read_qs_kind(qs_kind, kind_section, para_env, force_env_section, &
1512 no_fail, method_id, silent)
1518 LOGICAL,
INTENT(IN) :: no_fail
1519 INTEGER,
INTENT(IN) :: method_id
1520 LOGICAL,
INTENT(IN) :: silent
1522 CHARACTER(LEN=*),
PARAMETER :: routinen =
'read_qs_kind'
1523 INTEGER,
PARAMETER :: maxbas = 20
1525 CHARACTER(LEN=2) :: element_symbol
1526 CHARACTER(len=default_path_length) :: kg_potential_fn_kind, &
1527 potential_file_name, potential_fn_kind
1528 CHARACTER(LEN=default_string_length) :: akind_name, basis_type, keyword, &
1529 kgpot_name, kgpot_type, &
1530 potential_name, potential_type, tmp
1531 CHARACTER(LEN=default_string_length),
DIMENSION(4) :: description
1532 CHARACTER(LEN=default_string_length), &
1533 DIMENSION(:),
POINTER :: tmpstringlist
1534 CHARACTER(LEN=default_string_length), &
1535 DIMENSION(maxbas) :: basis_set_form, basis_set_name, &
1537 INTEGER :: handle, i, i_rep, iounit, ipaodesc, ipaopot, ipos, j, jj, k_rep, l, m, n_rep, &
1538 nb_rep, nexp, ngauss, nlcc, nloc, nnl, norbitals, npaodesc, npaopot, nppnl, nspin, nu, z
1539 INTEGER,
DIMENSION(:),
POINTER :: add_el, elec_conf, orbitals
1540 LOGICAL :: check, ecp_semi_local, explicit, explicit_basis, explicit_j, explicit_kgpot, &
1541 explicit_potential, explicit_u, explicit_u_m_j, nobasis, section_enabled, &
1542 subsection_enabled, update_input
1543 REAL(kind=
dp) :: alpha, ccore, r, rc, zeff_correction
1544 REAL(kind=
dp),
DIMENSION(6) :: error
1545 REAL(kind=
dp),
DIMENSION(:),
POINTER :: a_nl, aloc, anlcc, cloc, cnlcc, nelec
1546 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_nl
1547 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: c_nl
1554 TYPE(
section_vals_type),
POINTER :: basis_section, bs_section, dft_plus_u_section, &
1555 dft_section, enforce_occupation_section, kgpot_section, pao_desc_section, &
1556 pao_pot_section, potential_section, spin_section
1559 CALL timeset(routinen, handle)
1567 update_input = .true.
1568 basis_set_name(:) =
""
1569 basis_set_type(:) =
""
1570 basis_set_form(:) =
""
1576 zeff_correction = 0.0_dp
1578 explicit_basis = .false.
1579 explicit_j = .false.
1580 explicit_kgpot = .false.
1581 explicit_potential = .false.
1582 explicit_u = .false.
1583 explicit_u_m_j = .false.
1588 akind_name = qs_kind%name
1593 c_val=keyword, i_rep_section=i_rep)
1595 IF (keyword == akind_name)
THEN
1602 ipos = index(qs_kind%name,
"_")
1603 IF (((ipos == 2) .OR. (ipos == 3)) .AND. (index(qs_kind%name,
"_ghost") == 0))
THEN
1606 akind_name = qs_kind%name(1:ipos - 1)
1610 c_val=keyword, i_rep_section=i_rep)
1612 IF (keyword == akind_name)
THEN
1623 element_symbol = qs_kind%element_symbol(1:2)
1627 c_val=keyword, i_rep_section=i_rep)
1629 IF (keyword == element_symbol)
THEN
1640 c_val=keyword, i_rep_section=i_rep)
1642 IF (keyword ==
"DEFAULT")
THEN
1643 update_input = .false.
1649 IF (k_rep < 0 .AND. (.NOT. no_fail))
THEN
1650 CALL cp_abort(__location__, &
1651 "No &KIND section was possible to associate to the atomic kind <"// &
1652 trim(akind_name)//
">. The KIND section were also scanned for the"// &
1653 " corresponding element <"//trim(qs_kind%element_symbol)//
">"// &
1654 " and for the DEFAULT section but no match was found. Check your input file!")
1663 keyword_name=
"BASIS_SET", &
1664 explicit=explicit, &
1666 IF (.NOT. explicit) nb_rep = 0
1667 cpassert(nb_rep <= maxbas)
1670 keyword_name=
"BASIS_SET", i_rep_val=i, c_vals=tmpstringlist)
1671 IF (
SIZE(tmpstringlist) == 1)
THEN
1673 basis_set_type(i) =
"ORB"
1674 basis_set_form(i) =
"GTO"
1675 basis_set_name(i) = tmpstringlist(1)
1676 ELSEIF (
SIZE(tmpstringlist) == 2)
THEN
1678 basis_set_type(i) = tmpstringlist(1)
1679 basis_set_form(i) =
"GTO"
1680 basis_set_name(i) = tmpstringlist(2)
1681 ELSEIF (
SIZE(tmpstringlist) == 3)
THEN
1682 basis_set_type(i) = tmpstringlist(1)
1683 basis_set_form(i) = tmpstringlist(2)
1684 basis_set_name(i) = tmpstringlist(3)
1686 CALL cp_abort(__location__, &
1687 "invalid number of BASIS_SET keyword parameters: BASIS_SET [<TYPE>] [<FORM>] <NAME>")
1690 IF (basis_set_form(i) /=
"GTO" .AND. basis_set_form(i) /=
"STO")
THEN
1691 cpabort(
"invalid BASIS_SET FORM parameter")
1697 i_val=qs_kind%pao_basis_size)
1702 c_val=qs_kind%pao_model_file)
1708 ALLOCATE (qs_kind%pao_potentials(npaopot))
1709 DO ipaopot = 1, npaopot
1711 i_val=qs_kind%pao_potentials(ipaopot)%maxl)
1712 CALL section_vals_val_get(pao_pot_section, keyword_name=
"MAX_PROJECTOR", i_rep_section=ipaopot, &
1713 i_val=qs_kind%pao_potentials(ipaopot)%max_projector)
1715 r_val=qs_kind%pao_potentials(ipaopot)%beta)
1717 r_val=qs_kind%pao_potentials(ipaopot)%weight)
1723 ALLOCATE (qs_kind%pao_descriptors(npaodesc))
1724 DO ipaodesc = 1, npaodesc
1726 r_val=qs_kind%pao_descriptors(ipaodesc)%beta)
1727 CALL section_vals_val_get(pao_desc_section, keyword_name=
"SCREENING", i_rep_section=ipaodesc, &
1728 r_val=qs_kind%pao_descriptors(ipaodesc)%screening)
1730 r_val=qs_kind%pao_descriptors(ipaodesc)%weight)
1735 keyword_name=
"ELEC_CONF", n_rep_val=i)
1738 keyword_name=
"ELEC_CONF", i_vals=elec_conf)
1742 keyword_name=
"CORE_CORRECTION", r_val=zeff_correction)
1745 keyword_name=
"POTENTIAL_FILE_NAME", c_val=potential_fn_kind)
1747 keyword_name=
"POTENTIAL_TYPE", c_val=potential_type)
1749 explicit=explicit, keyword_name=
"POTENTIAL", c_vals=tmpstringlist)
1751 IF (
SIZE(tmpstringlist) == 1)
THEN
1753 potential_name = tmpstringlist(1)
1754 IF (potential_type ==
"")
THEN
1755 ipos = index(potential_name,
"-")
1757 potential_type = potential_name(:ipos - 1)
1759 potential_type = potential_name
1762 ELSEIF (
SIZE(tmpstringlist) == 2)
THEN
1763 potential_type = tmpstringlist(1)
1764 potential_name = tmpstringlist(2)
1766 cpabort(
"POTENTIAL input list is not correct")
1773 keyword_name=
"KG_POTENTIAL_FILE_NAME", c_val=kg_potential_fn_kind)
1775 keyword_name=
"KG_POTENTIAL", c_val=kgpot_name)
1779 keyword_name=
"ECP_SEMI_LOCAL", l_val=ecp_semi_local)
1782 qs_kind%covalent_radius =
ptable(z)%covalent_radius*
bohr
1784 keyword_name=
"COVALENT_RADIUS", r_val=r)
1785 IF (r > 0.0_dp) qs_kind%covalent_radius = r
1788 qs_kind%vdw_radius =
ptable(z)%vdw_radius*
bohr
1790 keyword_name=
"VDW_RADIUS", r_val=r)
1791 IF (r > 0.0_dp) qs_kind%vdw_radius = r
1795 keyword_name=
"HARD_EXP_RADIUS")
1798 qs_kind%hard_radius = 1.2_dp
1800 qs_kind%hard_radius = 0.8_dp*
bohr
1804 keyword_name=
"HARD_EXP_RADIUS", r_val=qs_kind%hard_radius)
1809 keyword_name=
"RHO0_EXP_RADIUS")
1811 qs_kind%hard0_radius = qs_kind%hard_radius
1814 keyword_name=
"RHO0_EXP_RADIUS", r_val=qs_kind%hard0_radius)
1816 IF (qs_kind%hard_radius < qs_kind%hard0_radius) &
1817 cpabort(
"rc0 should be <= rc")
1820 keyword_name=
"MAX_RAD_LOCAL", r_val=qs_kind%max_rad_local)
1822 keyword_name=
"LEBEDEV_GRID", i_val=qs_kind%ngrid_ang)
1823 IF (qs_kind%ngrid_ang <= 0) &
1824 cpabort(
"# point lebedev grid < 0")
1826 keyword_name=
"RADIAL_GRID", i_val=qs_kind%ngrid_rad)
1827 IF (qs_kind%ngrid_rad <= 0) &
1828 cpabort(
"# point radial grid < 0")
1830 keyword_name=
"GPW_TYPE", l_val=qs_kind%gpw_type_forced)
1832 keyword_name=
"GHOST", l_val=qs_kind%ghost)
1834 keyword_name=
"FLOATING_BASIS_CENTER", l_val=qs_kind%floating)
1836 keyword_name=
"NO_OPTIMIZE", l_val=qs_kind%no_optimize)
1840 keyword_name=
"MAGNETIZATION", r_val=qs_kind%magnetization)
1843 keyword_name=
"DFTB3_PARAM", r_val=qs_kind%dudq_dftb3)
1845 keyword_name=
"LMAX_DFTB", i_val=qs_kind%lmax_dftb)
1849 keyword_name=
"MAO", i_val=qs_kind%mao)
1852 NULLIFY (bs_section)
1854 i_rep_section=k_rep)
1855 section_enabled = .false.
1857 l_val=section_enabled)
1858 IF (section_enabled)
THEN
1860 IF (qs_kind%magnetization /= 0.0_dp)
THEN
1861 CALL cp_abort(__location__,
"BS Section is in conflict with non-zero magnetization "// &
1862 "for this atom kind.")
1864 qs_kind%bs_occupation = .true.
1866 NULLIFY (spin_section)
1872 keyword_name=
"NEL", i_vals=add_el)
1873 cpassert(
ASSOCIATED(add_el))
1874 ALLOCATE (qs_kind%addel(
SIZE(add_el), 2))
1876 qs_kind%addel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
1879 keyword_name=
"L", i_vals=add_el)
1880 cpassert(
ASSOCIATED(add_el))
1881 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
1882 ALLOCATE (qs_kind%laddel(
SIZE(add_el), 2))
1884 qs_kind%laddel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
1885 ALLOCATE (qs_kind%naddel(
SIZE(add_el), 2))
1889 keyword_name=
"N", n_rep_val=i)
1892 keyword_name=
"N", i_vals=add_el)
1893 IF (
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
THEN
1894 qs_kind%naddel(1:
SIZE(add_el), 1) = add_el(1:
SIZE(add_el))
1899 NULLIFY (spin_section)
1905 keyword_name=
"NEL", i_vals=add_el)
1906 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
1907 qs_kind%addel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
1908 qs_kind%addel(:, :) = qs_kind%addel(:, :)
1911 keyword_name=
"L", i_vals=add_el)
1912 cpassert(
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
1913 qs_kind%laddel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
1916 keyword_name=
"N", n_rep_val=i)
1920 keyword_name=
"N", i_vals=add_el)
1921 IF (
SIZE(add_el) ==
SIZE(qs_kind%addel, 1))
THEN
1922 qs_kind%naddel(1:
SIZE(add_el), 2) = add_el(1:
SIZE(add_el))
1930 NULLIFY (dft_plus_u_section)
1932 subsection_name=
"DFT_PLUS_U", &
1933 i_rep_section=k_rep)
1934 section_enabled = .false.
1936 keyword_name=
"_SECTION_PARAMETERS_", &
1937 l_val=section_enabled)
1938 IF (section_enabled)
THEN
1939 ALLOCATE (qs_kind%dft_plus_u)
1940 NULLIFY (qs_kind%dft_plus_u%nelec)
1941 NULLIFY (qs_kind%dft_plus_u%orbitals)
1945 qs_kind%dft_plus_u%l = l
1946#if defined(__SIRIUS)
1950 qs_kind%dft_plus_u%n = nu
1954 r_val=qs_kind%dft_plus_u%U, &
1955 explicit=explicit_u)
1959 r_val=qs_kind%dft_plus_u%J, &
1960 explicit=explicit_j)
1963 keyword_name=
"alpha", &
1964 r_val=qs_kind%dft_plus_u%alpha)
1967 keyword_name=
"beta", &
1968 r_val=qs_kind%dft_plus_u%beta)
1971 keyword_name=
"J0", &
1972 r_val=qs_kind%dft_plus_u%J0)
1975 keyword_name=
"occupation", &
1976 r_val=qs_kind%dft_plus_u%occupation)
1982 keyword_name=
"U_MINUS_J", &
1983 r_val=qs_kind%dft_plus_u%u_minus_j_target, &
1984 explicit=explicit_u_m_j)
1986 IF ((explicit_u .OR. explicit_j) .AND. explicit_u_m_j)
THEN
1987 cpabort(
"DFT+U| specifying U or J and U_MINUS_J parameters are mutually exclusive.")
1991 keyword_name=
"U_RAMPING", &
1992 r_val=qs_kind%dft_plus_u%u_ramping)
1994 keyword_name=
"INIT_U_RAMPING_EACH_SCF", &
1995 l_val=qs_kind%dft_plus_u%init_u_ramping_each_scf)
1996 IF (qs_kind%dft_plus_u%u_ramping > 0.0_dp)
THEN
1997 qs_kind%dft_plus_u%u_minus_j = 0.0_dp
1999 qs_kind%dft_plus_u%u_minus_j = qs_kind%dft_plus_u%u_minus_j_target
2002 keyword_name=
"EPS_U_RAMPING", &
2003 r_val=qs_kind%dft_plus_u%eps_u_ramping)
2005 NULLIFY (enforce_occupation_section)
2007 subsection_name=
"ENFORCE_OCCUPATION")
2008 subsection_enabled = .false.
2010 keyword_name=
"_SECTION_PARAMETERS_", &
2011 l_val=subsection_enabled)
2012 IF (subsection_enabled)
THEN
2015 keyword_name=
"NELEC", &
2018 ALLOCATE (qs_kind%dft_plus_u%nelec(nspin))
2019 qs_kind%dft_plus_u%nelec(:) = nelec(:)
2022 keyword_name=
"ORBITALS", &
2024 norbitals =
SIZE(orbitals)
2025 IF (norbitals <= 0 .OR. norbitals > 2*l + 1) &
2026 CALL cp_abort(__location__,
"DFT+U| Invalid number of ORBITALS specified: "// &
2027 "1 to 2*L+1 integer numbers are expected")
2028 ALLOCATE (qs_kind%dft_plus_u%orbitals(norbitals))
2029 qs_kind%dft_plus_u%orbitals(:) = orbitals(:)
2032 IF (qs_kind%dft_plus_u%orbitals(m) > l) &
2033 cpabort(
"DFT+U| Invalid orbital magnetic quantum number specified: m > l")
2034 IF (qs_kind%dft_plus_u%orbitals(m) < -l) &
2035 cpabort(
"DFT+U| Invalid orbital magnetic quantum number specified: m < -l")
2038 IF (qs_kind%dft_plus_u%orbitals(j) == qs_kind%dft_plus_u%orbitals(m)) &
2039 cpabort(
"DFT+U| An orbital magnetic quantum number was specified twice")
2044 keyword_name=
"EPS_SCF", &
2045 r_val=qs_kind%dft_plus_u%eps_scf)
2047 keyword_name=
"MAX_SCF", &
2049 qs_kind%dft_plus_u%max_scf = max(-1, i)
2051 keyword_name=
"SMEAR", &
2052 l_val=qs_kind%dft_plus_u%smear)
2063 explicit_basis = .false.
2066 can_return_null=.true.)
2070 explicit_potential = .false.
2073 i_rep_section=k_rep, can_return_null=.true.)
2077 explicit_kgpot = .false.
2080 i_rep_section=k_rep, can_return_null=.true.)
2084 SELECT CASE (method_id)
2091 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2092 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2095 cpassert(.NOT. qs_kind%floating)
2096 IF (qs_kind%ghost)
THEN
2097 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2100 elec_conf=elec_conf)
2104 zeff_correction=0.0_dp)
2109 check = .NOT.
ASSOCIATED(qs_kind%se_parameter)
2117 keyword_name=
"SE_P_ORBITALS_ON_H", l_val=qs_kind%se_parameter%p_orbitals_on_h)
2125 NULLIFY (tmp_basis_set)
2126 CALL init_se_param(qs_kind%se_parameter, tmp_basis_set, ngauss)
2129 zeff=qs_kind%se_parameter%zeff, zeff_correction=zeff_correction)
2130 qs_kind%se_parameter%zeff = qs_kind%se_parameter%zeff - zeff_correction
2132 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2134 CALL cp_warn(__location__, &
2135 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2136 trim(qs_kind%name)//
"> will be ignored!")
2138 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2140 CALL cp_warn(__location__, &
2141 "Information provided in the input file regarding BASIS for KIND <"// &
2142 trim(qs_kind%name)//
"> will be ignored!")
2149 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2150 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2153 cpassert(.NOT. qs_kind%floating)
2154 IF (qs_kind%ghost)
THEN
2155 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2158 elec_conf=elec_conf)
2162 zeff_correction=0.0_dp)
2165 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2167 CALL cp_warn(__location__, &
2168 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2169 trim(qs_kind%name)//
"> will be ignored!")
2171 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2173 CALL cp_warn(__location__, &
2174 "Information provided in the input file regarding BASIS for KIND <"// &
2175 trim(qs_kind%name)//
"> will be ignored!")
2182 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2183 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2186 cpassert(.NOT. qs_kind%floating)
2187 IF (qs_kind%ghost)
THEN
2188 CALL get_qs_kind(qs_kind=qs_kind, elec_conf=elec_conf)
2191 elec_conf=elec_conf)
2195 zeff_correction=0.0_dp)
2198 check = ((potential_name /=
'') .OR. explicit_potential) .AND. .NOT. silent
2200 CALL cp_warn(__location__, &
2201 "Information provided in the input file regarding POTENTIAL for KIND <"// &
2202 trim(qs_kind%name)//
"> will be ignored!")
2204 check = ((k_rep > 0) .OR. explicit_basis) .AND. .NOT. silent
2206 CALL cp_warn(__location__, &
2207 "Information provided in the input file regarding BASIS for KIND <"// &
2208 trim(qs_kind%name)//
"> will be ignored!")
2213 IF (potential_name /=
'')
THEN
2214 SELECT CASE (trim(potential_type))
2216 CALL cp_abort(__location__, &
2217 "PW DFT calculations only with potential type UPF or GTH possible."// &
2218 " <"//trim(potential_type)//
"> was specified "// &
2219 "for the atomic kind <"//trim(qs_kind%name))
2221 IF (potential_fn_kind ==
"-")
THEN
2224 potential_file_name = potential_fn_kind
2228 qs_kind%gth_potential, zeff_correction, para_env, &
2229 potential_file_name, potential_section, update_input)
2232 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2233 CALL get_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2236 CALL set_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2239 ALLOCATE (qs_kind%upf_potential)
2240 qs_kind%upf_potential%zion = 0
2241 qs_kind%upf_potential%filename = adjustl(trim(potential_name))
2243 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2244 CALL set_qs_kind(qs_kind, elec_conf=qs_kind%upf_potential%econf)
2247 CALL cp_abort(__location__, &
2248 "An invalid potential type <"// &
2249 trim(potential_type)//
"> was specified "// &
2250 "for the atomic kind <"// &
2254 CALL cp_abort(__location__, &
2255 "No potential type was defined for the "// &
2256 "atomic kind <"//trim(qs_kind%name)//
">")
2266 SELECT CASE (basis_set_form(i))
2268 NULLIFY (tmp_basis_set)
2271 tmp_basis_set, para_env, dft_section)
2273 NULLIFY (sto_basis_set)
2276 sto_basis_set, para_env, dft_section)
2277 NULLIFY (tmp_basis_set)
2281 CALL cp_abort(__location__, &
2282 "Invalid basis set form "//trim(basis_set_form(i))// &
2283 "for atomic kind <"//trim(qs_kind%name)//
">")
2285 tmp = basis_set_type(i)
2290 IF (explicit_basis)
THEN
2293 NULLIFY (tmp_basis_set)
2296 tmp_basis_set, basis_section, i, dft_section)
2303 DO i = 1,
SIZE(qs_kind%basis_sets)
2304 NULLIFY (tmp_basis_set)
2306 inumbas=i, basis_type=basis_type)
2307 IF (basis_type ==
"") cycle
2309 DO j = i + 1,
SIZE(qs_kind%basis_sets)
2311 NULLIFY (sup_basis_set)
2313 inumbas=jj, basis_type=tmp)
2314 IF (basis_type == tmp)
THEN
2321 NULLIFY (sup_basis_set)
2326 DO i = 1,
SIZE(qs_kind%basis_sets)
2327 NULLIFY (tmp_basis_set)
2329 inumbas=i, basis_type=basis_type)
2330 IF (basis_type ==
"ORB") nobasis = .false.
2333 CALL cp_abort(__location__, &
2334 "No basis set type was defined for the "// &
2335 "atomic kind <"//trim(qs_kind%name)//
">")
2339 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
2340 IF (
ASSOCIATED(qs_kind%elec_conf)) qs_kind%elec_conf = 0
2343 IF ((potential_name /=
'') .OR. explicit_potential)
THEN
2345 IF (potential_fn_kind ==
"-")
THEN
2348 potential_file_name = potential_fn_kind
2351 SELECT CASE (trim(potential_type))
2355 qs_kind%all_potential, zeff_correction, para_env, &
2356 potential_file_name, potential_section, update_input)
2359 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2360 CALL get_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2363 CALL set_potential(potential=qs_kind%all_potential, elec_conf=elec_conf)
2368 qs_kind%gth_potential, zeff_correction, para_env, &
2369 potential_file_name, potential_section, update_input)
2372 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2373 CALL get_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2376 CALL set_potential(potential=qs_kind%gth_potential, elec_conf=elec_conf)
2380 CALL get_potential(qs_kind%sgp_potential, description=description)
2382 potential_name, potential_file_name, potential_section)
2383 IF (ecp_semi_local)
THEN
2384 description(1) =
"Semi-local Gaussian pseudopotential "
2385 description(2) =
"ECP "//trim(potential_name)
2386 description(3) =
"LIBGRPP: A. V. Oleynichenko et al., Symmetry 15 197 2023"
2387 description(4) =
" "
2389 description(4) =
"ECP "//trim(potential_name)
2391 CALL set_potential(qs_kind%sgp_potential, name=ecppot%pname, description=description, &
2392 zeff=ecppot%zion, z=z, ecp_local=.true., ecp_semi_local=ecp_semi_local, &
2393 nloc=ecppot%nloc, nrloc=ecppot%nrloc, aloc=ecppot%aloc, bloc=ecppot%bloc, &
2395 CALL set_potential(qs_kind%sgp_potential, sl_lmax=ecppot%lmax, &
2396 npot=ecppot%npot, nrpot=ecppot%nrpot, apot=ecppot%apot, bpot=ecppot%bpot)
2398 IF (.NOT. ecp_semi_local)
THEN
2399 cpabort(
"ECPs are only well tested in their semi-local form")
2400 CALL get_qs_kind(qs_kind, basis_set=orb_basis_set)
2401 CALL sgp_construction(sgp_pot=sgppot, ecp_pot=ecppot, orb_basis=orb_basis_set, error=error)
2402 IF (iounit > 0 .AND. .NOT. silent)
THEN
2403 WRITE (iounit,
"(/,T2,'PP Transformation for ',A)") trim(ecppot%pname)
2404 IF (sgppot%has_local)
THEN
2405 WRITE (iounit,
"(T8,'Accuracy for local part:',T41,F10.3,'%',T61,F20.12)") error(4), error(1)
2407 IF (sgppot%has_nonlocal)
THEN
2408 WRITE (iounit,
"(T8,'Accuracy for nonlocal part:',T41,F10.3,'%',T61,F20.12)") error(5), error(2)
2410 IF (sgppot%has_nlcc)
THEN
2411 WRITE (iounit,
"(T8,'Accuracy for NLCC density:',T61,F20.12)") error(3)
2415 IF (sgppot%has_nonlocal)
THEN
2416 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=sgppot%n_nonlocal, lmax=sgppot%lmax, &
2417 is_nonlocal=sgppot%is_nonlocal)
2418 nnl = sgppot%n_nonlocal
2420 DO l = 0, sgppot%lmax
2421 nppnl = nppnl + nnl*
nco(l)
2424 ALLOCATE (a_nl(nnl), h_nl(nnl, 0:l), c_nl(nnl, nnl, 0:l))
2425 a_nl(:) = sgppot%a_nonlocal(:)
2426 h_nl(:, :) = sgppot%h_nonlocal(:, :)
2427 DO l = 0, sgppot%lmax
2428 c_nl(:, :, l) = sgppot%c_nonlocal(:, :, l)*sqrt(2._dp*l + 1.0_dp)
2430 CALL set_potential(qs_kind%sgp_potential, nppnl=nppnl, a_nonlocal=a_nl, h_nonlocal=h_nl, c_nonlocal=c_nl)
2432 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=0, lmax=-1, is_nonlocal=sgppot%is_nonlocal)
2436 cpassert(.NOT. sgppot%has_local)
2437 cpassert(.NOT. sgppot%has_nlcc)
2439 rc = 0.5_dp*qs_kind%covalent_radius*
angstrom
2440 rc = max(rc, 0.2_dp)
2441 rc = min(rc, 1.0_dp)
2442 alpha = 1.0_dp/(2.0_dp*rc**2)
2443 ccore = ecppot%zion*sqrt((alpha/
pi)**3)
2444 CALL set_potential(qs_kind%sgp_potential, alpha_core_charge=alpha, ccore_charge=ccore, &
2445 core_charge_radius=rc)
2448 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2452 CALL set_potential(qs_kind%sgp_potential, elec_conf=elec_conf)
2455 CALL get_potential(qs_kind%sgp_potential, description=description)
2456 description(4) =
"UPF "//trim(potential_name)
2458 CALL set_potential(qs_kind%sgp_potential, name=upfpot%pname, description=description, &
2459 zeff=upfpot%zion, z=z,
has_nlcc=upfpot%core_correction)
2462 IF (iounit > 0 .AND. .NOT. silent)
THEN
2463 WRITE (iounit,
"(/,T2,'PP Transformation for ',A)") trim(upfpot%pname)
2464 IF (sgppot%has_local)
THEN
2465 WRITE (iounit,
"(T8,'Accuracy for local part:',T61,F20.12)") error(1)
2467 IF (sgppot%has_nonlocal)
THEN
2468 WRITE (iounit,
"(T8,'Accuracy for nonlocal part:',T61,F20.12)") error(2)
2470 IF (sgppot%has_nlcc)
THEN
2471 WRITE (iounit,
"(T8,'Accuracy for NLCC density:',T61,F20.12)") error(3)
2474 IF (sgppot%has_nonlocal)
THEN
2475 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=sgppot%n_nonlocal, lmax=sgppot%lmax, &
2476 is_nonlocal=sgppot%is_nonlocal)
2477 nnl = sgppot%n_nonlocal
2479 DO l = 0, sgppot%lmax
2480 nppnl = nppnl + nnl*
nco(l)
2483 ALLOCATE (a_nl(nnl), h_nl(nnl, 0:l), c_nl(nnl, nnl, 0:l))
2484 a_nl(:) = sgppot%a_nonlocal(:)
2485 h_nl(:, :) = sgppot%h_nonlocal(:, :)
2486 c_nl(:, :, :) = sgppot%c_nonlocal(:, :, :)
2487 CALL set_potential(qs_kind%sgp_potential, nppnl=nppnl, a_nonlocal=a_nl, h_nonlocal=h_nl, c_nonlocal=c_nl)
2489 CALL set_potential(qs_kind%sgp_potential, n_nonlocal=0, lmax=-1, is_nonlocal=sgppot%is_nonlocal)
2492 cpassert(sgppot%has_local)
2494 rc = sgppot%ac_local
2495 alpha = 1.0_dp/(2.0_dp*rc**2)
2496 ccore = upfpot%zion*sqrt((alpha/
pi)**3)
2497 CALL set_potential(qs_kind%sgp_potential, alpha_core_charge=alpha, ccore_charge=ccore, &
2498 core_charge_radius=rc)
2500 nloc = sgppot%n_local
2501 ALLOCATE (aloc(nloc), cloc(nloc))
2502 aloc(1:nloc) = sgppot%a_local(1:nloc)
2503 cloc(1:nloc) = sgppot%c_local(1:nloc)
2504 CALL set_potential(qs_kind%sgp_potential, n_local=nloc, a_local=aloc, c_local=cloc)
2505 IF (sgppot%has_nlcc)
THEN
2506 nlcc = sgppot%n_nlcc
2507 ALLOCATE (anlcc(nlcc), cnlcc(nlcc))
2508 anlcc(1:nlcc) = sgppot%a_nlcc(1:nlcc)
2509 cnlcc(1:nlcc) = sgppot%c_nlcc(1:nlcc)
2514 IF (.NOT.
ASSOCIATED(elec_conf))
THEN
2518 CALL set_potential(qs_kind%sgp_potential, elec_conf=elec_conf)
2522 CALL cp_abort(__location__, &
2523 "An invalid potential type <"// &
2524 trim(potential_name)//
"> was specified "// &
2525 "for the atomic kind <"// &
2529 CALL cp_abort(__location__, &
2530 "No potential type was defined for the "// &
2531 "atomic kind <"//trim(qs_kind%name)//
">")
2534 CALL check_potential_basis_compatibility(qs_kind)
2537 IF ((kgpot_name /=
'') .OR. explicit_kgpot)
THEN
2538 ipos = index(kgpot_name,
"-")
2540 kgpot_type = kgpot_name(:ipos - 1)
2542 kgpot_type = kgpot_name
2546 SELECT CASE (trim(kgpot_type))
2549 IF (kg_potential_fn_kind ==
"-")
THEN
2552 potential_file_name = kg_potential_fn_kind
2556 qs_kind%tnadd_potential, para_env, &
2557 potential_file_name, kgpot_section, update_input)
2559 NULLIFY (qs_kind%tnadd_potential)
2561 CALL cp_abort(__location__, &
2562 "An invalid kg_potential type <"// &
2563 trim(potential_name)//
"> was specified "// &
2564 "for the atomic kind <"// &
2571 CALL timestop(handle)
2573 END SUBROUTINE read_qs_kind
2580 SUBROUTINE check_potential_basis_compatibility(qs_kind)
2583 CHARACTER(LEN=default_string_length) :: name
2588 CALL get_qs_kind(qs_kind, name=name, gth_potential=gth_potential, basis_set=basis_set)
2591 IF (
ASSOCIATED(gth_potential)) &
2592 npp = parse_valence_electrons(gth_potential%aliases)
2593 IF (
ASSOCIATED(basis_set)) &
2594 nbs = parse_valence_electrons(basis_set%aliases)
2596 IF (npp >= 0 .AND. nbs >= 0 .AND. npp /= nbs) &
2597 CALL cp_abort(__location__,
"Basis-set and pseudo-potential of atomic kind '"//trim(name)//
"'"// &
2598 " were optimized for different valence electron numbers.")
2600 END SUBROUTINE check_potential_basis_compatibility
2608 FUNCTION parse_valence_electrons(string)
RESULT(n)
2609 CHARACTER(*) :: string
2612 INTEGER :: i, istat, j
2614 i = index(string,
"-Q", .true.)
2618 j = scan(string(i + 2:),
"- ")
2619 READ (string(i + 2:i + j),
'(I3)', iostat=istat) n
2620 IF (istat /= 0) n = -1
2635 force_env_section, silent)
2637 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2642 LOGICAL,
INTENT(IN) :: silent
2644 CHARACTER(len=*),
PARAMETER :: routinen =
'create_qs_kind_set'
2646 INTEGER :: handle, ikind, method, nkind, qs_method
2649 CALL timeset(routinen, handle)
2651 IF (
ASSOCIATED(qs_kind_set)) cpabort(
"create_qs_kind_set: qs_kind_set already associated")
2652 IF (.NOT.
ASSOCIATED(atomic_kind_set)) cpabort(
"create_qs_kind_set: atomic_kind_set not associated")
2658 IF (method ==
do_qs)
THEN
2660 SELECT CASE (qs_method)
2675 nkind =
SIZE(atomic_kind_set)
2676 ALLOCATE (qs_kind_set(nkind))
2679 qs_kind_set(ikind)%name = atomic_kind_set(ikind)%name
2680 qs_kind_set(ikind)%element_symbol = atomic_kind_set(ikind)%element_symbol
2681 qs_kind_set(ikind)%natom = atomic_kind_set(ikind)%natom
2682 CALL read_qs_kind(qs_kind_set(ikind), kind_section, para_env, force_env_section, &
2683 no_fail, qs_method, silent)
2686 CALL timestop(handle)
2697 SUBROUTINE check_qs_kind(qs_kind, dft_control, subsys_section)
2709 IF (dft_control%qs_control%semi_empirical)
THEN
2710 CALL get_qs_kind(qs_kind, se_parameter=se_parameter)
2711 cpassert(
ASSOCIATED(se_parameter))
2715 ELSE IF (dft_control%qs_control%dftb)
THEN
2716 CALL get_qs_kind(qs_kind, dftb_parameter=dftb_parameter)
2717 cpassert(
ASSOCIATED(dftb_parameter))
2721 ELSE IF (dft_control%qs_control%xtb)
THEN
2722 IF (.NOT. (dft_control%qs_control%xtb_control%do_tblite))
THEN
2723 CALL get_qs_kind(qs_kind, xtb_parameter=xtb_parameter)
2724 cpassert(
ASSOCIATED(xtb_parameter))
2725 gfn_type = dft_control%qs_control%xtb_control%gfn_type
2730 END SUBROUTINE check_qs_kind
2740 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2744 CHARACTER(len=*),
PARAMETER :: routinen =
'check_qs_kind_set'
2746 INTEGER :: handle, ikind, nkind
2749 CALL timeset(routinen, handle)
2750 IF (
ASSOCIATED(qs_kind_set))
THEN
2751 nkind =
SIZE(qs_kind_set)
2753 qs_kind => qs_kind_set(ikind)
2754 CALL check_qs_kind(qs_kind, dft_control, subsys_section)
2756 IF (dft_control%qs_control%xtb)
THEN
2757 CALL write_xtb_kab_param(qs_kind_set, subsys_section, &
2758 dft_control%qs_control%xtb_control)
2761 cpabort(
"The pointer qs_kind_set is not associated")
2763 CALL timestop(handle)
2772 SUBROUTINE write_xtb_kab_param(qs_kind_set, subsys_section, xtb_control)
2774 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2778 CHARACTER(LEN=default_string_length) :: aname, bname
2779 INTEGER :: ikind, io_unit, jkind, nkind, za, zb
2782 TYPE(
xtb_atom_type),
POINTER :: xtb_parameter_a, xtb_parameter_b
2787 "PRINT%KINDS/POTENTIAL"),
cp_p_file))
THEN
2790 IF (io_unit > 0)
THEN
2792 WRITE (io_unit,
"(/,T2,A)")
"xTB| Kab parameters"
2793 nkind =
SIZE(qs_kind_set)
2795 qs_kinda => qs_kind_set(ikind)
2796 CALL get_qs_kind(qs_kinda, xtb_parameter=xtb_parameter_a)
2798 DO jkind = ikind, nkind
2799 qs_kindb => qs_kind_set(jkind)
2800 CALL get_qs_kind(qs_kindb, xtb_parameter=xtb_parameter_b)
2802 WRITE (io_unit,
"(A,T10,A15,T25,A15,T71,F10.3)") &
2803 " Kab:", trim(aname), trim(bname),
xtb_set_kab(za, zb, xtb_control)
2813 END SUBROUTINE write_xtb_kab_param
2836 SUBROUTINE set_qs_kind(qs_kind, paw_atom, ghost, floating, hard_radius, hard0_radius, &
2837 covalent_radius, vdw_radius, lmax_rho0, zeff, &
2838 no_optimize, dispersion, u_minus_j, reltmat, &
2839 dftb_parameter, xtb_parameter, &
2840 elec_conf, pao_basis_size)
2843 LOGICAL,
INTENT(IN),
OPTIONAL :: paw_atom, ghost, floating
2844 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: hard_radius, hard0_radius, &
2845 covalent_radius, vdw_radius
2846 INTEGER,
INTENT(IN),
OPTIONAL :: lmax_rho0
2847 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: zeff
2848 LOGICAL,
INTENT(IN),
OPTIONAL :: no_optimize
2850 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: u_minus_j
2851 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: reltmat
2854 INTEGER,
DIMENSION(:),
INTENT(IN),
OPTIONAL :: elec_conf
2855 INTEGER,
INTENT(IN),
OPTIONAL :: pao_basis_size
2857 IF (
PRESENT(dftb_parameter)) qs_kind%dftb_parameter => dftb_parameter
2858 IF (
PRESENT(xtb_parameter)) qs_kind%xtb_parameter => xtb_parameter
2859 IF (
PRESENT(elec_conf))
THEN
2860 IF (
ASSOCIATED(qs_kind%elec_conf))
THEN
2861 DEALLOCATE (qs_kind%elec_conf)
2863 ALLOCATE (qs_kind%elec_conf(0:
SIZE(elec_conf) - 1))
2864 qs_kind%elec_conf(:) = elec_conf(:)
2866 IF (
PRESENT(paw_atom)) qs_kind%paw_atom = paw_atom
2867 IF (
PRESENT(hard_radius)) qs_kind%hard_radius = hard_radius
2868 IF (
PRESENT(hard0_radius)) qs_kind%hard0_radius = hard0_radius
2869 IF (
PRESENT(covalent_radius)) qs_kind%covalent_radius = covalent_radius
2870 IF (
PRESENT(vdw_radius)) qs_kind%vdw_radius = vdw_radius
2871 IF (
PRESENT(lmax_rho0)) qs_kind%lmax_rho0 = lmax_rho0
2872 IF (
PRESENT(zeff))
THEN
2873 IF (
ASSOCIATED(qs_kind%all_potential))
THEN
2874 CALL set_potential(potential=qs_kind%all_potential, zeff=zeff)
2875 ELSE IF (
ASSOCIATED(qs_kind%gth_potential))
THEN
2876 CALL set_potential(potential=qs_kind%gth_potential, zeff=zeff)
2877 ELSE IF (
ASSOCIATED(qs_kind%sgp_potential))
THEN
2878 CALL set_potential(potential=qs_kind%sgp_potential, zeff=zeff)
2881 IF (
PRESENT(ghost)) qs_kind%ghost = ghost
2883 IF (
PRESENT(floating)) qs_kind%floating = floating
2885 IF (
PRESENT(no_optimize)) qs_kind%no_optimize = no_optimize
2887 IF (
PRESENT(dispersion)) qs_kind%dispersion => dispersion
2889 IF (
PRESENT(u_minus_j))
THEN
2890 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
2891 qs_kind%dft_plus_u%u_minus_j = u_minus_j
2895 IF (
PRESENT(reltmat)) qs_kind%reltmat => reltmat
2897 IF (
PRESENT(pao_basis_size)) qs_kind%pao_basis_size = pao_basis_size
2909 SUBROUTINE write_qs_kind(qs_kind, kind_number, output_unit)
2912 INTEGER,
INTENT(in) :: kind_number, output_unit
2914 CHARACTER(LEN=3) :: yon
2915 CHARACTER(LEN=default_string_length) :: basis_type, bstring
2920 IF (output_unit > 0)
THEN
2922 IF (
ASSOCIATED(qs_kind))
THEN
2923 WRITE (unit=output_unit, fmt=
"(/,T2,I2,A,T57,A,T75,I6)") &
2924 kind_number,
". Atomic kind: "//trim(qs_kind%name), &
2925 "Number of atoms: ", qs_kind%natom
2927 DO ibas = 1,
SIZE(qs_kind%basis_sets, 1)
2930 inumbas=ibas, basis_type=basis_type)
2932 SELECT CASE (basis_type)
2934 bstring =
"Basis Set"
2937 bstring =
"Orbital Basis Set"
2939 bstring =
"GAPW Soft Basis Set"
2942 bstring =
"Auxiliary Basis Set"
2944 bstring =
"Minimal Basis Set"
2946 bstring =
"RI Auxiliary Basis Set"
2948 bstring =
"Auxiliary Fit Basis Set"
2950 bstring =
"LRI Basis Set"
2952 bstring =
"LRI Basis Set for TDDFPT"
2954 bstring =
"RI XAS Basis Set"
2956 bstring =
"RI HFX Basis Set"
2965 IF (qs_kind%ghost)
THEN
2966 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
2967 "The atoms of this atomic kind are GHOST atoms!"
2969 IF (qs_kind%floating)
THEN
2970 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
2971 "The atoms of this atomic kind are FLOATING BASIS FUNCTIONS."
2973 IF (qs_kind%covalent_radius > 0.0_dp)
THEN
2974 WRITE (unit=output_unit, fmt=
"(/,T8,A,T71,F10.3)") &
2975 "Atomic covalent radius [Angstrom]:", &
2978 IF (qs_kind%vdw_radius > 0.0_dp)
THEN
2979 WRITE (unit=output_unit, fmt=
"(/,T8,A,T71,F10.3)") &
2980 "Atomic van der Waals radius [Angstrom]:", &
2983 IF (qs_kind%paw_atom)
THEN
2984 WRITE (unit=output_unit, fmt=
"(/,T6,A)") &
2985 "The atoms of this atomic kind are PAW atoms (GAPW):"
2986 WRITE (unit=output_unit, fmt=
"(T8,A,T71,F10.3)") &
2987 "Hard Gaussian function radius:", qs_kind%hard_radius, &
2988 "Rho0 radius:", qs_kind%hard0_radius, &
2989 "Maximum GTO radius used for PAW projector construction:", &
2990 qs_kind%max_rad_local
2993 basis_type=
"ORB_SOFT")
2997 IF (
ASSOCIATED(qs_kind%all_potential))
CALL write_potential(qs_kind%all_potential, output_unit)
2998 IF (
ASSOCIATED(qs_kind%gth_potential))
CALL write_potential(qs_kind%gth_potential, output_unit)
2999 IF (
ASSOCIATED(qs_kind%sgp_potential))
CALL write_potential(qs_kind%sgp_potential, output_unit)
3000 IF (
ASSOCIATED(qs_kind%tnadd_potential))
CALL write_potential(qs_kind%tnadd_potential, output_unit)
3001 IF (
ASSOCIATED(qs_kind%dft_plus_u))
THEN
3002 WRITE (unit=output_unit, fmt=
"(/,T6,A,/,T8,A,T76,I5,/,T8,A,T73,F8.3)") &
3003 "A DFT+U correction is applied to atoms of this atomic kind:", &
3004 "Angular quantum momentum number L:", qs_kind%dft_plus_u%l, &
3005 "U(eff) = (U - J) value in [eV]:", qs_kind%dft_plus_u%u_minus_j_target*
evolt
3006 IF (qs_kind%dft_plus_u%u_ramping > 0.0_dp)
THEN
3007 IF (qs_kind%dft_plus_u%init_u_ramping_each_scf)
THEN
3012 WRITE (unit=output_unit, fmt=
"(T8,A,T73,F8.3,/,T8,A,T73,ES8.1,/,T8,A,T78,A3)") &
3013 "Increment for U ramping in [eV]:", qs_kind%dft_plus_u%u_ramping*
evolt, &
3014 "SCF threshold value for U ramping:", qs_kind%dft_plus_u%eps_u_ramping, &
3015 "Set U ramping value to zero before each wavefunction optimisation:", yon
3017 IF (
ASSOCIATED(qs_kind%dft_plus_u%orbitals))
THEN
3018 WRITE (unit=output_unit, fmt=
"(T8,A)") &
3019 "An initial orbital occupation is requested:"
3020 IF (
ASSOCIATED(qs_kind%dft_plus_u%nelec))
THEN
3021 IF (any(qs_kind%dft_plus_u%nelec(:) >= 0.5_dp))
THEN
3022 IF (
SIZE(qs_kind%dft_plus_u%nelec) > 1)
THEN
3023 WRITE (unit=output_unit, fmt=
"(T9,A,T75,F6.2)") &
3024 "Number of alpha electrons:", &
3025 qs_kind%dft_plus_u%nelec(1), &
3026 "Number of beta electrons:", &
3027 qs_kind%dft_plus_u%nelec(2)
3029 WRITE (unit=output_unit, fmt=
"(T9,A,T75,F6.2)") &
3030 "Number of electrons:", &
3031 qs_kind%dft_plus_u%nelec(1)
3035 WRITE (unit=output_unit, fmt=
"(T9,A,(T78,I3))") &
3036 "Preferred (initial) orbital occupation order (orbital M values):", &
3037 qs_kind%dft_plus_u%orbitals(:)
3038 WRITE (unit=output_unit, fmt=
"(T9,A,T71,ES10.3,/,T9,A,T76,I5)") &
3039 "Threshold value for the SCF convergence criterion:", &
3040 qs_kind%dft_plus_u%eps_scf, &
3041 "Number of initial SCF iterations:", &
3042 qs_kind%dft_plus_u%max_scf
3043 IF (qs_kind%dft_plus_u%smear)
THEN
3044 WRITE (unit=output_unit, fmt=
"(T9,A)") &
3045 "A smearing of the orbital occupations will be performed"
3055 END SUBROUTINE write_qs_kind
3065 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
3068 CHARACTER(len=*),
PARAMETER :: routinen =
'write_qs_kind_set'
3070 INTEGER :: handle, ikind, nkind, output_unit
3074 CALL timeset(routinen, handle)
3079 "PRINT%KINDS", extension=
".Log")
3080 IF (output_unit > 0)
THEN
3081 IF (
ASSOCIATED(qs_kind_set))
THEN
3082 WRITE (unit=output_unit, fmt=
"(/,/,T2,A)")
"ATOMIC KIND INFORMATION"
3083 nkind =
SIZE(qs_kind_set)
3085 qs_kind => qs_kind_set(ikind)
3086 CALL write_qs_kind(qs_kind, ikind, output_unit)
3096 CALL timestop(handle)
3111 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
3114 CHARACTER(LEN=*),
PARAMETER :: routinen =
'write_gto_basis_sets'
3116 CHARACTER(LEN=default_string_length) :: basis_type, bstring
3117 INTEGER :: handle, ibas, ikind, nkind, output_unit
3122 CALL timeset(routinen, handle)
3127 "PRINT%KINDS/BASIS_SET", &
3129 IF (output_unit > 0)
THEN
3130 IF (
ASSOCIATED(qs_kind_set))
THEN
3131 WRITE (unit=output_unit, fmt=
"(/,/,T2,A)") &
3132 "BASIS SET INFORMATION (Unnormalised Gaussian-type functions)"
3133 nkind =
SIZE(qs_kind_set)
3135 qs_kind => qs_kind_set(ikind)
3136 WRITE (unit=output_unit, fmt=
"(/,T2,I2,A)") &
3137 ikind,
". Atomic kind: "//trim(qs_kind%name)
3139 DO ibas = 1,
SIZE(qs_kind%basis_sets, 1)
3142 inumbas=ibas, basis_type=basis_type)
3143 IF (basis_type ==
"") cycle
3144 SELECT CASE (basis_type)
3146 bstring =
"Basis Set"
3148 bstring =
"Orbital Basis Set"
3150 bstring =
"GAPW Soft Basis Set"
3152 bstring =
"Auxiliary Basis Set"
3154 bstring =
"Minimal Basis Set"
3156 bstring =
"RI Auxiliary Basis Set"
3158 bstring =
"Auxiliary Fit Basis Set"
3160 bstring =
"LRI Basis Set"
3162 bstring =
"LRI Basis Set for TDDFPT"
3164 bstring =
"RI HFX Basis Set"
3178 "PRINT%KINDS/BASIS_SET")
3180 CALL timestop(handle)
3197 INTEGER,
DIMENSION(0:lmat, 10),
INTENT(OUT) :: ncalc, ncore,
nelem
3198 REAL(kind=
dp),
DIMENSION(0:lmat, 10, 2), &
3199 INTENT(OUT) :: edelta
3201 INTEGER :: i, ii, is, l, ll, ne, nn, z
3202 INTEGER,
DIMENSION(:),
POINTER :: econf
3203 INTEGER,
DIMENSION(:, :),
POINTER :: addel, laddel, naddel
3204 LOGICAL :: bs_occupation
3205 REAL(kind=
dp) :: dmag, magnetization
3210 NULLIFY (gth_potential)
3212 gth_potential=gth_potential, &
3213 sgp_potential=sgp_potential, &
3214 magnetization=magnetization, &
3215 bs_occupation=bs_occupation, &
3216 addel=addel, laddel=laddel, naddel=naddel)
3223 IF (
ASSOCIATED(gth_potential))
THEN
3226 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
3230 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
3245 ncalc =
nelem - ncore
3251 IF (bs_occupation)
THEN
3253 DO i = 1,
SIZE(addel, 1)
3256 nn = naddel(i, is) - l
3259 DO ii =
SIZE(
nelem, 2), 1, -1
3260 IF (ncalc(l, ii) > 0)
THEN
3261 IF ((ncalc(l, ii) + ne) < 2*(2*l + 1) + 1)
THEN
3262 edelta(l, ii, is) = edelta(l, ii, is) + ne
3265 edelta(l, ii + 1, is) = edelta(l, ii + 1, is) + ne
3269 ELSE IF (ii == 1)
THEN
3270 edelta(l, ii, is) = edelta(l, ii, is) + ne
3275 edelta(l, nn, is) = edelta(l, nn, is) + ne
3277 IF (ncalc(l, nn) + edelta(l, nn, is) < 0)
THEN
3278 edelta(l, nn, is) = -ncalc(l, nn)
3283 edelta = 0.5_dp*edelta
3284 ELSE IF (magnetization /= 0.0_dp)
THEN
3285 dmag = 0.5_dp*abs(magnetization)
3286 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
3289 DO i = 1,
SIZE(ncalc, 2)
3290 IF (ncalc(l, i) == 0) cycle
3291 IF (ncalc(l, i) == ll) cycle
3292 IF (ncalc(l, i) > dmag .AND. (ll - ncalc(l, i)) > dmag)
THEN
3298 edelta(l, ii, 1) = magnetization*0.5_dp
3299 edelta(l, ii, 2) = -magnetization*0.5_dp
3304 CALL cp_abort(__location__, &
3305 "Magnetization value cannot be imposed for this atom type")
3309 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
3327 INTEGER,
DIMENSION(:),
POINTER :: econf
3328 INTEGER,
INTENT(IN) :: z
3329 INTEGER,
DIMENSION(0:lmat, 10),
INTENT(OUT) :: ncalc, ncore,
nelem
3331 CHARACTER(LEN=default_string_length) :: message
3332 INTEGER :: ii, iounit, l, ll, lmin, nc, nn
3333 INTEGER,
DIMENSION(0:lmat) :: econfx
3341 econfx(0:
SIZE(econf) - 1) = econf
3342 IF (sum(econf) >= 0)
THEN
3343 lmin = min(
lmat, ubound(
ptable(z)%e_conv, 1))
3654 IF (z == 65 .AND. econfx(3) == 0)
THEN
3660 IF (ncore(0, 1) <= 0)
THEN
3661 IF (z >= 58 .AND. z <= 71)
THEN
3674 ncore(3, 1) = nc - 28
3675 message =
"A small-core pseudopotential with 4f-in-core is used for the lanthanide "// &
3677 cphint(trim(message))
3688 ncore(3, 1) = nc - 46
3689 message =
"A medium-core pseudopotential with 4f-in-core is used for the lanthanide "// &
3691 cphint(trim(message))
3698 IF (ncore(0, 1) >= 0)
THEN
3701 nn = sum(ncore(l, :)) + econfx(l)
3714 ncalc =
nelem - ncore
3717 IF (iounit > 0)
THEN
3718 WRITE (iounit,
"(/,A,A2)")
"WARNING: Core states irregular for atom type ",
ptable(z)%symbol
3719 WRITE (iounit,
"(A,10I3)")
"WARNING: Redefine ELEC_CONF in the KIND section"
3720 cpabort(
"Incompatible Atomic Occupations Detected")
3724 lmin = min(
lmat, ubound(
ptable(z)%e_conv, 1))
3758 LOGICAL :: nlcc_present
3764 DO ikind = 1,
SIZE(qs_kind_set)
3765 CALL get_qs_kind(qs_kind_set(ikind), gth_potential=gth_potential, sgp_potential=sgp_potential)
3766 IF (
ASSOCIATED(gth_potential))
THEN
3767 CALL get_potential(potential=gth_potential, nlcc_present=nlcc_present)
3768 nlcc = nlcc .OR. nlcc_present
3769 ELSEIF (
ASSOCIATED(sgp_potential))
THEN
3771 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
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)
...
logical function, public has_nlcc(qs_kind_set)
finds if a given qs run needs to use nlcc
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 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 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 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.