24 atom_gthpot_type, atom_integrals, atom_orbitals, atom_potential_type, atom_sgppot_type, &
57 #include "./base/base_uses.f90"
63 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'atom_kind_orbitals'
88 density, wavefunction, wfninfo, confine, xc_section, nocc)
89 TYPE(atomic_kind_type),
INTENT(IN) :: atomic_kind
90 TYPE(qs_kind_type),
INTENT(IN) :: qs_kind
91 TYPE(grid_atom_type),
OPTIONAL :: agrid
92 INTEGER,
INTENT(IN),
OPTIONAL :: iunit
93 REAL(kind=
dp),
DIMENSION(:, :, :),
OPTIONAL, &
95 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL,
POINTER :: density
96 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL,
POINTER :: wavefunction, wfninfo
97 LOGICAL,
INTENT(IN),
OPTIONAL :: confine
98 TYPE(section_vals_type),
OPTIONAL,
POINTER :: xc_section
99 INTEGER,
DIMENSION(:),
OPTIONAL :: nocc
101 INTEGER :: i, ii, j, k, k1, k2, l, ll, m, mb, mo, &
103 INTEGER,
DIMENSION(0:lmat) :: nbb
104 INTEGER,
DIMENSION(0:lmat, 10) :: ncalc, ncore, nelem
105 INTEGER,
DIMENSION(0:lmat, 100) :: set_index, shell_index
106 INTEGER,
DIMENSION(:),
POINTER :: nshell
107 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf, ls
108 LOGICAL :: ecp_semi_local, ghost, has_pp, uks
109 REAL(kind=
dp) :: ok, scal, zeff
110 REAL(kind=
dp),
DIMENSION(0:lmat, 10, 2) :: edelta
111 TYPE(all_potential_type),
POINTER :: all_potential
112 TYPE(atom_basis_type),
POINTER :: basis
113 TYPE(atom_integrals),
POINTER :: integrals
114 TYPE(atom_orbitals),
POINTER :: orbitals
115 TYPE(atom_potential_type),
POINTER :: potential
116 TYPE(atom_type),
POINTER ::
atom
117 TYPE(gth_potential_type),
POINTER :: gth_potential
118 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
119 TYPE(sgp_potential_type),
POINTER :: sgp_potential
124 IF (
PRESENT(xc_section))
THEN
125 atom%xc_section => xc_section
127 NULLIFY (
atom%xc_section)
131 NULLIFY (all_potential, gth_potential, sgp_potential, orb_basis_set)
133 basis_set=orb_basis_set, &
135 all_potential=all_potential, &
136 gth_potential=gth_potential, &
137 sgp_potential=sgp_potential)
139 has_pp =
ASSOCIATED(gth_potential) .OR.
ASSOCIATED(sgp_potential)
151 ALLOCATE (potential, integrals)
153 IF (
PRESENT(confine))
THEN
154 potential%confinement = confine
156 IF (
ASSOCIATED(gth_potential) .OR.
ASSOCIATED(sgp_potential))
THEN
157 potential%confinement = .true.
159 potential%confinement = .false.
163 potential%acon = 0.1_dp
164 potential%rcon = 2.0_dp*
ptable(z)%vdw_radius*
bohr
165 potential%scon = 2.0_dp
167 IF (
ASSOCIATED(gth_potential))
THEN
169 CALL get_potential(gth_potential, zeff=zeff)
171 CALL set_atom(
atom, zcore=nint(zeff), potential=potential)
172 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
173 CALL get_potential(sgp_potential, ecp_semi_local=ecp_semi_local)
174 IF (ecp_semi_local)
THEN
176 CALL ecp_potential_conversion(sgp_potential, potential%ecp_pot)
177 potential%ecp_pot%symbol =
ptable(z)%symbol
180 CALL sgp_potential_conversion(sgp_potential, potential%sgp_pot)
181 potential%sgp_pot%symbol =
ptable(z)%symbol
183 CALL get_potential(sgp_potential, zeff=zeff)
184 CALL set_atom(
atom, zcore=nint(zeff), potential=potential)
197 atom%optimization%damping = 0.2_dp
198 atom%optimization%eps_scf = 1.e-6_dp
199 atom%optimization%eps_diis = 100._dp
200 atom%optimization%max_iter = 50
201 atom%optimization%n_diis = 5
212 IF (sum(abs(edelta)) > 0.0_dp)
THEN
220 ALLOCATE (
atom%state)
222 atom%state%core = 0._dp
224 atom%state%occ = 0._dp
227 edelta(0:
lmat, 1:7, 1) + edelta(0:
lmat, 1:7, 2)
231 atom%state%occupation = 0._dp
235 IF (ncalc(l, i) > 0)
THEN
238 atom%state%occupation(l, k) = real(ncalc(l, i),
dp) + &
239 edelta(l, i, 1) + edelta(l, i, 2)
240 atom%state%occa(l, k) = 0.5_dp*real(ncalc(l, i),
dp) + edelta(l, i, 1)
241 atom%state%occb(l, k) = 0.5_dp*real(ncalc(l, i),
dp) + edelta(l, i, 2)
243 atom%state%occupation(l, k) = real(ncalc(l, i),
dp)
247 ok = real(2*l + 1, kind=
dp)
250 atom%state%occ(l, i) = min(
atom%state%occ(l, i), 2.0_dp*ok)
251 atom%state%occa(l, i) = min(
atom%state%occa(l, i), ok)
252 atom%state%occb(l, i) = min(
atom%state%occb(l, i), ok)
253 atom%state%occupation(l, i) =
atom%state%occa(l, i) +
atom%state%occb(l, i)
257 atom%state%occ(l, i) = min(
atom%state%occ(l, i), 2.0_dp*ok)
258 atom%state%occupation(l, i) = min(
atom%state%occupation(l, i), 2.0_dp*ok)
263 atom%state%multiplicity = nint(abs(sum(
atom%state%occa -
atom%state%occb)) + 1)
265 atom%state%multiplicity = -1
270 atom%state%maxl_calc =
atom%state%maxl_occ
271 atom%state%maxn_calc =
atom%state%maxn_occ
274 IF (
PRESENT(nocc) .AND. ghost)
THEN
276 ELSEIF (
PRESENT(nocc))
THEN
281 IF (
atom%state%occa(l, k) > 0.0_dp)
THEN
282 nocc(1) = nocc(1) + 2*l + 1
284 IF (
atom%state%occb(l, k) > 0.0_dp)
THEN
285 nocc(2) = nocc(2) + 2*l + 1
288 IF (
atom%state%occupation(l, k) > 0.0_dp)
THEN
289 nocc(1) = nocc(1) + 2*l + 1
290 nocc(2) = nocc(2) + 2*l + 1
305 NULLIFY (integrals%tzora, integrals%hdkh)
310 mo = maxval(
atom%state%maxn_calc)
311 mb = maxval(
atom%basis%nbas)
315 IF (.NOT. ghost)
THEN
316 IF (
PRESENT(iunit))
THEN
323 IF (
PRESENT(pmat))
THEN
326 nset=nset, nshell=nshell, l=ls, nsgf=nsgf, first_sgf=first_sgf)
338 shell_index(l, k) = j
343 IF (
ASSOCIATED(pmat))
THEN
346 ALLOCATE (pmat(nsgf, nsgf, 2))
348 IF (.NOT. ghost)
THEN
351 DO k1 = 1,
atom%basis%nbas(l)
352 DO k2 = 1,
atom%basis%nbas(l)
353 scal = sqrt(
atom%integrals%ovlp(k1, k1, l)*
atom%integrals%ovlp(k2, k2, l))/real(2*l + 1, kind=
dp)
354 i = first_sgf(shell_index(l, k1), set_index(l, k1))
355 j = first_sgf(shell_index(l, k2), set_index(l, k2))
358 pmat(i + m, j + m, 1) =
atom%orbitals%pmata(k1, k2, l)*scal
359 pmat(i + m, j + m, 2) =
atom%orbitals%pmatb(k1, k2, l)*scal
363 pmat(i + m, j + m, 1) =
atom%orbitals%pmat(k1, k2, l)*scal
370 pmat(:, :, 1) = pmat(:, :, 1) + pmat(:, :, 2)
371 pmat(:, :, 2) = pmat(:, :, 1) - 2.0_dp*pmat(:, :, 2)
376 IF (
PRESENT(fmat))
THEN
380 nset=nset, nshell=nshell, l=ls, nsgf=nsgf, first_sgf=first_sgf)
392 shell_index(l, k) = j
396 IF (uks) cpabort(
"calculate_atomic_orbitals: only RKS is implemented")
397 IF (
ASSOCIATED(fmat)) cpabort(
"fmat already associated")
398 IF (.NOT.
ASSOCIATED(
atom%fmat)) cpabort(
"atom%fmat not associated")
399 ALLOCATE (fmat(nsgf, nsgf, 1))
401 IF (.NOT. ghost)
THEN
404 DO k1 = 1,
atom%basis%nbas(l)
405 DO k2 = 1,
atom%basis%nbas(l)
406 scal = sqrt(
atom%integrals%ovlp(k1, k1, l)*
atom%integrals%ovlp(k2, k2, l))
407 i = first_sgf(shell_index(l, k1), set_index(l, k1))
408 j = first_sgf(shell_index(l, k2), set_index(l, k2))
410 fmat(i + m, j + m, 1) =
atom%fmat%op(k1, k2, l)/scal
420 IF (
PRESENT(density))
THEN
421 IF (
ASSOCIATED(density))
DEALLOCATE (density)
422 ALLOCATE (density(nr))
430 IF (
PRESENT(wavefunction))
THEN
431 cpassert(
PRESENT(wfninfo))
432 IF (
ASSOCIATED(wavefunction))
DEALLOCATE (wavefunction)
433 IF (
ASSOCIATED(wfninfo))
DEALLOCATE (wfninfo)
434 mo = sum(
atom%state%maxn_occ)
435 ALLOCATE (wavefunction(nr, mo), wfninfo(2, mo))
436 wavefunction = 0.0_dp
437 IF (.NOT. ghost)
THEN
440 DO i = 1,
atom%state%maxn_occ(l)
441 IF (
atom%state%occupation(l, i) > 0.0_dp)
THEN
443 wfninfo(1, ii) =
atom%state%occupation(l, i)
444 wfninfo(2, ii) = real(l,
dp)
445 DO j = 1,
atom%basis%nbas(l)
446 wavefunction(:, ii) = wavefunction(:, ii) + &
447 atom%orbitals%wfn(j, i, l)*basis%bf(:, j, l)
464 DEALLOCATE (potential, basis, integrals)
479 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(INOUT) :: density
480 TYPE(atomic_kind_type),
POINTER :: atomic_kind
481 TYPE(qs_kind_type),
POINTER :: qs_kind
482 INTEGER,
INTENT(IN) :: ngto
483 INTEGER,
INTENT(IN),
OPTIONAL :: iunit
484 LOGICAL,
INTENT(IN),
OPTIONAL :: allelectron, confine
486 INTEGER,
PARAMETER :: num_gto = 40
488 INTEGER :: i, ii, k, l, ll, m, mb, mo, ngp, nn, nr, &
489 quadtype, relativistic, z
490 INTEGER,
DIMENSION(0:lmat) :: starti
491 INTEGER,
DIMENSION(0:lmat, 10) :: ncalc, ncore, nelem
492 INTEGER,
DIMENSION(:),
POINTER :: econf
493 LOGICAL :: ecp_semi_local
494 REAL(kind=
dp) :: al, aval, cc, cval, ear, rk, xx, zeff
495 REAL(kind=
dp),
DIMENSION(num_gto+2) :: results
496 TYPE(all_potential_type),
POINTER :: all_potential
497 TYPE(atom_basis_type),
POINTER :: basis
498 TYPE(atom_integrals),
POINTER :: integrals
499 TYPE(atom_orbitals),
POINTER :: orbitals
500 TYPE(atom_potential_type),
POINTER :: potential
501 TYPE(atom_type),
POINTER ::
atom
502 TYPE(grid_atom_type),
POINTER :: grid
503 TYPE(gth_potential_type),
POINTER :: gth_potential
504 TYPE(sgp_potential_type),
POINTER :: sgp_potential
510 NULLIFY (all_potential, gth_potential)
512 all_potential=all_potential, &
513 gth_potential=gth_potential, &
514 sgp_potential=sgp_potential)
516 IF (
PRESENT(allelectron))
THEN
517 IF (allelectron)
THEN
518 NULLIFY (gth_potential)
523 cpassert(ngto <= num_gto)
525 IF (
ASSOCIATED(gth_potential) .OR.
ASSOCIATED(sgp_potential))
THEN
535 pp_calc=(
ASSOCIATED(gth_potential) .OR.
ASSOCIATED(sgp_potential)), &
537 relativistic=relativistic, &
541 ALLOCATE (potential, basis, integrals)
543 IF (
PRESENT(confine))
THEN
544 potential%confinement = confine
546 IF (
ASSOCIATED(gth_potential) .OR.
ASSOCIATED(sgp_potential))
THEN
547 potential%confinement = .true.
549 potential%confinement = .false.
553 potential%acon = 200._dp
554 potential%rcon = 4.0_dp
555 potential%scon = 8.0_dp
557 IF (
ASSOCIATED(gth_potential))
THEN
559 CALL get_potential(gth_potential, zeff=zeff)
561 CALL set_atom(
atom, zcore=nint(zeff), potential=potential)
562 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
563 CALL get_potential(sgp_potential, ecp_semi_local=ecp_semi_local)
564 IF (ecp_semi_local)
THEN
566 CALL ecp_potential_conversion(sgp_potential, potential%ecp_pot)
567 potential%ecp_pot%symbol =
ptable(z)%symbol
570 CALL sgp_potential_conversion(sgp_potential, potential%sgp_pot)
571 potential%sgp_pot%symbol =
ptable(z)%symbol
573 CALL get_potential(sgp_potential, zeff=zeff)
574 CALL set_atom(
atom, zcore=nint(zeff), potential=potential)
589 NULLIFY (basis%am, basis%cm, basis%as, basis%ns, basis%bf, basis%dbf, basis%ddbf)
592 basis%eps_eig = 1.e-12_dp
595 basis%nprim = basis%nbas
596 m = maxval(basis%nbas)
597 ALLOCATE (basis%am(m, 0:
lmat))
600 DO i = 1, basis%nbas(l)
601 ll = i - 1 + starti(l)
602 basis%am(i, l) = aval*cval**(ll)
606 basis%geometrical = .true.
613 m = maxval(basis%nbas)
614 ALLOCATE (basis%bf(nr, m, 0:
lmat))
615 ALLOCATE (basis%dbf(nr, m, 0:
lmat))
616 ALLOCATE (basis%ddbf(nr, m, 0:
lmat))
621 DO i = 1, basis%nbas(l)
624 rk = basis%grid%rad(k)
625 ear = exp(-al*basis%grid%rad(k)**2)
626 basis%bf(k, i, l) = rk**l*ear
627 basis%dbf(k, i, l) = (real(l,
dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear
628 basis%ddbf(k, i, l) = (real(l*(l - 1),
dp)*rk**(l - 2) - &
629 2._dp*al*real(2*l + 1,
dp)*rk**(l) + 4._dp*al*rk**(l + 2))*ear
637 atom%optimization%damping = 0.2_dp
638 atom%optimization%eps_scf = 1.e-6_dp
639 atom%optimization%eps_diis = 100._dp
640 atom%optimization%max_iter = 50
641 atom%optimization%n_diis = 5
646 IF (
ASSOCIATED(gth_potential))
THEN
647 CALL get_potential(gth_potential, elec_conf=econf)
649 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
650 CALL get_potential(sgp_potential, elec_conf=econf)
653 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
668 ncalc = nelem - ncore
671 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
677 ALLOCATE (
atom%state)
679 atom%state%core = 0._dp
681 atom%state%occ = 0._dp
683 atom%state%occupation = 0._dp
684 atom%state%multiplicity = -1
688 IF (ncalc(l, i) > 0)
THEN
690 atom%state%occupation(l, k) = real(ncalc(l, i),
dp)
697 atom%state%maxl_calc =
atom%state%maxl_occ
698 atom%state%maxn_calc =
atom%state%maxn_occ
708 NULLIFY (integrals%tzora, integrals%hdkh)
713 mo = maxval(
atom%state%maxn_calc)
714 mb = maxval(
atom%basis%nbas)
718 IF (
PRESENT(iunit))
THEN
729 density(i, 1) = xx*cc**i
730 density(i, 2) = results(2 + i)
741 DEALLOCATE (potential, basis, integrals)
753 TYPE(atomic_kind_type),
INTENT(IN) :: atomic_kind
754 TYPE(qs_kind_type),
INTENT(IN) :: qs_kind
755 TYPE(rel_control_type),
POINTER :: rel_control
756 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: rtmat
758 INTEGER :: i, ii, ipgf, j, k, k1, k2, l, ll, m, n, &
759 ngp, nj, nn, nr, ns, nset, nsgf, &
760 quadtype, relativistic, z
761 INTEGER,
DIMENSION(0:lmat, 10) :: ncalc, ncore, nelem
762 INTEGER,
DIMENSION(0:lmat, 100) :: set_index, shell_index
763 INTEGER,
DIMENSION(:),
POINTER :: lmax, lmin, npgf, nshell
764 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf, last_sgf, ls
765 REAL(kind=
dp) :: al, alpha, ear, prefac, rk, zeff
766 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: omat
767 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: zet
768 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: gcc
769 TYPE(all_potential_type),
POINTER :: all_potential
770 TYPE(atom_basis_type),
POINTER :: basis
771 TYPE(atom_integrals),
POINTER :: integrals
772 TYPE(atom_potential_type),
POINTER :: potential
773 TYPE(atom_type),
POINTER ::
atom
774 TYPE(grid_atom_type),
POINTER :: grid
775 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
777 IF (rel_control%rel_method ==
rel_none)
RETURN
779 NULLIFY (all_potential, orb_basis_set)
780 CALL get_qs_kind(qs_kind, basis_set=orb_basis_set, all_potential=all_potential)
782 cpassert(
ASSOCIATED(orb_basis_set))
784 IF (
ASSOCIATED(all_potential))
THEN
791 NULLIFY (
atom%xc_section)
792 NULLIFY (
atom%orbitals)
794 alpha = sqrt(all_potential%alpha_core_charge)
797 SELECT CASE (rel_control%rel_method)
801 SELECT CASE (rel_control%rel_DKH_order)
814 SELECT CASE (rel_control%rel_zora_type)
829 relativistic=relativistic, &
833 ALLOCATE (potential, basis, integrals)
839 nset=nset, nshell=nshell, npgf=npgf, lmin=lmin, lmax=lmax, l=ls, nsgf=nsgf, zet=zet, gcc=gcc, &
840 first_sgf=first_sgf, last_sgf=last_sgf)
850 NULLIFY (basis%am, basis%cm, basis%as, basis%ns, basis%bf, basis%dbf, basis%ddbf)
852 basis%eps_eig = 1.e-12_dp
860 DO j = lmin(i), min(lmax(i),
lmat)
861 basis%nprim(j) = basis%nprim(j) + npgf(i)
866 basis%nbas(l) = basis%nbas(l) + 1
870 shell_index(l, k) = j
875 nj = maxval(basis%nprim)
876 ns = maxval(basis%nbas)
877 ALLOCATE (basis%am(nj, 0:
lmat))
879 ALLOCATE (basis%cm(nj, ns, 0:
lmat))
885 IF (j >= lmin(i) .AND. j <= lmax(i))
THEN
887 basis%am(nj + ipgf, j) = zet(ipgf, i)
890 IF (ls(ii, i) == j)
THEN
893 basis%cm(nj + ipgf, ns, j) = gcc(ipgf, ii, i)
905 prefac = 2.0_dp*sqrt(
pi/
dfac(2*j + 1))
906 DO ipgf = 1, basis%nprim(j)
907 DO ii = 1, basis%nbas(j)
908 basis%cm(ipgf, ii, j) = prefac*basis%cm(ipgf, ii, j)
915 m = maxval(basis%nbas)
916 ALLOCATE (basis%bf(nr, m, 0:
lmat))
917 ALLOCATE (basis%dbf(nr, m, 0:
lmat))
918 ALLOCATE (basis%ddbf(nr, m, 0:
lmat))
924 DO i = 1, basis%nprim(l)
927 rk = basis%grid%rad(k)
928 ear = exp(-al*basis%grid%rad(k)**2)
929 DO j = 1, basis%nbas(l)
930 basis%bf(k, j, l) = basis%bf(k, j, l) + rk**l*ear*basis%cm(i, j, l)
931 basis%dbf(k, j, l) = basis%dbf(k, j, l) &
932 + (real(l,
dp)*rk**(l - 1) - 2._dp*al*rk**(l + 1))*ear*basis%cm(i, j, l)
933 basis%ddbf(k, j, l) = basis%ddbf(k, j, l) + &
934 (real(l*(l - 1),
dp)*rk**(l - 2) - 2._dp*al*real(2*l + 1,
dp)* &
935 rk**(l) + 4._dp*al*rk**(l + 2))*ear*basis%cm(i, j, l)
944 atom%optimization%damping = 0.2_dp
945 atom%optimization%eps_scf = 1.e-6_dp
946 atom%optimization%eps_diis = 100._dp
947 atom%optimization%max_iter = 50
948 atom%optimization%n_diis = 5
954 DO l = 0, min(
lmat, ubound(
ptable(z)%e_conv, 1))
969 ncalc = nelem - ncore
971 IF (qs_kind%ghost .OR. qs_kind%floating)
THEN
977 ALLOCATE (
atom%state)
979 atom%state%core = 0._dp
981 atom%state%occ = 0._dp
983 atom%state%occupation = 0._dp
984 atom%state%multiplicity = -1
988 IF (ncalc(l, i) > 0)
THEN
990 atom%state%occupation(l, k) = real(ncalc(l, i),
dp)
997 atom%state%maxl_calc =
atom%state%maxl_occ
998 atom%state%maxn_calc =
atom%state%maxn_occ
1006 NULLIFY (integrals%tzora, integrals%hdkh)
1012 integrals%core = 0.0_dp
1016 ALLOCATE (omat(m, m))
1018 CALL sg_erfc(omat(1:m, 1:m), l, alpha, basis%am(1:m, l), basis%am(1:m, l))
1019 integrals%core(1:n, 1:n, l) = matmul(transpose(basis%cm(1:m, 1:n, l)), &
1020 matmul(omat(1:m, 1:m), basis%cm(1:m, 1:n, l)))
1026 IF (
ASSOCIATED(rtmat))
THEN
1029 ALLOCATE (rtmat(nsgf, nsgf))
1033 DO k1 = 1, basis%nbas(l)
1034 DO k2 = 1, basis%nbas(l)
1035 i = first_sgf(shell_index(l, k1), set_index(l, k1))
1036 j = first_sgf(shell_index(l, k2), set_index(l, k2))
1037 SELECT CASE (
atom%relativistic)
1042 rtmat(i + m, j + m) = integrals%tzora(k1, k2, l)
1046 rtmat(i + m, j + m) = integrals%hdkh(k1, k2, l) - integrals%kin(k1, k2, l) + &
1047 atom%zcore*integrals%core(k1, k2, l)
1055 rtmat(k1, k2) = 0.5_dp*(rtmat(k1, k2) + rtmat(k2, k1))
1056 rtmat(k2, k1) = rtmat(k1, k2)
1068 DEALLOCATE (potential, basis, integrals)
1072 IF (
ASSOCIATED(rtmat))
THEN
1087 TYPE(gth_potential_type),
POINTER :: gth_potential
1088 TYPE(atom_gthpot_type) :: gth_atompot
1090 INTEGER :: i, j, l, lm, n, ne, nexp_lpot, nexp_lsd, &
1092 INTEGER,
DIMENSION(:),
POINTER :: nct_lpot, nct_lsd, nct_nlcc, nppnl, &
1094 LOGICAL :: lpot_present, lsd_present, nlcc_present
1095 REAL(kind=
dp) :: ac, zeff
1096 REAL(kind=
dp),
DIMENSION(:),
POINTER :: alpha_lpot, alpha_lsd, alpha_nlcc, ap, ce
1097 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: cval_lpot, cval_lsd, cval_nlcc
1098 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: hp
1100 CALL get_potential(gth_potential, &
1102 elec_conf=ppeconf, &
1103 alpha_core_charge=ac, &
1111 gth_atompot%zion = zeff
1112 gth_atompot%rc = sqrt(0.5_dp/ac)
1113 gth_atompot%ncl = ne
1114 gth_atompot%cl(:) = 0._dp
1115 IF (ac > 0._dp)
THEN
1117 gth_atompot%cl(i) = ce(i)/(2._dp*ac)**(i - 1)
1121 gth_atompot%lpotextended = .false.
1122 gth_atompot%lsdpot = .false.
1123 gth_atompot%nlcc = .false.
1124 gth_atompot%nexp_lpot = 0
1125 gth_atompot%nexp_lsd = 0
1126 gth_atompot%nexp_nlcc = 0
1127 CALL get_potential(gth_potential, &
1128 lpot_present=lpot_present, &
1129 lsd_present=lsd_present, &
1130 nlcc_present=nlcc_present)
1131 IF (lpot_present)
THEN
1132 CALL get_potential(gth_potential, &
1133 nexp_lpot=nexp_lpot, &
1134 alpha_lpot=alpha_lpot, &
1135 nct_lpot=nct_lpot, &
1136 cval_lpot=cval_lpot)
1137 gth_atompot%lpotextended = .true.
1138 gth_atompot%nexp_lpot = nexp_lpot
1139 gth_atompot%alpha_lpot(1:nexp_lpot) = sqrt(0.5_dp/alpha_lpot(1:nexp_lpot))
1140 gth_atompot%nct_lpot(1:nexp_lpot) = nct_lpot(1:nexp_lpot)
1144 gth_atompot%cval_lpot(i, j) = cval_lpot(i, j)/(2._dp*ac)**(i - 1)
1148 IF (lsd_present)
THEN
1149 CALL get_potential(gth_potential, &
1150 nexp_lsd=nexp_lsd, &
1151 alpha_lsd=alpha_lsd, &
1154 gth_atompot%lsdpot = .true.
1155 gth_atompot%nexp_lsd = nexp_lsd
1156 gth_atompot%alpha_lsd(1:nexp_lsd) = sqrt(0.5_dp/alpha_lsd(1:nexp_lsd))
1157 gth_atompot%nct_lsd(1:nexp_lsd) = nct_lsd(1:nexp_lsd)
1161 gth_atompot%cval_lsd(i, j) = cval_lsd(i, j)/(2._dp*ac)**(i - 1)
1167 gth_atompot%nl(:) = 0
1168 gth_atompot%rcnl(:) = 0._dp
1169 gth_atompot%hnl(:, :, :) = 0._dp
1172 gth_atompot%nl(l) = n
1173 gth_atompot%rcnl(l) = sqrt(0.5_dp/ap(l))
1174 gth_atompot%hnl(1:n, 1:n, l) = hp(1:n, 1:n, l)
1177 IF (nlcc_present)
THEN
1178 CALL get_potential(gth_potential, &
1179 nexp_nlcc=nexp_nlcc, &
1180 alpha_nlcc=alpha_nlcc, &
1181 nct_nlcc=nct_nlcc, &
1182 cval_nlcc=cval_nlcc)
1183 gth_atompot%nlcc = .true.
1184 gth_atompot%nexp_nlcc = nexp_nlcc
1185 gth_atompot%alpha_nlcc(1:nexp_nlcc) = alpha_nlcc(1:nexp_nlcc)
1186 gth_atompot%nct_nlcc(1:nexp_nlcc) = nct_nlcc(1:nexp_nlcc)
1187 gth_atompot%cval_nlcc(1:4, 1:nexp_nlcc) = cval_nlcc(1:4, 1:nexp_nlcc)
1197 SUBROUTINE sgp_potential_conversion(sgp_potential, sgp_atompot)
1198 TYPE(sgp_potential_type),
POINTER :: sgp_potential
1199 TYPE(atom_sgppot_type) :: sgp_atompot
1202 INTEGER,
DIMENSION(:),
POINTER :: ppeconf
1203 LOGICAL :: nlcc_present
1204 REAL(kind=
dp) :: ac, zeff
1205 REAL(kind=
dp),
DIMENSION(:),
POINTER :: ap, ce
1206 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: hhp
1207 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: ccp
1209 CALL get_potential(sgp_potential, &
1210 name=sgp_atompot%pname, &
1212 elec_conf=ppeconf, &
1213 alpha_core_charge=ac)
1214 sgp_atompot%zion = zeff
1215 sgp_atompot%ac_local = ac
1216 sgp_atompot%econf(0:3) = ppeconf(0:3)
1217 CALL get_potential(sgp_potential, lmax=lm, &
1218 is_nonlocal=sgp_atompot%is_nonlocal, &
1219 n_nonlocal=n, a_nonlocal=ap, h_nonlocal=hhp, c_nonlocal=ccp)
1221 sgp_atompot%has_nonlocal = any(sgp_atompot%is_nonlocal)
1222 sgp_atompot%lmax = lm
1223 IF (sgp_atompot%has_nonlocal)
THEN
1224 cpassert(n <=
SIZE(sgp_atompot%a_nonlocal))
1225 sgp_atompot%n_nonlocal = n
1226 sgp_atompot%a_nonlocal(1:n) = ap(1:n)
1227 sgp_atompot%h_nonlocal(1:n, 0:lm) = hhp(1:n, 0:lm)
1228 sgp_atompot%c_nonlocal(1:n, 1:n, 0:lm) = ccp(1:n, 1:n, 0:lm)
1231 CALL get_potential(sgp_potential, n_local=n, a_local=ap, c_local=ce)
1232 cpassert(n <=
SIZE(sgp_atompot%a_local))
1233 sgp_atompot%n_local = n
1234 sgp_atompot%a_local(1:n) = ap(1:n)
1235 sgp_atompot%c_local(1:n) = ce(1:n)
1237 CALL get_potential(sgp_potential, has_nlcc=nlcc_present, &
1238 n_nlcc=n, a_nlcc=ap, c_nlcc=ce)
1239 IF (nlcc_present)
THEN
1240 sgp_atompot%has_nlcc = .true.
1241 cpassert(n <=
SIZE(sgp_atompot%a_nlcc))
1242 sgp_atompot%n_nlcc = n
1243 sgp_atompot%a_nlcc(1:n) = ap(1:n)
1244 sgp_atompot%c_nlcc(1:n) = ce(1:n)
1246 sgp_atompot%has_nlcc = .false.
1249 END SUBROUTINE sgp_potential_conversion
1256 SUBROUTINE ecp_potential_conversion(sgp_potential, ecp_atompot)
1257 TYPE(sgp_potential_type),
POINTER :: sgp_potential
1258 TYPE(atom_ecppot_type) :: ecp_atompot
1260 INTEGER,
DIMENSION(:),
POINTER :: ppeconf
1261 LOGICAL :: ecp_local, ecp_semi_local
1262 REAL(kind=
dp) :: zeff
1264 CALL get_potential(sgp_potential, ecp_local=ecp_local, ecp_semi_local=ecp_semi_local)
1265 cpassert(ecp_semi_local .AND. ecp_local)
1266 CALL get_potential(sgp_potential, &
1267 name=ecp_atompot%pname, &
1270 ecp_atompot%zion = zeff
1271 ecp_atompot%econf(0:3) = ppeconf(0:3)
1272 CALL get_potential(sgp_potential, lmax=ecp_atompot%lmax)
1274 CALL get_potential(sgp_potential, nloc=ecp_atompot%nloc, nrloc=ecp_atompot%nrloc, &
1275 aloc=ecp_atompot%aloc, bloc=ecp_atompot%bloc)
1277 CALL get_potential(sgp_potential, npot=ecp_atompot%npot, nrpot=ecp_atompot%nrpot, &
1278 apot=ecp_atompot%apot, bpot=ecp_atompot%bpot)
1280 END SUBROUTINE ecp_potential_conversion
subroutine, public sg_erfc(umat, l, a, pa, pb)
...
subroutine, public calculate_atom(atom, iw, noguess, converged)
General routine to perform electronic structure atomic calculations.
routines that fit parameters for /from atomic calculations
subroutine, public atom_fit_density(atom, num_gto, norder, iunit, powell_section, results)
Fit the atomic electron density using a geometrical Gaussian basis set.
calculate the orbitals for a given atomic kind type
subroutine, public calculate_atomic_density(density, atomic_kind, qs_kind, ngto, iunit, allelectron, confine)
...
subroutine, public calculate_atomic_relkin(atomic_kind, qs_kind, rel_control, rtmat)
...
subroutine, public calculate_atomic_orbitals(atomic_kind, qs_kind, agrid, iunit, pmat, fmat, density, wavefunction, wfninfo, confine, xc_section, nocc)
...
subroutine, public gth_potential_conversion(gth_potential, gth_atompot)
...
Calculate the atomic operator matrices.
subroutine, public atom_ppint_release(integrals)
Release memory allocated for atomic integrals (core electrons).
subroutine, public atom_int_setup(integrals, basis, potential, eri_coulomb, eri_exchange, all_nu)
Set up atomic integrals.
subroutine, public atom_relint_setup(integrals, basis, reltyp, zcore, alpha)
...
subroutine, public atom_relint_release(integrals)
Release memory allocated for atomic integrals (relativistic effects).
subroutine, public atom_ppint_setup(integrals, basis, potential)
...
subroutine, public atom_int_release(integrals)
Release memory allocated for atomic integrals (valence electrons).
subroutine, public set_kind_basis_atomic(basis, orb_basis_set, has_pp, agrid, cp2k_norm)
...
Define the atom type and its sub types.
subroutine, public create_atom_type(atom)
...
integer, parameter, public cgto_basis
integer, parameter, public gto_basis
subroutine, public release_atom_type(atom)
...
subroutine, public release_atom_potential(potential)
...
integer, parameter, public lmat
subroutine, public set_atom(atom, basis, state, integrals, orbitals, potential, zcore, pp_calc, do_zmp, doread, read_vxc, method_type, relativistic, coulomb_integral_type, exchange_integral_type, fmat)
...
subroutine, public release_atom_basis(basis)
...
subroutine, public create_atom_orbs(orbs, mbas, mo)
...
subroutine, public clementi_geobas(zval, cval, aval, ngto, ival)
...
Some basic routines for atomic calculations.
pure integer function, dimension(0:lmat), public get_maxn_occ(occupation)
Return the maximum principal quantum number of occupied orbitals.
subroutine, public atom_density(density, pmat, basis, maxl, typ, rr)
Map the electron density on an atomic radial grid.
pure integer function, public get_maxl_occ(occupation)
Return the maximum orbital quantum number of occupied orbitals.
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 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)
...
Definition of the atomic potential types.
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
real(kind=dp), dimension(-1:2 *maxfac+1), parameter, public dfac
Periodic Table related data definitions.
type(atom), dimension(0:nelem), public ptable
Definition of physical constants:
real(kind=dp), parameter, public bohr
subroutine, public allocate_grid_atom(grid_atom)
Initialize components of the grid_atom_type structure.
subroutine, public create_grid_atom(grid_atom, nr, na, llmax, ll, quadrature)
...
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, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, 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_r3d_rs_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_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public init_atom_electronic_state(atomic_kind, qs_kind, ncalc, ncore, nelem, edelta)
...
parameters that control a relativistic calculation