84 SUBROUTINE build_core_ae(matrix_h, matrix_p, force, virial, calculate_forces, use_virial, nder, &
85 qs_kind_set, atomic_kind_set, particle_set, sab_orb, sac_ae, &
86 nimages, cell_to_index, basis_type, atcore)
88 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p
91 LOGICAL,
INTENT(IN) :: calculate_forces
98 POINTER :: sab_orb, sac_ae
99 INTEGER,
INTENT(IN) :: nimages
100 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
101 CHARACTER(LEN=*),
INTENT(IN) :: basis_type
102 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT), &
105 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_core_ae'
107 INTEGER :: atom_a, handle, iatom, icol, ikind, img, irow, iset, jatom, jkind, jset, katom, &
108 kkind, ldai, ldsab, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, nb_plus, ncoa, &
109 ncob, nij, nkind, nseta, nsetb, nthread, sgfa, sgfb, slot
110 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
111 INTEGER,
DIMENSION(3) :: cellind
112 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
114 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
115 LOGICAL :: doat, dokp, found
116 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: active_set_pair, has_core_potential
117 REAL(kind=
dp) :: alpha_c, atk0, atk1, core_charge, core_radius, dab, dac, dbc, f0, rab2, &
118 rac2, rbc2, set_radius_a_max, set_radius_b_max, zeta_c
119 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: alpha_core_kind, core_charge_kind, &
120 core_radius_kind, ff, zeta_core_kind
121 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
122 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
123 REAL(kind=
dp),
DIMENSION(3) :: force_a, force_b, rab, rac, rbc
124 REAL(kind=
dp),
DIMENSION(3, 3) :: pv_thread
126 DIMENSION(:),
POINTER :: ap_iterator
130 REAL(kind=
dp),
DIMENSION(SIZE(particle_set)) :: at_thread
131 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
133 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
134 REAL(kind=
dp),
DIMENSION(3, SIZE(particle_set)) :: force_thread
145 IF (calculate_forces)
THEN
146 CALL timeset(routinen//
"_forces", handle)
148 CALL timeset(routinen, handle)
151 nkind =
SIZE(atomic_kind_set)
152 natom =
SIZE(particle_set)
154 doat =
PRESENT(atcore)
157 IF (calculate_forces .OR. doat)
THEN
158 IF (
SIZE(matrix_p, 1) == 2)
THEN
160 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
161 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
162 CALL dbcsr_add(matrix_p(2, img)%matrix, matrix_p(1, img)%matrix, &
163 alpha_scalar=-2.0_dp, beta_scalar=1.0_dp)
168 force_thread = 0.0_dp
172 ALLOCATE (basis_set_list(nkind))
173 ALLOCATE (has_core_potential(nkind), alpha_core_kind(nkind), zeta_core_kind(nkind), &
174 core_charge_kind(nkind), core_radius_kind(nkind))
175 has_core_potential(:) = .false.
176 alpha_core_kind(:) = 0.0_dp
177 zeta_core_kind(:) = 0.0_dp
178 core_charge_kind(:) = 0.0_dp
179 core_radius_kind(:) = 0.0_dp
181 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a, basis_type=basis_type)
182 IF (
ASSOCIATED(basis_set_a))
THEN
183 basis_set_list(ikind)%gto_basis_set => basis_set_a
185 NULLIFY (basis_set_list(ikind)%gto_basis_set)
187 CALL get_qs_kind(qs_kind_set(ikind), all_potential=all_potential, &
188 sgp_potential=sgp_potential)
189 IF (
ASSOCIATED(all_potential))
THEN
191 alpha_core_charge=alpha_core_kind(ikind), zeff=zeta_core_kind(ikind), &
192 ccore_charge=core_charge_kind(ikind), core_charge_radius=core_radius_kind(ikind))
193 has_core_potential(ikind) = .true.
194 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
196 alpha_core_charge=alpha_core_kind(ikind), zeff=zeta_core_kind(ikind), &
197 ccore_charge=core_charge_kind(ikind), core_charge_radius=core_radius_kind(ikind))
198 has_core_potential(ikind) = .true.
203 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
205 ldsab = max(maxco, maxsgf)
206 ldai =
ncoset(maxl + nder + 1)
246 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
247 ALLOCATE (verf(ldai, ldai, 2*maxl + nder + 1), vnuc(ldai, ldai, 2*maxl + nder + 1), ff(0:2*maxl + nder))
248 ALLOCATE (active_set_pair(maxnset*maxnset))
249 IF (calculate_forces .OR. doat)
THEN
250 ALLOCATE (pab(maxco, maxco, maxnset*maxnset))
254 DO slot = 1, sab_orb(1)%nl_size
256 ikind = sab_orb(1)%nlist_task(slot)%ikind
257 jkind = sab_orb(1)%nlist_task(slot)%jkind
258 iatom = sab_orb(1)%nlist_task(slot)%iatom
259 jatom = sab_orb(1)%nlist_task(slot)%jatom
260 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
261 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
263 basis_set_a => basis_set_list(ikind)%gto_basis_set
264 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
265 basis_set_b => basis_set_list(jkind)%gto_basis_set
266 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
270 first_sgfa => basis_set_a%first_sgf
271 la_max => basis_set_a%lmax
272 la_min => basis_set_a%lmin
273 npgfa => basis_set_a%npgf
274 nseta = basis_set_a%nset
275 nsgfa => basis_set_a%nsgf_set
276 rpgfa => basis_set_a%pgf_radius
277 set_radius_a => basis_set_a%set_radius
278 sphi_a => basis_set_a%sphi
279 zeta => basis_set_a%zet
280 set_radius_a_max = maxval(set_radius_a(1:nseta))
282 first_sgfb => basis_set_b%first_sgf
283 lb_max => basis_set_b%lmax
284 lb_min => basis_set_b%lmin
285 npgfb => basis_set_b%npgf
286 nsetb = basis_set_b%nset
287 nsgfb => basis_set_b%nsgf_set
288 rpgfb => basis_set_b%pgf_radius
289 set_radius_b => basis_set_b%set_radius
290 sphi_b => basis_set_b%sphi
291 zetb => basis_set_b%zet
292 set_radius_b_max = maxval(set_radius_b(1:nsetb))
294 dab = sqrt(sum(rab*rab))
299 nij = jset + (iset - 1)*maxnset
300 active_set_pair(nij) = set_radius_a(iset) + set_radius_b(jset) >= dab
305 img = cell_to_index(cellind(1), cellind(2), cellind(3))
311 IF (iatom == jatom)
THEN
318 IF (iatom <= jatom)
THEN
327 row=irow, col=icol, block=h_block, found=found)
328 IF (calculate_forces .OR. doat)
THEN
331 row=irow, col=icol, block=p_block, found=found)
332 cpassert(
ASSOCIATED(p_block))
335 ncoa = npgfa(iset)*
ncoset(la_max(iset))
336 sgfa = first_sgfa(1, iset)
338 nij = jset + (iset - 1)*maxnset
339 IF (.NOT. active_set_pair(nij)) cycle
340 ncob = npgfb(jset)*
ncoset(lb_max(jset))
341 sgfb = first_sgfb(1, jset)
343 IF (iatom <= jatom)
THEN
344 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
345 p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
347 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
348 transpose(p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1)))
350 pab(1:ncoa, 1:ncob, nij) = matmul(work(1:ncoa, 1:nsgfb(jset)), &
351 transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
358 ncoa = npgfa(iset)*
ncoset(la_max(iset))
360 nij = jset + (iset - 1)*maxnset
361 IF (.NOT. active_set_pair(nij)) cycle
362 ncob = npgfb(jset)*
ncoset(lb_max(jset))
363 hab(1:ncoa, 1:ncob, nij) = 0._dp
367 IF (.NOT. has_core_potential(kkind)) cycle
368 alpha_c = alpha_core_kind(kkind)
369 zeta_c = zeta_core_kind(kkind)
370 core_charge = core_charge_kind(kkind)
371 core_radius = core_radius_kind(kkind)
378 dac = sqrt(sum(rac*rac))
379 rbc(:) = rac(:) - rab(:)
380 dbc = sqrt(sum(rbc*rbc))
383 IF ((set_radius_a_max + core_radius < dac) .OR. &
384 (set_radius_b_max + core_radius < dbc))
THEN
389 IF (set_radius_a(iset) + core_radius < dac) cycle
390 ncoa = npgfa(iset)*
ncoset(la_max(iset))
391 sgfa = first_sgfa(1, iset)
393 nij = jset + (iset - 1)*maxnset
394 IF (.NOT. active_set_pair(nij)) cycle
395 IF (set_radius_b(jset) + core_radius < dbc) cycle
396 ncob = npgfb(jset)*
ncoset(lb_max(jset))
397 sgfb = first_sgfb(1, jset)
400 atk0 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
402 IF (calculate_forces)
THEN
403 na_plus = npgfa(iset)*
ncoset(la_max(iset) + nder)
404 nb_plus = npgfb(jset)*
ncoset(lb_max(jset))
405 ALLOCATE (habd(na_plus, nb_plus))
408 la_max(iset) + nder, npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
409 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
410 alpha_c, core_radius, zeta_c, core_charge, &
411 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:), &
417 CALL verfc_force(habd, pab(:, :, nij), force_a, force_b, nder, &
418 la_max(iset), la_min(iset), npgfa(iset), zeta(:, iset), &
419 lb_max(jset), lb_min(jset), npgfb(jset), zetb(:, jset), rab)
423 force_thread(1, iatom) = force_thread(1, iatom) + f0*force_a(1)
424 force_thread(2, iatom) = force_thread(2, iatom) + f0*force_a(2)
425 force_thread(3, iatom) = force_thread(3, iatom) + f0*force_a(3)
427 force_thread(1, jatom) = force_thread(1, jatom) + f0*force_b(1)
428 force_thread(2, jatom) = force_thread(2, jatom) + f0*force_b(2)
429 force_thread(3, jatom) = force_thread(3, jatom) + f0*force_b(3)
431 force_thread(1, katom) = force_thread(1, katom) - f0*force_a(1) - f0*force_b(1)
432 force_thread(2, katom) = force_thread(2, katom) - f0*force_a(2) - f0*force_b(2)
433 force_thread(3, katom) = force_thread(3, katom) - f0*force_a(3) - f0*force_b(3)
441 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
442 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
443 alpha_c, core_radius, zeta_c, core_charge, &
444 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
448 atk1 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
449 at_thread(katom) = at_thread(katom) + (atk1 - atk0)
457 sgfa = first_sgfa(1, iset)
458 ncoa = npgfa(iset)*
ncoset(la_max(iset))
460 nij = jset + (iset - 1)*maxnset
461 IF (.NOT. active_set_pair(nij)) cycle
462 ncob = npgfb(jset)*
ncoset(lb_max(jset))
463 sgfb = first_sgfb(1, jset)
466 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
467 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
469 IF (iatom <= jatom)
THEN
470 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
471 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
472 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
474 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
475 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
476 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
484 DEALLOCATE (hab, work, verf, vnuc, ff, active_set_pair)
485 IF (calculate_forces .OR. doat)
THEN
503 DEALLOCATE (basis_set_list, has_core_potential, alpha_core_kind, zeta_core_kind, &
504 core_charge_kind, core_radius_kind)
506 IF (calculate_forces .OR. doat)
THEN
509 IF (
SIZE(matrix_p, 1) == 2)
THEN
511 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
512 alpha_scalar=0.5_dp, beta_scalar=0.5_dp)
513 CALL dbcsr_add(matrix_p(2, img)%matrix, matrix_p(1, img)%matrix, &
514 alpha_scalar=-1.0_dp, beta_scalar=1.0_dp)
519 IF (calculate_forces)
THEN
523 atom_a = atom_of_kind(iatom)
524 ikind = kind_of(iatom)
525 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) + force_thread(:, iatom)
530 atcore(1:natom) = atcore(1:natom) + at_thread(1:natom)
533 IF (calculate_forces .AND. use_virial)
THEN
534 virial%pv_ppl = virial%pv_ppl + pv_thread
535 virial%pv_virial = virial%pv_virial + pv_thread
538 CALL timestop(handle)
559 SUBROUTINE verfc_force(habd, pab, fa, fb, nder, la_max, la_min, npgfa, zeta, lb_max, lb_min, npgfb, zetb, rab)
561 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: habd, pab
562 REAL(kind=
dp),
DIMENSION(3),
INTENT(OUT) :: fa, fb
563 INTEGER,
INTENT(IN) :: nder, la_max, la_min, npgfa
564 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: zeta
565 INTEGER,
INTENT(IN) :: lb_max, lb_min, npgfb
566 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: zetb
567 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
569 INTEGER :: ic_a, ic_b, icam1, icam2, icam3, icap1, &
570 icap2, icap3, icax, icbm1, icbm2, &
571 icbm3, icbx, icoa, icob, ipgfa, ipgfb, &
573 INTEGER,
DIMENSION(3) :: la, lb
574 REAL(kind=
dp) :: zax2, zbx2
580 nap =
ncoset(la_max + nder)
583 zax2 = zeta(ipgfa)*2.0_dp
585 zbx2 = zetb(ipgfb)*2.0_dp
587 la(1:3) =
indco(1:3, ic_a)
588 icap1 =
coset(la(1) + 1, la(2), la(3))
589 icap2 =
coset(la(1), la(2) + 1, la(3))
590 icap3 =
coset(la(1), la(2), la(3) + 1)
591 icam1 =
coset(la(1) - 1, la(2), la(3))
592 icam2 =
coset(la(1), la(2) - 1, la(3))
593 icam3 =
coset(la(1), la(2), la(3) - 1)
594 icoa = ic_a + (ipgfa - 1)*na
595 icax = (ipgfa - 1)*nap
598 lb(1:3) =
indco(1:3, ic_b)
599 icbm1 =
coset(lb(1) - 1, lb(2), lb(3))
600 icbm2 =
coset(lb(1), lb(2) - 1, lb(3))
601 icbm3 =
coset(lb(1), lb(2), lb(3) - 1)
602 icob = ic_b + (ipgfb - 1)*nb
603 icbx = (ipgfb - 1)*nb
605 fa(1) = fa(1) - pab(icoa, icob)*(-zax2*habd(icap1 + icax, icob) + &
606 REAL(la(1), kind=
dp)*habd(icam1 + icax, icob))
607 fa(2) = fa(2) - pab(icoa, icob)*(-zax2*habd(icap2 + icax, icob) + &
608 REAL(la(2), kind=
dp)*habd(icam2 + icax, icob))
609 fa(3) = fa(3) - pab(icoa, icob)*(-zax2*habd(icap3 + icax, icob) + &
610 REAL(la(3), kind=
dp)*habd(icam3 + icax, icob))
612 fb(1) = fb(1) - pab(icoa, icob)*( &
613 -zbx2*(habd(icap1 + icax, icob) - rab(1)*habd(ic_a + icax, icob)) + &
614 REAL(lb(1), kind=
dp)*habd(ic_a + icax, icbm1 + icbx))
615 fb(2) = fb(2) - pab(icoa, icob)*( &
616 -zbx2*(habd(icap2 + icax, icob) - rab(2)*habd(ic_a + icax, icob)) + &
617 REAL(lb(2), kind=
dp)*habd(ic_a + icax, icbm2 + icbx))
618 fb(3) = fb(3) - pab(icoa, icob)*( &
619 -zbx2*(habd(icap3 + icax, icob) - rab(3)*habd(ic_a + icax, icob)) + &
620 REAL(lb(3), kind=
dp)*habd(ic_a + icax, icbm3 + icbx))
643 SUBROUTINE build_erfc(matrix_h, matrix_p, qs_kind_set, atomic_kind_set, particle_set, &
644 calpha, ccore, eps_core_charge, sab_orb, sac_ae, atcore)
648 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
651 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: calpha, ccore
652 REAL(kind=
dp),
INTENT(IN) :: eps_core_charge
654 POINTER :: sab_orb, sac_ae
655 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT), &
658 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_erfc'
660 INTEGER :: handle, iatom, icol, ikind, img, irow, iset, jatom, jkind, jset, katom, kkind, &
661 ldai, ldsab, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, nb_plus, ncoa, ncob, &
662 nij, nkind, nseta, nsetb, nthread, sgfa, sgfb, slot
663 INTEGER,
DIMENSION(3) :: cellind
664 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
666 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
667 LOGICAL :: doat, found
668 REAL(kind=
dp) :: alpha_c, atk0, atk1, core_charge, &
669 core_radius, dab, dac, dbc, f0, rab2, &
671 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: ff
672 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
673 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
674 REAL(kind=
dp),
DIMENSION(3) :: rab, rac, rbc
675 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
676 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
679 DIMENSION(:),
POINTER :: ap_iterator
683 REAL(kind=
dp),
DIMENSION(SIZE(particle_set)) :: at_thread
694 CALL timeset(routinen, handle)
696 nkind =
SIZE(atomic_kind_set)
697 natom =
SIZE(particle_set)
699 doat =
PRESENT(atcore)
702 IF (
SIZE(matrix_p, 1) == 2)
THEN
703 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
704 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
705 CALL dbcsr_add(matrix_p(2)%matrix, matrix_p(1)%matrix, &
706 alpha_scalar=-2.0_dp, beta_scalar=1.0_dp)
712 ALLOCATE (basis_set_list(nkind))
714 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a)
715 IF (
ASSOCIATED(basis_set_a))
THEN
716 basis_set_list(ikind)%gto_basis_set => basis_set_a
718 NULLIFY (basis_set_list(ikind)%gto_basis_set)
723 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
725 ldsab = max(maxco, maxsgf)
764 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
765 ALLOCATE (verf(ldai, ldai, 2*maxl + 1), vnuc(ldai, ldai, 2*maxl + 1), ff(0:2*maxl))
767 ALLOCATE (pab(maxco, maxco, maxnset*maxnset))
771 DO slot = 1, sab_orb(1)%nl_size
773 ikind = sab_orb(1)%nlist_task(slot)%ikind
774 jkind = sab_orb(1)%nlist_task(slot)%jkind
775 iatom = sab_orb(1)%nlist_task(slot)%iatom
776 jatom = sab_orb(1)%nlist_task(slot)%jatom
777 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
778 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
780 basis_set_a => basis_set_list(ikind)%gto_basis_set
781 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
782 basis_set_b => basis_set_list(jkind)%gto_basis_set
783 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
787 first_sgfa => basis_set_a%first_sgf
788 la_max => basis_set_a%lmax
789 la_min => basis_set_a%lmin
790 npgfa => basis_set_a%npgf
791 nseta = basis_set_a%nset
792 nsgfa => basis_set_a%nsgf_set
793 rpgfa => basis_set_a%pgf_radius
794 set_radius_a => basis_set_a%set_radius
795 sphi_a => basis_set_a%sphi
796 zeta => basis_set_a%zet
798 first_sgfb => basis_set_b%first_sgf
799 lb_max => basis_set_b%lmax
800 lb_min => basis_set_b%lmin
801 npgfb => basis_set_b%npgf
802 nsetb = basis_set_b%nset
803 nsgfb => basis_set_b%nsgf_set
804 rpgfb => basis_set_b%pgf_radius
805 set_radius_b => basis_set_b%set_radius
806 sphi_b => basis_set_b%sphi
807 zetb => basis_set_b%zet
809 dab = sqrt(sum(rab*rab))
813 IF (iatom == jatom)
THEN
820 IF (iatom <= jatom)
THEN
829 row=irow, col=icol, block=h_block, found=found)
833 row=irow, col=icol, block=p_block, found=found)
834 cpassert(
ASSOCIATED(p_block))
837 ncoa = npgfa(iset)*
ncoset(la_max(iset))
838 sgfa = first_sgfa(1, iset)
840 ncob = npgfb(jset)*
ncoset(lb_max(jset))
841 sgfb = first_sgfb(1, jset)
842 nij = jset + (iset - 1)*maxnset
844 IF (iatom <= jatom)
THEN
845 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
846 p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
848 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
849 transpose(p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1)))
851 pab(1:ncoa, 1:ncob, nij) = matmul(work(1:ncoa, 1:nsgfb(jset)), &
852 transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
861 alpha_c = calpha(kkind)
862 core_charge = ccore(kkind)
863 core_radius =
exp_radius(0, alpha_c, eps_core_charge, core_charge)
864 core_radius = max(core_radius, 10.0_dp)
871 dac = sqrt(sum(rac*rac))
872 rbc(:) = rac(:) - rab(:)
873 dbc = sqrt(sum(rbc*rbc))
874 IF ((maxval(set_radius_a(:)) + core_radius < dac) .OR. &
875 (maxval(set_radius_b(:)) + core_radius < dbc))
THEN
880 IF (set_radius_a(iset) + core_radius < dac) cycle
881 ncoa = npgfa(iset)*
ncoset(la_max(iset))
882 sgfa = first_sgfa(1, iset)
884 IF (set_radius_b(jset) + core_radius < dbc) cycle
885 ncob = npgfb(jset)*
ncoset(lb_max(jset))
886 sgfb = first_sgfb(1, jset)
887 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
891 nij = jset + (iset - 1)*maxnset
893 atk0 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
897 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
898 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
899 alpha_c, core_radius, zeta_c, core_charge, &
900 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
903 atk1 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
904 at_thread(katom) = at_thread(katom) + (atk1 - atk0)
912 ncoa = npgfa(iset)*
ncoset(la_max(iset))
913 sgfa = first_sgfa(1, iset)
915 ncob = npgfb(jset)*
ncoset(lb_max(jset))
916 sgfb = first_sgfb(1, jset)
917 nij = jset + (iset - 1)*maxnset
920 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
921 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
923 IF (iatom <= jatom)
THEN
924 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
925 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
926 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
928 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
929 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
930 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
938 DEALLOCATE (hab, work, verf, vnuc, ff)
954 DEALLOCATE (basis_set_list)
959 IF (
SIZE(matrix_p, 1) == 2)
THEN
960 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
961 alpha_scalar=0.5_dp, beta_scalar=0.5_dp)
962 CALL dbcsr_add(matrix_p(2)%matrix, matrix_p(1)%matrix, &
963 alpha_scalar=-1.0_dp, beta_scalar=1.0_dp)
968 atcore(1:natom) = atcore(1:natom) + at_thread(1:natom)
971 CALL timestop(handle)
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.