(git:c28f603)
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 IF (.NOT. ASSOCIATED(n_list)) THEN
206 cpabort("sab_xtbe neighbor list is not associated in build_xtb_coulomb")
207 END IF
208 CALL neighbor_list_iterator_create(nl_iterator, n_list)
209 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
210 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, &
211 iatom=iatom, jatom=jatom, r=rij, cell=cellind)
212 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
213 CALL get_xtb_atom_param(xtb_atom_a, defined=defined, natorb=natorb_a)
214 IF (.NOT. defined .OR. natorb_a < 1) cycle
215 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
216 CALL get_xtb_atom_param(xtb_atom_b, defined=defined, natorb=natorb_b)
217 IF (.NOT. defined .OR. natorb_b < 1) cycle
218 ! atomic parameters
219 CALL get_xtb_atom_param(xtb_atom_a, eta=etaa, lmax=lmaxa, kappa=kappaa, rcut=rcuta)
220 CALL get_xtb_atom_param(xtb_atom_b, eta=etab, lmax=lmaxb, kappa=kappab, rcut=rcutb)
221 ! gamma matrix
222 ni = lmaxa + 1
223 nj = lmaxb + 1
224 ALLOCATE (gammab(ni, nj))
225 rcut = rcuta + rcutb
226 dr = sqrt(sum(rij(:)**2))
227 CALL gamma_rab_sr(gammab, dr, ni, kappaa, etaa, nj, kappab, etab, kg, rcut)
228 gchrg(iatom, 1:ni, 1) = gchrg(iatom, 1:ni, 1) + matmul(gammab, charges(jatom, 1:nj))
229 IF (iatom /= jatom) THEN
230 gchrg(jatom, 1:nj, 1) = gchrg(jatom, 1:nj, 1) + matmul(charges(iatom, 1:ni), gammab)
231 END IF
232 IF (calculate_forces) THEN
233 IF (dr > 1.e-6_dp) THEN
234 CALL dgamma_rab_sr(gammab, dr, ni, kappaa, etaa, nj, kappab, etab, kg, rcut)
235 DO i = 1, 3
236 gchrg(iatom, 1:ni, i + 1) = gchrg(iatom, 1:ni, i + 1) &
237 + matmul(gammab, charges(jatom, 1:nj))*rij(i)/dr
238 IF (iatom /= jatom) THEN
239 gchrg(jatom, 1:nj, i + 1) = gchrg(jatom, 1:nj, i + 1) &
240 - matmul(charges(iatom, 1:ni), gammab)*rij(i)/dr
241 END IF
242 END DO
243 IF (use_virial) THEN
244 gcint(1:ni) = matmul(gammab, charges(jatom, 1:nj))
245 DO i = 1, 3
246 fij(i) = -sum(charges(iatom, 1:ni)*gcint(1:ni))*rij(i)/dr
247 END DO
248 fi = 1.0_dp
249 IF (iatom == jatom) fi = 0.5_dp
250 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
251 END IF
252 END IF
253 END IF
254 DEALLOCATE (gammab)
255 END DO
256 CALL neighbor_list_iterator_release(nl_iterator)
257
258 ! 1/R contribution
259
260 IF (xtb_control%coulomb_lr) THEN
261 do_ewald = xtb_control%do_ewald
262 IF (do_ewald) THEN
263 ! Ewald sum
264 NULLIFY (ewald_env, ewald_pw)
265 CALL get_qs_env(qs_env=qs_env, &
266 ewald_env=ewald_env, ewald_pw=ewald_pw)
267 CALL get_cell(cell=cell, periodic=periodic, deth=deth)
268 CALL ewald_env_get(ewald_env, alpha=alpha, ewald_type=ewald_type)
269 CALL get_qs_env(qs_env=qs_env, sab_tbe=n_list)
270 CALL tb_ewald_overlap(gmcharge, mcharge, alpha, n_list, virial, use_virial)
271 SELECT CASE (ewald_type)
272 CASE DEFAULT
273 cpabort("Invalid Ewald type")
274 CASE (do_ewald_none)
275 cpabort("Not allowed with xTB/DFTB")
276 CASE (do_ewald_ewald)
277 cpabort("Standard Ewald not implemented in xTB/DFTB")
278 CASE (do_ewald_pme)
279 cpabort("PME not implemented in xTB/DFTB")
280 CASE (do_ewald_spme)
281 CALL tb_spme_evaluate(ewald_env, ewald_pw, particle_set, cell, &
282 gmcharge, mcharge, calculate_forces, virial, use_virial)
283 END SELECT
284 ELSE
285 ! direct sum
286 CALL get_qs_env(qs_env=qs_env, &
287 local_particles=local_particles)
288 DO ikind = 1, SIZE(local_particles%n_el)
289 DO ia = 1, local_particles%n_el(ikind)
290 iatom = local_particles%list(ikind)%array(ia)
291 DO jatom = 1, iatom - 1
292 rij = particle_set(iatom)%r - particle_set(jatom)%r
293 rij = pbc(rij, cell)
294 dr = sqrt(sum(rij(:)**2))
295 IF (dr > 1.e-6_dp) THEN
296 gmcharge(iatom, 1) = gmcharge(iatom, 1) + mcharge(jatom)/dr
297 gmcharge(jatom, 1) = gmcharge(jatom, 1) + mcharge(iatom)/dr
298 DO i = 2, nmat
299 gmcharge(iatom, i) = gmcharge(iatom, i) + rij(i - 1)*mcharge(jatom)/dr**3
300 gmcharge(jatom, i) = gmcharge(jatom, i) - rij(i - 1)*mcharge(iatom)/dr**3
301 END DO
302 IF (use_virial) THEN
303 DO i = 1, 3
304 fij(i) = mcharge(iatom)*mcharge(jatom)*rij(i)/dr**3
305 END DO
306 CALL virial_pair_force(virial%pv_virial, 1.0_dp, fij, rij)
307 END IF
308 END IF
309 END DO
310 END DO
311 END DO
312 END IF
313 END IF
314
315 ! global sum of gamma*p arrays
316 CALL get_qs_env(qs_env=qs_env, &
317 atomic_kind_set=atomic_kind_set, &
318 force=force, para_env=para_env)
319 CALL para_env%sum(gmcharge(:, 1))
320 CALL para_env%sum(gchrg(:, :, 1))
321
322 IF (xtb_control%coulomb_lr) THEN
323 IF (do_ewald) THEN
324 ! add self charge interaction and background charge contribution
325 gmcharge(:, 1) = gmcharge(:, 1) - 2._dp*alpha*oorootpi*mcharge(:)
326 IF (any(periodic(:) == 1)) THEN
327 gmcharge(:, 1) = gmcharge(:, 1) - pi/alpha**2/deth
328 END IF
329 END IF
330 END IF
331
332 ! energy
333 CALL get_atomic_kind_set(atomic_kind_set=atomic_kind_set, &
334 kind_of=kind_of, &
335 atom_of_kind=atom_of_kind)
336 ecsr = 0.0_dp
337 DO iatom = 1, natom
338 ikind = kind_of(iatom)
339 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
340 CALL get_xtb_atom_param(xtb_kind, lmax=ni)
341 ni = ni + 1
342 ecsr = ecsr + sum(charges(iatom, 1:ni)*gchrg(iatom, 1:ni, 1))
343 END DO
344
345 energy%hartree = energy%hartree + 0.5_dp*ecsr
346 energy%hartree = energy%hartree + 0.5_dp*sum(mcharge(:)*gmcharge(:, 1))
347
348 IF (atprop%energy) THEN
349 CALL get_qs_env(qs_env=qs_env, local_particles=local_particles)
350 DO ikind = 1, SIZE(local_particles%n_el)
351 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
352 CALL get_xtb_atom_param(xtb_kind, lmax=ni, occupation=occ)
353 ni = ni + 1
354 zeff = sum(real(occ, kind=dp))
355 DO ia = 1, local_particles%n_el(ikind)
356 iatom = local_particles%list(ikind)%array(ia)
357 atprop%atecoul(iatom) = atprop%atecoul(iatom) + &
358 0.5_dp*sum(real(occ(1:ni), kind=dp)*gchrg(iatom, 1:ni, 1))
359 atprop%atecoul(iatom) = atprop%atecoul(iatom) + &
360 0.5_dp*zeff*gmcharge(iatom, 1)
361 END DO
362 END DO
363 END IF
364
365 IF (calculate_forces) THEN
366 DO iatom = 1, natom
367 ikind = kind_of(iatom)
368 atom_i = atom_of_kind(iatom)
369 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
370 CALL get_xtb_atom_param(xtb_kind, lmax=ni)
371 ! short range
372 ni = ni + 1
373 DO i = 1, 3
374 fij(i) = sum(charges(iatom, 1:ni)*gchrg(iatom, 1:ni, i + 1))
375 END DO
376 force(ikind)%rho_elec(1, atom_i) = force(ikind)%rho_elec(1, atom_i) - fij(1)
377 force(ikind)%rho_elec(2, atom_i) = force(ikind)%rho_elec(2, atom_i) - fij(2)
378 force(ikind)%rho_elec(3, atom_i) = force(ikind)%rho_elec(3, atom_i) - fij(3)
379 ! long range
380 DO i = 1, 3
381 fij(i) = gmcharge(iatom, i + 1)*mcharge(iatom)
382 END DO
383 force(ikind)%rho_elec(1, atom_i) = force(ikind)%rho_elec(1, atom_i) - fij(1)
384 force(ikind)%rho_elec(2, atom_i) = force(ikind)%rho_elec(2, atom_i) - fij(2)
385 force(ikind)%rho_elec(3, atom_i) = force(ikind)%rho_elec(3, atom_i) - fij(3)
386 END DO
387 END IF
388
389 IF (.NOT. just_energy) THEN
390 CALL get_qs_env(qs_env=qs_env, matrix_s_kp=matrix_s)
391 CALL qs_rho_get(rho, rho_ao_kp=matrix_p)
392
393 nimg = dft_control%nimages
394 NULLIFY (cell_to_index)
395 IF (nimg > 1) THEN
396 NULLIFY (kpoints)
397 CALL get_qs_env(qs_env=qs_env, kpoints=kpoints)
398 CALL get_kpoint_info(kpoint=kpoints, cell_to_index=cell_to_index)
399 END IF
400
401 IF (calculate_forces .AND. SIZE(matrix_p, 1) == 2) THEN
402 DO img = 1, nimg
403 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
404 alpha_scalar=1.0_dp, beta_scalar=1.0_dp)
405 END DO
406 END IF
407
408 NULLIFY (sap_int)
409 IF (do_gamma_stress) THEN
410 ! derivative overlap integral (non collapsed)
411 CALL xtb_dsint_list(qs_env, sap_int)
412 END IF
413
414 IF (nimg == 1) THEN
415 ! no k-points; all matrices have been transformed to periodic bsf
416 CALL dbcsr_iterator_start(iter, matrix_s(1, 1)%matrix)
417 DO WHILE (dbcsr_iterator_blocks_left(iter))
418 CALL dbcsr_iterator_next_block(iter, irow, icol, sblock)
419 ikind = kind_of(irow)
420 jkind = kind_of(icol)
421
422 ! atomic parameters
423 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
424 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
425 CALL get_xtb_atom_param(xtb_atom_a, z=za, lao=laoa)
426 CALL get_xtb_atom_param(xtb_atom_b, z=zb, lao=laob)
427
428 ni = SIZE(sblock, 1)
429 nj = SIZE(sblock, 2)
430 ALLOCATE (gcij(ni, nj))
431 DO i = 1, ni
432 DO j = 1, nj
433 la = laoa(i) + 1
434 lb = laob(j) + 1
435 gcij(i, j) = 0.5_dp*(gchrg(irow, la, 1) + gchrg(icol, lb, 1))
436 END DO
437 END DO
438 gmij = 0.5_dp*(gmcharge(irow, 1) + gmcharge(icol, 1))
439 DO is = 1, SIZE(ks_matrix, 1)
440 NULLIFY (ksblock)
441 CALL dbcsr_get_block_p(matrix=ks_matrix(is, 1)%matrix, &
442 row=irow, col=icol, block=ksblock, found=found)
443 cpassert(found)
444 ksblock = ksblock - gcij*sblock
445 ksblock = ksblock - gmij*sblock
446 END DO
447 IF (calculate_forces) THEN
448 atom_i = atom_of_kind(irow)
449 atom_j = atom_of_kind(icol)
450 NULLIFY (pblock)
451 CALL dbcsr_get_block_p(matrix=matrix_p(1, 1)%matrix, &
452 row=irow, col=icol, block=pblock, found=found)
453 cpassert(found)
454 DO i = 1, 3
455 NULLIFY (dsblock)
456 CALL dbcsr_get_block_p(matrix=matrix_s(1 + i, 1)%matrix, &
457 row=irow, col=icol, block=dsblock, found=found)
458 cpassert(found)
459 fij(i) = 0.0_dp
460 ! short range
461 fi = -2.0_dp*sum(pblock*dsblock*gcij)
462 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
463 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
464 fij(i) = fij(i) + fi
465 ! long range
466 fi = -2.0_dp*gmij*sum(pblock*dsblock)
467 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
468 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
469 fij(i) = fij(i) + fi
470 END DO
471 END IF
472 DEALLOCATE (gcij)
473 END DO
474 CALL dbcsr_iterator_stop(iter)
475 ! stress tensor (needs recalculation of overlap integrals)
476 IF (do_gamma_stress) THEN
477 DO ikind = 1, nkind
478 DO jkind = 1, nkind
479 iac = ikind + nkind*(jkind - 1)
480 IF (.NOT. ASSOCIATED(sap_int(iac)%alist)) cycle
481 ! atomic parameters
482 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
483 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
484 CALL get_xtb_atom_param(xtb_atom_a, lao=laoa, natorb=ni)
485 CALL get_xtb_atom_param(xtb_atom_b, lao=laob, natorb=nj)
486 DO ia = 1, sap_int(iac)%nalist
487 IF (.NOT. ASSOCIATED(sap_int(iac)%alist(ia)%clist)) cycle
488 iatom = sap_int(iac)%alist(ia)%aatom
489 DO ic = 1, sap_int(iac)%alist(ia)%nclist
490 jatom = sap_int(iac)%alist(ia)%clist(ic)%catom
491 rij = sap_int(iac)%alist(ia)%clist(ic)%rac
492 dr = sqrt(sum(rij(:)**2))
493 IF (dr > 1.e-6_dp) THEN
494 dsint => sap_int(iac)%alist(ia)%clist(ic)%acint
495 ALLOCATE (gcij(ni, nj))
496 DO i = 1, ni
497 DO j = 1, nj
498 la = laoa(i) + 1
499 lb = laob(j) + 1
500 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
501 END DO
502 END DO
503 gmij = 0.5_dp*(gmcharge(iatom, 1) + gmcharge(jatom, 1))
504 icol = max(iatom, jatom)
505 irow = min(iatom, jatom)
506 NULLIFY (pblock)
507 CALL dbcsr_get_block_p(matrix=matrix_p(1, 1)%matrix, &
508 row=irow, col=icol, block=pblock, found=found)
509 cpassert(found)
510 fij = 0.0_dp
511 DO i = 1, 3
512 ! short/long range
513 IF (irow == iatom) THEN
514 f1 = -2.0_dp*sum(pblock*dsint(:, :, i)*gcij)
515 f2 = -2.0_dp*gmij*sum(pblock*dsint(:, :, i))
516 ELSE
517 f1 = -2.0_dp*sum(transpose(pblock)*dsint(:, :, i)*gcij)
518 f2 = -2.0_dp*gmij*sum(transpose(pblock)*dsint(:, :, i))
519 END IF
520 fij(i) = f1 + f2
521 END DO
522 DEALLOCATE (gcij)
523 fi = 1.0_dp
524 IF (iatom == jatom) fi = 0.5_dp
525 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
526 END IF
527 END DO
528 END DO
529 END DO
530 END DO
531 END IF
532 ELSE
533 NULLIFY (n_list)
534 CALL get_qs_env(qs_env=qs_env, sab_orb=n_list)
535 CALL neighbor_list_iterator_create(nl_iterator, n_list)
536 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
537 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, &
538 iatom=iatom, jatom=jatom, r=rij, cell=cellind)
539
540 icol = max(iatom, jatom)
541 irow = min(iatom, jatom)
542
543 ic = cell_to_index(cellind(1), cellind(2), cellind(3))
544 cpassert(ic > 0)
545
546 NULLIFY (sblock)
547 CALL dbcsr_get_block_p(matrix=matrix_s(1, ic)%matrix, &
548 row=irow, col=icol, block=sblock, found=found)
549 cpassert(found)
550
551 ! atomic parameters
552 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
553 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
554 CALL get_xtb_atom_param(xtb_atom_a, z=za, lao=laoa)
555 CALL get_xtb_atom_param(xtb_atom_b, z=zb, lao=laob)
556
557 ni = SIZE(sblock, 1)
558 nj = SIZE(sblock, 2)
559 ALLOCATE (gcij(ni, nj))
560 DO i = 1, ni
561 DO j = 1, nj
562 IF (irow == iatom) THEN
563 la = laoa(i) + 1
564 lb = laob(j) + 1
565 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
566 ELSE
567 la = laoa(j) + 1
568 lb = laob(i) + 1
569 gcij(i, j) = 0.5_dp*(gchrg(iatom, la, 1) + gchrg(jatom, lb, 1))
570 END IF
571 END DO
572 END DO
573 gmij = 0.5_dp*(gmcharge(iatom, 1) + gmcharge(jatom, 1))
574 DO is = 1, SIZE(ks_matrix, 1)
575 NULLIFY (ksblock)
576 CALL dbcsr_get_block_p(matrix=ks_matrix(is, ic)%matrix, &
577 row=irow, col=icol, block=ksblock, found=found)
578 cpassert(found)
579 ksblock = ksblock - gcij*sblock
580 ksblock = ksblock - gmij*sblock
581 END DO
582
583 IF (calculate_forces) THEN
584 atom_i = atom_of_kind(iatom)
585 atom_j = atom_of_kind(jatom)
586 IF (irow /= iatom) THEN
587 gmij = -gmij
588 gcij = -gcij
589 END IF
590 NULLIFY (pblock)
591 CALL dbcsr_get_block_p(matrix=matrix_p(1, ic)%matrix, &
592 row=irow, col=icol, block=pblock, found=found)
593 cpassert(found)
594 DO i = 1, 3
595 NULLIFY (dsblock)
596 CALL dbcsr_get_block_p(matrix=matrix_s(1 + i, ic)%matrix, &
597 row=irow, col=icol, block=dsblock, found=found)
598 cpassert(found)
599 fij(i) = 0.0_dp
600 ! short range
601 fi = -2.0_dp*sum(pblock*dsblock*gcij)
602 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
603 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
604 fij(i) = fij(i) + fi
605 ! long range
606 fi = -2.0_dp*gmij*sum(pblock*dsblock)
607 force(ikind)%rho_elec(i, atom_i) = force(ikind)%rho_elec(i, atom_i) + fi
608 force(jkind)%rho_elec(i, atom_j) = force(jkind)%rho_elec(i, atom_j) - fi
609 fij(i) = fij(i) + fi
610 END DO
611 IF (use_virial) THEN
612 dr = sqrt(sum(rij(:)**2))
613 IF (dr > 1.e-6_dp) THEN
614 fi = 1.0_dp
615 IF (iatom == jatom) fi = 0.5_dp
616 CALL virial_pair_force(virial%pv_virial, fi, fij, rij)
617 END IF
618 END IF
619 END IF
620 DEALLOCATE (gcij)
621
622 END DO
623 CALL neighbor_list_iterator_release(nl_iterator)
624 END IF
625
626 IF (calculate_forces .AND. SIZE(matrix_p, 1) == 2) THEN
627 DO img = 1, nimg
628 CALL dbcsr_add(matrix_p(1, img)%matrix, matrix_p(2, img)%matrix, &
629 alpha_scalar=1.0_dp, beta_scalar=-1.0_dp)
630 END DO
631 END IF
632 END IF
633
634 IF (xtb_control%tb3_interaction) THEN
635 CALL get_qs_env(qs_env, nkind=nkind)
636 ALLOCATE (zeffk(nkind), xgamma(nkind))
637 DO ikind = 1, nkind
638 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
639 CALL get_xtb_atom_param(xtb_kind, xgamma=xgamma(ikind), zeff=zeffk(ikind))
640 END DO
641 ! Diagonal 3rd order correction (DFTB3)
642 CALL build_dftb3_diagonal(qs_env, ks_matrix, rho, mcharge, energy, xgamma, zeffk, &
643 sap_int, calculate_forces, just_energy)
644 DEALLOCATE (zeffk, xgamma)
645 END IF
646
647 ! QMMM
648 IF (qs_env%qmmm .AND. qs_env%qmmm_periodic) THEN
649 CALL build_tb_coulomb_qmqm(qs_env, ks_matrix, rho, mcharge, energy, &
650 calculate_forces, just_energy)
651 END IF
652
653 IF (do_gamma_stress) THEN
654 CALL release_sap_int(sap_int)
655 END IF
656
657 CALL timestop(handle)
658
659 END SUBROUTINE build_xtb_coulomb
660
661! **************************************************************************************************
662!> \brief Computes the short-range gamma parameter from
663!> Nataga-Mishimoto-Ohno-Klopman formula for xTB
664!> WARNING: The xTB function (gamma - 1/r) has still an l-dependent longrange (1/r^3)
665!> behaviour. We use a cutoff function to smoothly remove this part.
666!> However, this will change energies and effect final results.
667!>
668!> \param gmat ...
669!> \param rab ...
670!> \param nla ...
671!> \param kappaa ...
672!> \param etaa ...
673!> \param nlb ...
674!> \param kappab ...
675!> \param etab ...
676!> \param kg ...
677!> \param rcut ...
678!> \par History
679!> 10.2018 JGH
680!> \version 1.1
681! **************************************************************************************************
682 SUBROUTINE gamma_rab_sr(gmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
683 REAL(dp), DIMENSION(:, :), INTENT(INOUT) :: gmat
684 REAL(dp), INTENT(IN) :: rab
685 INTEGER, INTENT(IN) :: nla
686 REAL(dp), DIMENSION(:), INTENT(IN) :: kappaa
687 REAL(dp), INTENT(IN) :: etaa
688 INTEGER, INTENT(IN) :: nlb
689 REAL(dp), DIMENSION(:), INTENT(IN) :: kappab
690 REAL(dp), INTENT(IN) :: etab, kg, rcut
691
692 REAL(kind=dp), PARAMETER :: rsmooth = 1.0_dp
693
694 INTEGER :: i, j
695 REAL(kind=dp) :: fcut, r, rk, x
696 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: eta
697
698 ALLOCATE (eta(nla, nlb))
699 eta = 0.0_dp
700
701 DO j = 1, nlb
702 DO i = 1, nla
703 eta(i, j) = 1._dp/(etaa*(1._dp + kappaa(i))) + 1._dp/(etab*(1._dp + kappab(j)))
704 eta(i, j) = 2._dp/eta(i, j)
705 END DO
706 END DO
707
708 gmat = 0.0_dp
709 IF (rab < 1.e-6_dp) THEN
710 ! on site terms
711 gmat(:, :) = eta(:, :)
712 ELSEIF (rab > rcut) THEN
713 ! do nothing
714 ELSE
715 rk = rab**kg
716 eta = eta**(-kg)
717 IF (rab < rcut - rsmooth) THEN
718 fcut = 1.0_dp
719 ELSE
720 r = rab - (rcut - rsmooth)
721 x = r/rsmooth
722 fcut = -6._dp*x**5 + 15._dp*x**4 - 10._dp*x**3 + 1._dp
723 END IF
724 gmat(:, :) = fcut*(1._dp/(rk + eta(:, :)))**(1._dp/kg) - fcut/rab
725 END IF
726
727 DEALLOCATE (eta)
728
729 END SUBROUTINE gamma_rab_sr
730
731! **************************************************************************************************
732!> \brief Computes the derivative of the short-range gamma parameter from
733!> Nataga-Mishimoto-Ohno-Klopman formula for xTB
734!> WARNING: The xTB function (gamma - 1/r) has still an l-dependent longrange (1/r^3)
735!> behaviour. We use a cutoff function to smoothly remove this part.
736!> However, this will change energies and effect final results.
737!>
738!> \param dgmat ...
739!> \param rab ...
740!> \param nla ...
741!> \param kappaa ...
742!> \param etaa ...
743!> \param nlb ...
744!> \param kappab ...
745!> \param etab ...
746!> \param kg ...
747!> \param rcut ...
748!> \par History
749!> 10.2018 JGH
750!> \version 1.1
751! **************************************************************************************************
752 SUBROUTINE dgamma_rab_sr(dgmat, rab, nla, kappaa, etaa, nlb, kappab, etab, kg, rcut)
753 REAL(dp), DIMENSION(:, :), INTENT(INOUT) :: dgmat
754 REAL(dp), INTENT(IN) :: rab
755 INTEGER, INTENT(IN) :: nla
756 REAL(dp), DIMENSION(:), INTENT(IN) :: kappaa
757 REAL(dp), INTENT(IN) :: etaa
758 INTEGER, INTENT(IN) :: nlb
759 REAL(dp), DIMENSION(:), INTENT(IN) :: kappab
760 REAL(dp), INTENT(IN) :: etab, kg, rcut
761
762 REAL(kind=dp), PARAMETER :: rsmooth = 1.0_dp
763
764 INTEGER :: i, j
765 REAL(kind=dp) :: dfcut, fcut, r, rk, x
766 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: eta
767
768 ALLOCATE (eta(nla, nlb))
769
770 DO j = 1, nlb
771 DO i = 1, nla
772 eta(i, j) = 1._dp/(etaa*(1._dp + kappaa(i))) + 1._dp/(etab*(1._dp + kappab(j)))
773 eta(i, j) = 2._dp/eta(i, j)
774 END DO
775 END DO
776
777 IF (rab < 1.e-6) THEN
778 ! on site terms
779 dgmat(:, :) = 0.0_dp
780 ELSEIF (rab > rcut) THEN
781 dgmat(:, :) = 0.0_dp
782 ELSE
783 eta = eta**(-kg)
784 rk = rab**kg
785 IF (rab < rcut - rsmooth) THEN
786 fcut = 1.0_dp
787 dfcut = 0.0_dp
788 ELSE
789 r = rab - (rcut - rsmooth)
790 x = r/rsmooth
791 fcut = -6._dp*x**5 + 15._dp*x**4 - 10._dp*x**3 + 1._dp
792 dfcut = -30._dp*x**4 + 60._dp*x**3 - 30._dp*x**2
793 dfcut = dfcut/rsmooth
794 END IF
795 dgmat(:, :) = dfcut*(1._dp/(rk + eta(:, :)))**(1._dp/kg)
796 dgmat(:, :) = dgmat(:, :) - dfcut/rab + fcut/rab**2
797 dgmat(:, :) = dgmat(:, :) - fcut/(rk + eta(:, :))*(1._dp/(rk + eta(:, :)))**(1._dp/kg)*rk/rab
798 END IF
799
800 DEALLOCATE (eta)
801
802 END SUBROUTINE dgamma_rab_sr
803
804! **************************************************************************************************
805!> \brief ...
806!> \param qs_env ...
807!> \param sap_int ...
808! **************************************************************************************************
809 SUBROUTINE xtb_dsint_list(qs_env, sap_int)
810
811 TYPE(qs_environment_type), POINTER :: qs_env
812 TYPE(sap_int_type), DIMENSION(:), POINTER :: sap_int
813
814 CHARACTER(LEN=*), PARAMETER :: routinen = 'xtb_dsint_list'
815
816 INTEGER :: handle, i, iac, iatom, ikind, ilist, iset, jatom, jkind, jneighbor, jset, ldsab, &
817 n1, n2, natorb_a, natorb_b, ncoa, ncob, nkind, nlist, nneighbor, nseta, nsetb, sgfa, sgfb
818 INTEGER, DIMENSION(3) :: cell
819 INTEGER, DIMENSION(:), POINTER :: la_max, la_min, lb_max, lb_min, npgfa, &
820 npgfb, nsgfa, nsgfb
821 INTEGER, DIMENSION(:, :), POINTER :: first_sgfa, first_sgfb
822 LOGICAL :: defined
823 REAL(kind=dp) :: dr
824 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: owork
825 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :, :) :: oint, sint
826 REAL(kind=dp), DIMENSION(3) :: rij
827 REAL(kind=dp), DIMENSION(:), POINTER :: set_radius_a, set_radius_b
828 REAL(kind=dp), DIMENSION(:, :), POINTER :: rpgfa, rpgfb, scon_a, scon_b, zeta, zetb
829 TYPE(clist_type), POINTER :: clist
830 TYPE(dft_control_type), POINTER :: dft_control
831 TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: basis_set_list
832 TYPE(gto_basis_set_type), POINTER :: basis_set_a, basis_set_b
834 DIMENSION(:), POINTER :: nl_iterator
835 TYPE(neighbor_list_set_p_type), DIMENSION(:), &
836 POINTER :: sab_orb
837 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
838 TYPE(xtb_atom_type), POINTER :: xtb_atom_a, xtb_atom_b
839
840 CALL timeset(routinen, handle)
841
842 CALL get_qs_env(qs_env=qs_env, nkind=nkind)
843 cpassert(.NOT. ASSOCIATED(sap_int))
844 ALLOCATE (sap_int(nkind*nkind))
845 DO i = 1, nkind*nkind
846 NULLIFY (sap_int(i)%alist, sap_int(i)%asort, sap_int(i)%aindex)
847 sap_int(i)%nalist = 0
848 END DO
849
850 CALL get_qs_env(qs_env=qs_env, &
851 qs_kind_set=qs_kind_set, &
852 dft_control=dft_control, &
853 sab_orb=sab_orb)
854
855 ! set up basis set lists
856 ALLOCATE (basis_set_list(nkind))
857 CALL basis_set_list_setup(basis_set_list, "ORB", qs_kind_set)
858
859 ! loop over all atom pairs with a non-zero overlap (sab_orb)
860 CALL neighbor_list_iterator_create(nl_iterator, sab_orb)
861 DO WHILE (neighbor_list_iterate(nl_iterator) == 0)
862 CALL get_iterator_info(nl_iterator, ikind=ikind, jkind=jkind, iatom=iatom, &
863 jatom=jatom, nlist=nlist, ilist=ilist, nnode=nneighbor, &
864 inode=jneighbor, cell=cell, r=rij)
865 iac = ikind + nkind*(jkind - 1)
866 !
867 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_atom_a)
868 CALL get_xtb_atom_param(xtb_atom_a, defined=defined, natorb=natorb_a)
869 IF (.NOT. defined .OR. natorb_a < 1) cycle
870 CALL get_qs_kind(qs_kind_set(jkind), xtb_parameter=xtb_atom_b)
871 CALL get_xtb_atom_param(xtb_atom_b, defined=defined, natorb=natorb_b)
872 IF (.NOT. defined .OR. natorb_b < 1) cycle
873
874 dr = sqrt(sum(rij(:)**2))
875
876 ! integral list
877 IF (.NOT. ASSOCIATED(sap_int(iac)%alist)) THEN
878 sap_int(iac)%a_kind = ikind
879 sap_int(iac)%p_kind = jkind
880 sap_int(iac)%nalist = nlist
881 ALLOCATE (sap_int(iac)%alist(nlist))
882 DO i = 1, nlist
883 NULLIFY (sap_int(iac)%alist(i)%clist)
884 sap_int(iac)%alist(i)%aatom = 0
885 sap_int(iac)%alist(i)%nclist = 0
886 END DO
887 END IF
888 IF (.NOT. ASSOCIATED(sap_int(iac)%alist(ilist)%clist)) THEN
889 sap_int(iac)%alist(ilist)%aatom = iatom
890 sap_int(iac)%alist(ilist)%nclist = nneighbor
891 ALLOCATE (sap_int(iac)%alist(ilist)%clist(nneighbor))
892 DO i = 1, nneighbor
893 sap_int(iac)%alist(ilist)%clist(i)%catom = 0
894 END DO
895 END IF
896 clist => sap_int(iac)%alist(ilist)%clist(jneighbor)
897 clist%catom = jatom
898 clist%cell = cell
899 clist%rac = rij
900 ALLOCATE (clist%acint(natorb_a, natorb_b, 3))
901 NULLIFY (clist%achint)
902 clist%acint = 0._dp
903 clist%nsgf_cnt = 0
904 NULLIFY (clist%sgf_list)
905
906 ! overlap
907 basis_set_a => basis_set_list(ikind)%gto_basis_set
908 IF (.NOT. ASSOCIATED(basis_set_a)) cycle
909 basis_set_b => basis_set_list(jkind)%gto_basis_set
910 IF (.NOT. ASSOCIATED(basis_set_b)) cycle
911 ! basis ikind
912 first_sgfa => basis_set_a%first_sgf
913 la_max => basis_set_a%lmax
914 la_min => basis_set_a%lmin
915 npgfa => basis_set_a%npgf
916 nseta = basis_set_a%nset
917 nsgfa => basis_set_a%nsgf_set
918 rpgfa => basis_set_a%pgf_radius
919 set_radius_a => basis_set_a%set_radius
920 scon_a => basis_set_a%scon
921 zeta => basis_set_a%zet
922 ! basis jkind
923 first_sgfb => basis_set_b%first_sgf
924 lb_max => basis_set_b%lmax
925 lb_min => basis_set_b%lmin
926 npgfb => basis_set_b%npgf
927 nsetb = basis_set_b%nset
928 nsgfb => basis_set_b%nsgf_set
929 rpgfb => basis_set_b%pgf_radius
930 set_radius_b => basis_set_b%set_radius
931 scon_b => basis_set_b%scon
932 zetb => basis_set_b%zet
933
934 ldsab = get_memory_usage(qs_kind_set, "ORB", "ORB")
935 ALLOCATE (oint(ldsab, ldsab, 4), owork(ldsab, ldsab))
936 ALLOCATE (sint(natorb_a, natorb_b, 4))
937 sint = 0.0_dp
938
939 DO iset = 1, nseta
940 ncoa = npgfa(iset)*ncoset(la_max(iset))
941 n1 = npgfa(iset)*(ncoset(la_max(iset)) - ncoset(la_min(iset) - 1))
942 sgfa = first_sgfa(1, iset)
943 DO jset = 1, nsetb
944 IF (set_radius_a(iset) + set_radius_b(jset) < dr) cycle
945 ncob = npgfb(jset)*ncoset(lb_max(jset))
946 n2 = npgfb(jset)*(ncoset(lb_max(jset)) - ncoset(lb_min(jset) - 1))
947 sgfb = first_sgfb(1, jset)
948 CALL overlap_ab(la_max(iset), la_min(iset), npgfa(iset), rpgfa(:, iset), zeta(:, iset), &
949 lb_max(jset), lb_min(jset), npgfb(jset), rpgfb(:, jset), zetb(:, jset), &
950 rij, sab=oint(:, :, 1), dab=oint(:, :, 2:4))
951 ! Contraction
952 DO i = 1, 4
953 CALL contraction(oint(:, :, i), owork, ca=scon_a(:, sgfa:), na=n1, ma=nsgfa(iset), &
954 cb=scon_b(:, sgfb:), nb=n2, mb=nsgfb(jset), fscale=1.0_dp, trans=.false.)
955 CALL block_add("IN", owork, nsgfa(iset), nsgfb(jset), sint(:, :, i), &
956 sgfa, sgfb, trans=.false.)
957 END DO
958 END DO
959 END DO
960 ! update dS/dR matrix
961 clist%acint(1:natorb_a, 1:natorb_b, 1:3) = sint(1:natorb_a, 1:natorb_b, 2:4)
962
963 DEALLOCATE (oint, owork, sint)
964
965 END DO
966 CALL neighbor_list_iterator_release(nl_iterator)
967
968 DEALLOCATE (basis_set_list)
969
970 CALL timestop(handle)
971
972 END SUBROUTINE xtb_dsint_list
973
974END 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:210
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
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_next_block(iterator, row, column, block, block_number_argument_has_been_removed, row_size, col_size, row_offset, col_offset, transposed)
...
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.