93#include "./base/base_uses.f90"
99 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'xtb_matrices'
113 LOGICAL,
INTENT(IN) :: calculate_forces
118 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
119 gfn_type = dft_control%qs_control%xtb_control%gfn_type
121 SELECT CASE (gfn_type)
123 CALL build_gfn0_xtb_matrices(qs_env, calculate_forces)
125 CALL build_gfn1_xtb_matrices(qs_env, calculate_forces)
127 cpabort(
"gfn_type = 2 not yet available")
129 cpabort(
"Unknown gfn_type")
139 SUBROUTINE build_gfn0_xtb_matrices(qs_env, calculate_forces)
142 LOGICAL,
INTENT(IN) :: calculate_forces
144 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_gfn0_xtb_matrices'
146 INTEGER :: atom_a, atom_b, atom_c, handle, i, iatom, ic, icol, ikind, img, ir, irow, iset, &
147 j, jatom, jkind, jset, katom, kkind, la, lb, ldsab, lmaxa, lmaxb, maxder, n1, n2, na, &
148 natom, natorb_a, natorb_b, nb, ncoa, ncob, nderivatives, nimg, nkind, nsa, nsb, nseta, &
149 nsetb, sgfa, sgfb, za, zb
150 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
151 INTEGER,
DIMENSION(25) :: laoa, laob, naoa, naob
152 INTEGER,
DIMENSION(3) :: cell
153 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
155 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
156 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
157 LOGICAL :: defined, diagblock, do_nonbonded, found, &
159 REAL(kind=
dp) :: dfp, dhij, dr, drk, drx, eeq_energy, ef_energy, enonbonded, enscale, erep, &
160 esrb, etaa, etab, f0, f1, f2, fhua, fhub, fhud, foab, fqa, fqb, hij, kf, qlambda, rcova, &
162 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: charges, cnumbers, dcharges, qlagrange
163 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dfblock, dhuckel, dqhuckel, huckel, owork
164 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: oint, sint
165 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: kijab
166 REAL(kind=
dp),
DIMENSION(3) :: fdik, fdika, fdikb, force_ab, rij, rik
167 REAL(kind=
dp),
DIMENSION(5) :: dpia, dpib, hena, henb, kpolya, kpolyb, &
169 REAL(kind=
dp),
DIMENSION(:),
POINTER :: eeq_q, set_radius_a, set_radius_b
170 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: fblock, pblock, rpgfa, rpgfb, sblock, &
171 scon_a, scon_b, wblock, zeta, zetb
176 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p, matrix_s, matrix_w
177 TYPE(
dcnum_type),
ALLOCATABLE,
DIMENSION(:) :: dcnum
185 DIMENSION(:),
POINTER :: nl_iterator
187 POINTER :: sab_orb, sab_xtb_nonbond
192 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
199 CALL timeset(routinen, handle)
201 NULLIFY (logger, virial, atprop)
204 NULLIFY (matrix_h, matrix_s, matrix_p, matrix_w, atomic_kind_set, &
205 qs_kind_set, sab_orb, ks_env)
209 atomic_kind_set=atomic_kind_set, &
210 qs_kind_set=qs_kind_set, &
211 matrix_h_kp=matrix_h, &
212 matrix_s_kp=matrix_s, &
215 dft_control=dft_control, &
218 nkind =
SIZE(atomic_kind_set)
219 xtb_control => dft_control%qs_control%xtb_control
220 do_nonbonded = xtb_control%do_nonbonded
221 nimg = dft_control%nimages
223 IF (calculate_forces) nderivatives = 1
224 IF (dft_control%tddfpt2_control%enabled) nderivatives = 1
225 maxder =
ncoset(nderivatives)
227 NULLIFY (particle_set)
228 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
229 natom =
SIZE(particle_set)
231 atom_of_kind=atom_of_kind, kind_of=kind_of)
233 IF (calculate_forces)
THEN
234 NULLIFY (rho, force, matrix_w)
236 rho=rho, matrix_w_kp=matrix_w, &
237 virial=virial, force=force)
240 IF (
SIZE(matrix_p, 1) == 2)
THEN
242 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
243 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
244 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, &
245 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
248 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
251 IF (atprop%energy)
THEN
255 NULLIFY (cell_to_index)
257 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
262 ALLOCATE (basis_set_list(nkind))
267 CALL create_sab_matrix(ks_env, matrix_s,
"xTB OVERLAP MATRIX", basis_set_list, basis_set_list, &
274 ALLOCATE (matrix_h(1, img)%matrix)
275 CALL dbcsr_create(matrix_h(1, img)%matrix, template=matrix_s(1, 1)%matrix, &
276 name=
"HAMILTONIAN MATRIX")
284 CALL cnumber_init(qs_env, cnumbers, dcnum, 2, calculate_forces)
286 ALLOCATE (charges(natom))
288 CALL xtb_eeq_calculation(qs_env, charges, cnumbers, eeq_sparam, eeq_energy, ef_energy, qlambda)
289 IF (calculate_forces)
THEN
290 ALLOCATE (dcharges(natom))
291 dcharges = qlambda/real(para_env%num_pe, kind=
dp)
293 energy%eeq = eeq_energy
294 energy%efield = ef_energy
296 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
299 dispersion_env%ext_charges = .true.
300 IF (
ASSOCIATED(dispersion_env%charges))
DEALLOCATE (dispersion_env%charges)
301 ALLOCATE (dispersion_env%charges(natom))
302 dispersion_env%charges = charges
303 IF (calculate_forces)
THEN
304 IF (
ASSOCIATED(dispersion_env%dcharges))
DEALLOCATE (dispersion_env%dcharges)
305 ALLOCATE (dispersion_env%dcharges(natom))
306 dispersion_env%dcharges = 0.0_dp
310 energy%dispersion, calculate_forces)
311 IF (calculate_forces)
THEN
312 IF (dispersion_env%pp_type ==
vdw_pairpot_dftd4 .AND. dispersion_env%ext_charges)
THEN
313 dcharges(1:natom) = dcharges(1:natom) + dispersion_env%dcharges(1:natom)
318 CALL gfn0_huckel(qs_env, cnumbers, charges, huckel, dhuckel, dqhuckel, calculate_forces)
327 iatom=iatom, jatom=jatom, r=rij, cell=cell)
328 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
330 IF (.NOT. defined .OR. natorb_a < 1) cycle
331 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
333 IF (.NOT. defined .OR. natorb_b < 1) cycle
335 dr = sqrt(sum(rij(:)**2))
339 lmax=lmaxa, nshell=nsa, kpoly=kpolya, hen=hena)
341 lmax=lmaxb, nshell=nsb, kpoly=kpolyb, hen=henb)
346 ic = cell_to_index(cell(1), cell(2), cell(3))
350 icol = max(iatom, jatom)
351 irow = min(iatom, jatom)
352 NULLIFY (sblock, fblock)
354 row=irow, col=icol, block=sblock, found=found)
357 row=irow, col=icol, block=fblock, found=found)
360 IF (calculate_forces)
THEN
363 row=irow, col=icol, block=pblock, found=found)
364 cpassert(
ASSOCIATED(pblock))
367 row=irow, col=icol, block=wblock, found=found)
368 cpassert(
ASSOCIATED(wblock))
370 NULLIFY (dsblocks(i)%block)
372 row=irow, col=icol, block=dsblocks(i)%block, found=found)
378 basis_set_a => basis_set_list(ikind)%gto_basis_set
379 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
380 basis_set_b => basis_set_list(jkind)%gto_basis_set
381 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
382 atom_a = atom_of_kind(iatom)
383 atom_b = atom_of_kind(jatom)
385 first_sgfa => basis_set_a%first_sgf
386 la_max => basis_set_a%lmax
387 la_min => basis_set_a%lmin
388 npgfa => basis_set_a%npgf
389 nseta = basis_set_a%nset
390 nsgfa => basis_set_a%nsgf_set
391 rpgfa => basis_set_a%pgf_radius
392 set_radius_a => basis_set_a%set_radius
393 scon_a => basis_set_a%scon
394 zeta => basis_set_a%zet
396 first_sgfb => basis_set_b%first_sgf
397 lb_max => basis_set_b%lmax
398 lb_min => basis_set_b%lmin
399 npgfb => basis_set_b%npgf
400 nsetb = basis_set_b%nset
401 nsgfb => basis_set_b%nsgf_set
402 rpgfb => basis_set_b%pgf_radius
403 set_radius_b => basis_set_b%set_radius
404 scon_b => basis_set_b%scon
405 zetb => basis_set_b%zet
408 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
409 ALLOCATE (sint(natorb_a, natorb_b, maxder))
413 ncoa = npgfa(iset)*
ncoset(la_max(iset))
414 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
415 sgfa = first_sgfa(1, iset)
417 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
418 ncob = npgfb(jset)*
ncoset(lb_max(jset))
419 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
420 sgfb = first_sgfb(1, jset)
421 IF (calculate_forces)
THEN
422 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
423 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
424 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
426 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
427 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
428 rij, sab=oint(:, :, 1))
431 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
432 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
433 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
434 IF (calculate_forces)
THEN
436 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
437 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
438 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), sgfa, sgfb, trans=.false.)
444 IF (calculate_forces)
THEN
446 IF (iatom <= jatom)
THEN
447 force_ab(i) = sum(sint(:, :, i + 1)*wblock(:, :))
449 force_ab(i) = sum(sint(:, :, i + 1)*transpose(wblock(:, :)))
453 force(ikind)%overlap(:, atom_a) = force(ikind)%overlap(:, atom_a) - f1*force_ab(:)
454 force(jkind)%overlap(:, atom_b) = force(jkind)%overlap(:, atom_b) + f1*force_ab(:)
455 IF (use_virial .AND. dr > 1.e-3_dp)
THEN
456 IF (iatom == jatom) f1 = 1.0_dp
461 IF (iatom <= jatom)
THEN
462 sblock(:, :) = sblock(:, :) + sint(:, :, 1)
464 sblock(:, :) = sblock(:, :) + transpose(sint(:, :, 1))
466 IF (calculate_forces)
THEN
468 IF (iatom <= jatom)
THEN
469 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) + sint(:, :, i)
471 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) - transpose(sint(:, :, i))
477 rcovab = rcova + rcovb
478 rrab = sqrt(dr/rcovab)
479 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
480 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
481 IF (calculate_forces)
THEN
482 IF (dr > 1.e-6_dp)
THEN
483 drx = 0.5_dp/rrab/rcovab
487 dpia(1:nsa) = drx*kpolya(1:nsa)
488 dpib(1:nsb) = drx*kpolyb(1:nsb)
493 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
500 fblock(i, i) = fblock(i, i) + huckel(na, iatom)
507 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
508 IF (iatom <= jatom)
THEN
509 fblock(i, j) = fblock(i, j) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
511 fblock(j, i) = fblock(j, i) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
516 IF (calculate_forces)
THEN
518 IF (irow == iatom) f0 = -1.0_dp
520 IF (iatom /= jatom) f2 = 2.0_dp
531 fhud = fhud + pblock(i, i)*dhuckel(na, iatom)
532 fqa = fqa + pblock(i, i)*dqhuckel(na, iatom)
534 dcharges(iatom) = dcharges(iatom) + fqa
542 hij = 0.5_dp*pia(na)*pib(nb)
543 drx = f2*hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)
544 IF (iatom <= jatom)
THEN
545 fhua = fhua + drx*pblock(i, j)*dhuckel(na, iatom)
546 fhub = fhub + drx*pblock(i, j)*dhuckel(nb, jatom)
547 fqa = fqa + drx*pblock(i, j)*dqhuckel(na, iatom)
548 fqb = fqb + drx*pblock(i, j)*dqhuckel(nb, jatom)
550 fhua = fhua + drx*pblock(j, i)*dhuckel(na, iatom)
551 fhub = fhub + drx*pblock(j, i)*dhuckel(nb, jatom)
552 fqa = fqa + drx*pblock(j, i)*dqhuckel(na, iatom)
553 fqb = fqb + drx*pblock(j, i)*dqhuckel(nb, jatom)
557 dcharges(iatom) = dcharges(iatom) + fqa
558 dcharges(jatom) = dcharges(jatom) + fqb
561 atom_a = atom_of_kind(iatom)
562 DO i = 1, dcnum(iatom)%neighbors
563 katom = dcnum(iatom)%nlist(i)
564 kkind = kind_of(katom)
565 atom_c = atom_of_kind(katom)
566 rik = dcnum(iatom)%rik(:, i)
567 drk = sqrt(sum(rik(:)**2))
568 IF (drk > 1.e-3_dp)
THEN
569 fdika(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
570 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdika(:)
571 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdika(:)
572 fdikb(:) = fhud*dcnum(iatom)%dvals(i)*rik(:)/drk
573 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdikb(:)
574 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdikb(:)
582 atom_b = atom_of_kind(jatom)
583 DO i = 1, dcnum(jatom)%neighbors
584 katom = dcnum(jatom)%nlist(i)
585 kkind = kind_of(katom)
586 atom_c = atom_of_kind(katom)
587 rik = dcnum(jatom)%rik(:, i)
588 drk = sqrt(sum(rik(:)**2))
589 IF (drk > 1.e-3_dp)
THEN
590 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
591 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) - fdik(:)
592 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdik(:)
604 ALLOCATE (dfblock(n1, n2))
612 dhij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*(dpia(na)*pib(nb) + pia(na)*dpib(nb))
613 IF (iatom <= jatom)
THEN
614 dfblock(i, j) = dfblock(i, j) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
616 dfblock(j, i) = dfblock(j, i) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
620 dfp = f0*sum(dfblock(:, :)*pblock(:, :))
622 foab = 2.0_dp*dfp*rij(ir)/dr
630 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
631 IF (iatom <= jatom)
THEN
632 foab = foab + 2.0_dp*hij*sint(i, j, ir + 1)*pblock(i, j)*kijab(i, j, ikind, jkind)
634 foab = foab - 2.0_dp*hij*sint(i, j, ir + 1)*pblock(j, i)*kijab(i, j, ikind, jkind)
644 IF (calculate_forces)
THEN
645 atom_a = atom_of_kind(iatom)
646 atom_b = atom_of_kind(jatom)
647 IF (irow == iatom) force_ab = -force_ab
648 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - force_ab(:)
649 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) + force_ab(:)
652 IF (iatom == jatom) f1 = 0.5_dp
657 DEALLOCATE (oint, owork, sint)
662 DO i = 1,
SIZE(matrix_h, 1)
670 IF (calculate_forces)
THEN
671 CALL para_env%sum(dcharges)
672 ALLOCATE (qlagrange(natom))
673 CALL xtb_eeq_forces(qs_env, charges, dcharges, qlagrange, cnumbers, dcnum, eeq_sparam)
677 enscale = xtb_control%enscale
682 CALL srb_potential(qs_env, esrb, calculate_forces, xtb_control, cnumbers, dcnum)
685 IF (do_nonbonded)
THEN
687 NULLIFY (sab_xtb_nonbond)
688 CALL get_qs_env(qs_env=qs_env, sab_xtb_nonbond=sab_xtb_nonbond)
690 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
694 erep = erep + esrb + enonbonded
695 IF (do_nonbonded)
THEN
696 CALL para_env%sum(enonbonded)
697 energy%xtb_nonbonded = enonbonded
699 CALL para_env%sum(esrb)
701 CALL para_env%sum(erep)
702 energy%repulsive = erep
707 IF (
ASSOCIATED(eeq_q))
THEN
708 cpassert(
SIZE(eeq_q) == natom)
710 ALLOCATE (eeq_q(natom))
711 eeq_q(1:natom) = charges(1:natom)
720 IF (calculate_forces)
THEN
721 DEALLOCATE (dhuckel, dqhuckel)
728 IF (calculate_forces)
THEN
729 DEALLOCATE (dcharges, qlagrange)
733 CALL ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
735 DEALLOCATE (basis_set_list)
736 IF (calculate_forces)
THEN
737 IF (
SIZE(matrix_p, 1) == 2)
THEN
739 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
741 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, alpha_scalar=1.0_dp, &
747 CALL timestop(handle)
749 END SUBROUTINE build_gfn0_xtb_matrices
756 SUBROUTINE build_gfn1_xtb_matrices(qs_env, calculate_forces)
759 LOGICAL,
INTENT(IN) :: calculate_forces
761 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_gfn1_xtb_matrices'
763 INTEGER :: atom_a, atom_b, atom_c, handle, i, iatom, ic, icol, ikind, img, ir, irow, iset, &
764 j, jatom, jkind, jset, katom, kkind, la, lb, ldsab, lmaxa, lmaxb, maxder, n1, n2, na, &
765 natom, natorb_a, natorb_b, nb, ncoa, ncob, nderivatives, nimg, nkind, nsa, nsb, nseta, &
766 nsetb, sgfa, sgfb, za, zb
767 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
768 INTEGER,
DIMENSION(25) :: laoa, laob, naoa, naob
769 INTEGER,
DIMENSION(3) :: cell
770 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
772 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
773 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
774 LOGICAL :: defined, diagblock, do_nonbonded, found, &
776 REAL(kind=
dp) :: dfp, dhij, dr, drk, drx, enonbonded, &
777 enscale, erep, etaa, etab, exb, f0, &
778 f1, fhua, fhub, fhud, foab, hij, kf, &
779 rcova, rcovab, rcovb, rrab
780 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cnumbers
781 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dfblock, dhuckel, huckel, owork
782 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: oint, sint
783 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: kijab
784 REAL(kind=
dp),
DIMENSION(3) :: fdik, fdika, fdikb, force_ab, rij, rik
785 REAL(kind=
dp),
DIMENSION(5) :: dpia, dpib, kpolya, kpolyb, pia, pib
786 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
787 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: fblock, pblock, rpgfa, rpgfb, sblock, &
788 scon_a, scon_b, wblock, zeta, zetb
793 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p, matrix_s, matrix_w
794 TYPE(
dcnum_type),
ALLOCATABLE,
DIMENSION(:) :: dcnum
801 DIMENSION(:),
POINTER :: nl_iterator
803 POINTER :: sab_orb, sab_xtb_nonbond
808 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
815 CALL timeset(routinen, handle)
817 NULLIFY (logger, virial, atprop)
820 NULLIFY (matrix_h, matrix_s, matrix_p, matrix_w, atomic_kind_set, &
821 qs_kind_set, sab_orb, ks_env)
826 atomic_kind_set=atomic_kind_set, &
827 qs_kind_set=qs_kind_set, &
828 matrix_h_kp=matrix_h, &
829 matrix_s_kp=matrix_s, &
832 dft_control=dft_control, &
835 nkind =
SIZE(atomic_kind_set)
836 xtb_control => dft_control%qs_control%xtb_control
837 xb_inter = xtb_control%xb_interaction
838 do_nonbonded = xtb_control%do_nonbonded
839 nimg = dft_control%nimages
841 IF (calculate_forces) nderivatives = 1
842 IF (dft_control%tddfpt2_control%enabled) nderivatives = 1
843 maxder =
ncoset(nderivatives)
845 NULLIFY (particle_set)
846 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
847 natom =
SIZE(particle_set)
849 atom_of_kind=atom_of_kind, kind_of=kind_of)
851 IF (calculate_forces)
THEN
852 NULLIFY (rho, force, matrix_w)
854 rho=rho, matrix_w_kp=matrix_w, &
855 virial=virial, force=force)
858 IF (
SIZE(matrix_p, 1) == 2)
THEN
860 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
861 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
862 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, &
863 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
866 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
869 IF (atprop%energy)
THEN
873 NULLIFY (cell_to_index)
875 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
880 ALLOCATE (basis_set_list(nkind))
885 CALL create_sab_matrix(ks_env, matrix_s,
"xTB OVERLAP MATRIX", basis_set_list, basis_set_list, &
892 ALLOCATE (matrix_h(1, img)%matrix)
893 CALL dbcsr_create(matrix_h(1, img)%matrix, template=matrix_s(1, 1)%matrix, &
894 name=
"HAMILTONIAN MATRIX")
902 CALL cnumber_init(qs_env, cnumbers, dcnum, 1, calculate_forces)
905 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
907 energy%dispersion, calculate_forces)
910 CALL gfn1_huckel(qs_env, cnumbers, huckel, dhuckel, calculate_forces)
919 iatom=iatom, jatom=jatom, r=rij, cell=cell)
920 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
922 IF (.NOT. defined .OR. natorb_a < 1) cycle
923 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
925 IF (.NOT. defined .OR. natorb_b < 1) cycle
927 dr = sqrt(sum(rij(:)**2))
931 lmax=lmaxa, nshell=nsa, kpoly=kpolya)
933 lmax=lmaxb, nshell=nsb, kpoly=kpolyb)
938 ic = cell_to_index(cell(1), cell(2), cell(3))
942 icol = max(iatom, jatom)
943 irow = min(iatom, jatom)
944 NULLIFY (sblock, fblock)
946 row=irow, col=icol, block=sblock, found=found)
949 row=irow, col=icol, block=fblock, found=found)
952 IF (calculate_forces)
THEN
955 row=irow, col=icol, block=pblock, found=found)
959 row=irow, col=icol, block=wblock, found=found)
962 NULLIFY (dsblocks(i)%block)
964 row=irow, col=icol, block=dsblocks(i)%block, found=found)
970 basis_set_a => basis_set_list(ikind)%gto_basis_set
971 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
972 basis_set_b => basis_set_list(jkind)%gto_basis_set
973 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
974 atom_a = atom_of_kind(iatom)
975 atom_b = atom_of_kind(jatom)
977 first_sgfa => basis_set_a%first_sgf
978 la_max => basis_set_a%lmax
979 la_min => basis_set_a%lmin
980 npgfa => basis_set_a%npgf
981 nseta = basis_set_a%nset
982 nsgfa => basis_set_a%nsgf_set
983 rpgfa => basis_set_a%pgf_radius
984 set_radius_a => basis_set_a%set_radius
985 scon_a => basis_set_a%scon
986 zeta => basis_set_a%zet
988 first_sgfb => basis_set_b%first_sgf
989 lb_max => basis_set_b%lmax
990 lb_min => basis_set_b%lmin
991 npgfb => basis_set_b%npgf
992 nsetb = basis_set_b%nset
993 nsgfb => basis_set_b%nsgf_set
994 rpgfb => basis_set_b%pgf_radius
995 set_radius_b => basis_set_b%set_radius
996 scon_b => basis_set_b%scon
997 zetb => basis_set_b%zet
1000 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
1001 ALLOCATE (sint(natorb_a, natorb_b, maxder))
1005 ncoa = npgfa(iset)*
ncoset(la_max(iset))
1006 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
1007 sgfa = first_sgfa(1, iset)
1009 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
1010 ncob = npgfb(jset)*
ncoset(lb_max(jset))
1011 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
1012 sgfb = first_sgfb(1, jset)
1013 IF (calculate_forces)
THEN
1014 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1015 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1016 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
1018 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1019 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1020 rij, sab=oint(:, :, 1))
1023 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1024 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1025 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
1026 IF (calculate_forces)
THEN
1028 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1029 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1030 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), sgfa, sgfb, trans=.false.)
1036 IF (calculate_forces)
THEN
1038 IF (iatom <= jatom)
THEN
1039 force_ab(i) = sum(sint(:, :, i + 1)*wblock(:, :))
1041 force_ab(i) = sum(sint(:, :, i + 1)*transpose(wblock(:, :)))
1045 force(ikind)%overlap(:, atom_a) = force(ikind)%overlap(:, atom_a) - f1*force_ab(:)
1046 force(jkind)%overlap(:, atom_b) = force(jkind)%overlap(:, atom_b) + f1*force_ab(:)
1047 IF (use_virial .AND. dr > 1.e-3_dp)
THEN
1048 IF (iatom == jatom) f1 = 1.0_dp
1053 IF (iatom <= jatom)
THEN
1054 sblock(:, :) = sblock(:, :) + sint(:, :, 1)
1056 sblock(:, :) = sblock(:, :) + transpose(sint(:, :, 1))
1058 IF (calculate_forces)
THEN
1060 IF (iatom <= jatom)
THEN
1061 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) + sint(:, :, i)
1063 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) - transpose(sint(:, :, i))
1069 rcovab = rcova + rcovb
1070 rrab = sqrt(dr/rcovab)
1071 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
1072 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
1073 IF (calculate_forces)
THEN
1074 IF (dr > 1.e-6_dp)
THEN
1075 drx = 0.5_dp/rrab/rcovab
1079 dpia(1:nsa) = drx*kpolya(1:nsa)
1080 dpib(1:nsb) = drx*kpolyb(1:nsb)
1085 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
1092 fblock(i, i) = fblock(i, i) + huckel(na, iatom)
1099 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1100 IF (iatom <= jatom)
THEN
1101 fblock(i, j) = fblock(i, j) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1103 fblock(j, i) = fblock(j, i) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1108 IF (calculate_forces)
THEN
1110 IF (irow == iatom) f0 = -1.0_dp
1119 fhud = fhud + pblock(i, i)*dhuckel(na, iatom)
1128 hij = 0.5_dp*pia(na)*pib(nb)
1129 IF (iatom <= jatom)
THEN
1130 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(na, iatom)
1131 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(nb, jatom)
1133 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(na, iatom)
1134 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(nb, jatom)
1138 IF (iatom /= jatom)
THEN
1144 atom_a = atom_of_kind(iatom)
1145 DO i = 1, dcnum(iatom)%neighbors
1146 katom = dcnum(iatom)%nlist(i)
1147 kkind = kind_of(katom)
1148 atom_c = atom_of_kind(katom)
1149 rik = dcnum(iatom)%rik(:, i)
1150 drk = sqrt(sum(rik(:)**2))
1151 IF (drk > 1.e-3_dp)
THEN
1152 fdika(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
1153 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdika(:)
1154 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdika(:)
1155 fdikb(:) = fhud*dcnum(iatom)%dvals(i)*rik(:)/drk
1156 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdikb(:)
1157 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdikb(:)
1158 IF (use_virial)
THEN
1159 fdik = fdika + fdikb
1165 atom_b = atom_of_kind(jatom)
1166 DO i = 1, dcnum(jatom)%neighbors
1167 katom = dcnum(jatom)%nlist(i)
1168 kkind = kind_of(katom)
1169 atom_c = atom_of_kind(katom)
1170 rik = dcnum(jatom)%rik(:, i)
1171 drk = sqrt(sum(rik(:)**2))
1172 IF (drk > 1.e-3_dp)
THEN
1173 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
1174 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) - fdik(:)
1175 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdik(:)
1176 IF (use_virial)
THEN
1185 n1 =
SIZE(fblock, 1)
1186 n2 =
SIZE(fblock, 2)
1187 ALLOCATE (dfblock(n1, n2))
1195 dhij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*(dpia(na)*pib(nb) + pia(na)*dpib(nb))
1196 IF (iatom <= jatom)
THEN
1197 dfblock(i, j) = dfblock(i, j) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1199 dfblock(j, i) = dfblock(j, i) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1203 dfp = f0*sum(dfblock(:, :)*pblock(:, :))
1205 foab = 2.0_dp*dfp*rij(ir)/dr
1213 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1214 IF (iatom <= jatom)
THEN
1215 foab = foab + 2.0_dp*hij*sint(i, j, ir + 1)*pblock(i, j)*kijab(i, j, ikind, jkind)
1217 foab = foab - 2.0_dp*hij*sint(i, j, ir + 1)*pblock(j, i)*kijab(i, j, ikind, jkind)
1223 DEALLOCATE (dfblock)
1227 IF (calculate_forces)
THEN
1228 atom_a = atom_of_kind(iatom)
1229 atom_b = atom_of_kind(jatom)
1230 IF (irow == iatom) force_ab = -force_ab
1231 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - force_ab(:)
1232 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) + force_ab(:)
1233 IF (use_virial)
THEN
1235 IF (iatom == jatom) f1 = 0.5_dp
1240 DEALLOCATE (oint, owork, sint)
1245 DO i = 1,
SIZE(matrix_h, 1)
1253 enscale = xtb_control%enscale
1263 IF (do_nonbonded)
THEN
1265 NULLIFY (sab_xtb_nonbond)
1266 CALL get_qs_env(qs_env=qs_env, sab_xtb_nonbond=sab_xtb_nonbond)
1268 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
1272 erep = erep + exb + enonbonded
1274 CALL para_env%sum(exb)
1275 energy%xtb_xb_inter = exb
1277 IF (do_nonbonded)
THEN
1278 CALL para_env%sum(enonbonded)
1279 energy%xtb_nonbonded = enonbonded
1281 CALL para_env%sum(erep)
1282 energy%repulsive = erep
1289 IF (calculate_forces)
THEN
1290 DEALLOCATE (dhuckel)
1296 CALL ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1298 DEALLOCATE (basis_set_list)
1299 IF (calculate_forces)
THEN
1300 IF (
SIZE(matrix_p, 1) == 2)
THEN
1302 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
1303 beta_scalar=-1.0_dp)
1304 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, alpha_scalar=1.0_dp, &
1305 beta_scalar=-1.0_dp)
1310 CALL timestop(handle)
1312 END SUBROUTINE build_gfn1_xtb_matrices
1321 SUBROUTINE ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1323 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_s
1324 LOGICAL,
INTENT(IN) :: calculate_forces
1326 INTEGER :: after, i, img, iw, nimg
1327 LOGICAL :: norml1, norml2, omit_headers, use_arnoldi
1328 REAL(kind=
dp),
DIMENSION(2) :: condnum
1336 nimg =
SIZE(matrix_h, 2)
1337 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
1339 qs_env%input,
"DFT%PRINT%AO_MATRICES/CORE_HAMILTONIAN"),
cp_p_file))
THEN
1343 after = min(max(after, 1), 16)
1346 output_unit=iw, omit_headers=omit_headers)
1352 qs_env%input,
"DFT%PRINT%AO_MATRICES/OVERLAP"),
cp_p_file))
THEN
1356 after = min(max(after, 1), 16)
1359 output_unit=iw, omit_headers=omit_headers)
1361 qs_env%input,
"DFT%PRINT%AO_MATRICES/DERIVATIVES"),
cp_p_file))
THEN
1362 DO i = 2,
SIZE(matrix_s, 1)
1364 output_unit=iw, omit_headers=omit_headers)
1372 IF (.NOT. calculate_forces)
THEN
1374 "DFT%PRINT%OVERLAP_CONDITION") /= 0)
THEN
1378 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%DIAGONALIZATION", l_val=norml2)
1379 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%ARNOLDI", l_val=use_arnoldi)
1380 CALL get_qs_env(qs_env=qs_env, blacs_env=blacs_env)
1381 CALL overlap_condnum(matrix_s, condnum, iw, norml1, norml2, use_arnoldi, blacs_env)
1385 END SUBROUTINE ao_matrix_output
Set of routines to: Contract integrals over primitive Gaussians Decontract (density) matrices Trace m...
Calculation of the overlap integrals over Cartesian Gaussian-type functions.
subroutine, public overlap_ab(la_max, la_min, npgfa, rpgfa, zeta, lb_max, lb_min, npgfb, rpgfb, zetb, rab, sab, dab, ddab)
Calculation of the two-center overlap integrals [a|b] over Cartesian Gaussian-type functions....
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.
Holds information on atomic properties.
subroutine, public atprop_array_init(atarray, natom)
...
collect pointers to a block of reals
methods related to the blacs parallel environment
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_finalize(matrix)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
Routines that link DBCSR and CP2K concepts together.
subroutine, public cp_dbcsr_alloc_block_from_nbl(matrix, sab_orb, desymmetrize)
allocate the blocks of a dbcsr based on the neighbor list
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers, cartesian_basis)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
Defines the basic variable types.
integer, parameter, public dp
Types and basic routines needed for a kpoint calculation.
subroutine, public get_kpoint_info(kpoint, kp_scheme, nkp_grid, kp_shift, symmetry, verbose, full_grid, use_real_wfn, eps_geo, parallel_group_size, kp_range, nkp, xkp, wkp, para_env, blacs_env_all, para_env_kp, para_env_inter_kp, blacs_env, kp_env, kp_aux_env, mpools, iogrp, nkp_groups, kp_dist, cell_to_index, index_to_cell, sab_nl, sab_nl_nosym, inversion_symmetry_only, symmetry_backend, symmetry_reduction_method, gamma_centered)
Retrieve information from a kpoint environment.
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset
Define the data structure for the particle information.
Calculation of overlap matrix condition numbers.
subroutine, public overlap_condnum(matrixkp_s, condnum, iunit, norml1, norml2, use_arnoldi, blacs_env)
Calculation of the overlap matrix Condition Number.
Coordination number routines for dispersion pairpotentials.
subroutine, public cnumber_release(cnumbers, dcnum, derivatives)
...
subroutine, public cnumber_init(qs_env, cnumbers, dcnum, ftype, derivatives, disp_env)
...
Calculation of dispersion using pair potentials.
subroutine, public calculate_dispersion_pairpot(qs_env, dispersion_env, energy, calculate_forces, atevdw)
...
Definition of disperson types for DFT calculations.
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, 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.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, mimic, ewald_env, ewald_pw, mpools, rho_external, external_vxc, mask, scf_control, rel_control, qs_charges, ks_env, ks_qmmm_env, wf_history, scf_env, active_space, input, oce, rho_atom_set, rho0_atom_set, rho0_mpole, run_rtp, rtp, rhoz_set, rhoz_tot, ecoul_1c, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, efield, rhoz_cneo_set, linres_control, xas_env, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, ls_scf_env, do_transport, transport_env, lri_env, lri_density, exstate_env, ec_env, dispersion_env, harris_env, gcp_env, mp2_env, bs_env, kg_env, force, kpoints, wanniercentres, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs, do_rixs, tb_tblite)
Set 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.
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, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
subroutine, public get_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, rho, rho_xc, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, kpoints, do_kpoints, atomic_kind_set, qs_kind_set, cell, cell_ref, use_ref_cell, particle_set, energy, force, local_particles, local_molecules, molecule_kind_set, molecule_set, subsys, cp_subsys, virial, results, atprop, nkind, natom, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env, nelectron_total, nelectron_spin)
...
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 neighbor_list_iterator_release(iterator_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)
...
Calculation of overlap matrix, its derivatives and forces.
superstucture that hold various representations of the density and keeps track of which ones are vali...
subroutine, public qs_rho_get(rho_struct, rho_ao, rho_ao_im, rho_ao_kp, rho_ao_im_kp, rho_r, drho_r, rho_g, drho_g, tau_r, tau_g, rho_r_valid, drho_r_valid, rho_g_valid, drho_g_valid, tau_r_valid, tau_g_valid, tot_rho_r, tot_rho_g, rho_r_sccs, soft_valid, complex_rho_ao)
returns info about the density described by this object. If some representation is not available an e...
pure subroutine, public virial_pair_force(pv_virial, f0, force, rab)
Computes the contribution to the stress tensor from two-body pair-wise forces.
Calculation of charge equilibration in xTB.
subroutine, public xtb_eeq_calculation(qs_env, charges, cnumbers, eeq_sparam, eeq_energy, ef_energy, lambda)
...
subroutine, public xtb_eeq_forces(qs_env, charges, dcharges, qlagrange, cnumbers, dcnum, eeq_sparam)
...
Calculation of EHT matrix elements in xTB Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public gfn0_kpair(qs_env, kijab)
...
subroutine, public gfn0_huckel(qs_env, cnumbers, charges, huckel, dhuckel, dqhuckel, calculate_forces)
...
subroutine, public gfn1_kpair(qs_env, kijab)
...
subroutine, public gfn1_huckel(qs_env, cnumbers, huckel, dhuckel, calculate_forces)
...
Calculation of Overlap and Hamiltonian matrices in xTB Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public build_xtb_matrices(qs_env, calculate_forces)
...
xTB (repulsive) pair potentials Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public nonbonded_correction(enonbonded, force, qs_env, xtb_control, sab_xtb_nonbond, atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
Computes a correction for nonbonded interactions based on a generic potential.
subroutine, public srb_potential(qs_env, esrb, calculate_forces, xtb_control, cnumbers, dcnum)
...
subroutine, public xb_interaction(qs_env, exb, calculate_forces)
...
subroutine, public repulsive_potential(qs_env, erep, kf, enscale, calculate_forces)
...
Definition of the xTB parameter types.
subroutine, public get_xtb_atom_param(xtb_parameter, symbol, aname, typ, defined, z, zeff, natorb, lmax, nao, lao, rcut, rcov, kx, eta, xgamma, alpha, zneff, nshell, nval, lval, kpoly, kappa, hen, zeta, xi, kappa0, alpg, occupation, electronegativity, chmax, en, kqat2, kcn, kq)
...
Provides all information about an atomic kind.
type for the atomic properties
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information about kpoints.
stores all the informations relevant to an mpi environment
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.