89#include "./base/base_uses.f90"
97 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_vcd_ao'
98 INTEGER,
PARAMETER :: bi_1 = 1, bi_x = 2, bi_y = 3, bi_z = 4, bi_xx = 5, &
99 bi_xy = 6, bi_xz = 7, bi_yy = 8, bi_yz = 9, bi_zz = 10
100 INTEGER,
DIMENSION(3),
PARAMETER :: bi_r = [bi_x, bi_y, bi_z]
101 INTEGER,
DIMENSION(3, 3),
PARAMETER :: bi_rr = reshape([bi_xx, bi_xy, bi_xz, bi_xy, bi_yy, bi_yz, &
102 bi_xz, bi_yz, bi_zz], [3, 3])
122 REAL(
dp),
DIMENSION(3) :: rc
124 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_matrix_hr_rh'
125 INTEGER,
PARAMETER :: ispin = 1
131 POINTER :: sab_all, sap_ppnl
133 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
135 CALL timeset(routinen, handle)
138 dft_control=dft_control, &
139 particle_set=particle_set, &
142 qs_kind_set=qs_kind_set, &
146 CALL dbcsr_set(vcd_env%matrix_hr(ispin, i)%matrix, 0._dp)
147 CALL dbcsr_set(vcd_env%matrix_rh(ispin, i)%matrix, 0._dp)
150 associate(matrix_hr_1d => vcd_env%matrix_hr(ispin, 1:3), &
151 matrix_rh_1d => vcd_env%matrix_rh(ispin, 1:3))
152 CALL build_rpnl_matrices(matrix_hr_1d, matrix_rh_1d, qs_kind_set, particle_set, sab_all, sap_ppnl, &
153 dft_control%qs_control%eps_ppnl, cell, rc)
154 CALL build_tr_matrices(matrix_hr_1d, matrix_rh_1d, qs_env, qs_kind_set,
"ORB", sab_all, rc)
155 CALL build_rcore_matrices(matrix_hr_1d, matrix_rh_1d, qs_env, qs_kind_set,
"ORB", sab_all, rc)
156 CALL build_vhxc_matrices(vcd_env%matrix_hr, vcd_env%matrix_rh, qs_env, rc)
159 CALL timestop(handle)
175 SUBROUTINE build_rpnl_matrices(matrix_vr, matrix_rv, qs_kind_set, particle_set, sab_all, sap_ppnl, eps_ppnl, &
178 TYPE(dbcsr_p_type),
DIMENSION(:) :: matrix_vr, matrix_rv
179 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
180 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
181 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
182 POINTER :: sab_all, sap_ppnl
183 REAL(kind=dp),
INTENT(IN) :: eps_ppnl
184 TYPE(cell_type),
INTENT(IN),
OPTIONAL,
POINTER :: cell
185 REAL(kind=dp),
DIMENSION(3) :: ref_point
187 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_rpnl_matrices'
189 INTEGER :: handle, i, iab, iac, iatom, ibc, icol, &
190 ikind, irow, jatom, jkind, kac, kbc, &
191 kkind, na, natom, nb, nkind, np, slot
192 INTEGER,
DIMENSION(3) :: cell_b
193 LOGICAL :: found, ppnl_present
194 REAL(kind=dp),
DIMENSION(:, :, :),
POINTER :: achint, acint, bchint, bcint
195 TYPE(alist_type),
POINTER :: alist_ac, alist_bc
196 TYPE(block_p_type),
DIMENSION(3) :: blocks_rv, blocks_vr
197 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set
198 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
199 TYPE(sap_int_type),
DIMENSION(:),
POINTER :: sap_int
206 ppnl_present =
ASSOCIATED(sap_ppnl)
207 IF (.NOT. ppnl_present)
RETURN
209 CALL timeset(routinen, handle)
210 nkind =
SIZE(qs_kind_set)
211 natom =
SIZE(particle_set)
215 ALLOCATE (sap_int(nkind*nkind))
216 DO i = 1, nkind*nkind
217 NULLIFY (sap_int(i)%alist, sap_int(i)%asort, sap_int(i)%aindex)
218 sap_int(i)%nalist = 0
223 CALL build_sap_ints(sap_int, sap_ppnl, qs_kind_set, nder=1, moment_mode=.true., &
224 particle_set=particle_set, cell=cell, refpoint=ref_point)
227 CALL sap_sort(sap_int)
229 ALLOCATE (basis_set(nkind))
231 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
232 IF (
ASSOCIATED(orb_basis_set))
THEN
233 basis_set(ikind)%gto_basis_set => orb_basis_set
235 NULLIFY (basis_set(ikind)%gto_basis_set)
264 DO slot = 1, sab_all(1)%nl_size
266 ikind = sab_all(1)%nlist_task(slot)%ikind
267 jkind = sab_all(1)%nlist_task(slot)%jkind
268 iatom = sab_all(1)%nlist_task(slot)%iatom
269 jatom = sab_all(1)%nlist_task(slot)%jatom
270 cell_b(:) = sab_all(1)%nlist_task(slot)%cell(:)
272 IF (.NOT.
ASSOCIATED(basis_set(ikind)%gto_basis_set)) cycle
273 IF (.NOT.
ASSOCIATED(basis_set(jkind)%gto_basis_set)) cycle
274 iab = ikind + nkind*(jkind - 1)
280 CALL dbcsr_get_block_p(matrix_vr(i)%matrix, irow, icol, blocks_vr(i)%block, found)
282 CALL dbcsr_get_block_p(matrix_rv(i)%matrix, irow, icol, blocks_rv(i)%block, found)
288 iac = ikind + nkind*(kkind - 1)
289 ibc = jkind + nkind*(kkind - 1)
290 IF (.NOT.
ASSOCIATED(sap_int(iac)%alist)) cycle
291 IF (.NOT.
ASSOCIATED(sap_int(ibc)%alist)) cycle
292 CALL get_alist(sap_int(iac), alist_ac, iatom)
293 CALL get_alist(sap_int(ibc), alist_bc, jatom)
295 IF (.NOT.
ASSOCIATED(alist_ac)) cycle
296 IF (.NOT.
ASSOCIATED(alist_bc)) cycle
297 DO kac = 1, alist_ac%nclist
298 DO kbc = 1, alist_bc%nclist
299 IF (alist_ac%clist(kac)%catom /= alist_bc%clist(kbc)%catom) cycle
300 IF (all(cell_b + alist_bc%clist(kbc)%cell - alist_ac%clist(kac)%cell == 0))
THEN
301 IF (alist_ac%clist(kac)%maxac*alist_bc%clist(kbc)%maxach < eps_ppnl) cycle
302 acint => alist_ac%clist(kac)%acint
303 bcint => alist_bc%clist(kbc)%acint
304 achint => alist_ac%clist(kac)%achint
305 bchint => alist_bc%clist(kbc)%achint
313 blocks_vr(i)%block(1:na, 1:nb) = blocks_vr(i)%block(1:na, 1:nb) + &
314 matmul(achint(1:na, 1:np, 1), &
315 transpose(bcint(1:nb, 1:np, i + 1)))
317 blocks_rv(i)%block(1:na, 1:nb) = blocks_rv(i)%block(1:na, 1:nb) + &
318 matmul(achint(1:na, 1:np, i + 1), &
319 transpose(bcint(1:nb, 1:np, 1)))
328 NULLIFY (blocks_vr(i)%block)
329 NULLIFY (blocks_rv(i)%block)
345 CALL release_sap_int(sap_int)
347 DEALLOCATE (basis_set)
349 CALL timestop(handle)
351 END SUBROUTINE build_rpnl_matrices
372 SUBROUTINE build_tr_matrices(matrix_tr, matrix_rt, qs_env, qs_kind_set, basis_type, sab_nl, rc)
374 TYPE(dbcsr_p_type),
DIMENSION(:) :: matrix_tr, matrix_rt
375 TYPE(qs_environment_type),
POINTER :: qs_env
376 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
377 CHARACTER(LEN=*),
INTENT(IN) :: basis_type
378 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
380 REAL(kind=dp),
DIMENSION(3) :: rc
382 CHARACTER(len=*),
PARAMETER :: routinen =
'build_tr_matrices'
384 INTEGER :: handle, i, iatom, icol, ikind, ir, irow, &
385 iset, jatom, jkind, jset, ldsab, ltab, &
386 natom, ncoa, ncob, nkind, nseta, &
387 nsetb, sgfa, sgfb, slot
388 INTEGER,
DIMENSION(3) :: cell
389 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
391 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
392 LOGICAL :: do_symmetric, found, trans
394 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: qab, tkab
395 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: kab
396 REAL(kind=dp),
DIMENSION(3) :: ra, rab, rac, rb, rbc
397 REAL(kind=dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
398 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: rpgfa, rpgfb, scon_a, scon_b, zeta, zetb
399 TYPE(block_p_type),
DIMENSION(3, 2) :: blocks_tr
400 TYPE(cell_type),
POINTER :: qs_cell
401 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
402 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
403 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
413 CALL timeset(routinen, handle)
415 nkind =
SIZE(qs_kind_set)
418 cpassert(
SIZE(sab_nl) > 0)
419 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_nl, symmetric=do_symmetric)
422 ALLOCATE (basis_set_list(nkind))
423 CALL basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
426 ldsab = get_memory_usage(qs_kind_set, basis_type)
428 CALL get_qs_env(qs_env=qs_env, &
429 particle_set=particle_set, &
455 ALLOCATE (kab(ldsab, ldsab, 3), qab(ldsab, ldsab))
458 DO slot = 1, sab_nl(1)%nl_size
460 ikind = sab_nl(1)%nlist_task(slot)%ikind
461 jkind = sab_nl(1)%nlist_task(slot)%jkind
462 iatom = sab_nl(1)%nlist_task(slot)%iatom
463 jatom = sab_nl(1)%nlist_task(slot)%jatom
464 cell(:) = sab_nl(1)%nlist_task(slot)%cell(:)
465 rab(1:3) = sab_nl(1)%nlist_task(slot)%r(1:3)
467 basis_set_a => basis_set_list(ikind)%gto_basis_set
468 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
469 basis_set_b => basis_set_list(jkind)%gto_basis_set
470 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
476 first_sgfa => basis_set_a%first_sgf
477 la_max => basis_set_a%lmax
478 la_min => basis_set_a%lmin
479 npgfa => basis_set_a%npgf
480 nsgfa => basis_set_a%nsgf_set
481 rpgfa => basis_set_a%pgf_radius
482 set_radius_a => basis_set_a%set_radius
483 scon_a => basis_set_a%scon
484 zeta => basis_set_a%zet
486 first_sgfb => basis_set_b%first_sgf
487 lb_max => basis_set_b%lmax
488 lb_min => basis_set_b%lmin
489 npgfb => basis_set_b%npgf
490 nsgfb => basis_set_b%nsgf_set
491 rpgfb => basis_set_b%pgf_radius
492 set_radius_b => basis_set_b%set_radius
493 scon_b => basis_set_b%scon
494 zetb => basis_set_b%zet
496 nseta = basis_set_a%nset
497 nsetb = basis_set_b%nset
499 IF (do_symmetric)
THEN
500 IF (iatom <= jatom)
THEN
512 NULLIFY (blocks_tr(ir, 1)%block)
513 CALL dbcsr_get_block_p(matrix=matrix_tr(ir)%matrix, &
514 row=irow, col=icol, block=blocks_tr(ir, 1)%block, found=found)
516 NULLIFY (blocks_tr(ir, 2)%block)
517 CALL dbcsr_get_block_p(matrix=matrix_rt(ir)%matrix, &
518 row=irow, col=icol, block=blocks_tr(ir, 2)%block, found=found)
526 ra = pbc(particle_set(iatom)%r(:), qs_cell)
527 rb(:) = ra(:) + rab(:)
528 rac = pbc(rc, ra, qs_cell)
531 trans = do_symmetric .AND. (iatom > jatom)
535 ncoa = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
536 sgfa = first_sgfa(1, iset)
540 IF (set_radius_a(iset) + set_radius_b(jset) < tab) cycle
545 ncob = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
546 sgfb = first_sgfb(1, jset)
549 ltab = max(npgfa(iset)*
ncoset(la_max(iset) + 1), npgfb(jset)*
ncoset(lb_max(jset) + 1))
550 ALLOCATE (tkab(ltab, ltab))
551 CALL kinetic(la_max(iset) + 1, la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
552 lb_max(jset) + 1, lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
556 CALL apply_cartesian_operator(la_max(iset), la_min(iset), npgfa(iset), &
557 lb_max(jset), lb_min(jset), npgfb(jset), tkab, kab, &
558 right=(i == 1), derivative=.false., origin=merge(rbc, rac, i == 1))
560 CALL contraction(kab(:, :, ir), qab, ca=scon_a(:, sgfa:), na=ncoa, ma=nsgfa(iset), &
561 cb=scon_b(:, sgfb:), nb=ncob, mb=nsgfb(jset), trans=trans)
564 CALL block_add(
"IN", qab, nsgfa(iset), nsgfb(jset), blocks_tr(ir, i)%block, &
565 sgfa, sgfb, trans=trans)
574 DEALLOCATE (kab, qab)
588 DEALLOCATE (basis_set_list)
589 CALL timestop(handle)
591 END SUBROUTINE build_tr_matrices
604 SUBROUTINE build_rcore_matrices(matrix_rcore_hr, matrix_rcore_rh, qs_env, qs_kind_set, basis_type, sab_nl, rf)
605 TYPE(dbcsr_p_type),
DIMENSION(:) :: matrix_rcore_hr, matrix_rcore_rh
606 TYPE(qs_environment_type),
POINTER :: qs_env
607 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
608 CHARACTER(LEN=*) :: basis_type
609 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
611 REAL(kind=dp),
DIMENSION(3) :: rf
613 CHARACTER(len=*),
PARAMETER :: routinen =
'build_rcore_matrices'
614 INTEGER,
PARAMETER :: nexp_max = 30
616 INTEGER :: atom_a, atom_b, handle, i, iatom, icol, idir, ikind, inode, irow, iset, jatom, &
617 jkind, jset, katom, kkind, ldai, ldsab, maxco, maxder, maxl, maxlgto, maxlppl, maxnset, &
618 maxsgf, mepos, n_local, ncoa, ncob, nder, nexp_lpot, nexp_ppl, nimages, nkind, nloc, &
619 nseta, nsetb, nthread, sgfa, sgfb
620 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind
621 INTEGER,
DIMENSION(1:10) :: nrloc
622 INTEGER,
DIMENSION(3) :: cellind
623 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, &
624 nct_lpot, npgfa, npgfb, nsgfa, nsgfb
625 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
626 INTEGER,
DIMENSION(nexp_max) :: nct_ppl
627 LOGICAL :: do_symmetric, do_upf, dokp, ecp_local, &
628 ecp_semi_local, found, lpotextended
629 REAL(kind=dp) :: alpha, dab, dac, dbc, ppl_radius
630 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :) :: hab, qab
631 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: ppl_work, rhab, work
632 REAL(kind=dp),
DIMENSION(1:10) :: aloc, bloc
633 REAL(kind=dp),
DIMENSION(3) :: ra, rab, rac, raf, rb, rbc
634 REAL(kind=dp),
DIMENSION(4, nexp_max) :: cval_ppl
635 REAL(kind=dp),
DIMENSION(:),
POINTER :: a_local, alpha_lpot, c_local, cexp_ppl, &
636 set_radius_a, set_radius_b
637 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: cval_lpot, rpgfa, rpgfb, scon_a, scon_b, &
638 sphi_a, sphi_b, zeta, zetb
639 REAL(kind=dp),
DIMENSION(nexp_max) :: alpha_ppl
640 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
641 TYPE(block_p_type),
DIMENSION(3, 2) :: blocks_rcore
642 TYPE(cell_type),
POINTER :: cell
643 TYPE(gth_potential_type),
POINTER :: gth_potential
644 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
645 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
646 TYPE(neighbor_list_iterator_p_type), &
647 DIMENSION(:),
POINTER :: ap_iterator, nl_iterator
648 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
650 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
651 TYPE(sgp_potential_type),
POINTER :: sgp_potential
653 CALL timeset(routinen, handle)
655 CALL get_qs_env(qs_env=qs_env, &
656 atomic_kind_set=atomic_kind_set, &
657 qs_kind_set=qs_kind_set, &
658 particle_set=particle_set, &
663 cpassert(
SIZE(sab_nl) > 0)
664 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_nl, symmetric=do_symmetric)
666 nkind =
SIZE(qs_kind_set)
669 ALLOCATE (basis_set_list(nkind))
670 CALL basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
679 nkind =
SIZE(atomic_kind_set)
683 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, atom_of_kind=atom_of_kind)
687 CALL get_qs_kind_set(qs_kind_set, maxco=maxco, maxlgto=maxlgto, &
688 maxsgf=maxsgf, maxnset=maxnset, maxlppl=maxlppl, &
689 basis_type=basis_type)
691 maxl = max(maxlgto, maxlppl)
692 CALL init_orbital_pointers(2*maxl + 2*nder + 2)
696 ldsab = max(maxco,
ncoset(maxlppl), maxsgf, maxlppl, maxco*
ncoset(maxlgto + 1))
697 ldai =
ncoset(2*maxlgto + 2)
700 CALL get_qs_kind(qs_kind_set(ikind), basis_set=basis_set_a, basis_type=basis_type, &
701 sgp_potential=sgp_potential)
702 IF (
ASSOCIATED(sgp_potential))
THEN
703 IF (
ALLOCATED(sgp_potential%upf_data))
THEN
704 IF (sgp_potential%upf_local%radial%degree < 2*maxlgto + 2)
THEN
705 CALL upf_local_init(sgp_potential%upf_data, sgp_potential%alpha_core_charge, &
706 2*maxlgto + 2, sgp_potential%upf_local)
710 IF (
ASSOCIATED(basis_set_a))
THEN
711 basis_set_list(ikind)%gto_basis_set => basis_set_a
713 NULLIFY (basis_set_list(ikind)%gto_basis_set)
720 CALL neighbor_list_iterator_create(nl_iterator, sab_nl, nthread=nthread)
723 CALL neighbor_list_iterator_create(ap_iterator, sac_ppl, search=.true., nthread=nthread)
751 ALLOCATE (hab(ldsab, ldsab), rhab(ldsab, ldsab, 3), work(ldsab, ldsab*(nder + 1), 3))
752 ALLOCATE (qab(ldsab, ldsab))
754 ldai =
ncoset(2*maxlgto + 2)
755 ALLOCATE (ppl_work(ldai, ldai, max(maxder, 2*maxlgto + 2 + 1)))
757 DO WHILE (neighbor_list_iterate(nl_iterator, mepos=mepos) == 0)
759 CALL get_iterator_info(nl_iterator, mepos=mepos, ikind=ikind, jkind=jkind, inode=inode, &
760 iatom=iatom, jatom=jatom, r=rab, cell=cellind)
762 basis_set_a => basis_set_list(ikind)%gto_basis_set
763 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
764 basis_set_b => basis_set_list(jkind)%gto_basis_set
765 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
767 atom_a = atom_of_kind(iatom)
768 atom_b = atom_of_kind(jatom)
771 first_sgfa => basis_set_a%first_sgf
772 la_max => basis_set_a%lmax
773 la_min => basis_set_a%lmin
774 npgfa => basis_set_a%npgf
775 nsgfa => basis_set_a%nsgf_set
776 rpgfa => basis_set_a%pgf_radius
777 set_radius_a => basis_set_a%set_radius
778 sphi_a => basis_set_a%sphi
779 zeta => basis_set_a%zet
780 scon_a => basis_set_a%scon
782 first_sgfb => basis_set_b%first_sgf
783 lb_max => basis_set_b%lmax
784 lb_min => basis_set_b%lmin
785 npgfb => basis_set_b%npgf
786 nsgfb => basis_set_b%nsgf_set
787 rpgfb => basis_set_b%pgf_radius
788 set_radius_b => basis_set_b%set_radius
789 sphi_b => basis_set_b%sphi
790 zetb => basis_set_b%zet
791 scon_b => basis_set_b%scon
793 nseta = basis_set_a%nset
794 nsetb = basis_set_b%nset
801 NULLIFY (blocks_rcore(idir, 1)%block)
802 CALL dbcsr_get_block_p(matrix=matrix_rcore_hr(idir)%matrix, &
803 row=irow, col=icol, block=blocks_rcore(idir, 1)%block, found=found)
805 NULLIFY (blocks_rcore(idir, 2)%block)
806 CALL dbcsr_get_block_p(matrix=matrix_rcore_rh(idir)%matrix, &
807 row=irow, col=icol, block=blocks_rcore(idir, 2)%block, found=found)
812 ra = pbc(particle_set(iatom)%r(:), cell)
813 rb(:) = ra(:) + rab(:)
815 raf = pbc(rf, ra, cell)
819 CALL get_qs_kind(qs_kind_set(kkind), gth_potential=gth_potential, &
820 sgp_potential=sgp_potential)
822 IF (
ASSOCIATED(gth_potential))
THEN
823 CALL get_potential(potential=gth_potential, &
824 alpha_ppl=alpha, cexp_ppl=cexp_ppl, &
825 lpot_present=lpotextended, ppl_radius=ppl_radius)
828 nct_ppl(1) =
SIZE(cexp_ppl)
829 cval_ppl(1:nct_ppl(1), 1) = cexp_ppl(1:nct_ppl(1))
830 IF (lpotextended)
THEN
831 CALL get_potential(potential=gth_potential, &
832 nexp_lpot=nexp_lpot, alpha_lpot=alpha_lpot, nct_lpot=nct_lpot, cval_lpot=cval_lpot)
833 cpassert(nexp_lpot < nexp_max)
834 nexp_ppl = nexp_lpot + 1
835 alpha_ppl(2:nexp_lpot + 1) = alpha_lpot(1:nexp_lpot)
836 nct_ppl(2:nexp_lpot + 1) = nct_lpot(1:nexp_lpot)
838 cval_ppl(1:nct_lpot(i), i + 1) = cval_lpot(1:nct_lpot(i), i)
841 ELSE IF (
ASSOCIATED(sgp_potential))
THEN
842 CALL get_potential(potential=sgp_potential, ecp_local=ecp_local, ecp_semi_local=ecp_semi_local, &
843 ppl_radius=ppl_radius)
844 do_upf =
ALLOCATED(sgp_potential%upf_data)
846 cpassert(.NOT. ecp_local .AND. .NOT. ecp_semi_local)
847 ELSE IF (ecp_local)
THEN
848 CALL get_potential(potential=sgp_potential, nloc=nloc, nrloc=nrloc, aloc=aloc, bloc=bloc)
849 IF (sum(abs(aloc(1:nloc))) < 1.0e-12_dp) cycle
851 cpassert(nexp_ppl <= nexp_max)
852 nct_ppl(1:nloc) = nrloc(1:nloc) - 1
853 alpha_ppl(1:nloc) = bloc(1:nloc)
854 cval_ppl(1, 1:nloc) = aloc(1:nloc)
856 CALL get_potential(potential=sgp_potential, n_local=n_local, a_local=a_local, c_local=c_local)
858 cpassert(nexp_ppl <= nexp_max)
859 nct_ppl(1:n_local) = 1
860 alpha_ppl(1:n_local) = a_local(1:n_local)
861 cval_ppl(1, 1:n_local) = c_local(1:n_local)
863 IF (ecp_semi_local)
THEN
864 cpabort(
"VCD with semi-local ECPs not implemented")
870 CALL nl_set_sub_iterator(ap_iterator, ikind, kkind, iatom, mepos=mepos)
872 DO WHILE (nl_sub_iterate(ap_iterator, mepos=mepos) == 0)
874 CALL get_iterator_info(ap_iterator, mepos=mepos, jatom=katom, r=rac)
875 dac = sqrt(sum(rac*rac))
876 rbc(:) = rac(:) - rab(:)
877 dbc = sqrt(sum(rbc*rbc))
878 IF ((maxval(set_radius_a(:)) + ppl_radius < dac) .OR. &
879 (maxval(set_radius_b(:)) + ppl_radius < dbc))
THEN
883 IF (set_radius_a(iset) + ppl_radius < dac) cycle
884 ncoa = npgfa(iset)*
ncoset(la_max(iset))
886 sgfa = first_sgfa(1, iset)
888 IF (set_radius_b(jset) + ppl_radius < dbc) cycle
889 ncob = npgfb(jset)*
ncoset(lb_max(jset))
891 sgfb = first_sgfb(1, jset)
892 IF (set_radius_a(iset) + set_radius_b(jset) < dab) cycle
900 CALL upf_local_matrix(sgp_potential%upf_local, &
901 la_max(iset) + 1, zeta(:npgfa(iset), iset), &
902 lb_max(jset) + 1, zetb(:npgfb(jset), jset), rab, rac, &
903 hab(:npgfa(iset)*
ncoset(la_max(iset) + 1), :npgfb(jset)*
ncoset(lb_max(jset) + 1)))
906 la_max(iset) + 1, la_min(iset), npgfa(iset), &
907 rpgfa(:, iset), zeta(:, iset), &
908 lb_max(jset) + 1, lb_min(jset), npgfb(jset), &
909 rpgfb(:, jset), zetb(:, jset), &
910 nexp_ppl, alpha_ppl, nct_ppl, cval_ppl, ppl_radius, &
911 rab, dab, rac, dac, rbc, dbc, hab(:, :), ppl_work)
915 CALL apply_cartesian_operator(la_max(iset), 0, npgfa(iset), lb_max(jset), 0, npgfb(jset), &
916 hab, rhab, right=.false., derivative=.false., origin=raf)
919 CALL dgemm(
"N",
"N", ncoa, nsgfb(jset), ncob, &
920 1.0_dp, rhab(1, 1, idir),
SIZE(rhab, 1), &
921 sphi_b(1, sgfb),
SIZE(sphi_b, 1), &
922 0.0_dp, work(1, 1, idir),
SIZE(work, 1))
925 CALL dgemm(
"T",
"N", nsgfa(iset), nsgfb(jset), ncoa, &
926 1.0_dp, sphi_a(1, sgfa),
SIZE(sphi_a, 1), &
927 work(1, 1, idir),
SIZE(work, 1), &
928 1.0_dp, blocks_rcore(idir, i)%block(sgfa, sgfb), &
929 SIZE(blocks_rcore(idir, i)%block, 1))
939 DEALLOCATE (hab, rhab, work, ppl_work)
943 CALL neighbor_list_iterator_release(ap_iterator)
944 CALL neighbor_list_iterator_release(nl_iterator)
946 DEALLOCATE (atom_of_kind, basis_set_list)
948 CALL timestop(handle)
950 END SUBROUTINE build_rcore_matrices
960 SUBROUTINE build_vhxc_matrices(matrix_hr, matrix_rh, qs_env, rc)
961 TYPE(dbcsr_p_type),
DIMENSION(:, :), &
962 INTENT(INOUT),
POINTER :: matrix_hr, matrix_rh
963 TYPE(qs_environment_type),
POINTER :: qs_env
964 REAL(kind=dp),
DIMENSION(3) :: rc
966 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_vhxc_matrices'
967 INTEGER,
PARAMETER :: nspins = 1
969 INTEGER :: handle, idir, ispin
970 REAL(kind=dp) :: edisp
971 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks
972 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_rvxc, matrix_rvxc_desymm
973 TYPE(pw_env_type),
POINTER :: pw_env
974 TYPE(pw_pool_type),
POINTER :: auxbas_pw_pool
975 TYPE(pw_r3d_rs_type),
DIMENSION(:),
POINTER :: v_rspace, v_tau_rspace
976 TYPE(pw_r3d_rs_type),
POINTER :: v_hartree_rspace
977 TYPE(qs_energy_type),
POINTER :: energy
978 TYPE(qs_ks_env_type),
POINTER :: ks_env
979 TYPE(qs_rho_type),
POINTER :: rho_struct
980 TYPE(section_vals_type),
POINTER :: input, xc_section
982 CALL timeset(routinen, handle)
984 CALL get_qs_env(qs_env, matrix_ks=matrix_ks, &
988 v_hartree_rspace=v_hartree_rspace, &
991 CALL pw_env_get(pw_env, auxbas_pw_pool=auxbas_pw_pool)
993 NULLIFY (matrix_rvxc, matrix_rvxc_desymm)
994 CALL dbcsr_allocate_matrix_set(matrix_rvxc, nspins, 3)
995 CALL dbcsr_allocate_matrix_set(matrix_rvxc_desymm, nspins, 3)
999 CALL dbcsr_init_p(matrix_rvxc(ispin, idir)%matrix)
1000 CALL dbcsr_init_p(matrix_rvxc_desymm(ispin, idir)%matrix)
1002 CALL dbcsr_copy(matrix_rvxc_desymm(ispin, idir)%matrix, matrix_hr(1, 1)%matrix)
1003 CALL dbcsr_set(matrix_rvxc_desymm(ispin, idir)%matrix, 0._dp)
1005 CALL dbcsr_copy(matrix_rvxc(ispin, idir)%matrix, matrix_ks(ispin)%matrix)
1006 CALL dbcsr_set(matrix_rvxc(ispin, idir)%matrix, 0.0_dp)
1010 xc_section => section_vals_get_subs_vals(input,
"DFT%XC")
1011 CALL get_qs_env(qs_env=qs_env, rho=rho_struct)
1014 NULLIFY (v_tau_rspace)
1015 CALL qs_vxc_create(ks_env=ks_env, rho_struct=rho_struct, xc_section=xc_section, &
1016 vxc_rho=v_rspace, vxc_tau=v_tau_rspace, exc=energy%exc, &
1017 edisp=edisp, dispersion_env=qs_env%dispersion_env, &
1018 just_energy=.false.)
1020 IF (.NOT.
ASSOCIATED(v_rspace))
THEN
1021 ALLOCATE (v_rspace(nspins))
1022 DO ispin = 1, nspins
1023 CALL auxbas_pw_pool%create_pw(v_rspace(ispin))
1024 CALL pw_zero(v_rspace(ispin))
1028 DO ispin = 1, nspins
1029 CALL pw_axpy(v_hartree_rspace, v_rspace(ispin), 1.0_dp/v_hartree_rspace%pw_grid%dvol)
1030 CALL integrate_rv_rspace(v_rspace=v_rspace(ispin), hmat=matrix_rvxc(ispin, :), qs_env=qs_env, &
1034 CALL dbcsr_scale(matrix_rvxc(ispin, idir)%matrix, v_rspace(ispin)%pw_grid%dvol)
1035 CALL dbcsr_desymmetrize(matrix_rvxc(ispin, idir)%matrix, matrix_rvxc_desymm(ispin, idir)%matrix)
1036 CALL dbcsr_add(matrix_hr(ispin, idir)%matrix, matrix_rvxc_desymm(ispin, idir)%matrix, 1.0_dp, 1.0_dp)
1037 CALL dbcsr_add(matrix_rh(ispin, idir)%matrix, matrix_rvxc_desymm(ispin, idir)%matrix, 1.0_dp, 1.0_dp)
1042 DO ispin = 1, nspins
1043 CALL auxbas_pw_pool%give_back_pw(v_rspace(ispin))
1045 DEALLOCATE (v_rspace)
1047 CALL dbcsr_deallocate_matrix_set(matrix_rvxc)
1048 CALL dbcsr_deallocate_matrix_set(matrix_rvxc_desymm)
1050 CALL timestop(handle)
1052 END SUBROUTINE build_vhxc_matrices
1065 SUBROUTINE integrate_rv_rspace(v_rspace, hmat, qs_env, rc)
1067 TYPE(pw_r3d_rs_type) :: v_rspace
1068 TYPE(dbcsr_p_type),
DIMENSION(:),
INTENT(INOUT) :: hmat
1069 TYPE(qs_environment_type),
POINTER :: qs_env
1070 REAL(kind=dp),
DIMENSION(3) :: rc
1072 CHARACTER(len=*),
PARAMETER :: routinen =
'integrate_rv_rspace'
1074 CHARACTER(len=default_string_length) :: my_basis_type
1075 INTEGER :: bcol, brow, handle, iatom, idir, igrid_level, ikind, ikind_old, ilevel, img, &
1076 ipair, ipgf, ipgf_new, iset, iset_new, iset_old, itask, ithread, jatom, jkind, jkind_old, &
1077 jpgf, jpgf_new, jset, jset_new, jset_old, ldsab, maxco, maxlgto, maxpgf, maxset, &
1078 maxsgf_set, na1, na2, natom, nb1, nb2, ncoa, ncoa_full, ncob, ncob_full, nkind, nseta, &
1079 nsetb, nthread, offset, sgfa, sgfb
1080 INTEGER,
DIMENSION(:),
POINTER :: col_blk_size, la_max, la_min, lb_max, &
1081 lb_min, npgfa, npgfb, nsgfa, nsgfb, &
1083 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
1084 LOGICAL :: atom_pair_changed, atom_pair_done, &
1085 found, has_threads, my_compute_tau, &
1086 my_gapw, new_set_pair_coming
1087 REAL(kind=dp) :: eps_rho_rspace, f, prefactor, radius, &
1089 REAL(kind=dp),
ALLOCATABLE,
DIMENSION(:, :), &
1091 REAL(kind=dp),
DIMENSION(3) :: ra, rab, rab_inv, rac, rb, rbc, rp
1092 REAL(kind=dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
1093 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: hab, sphi_a, sphi_b, work, zeta, zetb
1094 REAL(kind=dp),
DIMENSION(:, :, :),
POINTER :: habt, rhab, workt
1095 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1096 TYPE(block_p_type),
ALLOCATABLE,
DIMENSION(:) :: h_block
1097 TYPE(cell_type),
POINTER :: cell
1098 TYPE(dbcsr_distribution_type) :: dist
1099 TYPE(dbcsr_p_type) :: matrix_image(1)
1100 TYPE(dft_control_type),
POINTER :: dft_control
1101 TYPE(gridlevel_info_type),
POINTER :: gridlevel_info
1102 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
1103 TYPE(mp_comm_type) :: group
1104 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1105 TYPE(pw_env_type),
POINTER :: pw_env
1106 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1107 TYPE(realspace_grid_type),
DIMENSION(:),
POINTER :: rs_v
1108 TYPE(task_list_type),
POINTER :: task_list, task_list_soft
1109 TYPE(task_type),
DIMENSION(:),
POINTER :: tasks
1110 TYPE(virial_type),
POINTER :: virial
1112 CALL timeset(routinen, handle)
1114 my_compute_tau = .false.
1116 my_basis_type =
"ORB"
1119 CALL get_qs_env(qs_env=qs_env, &
1120 task_list=task_list, &
1121 task_list_soft=task_list_soft)
1122 cpassert(
ASSOCIATED(task_list))
1127 CALL get_qs_env(qs_env=qs_env, pw_env=pw_env)
1128 cpassert(
ASSOCIATED(pw_env))
1131 CALL get_qs_env(qs_env=qs_env, &
1132 atomic_kind_set=atomic_kind_set, &
1133 qs_kind_set=qs_kind_set, &
1135 dft_control=dft_control, &
1136 particle_set=particle_set, &
1145 tasks => task_list%tasks
1147 cpassert(
ASSOCIATED(pw_env))
1148 CALL pw_env_get(pw_env, rs_grids=rs_v)
1151 group = rs_v(1)%desc%group
1154 gridlevel_info => pw_env%gridlevel_info
1157 CALL potential_pw2rs(rs_v, v_rspace, pw_env)
1159 nkind =
SIZE(qs_kind_set)
1162 eps_rho_rspace = dft_control%qs_control%eps_rho_rspace
1164 CALL get_qs_kind_set(qs_kind_set=qs_kind_set, &
1167 maxsgf_set=maxsgf_set, &
1168 basis_type=my_basis_type)
1177 CALL get_qs_kind(qs_kind_set(ikind), &
1178 basis_set=orb_basis_set, basis_type=my_basis_type)
1180 IF (.NOT.
ASSOCIATED(orb_basis_set)) cycle
1182 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1183 npgf=npgfa, nset=nseta)
1185 maxset = max(nseta, maxset)
1186 maxpgf = max(maxval(npgfa), maxpgf)
1189 ldsab = max(maxco, maxsgf_set, maxpgf*
ncoset(maxlgto + 1))
1192 NULLIFY (habt, workt)
1193 CALL reallocate(habt, 1, ldsab, 1, ldsab, 0, nthread)
1194 CALL reallocate(workt, 1, ldsab, 1, maxsgf_set, 0, nthread)
1195 ALLOCATE (rhab(ldsab, ldsab, 3))
1197 ALLOCATE (h_block(3))
1199 IF (
ASSOCIATED(task_list%atom_pair_send))
THEN
1201 ALLOCATE (h_buffer(task_list%buffer_size_recv, 3))
1202 h_buffer(:, :) = 0.0_dp
1203 CALL dbcsr_get_info(hmat(1)%matrix, row_blk_size=row_blk_size, col_blk_size=col_blk_size)
1208 work => workt(:, :, ithread)
1209 hab => habt(:, :, ithread)
1212 iset_old = -1; jset_old = -1
1213 ikind_old = -1; jkind_old = -1
1219 loop_gridlevels:
DO igrid_level = 1, gridlevel_info%ngrid_levels
1220 IF (.NOT.
ALLOCATED(h_buffer))
THEN
1222 CALL dbcsr_work_create(hmat(idir)%matrix, work_mutable=.true., n=nthread)
1223 CALL dbcsr_get_info(hmat(idir)%matrix, distribution=dist)
1224 CALL dbcsr_distribution_get(dist, has_threads=has_threads)
1230 loop_pairs:
DO ipair = 1, task_list%npairs(igrid_level)
1231 loop_tasks:
DO itask = task_list%taskstart(ipair, igrid_level), task_list%taskstop(ipair, igrid_level)
1232 ilevel = tasks(itask)%grid_level
1233 img = tasks(itask)%image
1234 iatom = tasks(itask)%iatom
1235 jatom = tasks(itask)%jatom
1236 iset = tasks(itask)%iset
1237 jset = tasks(itask)%jset
1238 ipgf = tasks(itask)%ipgf
1239 jpgf = tasks(itask)%jpgf
1243 IF (itask == task_list%taskstart(ipair, igrid_level))
THEN
1245 ikind = particle_set(iatom)%atomic_kind%kind_number
1246 jkind = particle_set(jatom)%atomic_kind%kind_number
1248 IF (iatom <= jatom)
THEN
1256 IF (ikind /= ikind_old)
THEN
1257 CALL get_qs_kind(qs_kind_set(ikind), &
1258 basis_set=orb_basis_set, basis_type=my_basis_type)
1260 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1261 first_sgf=first_sgfa, &
1267 set_radius=set_radius_a, &
1272 IF (jkind /= jkind_old)
THEN
1273 CALL get_qs_kind(qs_kind_set(jkind), &
1274 basis_set=orb_basis_set, basis_type=my_basis_type)
1275 CALL get_gto_basis_set(gto_basis_set=orb_basis_set, &
1276 first_sgf=first_sgfb, &
1282 set_radius=set_radius_b, &
1289 NULLIFY (h_block(idir)%block)
1290 IF (
ALLOCATED(h_buffer))
THEN
1291 offset = task_list%pair_offsets_recv(tasks(itask)%pair_index)
1292 h_block(idir)%block(1:row_blk_size(brow), 1:col_blk_size(bcol)) => &
1293 h_buffer(offset + 1:offset + row_blk_size(brow)*col_blk_size(bcol), idir)
1295 CALL dbcsr_get_block_p(hmat(idir)%matrix, brow, bcol, h_block(idir)%block, found)
1303 atom_pair_changed = .true.
1307 atom_pair_changed = .false.
1311 IF (atom_pair_changed .OR. iset_old /= iset .OR. jset_old /= jset)
THEN
1314 ncoa = npgfa(iset)*
ncoset(la_max(iset))
1315 ncoa_full = npgfa(iset)*
ncoset(la_max(iset) + 1)
1316 sgfa = first_sgfa(1, iset)
1317 ncob = npgfb(jset)*
ncoset(lb_max(jset))
1318 ncob_full = npgfb(jset)*
ncoset(lb_max(jset) + 1)
1319 sgfb = first_sgfb(1, jset)
1321 IF (iatom <= jatom)
THEN
1322 hab(1:ncoa_full, 1:ncob_full) = 0._dp
1324 hab(1:ncob_full, 1:ncoa_full) = 0._dp
1332 rab = tasks(itask)%rab
1334 ra = pbc(particle_set(iatom)%r(:), cell)
1335 rb(:) = ra(:) + rab(:)
1336 rac = pbc(rc, ra, cell)
1339 zetp = zeta(ipgf, iset) + zetb(jpgf, jset)
1340 f = zetb(jpgf, jset)/zetp
1341 rp(:) = ra(:) + f*rab(:)
1343 prefactor = exp(-zeta(ipgf, iset)*f*dot_product(rab, rab))
1344 radius = exp_radius_very_extended(la_min=la_min(iset), la_max=la_max(iset), &
1345 lb_min=lb_min(jset), lb_max=lb_max(jset), &
1346 ra=ra, rb=rb, rp=rp, &
1347 zetp=zetp, eps=eps_rho_rspace, &
1348 prefactor=prefactor, cutoff=1.0_dp)
1350 na1 = (ipgf - 1)*
ncoset(la_max(iset) + 1) + 1
1351 na2 = ipgf*
ncoset(la_max(iset) + 1)
1352 nb1 = (jpgf - 1)*
ncoset(lb_max(jset) + 1) + 1
1353 nb2 = jpgf*
ncoset(lb_max(jset) + 1)
1355 IF (iatom <= jatom)
THEN
1356 CALL integrate_pgf_product( &
1357 la_max(iset) + 1, zeta(ipgf, iset), la_min(iset), &
1358 lb_max(jset) + 1, zetb(jpgf, jset), lb_min(jset), &
1359 ra, rab, rs_v(igrid_level), &
1360 hab, o1=na1 - 1, o2=nb1 - 1, &
1362 calculate_forces=.false.)
1365 CALL integrate_pgf_product( &
1366 lb_max(jset) + 1, zetb(jpgf, jset), lb_min(jset), &
1367 la_max(iset) + 1, zeta(ipgf, iset), la_min(iset), &
1368 rb, rab_inv, rs_v(igrid_level), &
1369 hab, o1=nb1 - 1, o2=na1 - 1, &
1371 calculate_forces=.false.)
1374 new_set_pair_coming = .false.
1375 atom_pair_done = .false.
1376 IF (itask < task_list%taskstop(ipair, igrid_level))
THEN
1377 ilevel = tasks(itask + 1)%grid_level
1378 img = tasks(itask + 1)%image
1379 iatom = tasks(itask + 1)%iatom
1380 jatom = tasks(itask + 1)%jatom
1381 iset_new = tasks(itask + 1)%iset
1382 jset_new = tasks(itask + 1)%jset
1383 ipgf_new = tasks(itask + 1)%ipgf
1384 jpgf_new = tasks(itask + 1)%jpgf
1385 IF (iset_new /= iset .OR. jset_new /= jset)
THEN
1386 new_set_pair_coming = .true.
1390 new_set_pair_coming = .true.
1391 atom_pair_done = .true.
1394 IF (new_set_pair_coming)
THEN
1396 IF (iatom <= jatom)
THEN
1397 CALL apply_cartesian_operator(la_max(iset), 0, npgfa(iset), lb_max(jset), 0, npgfb(jset), &
1398 hab, rhab, right=.false., derivative=.false., origin=rac)
1401 CALL apply_cartesian_operator(lb_max(jset), 0, npgfb(jset), la_max(iset), 0, npgfa(iset), &
1402 hab, rhab, right=.true., derivative=.false., origin=rac)
1407 IF (iatom <= jatom)
THEN
1409 work(1:ncoa, 1:nsgfb(jset)) = matmul(rhab(1:ncoa, 1:ncob, idir), sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1))
1410 h_block(idir)%block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) = &
1411 h_block(idir)%block(sgfa:sgfa + nsgfa(iset) - 1, sgfb:sgfb + nsgfb(jset) - 1) + &
1412 matmul(transpose(sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1)), work(1:ncoa, 1:nsgfb(jset)))
1414 work(1:ncob, 1:nsgfa(iset)) = matmul(rhab(1:ncob, 1:ncoa, idir), sphi_a(1:ncoa, sgfa:sgfa + nsgfa(iset) - 1))
1415 h_block(idir)%block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) = &
1416 h_block(idir)%block(sgfb:sgfb + nsgfb(jset) - 1, sgfa:sgfa + nsgfa(iset) - 1) + &
1417 matmul(transpose(sphi_b(1:ncob, sgfb:sgfb + nsgfb(jset) - 1)), work(1:ncob, 1:nsgfa(iset)))
1425 IF (.NOT.
ALLOCATED(h_buffer))
THEN
1427 CALL dbcsr_finalize(hmat(idir)%matrix)
1431 END DO loop_gridlevels
1433 IF (
ALLOCATED(h_buffer))
THEN
1435 task_list%hab_buffer%host_buffer(:) = h_buffer(:, idir)
1436 matrix_image(1)%matrix => hmat(idir)%matrix
1437 CALL rs_gather_matrices(task_list%hab_buffer, matrix_image, task_list, group)
1442 DEALLOCATE (habt, rhab, workt, h_block)
1444 CALL timestop(handle)
1446 END SUBROUTINE integrate_rv_rspace
1458 TYPE(qs_environment_type),
POINTER :: qs_env
1459 TYPE(dbcsr_p_type),
DIMENSION(:) :: matrix_dsdv
1460 REAL(kind=dp),
DIMENSION(:, :) :: deltar
1461 REAL(kind=dp),
DIMENSION(3) :: rcc
1463 CHARACTER(len=*),
PARAMETER :: routinen =
'build_dSdV_matrix'
1465 INTEGER :: handle, i
1466 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_ks, my_matrix_dsdv, &
1467 my_matrix_dsdv2, my_matrix_mom
1468 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1470 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1472 CALL timeset(routinen, handle)
1474 NULLIFY (my_matrix_mom, my_matrix_dsdv, my_matrix_dsdv2, sab_all, qs_kind_set)
1476 CALL get_qs_env(qs_env=qs_env, &
1478 qs_kind_set=qs_kind_set, &
1479 matrix_ks=matrix_ks)
1482 CALL dbcsr_allocate_matrix_set(my_matrix_dsdv, 3)
1483 CALL dbcsr_allocate_matrix_set(my_matrix_dsdv2, 3)
1484 CALL dbcsr_allocate_matrix_set(my_matrix_mom, 3)
1487 ALLOCATE (my_matrix_dsdv(i)%matrix)
1488 ALLOCATE (my_matrix_dsdv2(i)%matrix)
1489 ALLOCATE (my_matrix_mom(i)%matrix)
1491 CALL dbcsr_copy(my_matrix_dsdv(i)%matrix, matrix_dsdv(i)%matrix)
1492 CALL dbcsr_copy(my_matrix_dsdv2(i)%matrix, matrix_dsdv(i)%matrix)
1493 CALL dbcsr_copy(my_matrix_mom(i)%matrix, matrix_ks(1)%matrix)
1495 CALL dbcsr_set(my_matrix_dsdv2(i)%matrix, 0.0_dp)
1496 CALL dbcsr_set(my_matrix_dsdv(i)%matrix, 0.0_dp)
1497 CALL dbcsr_set(my_matrix_mom(i)%matrix, 0.0_dp)
1498 CALL dbcsr_set(matrix_dsdv(i)%matrix, 0.0_dp)
1501 CALL build_local_moment_matrix(qs_env, my_matrix_mom, 1, ref_point=rcc, &
1502 neighbor_image=.true.)
1505 CALL dbcsr_desymmetrize(my_matrix_mom(i)%matrix, my_matrix_dsdv(i)%matrix)
1506 CALL dbcsr_copy(my_matrix_dsdv2(i)%matrix, my_matrix_dsdv(i)%matrix)
1511 deltar, direction_or=.true.)
1514 deltar, direction_or=.false.)
1516 CALL dbcsr_copy(matrix_dsdv(i)%matrix, my_matrix_dsdv(i)%matrix)
1517 CALL dbcsr_add(matrix_dsdv(i)%matrix, my_matrix_dsdv2(i)%matrix, 1.0_dp, -1.0_dp)
1520 CALL dbcsr_deallocate_matrix_set(my_matrix_dsdv)
1521 CALL dbcsr_deallocate_matrix_set(my_matrix_dsdv2)
1522 CALL dbcsr_deallocate_matrix_set(my_matrix_mom)
1524 CALL timestop(handle)
1540 SUBROUTINE build_com_rpnl_r(matrix_rcomr, matrix_rrcom, qs_kind_set, sab_all, sap_ppnl, eps_ppnl, &
1543 TYPE(dbcsr_p_type),
DIMENSION(:, :) :: matrix_rcomr, matrix_rrcom
1544 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1545 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1546 POINTER :: sab_all, sap_ppnl
1547 REAL(kind=dp),
INTENT(IN) :: eps_ppnl
1548 TYPE(particle_type),
DIMENSION(:),
INTENT(IN), &
1549 POINTER :: particle_set
1550 TYPE(cell_type),
POINTER :: cell
1552 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_com_rpnl_r'
1554 INTEGER :: handle, i, iab, iac, iatom, ibc, icol, &
1555 ikind, irow, j, jatom, jkind, kac, &
1556 kbc, kkind, na, natom, nb, nkind, np, &
1558 INTEGER,
DIMENSION(3) :: cell_b
1559 LOGICAL :: found, ppnl_present
1560 REAL(kind=dp),
DIMENSION(3) :: rab
1561 REAL(kind=dp),
DIMENSION(:, :, :),
POINTER :: achint, acint, bchint, bcint
1562 TYPE(alist_type),
POINTER :: alist_ac, alist_bc
1563 TYPE(block_p_type),
DIMENSION(3, 3, 2) :: blocks_rvr
1564 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set
1565 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
1566 TYPE(sap_int_type),
DIMENSION(:),
POINTER :: sap_int
1573 ppnl_present =
ASSOCIATED(sap_ppnl)
1574 IF (.NOT. ppnl_present)
RETURN
1576 CALL timeset(routinen, handle)
1577 nkind =
SIZE(qs_kind_set)
1578 natom =
SIZE(particle_set)
1582 ALLOCATE (sap_int(nkind*nkind))
1583 DO i = 1, nkind*nkind
1584 NULLIFY (sap_int(i)%alist, sap_int(i)%asort, sap_int(i)%aindex)
1585 sap_int(i)%nalist = 0
1594 CALL build_sap_ints(sap_int, sap_ppnl, qs_kind_set, nder=2, moment_mode=.true., &
1595 particle_set=particle_set, cell=cell, refpoint=[0._dp, 0._dp, 0._dp])
1598 CALL sap_sort(sap_int)
1600 ALLOCATE (basis_set(nkind))
1602 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
1603 IF (
ASSOCIATED(orb_basis_set))
THEN
1604 basis_set(ikind)%gto_basis_set => orb_basis_set
1606 NULLIFY (basis_set(ikind)%gto_basis_set)
1635 DO slot = 1, sab_all(1)%nl_size
1637 ikind = sab_all(1)%nlist_task(slot)%ikind
1638 jkind = sab_all(1)%nlist_task(slot)%jkind
1639 iatom = sab_all(1)%nlist_task(slot)%iatom
1640 jatom = sab_all(1)%nlist_task(slot)%jatom
1641 cell_b(:) = sab_all(1)%nlist_task(slot)%cell(:)
1642 rab(1:3) = sab_all(1)%nlist_task(slot)%r(1:3)
1644 IF (.NOT.
ASSOCIATED(basis_set(ikind)%gto_basis_set)) cycle
1645 IF (.NOT.
ASSOCIATED(basis_set(jkind)%gto_basis_set)) cycle
1646 iab = ikind + nkind*(jkind - 1)
1656 CALL dbcsr_get_block_p(matrix_rcomr(i, j)%matrix, irow, icol, blocks_rvr(i, j, 1)%block, found)
1658 CALL dbcsr_get_block_p(matrix_rrcom(i, j)%matrix, irow, icol, blocks_rvr(i, j, 2)%block, found)
1665 iac = ikind + nkind*(kkind - 1)
1666 ibc = jkind + nkind*(kkind - 1)
1667 IF (.NOT.
ASSOCIATED(sap_int(iac)%alist)) cycle
1668 IF (.NOT.
ASSOCIATED(sap_int(ibc)%alist)) cycle
1669 CALL get_alist(sap_int(iac), alist_ac, iatom)
1670 CALL get_alist(sap_int(ibc), alist_bc, jatom)
1671 IF (.NOT.
ASSOCIATED(alist_ac)) cycle
1672 IF (.NOT.
ASSOCIATED(alist_bc)) cycle
1673 DO kac = 1, alist_ac%nclist
1674 DO kbc = 1, alist_bc%nclist
1675 IF (alist_ac%clist(kac)%catom /= alist_bc%clist(kbc)%catom) cycle
1685 IF (all(cell_b + alist_bc%clist(kbc)%cell - alist_ac%clist(kac)%cell == 0))
THEN
1686 IF (alist_ac%clist(kac)%maxac*alist_bc%clist(kbc)%maxach < eps_ppnl) cycle
1687 acint => alist_ac%clist(kac)%acint
1688 bcint => alist_bc%clist(kbc)%acint
1689 achint => alist_ac%clist(kac)%achint
1690 bchint => alist_bc%clist(kbc)%achint
1700 blocks_rvr(i, j, 1)%block(1:na, 1:nb) = blocks_rvr(i, j, 1)%block(1:na, 1:nb) + &
1701 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_rr(i, j)))) - &
1702 matmul(achint(1:na, 1:np, bi_r(i)), transpose(bcint(1:nb, 1:np, bi_r(j))))
1705 blocks_rvr(i, j, 2)%block(1:na, 1:nb) = blocks_rvr(i, j, 2)%block(1:na, 1:nb) + &
1706 matmul(achint(1:na, 1:np, bi_r(j)), transpose(bcint(1:nb, 1:np, bi_r(i)))) - &
1707 matmul(achint(1:na, 1:np, bi_rr(i, j)), transpose(bcint(1:nb, 1:np, bi_1)))
1719 NULLIFY (blocks_rvr(i, j, 1)%block)
1720 NULLIFY (blocks_rvr(i, j, 2)%block)
1737 CALL release_sap_int(sap_int)
1739 DEALLOCATE (basis_set)
1741 CALL timestop(handle)
1756 SUBROUTINE build_dcom_rpnl(matrix_rv, qs_kind_set, sab_orb, sap_ppnl, eps_ppnl, particle_set, pseudoatom)
1758 TYPE(dbcsr_p_type),
DIMENSION(:, :) :: matrix_rv
1759 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1760 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
1761 POINTER :: sab_orb, sap_ppnl
1762 REAL(kind=dp),
INTENT(IN) :: eps_ppnl
1763 TYPE(particle_type),
DIMENSION(:),
INTENT(IN), &
1764 POINTER :: particle_set
1765 INTEGER,
INTENT(IN) :: pseudoatom
1767 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_dcom_rpnl'
1769 INTEGER :: handle, i, iab, iac, iatom, ibc, icol, &
1770 ikind, irow, j, jatom, jkind, kac, &
1771 kbc, kkind, na, natom, nb, nkind, np, &
1773 INTEGER,
DIMENSION(3) :: cell_b
1774 LOGICAL :: found, ppnl_present
1775 REAL(kind=dp),
DIMENSION(3) :: rab
1776 REAL(kind=dp),
DIMENSION(:, :, :),
POINTER :: achint, acint, bchint, bcint
1777 TYPE(alist_type),
POINTER :: alist_ac, alist_bc
1778 TYPE(block_p_type),
DIMENSION(3, 3) :: blocks_rv
1779 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set
1780 TYPE(gto_basis_set_type),
POINTER :: orb_basis_set
1781 TYPE(sap_int_type),
DIMENSION(:),
POINTER :: sap_int
1788 ppnl_present =
ASSOCIATED(sap_ppnl)
1789 IF (.NOT. ppnl_present)
RETURN
1791 CALL timeset(routinen, handle)
1792 nkind =
SIZE(qs_kind_set)
1793 natom =
SIZE(particle_set)
1797 ALLOCATE (sap_int(nkind*nkind))
1798 DO i = 1, nkind*nkind
1799 NULLIFY (sap_int(i)%alist, sap_int(i)%asort, sap_int(i)%aindex)
1800 sap_int(i)%nalist = 0
1804 CALL build_sap_ints(sap_int, sap_ppnl, qs_kind_set, nder=2, moment_mode=.true., &
1805 particle_set=particle_set, pseudoatom=pseudoatom)
1808 CALL sap_sort(sap_int)
1810 ALLOCATE (basis_set(nkind))
1812 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_set)
1813 IF (
ASSOCIATED(orb_basis_set))
THEN
1814 basis_set(ikind)%gto_basis_set => orb_basis_set
1816 NULLIFY (basis_set(ikind)%gto_basis_set)
1845 DO slot = 1, sab_orb(1)%nl_size
1847 ikind = sab_orb(1)%nlist_task(slot)%ikind
1848 jkind = sab_orb(1)%nlist_task(slot)%jkind
1849 iatom = sab_orb(1)%nlist_task(slot)%iatom
1850 jatom = sab_orb(1)%nlist_task(slot)%jatom
1851 cell_b(:) = sab_orb(1)%nlist_task(slot)%cell(:)
1852 rab(1:3) = sab_orb(1)%nlist_task(slot)%r(1:3)
1854 IF (.NOT.
ASSOCIATED(basis_set(ikind)%gto_basis_set)) cycle
1855 IF (.NOT.
ASSOCIATED(basis_set(jkind)%gto_basis_set)) cycle
1856 iab = ikind + nkind*(jkind - 1)
1859 IF (iatom <= jatom)
THEN
1869 CALL dbcsr_get_block_p(matrix_rv(i, j)%matrix, irow, icol, blocks_rv(i, j)%block, found)
1870 blocks_rv(i, j)%block = 0._dp
1877 iac = ikind + nkind*(kkind - 1)
1878 ibc = jkind + nkind*(kkind - 1)
1879 IF (.NOT.
ASSOCIATED(sap_int(iac)%alist)) cycle
1880 IF (.NOT.
ASSOCIATED(sap_int(ibc)%alist)) cycle
1881 CALL get_alist(sap_int(iac), alist_ac, iatom)
1882 CALL get_alist(sap_int(ibc), alist_bc, jatom)
1883 IF (.NOT.
ASSOCIATED(alist_ac)) cycle
1884 IF (.NOT.
ASSOCIATED(alist_bc)) cycle
1885 DO kac = 1, alist_ac%nclist
1886 DO kbc = 1, alist_bc%nclist
1887 IF (alist_ac%clist(kac)%catom /= alist_bc%clist(kbc)%catom) cycle
1888 IF (all(cell_b + alist_bc%clist(kbc)%cell - alist_ac%clist(kac)%cell == 0))
THEN
1889 IF (alist_ac%clist(kac)%maxac*alist_bc%clist(kbc)%maxach < eps_ppnl) cycle
1890 acint => alist_ac%clist(kac)%acint
1891 bcint => alist_bc%clist(kbc)%acint
1892 achint => alist_ac%clist(kac)%achint
1893 bchint => alist_bc%clist(kbc)%achint
1902 IF (iatom <= jatom)
THEN
1904 blocks_rv(1, 1)%block(1:na, 1:nb) = blocks_rv(1, 1)%block(1:na, 1:nb) + &
1905 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_x)))
1907 blocks_rv(1, 2)%block(1:na, 1:nb) = blocks_rv(1, 2)%block(1:na, 1:nb) + &
1908 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_y)))
1910 blocks_rv(1, 3)%block(1:na, 1:nb) = blocks_rv(1, 3)%block(1:na, 1:nb) + &
1911 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_z)))
1913 blocks_rv(2, 1)%block(1:na, 1:nb) = blocks_rv(2, 1)%block(1:na, 1:nb) + &
1914 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_x)))
1916 blocks_rv(2, 2)%block(1:na, 1:nb) = blocks_rv(2, 2)%block(1:na, 1:nb) + &
1917 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_y)))
1919 blocks_rv(2, 3)%block(1:na, 1:nb) = blocks_rv(2, 3)%block(1:na, 1:nb) + &
1920 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_z)))
1922 blocks_rv(3, 1)%block(1:na, 1:nb) = blocks_rv(3, 1)%block(1:na, 1:nb) + &
1923 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_x)))
1925 blocks_rv(3, 2)%block(1:na, 1:nb) = blocks_rv(3, 2)%block(1:na, 1:nb) + &
1926 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_y)))
1928 blocks_rv(3, 3)%block(1:na, 1:nb) = blocks_rv(3, 3)%block(1:na, 1:nb) + &
1929 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_z)))
1932 blocks_rv(1, 1)%block(1:na, 1:nb) = blocks_rv(1, 1)%block(1:na, 1:nb) - &
1933 matmul(achint(1:na, 1:np, bi_xx), transpose(bcint(1:nb, 1:np, bi_1)))
1935 blocks_rv(1, 2)%block(1:na, 1:nb) = blocks_rv(1, 2)%block(1:na, 1:nb) - &
1936 matmul(achint(1:na, 1:np, bi_xy), transpose(bcint(1:nb, 1:np, bi_1)))
1938 blocks_rv(1, 3)%block(1:na, 1:nb) = blocks_rv(1, 3)%block(1:na, 1:nb) - &
1939 matmul(achint(1:na, 1:np, bi_xz), transpose(bcint(1:nb, 1:np, bi_1)))
1941 blocks_rv(2, 1)%block(1:na, 1:nb) = blocks_rv(2, 1)%block(1:na, 1:nb) - &
1942 matmul(achint(1:na, 1:np, bi_xy), transpose(bcint(1:nb, 1:np, bi_1)))
1944 blocks_rv(2, 2)%block(1:na, 1:nb) = blocks_rv(2, 2)%block(1:na, 1:nb) - &
1945 matmul(achint(1:na, 1:np, bi_yy), transpose(bcint(1:nb, 1:np, bi_1)))
1947 blocks_rv(2, 3)%block(1:na, 1:nb) = blocks_rv(2, 3)%block(1:na, 1:nb) - &
1948 matmul(achint(1:na, 1:np, bi_yz), transpose(bcint(1:nb, 1:np, bi_1)))
1950 blocks_rv(3, 1)%block(1:na, 1:nb) = blocks_rv(3, 1)%block(1:na, 1:nb) - &
1951 matmul(achint(1:na, 1:np, bi_xz), transpose(bcint(1:nb, 1:np, bi_1)))
1953 blocks_rv(3, 2)%block(1:na, 1:nb) = blocks_rv(3, 2)%block(1:na, 1:nb) - &
1954 matmul(achint(1:na, 1:np, bi_yz), transpose(bcint(1:nb, 1:np, bi_1)))
1956 blocks_rv(3, 3)%block(1:na, 1:nb) = blocks_rv(3, 3)%block(1:na, 1:nb) - &
1957 matmul(achint(1:na, 1:np, bi_zz), transpose(bcint(1:nb, 1:np, bi_1)))
1960 blocks_rv(1, 1)%block(1:na, 1:nb) = blocks_rv(1, 1)%block(1:na, 1:nb) - &
1961 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_xx)))
1963 blocks_rv(1, 2)%block(1:na, 1:nb) = blocks_rv(1, 2)%block(1:na, 1:nb) - &
1964 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_xy)))
1966 blocks_rv(1, 3)%block(1:na, 1:nb) = blocks_rv(1, 3)%block(1:na, 1:nb) - &
1967 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_xz)))
1969 blocks_rv(2, 1)%block(1:na, 1:nb) = blocks_rv(2, 1)%block(1:na, 1:nb) - &
1970 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_xy)))
1972 blocks_rv(2, 2)%block(1:na, 1:nb) = blocks_rv(2, 2)%block(1:na, 1:nb) - &
1973 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_yy)))
1975 blocks_rv(2, 3)%block(1:na, 1:nb) = blocks_rv(2, 3)%block(1:na, 1:nb) - &
1976 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_yz)))
1978 blocks_rv(3, 1)%block(1:na, 1:nb) = blocks_rv(3, 1)%block(1:na, 1:nb) - &
1979 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_xz)))
1981 blocks_rv(3, 2)%block(1:na, 1:nb) = blocks_rv(3, 2)%block(1:na, 1:nb) - &
1982 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_yz)))
1984 blocks_rv(3, 3)%block(1:na, 1:nb) = blocks_rv(3, 3)%block(1:na, 1:nb) - &
1985 matmul(achint(1:na, 1:np, bi_1), transpose(bcint(1:nb, 1:np, bi_zz)))
1988 blocks_rv(1, 1)%block(1:na, 1:nb) = blocks_rv(1, 1)%block(1:na, 1:nb) + &
1989 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_x)))
1991 blocks_rv(1, 2)%block(1:na, 1:nb) = blocks_rv(1, 2)%block(1:na, 1:nb) + &
1992 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_x)))
1994 blocks_rv(1, 3)%block(1:na, 1:nb) = blocks_rv(1, 3)%block(1:na, 1:nb) + &
1995 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_x)))
1997 blocks_rv(2, 1)%block(1:na, 1:nb) = blocks_rv(2, 1)%block(1:na, 1:nb) + &
1998 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_y)))
2000 blocks_rv(2, 2)%block(1:na, 1:nb) = blocks_rv(2, 2)%block(1:na, 1:nb) + &
2001 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_y)))
2003 blocks_rv(2, 3)%block(1:na, 1:nb) = blocks_rv(2, 3)%block(1:na, 1:nb) + &
2004 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_y)))
2006 blocks_rv(3, 1)%block(1:na, 1:nb) = blocks_rv(3, 1)%block(1:na, 1:nb) + &
2007 matmul(achint(1:na, 1:np, bi_x), transpose(bcint(1:nb, 1:np, bi_z)))
2009 blocks_rv(3, 2)%block(1:na, 1:nb) = blocks_rv(3, 2)%block(1:na, 1:nb) + &
2010 matmul(achint(1:na, 1:np, bi_y), transpose(bcint(1:nb, 1:np, bi_z)))
2012 blocks_rv(3, 3)%block(1:na, 1:nb) = blocks_rv(3, 3)%block(1:na, 1:nb) + &
2013 matmul(achint(1:na, 1:np, bi_z), transpose(bcint(1:nb, 1:np, bi_z)))
2016 blocks_rv(1, 1)%block(1:nb, 1:na) = blocks_rv(1, 1)%block(1:nb, 1:na) + &
2017 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_x)))
2019 blocks_rv(1, 2)%block(1:nb, 1:na) = blocks_rv(1, 2)%block(1:nb, 1:na) + &
2020 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_y)))
2022 blocks_rv(1, 3)%block(1:nb, 1:na) = blocks_rv(1, 3)%block(1:nb, 1:na) + &
2023 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_z)))
2025 blocks_rv(2, 1)%block(1:nb, 1:na) = blocks_rv(2, 1)%block(1:nb, 1:na) + &
2026 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_x)))
2028 blocks_rv(2, 2)%block(1:nb, 1:na) = blocks_rv(2, 2)%block(1:nb, 1:na) + &
2029 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_y)))
2031 blocks_rv(2, 3)%block(1:nb, 1:na) = blocks_rv(2, 3)%block(1:nb, 1:na) + &
2032 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_z)))
2034 blocks_rv(3, 1)%block(1:nb, 1:na) = blocks_rv(3, 1)%block(1:nb, 1:na) + &
2035 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_x)))
2037 blocks_rv(3, 2)%block(1:nb, 1:na) = blocks_rv(3, 2)%block(1:nb, 1:na) + &
2038 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_y)))
2040 blocks_rv(3, 3)%block(1:nb, 1:na) = blocks_rv(3, 3)%block(1:nb, 1:na) + &
2041 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_z)))
2044 blocks_rv(1, 1)%block(1:nb, 1:na) = blocks_rv(1, 1)%block(1:nb, 1:na) - &
2045 matmul(bchint(1:nb, 1:np, bi_xx), transpose(acint(1:na, 1:np, bi_1)))
2047 blocks_rv(1, 2)%block(1:nb, 1:na) = blocks_rv(1, 2)%block(1:nb, 1:na) - &
2048 matmul(bchint(1:nb, 1:np, bi_xy), transpose(acint(1:na, 1:np, bi_1)))
2050 blocks_rv(1, 3)%block(1:nb, 1:na) = blocks_rv(1, 3)%block(1:nb, 1:na) - &
2051 matmul(bchint(1:nb, 1:np, bi_xz), transpose(acint(1:na, 1:np, bi_1)))
2053 blocks_rv(2, 1)%block(1:nb, 1:na) = blocks_rv(2, 1)%block(1:nb, 1:na) - &
2054 matmul(bchint(1:nb, 1:np, bi_xy), transpose(acint(1:na, 1:np, bi_1)))
2056 blocks_rv(2, 2)%block(1:nb, 1:na) = blocks_rv(2, 2)%block(1:nb, 1:na) - &
2057 matmul(bchint(1:nb, 1:np, bi_yy), transpose(acint(1:na, 1:np, bi_1)))
2059 blocks_rv(2, 3)%block(1:nb, 1:na) = blocks_rv(2, 3)%block(1:nb, 1:na) - &
2060 matmul(bchint(1:nb, 1:np, bi_yz), transpose(acint(1:na, 1:np, bi_1)))
2062 blocks_rv(3, 1)%block(1:nb, 1:na) = blocks_rv(3, 1)%block(1:nb, 1:na) - &
2063 matmul(bchint(1:nb, 1:np, bi_xz), transpose(acint(1:na, 1:np, bi_1)))
2065 blocks_rv(3, 2)%block(1:nb, 1:na) = blocks_rv(3, 2)%block(1:nb, 1:na) - &
2066 matmul(bchint(1:nb, 1:np, bi_yz), transpose(acint(1:na, 1:np, bi_1)))
2068 blocks_rv(3, 3)%block(1:nb, 1:na) = blocks_rv(3, 3)%block(1:nb, 1:na) - &
2069 matmul(bchint(1:nb, 1:np, bi_zz), transpose(acint(1:na, 1:np, bi_1)))
2072 blocks_rv(1, 1)%block(1:nb, 1:na) = blocks_rv(1, 1)%block(1:nb, 1:na) - &
2073 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_xx)))
2075 blocks_rv(1, 2)%block(1:nb, 1:na) = blocks_rv(1, 2)%block(1:nb, 1:na) - &
2076 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_xy)))
2078 blocks_rv(1, 3)%block(1:nb, 1:na) = blocks_rv(1, 3)%block(1:nb, 1:na) - &
2079 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_xz)))
2081 blocks_rv(2, 1)%block(1:nb, 1:na) = blocks_rv(2, 1)%block(1:nb, 1:na) - &
2082 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_xy)))
2084 blocks_rv(2, 2)%block(1:nb, 1:na) = blocks_rv(2, 2)%block(1:nb, 1:na) - &
2085 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_yy)))
2087 blocks_rv(2, 3)%block(1:nb, 1:na) = blocks_rv(2, 3)%block(1:nb, 1:na) - &
2088 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_yz)))
2090 blocks_rv(3, 1)%block(1:nb, 1:na) = blocks_rv(3, 1)%block(1:nb, 1:na) - &
2091 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_xz)))
2093 blocks_rv(3, 2)%block(1:nb, 1:na) = blocks_rv(3, 2)%block(1:nb, 1:na) - &
2094 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_yz)))
2096 blocks_rv(3, 3)%block(1:nb, 1:na) = blocks_rv(3, 3)%block(1:nb, 1:na) - &
2097 matmul(bchint(1:nb, 1:np, bi_1), transpose(acint(1:na, 1:np, bi_zz)))
2100 blocks_rv(1, 1)%block(1:nb, 1:na) = blocks_rv(1, 1)%block(1:nb, 1:na) + &
2101 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_x)))
2103 blocks_rv(1, 2)%block(1:nb, 1:na) = blocks_rv(1, 2)%block(1:nb, 1:na) + &
2104 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_x)))
2106 blocks_rv(1, 3)%block(1:nb, 1:na) = blocks_rv(1, 3)%block(1:nb, 1:na) + &
2107 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_x)))
2109 blocks_rv(2, 1)%block(1:nb, 1:na) = blocks_rv(2, 1)%block(1:nb, 1:na) + &
2110 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_y)))
2112 blocks_rv(2, 2)%block(1:nb, 1:na) = blocks_rv(2, 2)%block(1:nb, 1:na) + &
2113 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_y)))
2115 blocks_rv(2, 3)%block(1:nb, 1:na) = blocks_rv(2, 3)%block(1:nb, 1:na) + &
2116 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_y)))
2118 blocks_rv(3, 1)%block(1:nb, 1:na) = blocks_rv(3, 1)%block(1:nb, 1:na) + &
2119 matmul(bchint(1:nb, 1:np, bi_x), transpose(acint(1:na, 1:np, bi_z)))
2121 blocks_rv(3, 2)%block(1:nb, 1:na) = blocks_rv(3, 2)%block(1:nb, 1:na) + &
2122 matmul(bchint(1:nb, 1:np, bi_y), transpose(acint(1:na, 1:np, bi_z)))
2124 blocks_rv(3, 3)%block(1:nb, 1:na) = blocks_rv(3, 3)%block(1:nb, 1:na) + &
2125 matmul(bchint(1:nb, 1:np, bi_z), transpose(acint(1:na, 1:np, bi_z)))
2135 NULLIFY (blocks_rv(i, 1)%block)
2136 NULLIFY (blocks_rv(i, 2)%block)
2137 NULLIFY (blocks_rv(i, 3)%block)
2153 CALL release_sap_int(sap_int)
2155 DEALLOCATE (basis_set)
2157 CALL timestop(handle)
2175 TYPE(dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_hr
2176 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
2177 CHARACTER(LEN=*),
INTENT(IN) :: basis_type
2178 TYPE(neighbor_list_set_p_type),
DIMENSION(:), &
2180 REAL(kind=dp),
DIMENSION(:, :) :: deltar
2181 LOGICAL :: direction_or
2183 CHARACTER(len=*),
PARAMETER :: routinen =
'hr_mult_by_delta_3d'
2185 INTEGER :: handle, iatom, icol, ikind, ir, irow, &
2186 jatom, jkind, ldsab, mepos, nkind, &
2187 nseta, nsetb, nthread
2188 INTEGER,
DIMENSION(3) :: cell
2189 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
2191 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
2192 LOGICAL :: do_symmetric, found
2193 REAL(kind=dp),
DIMENSION(3) :: rab
2194 REAL(kind=dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
2195 REAL(kind=dp),
DIMENSION(:, :),
POINTER :: kx_block, ky_block, kz_block, rpgfa, &
2196 rpgfb, scon_a, scon_b, sphi_a, sphi_b, &
2198 TYPE(gto_basis_set_p_type),
DIMENSION(:),
POINTER :: basis_set_list
2199 TYPE(gto_basis_set_type),
POINTER :: basis_set_a, basis_set_b
2200 TYPE(neighbor_list_iterator_p_type), &
2201 DIMENSION(:),
POINTER :: nl_iterator
2203 CALL timeset(routinen, handle)
2205 nkind =
SIZE(qs_kind_set)
2208 cpassert(
SIZE(sab_nl) > 0)
2209 CALL get_neighbor_list_set_p(neighbor_list_sets=sab_nl, symmetric=do_symmetric)
2212 ALLOCATE (basis_set_list(nkind))
2213 CALL basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
2216 ldsab = get_memory_usage(qs_kind_set, basis_type)
2221 CALL neighbor_list_iterator_create(nl_iterator, sab_nl, nthread=nthread)
2237 DO WHILE (neighbor_list_iterate(nl_iterator, mepos=mepos) == 0)
2238 CALL get_iterator_info(nl_iterator, mepos=mepos, ikind=ikind, jkind=jkind, &
2239 iatom=iatom, jatom=jatom, r=rab, cell=cell)
2240 basis_set_a => basis_set_list(ikind)%gto_basis_set
2241 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
2242 basis_set_b => basis_set_list(jkind)%gto_basis_set
2243 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
2245 first_sgfa => basis_set_a%first_sgf
2246 la_max => basis_set_a%lmax
2247 la_min => basis_set_a%lmin
2248 npgfa => basis_set_a%npgf
2249 nsgfa => basis_set_a%nsgf_set
2250 rpgfa => basis_set_a%pgf_radius
2251 set_radius_a => basis_set_a%set_radius
2252 sphi_a => basis_set_a%sphi
2253 zeta => basis_set_a%zet
2254 scon_a => basis_set_a%scon
2256 first_sgfb => basis_set_b%first_sgf
2257 lb_max => basis_set_b%lmax
2258 lb_min => basis_set_b%lmin
2259 npgfb => basis_set_b%npgf
2260 nsgfb => basis_set_b%nsgf_set
2261 rpgfb => basis_set_b%pgf_radius
2262 set_radius_b => basis_set_b%set_radius
2263 sphi_b => basis_set_b%sphi
2264 zetb => basis_set_b%zet
2265 scon_b => basis_set_b%scon
2267 nseta = basis_set_a%nset
2268 nsetb = basis_set_b%nset
2270 IF (do_symmetric)
THEN
2271 IF (iatom <= jatom)
THEN
2283 NULLIFY (kx_block, ky_block, kz_block)
2284 CALL dbcsr_get_block_p(matrix_hr(1)%matrix, irow, icol, kx_block, found)
2286 CALL dbcsr_get_block_p(matrix_hr(2)%matrix, irow, icol, ky_block, found)
2288 CALL dbcsr_get_block_p(matrix_hr(3)%matrix, irow, icol, kz_block, found)
2291 IF (direction_or)
THEN
2296 kx_block(:, :) = kx_block(:, :)*deltar(ir, jatom)
2298 ky_block(:, :) = ky_block(:, :)*deltar(ir, jatom)
2300 kz_block(:, :) = kz_block(:, :)*deltar(ir, jatom)
2309 kx_block(:, :) = kx_block(:, :)*deltar(ir, iatom)
2311 ky_block(:, :) = ky_block(:, :)*deltar(ir, iatom)
2313 kz_block(:, :) = kz_block(:, :)*deltar(ir, iatom)
2320 CALL neighbor_list_iterator_release(nl_iterator)
2323 DEALLOCATE (basis_set_list)
2325 CALL timestop(handle)
static GRID_HOST_DEVICE int ncoset(const int l)
Number of Cartesian orbitals up to given angular momentum quantum.
static void dgemm(const char transa, const char transb, const int m, const int n, const int k, const double alpha, const double *a, const int lda, const double *b, const int ldb, const double beta, double *c, const int ldc)
Convenient wrapper to hide Fortran nature of dgemm_, swapping a and b.
Coordinate and basis-center derivative ladders for Cartesian Gaussian integrals. Derivatives act on a...
subroutine, public apply_cartesian_operator(la_max, la_min, npgfa, lb_max, lb_min, npgfb, ab, values, right, derivative, exponents, origin)
Apply a Cartesian operator on either side of a primitive integral block. The input includes one extra...
Set of routines to: Contract integrals over primitive Gaussians Decontract (density) matrices Trace m...
Calculation of the kinetic energy integrals over Cartesian Gaussian-type functions.
subroutine, public kinetic(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rab, kab, dab)
Calculation of the two-center kinetic energy integrals [a|T|b] over Cartesian Gaussian-type functions...
Calculation of three-center overlap integrals over Cartesian Gaussian-type functions for the second t...
subroutine, public ppl_integral(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, nexp_ppl, alpha_ppl, nct_ppl, cexp_ppl, rpgfc, rab, dab, rac, dac, rbc, dbc, vab, s, pab, force_a, force_b, fs, hab2, hab2_work, deltar, iatom, jatom, katom)
Calculation of three-center overlap integrals <a|c|b> over Cartesian Gaussian functions for the local...
All kind of helpful little routines.
real(kind=dp) function, public exp_radius_very_extended(la_min, la_max, lb_min, lb_max, pab, o1, o2, ra, rb, rp, zetp, eps, prefactor, cutoff, epsabs)
computes the radius of the Gaussian outside of which it is smaller than eps
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.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum, ccon)
...
collect pointers to a block of reals
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_scale(matrix, alpha_scalar)
...
subroutine, public dbcsr_desymmetrize(matrix_a, matrix_b)
...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_get_info(matrix, nblkrows_total, nblkcols_total, nfullrows_total, nfullcols_total, nblkrows_local, nblkcols_local, nfullrows_local, nfullcols_local, my_prow, my_pcol, local_rows, local_cols, proc_row_dist, proc_col_dist, row_blk_size, col_blk_size, row_blk_offset, col_blk_offset, distribution, name, matrix_type, group)
...
subroutine, public dbcsr_init_p(matrix)
...
subroutine, public dbcsr_work_create(matrix, nblks_guess, sizedata_guess, n, work_mutable)
...
subroutine, public dbcsr_finalize(matrix)
...
subroutine, public dbcsr_set(matrix, alpha)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_distribution_get(dist, row_dist, col_dist, nrows, ncols, has_threads, group, mynode, numnodes, nprows, npcols, myprow, mypcol, pgrid, subgroups_defined, prow_group, pcol_group)
...
DBCSR operations in CP2K.
Definition of the atomic potential types.
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_string_length
Utility routines for the memory handling.
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
subroutine, public init_orbital_pointers(maxl)
Initialize or update the orbital pointers.
integer, dimension(:), allocatable, public ncoset
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, mimic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, rhoz_cneo_set, ecoul_1c, rho0_s_rs, rho0_s_gs, rhoz_cneo_s_rs, rhoz_cneo_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Get the QUICKSTEP environment.
Some utility functions for the calculation of integrals.
subroutine, public basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
Set up an easy accessible list of the basis sets for all kinds.
Integrate single or product functions over a potential on a RS grid.
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, 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.
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, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
Type definitiona for linear response calculations.
Calculates the moment integrals <a|r^m|b> and <a|r x d/dr|b>.
subroutine, public build_local_moment_matrix(qs_env, moments, nmoments, ref_point, ref_points, basis_type, all_images, minimum_image, neighbor_image, first_component)
...
Define the neighbor list data types and the corresponding functionality.
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_neighbor_list_set_p(neighbor_list_sets, nlist, symmetric)
Return the components of the first neighbor list set.
integer function, public neighbor_list_iterate(iterator_set, mepos)
...
subroutine, public get_iterator_info(iterator_set, mepos, ikind, jkind, nkind, ilist, nlist, inode, nnode, iatom, jatom, r, cell)
...
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public build_dcom_rpnl(matrix_rv, qs_kind_set, sab_orb, sap_ppnl, eps_ppnl, particle_set, pseudoatom)
Calculate the double commutator [[Vnl, r], r].
subroutine, public build_com_rpnl_r(matrix_rcomr, matrix_rrcom, qs_kind_set, sab_all, sap_ppnl, eps_ppnl, particle_set, cell)
Build the two ordered nonlocal second-position products.
subroutine, public hr_mult_by_delta_3d(matrix_hr, qs_kind_set, basis_type, sab_nl, deltar, direction_or)
Apply the operator \delta_\mu^\lambda to zero out all elements of the matrix which don't fulfill the ...
subroutine, public build_dsdv_matrix(qs_env, matrix_dsdv, deltar, rcc)
Builds the overlap derivative wrt nuclear velocities dS/dV = < mu | r | nu > * (nu - mu).
subroutine, public build_matrix_hr_rh(vcd_env, qs_env, rc)
Build the matrix Hr*delta_nu^\lambda - rH*delta_mu^\lambda.
subroutine, public qs_vxc_create(ks_env, rho_struct, xc_section, vxc_rho, vxc_tau, exc, just_energy, edisp, dispersion_env, adiabatic_rescale_factor, pw_env_external, native_skala_atom_force, qs_env_external, native_gapw_composite_override, native_skala_defer_to_atom_composite)
calculates and allocates the xc potential, already reducing it to the dependence on rho and the one o...
Transfers densities from PW to RS grids and potentials from PW to RS.
subroutine, public potential_pw2rs(rs_v, v_rspace, pw_env)
transfers a potential from a pw_grid to a vector of realspace multigrids
General overlap type integrals containers.
subroutine, public build_sap_ints(sap_int, sap_ppnl, qs_kind_set, nder, moment_mode, refpoint, particle_set, cell, pseudoatom)
Calculate overlap and optionally momenta <a|x^n|p> between GTOs and nl. pseudo potential projectors a...
generate the tasks lists used by collocate and integrate routines
subroutine, public rs_gather_matrices(src_buffer, dest_matrices, task_list, group)
Gather the dbcsr matrix blocks and receives them into a buffer as needed after integration.
Local UPF matrix elements from the original radial potential. The Gaussian core electrostatics suppli...
subroutine, public upf_local_matrix(local, la, alpha, lb, beta, rab, rac, v, da, db)
Evaluate primitive three-center local integrals by the Gaussian product theorem.
subroutine, public upf_local_init(pot, alpha, degree, local, eps)
Prepare the short-range local potential outside parallel regions.
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
contained for different pw related things
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.