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, &
745 CALL timestop(handle)
747 END SUBROUTINE build_gfn0_xtb_matrices
754 SUBROUTINE build_gfn1_xtb_matrices(qs_env, calculate_forces)
757 LOGICAL,
INTENT(IN) :: calculate_forces
759 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_gfn1_xtb_matrices'
761 INTEGER :: atom_a, atom_b, atom_c, handle, i, iatom, ic, icol, ikind, img, ir, irow, iset, &
762 j, jatom, jkind, jset, katom, kkind, la, lb, ldsab, lmaxa, lmaxb, maxder, n1, n2, na, &
763 natom, natorb_a, natorb_b, nb, ncoa, ncob, nderivatives, nimg, nkind, nsa, nsb, nseta, &
764 nsetb, sgfa, sgfb, za, zb
765 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
766 INTEGER,
DIMENSION(25) :: laoa, laob, naoa, naob
767 INTEGER,
DIMENSION(3) :: cell
768 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
770 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
771 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
772 LOGICAL :: defined, diagblock, do_nonbonded, found, &
774 REAL(kind=
dp) :: dfp, dhij, dr, drk, drx, enonbonded, &
775 enscale, erep, etaa, etab, exb, f0, &
776 f1, fhua, fhub, fhud, foab, hij, kf, &
777 rcova, rcovab, rcovb, rrab
778 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cnumbers
779 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dfblock, dhuckel, huckel, owork
780 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: oint, sint
781 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: kijab
782 REAL(kind=
dp),
DIMENSION(3) :: fdik, fdika, fdikb, force_ab, rij, rik
783 REAL(kind=
dp),
DIMENSION(5) :: dpia, dpib, kpolya, kpolyb, pia, pib
784 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
785 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: fblock, pblock, rpgfa, rpgfb, sblock, &
786 scon_a, scon_b, wblock, zeta, zetb
791 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p, matrix_s, matrix_w
792 TYPE(
dcnum_type),
ALLOCATABLE,
DIMENSION(:) :: dcnum
799 DIMENSION(:),
POINTER :: nl_iterator
801 POINTER :: sab_orb, sab_xtb_nonbond
806 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
813 CALL timeset(routinen, handle)
815 NULLIFY (logger, virial, atprop)
818 NULLIFY (matrix_h, matrix_s, matrix_p, matrix_w, atomic_kind_set, &
819 qs_kind_set, sab_orb, ks_env)
824 atomic_kind_set=atomic_kind_set, &
825 qs_kind_set=qs_kind_set, &
826 matrix_h_kp=matrix_h, &
827 matrix_s_kp=matrix_s, &
830 dft_control=dft_control, &
833 nkind =
SIZE(atomic_kind_set)
834 xtb_control => dft_control%qs_control%xtb_control
835 xb_inter = xtb_control%xb_interaction
836 do_nonbonded = xtb_control%do_nonbonded
837 nimg = dft_control%nimages
839 IF (calculate_forces) nderivatives = 1
840 IF (dft_control%tddfpt2_control%enabled) nderivatives = 1
841 maxder =
ncoset(nderivatives)
843 NULLIFY (particle_set)
844 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
845 natom =
SIZE(particle_set)
847 atom_of_kind=atom_of_kind, kind_of=kind_of)
849 IF (calculate_forces)
THEN
850 NULLIFY (rho, force, matrix_w)
852 rho=rho, matrix_w_kp=matrix_w, &
853 virial=virial, force=force)
856 IF (
SIZE(matrix_p, 1) == 2)
THEN
858 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
859 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
860 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, &
861 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
864 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
867 IF (atprop%energy)
THEN
871 NULLIFY (cell_to_index)
873 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
878 ALLOCATE (basis_set_list(nkind))
883 CALL create_sab_matrix(ks_env, matrix_s,
"xTB OVERLAP MATRIX", basis_set_list, basis_set_list, &
890 ALLOCATE (matrix_h(1, img)%matrix)
891 CALL dbcsr_create(matrix_h(1, img)%matrix, template=matrix_s(1, 1)%matrix, &
892 name=
"HAMILTONIAN MATRIX")
900 CALL cnumber_init(qs_env, cnumbers, dcnum, 1, calculate_forces)
903 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
905 energy%dispersion, calculate_forces)
908 CALL gfn1_huckel(qs_env, cnumbers, huckel, dhuckel, calculate_forces)
917 iatom=iatom, jatom=jatom, r=rij, cell=cell)
918 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
920 IF (.NOT. defined .OR. natorb_a < 1) cycle
921 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
923 IF (.NOT. defined .OR. natorb_b < 1) cycle
925 dr = sqrt(sum(rij(:)**2))
929 lmax=lmaxa, nshell=nsa, kpoly=kpolya)
931 lmax=lmaxb, nshell=nsb, kpoly=kpolyb)
936 ic = cell_to_index(cell(1), cell(2), cell(3))
940 icol = max(iatom, jatom)
941 irow = min(iatom, jatom)
942 NULLIFY (sblock, fblock)
944 row=irow, col=icol, block=sblock, found=found)
947 row=irow, col=icol, block=fblock, found=found)
950 IF (calculate_forces)
THEN
953 row=irow, col=icol, block=pblock, found=found)
957 row=irow, col=icol, block=wblock, found=found)
960 NULLIFY (dsblocks(i)%block)
962 row=irow, col=icol, block=dsblocks(i)%block, found=found)
968 basis_set_a => basis_set_list(ikind)%gto_basis_set
969 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
970 basis_set_b => basis_set_list(jkind)%gto_basis_set
971 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
972 atom_a = atom_of_kind(iatom)
973 atom_b = atom_of_kind(jatom)
975 first_sgfa => basis_set_a%first_sgf
976 la_max => basis_set_a%lmax
977 la_min => basis_set_a%lmin
978 npgfa => basis_set_a%npgf
979 nseta = basis_set_a%nset
980 nsgfa => basis_set_a%nsgf_set
981 rpgfa => basis_set_a%pgf_radius
982 set_radius_a => basis_set_a%set_radius
983 scon_a => basis_set_a%scon
984 zeta => basis_set_a%zet
986 first_sgfb => basis_set_b%first_sgf
987 lb_max => basis_set_b%lmax
988 lb_min => basis_set_b%lmin
989 npgfb => basis_set_b%npgf
990 nsetb = basis_set_b%nset
991 nsgfb => basis_set_b%nsgf_set
992 rpgfb => basis_set_b%pgf_radius
993 set_radius_b => basis_set_b%set_radius
994 scon_b => basis_set_b%scon
995 zetb => basis_set_b%zet
998 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
999 ALLOCATE (sint(natorb_a, natorb_b, maxder))
1003 ncoa = npgfa(iset)*
ncoset(la_max(iset))
1004 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
1005 sgfa = first_sgfa(1, iset)
1007 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
1008 ncob = npgfb(jset)*
ncoset(lb_max(jset))
1009 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
1010 sgfb = first_sgfb(1, jset)
1011 IF (calculate_forces)
THEN
1012 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1013 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1014 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
1016 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1017 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1018 rij, sab=oint(:, :, 1))
1021 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1022 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1023 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
1024 IF (calculate_forces)
THEN
1026 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1027 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1028 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), sgfa, sgfb, trans=.false.)
1034 IF (calculate_forces)
THEN
1036 IF (iatom <= jatom)
THEN
1037 force_ab(i) = sum(sint(:, :, i + 1)*wblock(:, :))
1039 force_ab(i) = sum(sint(:, :, i + 1)*transpose(wblock(:, :)))
1043 force(ikind)%overlap(:, atom_a) = force(ikind)%overlap(:, atom_a) - f1*force_ab(:)
1044 force(jkind)%overlap(:, atom_b) = force(jkind)%overlap(:, atom_b) + f1*force_ab(:)
1045 IF (use_virial .AND. dr > 1.e-3_dp)
THEN
1046 IF (iatom == jatom) f1 = 1.0_dp
1051 IF (iatom <= jatom)
THEN
1052 sblock(:, :) = sblock(:, :) + sint(:, :, 1)
1054 sblock(:, :) = sblock(:, :) + transpose(sint(:, :, 1))
1056 IF (calculate_forces)
THEN
1058 IF (iatom <= jatom)
THEN
1059 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) + sint(:, :, i)
1061 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) - transpose(sint(:, :, i))
1067 rcovab = rcova + rcovb
1068 rrab = sqrt(dr/rcovab)
1069 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
1070 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
1071 IF (calculate_forces)
THEN
1072 IF (dr > 1.e-6_dp)
THEN
1073 drx = 0.5_dp/rrab/rcovab
1077 dpia(1:nsa) = drx*kpolya(1:nsa)
1078 dpib(1:nsb) = drx*kpolyb(1:nsb)
1083 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
1090 fblock(i, i) = fblock(i, i) + huckel(na, iatom)
1097 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1098 IF (iatom <= jatom)
THEN
1099 fblock(i, j) = fblock(i, j) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1101 fblock(j, i) = fblock(j, i) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1106 IF (calculate_forces)
THEN
1108 IF (irow == iatom) f0 = -1.0_dp
1117 fhud = fhud + pblock(i, i)*dhuckel(na, iatom)
1126 hij = 0.5_dp*pia(na)*pib(nb)
1127 IF (iatom <= jatom)
THEN
1128 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(na, iatom)
1129 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(nb, jatom)
1131 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(na, iatom)
1132 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(nb, jatom)
1136 IF (iatom /= jatom)
THEN
1142 atom_a = atom_of_kind(iatom)
1143 DO i = 1, dcnum(iatom)%neighbors
1144 katom = dcnum(iatom)%nlist(i)
1145 kkind = kind_of(katom)
1146 atom_c = atom_of_kind(katom)
1147 rik = dcnum(iatom)%rik(:, i)
1148 drk = sqrt(sum(rik(:)**2))
1149 IF (drk > 1.e-3_dp)
THEN
1150 fdika(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
1151 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdika(:)
1152 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdika(:)
1153 fdikb(:) = fhud*dcnum(iatom)%dvals(i)*rik(:)/drk
1154 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdikb(:)
1155 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdikb(:)
1156 IF (use_virial)
THEN
1157 fdik = fdika + fdikb
1163 atom_b = atom_of_kind(jatom)
1164 DO i = 1, dcnum(jatom)%neighbors
1165 katom = dcnum(jatom)%nlist(i)
1166 kkind = kind_of(katom)
1167 atom_c = atom_of_kind(katom)
1168 rik = dcnum(jatom)%rik(:, i)
1169 drk = sqrt(sum(rik(:)**2))
1170 IF (drk > 1.e-3_dp)
THEN
1171 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
1172 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) - fdik(:)
1173 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdik(:)
1174 IF (use_virial)
THEN
1183 n1 =
SIZE(fblock, 1)
1184 n2 =
SIZE(fblock, 2)
1185 ALLOCATE (dfblock(n1, n2))
1193 dhij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*(dpia(na)*pib(nb) + pia(na)*dpib(nb))
1194 IF (iatom <= jatom)
THEN
1195 dfblock(i, j) = dfblock(i, j) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1197 dfblock(j, i) = dfblock(j, i) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1201 dfp = f0*sum(dfblock(:, :)*pblock(:, :))
1203 foab = 2.0_dp*dfp*rij(ir)/dr
1211 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1212 IF (iatom <= jatom)
THEN
1213 foab = foab + 2.0_dp*hij*sint(i, j, ir + 1)*pblock(i, j)*kijab(i, j, ikind, jkind)
1215 foab = foab - 2.0_dp*hij*sint(i, j, ir + 1)*pblock(j, i)*kijab(i, j, ikind, jkind)
1221 DEALLOCATE (dfblock)
1225 IF (calculate_forces)
THEN
1226 atom_a = atom_of_kind(iatom)
1227 atom_b = atom_of_kind(jatom)
1228 IF (irow == iatom) force_ab = -force_ab
1229 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - force_ab(:)
1230 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) + force_ab(:)
1231 IF (use_virial)
THEN
1233 IF (iatom == jatom) f1 = 0.5_dp
1238 DEALLOCATE (oint, owork, sint)
1243 DO i = 1,
SIZE(matrix_h, 1)
1251 enscale = xtb_control%enscale
1261 IF (do_nonbonded)
THEN
1263 NULLIFY (sab_xtb_nonbond)
1264 CALL get_qs_env(qs_env=qs_env, sab_xtb_nonbond=sab_xtb_nonbond)
1266 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
1270 erep = erep + exb + enonbonded
1272 CALL para_env%sum(exb)
1273 energy%xtb_xb_inter = exb
1275 IF (do_nonbonded)
THEN
1276 CALL para_env%sum(enonbonded)
1277 energy%xtb_nonbonded = enonbonded
1279 CALL para_env%sum(erep)
1280 energy%repulsive = erep
1287 IF (calculate_forces)
THEN
1288 DEALLOCATE (dhuckel)
1294 CALL ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1296 DEALLOCATE (basis_set_list)
1297 IF (calculate_forces)
THEN
1298 IF (
SIZE(matrix_p, 1) == 2)
THEN
1300 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
1301 beta_scalar=-1.0_dp)
1306 CALL timestop(handle)
1308 END SUBROUTINE build_gfn1_xtb_matrices
1317 SUBROUTINE ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1319 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_s
1320 LOGICAL,
INTENT(IN) :: calculate_forces
1322 INTEGER :: after, i, img, iw, nimg
1323 LOGICAL :: norml1, norml2, omit_headers, use_arnoldi
1324 REAL(kind=
dp),
DIMENSION(2) :: condnum
1332 nimg =
SIZE(matrix_h, 2)
1333 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
1335 qs_env%input,
"DFT%PRINT%AO_MATRICES/CORE_HAMILTONIAN"),
cp_p_file))
THEN
1339 after = min(max(after, 1), 16)
1342 output_unit=iw, omit_headers=omit_headers)
1348 qs_env%input,
"DFT%PRINT%AO_MATRICES/OVERLAP"),
cp_p_file))
THEN
1352 after = min(max(after, 1), 16)
1355 output_unit=iw, omit_headers=omit_headers)
1357 qs_env%input,
"DFT%PRINT%AO_MATRICES/DERIVATIVES"),
cp_p_file))
THEN
1358 DO i = 2,
SIZE(matrix_s, 1)
1360 output_unit=iw, omit_headers=omit_headers)
1368 IF (.NOT. calculate_forces)
THEN
1370 "DFT%PRINT%OVERLAP_CONDITION") .NE. 0)
THEN
1374 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%DIAGONALIZATION", l_val=norml2)
1375 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%ARNOLDI", l_val=use_arnoldi)
1376 CALL get_qs_env(qs_env=qs_env, blacs_env=blacs_env)
1377 CALL overlap_condnum(matrix_s, condnum, iw, norml1, norml2, use_arnoldi, blacs_env)
1381 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)
...
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)
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, 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, 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, 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, ecoul_1c, rho0_s_rs, rho0_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)
Get the QUICKSTEP environment.
subroutine, public set_qs_env(qs_env, super_cell, mos, qmmm, qmmm_periodic, 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, 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)
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, 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, 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, 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, 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, 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, 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, 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, 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.