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