21 USE dbcsr_api,
ONLY: dbcsr_add,&
40 neighbor_list_iterator_p_type,&
42 neighbor_list_set_p_type,&
53 #include "./base/base_uses.f90"
59 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'core_ae'
82 SUBROUTINE build_core_ae(matrix_h, matrix_p, force, virial, calculate_forces, use_virial, nder, &
83 qs_kind_set, atomic_kind_set, particle_set, sab_orb, sac_ae, nimages, cell_to_index)
85 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p
86 TYPE(qs_force_type),
DIMENSION(:),
POINTER :: force
87 TYPE(virial_type),
POINTER :: virial
88 LOGICAL,
INTENT(IN) :: calculate_forces
91 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
92 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
93 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
94 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
95 POINTER :: sab_orb, sac_ae
96 INTEGER,
INTENT(IN) :: nimages
97 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
99 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_core_ae'
101 INTEGER :: atom_a, handle, iatom, icol, ikind, img, irow, iset, jatom, jkind, jset, katom, &
102 kkind, ldai, ldsab, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, nb_plus, ncoa, &
103 ncob, nij, nkind, nseta, nsetb, nthread, sgfa, sgfb, slot
104 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
105 INTEGER,
DIMENSION(3) :: cellind
106 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
108 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
109 LOGICAL :: dokp, found
110 REAL(kind=
dp) :: alpha_c, core_charge, core_radius, dab, &
111 dac, dbc, f0, rab2, rac2, rbc2, zeta_c
112 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: ff
113 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
114 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
115 REAL(kind=
dp),
DIMENSION(3) :: force_a, force_b, rab, rac, rbc
116 REAL(kind=
dp),
DIMENSION(3, 3) :: pv_thread
117 TYPE(neighbor_list_iterator_p_type), &
118 DIMENSION(:),
POINTER :: ap_iterator
119 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
120 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
121 TYPE(all_potential_type),
POINTER :: all_potential
122 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
124 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
125 REAL(kind=
dp),
DIMENSION(3, SIZE(particle_set)) :: force_thread
126 TYPE(sgp_potential_type),
POINTER :: sgp_potential
136 IF (calculate_forces)
THEN
137 CALL timeset(routinen//
"_forces", handle)
139 CALL timeset(routinen, handle)
142 nkind =
SIZE(atomic_kind_set)
143 natom =
SIZE(particle_set)
147 IF (calculate_forces)
THEN
148 IF (
SIZE(matrix_p, 1) == 2)
THEN
150 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
151 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
152 CALL dbcsr_add(matrix_p(2, img)%matrix, matrix_p(1, img)%matrix, &
153 alpha_scalar=-2.0_dp, beta_scalar=1.0_dp)
158 force_thread = 0.0_dp
161 ALLOCATE (basis_set_list(nkind))
163 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a)
164 IF (
ASSOCIATED(basis_set_a))
THEN
165 basis_set_list(ikind)%gto_basis_set => basis_set_a
167 NULLIFY (basis_set_list(ikind)%gto_basis_set)
172 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
174 ldsab = max(maxco, maxsgf)
175 ldai =
ncoset(maxl + nder + 1)
213 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
214 ALLOCATE (verf(ldai, ldai, 2*maxl + nder + 1), vnuc(ldai, ldai, 2*maxl + nder + 1), ff(0:2*maxl + nder))
215 IF (calculate_forces)
THEN
216 ALLOCATE (pab(maxco, maxco, maxnset*maxnset))
220 DO slot = 1, sab_orb(1)%nl_size
222 ikind = sab_orb(1)%nlist_task(slot)%ikind
223 jkind = sab_orb(1)%nlist_task(slot)%jkind
224 iatom = sab_orb(1)%nlist_task(slot)%iatom
225 jatom = sab_orb(1)%nlist_task(slot)%jatom
226 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
227 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
229 basis_set_a => basis_set_list(ikind)%gto_basis_set
230 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
231 basis_set_b => basis_set_list(jkind)%gto_basis_set
232 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
236 first_sgfa => basis_set_a%first_sgf
237 la_max => basis_set_a%lmax
238 la_min => basis_set_a%lmin
239 npgfa => basis_set_a%npgf
240 nseta = basis_set_a%nset
241 nsgfa => basis_set_a%nsgf_set
242 rpgfa => basis_set_a%pgf_radius
243 set_radius_a => basis_set_a%set_radius
244 sphi_a => basis_set_a%sphi
245 zeta => basis_set_a%zet
247 first_sgfb => basis_set_b%first_sgf
248 lb_max => basis_set_b%lmax
249 lb_min => basis_set_b%lmin
250 npgfb => basis_set_b%npgf
251 nsetb = basis_set_b%nset
252 nsgfb => basis_set_b%nsgf_set
253 rpgfb => basis_set_b%pgf_radius
254 set_radius_b => basis_set_b%set_radius
255 sphi_b => basis_set_b%sphi
256 zetb => basis_set_b%zet
258 dab = sqrt(sum(rab*rab))
261 img = cell_to_index(cellind(1), cellind(2), cellind(3))
267 IF (iatom == jatom)
THEN
274 IF (iatom <= jatom)
THEN
282 CALL dbcsr_get_block_p(matrix=matrix_h(1, img)%matrix, &
283 row=irow, col=icol, block=h_block, found=found)
284 IF (calculate_forces)
THEN
286 CALL dbcsr_get_block_p(matrix=matrix_p(1, img)%matrix, &
287 row=irow, col=icol, block=p_block, found=found)
288 cpassert(
ASSOCIATED(p_block))
291 ncoa = npgfa(iset)*
ncoset(la_max(iset))
292 sgfa = first_sgfa(1, iset)
294 ncob = npgfb(jset)*
ncoset(lb_max(jset))
295 sgfb = first_sgfb(1, jset)
296 nij = jset + (iset - 1)*maxnset
298 IF (iatom <= jatom)
THEN
299 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
300 p_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1))
302 work(1:ncoa, 1:nsgfb(jset)) = matmul(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1), &
303 transpose(p_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1)))
305 pab(1:ncoa, 1:ncob, nij) = matmul(work(1:ncoa, 1:nsgfb(jset)), &
306 transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)))
314 CALL get_qs_kind(qs_kind_set(kkind), all_potential=all_potential, &
315 sgp_potential=sgp_potential)
316 IF (
ASSOCIATED(all_potential))
THEN
317 CALL get_potential(potential=all_potential, &
318 alpha_core_charge=alpha_c, zeff=zeta_c, &
319 ccore_charge=core_charge, core_charge_radius=core_radius)
320 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
321 CALL get_potential(potential=sgp_potential, &
322 alpha_core_charge=alpha_c, zeff=zeta_c, &
323 ccore_charge=core_charge, core_charge_radius=core_radius)
333 dac = sqrt(sum(rac*rac))
334 rbc(:) = rac(:) - rab(:)
335 dbc = sqrt(sum(rbc*rbc))
336 IF ((maxval(set_radius_a(:)) + core_radius < dac) .OR. &
337 (maxval(set_radius_b(:)) + core_radius < dbc))
THEN
342 IF (set_radius_a(iset) + core_radius < dac) cycle
343 ncoa = npgfa(iset)*
ncoset(la_max(iset))
344 sgfa = first_sgfa(1, iset)
346 IF (set_radius_b(jset) + core_radius < dbc) cycle
347 ncob = npgfb(jset)*
ncoset(lb_max(jset))
348 sgfb = first_sgfb(1, jset)
349 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
353 nij = jset + (iset - 1)*maxnset
355 IF (calculate_forces)
THEN
356 na_plus = npgfa(iset)*
ncoset(la_max(iset) + nder)
357 nb_plus = npgfb(jset)*
ncoset(lb_max(jset))
358 ALLOCATE (habd(na_plus, nb_plus))
361 la_max(iset) + nder, npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
362 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
363 alpha_c, core_radius, zeta_c, core_charge, &
364 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:), &
370 CALL verfc_force(habd, pab(:, :, nij), force_a, force_b, nder, &
371 la_max(iset), la_min(iset), npgfa(iset), zeta(:, iset), &
372 lb_max(jset), lb_min(jset), npgfb(jset), zetb(:, jset), rab)
376 force_thread(1, iatom) = force_thread(1, iatom) + f0*force_a(1)
377 force_thread(2, iatom) = force_thread(2, iatom) + f0*force_a(2)
378 force_thread(3, iatom) = force_thread(3, iatom) + f0*force_a(3)
380 force_thread(1, jatom) = force_thread(1, jatom) + f0*force_b(1)
381 force_thread(2, jatom) = force_thread(2, jatom) + f0*force_b(2)
382 force_thread(3, jatom) = force_thread(3, jatom) + f0*force_b(3)
384 force_thread(1, katom) = force_thread(1, katom) - f0*force_a(1) - f0*force_b(1)
385 force_thread(2, katom) = force_thread(2, katom) - f0*force_a(2) - f0*force_b(2)
386 force_thread(3, katom) = force_thread(3, katom) - f0*force_a(3) - f0*force_b(3)
394 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
395 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
396 alpha_c, core_radius, zeta_c, core_charge, &
397 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
405 ncoa = npgfa(iset)*
ncoset(la_max(iset))
406 sgfa = first_sgfa(1, iset)
408 ncob = npgfb(jset)*
ncoset(lb_max(jset))
409 sgfb = first_sgfb(1, jset)
410 nij = jset + (iset - 1)*maxnset
413 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
414 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
416 IF (iatom <= jatom)
THEN
417 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
418 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
419 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
421 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
422 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
423 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
431 DEALLOCATE (hab, work, verf, vnuc, ff)
432 IF (calculate_forces)
THEN
450 DEALLOCATE (basis_set_list)
452 IF (calculate_forces)
THEN
455 IF (
SIZE(matrix_p, 1) == 2)
THEN
457 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
458 alpha_scalar=0.5_dp, beta_scalar=0.5_dp)
459 CALL dbcsr_add(matrix_p(2, img)%matrix, matrix_p(1, img)%matrix, &
460 alpha_scalar=-1.0_dp, beta_scalar=1.0_dp)
465 IF (calculate_forces)
THEN
469 atom_a = atom_of_kind(iatom)
470 ikind = kind_of(iatom)
471 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) + force_thread(:, iatom)
476 IF (calculate_forces .AND. use_virial)
THEN
477 virial%pv_ppl = virial%pv_ppl + pv_thread
478 virial%pv_virial = virial%pv_virial + pv_thread
481 CALL timestop(handle)
502 SUBROUTINE verfc_force(habd, pab, fa, fb, nder, la_max, la_min, npgfa, zeta, lb_max, lb_min, npgfb, zetb, rab)
504 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: habd, pab
505 REAL(kind=
dp),
DIMENSION(3),
INTENT(OUT) :: fa, fb
506 INTEGER,
INTENT(IN) :: nder, la_max, la_min, npgfa
507 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: zeta
508 INTEGER,
INTENT(IN) :: lb_max, lb_min, npgfb
509 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: zetb
510 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: rab
512 INTEGER :: ic_a, ic_b, icam1, icam2, icam3, icap1, &
513 icap2, icap3, icax, icbm1, icbm2, &
514 icbm3, icbx, icoa, icob, ipgfa, ipgfb, &
516 INTEGER,
DIMENSION(3) :: la, lb
517 REAL(kind=
dp) :: zax2, zbx2
523 nap =
ncoset(la_max + nder)
526 zax2 = zeta(ipgfa)*2.0_dp
528 zbx2 = zetb(ipgfb)*2.0_dp
530 la(1:3) =
indco(1:3, ic_a)
531 icap1 =
coset(la(1) + 1, la(2), la(3))
532 icap2 =
coset(la(1), la(2) + 1, la(3))
533 icap3 =
coset(la(1), la(2), la(3) + 1)
534 icam1 =
coset(la(1) - 1, la(2), la(3))
535 icam2 =
coset(la(1), la(2) - 1, la(3))
536 icam3 =
coset(la(1), la(2), la(3) - 1)
537 icoa = ic_a + (ipgfa - 1)*na
538 icax = (ipgfa - 1)*nap
541 lb(1:3) =
indco(1:3, ic_b)
542 icbm1 =
coset(lb(1) - 1, lb(2), lb(3))
543 icbm2 =
coset(lb(1), lb(2) - 1, lb(3))
544 icbm3 =
coset(lb(1), lb(2), lb(3) - 1)
545 icob = ic_b + (ipgfb - 1)*nb
546 icbx = (ipgfb - 1)*nb
548 fa(1) = fa(1) - pab(icoa, icob)*(-zax2*habd(icap1 + icax, icob) + &
549 REAL(la(1), kind=
dp)*habd(icam1 + icax, icob))
550 fa(2) = fa(2) - pab(icoa, icob)*(-zax2*habd(icap2 + icax, icob) + &
551 REAL(la(2), kind=
dp)*habd(icam2 + icax, icob))
552 fa(3) = fa(3) - pab(icoa, icob)*(-zax2*habd(icap3 + icax, icob) + &
553 REAL(la(3), kind=
dp)*habd(icam3 + icax, icob))
555 fb(1) = fb(1) - pab(icoa, icob)*( &
556 -zbx2*(habd(icap1 + icax, icob) - rab(1)*habd(ic_a + icax, icob)) + &
557 REAL(lb(1), kind=
dp)*habd(ic_a + icax, icbm1 + icbx))
558 fb(2) = fb(2) - pab(icoa, icob)*( &
559 -zbx2*(habd(icap2 + icax, icob) - rab(2)*habd(ic_a + icax, icob)) + &
560 REAL(lb(2), kind=
dp)*habd(ic_a + icax, icbm2 + icbx))
561 fb(3) = fb(3) - pab(icoa, icob)*( &
562 -zbx2*(habd(icap3 + icax, icob) - rab(3)*habd(ic_a + icax, icob)) + &
563 REAL(lb(3), kind=
dp)*habd(ic_a + icax, icbm3 + icbx))
570 END SUBROUTINE verfc_force
584 SUBROUTINE build_erfc(matrix_h, qs_kind_set, atomic_kind_set, particle_set, &
585 calpha, ccore, eps_core_charge, sab_orb, sac_ae)
587 TYPE(dbcsr_p_type) :: matrix_h
588 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
589 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
590 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
591 REAL(kind=
dp),
DIMENSION(:),
INTENT(IN) :: calpha, ccore
592 REAL(kind=
dp),
INTENT(IN) :: eps_core_charge
593 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
594 POINTER :: sab_orb, sac_ae
596 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_erfc'
598 INTEGER :: handle, iatom, icol, ikind, img, irow, iset, jatom, jkind, jset, katom, kkind, &
599 ldai, ldsab, maxco, maxl, maxnset, maxsgf, mepos, na_plus, natom, nb_plus, ncoa, ncob, &
600 nij, nkind, nseta, nsetb, nthread, sgfa, sgfb, slot
601 INTEGER,
DIMENSION(3) :: cellind
602 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
604 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
605 LOGICAL :: dokp, found
606 REAL(kind=
dp) :: alpha_c, core_charge, core_radius, dab, &
607 dac, dbc, f0, rab2, rac2, rbc2, zeta_c
608 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: ff
609 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: habd, work
610 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: hab, pab, verf, vnuc
611 REAL(kind=
dp),
DIMENSION(3) :: rab, rac, rbc
612 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
613 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: h_block, p_block, rpgfa, rpgfb, sphi_a, &
615 TYPE(all_potential_type),
POINTER :: all_potential
616 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
617 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
618 TYPE(neighbor_list_iterator_p_type), &
619 DIMENSION(:),
POINTER :: ap_iterator
620 TYPE(sgp_potential_type),
POINTER :: sgp_potential
630 CALL timeset(routinen, handle)
632 nkind =
SIZE(atomic_kind_set)
633 natom =
SIZE(particle_set)
635 ALLOCATE (basis_set_list(nkind))
637 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a)
638 IF (
ASSOCIATED(basis_set_a))
THEN
639 basis_set_list(ikind)%gto_basis_set => basis_set_a
641 NULLIFY (basis_set_list(ikind)%gto_basis_set)
646 maxco=maxco, maxlgto=maxl, maxsgf=maxsgf, maxnset=maxnset)
648 ldsab = max(maxco, maxsgf)
686 ALLOCATE (hab(ldsab, ldsab, maxnset*maxnset), work(ldsab, ldsab))
687 ALLOCATE (verf(ldai, ldai, 2*maxl + 1), vnuc(ldai, ldai, 2*maxl + 1), ff(0:2*maxl))
690 DO slot = 1, sab_orb(1)%nl_size
692 ikind = sab_orb(1)%nlist_task(slot)%ikind
693 jkind = sab_orb(1)%nlist_task(slot)%jkind
694 iatom = sab_orb(1)%nlist_task(slot)%iatom
695 jatom = sab_orb(1)%nlist_task(slot)%jatom
696 cellind(:) = sab_orb(1)%nlist_task(slot)%cell(:)
697 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
699 basis_set_a => basis_set_list(ikind)%gto_basis_set
700 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
701 basis_set_b => basis_set_list(jkind)%gto_basis_set
702 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
706 first_sgfa => basis_set_a%first_sgf
707 la_max => basis_set_a%lmax
708 la_min => basis_set_a%lmin
709 npgfa => basis_set_a%npgf
710 nseta = basis_set_a%nset
711 nsgfa => basis_set_a%nsgf_set
712 rpgfa => basis_set_a%pgf_radius
713 set_radius_a => basis_set_a%set_radius
714 sphi_a => basis_set_a%sphi
715 zeta => basis_set_a%zet
717 first_sgfb => basis_set_b%first_sgf
718 lb_max => basis_set_b%lmax
719 lb_min => basis_set_b%lmin
720 npgfb => basis_set_b%npgf
721 nsetb = basis_set_b%nset
722 nsgfb => basis_set_b%nsgf_set
723 rpgfb => basis_set_b%pgf_radius
724 set_radius_b => basis_set_b%set_radius
725 sphi_b => basis_set_b%sphi
726 zetb => basis_set_b%zet
728 dab = sqrt(sum(rab*rab))
732 IF (iatom == jatom)
THEN
739 IF (iatom <= jatom)
THEN
747 CALL dbcsr_get_block_p(matrix=matrix_h%matrix, &
748 row=irow, col=icol, block=h_block, found=found)
754 alpha_c = calpha(kkind)
755 core_charge = ccore(kkind)
756 core_radius =
exp_radius(0, alpha_c, eps_core_charge, core_charge)
757 core_radius = max(core_radius, 10.0_dp)
764 dac = sqrt(sum(rac*rac))
765 rbc(:) = rac(:) - rab(:)
766 dbc = sqrt(sum(rbc*rbc))
767 IF ((maxval(set_radius_a(:)) + core_radius < dac) .OR. &
768 (maxval(set_radius_b(:)) + core_radius < dbc))
THEN
773 IF (set_radius_a(iset) + core_radius < dac) cycle
774 ncoa = npgfa(iset)*
ncoset(la_max(iset))
775 sgfa = first_sgfa(1, iset)
777 IF (set_radius_b(jset) + core_radius < dbc) cycle
778 ncob = npgfb(jset)*
ncoset(lb_max(jset))
779 sgfb = first_sgfb(1, jset)
780 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
784 nij = jset + (iset - 1)*maxnset
787 la_max(iset), npgfa(iset), zeta(:, iset), rpgfa(:, iset), la_min(iset), &
788 lb_max(jset), npgfb(jset), zetb(:, jset), rpgfb(:, jset), lb_min(jset), &
789 alpha_c, core_radius, zeta_c, core_charge, &
790 rab, rab2, rac, rac2, rbc2, hab(:, :, nij), verf, vnuc, ff(0:))
797 ncoa = npgfa(iset)*
ncoset(la_max(iset))
798 sgfa = first_sgfa(1, iset)
800 ncob = npgfb(jset)*
ncoset(lb_max(jset))
801 sgfb = first_sgfb(1, jset)
802 nij = jset + (iset - 1)*maxnset
805 work(1:ncoa, 1:nsgfb(jset)) = matmul(hab(1:ncoa, 1:ncob, nij), &
806 sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
808 IF (iatom <= jatom)
THEN
809 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
810 h_block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
811 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
813 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
814 h_block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
815 matmul(transpose(work(1:ncoa, 1:nsgfb(jset))), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
823 DEALLOCATE (hab, work, verf, vnuc, ff)
839 DEALLOCATE (basis_set_list)
841 CALL timestop(handle)
Build up the nuclear potential part of the core Hamiltonian matrix in the case of an allelectron calc...
subroutine, public verfc(la_max1, npgfa, zeta, rpgfa, la_min1, lb_max1, npgfb, zetb, rpgfb, lb_min1, zetc, rpgfc, zc, cerf, rab, rab2, rac, rac2, rbc2, vabc, verf, vnuc, f, maxder, vabc_plus, vnabc, pVp_sum, pVp, dkh_erfc)
Calculation of the primitive three-center nuclear potential integrals <a|Z*erfc(r)/r|b> over Cartesia...
All kind of helpful little routines.
real(kind=dp) function, public exp_radius(l, alpha, threshold, prefactor, epsabs, epsrel, rlow)
The radius of a primitive Gaussian function for a given threshold is calculated. g(r) = prefactor*r**...
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
Calculation of the nuclear attraction contribution to the core Hamiltonian <a|erfc|b> :we only calcul...
subroutine, public build_core_ae(matrix_h, matrix_p, force, virial, calculate_forces, use_virial, nder, qs_kind_set, atomic_kind_set, particle_set, sab_orb, sac_ae, nimages, cell_to_index)
...
subroutine, public build_erfc(matrix_h, qs_kind_set, atomic_kind_set, particle_set, calpha, ccore, eps_core_charge, sab_orb, sac_ae)
Integrals = -Z*erfc(a*r)/r.
Definition of the atomic potential types.
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
integer, dimension(:), allocatable, public ncoset
integer, dimension(:, :, :), allocatable, public coset
integer, dimension(:, :), allocatable, public indco
Define the data structure for the particle information.
Define the quickstep kind type and their sub types.
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 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)
Get attributes of an atomic kind set.
Define the neighbor list data types and the corresponding functionality.
integer function, public nl_sub_iterate(iterator_set, mepos)
...
subroutine, public neighbor_list_iterator_create(iterator_set, nl, search, nthread)
Neighbor list iterator functions.
subroutine, public nl_set_sub_iterator(iterator_set, ikind, jkind, iatom, mepos)
...
subroutine, public neighbor_list_iterator_release(iterator_set)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
pure subroutine, public virial_pair_force(pv_virial, f0, force, rab)
Computes the contribution to the stress tensor from two-body pair-wise forces.