(git:d43dca4)
Loading...
Searching...
No Matches
xtb_coulomb.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \brief Calculation of Coulomb contributions in xTB
10!> \author JGH
11! **************************************************************************************************
13 USE ai_contraction, ONLY: block_add,&
15 USE ai_overlap, ONLY: overlap_ab
22 USE cell_types, ONLY: cell_type,&
23 get_cell,&
24 pbc
27 USE cp_dbcsr_api, ONLY: dbcsr_add,&
41 USE kinds, ONLY: dp
42 USE kpoint_types, ONLY: get_kpoint_info,&
44 USE mathconstants, ONLY: oorootpi,&
45 pi
47 USE orbital_pointers, ONLY: ncoset
61 USE qs_kind_types, ONLY: get_qs_kind,&
69 USE qs_rho_types, ONLY: qs_rho_get,&
71 USE sap_kind_types, ONLY: clist_type,&
75 USE virial_types, ONLY: virial_type
76 USE xtb_types, ONLY: get_xtb_atom_param,&
78#include "./base/base_uses.f90"
79
80 IMPLICIT NONE
81
82 PRIVATE
83
84 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xtb_coulomb'
85
87
88CONTAINS
89
90! **************************************************************************************************
91!> \brief ...
92!> \param qs_env ...
93!> \param ks_matrix ...
94!> \param rho ...
95!> \param charges ...
96!> \param mcharge ...
97!> \param energy ...
98!> \param calculate_forces ...
99!> \param just_energy ...
100! **************************************************************************************************
101 SUBROUTINE build_xtb_coulomb(qs_env, ks_matrix, rho, charges, mcharge, energy, &
102 calculate_forces, just_energy)
103
104 TYPE(qs_environment_type), POINTER :: qs_env
105 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: ks_matrix
106 TYPE(qs_rho_type), POINTER :: rho
107 REAL(dp), DIMENSION(:, :), INTENT(in) :: charges
108 REAL(dp), DIMENSION(:), INTENT(in) :: mcharge
109 TYPE(qs_energy_type), POINTER :: energy
110 LOGICAL, INTENT(in) :: calculate_forces, just_energy
111
112 CHARACTER(len=*), PARAMETER :: routinen = 'build_xtb_coulomb'
113
114 INTEGER :: atom_i, atom_j, ewald_type, handle, i, ia, iac, iatom, ic, icol, ikind, img, &
115 irow, is, j, jatom, jkind, la, lb, lmaxa, lmaxb, natom, natorb_a, natorb_b, ni, nimg, nj, &
116 nkind, nmat, za, zb
117 INTEGER, ALLOCATABLE, DIMENSION(:) :: atom_of_kind, kind_of
118 INTEGER, DIMENSION(25) :: laoa, laob
119 INTEGER, DIMENSION(3) :: cellind, periodic
120 INTEGER, DIMENSION(5) :: occ
121 INTEGER, DIMENSION(:, :, :), POINTER :: cell_to_index
122 LOGICAL :: defined, do_ewald, do_gamma_stress, &
123 found, use_virial
124 REAL(kind=dp) :: alpha, deth, dr, ecsr, etaa, etab, f1, &
125 f2, fi, gmij, kg, rcut, rcuta, rcutb, &
126 zeff
127 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: xgamma, zeffk
128 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: gammab, gcij, gmcharge
129 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: gchrg
130 REAL(kind=dp), DIMENSION(25) :: gcint
131 REAL(kind=dp), DIMENSION(3) :: fij, rij
132 REAL(kind=dp), DIMENSION(5) :: kappaa, kappab
133 REAL(kind=dp), DIMENSION(:, :), POINTER :: dsblock, ksblock, pblock, sblock
134 REAL(kind=dp), DIMENSION(:, :, :), POINTER :: dsint
135 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
136 TYPE(atprop_type), POINTER :: atprop
137 TYPE(cell_type), POINTER :: cell
138 TYPE(dbcsr_iterator_type) :: iter
139 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: matrix_p, matrix_s
140 TYPE(dft_control_type), POINTER :: dft_control
141 TYPE(distribution_1d_type), POINTER :: local_particles
142 TYPE(ewald_environment_type), POINTER :: ewald_env
143 TYPE(ewald_pw_type), POINTER :: ewald_pw
144 TYPE(kpoint_type), POINTER :: kpoints
145 TYPE(mp_para_env_type), POINTER :: para_env
147 DIMENSION(:), POINTER :: nl_iterator
148 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
149 POINTER :: n_list
150 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
151 TYPE(qs_force_type), DIMENSION(:), POINTER :: force
152 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
153 TYPE(sap_int_type), DIMENSION(:), POINTER :: sap_int
154 TYPE(virial_type), POINTER :: virial
155 TYPE(xtb_atom_type), POINTER :: xtb_atom_a, xtb_atom_b, xtb_kind
156 TYPE(xtb_control_type), POINTER :: xtb_control
157
158 CALL timeset(routinen, handle)
159
160 NULLIFY (matrix_p, matrix_s, virial, atprop, dft_control)
161
162 CALL get_qs_env(qs_env, &
163 qs_kind_set=qs_kind_set, &
164 particle_set=particle_set, &
165 cell=cell, &
166 virial=virial, &
167 atprop=atprop, &
168 dft_control=dft_control)
169
170 xtb_control => dft_control%qs_control%xtb_control
171
172 use_virial = .false.
173 IF (calculate_forces) THEN
174 use_virial = virial%pv_availability .AND. (.NOT. virial%pv_numer)
175 END IF
176
177 do_gamma_stress = .false.
178 IF (.NOT. just_energy .AND. use_virial) THEN
179 IF (dft_control%nimages == 1) do_gamma_stress = .true.
180 END IF
181
182 IF (atprop%energy) THEN
183 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set)
184 natom = SIZE(particle_set)
185 CALL atprop_array_init(atprop%atecoul, natom)
186 END IF
187
188 IF (calculate_forces) THEN
189 nmat = 4
190 ELSE
191 nmat = 1
192 END IF
193
194 CALL get_qs_env(qs_env, nkind=nkind, natom=natom)
195 ALLOCATE (gchrg(natom, 5, nmat))
196 gchrg = 0._dp
197 ALLOCATE (gmcharge(natom, nmat))
198 gmcharge = 0._dp
199
200 ! short range contribution (gamma)
201 ! loop over all atom pairs (sab_xtbe)
202 kg = xtb_control%kg
203 NULLIFY (n_list)
204 CALL get_qs_env(qs_env=qs_env, sab_xtbe=n_list)
205 CALL neighbor_list_iterator_create(nl_iterator, n_list)
206 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
207 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, &
208 iatom=iatom, jatom=jatom, r=rij, cell=cellind)
209 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
210 CALL get_xtb_atom_param(xtb_atom_a, defined=defined, natorb=natorb_a)
211 IF (.NOT. defined .OR. natorb_a < 1) cycle
212 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
213 CALL get_xtb_atom_param(xtb_atom_b, defined=defined, natorb=natorb_b)
214 IF (.NOT. defined .OR. natorb_b < 1) cycle
215 ! atomic parameters
216 CALL get_xtb_atom_param(xtb_atom_a, eta=etaa, lmax=lmaxa, kappa=kappaa, rcut=rcuta)
217 CALL get_xtb_atom_param(xtb_atom_b, eta=etab, lmax=lmaxb, kappa=kappab, rcut=rcutb)
218 ! gamma matrix
219 ni = lmaxa + 1
220 nj = lmaxb + 1
221 ALLOCATE (gammab(ni, nj))
222 rcut = rcuta + rcutb
223 dr = sqrt(sum(rij(:)**2))
224 CALL gamma_rab_sr(gammab, dr, ni, kappaa, etaa, nj, kappab, etab, kg, rcut)
225 gchrg(iatom, 1:ni, 1) = gchrg(iatom, 1:ni, 1) + matmul(gammab, charges(jatom, 1:nj))
226 IF (iatom /= jatom) THEN
227 gchrg(jatom, 1:nj, 1) = gchrg(jatom, 1:nj, 1) + matmul(charges(iatom, 1:ni), gammab)
228 END IF
229 IF (calculate_forces) THEN
230 IF (dr > 1.e-6_dp) THEN
231 CALL dgamma_rab_sr(gammab, dr, ni, kappaa, etaa, nj, kappab, etab, kg, rcut)
232 DO i = 1, 3
233 gchrg(iatom, 1:ni, i + 1) = gchrg(iatom, 1:ni, i + 1) &
234 + matmul(gammab, charges(jatom, 1:nj))*rij(i)/dr
235 IF (iatom /= jatom) THEN
236 gchrg(jatom, 1:nj, i + 1) = gchrg(jatom, 1:nj, i + 1) &
237 - matmul(charges(iatom, 1:ni), gammab)*rij(i)/dr
238 END IF
239 END DO
240 IF (use_virial) THEN
241 gcint(1:ni) = matmul(gammab, charges(jatom, 1:nj))
242 DO i = 1, 3
243 fij(i) = -sum(charges(iatom, 1:ni)*gcint(1:ni))*rij(i)/dr
244 END DO
245 fi = 1.0_dp
246 IF (iatom == jatom) fi = 0.5_dp
247 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
248 END IF
249 END IF
250 END IF
251 DEALLOCATE (gammab)
252 END DO
253 CALL neighbor_list_iterator_release(nl_iterator)
254
255 ! 1/R contribution
256
257 IF (xtb_control%coulomb_lr) THEN
258 do_ewald = xtb_control%do_ewald
259 IF (do_ewald) THEN
260 ! Ewald sum
261 NULLIFY (ewald_env, ewald_pw)
262 CALL get_qs_env(qs_env=qs_env, &
263 ewald_env=ewald_env, ewald_pw=ewald_pw)
264 CALL get_cell(cell=cell, periodic=periodic, deth=deth)
265 CALL ewald_env_get(ewald_env, alpha=alpha, ewald_type=ewald_type)
266 CALL get_qs_env(qs_env=qs_env, sab_tbe=n_list)
267 CALL tb_ewald_overlap(gmcharge, mcharge, alpha, n_list, virial, use_virial)
268 SELECT CASE (ewald_type)
269 CASE DEFAULT
270 cpabort("Invalid Ewald type")
271 CASE (do_ewald_none)
272 cpabort("Not allowed with xTB/DFTB")
273 CASE (do_ewald_ewald)
274 cpabort("Standard Ewald not implemented in xTB/DFTB")
275 CASE (do_ewald_pme)
276 cpabort("PME not implemented in xTB/DFTB")
277 CASE (do_ewald_spme)
278 CALL tb_spme_evaluate(ewald_env, ewald_pw, particle_set, cell, &
279 gmcharge, mcharge, calculate_forces, virial, use_virial)
280 END SELECT
281 ELSE
282 ! direct sum
283 CALL get_qs_env(qs_env=qs_env, &
284 local_particles=local_particles)
285 DO ikind = 1, SIZE(local_particles%n_el)
286 DO ia = 1, local_particles%n_el(ikind)
287 iatom = local_particles%list(ikind)%array(ia)
288 DO jatom = 1, iatom - 1
289 rij = particle_set(iatom)%r - particle_set(jatom)%r
290 rij = pbc(rij, cell)
291 dr = sqrt(sum(rij(:)**2))
292 IF (dr > 1.e-6_dp) THEN
293 gmcharge(iatom, 1) = gmcharge(iatom, 1) + mcharge(jatom)/dr
294 gmcharge(jatom, 1) = gmcharge(jatom, 1) + mcharge(iatom)/dr
295 DO i = 2, nmat
296 gmcharge(iatom, i) = gmcharge(iatom, i) + rij(i - 1)*mcharge(jatom)/dr**3
297 gmcharge(jatom, i) = gmcharge(jatom, i) - rij(i - 1)*mcharge(iatom)/dr**3
298 END DO
299 IF (use_virial) THEN
300 DO i = 1, 3
301 fij(i) = mcharge(iatom)*mcharge(jatom)*rij(i)/dr**3
302 END DO
303 CALL virial_pair_force(virial%pv_virial, 1.0_dp, fij, rij)
304 END IF
305 END IF
306 END DO
307 END DO
308 END DO
309 END IF
310 END IF
311
312 ! global sum of gamma*p arrays
313 CALL get_qs_env(qs_env=qs_env, &
314 atomic_kind_set=atomic_kind_set, &
315 force=force, para_env=para_env)
316 CALL para_env%sum(gmcharge(:, 1))
317 CALL para_env%sum(gchrg(:, :, 1))
318
319 IF (xtb_control%coulomb_lr) THEN
320 IF (do_ewald) THEN
321 ! add self charge interaction and background charge contribution
322 gmcharge(:, 1) = gmcharge(:, 1) - 2._dp*alpha*oorootpi*mcharge(:)
323 IF (any(periodic(:) == 1)) THEN
324 gmcharge(:, 1) = gmcharge(:, 1) - pi/alpha**2/deth
325 END IF
326 END IF
327 END IF
328
329 ! energy
330 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
331 kind_of=kind_of, &
332 atom_of_kind=atom_of_kind)
333 ecsr = 0.0_dp
334 DO iatom = 1, natom
335 ikind = kind_of(iatom)
336 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
337 CALL get_xtb_atom_param(xtb_kind, lmax=ni)
338 ni = ni + 1
339 ecsr = ecsr + sum(charges(iatom, 1:ni)*gchrg(iatom, 1:ni, 1))
340 END DO
341
342 energy%hartree = energy%hartree + 0.5_dp*ecsr
343 energy%hartree = energy%hartree + 0.5_dp*sum(mcharge(:)*gmcharge(:, 1))
344
345 IF (atprop%energy) THEN
346 CALL get_qs_env(qs_env=qs_env, local_particles=local_particles)
347 DO ikind = 1, SIZE(local_particles%n_el)
348 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
349 CALL get_xtb_atom_param(xtb_kind, lmax=ni, occupation=occ)
350 ni = ni + 1
351 zeff = sum(real(occ, kind=dp))
352 DO ia = 1, local_particles%n_el(ikind)
353 iatom = local_particles%list(ikind)%array(ia)
354 atprop%atecoul(iatom) = atprop%atecoul(iatom) + &
355 0.5_dp*sum(real(occ(1:ni), kind=dp)*gchrg(iatom, 1:ni, 1))
356 atprop%atecoul(iatom) = atprop%atecoul(iatom) + &
357 0.5_dp*zeff*gmcharge(iatom, 1)
358 END DO
359 END DO
360 END IF
361
362 IF (calculate_forces) THEN
363 DO iatom = 1, natom
364 ikind = kind_of(iatom)
365 atom_i = atom_of_kind(iatom)
366 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
367 CALL get_xtb_atom_param(xtb_kind, lmax=ni)
368 ! short range
369 ni = ni + 1
370 DO i = 1, 3
371 fij(i) = sum(charges(iatom, 1:ni)*gchrg(iatom, 1:ni, i + 1))
372 END DO
373 force(ikind)%rho_elec(1, atom_i) = force(ikind)%rho_elec(1, atom_i) - fij(1)
374 force(ikind)%rho_elec(2, atom_i) = force(ikind)%rho_elec(2, atom_i) - fij(2)
375 force(ikind)%rho_elec(3, atom_i) = force(ikind)%rho_elec(3, atom_i) - fij(3)
376 ! long range
377 DO i = 1, 3
378 fij(i) = gmcharge(iatom, i + 1)*mcharge(iatom)
379 END DO
380 force(ikind)%rho_elec(1, atom_i) = force(ikind)%rho_elec(1, atom_i) - fij(1)
381 force(ikind)%rho_elec(2, atom_i) = force(ikind)%rho_elec(2, atom_i) - fij(2)
382 force(ikind)%rho_elec(3, atom_i) = force(ikind)%rho_elec(3, atom_i) - fij(3)
383 END DO
384 END IF
385
386 IF (.NOT. just_energy) THEN
387 CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
388 CALL qs_rho_get(rho, rho_ao_kp=matrix_p)
389
390 nimg = dft_control%nimages
391 NULLIFY (cell_to_index)
392 IF (nimg > 1) THEN
393 NULLIFY (kpoints)
394 CALL get_qs_env(qs_env=qs_env, kpoints=kpoints)
395 CALL get_kpoint_info(kpoint=kpoints, cell_to_index=cell_to_index)
396 END IF
397
398 IF (calculate_forces .AND. SIZE(matrix_p, 1) == 2) THEN
399 DO img = 1, nimg
400 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
401 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
402 END DO
403 END IF
404
405 NULLIFY (sap_int)
406 IF (do_gamma_stress) THEN
407 ! derivative overlap integral (non collapsed)
408 CALL xtb_dsint_list(qs_env, sap_int)
409 END IF
410
411 IF (nimg == 1) THEN
412 ! no k-points; all matrices have been transformed to periodic bsf
413 CALL dbcsr_iterator_start(iter, matrix_s(1, 1)%matrix)
414 DO WHILE (dbcsr_iterator_blocks_left(iter))
415 CALL dbcsr_iterator_next_block(iter, irow, icol, sblock)
416 ikind = kind_of(irow)
417 jkind = kind_of(icol)
418
419 ! atomic parameters
420 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
421 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
422 CALL get_xtb_atom_param(xtb_atom_a, z=za, lao=laoa)
423 CALL get_xtb_atom_param(xtb_atom_b, z=zb, lao=laob)
424
425 ni = SIZE(sblock, 1)
426 nj = SIZE(sblock, 2)
427 ALLOCATE (gcij(ni, nj))
428 DO i = 1, ni
429 DO j = 1, nj
430 la = laoa(i) + 1
431 lb = laob(j) + 1
432 gcij(i, j) = 0.5_dp*(gchrg(irow, la, 1) + gchrg(icol, lb, 1))
433 END DO
434 END DO
435 gmij = 0.5_dp*(gmcharge(irow, 1) + gmcharge(icol, 1))
436 DO is = 1, SIZE(ks_matrix, 1)
437 NULLIFY (ksblock)
438 CALL dbcsr_get_block_p(matrix=ks_matrix(is, 1)%matrix, &
439 row=irow, col=icol, block=ksblock, found=found)
440 cpassert(found)
441 ksblock = ksblock - gcij*sblock
442 ksblock = ksblock - gmij*sblock
443 END DO
444 IF (calculate_forces) THEN
445 atom_i = atom_of_kind(irow)
446 atom_j = atom_of_kind(icol)
447 NULLIFY (pblock)
448 CALL dbcsr_get_block_p(matrix=matrix_p(1, 1)%matrix, &
449 row=irow, col=icol, block=pblock, found=found)
450 cpassert(found)
451 DO i = 1, 3
452 NULLIFY (dsblock)
453 CALL dbcsr_get_block_p(matrix=matrix_s(1 + i, 1)%matrix, &
454 row=irow, col=icol, block=dsblock, found=found)
455 cpassert(found)
456 fij(i) = 0.0_dp
457 ! short range
458 fi = -2.0_dp*sum(pblock*dsblock*gcij)
459 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
460 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
461 fij(i) = fij(i) + fi
462 ! long range
463 fi = -2.0_dp*gmij*sum(pblock*dsblock)
464 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
465 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
466 fij(i) = fij(i) + fi
467 END DO
468 END IF
469 DEALLOCATE (gcij)
470 END DO
471 CALL dbcsr_iterator_stop(iter)
472 ! stress tensor (needs recalculation of overlap integrals)
473 IF (do_gamma_stress) THEN
474 DO ikind = 1, nkind
475 DO jkind = 1, nkind
476 iac = ikind + nkind*(jkind - 1)
477 IF (.NOT. ASSOCIATED(sap_int(iac)%alist)) cycle
478 ! atomic parameters
479 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
480 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
481 CALL get_xtb_atom_param(xtb_atom_a, lao=laoa, natorb=ni)
482 CALL get_xtb_atom_param(xtb_atom_b, lao=laob, natorb=nj)
483 DO ia = 1, sap_int(iac)%nalist
484 IF (.NOT. ASSOCIATED(sap_int(iac)%alist(ia)%clist)) cycle
485 iatom = sap_int(iac)%alist(ia)%aatom
486 DO ic = 1, sap_int(iac)%alist(ia)%nclist
487 jatom = sap_int(iac)%alist(ia)%clist(ic)%catom
488 rij = sap_int(iac)%alist(ia)%clist(ic)%rac
489 dr = sqrt(sum(rij(:)**2))
490 IF (dr > 1.e-6_dp) THEN
491 dsint => sap_int(iac)%alist(ia)%clist(ic)%acint
492 ALLOCATE (gcij(ni, nj))
493 DO i = 1, ni
494 DO j = 1, nj
495 la = laoa(i) + 1
496 lb = laob(j) + 1
497 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
498 END DO
499 END DO
500 gmij = 0.5_dp*(gmcharge(iatom, 1) + gmcharge(jatom, 1))
501 icol = max(iatom, jatom)
502 irow = min(iatom, jatom)
503 NULLIFY (pblock)
504 CALL dbcsr_get_block_p(matrix=matrix_p(1, 1)%matrix, &
505 row=irow, col=icol, block=pblock, found=found)
506 cpassert(found)
507 fij = 0.0_dp
508 DO i = 1, 3
509 ! short/long range
510 IF (irow == iatom) THEN
511 f1 = -2.0_dp*sum(pblock*dsint(:, :, i)*gcij)
512 f2 = -2.0_dp*gmij*sum(pblock*dsint(:, :, i))
513 ELSE
514 f1 = -2.0_dp*sum(transpose(pblock)*dsint(:, :, i)*gcij)
515 f2 = -2.0_dp*gmij*sum(transpose(pblock)*dsint(:, :, i))
516 END IF
517 fij(i) = f1 + f2
518 END DO
519 DEALLOCATE (gcij)
520 fi = 1.0_dp
521 IF (iatom == jatom) fi = 0.5_dp
522 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
523 END IF
524 END DO
525 END DO
526 END DO
527 END DO
528 END IF
529 ELSE
530 NULLIFY (n_list)
531 CALL get_qs_env(qs_env=qs_env, sab_orb=n_list)
532 CALL neighbor_list_iterator_create(nl_iterator, n_list)
533 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
534 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, &
535 iatom=iatom, jatom=jatom, r=rij, cell=cellind)
536
537 icol = max(iatom, jatom)
538 irow = min(iatom, jatom)
539
540 ic = cell_to_index(cellind(1), cellind(2), cellind(3))
541 cpassert(ic > 0)
542
543 NULLIFY (sblock)
544 CALL dbcsr_get_block_p(matrix=matrix_s(1, ic)%matrix, &
545 row=irow, col=icol, block=sblock, found=found)
546 cpassert(found)
547
548 ! atomic parameters
549 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
550 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
551 CALL get_xtb_atom_param(xtb_atom_a, z=za, lao=laoa)
552 CALL get_xtb_atom_param(xtb_atom_b, z=zb, lao=laob)
553
554 ni = SIZE(sblock, 1)
555 nj = SIZE(sblock, 2)
556 ALLOCATE (gcij(ni, nj))
557 DO i = 1, ni
558 DO j = 1, nj
559 IF (irow == iatom) THEN
560 la = laoa(i) + 1
561 lb = laob(j) + 1
562 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
563 ELSE
564 la = laoa(j) + 1
565 lb = laob(i) + 1
566 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
567 END IF
568 END DO
569 END DO
570 gmij = 0.5_dp*(gmcharge(iatom, 1) + gmcharge(jatom, 1))
571 DO is = 1, SIZE(ks_matrix, 1)
572 NULLIFY (ksblock)
573 CALL dbcsr_get_block_p(matrix=ks_matrix(is, ic)%matrix, &
574 row=irow, col=icol, block=ksblock, found=found)
575 cpassert(found)
576 ksblock = ksblock - gcij*sblock
577 ksblock = ksblock - gmij*sblock
578 END DO
579
580 IF (calculate_forces) THEN
581 atom_i = atom_of_kind(iatom)
582 atom_j = atom_of_kind(jatom)
583 IF (irow /= iatom) THEN
584 gmij = -gmij
585 gcij = -gcij
586 END IF
587 NULLIFY (pblock)
588 CALL dbcsr_get_block_p(matrix=matrix_p(1, ic)%matrix, &
589 row=irow, col=icol, block=pblock, found=found)
590 cpassert(found)
591 DO i = 1, 3
592 NULLIFY (dsblock)
593 CALL dbcsr_get_block_p(matrix=matrix_s(1 + i, ic)%matrix, &
594 row=irow, col=icol, block=dsblock, found=found)
595 cpassert(found)
596 fij(i) = 0.0_dp
597 ! short range
598 fi = -2.0_dp*sum(pblock*dsblock*gcij)
599 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
600 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
601 fij(i) = fij(i) + fi
602 ! long range
603 fi = -2.0_dp*gmij*sum(pblock*dsblock)
604 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
605 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
606 fij(i) = fij(i) + fi
607 END DO
608 IF (use_virial) THEN
609 dr = sqrt(sum(rij(:)**2))
610 IF (dr > 1.e-6_dp) THEN
611 fi = 1.0_dp
612 IF (iatom == jatom) fi = 0.5_dp
613 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
614 END IF
615 END IF
616 END IF
617 DEALLOCATE (gcij)
618
619 END DO
620 CALL neighbor_list_iterator_release(nl_iterator)
621 END IF
622
623 IF (calculate_forces .AND. SIZE(matrix_p, 1) == 2) THEN
624 DO img = 1, nimg
625 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
626 alpha_scalar=1.0_dp, beta_scalar=-1.0_dp)
627 END DO
628 END IF
629 END IF
630
631 IF (xtb_control%tb3_interaction) THEN
632 CALL get_qs_env(qs_env, nkind=nkind)
633 ALLOCATE (zeffk(nkind), xgamma(nkind))
634 DO ikind = 1, nkind
635 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
636 CALL get_xtb_atom_param(xtb_kind, xgamma=xgamma(ikind), zeff=zeffk(ikind))
637 END DO
638 ! Diagonal 3rd order correction (DFTB3)
639 CALL build_dftb3_diagonal(qs_env, ks_matrix, rho, mcharge, energy, xgamma, zeffk, &
640 sap_int, calculate_forces, just_energy)
641 DEALLOCATE (zeffk, xgamma)
642 END IF
643
644 ! QMMM
645 IF (qs_env%qmmm .AND. qs_env%qmmm_periodic) THEN
646 CALL build_tb_coulomb_qmqm(qs_env, ks_matrix, rho, mcharge, energy, &
647 calculate_forces, just_energy)
648 END IF
649
650 IF (do_gamma_stress) THEN
651 CALL release_sap_int(sap_int)
652 END IF
653
654 CALL timestop(handle)
655
656 END SUBROUTINE build_xtb_coulomb
657
658! **************************************************************************************************
659!> \brief Computes the short-range gamma parameter from
660!> Nataga-Mishimoto-Ohno-Klopman formula for xTB
661!> WARNING: The xTB function (gamma - 1/r) has still an l-dependent longrange (1/r^3)
662!> behaviour. We use a cutoff function to smoothly remove this part.
663!> However, this will change energies and effect final results.
664!>
665!> \param gmat ...
666!> \param rab ...
667!> \param nla ...
668!> \param kappaa ...
669!> \param etaa ...
670!> \param nlb ...
671!> \param kappab ...
672!> \param etab ...
673!> \param kg ...
674!> \param rcut ...
675!> \par History
676!> 10.2018 JGH
677!> \version 1.1
678! **************************************************************************************************
679 SUBROUTINE gamma_rab_sr(gmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
680 REAL(dp), DIMENSION(:, :), INTENT(INOUT) :: gmat
681 REAL(dp), INTENT(IN) :: rab
682 INTEGER, INTENT(IN) :: nla
683 REAL(dp), DIMENSION(:), INTENT(IN) :: kappaa
684 REAL(dp), INTENT(IN) :: etaa
685 INTEGER, INTENT(IN) :: nlb
686 REAL(dp), DIMENSION(:), INTENT(IN) :: kappab
687 REAL(dp), INTENT(IN) :: etab, kg, rcut
688
689 REAL(kind=dp), PARAMETER :: rsmooth = 1.0_dp
690
691 INTEGER :: i, j
692 REAL(kind=dp) :: fcut, r, rk, x
693 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: eta
694
695 ALLOCATE (eta(nla, nlb))
696 eta = 0.0_dp
697
698 DO j = 1, nlb
699 DO i = 1, nla
700 eta(i, j) = 1._dp/(etaa*(1._dp + kappaa(i))) + 1._dp/(etab*(1._dp + kappab(j)))
701 eta(i, j) = 2._dp/eta(i, j)
702 END DO
703 END DO
704
705 gmat = 0.0_dp
706 IF (rab < 1.e-6_dp) THEN
707 ! on site terms
708 gmat(:, :) = eta(:, :)
709 ELSEIF (rab > rcut) THEN
710 ! do nothing
711 ELSE
712 rk = rab**kg
713 eta = eta**(-kg)
714 IF (rab < rcut - rsmooth) THEN
715 fcut = 1.0_dp
716 ELSE
717 r = rab - (rcut - rsmooth)
718 x = r/rsmooth
719 fcut = -6._dp*x**5 + 15._dp*x**4 - 10._dp*x**3 + 1._dp
720 END IF
721 gmat(:, :) = fcut*(1._dp/(rk + eta(:, :)))**(1._dp/kg) - fcut/rab
722 END IF
723
724 DEALLOCATE (eta)
725
726 END SUBROUTINE gamma_rab_sr
727
728! **************************************************************************************************
729!> \brief Computes the derivative of the short-range gamma parameter from
730!> Nataga-Mishimoto-Ohno-Klopman formula for xTB
731!> WARNING: The xTB function (gamma - 1/r) has still an l-dependent longrange (1/r^3)
732!> behaviour. We use a cutoff function to smoothly remove this part.
733!> However, this will change energies and effect final results.
734!>
735!> \param dgmat ...
736!> \param rab ...
737!> \param nla ...
738!> \param kappaa ...
739!> \param etaa ...
740!> \param nlb ...
741!> \param kappab ...
742!> \param etab ...
743!> \param kg ...
744!> \param rcut ...
745!> \par History
746!> 10.2018 JGH
747!> \version 1.1
748! **************************************************************************************************
749 SUBROUTINE dgamma_rab_sr(dgmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
750 REAL(dp), DIMENSION(:, :), INTENT(INOUT) :: dgmat
751 REAL(dp), INTENT(IN) :: rab
752 INTEGER, INTENT(IN) :: nla
753 REAL(dp), DIMENSION(:), INTENT(IN) :: kappaa
754 REAL(dp), INTENT(IN) :: etaa
755 INTEGER, INTENT(IN) :: nlb
756 REAL(dp), DIMENSION(:), INTENT(IN) :: kappab
757 REAL(dp), INTENT(IN) :: etab, kg, rcut
758
759 REAL(kind=dp), PARAMETER :: rsmooth = 1.0_dp
760
761 INTEGER :: i, j
762 REAL(kind=dp) :: dfcut, fcut, r, rk, x
763 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: eta
764
765 ALLOCATE (eta(nla, nlb))
766
767 DO j = 1, nlb
768 DO i = 1, nla
769 eta(i, j) = 1._dp/(etaa*(1._dp + kappaa(i))) + 1._dp/(etab*(1._dp + kappab(j)))
770 eta(i, j) = 2._dp/eta(i, j)
771 END DO
772 END DO
773
774 IF (rab < 1.e-6) THEN
775 ! on site terms
776 dgmat(:, :) = 0.0_dp
777 ELSEIF (rab > rcut) THEN
778 dgmat(:, :) = 0.0_dp
779 ELSE
780 eta = eta**(-kg)
781 rk = rab**kg
782 IF (rab < rcut - rsmooth) THEN
783 fcut = 1.0_dp
784 dfcut = 0.0_dp
785 ELSE
786 r = rab - (rcut - rsmooth)
787 x = r/rsmooth
788 fcut = -6._dp*x**5 + 15._dp*x**4 - 10._dp*x**3 + 1._dp
789 dfcut = -30._dp*x**4 + 60._dp*x**3 - 30._dp*x**2
790 dfcut = dfcut/rsmooth
791 END IF
792 dgmat(:, :) = dfcut*(1._dp/(rk + eta(:, :)))**(1._dp/kg)
793 dgmat(:, :) = dgmat(:, :) - dfcut/rab + fcut/rab**2
794 dgmat(:, :) = dgmat(:, :) - fcut/(rk + eta(:, :))*(1._dp/(rk + eta(:, :)))**(1._dp/kg)*rk/rab
795 END IF
796
797 DEALLOCATE (eta)
798
799 END SUBROUTINE dgamma_rab_sr
800
801! **************************************************************************************************
802!> \brief ...
803!> \param qs_env ...
804!> \param sap_int ...
805! **************************************************************************************************
806 SUBROUTINE xtb_dsint_list(qs_env, sap_int)
807
808 TYPE(qs_environment_type), POINTER :: qs_env
809 TYPE(sap_int_type), DIMENSION(:), POINTER :: sap_int
810
811 CHARACTER(LEN=*), PARAMETER :: routinen = 'xtb_dsint_list'
812
813 INTEGER :: handle, i, iac, iatom, ikind, ilist, iset, jatom, jkind, jneighbor, jset, ldsab, &
814 n1, n2, natorb_a, natorb_b, ncoa, ncob, nkind, nlist, nneighbor, nseta, nsetb, sgfa, sgfb
815 INTEGER, DIMENSION(3) :: cell
816 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
817 npgfb, nsgfa, nsgfb
818 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb
819 LOGICAL :: defined
820 REAL(kind=dp) :: dr
821 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: owork
822 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: oint, sint
823 REAL(kind=dp), DIMENSION(3) :: rij
824 REAL(kind=dp), DIMENSION(:), POINTER :: set_radius_a, set_radius_b
825 REAL(kind=dp), DIMENSION(:, :), POINTER :: rpgfa, rpgfb, scon_a, scon_b, zeta, zetb
826 TYPE(clist_type), POINTER :: clist
827 TYPE(dft_control_type), POINTER :: dft_control
828 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_list
829 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b
831 DIMENSION(:), POINTER :: nl_iterator
832 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
833 POINTER :: sab_orb
834 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
835 TYPE(xtb_atom_type), POINTER :: xtb_atom_a, xtb_atom_b
836
837 CALL timeset(routinen, handle)
838
839 CALL get_qs_env(qs_env=qs_env, nkind=nkind)
840 cpassert(.NOT. ASSOCIATED(sap_int))
841 ALLOCATE (sap_int(nkind*nkind))
842 DO i = 1, nkind*nkind
843 NULLIFY (sap_int(i)%alist, sap_int(i)%asort, sap_int(i)%aindex)
844 sap_int(i)%nalist = 0
845 END DO
846
847 CALL get_qs_env(qs_env=qs_env, &
848 qs_kind_set=qs_kind_set, &
849 dft_control=dft_control, &
850 sab_orb=sab_orb)
851
852 ! set up basis set lists
853 ALLOCATE (basis_set_list(nkind))
854 CALL basis_set_list_setup(basis_set_list, "ORB", qs_kind_set)
855
856 ! loop over all atom pairs with a non-zero overlap (sab_orb)
857 CALL neighbor_list_iterator_create(nl_iterator, sab_orb)
858 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
859 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, iatom=iatom, &
860 jatom=jatom, nlist=nlist, ilist=ilist, nnode=nneighbor, &
861 inode=jneighbor, cell=cell, r=rij)
862 iac = ikind + nkind*(jkind - 1)
863 !
864 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
865 CALL get_xtb_atom_param(xtb_atom_a, defined=defined, natorb=natorb_a)
866 IF (.NOT. defined .OR. natorb_a < 1) cycle
867 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
868 CALL get_xtb_atom_param(xtb_atom_b, defined=defined, natorb=natorb_b)
869 IF (.NOT. defined .OR. natorb_b < 1) cycle
870
871 dr = sqrt(sum(rij(:)**2))
872
873 ! integral list
874 IF (.NOT. ASSOCIATED(sap_int(iac)%alist)) THEN
875 sap_int(iac)%a_kind = ikind
876 sap_int(iac)%p_kind = jkind
877 sap_int(iac)%nalist = nlist
878 ALLOCATE (sap_int(iac)%alist(nlist))
879 DO i = 1, nlist
880 NULLIFY (sap_int(iac)%alist(i)%clist)
881 sap_int(iac)%alist(i)%aatom = 0
882 sap_int(iac)%alist(i)%nclist = 0
883 END DO
884 END IF
885 IF (.NOT. ASSOCIATED(sap_int(iac)%alist(ilist)%clist)) THEN
886 sap_int(iac)%alist(ilist)%aatom = iatom
887 sap_int(iac)%alist(ilist)%nclist = nneighbor
888 ALLOCATE (sap_int(iac)%alist(ilist)%clist(nneighbor))
889 DO i = 1, nneighbor
890 sap_int(iac)%alist(ilist)%clist(i)%catom = 0
891 END DO
892 END IF
893 clist => sap_int(iac)%alist(ilist)%clist(jneighbor)
894 clist%catom = jatom
895 clist%cell = cell
896 clist%rac = rij
897 ALLOCATE (clist%acint(natorb_a, natorb_b, 3))
898 NULLIFY (clist%achint)
899 clist%acint = 0._dp
900 clist%nsgf_cnt = 0
901 NULLIFY (clist%sgf_list)
902
903 ! overlap
904 basis_set_a => basis_set_list(ikind)%gto_basis_set
905 IF (.NOT. ASSOCIATED(basis_set_a)) cycle
906 basis_set_b => basis_set_list(jkind)%gto_basis_set
907 IF (.NOT. ASSOCIATED(basis_set_b)) cycle
908 ! basis ikind
909 first_sgfa => basis_set_a%first_sgf
910 la_max => basis_set_a%lmax
911 la_min => basis_set_a%lmin
912 npgfa => basis_set_a%npgf
913 nseta = basis_set_a%nset
914 nsgfa => basis_set_a%nsgf_set
915 rpgfa => basis_set_a%pgf_radius
916 set_radius_a => basis_set_a%set_radius
917 scon_a => basis_set_a%scon
918 zeta => basis_set_a%zet
919 ! basis jkind
920 first_sgfb => basis_set_b%first_sgf
921 lb_max => basis_set_b%lmax
922 lb_min => basis_set_b%lmin
923 npgfb => basis_set_b%npgf
924 nsetb = basis_set_b%nset
925 nsgfb => basis_set_b%nsgf_set
926 rpgfb => basis_set_b%pgf_radius
927 set_radius_b => basis_set_b%set_radius
928 scon_b => basis_set_b%scon
929 zetb => basis_set_b%zet
930
931 ldsab = get_memory_usage(qs_kind_set, "ORB", "ORB")
932 ALLOCATE (oint(ldsab, ldsab, 4), owork(ldsab, ldsab))
933 ALLOCATE (sint(natorb_a, natorb_b, 4))
934 sint = 0.0_dp
935
936 DO iset = 1, nseta
937 ncoa = npgfa(iset)*ncoset(la_max(iset))
938 n1 = npgfa(iset)*(ncoset(la_max(iset)) - ncoset(la_min(iset) - 1))
939 sgfa = first_sgfa(1, iset)
940 DO jset = 1, nsetb
941 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
942 ncob = npgfb(jset)*ncoset(lb_max(jset))
943 n2 = npgfb(jset)*(ncoset(lb_max(jset)) - ncoset(lb_min(jset) - 1))
944 sgfb = first_sgfb(1, jset)
945 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
946 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
947 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
948 ! Contraction
949 DO i = 1, 4
950 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
951 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
952 CALL block_add("IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), &
953 sgfa, sgfb, trans=.false.)
954 END DO
955 END DO
956 END DO
957 ! update dS/dR matrix
958 clist%acint(1:natorb_a, 1:natorb_b, 1:3) = sint(1:natorb_a, 1:natorb_b, 2:4)
959
960 DEALLOCATE (oint, owork, sint)
961
962 END DO
963 CALL neighbor_list_iterator_release(nl_iterator)
964
965 DEALLOCATE (basis_set_list)
966
967 CALL timestop(handle)
968
969 END SUBROUTINE xtb_dsint_list
970
971END MODULE xtb_coulomb
Set of routines to: Contract integrals over primitive Gaussians Decontract (density) matrices Trace m...
Calculation of the overlap integrals over Cartesian Gaussian-type functions.
Definition ai_overlap.F:18
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....
Definition ai_overlap.F:681
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)
...
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
Definition cell_types.F:200
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_iterator_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset)
...
logical function, public dbcsr_iterator_blocks_left(iterator)
...
subroutine, public dbcsr_iterator_stop(iterator)
...
subroutine, public dbcsr_get_block_p(matrix, row, col, block, found, row_size, col_size)
...
subroutine, public dbcsr_iterator_start(iterator, matrix, shared, dynamic, dynamic_byrows)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
stores a lists of integer that are local to a processor. The idea is that these integers represent ob...
subroutine, public ewald_env_get(ewald_env, ewald_type, alpha, eps_pol, epsilon, gmax, ns_max, o_spline, group, para_env, poisson_section, precs, rcut, do_multipoles, max_multipole, do_ipol, max_ipol_iter, interaction_cutoffs, cell_hmat)
Purpose: Get the EWALD environment.
Calculation of Ewald contributions in DFTB.
subroutine, public tb_ewald_overlap(gmcharge, mcharge, alpha, n_list, virial, use_virial)
...
subroutine, public tb_spme_evaluate(ewald_env, ewald_pw, particle_set, box, gmcharge, mcharge, calculate_forces, virial, use_virial)
...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
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.
Definition of mathematical constants and functions.
real(kind=dp), parameter, public oorootpi
real(kind=dp), parameter, public pi
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.
functions related to the poisson solver on regular grids
integer, parameter, public do_ewald_pme
integer, parameter, public do_ewald_ewald
integer, parameter, public do_ewald_none
integer, parameter, public do_ewald_spme
Calculation of QMMM Coulomb contributions in TB.
subroutine, public build_tb_coulomb_qmqm(qs_env, ks_matrix, rho, mcharge, energy, calculate_forces, just_energy)
...
Calculation of DFTB3 Terms.
subroutine, public build_dftb3_diagonal(qs_env, ks_matrix, rho, mcharge, energy, xgamma, zeff, sap_int, calculate_forces, just_energy)
...
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.
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.
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)
...
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...
General overlap type integrals containers.
subroutine, public release_sap_int(sap_int)
...
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 Coulomb contributions in xTB.
Definition xtb_coulomb.F:12
subroutine, public gamma_rab_sr(gmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
Computes the short-range gamma parameter from Nataga-Mishimoto-Ohno-Klopman formula for xTB WARNING: ...
subroutine, public dgamma_rab_sr(dgmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
Computes the derivative of the short-range gamma parameter from Nataga-Mishimoto-Ohno-Klopman formula...
subroutine, public build_xtb_coulomb(qs_env, ks_matrix, rho, charges, mcharge, energy, calculate_forces, just_energy)
...
subroutine, public xtb_dsint_list(qs_env, sap_int)
...
Definition of the xTB parameter types.
Definition xtb_types.F:20
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)
...
Definition xtb_types.F:199
Provides all information about an atomic kind.
type for the atomic properties
Type defining parameters related to the simulation cell.
Definition cell_types.F:60
structure to store local (to a processor) ordered lists of integers.
Contains information about kpoints.
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
keeps the density in various representations, keeping track of which ones are valid.