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 eeq_sparam = xtb_control%eeq_sparam
221 do_nonbonded = xtb_control%do_nonbonded
222 nimg = dft_control%nimages
224 IF (calculate_forces) nderivatives = 1
225 IF (dft_control%tddfpt2_control%enabled) nderivatives = 1
226 maxder =
ncoset(nderivatives)
228 NULLIFY (particle_set)
229 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
230 natom =
SIZE(particle_set)
232 atom_of_kind=atom_of_kind, kind_of=kind_of)
234 IF (calculate_forces)
THEN
235 NULLIFY (rho, force, matrix_w)
237 rho=rho, matrix_w_kp=matrix_w, &
238 virial=virial, force=force)
241 IF (
SIZE(matrix_p, 1) == 2)
THEN
243 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
244 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
245 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, &
246 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
249 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
252 IF (atprop%energy)
THEN
256 NULLIFY (cell_to_index)
258 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
263 ALLOCATE (basis_set_list(nkind))
268 CALL create_sab_matrix(ks_env, matrix_s,
"xTB OVERLAP MATRIX", basis_set_list, basis_set_list, &
275 ALLOCATE (matrix_h(1, img)%matrix)
276 CALL dbcsr_create(matrix_h(1, img)%matrix, template=matrix_s(1, 1)%matrix, &
277 name=
"HAMILTONIAN MATRIX")
285 CALL cnumber_init(qs_env, cnumbers, dcnum, 2, calculate_forces)
287 ALLOCATE (charges(natom))
289 CALL xtb_eeq_calculation(qs_env, charges, cnumbers, eeq_sparam, eeq_energy, ef_energy, qlambda)
290 IF (calculate_forces)
THEN
291 ALLOCATE (dcharges(natom))
292 dcharges = qlambda/real(para_env%num_pe, kind=
dp)
294 energy%eeq = eeq_energy
295 energy%efield = ef_energy
297 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
300 dispersion_env%ext_charges = .true.
301 IF (
ASSOCIATED(dispersion_env%charges))
DEALLOCATE (dispersion_env%charges)
302 ALLOCATE (dispersion_env%charges(natom))
303 dispersion_env%charges = charges
304 IF (calculate_forces)
THEN
305 IF (
ASSOCIATED(dispersion_env%dcharges))
DEALLOCATE (dispersion_env%dcharges)
306 ALLOCATE (dispersion_env%dcharges(natom))
307 dispersion_env%dcharges = 0.0_dp
311 energy%dispersion, calculate_forces)
312 IF (calculate_forces)
THEN
313 IF (dispersion_env%pp_type ==
vdw_pairpot_dftd4 .AND. dispersion_env%ext_charges)
THEN
314 dcharges(1:natom) = dcharges(1:natom) + dispersion_env%dcharges(1:natom)
319 CALL gfn0_huckel(qs_env, cnumbers, charges, huckel, dhuckel, dqhuckel, calculate_forces)
328 iatom=iatom, jatom=jatom, r=rij, cell=cell)
329 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
331 IF (.NOT. defined .OR. natorb_a < 1) cycle
332 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
334 IF (.NOT. defined .OR. natorb_b < 1) cycle
336 dr = sqrt(sum(rij(:)**2))
340 lmax=lmaxa, nshell=nsa, kpoly=kpolya, hen=hena)
342 lmax=lmaxb, nshell=nsb, kpoly=kpolyb, hen=henb)
347 ic = cell_to_index(cell(1), cell(2), cell(3))
351 icol = max(iatom, jatom)
352 irow = min(iatom, jatom)
353 NULLIFY (sblock, fblock)
355 row=irow, col=icol, block=sblock, found=found)
358 row=irow, col=icol, block=fblock, found=found)
361 IF (calculate_forces)
THEN
364 row=irow, col=icol, block=pblock, found=found)
365 cpassert(
ASSOCIATED(pblock))
368 row=irow, col=icol, block=wblock, found=found)
369 cpassert(
ASSOCIATED(wblock))
371 NULLIFY (dsblocks(i)%block)
373 row=irow, col=icol, block=dsblocks(i)%block, found=found)
379 basis_set_a => basis_set_list(ikind)%gto_basis_set
380 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
381 basis_set_b => basis_set_list(jkind)%gto_basis_set
382 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
383 atom_a = atom_of_kind(iatom)
384 atom_b = atom_of_kind(jatom)
386 first_sgfa => basis_set_a%first_sgf
387 la_max => basis_set_a%lmax
388 la_min => basis_set_a%lmin
389 npgfa => basis_set_a%npgf
390 nseta = basis_set_a%nset
391 nsgfa => basis_set_a%nsgf_set
392 rpgfa => basis_set_a%pgf_radius
393 set_radius_a => basis_set_a%set_radius
394 scon_a => basis_set_a%scon
395 zeta => basis_set_a%zet
397 first_sgfb => basis_set_b%first_sgf
398 lb_max => basis_set_b%lmax
399 lb_min => basis_set_b%lmin
400 npgfb => basis_set_b%npgf
401 nsetb = basis_set_b%nset
402 nsgfb => basis_set_b%nsgf_set
403 rpgfb => basis_set_b%pgf_radius
404 set_radius_b => basis_set_b%set_radius
405 scon_b => basis_set_b%scon
406 zetb => basis_set_b%zet
409 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
410 ALLOCATE (sint(natorb_a, natorb_b, maxder))
414 ncoa = npgfa(iset)*
ncoset(la_max(iset))
415 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
416 sgfa = first_sgfa(1, iset)
418 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
419 ncob = npgfb(jset)*
ncoset(lb_max(jset))
420 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
421 sgfb = first_sgfb(1, jset)
422 IF (calculate_forces)
THEN
423 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
424 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
425 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
427 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
428 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
429 rij, sab=oint(:, :, 1))
432 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
433 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
434 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
435 IF (calculate_forces)
THEN
437 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
438 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
439 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), sgfa, sgfb, trans=.false.)
445 IF (calculate_forces)
THEN
447 IF (iatom <= jatom)
THEN
448 force_ab(i) = sum(sint(:, :, i + 1)*wblock(:, :))
450 force_ab(i) = sum(sint(:, :, i + 1)*transpose(wblock(:, :)))
454 force(ikind)%overlap(:, atom_a) = force(ikind)%overlap(:, atom_a) - f1*force_ab(:)
455 force(jkind)%overlap(:, atom_b) = force(jkind)%overlap(:, atom_b) + f1*force_ab(:)
456 IF (use_virial .AND. dr > 1.e-3_dp)
THEN
457 IF (iatom == jatom) f1 = 1.0_dp
462 IF (iatom <= jatom)
THEN
463 sblock(:, :) = sblock(:, :) + sint(:, :, 1)
465 sblock(:, :) = sblock(:, :) + transpose(sint(:, :, 1))
467 IF (calculate_forces)
THEN
469 IF (iatom <= jatom)
THEN
470 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) + sint(:, :, i)
472 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) - transpose(sint(:, :, i))
478 rcovab = rcova + rcovb
479 rrab = sqrt(dr/rcovab)
480 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
481 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
482 IF (calculate_forces)
THEN
483 IF (dr > 1.e-6_dp)
THEN
484 drx = 0.5_dp/rrab/rcovab
488 dpia(1:nsa) = drx*kpolya(1:nsa)
489 dpib(1:nsb) = drx*kpolyb(1:nsb)
494 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
501 fblock(i, i) = fblock(i, i) + huckel(na, iatom)
508 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
509 IF (iatom <= jatom)
THEN
510 fblock(i, j) = fblock(i, j) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
512 fblock(j, i) = fblock(j, i) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
517 IF (calculate_forces)
THEN
519 IF (irow == iatom) f0 = -1.0_dp
521 IF (iatom /= jatom) f2 = 2.0_dp
532 fhud = fhud + pblock(i, i)*dhuckel(na, iatom)
533 fqa = fqa + pblock(i, i)*dqhuckel(na, iatom)
535 dcharges(iatom) = dcharges(iatom) + fqa
543 hij = 0.5_dp*pia(na)*pib(nb)
544 drx = f2*hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)
545 IF (iatom <= jatom)
THEN
546 fhua = fhua + drx*pblock(i, j)*dhuckel(na, iatom)
547 fhub = fhub + drx*pblock(i, j)*dhuckel(nb, jatom)
548 fqa = fqa + drx*pblock(i, j)*dqhuckel(na, iatom)
549 fqb = fqb + drx*pblock(i, j)*dqhuckel(nb, jatom)
551 fhua = fhua + drx*pblock(j, i)*dhuckel(na, iatom)
552 fhub = fhub + drx*pblock(j, i)*dhuckel(nb, jatom)
553 fqa = fqa + drx*pblock(j, i)*dqhuckel(na, iatom)
554 fqb = fqb + drx*pblock(j, i)*dqhuckel(nb, jatom)
558 dcharges(iatom) = dcharges(iatom) + fqa
559 dcharges(jatom) = dcharges(jatom) + fqb
562 atom_a = atom_of_kind(iatom)
563 DO i = 1, dcnum(iatom)%neighbors
564 katom = dcnum(iatom)%nlist(i)
565 kkind = kind_of(katom)
566 atom_c = atom_of_kind(katom)
567 rik = dcnum(iatom)%rik(:, i)
568 drk = sqrt(sum(rik(:)**2))
569 IF (drk > 1.e-3_dp)
THEN
570 fdika(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
571 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdika(:)
572 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdika(:)
573 fdikb(:) = fhud*dcnum(iatom)%dvals(i)*rik(:)/drk
574 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdikb(:)
575 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdikb(:)
583 atom_b = atom_of_kind(jatom)
584 DO i = 1, dcnum(jatom)%neighbors
585 katom = dcnum(jatom)%nlist(i)
586 kkind = kind_of(katom)
587 atom_c = atom_of_kind(katom)
588 rik = dcnum(jatom)%rik(:, i)
589 drk = sqrt(sum(rik(:)**2))
590 IF (drk > 1.e-3_dp)
THEN
591 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
592 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) - fdik(:)
593 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdik(:)
605 ALLOCATE (dfblock(n1, n2))
613 dhij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*(dpia(na)*pib(nb) + pia(na)*dpib(nb))
614 IF (iatom <= jatom)
THEN
615 dfblock(i, j) = dfblock(i, j) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
617 dfblock(j, i) = dfblock(j, i) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
621 dfp = f0*sum(dfblock(:, :)*pblock(:, :))
623 foab = 2.0_dp*dfp*rij(ir)/dr
631 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
632 IF (iatom <= jatom)
THEN
633 foab = foab + 2.0_dp*hij*sint(i, j, ir + 1)*pblock(i, j)*kijab(i, j, ikind, jkind)
635 foab = foab - 2.0_dp*hij*sint(i, j, ir + 1)*pblock(j, i)*kijab(i, j, ikind, jkind)
645 IF (calculate_forces)
THEN
646 atom_a = atom_of_kind(iatom)
647 atom_b = atom_of_kind(jatom)
648 IF (irow == iatom) force_ab = -force_ab
649 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - force_ab(:)
650 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) + force_ab(:)
653 IF (iatom == jatom) f1 = 0.5_dp
658 DEALLOCATE (oint, owork, sint)
663 DO i = 1,
SIZE(matrix_h, 1)
671 IF (calculate_forces)
THEN
672 CALL para_env%sum(dcharges)
673 ALLOCATE (qlagrange(natom))
674 CALL xtb_eeq_forces(qs_env, charges, dcharges, qlagrange, cnumbers, dcnum, eeq_sparam)
678 enscale = xtb_control%enscale
683 CALL srb_potential(qs_env, esrb, calculate_forces, xtb_control, cnumbers, dcnum)
686 IF (do_nonbonded)
THEN
688 NULLIFY (sab_xtb_nonbond)
689 CALL get_qs_env(qs_env=qs_env, sab_xtb_nonbond=sab_xtb_nonbond)
691 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
695 erep = erep + esrb + enonbonded
696 IF (do_nonbonded)
THEN
697 CALL para_env%sum(enonbonded)
698 energy%xtb_nonbonded = enonbonded
700 CALL para_env%sum(esrb)
702 CALL para_env%sum(erep)
703 energy%repulsive = erep
708 IF (
ASSOCIATED(eeq_q))
THEN
709 cpassert(
SIZE(eeq_q) == natom)
711 ALLOCATE (eeq_q(natom))
712 eeq_q(1:natom) = charges(1:natom)
721 IF (calculate_forces)
THEN
722 DEALLOCATE (dhuckel, dqhuckel)
729 IF (calculate_forces)
THEN
730 DEALLOCATE (dcharges, qlagrange)
734 CALL ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
736 DEALLOCATE (basis_set_list)
737 IF (calculate_forces)
THEN
738 IF (
SIZE(matrix_p, 1) == 2)
THEN
740 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
742 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, alpha_scalar=1.0_dp, &
748 CALL timestop(handle)
750 END SUBROUTINE build_gfn0_xtb_matrices
757 SUBROUTINE build_gfn1_xtb_matrices(qs_env, calculate_forces)
760 LOGICAL,
INTENT(IN) :: calculate_forces
762 CHARACTER(LEN=*),
PARAMETER :: routinen =
'build_gfn1_xtb_matrices'
764 INTEGER :: atom_a, atom_b, atom_c, handle, i, iatom, ic, icol, ikind, img, ir, irow, iset, &
765 j, jatom, jkind, jset, katom, kkind, la, lb, ldsab, lmaxa, lmaxb, maxder, n1, n2, na, &
766 natom, natorb_a, natorb_b, nb, ncoa, ncob, nderivatives, nimg, nkind, nsa, nsb, nseta, &
767 nsetb, sgfa, sgfb, za, zb
768 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
769 INTEGER,
DIMENSION(25) :: laoa, laob, naoa, naob
770 INTEGER,
DIMENSION(3) :: cell
771 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
773 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, first_sgfb
774 INTEGER,
DIMENSION(:, :, :),
POINTER :: cell_to_index
775 LOGICAL :: defined, diagblock, do_nonbonded, found, &
777 REAL(kind=
dp) :: dfp, dhij, dr, drk, drx, enonbonded, &
778 enscale, erep, etaa, etab, exb, f0, &
779 f1, fhua, fhub, fhud, foab, hij, kf, &
780 rcova, rcovab, rcovb, rrab
781 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: cnumbers
782 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: dfblock, dhuckel, huckel, owork
783 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: oint, sint
784 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: kijab
785 REAL(kind=
dp),
DIMENSION(3) :: fdik, fdika, fdikb, force_ab, rij, rik
786 REAL(kind=
dp),
DIMENSION(5) :: dpia, dpib, kpolya, kpolyb, pia, pib
787 REAL(kind=
dp),
DIMENSION(:),
POINTER :: set_radius_a, set_radius_b
788 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: fblock, pblock, rpgfa, rpgfb, sblock, &
789 scon_a, scon_b, wblock, zeta, zetb
794 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_p, matrix_s, matrix_w
795 TYPE(
dcnum_type),
ALLOCATABLE,
DIMENSION(:) :: dcnum
802 DIMENSION(:),
POINTER :: nl_iterator
804 POINTER :: sab_orb, sab_xtb_nonbond
809 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
816 CALL timeset(routinen, handle)
818 NULLIFY (logger, virial, atprop)
821 NULLIFY (matrix_h, matrix_s, matrix_p, matrix_w, atomic_kind_set, &
822 qs_kind_set, sab_orb, ks_env)
827 atomic_kind_set=atomic_kind_set, &
828 qs_kind_set=qs_kind_set, &
829 matrix_h_kp=matrix_h, &
830 matrix_s_kp=matrix_s, &
833 dft_control=dft_control, &
836 nkind =
SIZE(atomic_kind_set)
837 xtb_control => dft_control%qs_control%xtb_control
838 xb_inter = xtb_control%xb_interaction
839 do_nonbonded = xtb_control%do_nonbonded
840 nimg = dft_control%nimages
842 IF (calculate_forces) nderivatives = 1
843 IF (dft_control%tddfpt2_control%enabled) nderivatives = 1
844 maxder =
ncoset(nderivatives)
846 NULLIFY (particle_set)
847 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
848 natom =
SIZE(particle_set)
850 atom_of_kind=atom_of_kind, kind_of=kind_of)
852 IF (calculate_forces)
THEN
853 NULLIFY (rho, force, matrix_w)
855 rho=rho, matrix_w_kp=matrix_w, &
856 virial=virial, force=force)
859 IF (
SIZE(matrix_p, 1) == 2)
THEN
861 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
862 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
863 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, &
864 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
867 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
870 IF (atprop%energy)
THEN
874 NULLIFY (cell_to_index)
876 CALL get_ks_env(ks_env=ks_env, kpoints=kpoints)
881 ALLOCATE (basis_set_list(nkind))
886 CALL create_sab_matrix(ks_env, matrix_s,
"xTB OVERLAP MATRIX", basis_set_list, basis_set_list, &
893 ALLOCATE (matrix_h(1, img)%matrix)
894 CALL dbcsr_create(matrix_h(1, img)%matrix, template=matrix_s(1, 1)%matrix, &
895 name=
"HAMILTONIAN MATRIX")
903 CALL cnumber_init(qs_env, cnumbers, dcnum, 1, calculate_forces)
906 CALL get_qs_env(qs_env=qs_env, dispersion_env=dispersion_env)
908 energy%dispersion, calculate_forces)
911 CALL gfn1_huckel(qs_env, cnumbers, huckel, dhuckel, calculate_forces)
920 iatom=iatom, jatom=jatom, r=rij, cell=cell)
921 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
923 IF (.NOT. defined .OR. natorb_a < 1) cycle
924 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
926 IF (.NOT. defined .OR. natorb_b < 1) cycle
928 dr = sqrt(sum(rij(:)**2))
932 lmax=lmaxa, nshell=nsa, kpoly=kpolya)
934 lmax=lmaxb, nshell=nsb, kpoly=kpolyb)
939 ic = cell_to_index(cell(1), cell(2), cell(3))
943 icol = max(iatom, jatom)
944 irow = min(iatom, jatom)
945 NULLIFY (sblock, fblock)
947 row=irow, col=icol, block=sblock, found=found)
950 row=irow, col=icol, block=fblock, found=found)
953 IF (calculate_forces)
THEN
956 row=irow, col=icol, block=pblock, found=found)
960 row=irow, col=icol, block=wblock, found=found)
963 NULLIFY (dsblocks(i)%block)
965 row=irow, col=icol, block=dsblocks(i)%block, found=found)
971 basis_set_a => basis_set_list(ikind)%gto_basis_set
972 IF (.NOT.
ASSOCIATED(basis_set_a)) cycle
973 basis_set_b => basis_set_list(jkind)%gto_basis_set
974 IF (.NOT.
ASSOCIATED(basis_set_b)) cycle
975 atom_a = atom_of_kind(iatom)
976 atom_b = atom_of_kind(jatom)
978 first_sgfa => basis_set_a%first_sgf
979 la_max => basis_set_a%lmax
980 la_min => basis_set_a%lmin
981 npgfa => basis_set_a%npgf
982 nseta = basis_set_a%nset
983 nsgfa => basis_set_a%nsgf_set
984 rpgfa => basis_set_a%pgf_radius
985 set_radius_a => basis_set_a%set_radius
986 scon_a => basis_set_a%scon
987 zeta => basis_set_a%zet
989 first_sgfb => basis_set_b%first_sgf
990 lb_max => basis_set_b%lmax
991 lb_min => basis_set_b%lmin
992 npgfb => basis_set_b%npgf
993 nsetb = basis_set_b%nset
994 nsgfb => basis_set_b%nsgf_set
995 rpgfb => basis_set_b%pgf_radius
996 set_radius_b => basis_set_b%set_radius
997 scon_b => basis_set_b%scon
998 zetb => basis_set_b%zet
1001 ALLOCATE (oint(ldsab, ldsab, maxder), owork(ldsab, ldsab))
1002 ALLOCATE (sint(natorb_a, natorb_b, maxder))
1006 ncoa = npgfa(iset)*
ncoset(la_max(iset))
1007 n1 = npgfa(iset)*(
ncoset(la_max(iset)) -
ncoset(la_min(iset) - 1))
1008 sgfa = first_sgfa(1, iset)
1010 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
1011 ncob = npgfb(jset)*
ncoset(lb_max(jset))
1012 n2 = npgfb(jset)*(
ncoset(lb_max(jset)) -
ncoset(lb_min(jset) - 1))
1013 sgfb = first_sgfb(1, jset)
1014 IF (calculate_forces)
THEN
1015 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1016 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1017 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
1019 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
1020 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
1021 rij, sab=oint(:, :, 1))
1024 CALL contraction(oint(:, :, 1), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1025 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1026 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, 1), sgfa, sgfb, trans=.false.)
1027 IF (calculate_forces)
THEN
1029 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
1030 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
1031 CALL block_add(
"IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), sgfa, sgfb, trans=.false.)
1037 IF (calculate_forces)
THEN
1039 IF (iatom <= jatom)
THEN
1040 force_ab(i) = sum(sint(:, :, i + 1)*wblock(:, :))
1042 force_ab(i) = sum(sint(:, :, i + 1)*transpose(wblock(:, :)))
1046 force(ikind)%overlap(:, atom_a) = force(ikind)%overlap(:, atom_a) - f1*force_ab(:)
1047 force(jkind)%overlap(:, atom_b) = force(jkind)%overlap(:, atom_b) + f1*force_ab(:)
1048 IF (use_virial .AND. dr > 1.e-3_dp)
THEN
1049 IF (iatom == jatom) f1 = 1.0_dp
1054 IF (iatom <= jatom)
THEN
1055 sblock(:, :) = sblock(:, :) + sint(:, :, 1)
1057 sblock(:, :) = sblock(:, :) + transpose(sint(:, :, 1))
1059 IF (calculate_forces)
THEN
1061 IF (iatom <= jatom)
THEN
1062 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) + sint(:, :, i)
1064 dsblocks(i)%block(:, :) = dsblocks(i)%block(:, :) - transpose(sint(:, :, i))
1070 rcovab = rcova + rcovb
1071 rrab = sqrt(dr/rcovab)
1072 pia(1:nsa) = 1._dp + kpolya(1:nsa)*rrab
1073 pib(1:nsb) = 1._dp + kpolyb(1:nsb)*rrab
1074 IF (calculate_forces)
THEN
1075 IF (dr > 1.e-6_dp)
THEN
1076 drx = 0.5_dp/rrab/rcovab
1080 dpia(1:nsa) = drx*kpolya(1:nsa)
1081 dpib(1:nsb) = drx*kpolyb(1:nsb)
1086 IF (iatom == jatom .AND. dr < 0.001_dp) diagblock = .true.
1093 fblock(i, i) = fblock(i, i) + huckel(na, iatom)
1100 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1101 IF (iatom <= jatom)
THEN
1102 fblock(i, j) = fblock(i, j) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1104 fblock(j, i) = fblock(j, i) + hij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1109 IF (calculate_forces)
THEN
1111 IF (irow == iatom) f0 = -1.0_dp
1120 fhud = fhud + pblock(i, i)*dhuckel(na, iatom)
1129 hij = 0.5_dp*pia(na)*pib(nb)
1130 IF (iatom <= jatom)
THEN
1131 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(na, iatom)
1132 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(i, j)*dhuckel(nb, jatom)
1134 fhua = fhua + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(na, iatom)
1135 fhub = fhub + hij*kijab(i, j, ikind, jkind)*sint(i, j, 1)*pblock(j, i)*dhuckel(nb, jatom)
1139 IF (iatom /= jatom)
THEN
1145 atom_a = atom_of_kind(iatom)
1146 DO i = 1, dcnum(iatom)%neighbors
1147 katom = dcnum(iatom)%nlist(i)
1148 kkind = kind_of(katom)
1149 atom_c = atom_of_kind(katom)
1150 rik = dcnum(iatom)%rik(:, i)
1151 drk = sqrt(sum(rik(:)**2))
1152 IF (drk > 1.e-3_dp)
THEN
1153 fdika(:) = fhua*dcnum(iatom)%dvals(i)*rik(:)/drk
1154 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdika(:)
1155 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdika(:)
1156 fdikb(:) = fhud*dcnum(iatom)%dvals(i)*rik(:)/drk
1157 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - fdikb(:)
1158 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdikb(:)
1159 IF (use_virial)
THEN
1160 fdik = fdika + fdikb
1166 atom_b = atom_of_kind(jatom)
1167 DO i = 1, dcnum(jatom)%neighbors
1168 katom = dcnum(jatom)%nlist(i)
1169 kkind = kind_of(katom)
1170 atom_c = atom_of_kind(katom)
1171 rik = dcnum(jatom)%rik(:, i)
1172 drk = sqrt(sum(rik(:)**2))
1173 IF (drk > 1.e-3_dp)
THEN
1174 fdik(:) = fhub*dcnum(jatom)%dvals(i)*rik(:)/drk
1175 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) - fdik(:)
1176 force(kkind)%all_potential(:, atom_c) = force(kkind)%all_potential(:, atom_c) + fdik(:)
1177 IF (use_virial)
THEN
1186 n1 =
SIZE(fblock, 1)
1187 n2 =
SIZE(fblock, 2)
1188 ALLOCATE (dfblock(n1, n2))
1196 dhij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*(dpia(na)*pib(nb) + pia(na)*dpib(nb))
1197 IF (iatom <= jatom)
THEN
1198 dfblock(i, j) = dfblock(i, j) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1200 dfblock(j, i) = dfblock(j, i) + dhij*sint(i, j, 1)*kijab(i, j, ikind, jkind)
1204 dfp = f0*sum(dfblock(:, :)*pblock(:, :))
1206 foab = 2.0_dp*dfp*rij(ir)/dr
1214 hij = 0.5_dp*(huckel(na, iatom) + huckel(nb, jatom))*pia(na)*pib(nb)
1215 IF (iatom <= jatom)
THEN
1216 foab = foab + 2.0_dp*hij*sint(i, j, ir + 1)*pblock(i, j)*kijab(i, j, ikind, jkind)
1218 foab = foab - 2.0_dp*hij*sint(i, j, ir + 1)*pblock(j, i)*kijab(i, j, ikind, jkind)
1224 DEALLOCATE (dfblock)
1228 IF (calculate_forces)
THEN
1229 atom_a = atom_of_kind(iatom)
1230 atom_b = atom_of_kind(jatom)
1231 IF (irow == iatom) force_ab = -force_ab
1232 force(ikind)%all_potential(:, atom_a) = force(ikind)%all_potential(:, atom_a) - force_ab(:)
1233 force(jkind)%all_potential(:, atom_b) = force(jkind)%all_potential(:, atom_b) + force_ab(:)
1234 IF (use_virial)
THEN
1236 IF (iatom == jatom) f1 = 0.5_dp
1241 DEALLOCATE (oint, owork, sint)
1246 DO i = 1,
SIZE(matrix_h, 1)
1254 enscale = xtb_control%enscale
1264 IF (do_nonbonded)
THEN
1266 NULLIFY (sab_xtb_nonbond)
1267 CALL get_qs_env(qs_env=qs_env, sab_xtb_nonbond=sab_xtb_nonbond)
1269 atomic_kind_set, calculate_forces, use_virial, virial, atprop, atom_of_kind)
1273 erep = erep + exb + enonbonded
1275 CALL para_env%sum(exb)
1276 energy%xtb_xb_inter = exb
1278 IF (do_nonbonded)
THEN
1279 CALL para_env%sum(enonbonded)
1280 energy%xtb_nonbonded = enonbonded
1282 CALL para_env%sum(erep)
1283 energy%repulsive = erep
1290 IF (calculate_forces)
THEN
1291 DEALLOCATE (dhuckel)
1297 CALL ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1299 DEALLOCATE (basis_set_list)
1300 IF (calculate_forces)
THEN
1301 IF (
SIZE(matrix_p, 1) == 2)
THEN
1303 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, alpha_scalar=1.0_dp, &
1304 beta_scalar=-1.0_dp)
1305 CALL dbcsr_add(matrix_w(1, img)%matrix, matrix_w(2, img)%matrix, alpha_scalar=1.0_dp, &
1306 beta_scalar=-1.0_dp)
1311 CALL timestop(handle)
1313 END SUBROUTINE build_gfn1_xtb_matrices
1322 SUBROUTINE ao_matrix_output(qs_env, matrix_h, matrix_s, calculate_forces)
1324 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_h, matrix_s
1325 LOGICAL,
INTENT(IN) :: calculate_forces
1327 INTEGER :: after, i, img, iw, nimg
1328 LOGICAL :: norml1, norml2, omit_headers, use_arnoldi
1329 REAL(kind=
dp),
DIMENSION(2) :: condnum
1337 nimg =
SIZE(matrix_h, 2)
1338 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
1340 qs_env%input,
"DFT%PRINT%AO_MATRICES/CORE_HAMILTONIAN"),
cp_p_file))
THEN
1344 after = min(max(after, 1), 16)
1347 output_unit=iw, omit_headers=omit_headers)
1353 qs_env%input,
"DFT%PRINT%AO_MATRICES/OVERLAP"),
cp_p_file))
THEN
1357 after = min(max(after, 1), 16)
1360 output_unit=iw, omit_headers=omit_headers)
1362 qs_env%input,
"DFT%PRINT%AO_MATRICES/DERIVATIVES"),
cp_p_file))
THEN
1363 DO i = 2,
SIZE(matrix_s, 1)
1365 output_unit=iw, omit_headers=omit_headers)
1373 IF (.NOT. calculate_forces)
THEN
1375 "DFT%PRINT%OVERLAP_CONDITION") /= 0)
THEN
1379 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%DIAGONALIZATION", l_val=norml2)
1380 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%OVERLAP_CONDITION%ARNOLDI", l_val=use_arnoldi)
1381 CALL get_qs_env(qs_env=qs_env, blacs_env=blacs_env)
1382 CALL overlap_condnum(matrix_s, condnum, iw, norml1, norml2, use_arnoldi, blacs_env)
1386 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, rr_work)
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, lattice_fft)
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, 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.
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, 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 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_vhxc, 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_vhxc, 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, wall, hen, zeta, xi, kappa0, alpg, occupation, ngauss, 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.