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, max_na_plus, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, &
109 nb_plus, ncoa, 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 :: any_habd, doat, dokp, found, need_pab
116 LOGICAL,
ALLOCATABLE,
DIMENSION(:) :: active_set_pair, has_core_potential, &
118 REAL(kind=
dp) :: alpha_c, atk0, atk1, core_charge, core_radius, dab, dac, dbc, f0, rab2, &
119 rac2, rbc2, set_radius_a_max, set_radius_b_max, zeta_c
120 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: alpha_core_kind, core_charge_kind, &
121 core_radius_kind, ff, zeta_core_kind
122 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
123 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
124 REAL(kind=
dp),
DIMENSION(3) :: force_a, force_b, rab, rac, rbc
125 REAL(kind=
dp),
DIMENSION(3, 3) :: pv_thread
127 DIMENSION(:),
POINTER :: ap_iterator
131 REAL(kind=
dp),
DIMENSION(SIZE(particle_set)) :: at_thread
132 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
134 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
135 REAL(kind=
dp),
DIMENSION(3, SIZE(particle_set)) :: force_thread
146 IF (calculate_forces)
THEN
147 CALL timeset(routinen//
"_forces", handle)
149 CALL timeset(routinen, handle)
152 nkind =
SIZE(atomic_kind_set)
153 natom =
SIZE(particle_set)
155 doat =
PRESENT(atcore)
158 IF (calculate_forces .OR. doat)
THEN
159 IF (
SIZE(matrix_p, 1) == 2)
THEN
161 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
162 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
163 CALL dbcsr_add(matrix_p(2, img)%matrix, matrix_p(1, img)%matrix, &
164 alpha_scalar=-2.0_dp, beta_scalar=1.0_dp)
169 force_thread = 0.0_dp
173 ALLOCATE (basis_set_list(nkind))
174 ALLOCATE (has_core_potential(nkind), alpha_core_kind(nkind), zeta_core_kind(nkind), &
175 core_charge_kind(nkind), core_radius_kind(nkind))
176 has_core_potential(:) = .false.
177 alpha_core_kind(:) = 0.0_dp
178 zeta_core_kind(:) = 0.0_dp
179 core_charge_kind(:) = 0.0_dp
180 core_radius_kind(:) = 0.0_dp
182 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a, basis_type=basis_type)
183 IF (
ASSOCIATED(basis_set_a))
THEN
184 basis_set_list(ikind)%gto_basis_set => basis_set_a
186 NULLIFY (basis_set_list(ikind)%gto_basis_set)
188 CALL get_qs_kind(qs_kind_set(ikind), all_potential=all_potential, &
189 sgp_potential=sgp_potential)
190 IF (
ASSOCIATED(all_potential))
THEN
192 alpha_core_charge=alpha_core_kind(ikind), zeff=zeta_core_kind(ikind), &
193 ccore_charge=core_charge_kind(ikind), core_charge_radius=core_radius_kind(ikind))
194 has_core_potential(ikind) = .true.
195 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
197 alpha_core_charge=alpha_core_kind(ikind), zeff=zeta_core_kind(ikind), &
198 ccore_charge=core_charge_kind(ikind), core_charge_radius=core_radius_kind(ikind))
199 has_core_potential(ikind) = .true.
204 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
206 IF (calculate_forces)
CALL get_qs_kind_set(qs_kind_set, basis_type=basis_type, &
207 maxco=max_na_plus, maxder=nder)
209 ldsab = max(maxco, maxsgf)
210 ldai =
ncoset(maxl + nder + 1)
250 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
251 ALLOCATE (verf(ldai, ldai, 2*maxl + nder + 1), vnuc(ldai, ldai, 2*maxl + nder + 1), ff(0:2*maxl + nder))
252 ALLOCATE (active_set_pair(maxnset*maxnset))
253 IF (calculate_forces .OR. doat)
ALLOCATE (pab(maxco, maxco, maxnset*maxnset), pab_ready(maxnset*maxnset))
254 IF (calculate_forces)
ALLOCATE (habd(max(1, max_na_plus), max(1, maxco)))
257 DO slot = 1, sab_orb(1)%nl_size
259 ikind = sab_orb(1)%nlist_task(slot)%ikind
260 jkind = sab_orb(1)%nlist_task(slot)%jkind
261 iatom = sab_orb(1)%nlist_task(slot)%iatom
262 jatom = sab_orb(1)%nlist_task(slot)%jatom
263 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
264 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
266 basis_set_a => basis_set_list(ikind)%gto_basis_set
267 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
268 basis_set_b => basis_set_list(jkind)%gto_basis_set
269 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
273 first_sgfa => basis_set_a%first_sgf
274 la_max => basis_set_a%lmax
275 la_min => basis_set_a%lmin
276 npgfa => basis_set_a%npgf
277 nseta = basis_set_a%nset
278 nsgfa => basis_set_a%nsgf_set
279 rpgfa => basis_set_a%pgf_radius
280 set_radius_a => basis_set_a%set_radius
281 sphi_a => basis_set_a%sphi
282 zeta => basis_set_a%zet
283 set_radius_a_max = maxval(set_radius_a(1:nseta))
285 first_sgfb => basis_set_b%first_sgf
286 lb_max => basis_set_b%lmax
287 lb_min => basis_set_b%lmin
288 npgfb => basis_set_b%npgf
289 nsetb = basis_set_b%nset
290 nsgfb => basis_set_b%nsgf_set
291 rpgfb => basis_set_b%pgf_radius
292 set_radius_b => basis_set_b%set_radius
293 sphi_b => basis_set_b%sphi
294 zetb => basis_set_b%zet
295 set_radius_b_max = maxval(set_radius_b(1:nsetb))
297 dab = sqrt(sum(rab*rab))
298 IF (set_radius_a_max + set_radius_b_max < dab) cycle
303 nij = jset + (iset - 1)*maxnset
304 active_set_pair(nij) = set_radius_a(iset) + set_radius_b(jset) >= dab
309 img = cell_to_index(cellind(1), cellind(2), cellind(3))
315 IF (iatom == jatom)
THEN
322 IF (iatom <= jatom)
THEN
331 row=irow, col=icol, block=h_block, found=found)
332 IF (calculate_forces .OR. doat)
THEN
335 row=irow, col=icol, block=p_block, found=found)
336 cpassert(
ASSOCIATED(p_block))
337 pab_ready(1:maxnset*maxnset) = .false.
342 ncoa = npgfa(iset)*
ncoset(la_max(iset))
344 nij = jset + (iset - 1)*maxnset
345 IF (.NOT. active_set_pair(nij)) cycle
346 ncob = npgfb(jset)*
ncoset(lb_max(jset))
347 hab(1:ncoa, 1:ncob, nij) = 0._dp
351 IF (.NOT. has_core_potential(kkind)) cycle
352 alpha_c = alpha_core_kind(kkind)
353 zeta_c = zeta_core_kind(kkind)
354 core_charge = core_charge_kind(kkind)
355 core_radius = core_radius_kind(kkind)
362 dac = sqrt(sum(rac*rac))
363 rbc(:) = rac(:) - rab(:)
364 dbc = sqrt(sum(rbc*rbc))
367 IF ((set_radius_a_max + core_radius < dac) .OR. &
368 (set_radius_b_max + core_radius < dbc))
THEN
373 IF (set_radius_a(iset) + core_radius < dac) cycle
374 ncoa = npgfa(iset)*
ncoset(la_max(iset))
375 sgfa = first_sgfa(1, iset)
377 nij = jset + (iset - 1)*maxnset
378 IF (.NOT. active_set_pair(nij)) cycle
379 IF (set_radius_b(jset) + core_radius < dbc) cycle
380 ncob = npgfb(jset)*
ncoset(lb_max(jset))
381 sgfb = first_sgfb(1, jset)
385 IF (pab_ready(nij)) atk0 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
387 IF (calculate_forces)
THEN
388 na_plus = npgfa(iset)*
ncoset(la_max(iset) + nder)
389 nb_plus = npgfb(jset)*
ncoset(lb_max(jset))
390 habd(1:na_plus, 1:nb_plus) = 0._dp
392 la_max(iset) + nder, npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
393 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
394 alpha_c, core_radius, zeta_c, core_charge, &
395 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:), &
397 any_habd = any(habd(1:na_plus, 1:nb_plus) /= 0.0_dp)
400 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
401 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
402 alpha_c, core_radius, zeta_c, core_charge, &
403 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
406 IF (calculate_forces .OR. doat)
THEN
407 IF (.NOT. pab_ready(nij))
THEN
409 IF (doat .AND. .NOT. need_pab) need_pab = any(hab(1:ncoa, 1:ncob, nij) /= 0.0_dp)
412 IF (iatom <= jatom)
THEN
413 work(1:ncoa, 1:nsgfb(jset)) = &
414 matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
415 p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
417 work(1:ncoa, 1:nsgfb(jset)) = &
418 matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
419 transpose(p_block(sgfb:sgfb + nsgfb(jset) - 1, &
420 sgfa:sgfa + nsgfa(iset) - 1)))
422 pab(1:ncoa, 1:ncob, nij) = &
423 matmul(work(1:ncoa, 1:nsgfb(jset)), &
424 transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
425 pab_ready(nij) = .true.
433 CALL verfc_force(habd, pab(:, :, nij), force_a, force_b, nder, &
434 la_max(iset), la_min(iset), npgfa(iset), zeta(:, iset), &
435 lb_max(jset), lb_min(jset), npgfb(jset), zetb(:, jset), rab)
436 force_thread(1:3, iatom) = force_thread(1:3, iatom) + f0*force_a(1:3)
437 force_thread(1:3, jatom) = force_thread(1:3, jatom) + f0*force_b(1:3)
438 force_thread(1:3, katom) = force_thread(1:3, katom) - f0*force_a(1:3) - f0*force_b(1:3)
446 IF (pab_ready(nij))
THEN
447 atk1 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
448 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 IF (.NOT. any(hab(1:ncoa, 1:ncob, nij) /= 0.0_dp)) cycle
464 sgfb = first_sgfb(1, jset)
467 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
468 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
470 IF (iatom <= jatom)
THEN
471 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
472 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
473 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
475 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
476 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
477 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
485 DEALLOCATE (hab, work, verf, vnuc, ff, active_set_pair)
486 IF (calculate_forces .OR. doat)
DEALLOCATE (pab, pab_ready)
487 IF (calculate_forces)
DEALLOCATE (habd)
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_a_min, ic_b, ic_b_min, icax, &
570 icbx, icob, icob_m, icpa, idir, ipgfa, &
572 INTEGER,
DIMENSION(3) :: la, lb
573 INTEGER,
DIMENSION(ncoset(lb_max), 3) :: icbm
574 INTEGER,
DIMENSION(ncoset(la_max), 3) :: icam, icap
575 REAL(kind=
dp) :: pval, s0, smb, zax2, zbx2
576 REAL(kind=
dp),
DIMENSION(3) :: sma,
sp
577 REAL(kind=
dp),
DIMENSION(ncoset(la_max), 3) :: rla
583 nap =
ncoset(la_max + nder)
585 ic_a_min =
ncoset(la_min - 1) + 1
586 ic_b_min =
ncoset(lb_min - 1) + 1
587 DO ic_a = ic_a_min, na
588 la(1:3) =
indco(1:3, ic_a)
589 rla(ic_a, 1:3) = real(la(1:3), kind=
dp)
590 icap(ic_a, 1) =
coset(la(1) + 1, la(2), la(3))
591 icap(ic_a, 2) =
coset(la(1), la(2) + 1, la(3))
592 icap(ic_a, 3) =
coset(la(1), la(2), la(3) + 1)
593 icam(ic_a, 1) =
coset(la(1) - 1, la(2), la(3))
594 icam(ic_a, 2) =
coset(la(1), la(2) - 1, la(3))
595 icam(ic_a, 3) =
coset(la(1), la(2), la(3) - 1)
597 DO ic_b = ic_b_min, nb
598 lb(1:3) =
indco(1:3, ic_b)
599 icbm(ic_b, 1) =
coset(lb(1) - 1, lb(2), lb(3))
600 icbm(ic_b, 2) =
coset(lb(1), lb(2) - 1, lb(3))
601 icbm(ic_b, 3) =
coset(lb(1), lb(2), lb(3) - 1)
604 zbx2 = zetb(ipgfb)*2.0_dp
605 icbx = (ipgfb - 1)*nb
607 icax = (ipgfa - 1)*nap
608 IF (.NOT. any(habd(icax + 1:icax + nap, icbx + 1:icbx + nb) /= 0.0_dp)) cycle
609 zax2 = zeta(ipgfa)*2.0_dp
610 icpa = (ipgfa - 1)*na
614 DO ic_b = ic_b_min, nb
615 lb(1:3) =
indco(1:3, ic_b)
617 DO ic_a = ic_a_min, na
618 pval = pab(icpa + ic_a, icob)
619 s0 = s0 + pval*habd(icax + ic_a, icob)
620 sp(1) =
sp(1) + pval*habd(icax + icap(ic_a, 1), icob)
621 sp(2) =
sp(2) + pval*habd(icax + icap(ic_a, 2), icob)
622 sp(3) =
sp(3) + pval*habd(icax + icap(ic_a, 3), icob)
623 sma(1) = sma(1) + pval*(rla(ic_a, 1)*habd(icax + icam(ic_a, 1), icob))
624 sma(2) = sma(2) + pval*(rla(ic_a, 2)*habd(icax + icam(ic_a, 2), icob))
625 sma(3) = sma(3) + pval*(rla(ic_a, 3)*habd(icax + icam(ic_a, 3), icob))
628 IF (lb(idir) > 0)
THEN
629 icob_m = icbx + icbm(ic_b, idir)
631 DO ic_a = ic_a_min, na
632 smb = smb + pab(icpa + ic_a, icob)*habd(icax + ic_a, icob_m)
634 fb(idir) = fb(idir) - real(lb(idir), kind=
dp)*smb
638 fa(1:3) = fa(1:3) + zax2*
sp(1:3) - sma(1:3)
639 fb(1:3) = fb(1:3) + zbx2*(
sp(1:3) - rab(1:3)*s0)
659 SUBROUTINE build_erfc(matrix_h, matrix_p, qs_kind_set, atomic_kind_set, particle_set, &
660 calpha, ccore, eps_core_charge, sab_orb, sac_ae, atcore)
664 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
667 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: calpha, ccore
668 REAL(kind=
dp),
INTENT(IN) :: eps_core_charge
670 POINTER :: sab_orb, sac_ae
671 REAL(kind=
dp),
DIMENSION(:),
INTENT(INOUT), &
674 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_erfc'
676 INTEGER :: handle, iatom, icol, ikind, img, irow, iset, jatom, jkind, jset, katom, kkind, &
677 ldai, ldsab, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, nb_plus, ncoa, ncob, &
678 nij, nkind, nseta, nsetb, nthread, sgfa, sgfb, slot
679 INTEGER,
DIMENSION(3) :: cellind
680 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
682 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
683 LOGICAL :: doat, found
684 REAL(kind=
dp) :: alpha_c, atk0, atk1, core_charge, &
685 core_radius, dab, dac, dbc, f0, rab2, &
687 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: ff
688 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
689 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
690 REAL(kind=
dp),
DIMENSION(3) :: rab, rac, rbc
691 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
692 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
695 DIMENSION(:),
POINTER :: ap_iterator
699 REAL(kind=
dp),
DIMENSION(SIZE(particle_set)) :: at_thread
710 CALL timeset(routinen, handle)
712 nkind =
SIZE(atomic_kind_set)
713 natom =
SIZE(particle_set)
715 doat =
PRESENT(atcore)
718 IF (
SIZE(matrix_p, 1) == 2)
THEN
719 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
720 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
721 CALL dbcsr_add(matrix_p(2)%matrix, matrix_p(1)%matrix, &
722 alpha_scalar=-2.0_dp, beta_scalar=1.0_dp)
728 ALLOCATE (basis_set_list(nkind))
730 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a)
731 IF (
ASSOCIATED(basis_set_a))
THEN
732 basis_set_list(ikind)%gto_basis_set => basis_set_a
734 NULLIFY (basis_set_list(ikind)%gto_basis_set)
739 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
741 ldsab = max(maxco, maxsgf)
780 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
781 ALLOCATE (verf(ldai, ldai, 2*maxl + 1), vnuc(ldai, ldai, 2*maxl + 1), ff(0:2*maxl))
783 ALLOCATE (pab(maxco, maxco, maxnset*maxnset))
787 DO slot = 1, sab_orb(1)%nl_size
789 ikind = sab_orb(1)%nlist_task(slot)%ikind
790 jkind = sab_orb(1)%nlist_task(slot)%jkind
791 iatom = sab_orb(1)%nlist_task(slot)%iatom
792 jatom = sab_orb(1)%nlist_task(slot)%jatom
793 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
794 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
796 basis_set_a => basis_set_list(ikind)%gto_basis_set
797 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
798 basis_set_b => basis_set_list(jkind)%gto_basis_set
799 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
803 first_sgfa => basis_set_a%first_sgf
804 la_max => basis_set_a%lmax
805 la_min => basis_set_a%lmin
806 npgfa => basis_set_a%npgf
807 nseta = basis_set_a%nset
808 nsgfa => basis_set_a%nsgf_set
809 rpgfa => basis_set_a%pgf_radius
810 set_radius_a => basis_set_a%set_radius
811 sphi_a => basis_set_a%sphi
812 zeta => basis_set_a%zet
814 first_sgfb => basis_set_b%first_sgf
815 lb_max => basis_set_b%lmax
816 lb_min => basis_set_b%lmin
817 npgfb => basis_set_b%npgf
818 nsetb = basis_set_b%nset
819 nsgfb => basis_set_b%nsgf_set
820 rpgfb => basis_set_b%pgf_radius
821 set_radius_b => basis_set_b%set_radius
822 sphi_b => basis_set_b%sphi
823 zetb => basis_set_b%zet
825 dab = sqrt(sum(rab*rab))
829 IF (iatom == jatom)
THEN
836 IF (iatom <= jatom)
THEN
845 row=irow, col=icol, block=h_block, found=found)
849 row=irow, col=icol, block=p_block, found=found)
850 cpassert(
ASSOCIATED(p_block))
853 ncoa = npgfa(iset)*
ncoset(la_max(iset))
854 sgfa = first_sgfa(1, iset)
856 ncob = npgfb(jset)*
ncoset(lb_max(jset))
857 sgfb = first_sgfb(1, jset)
858 nij = jset + (iset - 1)*maxnset
860 IF (iatom <= jatom)
THEN
861 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
862 p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
864 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
865 transpose(p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1)))
867 pab(1:ncoa, 1:ncob, nij) = matmul(work(1:ncoa, 1:nsgfb(jset)), &
868 transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
877 alpha_c = calpha(kkind)
878 core_charge = ccore(kkind)
879 core_radius =
exp_radius(0, alpha_c, eps_core_charge, core_charge)
880 core_radius = max(core_radius, 10.0_dp)
887 dac = sqrt(sum(rac*rac))
888 rbc(:) = rac(:) - rab(:)
889 dbc = sqrt(sum(rbc*rbc))
890 IF ((maxval(set_radius_a(:)) + core_radius < dac) .OR. &
891 (maxval(set_radius_b(:)) + core_radius < dbc))
THEN
896 IF (set_radius_a(iset) + core_radius < dac) cycle
897 ncoa = npgfa(iset)*
ncoset(la_max(iset))
898 sgfa = first_sgfa(1, iset)
900 IF (set_radius_b(jset) + core_radius < dbc) cycle
901 ncob = npgfb(jset)*
ncoset(lb_max(jset))
902 sgfb = first_sgfb(1, jset)
903 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
907 nij = jset + (iset - 1)*maxnset
909 atk0 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
913 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
914 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
915 alpha_c, core_radius, zeta_c, core_charge, &
916 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
919 atk1 = f0*sum(hab(1:ncoa, 1:ncob, nij)*pab(1:ncoa, 1:ncob, nij))
920 at_thread(katom) = at_thread(katom) + (atk1 - atk0)
928 ncoa = npgfa(iset)*
ncoset(la_max(iset))
929 sgfa = first_sgfa(1, iset)
931 ncob = npgfb(jset)*
ncoset(lb_max(jset))
932 sgfb = first_sgfb(1, jset)
933 nij = jset + (iset - 1)*maxnset
936 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
937 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
939 IF (iatom <= jatom)
THEN
940 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
941 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
942 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
944 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
945 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
946 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
954 DEALLOCATE (hab, work, verf, vnuc, ff)
970 DEALLOCATE (basis_set_list)
975 IF (
SIZE(matrix_p, 1) == 2)
THEN
976 CALL dbcsr_add(matrix_p(1)%matrix, matrix_p(2)%matrix, &
977 alpha_scalar=0.5_dp, beta_scalar=0.5_dp)
978 CALL dbcsr_add(matrix_p(2)%matrix, matrix_p(1)%matrix, &
979 alpha_scalar=-1.0_dp, beta_scalar=1.0_dp)
984 atcore(1:natom) = atcore(1:natom) + at_thread(1:natom)
987 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, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, 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.