(git:98357aa)
Loading...
Searching...
No Matches
xtb_ks_matrix.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 KS matrix in xTB
10!> Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov
11!> JCTC 13, 1989-2009, (2017)
12!> DOI: 10.1021/acs.jctc.7b00118
13!> \author JGH
14! **************************************************************************************************
19 USE cp_dbcsr_api, ONLY: dbcsr_add,&
33 USE kinds, ONLY: dp
35 USE mulliken, ONLY: ao_charges
41 USE qs_kind_types, ONLY: get_qs_kind,&
45 USE qs_mo_types, ONLY: get_mo_set,&
47 USE qs_rho_types, ONLY: qs_rho_get,&
51 USE xtb_types, ONLY: get_xtb_atom_param,&
53#include "./base/base_uses.f90"
54
55 IMPLICIT NONE
56
57 PRIVATE
58
59 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xtb_ks_matrix'
60
61 PUBLIC :: build_xtb_ks_matrix
62
63CONTAINS
64
65! **************************************************************************************************
66!> \brief ...
67!> \param qs_env ...
68!> \param calculate_forces ...
69!> \param just_energy ...
70!> \param ext_ks_matrix ...
71! **************************************************************************************************
72 SUBROUTINE build_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
73 TYPE(qs_environment_type), POINTER :: qs_env
74 LOGICAL, INTENT(in) :: calculate_forces, just_energy
75 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
76 POINTER :: ext_ks_matrix
77
78 INTEGER :: gfn_type
79 TYPE(dft_control_type), POINTER :: dft_control
80
81 CALL get_qs_env(qs_env=qs_env, dft_control=dft_control)
82 gfn_type = dft_control%qs_control%xtb_control%gfn_type
83
84 SELECT CASE (gfn_type)
85 CASE (0)
86 cpassert(.NOT. PRESENT(ext_ks_matrix))
87 CALL build_gfn0_xtb_ks_matrix(qs_env, calculate_forces, just_energy)
88 CASE (1)
89 CALL build_gfn1_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
90 CASE (2)
91 cpabort("gfn_type = 2 not yet available")
92 CASE DEFAULT
93 cpabort("Unknown gfn_type")
94 END SELECT
95
96 END SUBROUTINE build_xtb_ks_matrix
97
98! **************************************************************************************************
99!> \brief ...
100!> \param qs_env ...
101!> \param calculate_forces ...
102!> \param just_energy ...
103! **************************************************************************************************
104 SUBROUTINE build_gfn0_xtb_ks_matrix(qs_env, calculate_forces, just_energy)
105 TYPE(qs_environment_type), POINTER :: qs_env
106 LOGICAL, INTENT(in) :: calculate_forces, just_energy
107
108 CHARACTER(len=*), PARAMETER :: routinen = 'build_gfn0_xtb_ks_matrix'
109
110 INTEGER :: handle, img, iounit, ispin, natom, nimg, &
111 nspins
112 REAL(kind=dp) :: pc_ener, qmmm_el
113 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
114 TYPE(cp_logger_type), POINTER :: logger
115 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_p1, mo_derivs
116 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: ks_matrix, matrix_h
117 TYPE(dbcsr_type), POINTER :: mo_coeff
118 TYPE(dft_control_type), POINTER :: dft_control
119 TYPE(mp_para_env_type), POINTER :: para_env
120 TYPE(qs_energy_type), POINTER :: energy
121 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
122 TYPE(qs_ks_env_type), POINTER :: ks_env
123 TYPE(qs_rho_type), POINTER :: rho
124 TYPE(section_vals_type), POINTER :: scf_section
125
126 CALL timeset(routinen, handle)
127
128 mark_used(calculate_forces)
129
130 NULLIFY (dft_control, logger, scf_section, ks_env, ks_matrix, rho, &
131 energy)
132 cpassert(ASSOCIATED(qs_env))
133
134 logger => cp_get_default_logger()
135 iounit = cp_logger_get_default_io_unit(logger)
136
137 CALL get_qs_env(qs_env, &
138 dft_control=dft_control, &
139 atomic_kind_set=atomic_kind_set, &
140 qs_kind_set=qs_kind_set, &
141 matrix_h_kp=matrix_h, &
142 para_env=para_env, &
143 ks_env=ks_env, &
144 matrix_ks_kp=ks_matrix, &
145 energy=energy)
146
147 energy%hartree = 0.0_dp
148 energy%qmmm_el = 0.0_dp
149
150 scf_section => section_vals_get_subs_vals(qs_env%input, "DFT%SCF")
151 nspins = dft_control%nspins
152 nimg = dft_control%nimages
153 cpassert(ASSOCIATED(matrix_h))
154 cpassert(SIZE(ks_matrix) > 0)
155
156 DO ispin = 1, nspins
157 DO img = 1, nimg
158 ! copy the core matrix into the fock matrix
159 CALL dbcsr_copy(ks_matrix(ispin, img)%matrix, matrix_h(1, img)%matrix)
160 END DO
161 END DO
162
163 IF (qs_env%qmmm) THEN
164 cpabort("gfn0 QMMM NYA")
165 CALL get_qs_env(qs_env=qs_env, rho=rho, natom=natom)
166 cpassert(SIZE(ks_matrix, 2) == 1)
167 DO ispin = 1, nspins
168 ! If QM/MM sumup the 1el Hamiltonian
169 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
170 1.0_dp, 1.0_dp)
171 CALL qs_rho_get(rho, rho_ao=matrix_p1)
172 ! Compute QM/MM Energy
173 CALL dbcsr_dot(qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
174 matrix_p1(ispin)%matrix, qmmm_el)
175 energy%qmmm_el = energy%qmmm_el + qmmm_el
176 END DO
177 pc_ener = qs_env%ks_qmmm_env%pc_ener
178 energy%qmmm_el = energy%qmmm_el + pc_ener
179 END IF
180
181 energy%total = energy%core + energy%eeq + energy%efield + energy%qmmm_el + &
182 energy%repulsive + energy%dispersion + energy%kTS
183
184 iounit = cp_print_key_unit_nr(logger, scf_section, "PRINT%DETAILED_ENERGY", &
185 extension=".scfLog")
186 IF (iounit > 0) THEN
187 WRITE (unit=iounit, fmt="(/,(T9,A,T60,F20.10))") &
188 "Repulsive pair potential energy: ", energy%repulsive, &
189 "SRB Correction energy: ", energy%srb, &
190 "Zeroth order Hamiltonian energy: ", energy%core, &
191 "Charge equilibration energy: ", energy%eeq, &
192 "London dispersion energy: ", energy%dispersion
193 IF (dft_control%qs_control%xtb_control%do_nonbonded) THEN
194 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
195 "Correction for nonbonded interactions: ", energy%xtb_nonbonded
196 END IF
197 IF (abs(energy%efield) > 1.e-12_dp) THEN
198 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
199 "Electric field interaction energy: ", energy%efield
200 END IF
201 IF (qs_env%qmmm) THEN
202 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
203 "QM/MM Electrostatic energy: ", energy%qmmm_el
204 END IF
205 END IF
206 CALL cp_print_key_finished_output(iounit, logger, scf_section, &
207 "PRINT%DETAILED_ENERGY")
208 ! here we compute dE/dC if needed. Assumes dE/dC is H_{ks}C
209 IF (qs_env%requires_mo_derivs .AND. .NOT. just_energy) THEN
210 cpassert(SIZE(ks_matrix, 2) == 1)
211 block
212 TYPE(mo_set_type), DIMENSION(:), POINTER :: mo_array
213 CALL get_qs_env(qs_env, mo_derivs=mo_derivs, mos=mo_array)
214 DO ispin = 1, SIZE(mo_derivs)
215 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff_b=mo_coeff)
216 cpassert(mo_array(ispin)%use_mo_coeff_b)
217 CALL dbcsr_multiply('n', 'n', 1.0_dp, ks_matrix(ispin, 1)%matrix, mo_coeff, &
218 0.0_dp, mo_derivs(ispin)%matrix)
219 END DO
220 END block
221 END IF
222
223 CALL timestop(handle)
224
225 END SUBROUTINE build_gfn0_xtb_ks_matrix
226
227! **************************************************************************************************
228!> \brief ...
229!> \param qs_env ...
230!> \param calculate_forces ...
231!> \param just_energy ...
232!> \param ext_ks_matrix ...
233! **************************************************************************************************
234 SUBROUTINE build_gfn1_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
235 TYPE(qs_environment_type), POINTER :: qs_env
236 LOGICAL, INTENT(in) :: calculate_forces, just_energy
237 TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
238 POINTER :: ext_ks_matrix
239
240 CHARACTER(len=*), PARAMETER :: routinen = 'build_gfn1_xtb_ks_matrix'
241
242 INTEGER :: atom_a, handle, iatom, ikind, img, &
243 iounit, is, ispin, na, natom, natorb, &
244 nimg, nkind, ns, nsgf, nspins
245 INTEGER, DIMENSION(25) :: lao
246 INTEGER, DIMENSION(5) :: occ
247 LOGICAL :: do_efield, pass_check
248 REAL(kind=dp) :: achrg, chmax, pc_ener, qmmm_el
249 REAL(kind=dp), ALLOCATABLE, DIMENSION(:) :: mcharge
250 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: aocg, charges
251 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
252 TYPE(cp_logger_type), POINTER :: logger
253 TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: matrix_p1, mo_derivs, p_matrix
254 TYPE(dbcsr_p_type), DIMENSION(:, :), POINTER :: ks_matrix, matrix_h, matrix_p, matrix_s
255 TYPE(dbcsr_type), POINTER :: mo_coeff, s_matrix
256 TYPE(dft_control_type), POINTER :: dft_control
257 TYPE(mp_para_env_type), POINTER :: para_env
258 TYPE(particle_type), DIMENSION(:), POINTER :: particle_set
259 TYPE(qs_energy_type), POINTER :: energy
260 TYPE(qs_kind_type), DIMENSION(:), POINTER :: qs_kind_set
261 TYPE(qs_ks_env_type), POINTER :: ks_env
262 TYPE(qs_rho_type), POINTER :: rho
263 TYPE(qs_scf_env_type), POINTER :: scf_env
264 TYPE(section_vals_type), POINTER :: scf_section
265 TYPE(xtb_atom_type), POINTER :: xtb_kind
266
267 CALL timeset(routinen, handle)
268
269 NULLIFY (dft_control, logger, scf_section, matrix_p, particle_set, ks_env, &
270 ks_matrix, rho, energy)
271 cpassert(ASSOCIATED(qs_env))
272
273 logger => cp_get_default_logger()
274 iounit = cp_logger_get_default_io_unit(logger)
275
276 CALL get_qs_env(qs_env, &
277 dft_control=dft_control, &
278 atomic_kind_set=atomic_kind_set, &
279 qs_kind_set=qs_kind_set, &
280 matrix_h_kp=matrix_h, &
281 para_env=para_env, &
282 ks_env=ks_env, &
283 matrix_ks_kp=ks_matrix, &
284 rho=rho, &
285 energy=energy)
286
287 IF (PRESENT(ext_ks_matrix)) THEN
288 ! remap pointer to allow for non-kpoint external ks matrix
289 ! ext_ks_matrix is used in linear response code
290 ns = SIZE(ext_ks_matrix)
291 ks_matrix(1:ns, 1:1) => ext_ks_matrix(1:ns)
292 END IF
293
294 energy%hartree = 0.0_dp
295 energy%qmmm_el = 0.0_dp
296 energy%efield = 0.0_dp
297
298 scf_section => section_vals_get_subs_vals(qs_env%input, "DFT%SCF")
299 nspins = dft_control%nspins
300 nimg = dft_control%nimages
301 cpassert(ASSOCIATED(matrix_h))
302 cpassert(ASSOCIATED(rho))
303 cpassert(SIZE(ks_matrix) > 0)
304
305 DO ispin = 1, nspins
306 DO img = 1, nimg
307 ! copy the core matrix into the fock matrix
308 CALL dbcsr_copy(ks_matrix(ispin, img)%matrix, matrix_h(1, img)%matrix)
309 END DO
310 END DO
311
312 IF (dft_control%apply_period_efield .OR. dft_control%apply_efield .OR. &
313 dft_control%apply_efield_field) THEN
314 do_efield = .true.
315 ELSE
316 do_efield = .false.
317 END IF
318
319 IF (dft_control%qs_control%xtb_control%coulomb_interaction .OR. do_efield) THEN
320 ! Mulliken charges
321 CALL get_qs_env(qs_env=qs_env, particle_set=particle_set, matrix_s_kp=matrix_s)
322 CALL qs_rho_get(rho, rho_ao_kp=matrix_p)
323 natom = SIZE(particle_set)
324 ALLOCATE (mcharge(natom), charges(natom, 5))
325 charges = 0.0_dp
326 nkind = SIZE(atomic_kind_set)
327 CALL get_qs_kind_set(qs_kind_set, maxsgf=nsgf)
328 ALLOCATE (aocg(nsgf, natom))
329 aocg = 0.0_dp
330 IF (nimg > 1) THEN
331 CALL ao_charges(matrix_p, matrix_s, aocg, para_env)
332 ELSE
333 p_matrix => matrix_p(:, 1)
334 s_matrix => matrix_s(1, 1)%matrix
335 CALL ao_charges(p_matrix, s_matrix, aocg, para_env)
336 END IF
337 DO ikind = 1, nkind
338 CALL get_atomic_kind(atomic_kind_set(ikind), natom=na)
339 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
340 CALL get_xtb_atom_param(xtb_kind, natorb=natorb, lao=lao, occupation=occ)
341 DO iatom = 1, na
342 atom_a = atomic_kind_set(ikind)%atom_list(iatom)
343 charges(atom_a, :) = real(occ(:), kind=dp)
344 DO is = 1, natorb
345 ns = lao(is) + 1
346 charges(atom_a, ns) = charges(atom_a, ns) - aocg(is, atom_a)
347 END DO
348 END DO
349 END DO
350 DEALLOCATE (aocg)
351 ! charge mixing
352 IF (dft_control%qs_control%do_ls_scf) THEN
353 !
354 ELSE
355 CALL get_qs_env(qs_env=qs_env, scf_env=scf_env)
356 CALL charge_mixing(scf_env%mixing_method, scf_env%mixing_store, &
357 charges, para_env, scf_env%iter_count, &
358 scc_mixer=dft_control%qs_control%xtb_control%tblite_scc_mixer, &
359 tblite_mixer_iterations= &
360 dft_control%qs_control%xtb_control%tblite_mixer_iterations, &
361 tblite_mixer_damping=dft_control%qs_control%xtb_control%tblite_mixer_damping, &
362 tblite_mixer_memory=dft_control%qs_control%xtb_control%tblite_mixer_memory, &
363 tblite_mixer_omega0=dft_control%qs_control%xtb_control%tblite_mixer_omega0, &
364 tblite_mixer_min_weight= &
365 dft_control%qs_control%xtb_control%tblite_mixer_min_weight, &
366 tblite_mixer_max_weight= &
367 dft_control%qs_control%xtb_control%tblite_mixer_max_weight, &
368 tblite_mixer_weight_factor= &
369 dft_control%qs_control%xtb_control%tblite_mixer_weight_factor)
370 END IF
371
372 DO iatom = 1, natom
373 mcharge(iatom) = sum(charges(iatom, :))
374 END DO
375 END IF
376 IF (dft_control%qs_control%xtb_control%coulomb_interaction .AND. &
377 (.NOT. dft_control%qs_control%xtb_control%do_tblite)) THEN
378 CALL build_xtb_coulomb(qs_env, ks_matrix, rho, charges, mcharge, energy, &
379 calculate_forces, just_energy)
380 END IF
381
382 IF (do_efield) THEN
383 CALL efield_tb_matrix(qs_env, ks_matrix, rho, mcharge, energy, calculate_forces, just_energy)
384 END IF
385
386 IF (dft_control%qs_control%xtb_control%coulomb_interaction) THEN
387 IF (dft_control%qs_control%xtb_control%check_atomic_charges) THEN
388 pass_check = .true.
389 DO ikind = 1, nkind
390 CALL get_atomic_kind(atomic_kind_set(ikind), natom=na)
391 CALL get_qs_kind(qs_kind_set(ikind), xtb_parameter=xtb_kind)
392 CALL get_xtb_atom_param(xtb_kind, chmax=chmax)
393 DO iatom = 1, na
394 atom_a = atomic_kind_set(ikind)%atom_list(iatom)
395 achrg = mcharge(atom_a)
396 IF (abs(achrg) > chmax) THEN
397 IF (iounit > 0) THEN
398 WRITE (iounit, "(A,A,I3,I6,A,F4.2,A,F6.2)") " Charge outside chemical range:", &
399 " Kind Atom=", ikind, atom_a, " Limit=", chmax, " Charge=", achrg
400 END IF
401 pass_check = .false.
402 END IF
403 END DO
404 END DO
405 IF (.NOT. pass_check) THEN
406 CALL cp_warn(__location__, "Atomic charges outside chemical range were detected."// &
407 " Switch-off CHECK_ATOMIC_CHARGES keyword in the &xTB section"// &
408 " if you want to force to continue the calculation.")
409 cpabort("xTB Charges")
410 END IF
411 END IF
412 END IF
413
414 IF (dft_control%qs_control%xtb_control%coulomb_interaction .OR. do_efield) THEN
415 DEALLOCATE (mcharge, charges)
416 END IF
417
418 IF (qs_env%qmmm) THEN
419 cpassert(SIZE(ks_matrix, 2) == 1)
420 DO ispin = 1, nspins
421 ! If QM/MM sumup the 1el Hamiltonian
422 CALL dbcsr_add(ks_matrix(ispin, 1)%matrix, qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
423 1.0_dp, 1.0_dp)
424 CALL qs_rho_get(rho, rho_ao=matrix_p1)
425 ! Compute QM/MM Energy
426 CALL dbcsr_dot(qs_env%ks_qmmm_env%matrix_h(1)%matrix, &
427 matrix_p1(ispin)%matrix, qmmm_el)
428 energy%qmmm_el = energy%qmmm_el + qmmm_el
429 END DO
430 pc_ener = qs_env%ks_qmmm_env%pc_ener
431 energy%qmmm_el = energy%qmmm_el + pc_ener
432 END IF
433
434 energy%total = energy%core + energy%repulsive + &
435 energy%hartree + energy%xtb_spinpol + energy%efield + &
436 energy%qmmm_el + energy%dispersion + energy%dftb3 + energy%kTS
437
438 iounit = cp_print_key_unit_nr(logger, scf_section, "PRINT%DETAILED_ENERGY", &
439 extension=".scfLog")
440 IF (iounit > 0) THEN
441 WRITE (unit=iounit, fmt="(/,(T9,A,T60,F20.10))") &
442 "Repulsive pair potential energy: ", energy%repulsive, &
443 "Zeroth order Hamiltonian energy: ", energy%core, &
444 "Charge fluctuation energy: ", energy%hartree, &
445 "London dispersion energy: ", energy%dispersion
446 IF (dft_control%qs_control%xtb_control%do_spinpol) THEN
447 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
448 "Spin polarisation correction: ", energy%xtb_spinpol
449 END IF
450 IF (dft_control%qs_control%xtb_control%xb_interaction) THEN
451 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
452 "Correction for halogen bonding: ", energy%xtb_xb_inter
453 END IF
454 IF (dft_control%qs_control%xtb_control%do_nonbonded) THEN
455 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
456 "Correction for nonbonded interactions: ", energy%xtb_nonbonded
457 END IF
458 IF (abs(energy%efield) > 1.e-12_dp) THEN
459 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
460 "Electric field interaction energy: ", energy%efield
461 END IF
462 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
463 "DFTB3 3rd Order Energy Correction ", energy%dftb3
464 IF (qs_env%qmmm) THEN
465 WRITE (unit=iounit, fmt="(T9,A,T60,F20.10)") &
466 "QM/MM Electrostatic energy: ", energy%qmmm_el
467 END IF
468 END IF
469 CALL cp_print_key_finished_output(iounit, logger, scf_section, &
470 "PRINT%DETAILED_ENERGY")
471 ! here we compute dE/dC if needed. Assumes dE/dC is H_{ks}C
472 IF (qs_env%requires_mo_derivs .AND. .NOT. just_energy) THEN
473 cpassert(SIZE(ks_matrix, 2) == 1)
474 block
475 TYPE(mo_set_type), DIMENSION(:), POINTER :: mo_array
476 CALL get_qs_env(qs_env, mo_derivs=mo_derivs, mos=mo_array)
477 DO ispin = 1, SIZE(mo_derivs)
478 CALL get_mo_set(mo_set=mo_array(ispin), mo_coeff_b=mo_coeff)
479 cpassert(mo_array(ispin)%use_mo_coeff_b)
480 CALL dbcsr_multiply('n', 'n', 1.0_dp, ks_matrix(ispin, 1)%matrix, mo_coeff, &
481 0.0_dp, mo_derivs(ispin)%matrix)
482 END DO
483 END block
484 END IF
485
486 CALL timestop(handle)
487
488 END SUBROUTINE build_gfn1_xtb_ks_matrix
489
490END MODULE xtb_ks_matrix
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_copy(matrix_b, matrix_a, name, keep_sparsity, keep_imaginary)
...
subroutine, public dbcsr_multiply(transa, transb, alpha, matrix_a, matrix_b, beta, matrix_c, first_row, last_row, first_column, last_column, first_k, last_k, retain_sparsity, filter_eps, flop)
...
subroutine, public dbcsr_add(matrix_a, matrix_b, alpha_scalar, beta_scalar)
...
subroutine, public dbcsr_dot(matrix_a, matrix_b, trace)
Computes the dot product of two matrices, also known as the trace of their matrix product.
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
Calculation of electric field contributions in TB.
subroutine, public efield_tb_matrix(qs_env, ks_matrix, rho, mcharge, energy, calculate_forces, just_energy)
...
objects that represent the structure of input sections and the data contained in an input section
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Interface to the message passing library MPI.
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii} ]
Definition mulliken.F:13
Define the data structure for the particle information.
subroutine, public charge_mixing(mixing_method, mixing_store, charges, para_env, iter_count, scc_mixer, tblite_mixer_iterations, tblite_mixer_damping, tblite_mixer_memory, tblite_mixer_omega0, tblite_mixer_min_weight, tblite_mixer_max_weight, tblite_mixer_weight_factor)
Driver for TB SCC variable mixing, calls the requested method.
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.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, cneo_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, hund_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
Get attributes of an atomic kind set.
Definition and initialisation of the mo data type.
Definition qs_mo_types.F:22
subroutine, public get_mo_set(mo_set, maxocc, homo, lfomo, nao, nelectron, n_el_f, nmo, eigenvalues, occupation_numbers, mo_coeff, mo_coeff_b, uniform_occupation, kts, mu, flexible_electron_count)
Get the components of a MO set data structure.
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...
module that contains the definitions of the scf types
Calculation of Coulomb contributions in xTB.
Definition xtb_coulomb.F:12
subroutine, public build_xtb_coulomb(qs_env, ks_matrix, rho, charges, mcharge, energy, calculate_forces, just_energy)
...
Calculation of KS matrix in xTB Reference: Stefan Grimme, Christoph Bannwarth, Philip Shushkov JCTC 1...
subroutine, public build_xtb_ks_matrix(qs_env, calculate_forces, just_energy, ext_ks_matrix)
...
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 of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.
calculation environment to calculate the ks matrix, holds all the needed vars. assumes that the core ...
keeps the density in various representations, keeping track of which ones are valid.