90#include "./base/base_uses.f90"
98 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qs_force'
115 LOGICAL :: calc_force, consistent_energies, linres
117 qs_env%linres_run = linres
119 CALL qs_forces(qs_env)
122 consistent_energies=consistent_energies)
134 SUBROUTINE qs_forces(qs_env)
138 CHARACTER(len=*),
PARAMETER :: routinen =
'qs_forces'
140 INTEGER :: after, handle, i, iatom, ic, ikind, &
141 ispin, iw, natom, nkind, nspin, &
143 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of, natom_of_kind
144 LOGICAL :: do_admm, do_exx, do_gw, do_im_time, &
145 do_kpoints, has_unit_metric, &
146 omit_headers, perform_ec, reuse_hfx
147 REAL(
dp) :: dummy_real, dummy_real2(2)
151 TYPE(
dbcsr_p_type),
DIMENSION(:),
POINTER :: matrix_s, matrix_w, rho_ao
152 TYPE(
dbcsr_p_type),
DIMENSION(:, :),
POINTER :: matrix_w_kp
166 CALL timeset(routinen, handle)
174 CALL get_qs_env(qs_env, particle_set=particle_set)
175 natom =
SIZE(particle_set)
177 particle_set(iatom)%f = 0.0_dp
181 NULLIFY (atomic_kind_set)
182 CALL get_qs_env(qs_env, atomic_kind_set=atomic_kind_set)
184 atom_of_kind=atom_of_kind, &
187 NULLIFY (force, subsys, dft_control)
191 do_kpoints=do_kpoints, &
192 dft_control=dft_control)
193 IF (do_kpoints .AND. dft_control%dft_plus_u .AND. dft_control%plus_u_method_id ==
plus_u_lowdin)
THEN
194 IF (
ASSOCIATED(qs_env%mp2_env) .OR. qs_env%run_rtp .OR. &
195 (dft_control%smeagol_control%smeagol_enabled .AND. &
197 cpabort(
"Lowdin DFT+U forces with k-points require the ground-state DFT W matrix")
200 IF (.NOT.
ASSOCIATED(force))
THEN
202 nkind =
SIZE(atomic_kind_set)
205 DEALLOCATE (natom_of_kind)
211 IF (dft_control%qs_control%cdft)
THEN
212 dft_control%qs_control%cdft_control%save_pot = .true.
224 IF (qs_env%run_rtp)
THEN
225 NULLIFY (matrix_w, matrix_s, ks_env)
231 DO ispin = 1, dft_control%nspins
232 ALLOCATE (matrix_w(ispin)%matrix)
233 CALL dbcsr_copy(matrix_w(ispin)%matrix, matrix_s(1)%matrix, &
235 CALL dbcsr_set(matrix_w(ispin)%matrix, 0.0_dp)
241 IF (dft_control%rtp_control%velocity_gauge)
THEN
247 IF (dft_control%qs_control%mulliken_restraint)
THEN
248 NULLIFY (matrix_w, matrix_s, rho)
256 para_env, matrix_s(1)%matrix, rho_ao, w_matrix=matrix_w)
261 IF (dft_control%dft_plus_u .AND. .NOT. (do_kpoints .AND. dft_control%plus_u_method_id ==
plus_u_lowdin))
THEN
262 NULLIFY (matrix_w_kp)
263 CALL get_qs_env(qs_env, matrix_w_kp=matrix_w_kp)
264 CALL plus_u(qs_env=qs_env, matrix_w=matrix_w_kp)
268 CALL get_qs_env(qs_env, has_unit_metric=has_unit_metric)
269 IF (.NOT. has_unit_metric)
THEN
270 NULLIFY (matrix_w_kp)
271 CALL get_qs_env(qs_env, matrix_w_kp=matrix_w_kp)
272 nspin =
SIZE(matrix_w_kp, 1)
275 qs_env%input,
"DFT%PRINT%AO_MATRICES/W_MATRIX"),
cp_p_file))
THEN
279 CALL section_vals_val_get(qs_env%input,
"DFT%PRINT%AO_MATRICES%OMIT_HEADERS", l_val=omit_headers)
280 after = min(max(after, 1), 16)
281 DO ic = 1,
SIZE(matrix_w_kp, 2)
283 para_env, output_unit=iw, omit_headers=omit_headers)
286 "DFT%PRINT%AO_MATRICES/W_MATRIX")
293 IF (qs_env%energy_correction)
THEN
295 IF (.NOT. ec_env%do_skip) perform_ec = .true.
299 IF (dft_control%qs_control%semi_empirical)
THEN
301 calculate_forces=.true.)
303 ELSE IF (dft_control%qs_control%dftb)
THEN
305 calculate_forces=.true.)
307 calculate_forces=.true.)
308 ELSE IF (dft_control%qs_control%xtb)
THEN
309 IF (dft_control%qs_control%xtb_control%do_tblite)
THEN
311 IF (qs_env%run_rtp)
THEN
319 ELSE IF (perform_ec)
THEN
326 IF (qs_env%run_rtp)
THEN
327 IF (dft_control%apply_efield_field)
THEN
330 IF (dft_control%rtp_control%velocity_gauge)
THEN
341 IF (.NOT. dft_control%qs_control%gapw)
THEN
345 IF (dft_control%qs_control%rigpw)
THEN
346 CALL get_qs_env(qs_env=qs_env, lri_env=lri_env)
352 IF (
ASSOCIATED(qs_env%mp2_env))
THEN
357 energy%total = energy%total + energy%mp2
361 .AND. .NOT. qs_env%mp2_env%do_im_time)
THEN
371 do_gw = qs_env%mp2_env%ri_rpa%do_ri_g0w0
372 do_admm = qs_env%mp2_env%ri_rpa%do_admm
373 reuse_hfx = qs_env%mp2_env%ri_rpa%reuse_hfx
374 do_im_time = qs_env%mp2_env%do_im_time
379 unit_nr=output_unit, &
380 hfx_sections=hfx_sections, &
381 x_data=qs_env%mp2_env%ri_rpa%x_data, &
384 calc_forces=.true., &
385 reuse_hfx=reuse_hfx, &
386 do_im_time=do_im_time, &
387 e_ex_from_gw=dummy_real, &
388 e_admm_from_gw=dummy_real2, &
392 ELSE IF (perform_ec)
THEN
394 ELSE IF (qs_env%harris_method)
THEN
412 ikind = kind_of(iatom)
413 i = atom_of_kind(iatom)
419 force(ikind)%other(1:3, i) = -particle_set(iatom)%f(1:3) + force(ikind)%ch_pulay(1:3, i)
420 force(ikind)%total(1:3, i) = force(ikind)%total(1:3, i) + force(ikind)%other(1:3, i)
421 particle_set(iatom)%f = -force(ikind)%total(1:3, i)
424 NULLIFY (cell, virial, energy)
425 CALL get_qs_env(qs_env=qs_env, cell=cell, virial=virial, energy=energy)
426 IF (virial%pv_availability)
THEN
427 CALL para_env%sum(virial%pv_overlap)
428 CALL para_env%sum(virial%pv_ekinetic)
429 CALL para_env%sum(virial%pv_ppl)
430 CALL para_env%sum(virial%pv_ppnl)
431 CALL para_env%sum(virial%pv_ecore_overlap)
432 CALL para_env%sum(virial%pv_ehartree)
433 CALL para_env%sum(virial%pv_exc)
434 CALL para_env%sum(virial%pv_exx)
435 CALL para_env%sum(virial%pv_vdw)
436 CALL para_env%sum(virial%pv_mp2)
437 CALL para_env%sum(virial%pv_nlcc)
438 CALL para_env%sum(virial%pv_gapw)
439 CALL para_env%sum(virial%pv_lrigpw)
440 CALL para_env%sum(virial%pv_virial)
443 IF ((.NOT. virial%pv_numer) .AND. &
444 (.NOT. (dft_control%qs_control%dftb .OR. &
445 dft_control%qs_control%xtb .OR. &
446 dft_control%qs_control%semi_empirical)))
THEN
453 energy%hartree = ec_env%ehartree
454 energy%exc = ec_env%exc
455 IF (dft_control%do_admm)
THEN
456 energy%exc_aux_fit = ec_env%exc_aux_fit
460 virial%pv_ehartree(i, i) = virial%pv_ehartree(i, i) &
461 - 2.0_dp*(energy%hartree + energy%sccs_pol)
462 virial%pv_virial(i, i) = virial%pv_virial(i, i) - energy%exc &
463 - 2.0_dp*(energy%hartree + energy%sccs_pol)
464 virial%pv_exc(i, i) = virial%pv_exc(i, i) - energy%exc
465 IF (dft_control%do_admm)
THEN
466 virial%pv_exc(i, i) = virial%pv_exc(i, i) - energy%exc_aux_fit
467 virial%pv_virial(i, i) = virial%pv_virial(i, i) - energy%exc_aux_fit
474 IF ((.NOT. virial%pv_numer) .AND. count(cell%perd /= 0) == 2)
THEN
475 SELECT CASE (dft_control%qs_control%method_id)
483 IF (dft_control%qs_control%xtb .AND. dft_control%qs_control%xtb_control%do_tblite)
THEN
490 IF (dft_control%qs_control%semi_empirical)
THEN
491 CALL write_forces(force, atomic_kind_set, 2, output_unit=output_unit, &
492 print_section=print_section)
493 ELSE IF (dft_control%qs_control%dftb)
THEN
494 CALL write_forces(force, atomic_kind_set, 4, output_unit=output_unit, &
495 print_section=print_section)
496 ELSE IF (dft_control%qs_control%xtb)
THEN
497 CALL write_forces(force, atomic_kind_set, 4, output_unit=output_unit, &
498 print_section=print_section)
499 ELSE IF (dft_control%qs_control%gapw .OR. dft_control%qs_control%gapw_xc)
THEN
500 CALL write_forces(force, atomic_kind_set, 1, output_unit=output_unit, &
501 print_section=print_section)
503 CALL write_forces(force, atomic_kind_set, 0, output_unit=output_unit, &
504 print_section=print_section)
507 "DFT%PRINT%DERIVATIVES")
510 NULLIFY (ks_env, matrix_w_kp)
512 matrix_w_kp=matrix_w_kp, &
515 NULLIFY (matrix_w_kp)
516 CALL set_ks_env(ks_env, matrix_w_kp=matrix_w_kp)
518 DEALLOCATE (atom_of_kind, kind_of)
520 CALL timestop(handle)
522 END SUBROUTINE qs_forces
535 SUBROUTINE write_forces(qs_force, atomic_kind_set, ftype, output_unit, &
540 INTEGER,
INTENT(IN) :: ftype, output_unit
543 CHARACTER(LEN=13) :: fmtstr5
544 CHARACTER(LEN=15) :: fmtstr4
545 CHARACTER(LEN=20) :: fmtstr3
546 CHARACTER(LEN=35) :: fmtstr2
547 CHARACTER(LEN=48) :: fmtstr1
548 INTEGER :: i, iatom, ikind, my_ftype, natom, ndigits
549 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom_of_kind, kind_of
550 REAL(kind=
dp),
DIMENSION(3) :: grand_total
552 IF (output_unit > 0)
THEN
554 IF (.NOT.
ASSOCIATED(
qs_force))
THEN
555 CALL cp_abort(__location__, &
556 "The qs_force pointer is not associated "// &
557 "and cannot be printed")
561 kind_of=kind_of, natom=natom)
567 fmtstr1 =
"(/,/,T2,A,/,/,T3,A,T11,A,T23,A,T40,A1,2( X,A1))"
568 WRITE (unit=fmtstr1(41:42), fmt=
"(I2)") ndigits + 5
570 fmtstr2 =
"(/,(T2,I5,4X,I4,T18,A,T34,3F . ))"
571 WRITE (unit=fmtstr2(32:33), fmt=
"(I2)") ndigits
572 WRITE (unit=fmtstr2(29:30), fmt=
"(I2)") ndigits + 6
574 fmtstr3 =
"(/,T3,A,T34,3F . )"
575 WRITE (unit=fmtstr3(18:19), fmt=
"(I2)") ndigits
576 WRITE (unit=fmtstr3(15:16), fmt=
"(I2)") ndigits + 6
578 fmtstr4 =
"((T34,3F . ))"
579 WRITE (unit=fmtstr4(12:13), fmt=
"(I2)") ndigits
580 WRITE (unit=fmtstr4(9:10), fmt=
"(I2)") ndigits + 6
582 fmtstr5 =
"(/T2,A//T3,A)"
584 WRITE (unit=output_unit, fmt=fmtstr1) &
585 "FORCES [a.u.]",
"Atom",
"Kind",
"Component",
"X",
"Y",
"Z"
587 grand_total(:) = 0.0_dp
591 SELECT CASE (my_ftype)
594 ikind = kind_of(iatom)
595 i = atom_of_kind(iatom)
596 WRITE (unit=output_unit, fmt=fmtstr2) &
597 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
598 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
602 ikind = kind_of(iatom)
603 i = atom_of_kind(iatom)
604 WRITE (unit=output_unit, fmt=fmtstr2) &
605 iatom, ikind,
" overlap",
qs_force(ikind)%overlap(1:3, i), &
606 iatom, ikind,
" overlap_admm",
qs_force(ikind)%overlap_admm(1:3, i), &
607 iatom, ikind,
" kinetic",
qs_force(ikind)%kinetic(1:3, i), &
608 iatom, ikind,
" gth_ppl",
qs_force(ikind)%gth_ppl(1:3, i), &
609 iatom, ikind,
" gth_nlcc",
qs_force(ikind)%gth_nlcc(1:3, i), &
610 iatom, ikind,
" gth_ppnl",
qs_force(ikind)%gth_ppnl(1:3, i), &
611 iatom, ikind,
" core_overlap",
qs_force(ikind)%core_overlap(1:3, i), &
612 iatom, ikind,
" rho_core",
qs_force(ikind)%rho_core(1:3, i), &
613 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
614 iatom, ikind,
" rho_lri_elec",
qs_force(ikind)%rho_lri_elec(1:3, i), &
615 iatom, ikind,
" ch_pulay",
qs_force(ikind)%ch_pulay(1:3, i), &
616 iatom, ikind,
" dispersion",
qs_force(ikind)%dispersion(1:3, i), &
617 iatom, ikind,
" gCP",
qs_force(ikind)%gcp(1:3, i), &
618 iatom, ikind,
" other",
qs_force(ikind)%other(1:3, i), &
619 iatom, ikind,
" fock_4c",
qs_force(ikind)%fock_4c(1:3, i), &
620 iatom, ikind,
" ehrenfest",
qs_force(ikind)%ehrenfest(1:3, i), &
621 iatom, ikind,
" efield",
qs_force(ikind)%efield(1:3, i), &
622 iatom, ikind,
" eev",
qs_force(ikind)%eev(1:3, i), &
623 iatom, ikind,
" mp2_non_sep",
qs_force(ikind)%mp2_non_sep(1:3, i), &
624 iatom, ikind,
" tensorial_u",
qs_force(ikind)%tensorial_u(1:3, i), &
625 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
626 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
630 ikind = kind_of(iatom)
631 i = atom_of_kind(iatom)
632 WRITE (unit=output_unit, fmt=fmtstr2) &
633 iatom, ikind,
" overlap",
qs_force(ikind)%overlap(1:3, i), &
634 iatom, ikind,
" overlap_admm",
qs_force(ikind)%overlap_admm(1:3, i), &
635 iatom, ikind,
" kinetic",
qs_force(ikind)%kinetic(1:3, i), &
636 iatom, ikind,
" gth_ppl",
qs_force(ikind)%gth_ppl(1:3, i), &
637 iatom, ikind,
" gth_nlcc",
qs_force(ikind)%gth_nlcc(1:3, i), &
638 iatom, ikind,
" gth_ppnl",
qs_force(ikind)%gth_ppnl(1:3, i), &
639 iatom, ikind,
" all_potential",
qs_force(ikind)%all_potential(1:3, i), &
640 iatom, ikind,
"cneo_potential",
qs_force(ikind)%cneo_potential(1:3, i), &
641 iatom, ikind,
" core_overlap",
qs_force(ikind)%core_overlap(1:3, i), &
642 iatom, ikind,
" rho_core",
qs_force(ikind)%rho_core(1:3, i), &
643 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
644 iatom, ikind,
" rho_lri_elec",
qs_force(ikind)%rho_lri_elec(1:3, i), &
645 iatom, ikind,
" rho_cneo_nuc",
qs_force(ikind)%rho_cneo_nuc(1:3, i), &
646 iatom, ikind,
" vhxc_atom",
qs_force(ikind)%vhxc_atom(1:3, i), &
647 iatom, ikind,
" g0s_Vh_elec",
qs_force(ikind)%g0s_Vh_elec(1:3, i), &
648 iatom, ikind,
" ch_pulay",
qs_force(ikind)%ch_pulay(1:3, i), &
649 iatom, ikind,
" dispersion",
qs_force(ikind)%dispersion(1:3, i), &
650 iatom, ikind,
" gCP",
qs_force(ikind)%gcp(1:3, i), &
651 iatom, ikind,
" fock_4c",
qs_force(ikind)%fock_4c(1:3, i), &
652 iatom, ikind,
" ehrenfest",
qs_force(ikind)%ehrenfest(1:3, i), &
653 iatom, ikind,
" efield",
qs_force(ikind)%efield(1:3, i), &
654 iatom, ikind,
" eev",
qs_force(ikind)%eev(1:3, i), &
655 iatom, ikind,
" mp2_non_sep",
qs_force(ikind)%mp2_non_sep(1:3, i), &
656 iatom, ikind,
" tensorial_u",
qs_force(ikind)%tensorial_u(1:3, i), &
657 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
658 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
662 ikind = kind_of(iatom)
663 i = atom_of_kind(iatom)
664 WRITE (unit=output_unit, fmt=fmtstr2) &
665 iatom, ikind,
" all_potential",
qs_force(ikind)%all_potential(1:3, i), &
666 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
667 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
668 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
672 ikind = kind_of(iatom)
673 i = atom_of_kind(iatom)
674 WRITE (unit=output_unit, fmt=fmtstr2) &
675 iatom, ikind,
" overlap",
qs_force(ikind)%overlap(1:3, i), &
676 iatom, ikind,
"overlap_admm",
qs_force(ikind)%overlap_admm(1:3, i), &
677 iatom, ikind,
" kinetic",
qs_force(ikind)%kinetic(1:3, i), &
678 iatom, ikind,
" gth_ppl",
qs_force(ikind)%gth_ppl(1:3, i), &
679 iatom, ikind,
" gth_nlcc",
qs_force(ikind)%gth_nlcc(1:3, i), &
680 iatom, ikind,
" gth_ppnl",
qs_force(ikind)%gth_ppnl(1:3, i), &
681 iatom, ikind,
" core_overlap",
qs_force(ikind)%core_overlap(1:3, i), &
682 iatom, ikind,
" rho_core",
qs_force(ikind)%rho_core(1:3, i), &
683 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
684 iatom, ikind,
" ch_pulay",
qs_force(ikind)%ch_pulay(1:3, i), &
685 iatom, ikind,
" fock_4c",
qs_force(ikind)%fock_4c(1:3, i), &
686 iatom, ikind,
" mp2_non_sep",
qs_force(ikind)%mp2_non_sep(1:3, i), &
687 iatom, ikind,
" tensorial_u",
qs_force(ikind)%tensorial_u(1:3, i), &
688 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
689 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
693 ikind = kind_of(iatom)
694 i = atom_of_kind(iatom)
695 WRITE (unit=output_unit, fmt=fmtstr2) &
696 iatom, ikind,
" all_potential",
qs_force(ikind)%all_potential(1:3, i), &
697 iatom, ikind,
" overlap",
qs_force(ikind)%overlap(1:3, i), &
698 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
699 iatom, ikind,
" repulsive",
qs_force(ikind)%repulsive(1:3, i), &
700 iatom, ikind,
" dispersion",
qs_force(ikind)%dispersion(1:3, i), &
701 iatom, ikind,
" efield",
qs_force(ikind)%efield(1:3, i), &
702 iatom, ikind,
" ehrenfest",
qs_force(ikind)%ehrenfest(1:3, i), &
703 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
704 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
708 ikind = kind_of(iatom)
709 i = atom_of_kind(iatom)
710 WRITE (unit=output_unit, fmt=fmtstr2) &
711 iatom, ikind,
" overlap",
qs_force(ikind)%overlap(1:3, i), &
712 iatom, ikind,
" kinetic",
qs_force(ikind)%kinetic(1:3, i), &
713 iatom, ikind,
" rho_elec",
qs_force(ikind)%rho_elec(1:3, i), &
714 iatom, ikind,
" dispersion",
qs_force(ikind)%dispersion(1:3, i), &
715 iatom, ikind,
" all potential",
qs_force(ikind)%all_potential(1:3, i), &
716 iatom, ikind,
" other",
qs_force(ikind)%other(1:3, i), &
717 iatom, ikind,
" total",
qs_force(ikind)%total(1:3, i)
718 grand_total(1:3) = grand_total(1:3) +
qs_force(ikind)%total(1:3, i)
722 WRITE (unit=output_unit, fmt=fmtstr3)
"Sum of total", grand_total(1:3)
724 DEALLOCATE (atom_of_kind)
729 END SUBROUTINE write_forces
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.
Handles all functions related to the CELL.
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_set(matrix, alpha)
...
DBCSR operations in CP2K.
subroutine, public cp_dbcsr_write_sparse_matrix(sparse_matrix, before, after, qs_env, para_env, first_row, last_row, first_col, last_col, scale, output_unit, omit_headers, cartesian_basis)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
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...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
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, file_access)
...
Add the DFT+U contribution to the Hamiltonian matrix.
subroutine, public plus_u(qs_env, matrix_h, matrix_w)
Add the DFT+U contribution to the Hamiltonian matrix. Wrapper routine for all "+U" methods.
Types needed for a for a Energy Correction.
all routins needed for a nonperiodic electric field
subroutine, public efield_potential_lengh_gauge(qs_env, calculate_forces)
Replace the original implementation of the electric-electronic interaction in the length gauge....
subroutine, public calculate_ecore_efield(qs_env, calculate_forces)
Computes the force and the energy due to a efield on the cores Note: In the velocity gauge,...
Routines for an energy correction on top of a Kohn-Sham calculation.
subroutine, public energy_correction(qs_env, ec_init, calculate_forces)
Energy Correction to a Kohn-Sham simulation Available energy corrections: (1) Harris energy functiona...
Routines for total energy and forces of excited states.
subroutine, public excited_state_energy(qs_env, calculate_forces)
Excited state energy and forces.
Routines to calculate EXX in RPA and energy correction methods.
subroutine, public calculate_exx(qs_env, unit_nr, hfx_sections, x_data, do_gw, do_admm, calc_forces, reuse_hfx, do_im_time, e_ex_from_gw, e_admm_from_gw, t3)
...
Defines the basic variable types.
integer, parameter, public dp
contains the types and subroutines for dealing with the lri_env lri : local resolution of the identit...
Interface to the message passing library MPI.
Routines to calculate CPHF like update and solve Z-vector equation for MP2 gradients (only GPW).
subroutine, public update_mp2_forces(qs_env)
...
compute mulliken charges we (currently) define them as c_i = 1/2 [ (PS)_{ii} + (SP)_{ii}...
subroutine, public mulliken_restraint(mulliken_restraint_control, para_env, s_matrix, p_matrix, energy, order_p, ks_matrix, w_matrix)
computes the energy and density matrix derivate of a constraint on the mulliken charges
Define the data structure for the particle information.
Calculation of the energies concerning the core charge distribution.
subroutine, public calculate_ecore_overlap(qs_env, para_env, calculate_forces, molecular, e_overlap_core, atecc)
Calculate the overlap energy of the core charge distribution.
subroutine, public calculate_ecore_self(qs_env, e_self_core, atecc)
Calculate the self energy of the core charge distribution.
Calculation of the core Hamiltonian integral matrix <a|H|b> over Cartesian Gaussian-type functions.
subroutine, public build_core_hamiltonian_matrix(qs_env, calculate_forces)
Cosntruction of the QS Core Hamiltonian Matrix.
Calculation of dispersion in DFTB.
subroutine, public calculate_dftb_dispersion(qs_env, para_env, calculate_forces)
...
Calculation of Overlap and Hamiltonian matrices in DFTB.
subroutine, public build_dftb_matrices(qs_env, para_env, calculate_forces)
...
Perform a QUICKSTEP wavefunction optimization (single point).
subroutine, public qs_energies(qs_env, consistent_energies, calc_forces)
Driver routine for QUICKSTEP single point wavefunction optimization.
qs_environment methods that use many other modules
subroutine, public qs_env_rebuild_pw_env(qs_env)
rebuilds the pw_env in the given qs_env, allocating it if necessary
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.
Routines to handle an external electrostatic field The external field can be generic and is provided ...
subroutine, public external_c_potential(qs_env, calculate_forces)
Computes the force and the energy due to the external potential on the cores.
subroutine, public external_e_potential(qs_env)
Computes the external potential on the grid.
subroutine, public replicate_qs_force(qs_force, para_env)
Replicate and sum up the force.
subroutine, public zero_qs_force(qs_force)
Initialize a Quickstep force data structure.
subroutine, public allocate_qs_force(qs_force, natom_of_kind)
Allocate a Quickstep force data structure.
Quickstep force driver routine.
subroutine, public qs_calc_energy_force(qs_env, calc_force, consistent_energies, linres)
...
routines that build the Kohn-Sham matrix (i.e calculate the coulomb and xc parts
subroutine, public qs_ks_update_qs_env(qs_env, calculate_forces, just_energy, print_active)
updates the Kohn Sham matrix of the given qs_env (facility method)
subroutine, public set_ks_env(ks_env, v_hartree_rspace, s_mstruct_changed, rho_changed, exc_accint, potential_changed, forces_up_to_date, complex_ks, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, kinetic, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, matrix_vhxc, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_ks_im_kp, vppl, xcint_weights, rho_core, rho_nlcc, rho_nlcc_g, vee, neighbor_list_id, kpoints, sab_orb, sab_all, sac_ae, sac_ppl, sac_lri, sap_ppnl, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_vdw, sab_scp, sab_almo, sab_kp, sab_kp_nosym, sab_cneo, task_list, task_list_soft, subsys, dft_control, dbcsr_dist, distribution_2d, pw_env, para_env, blacs_env)
...
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...
Utility routines for qs_scf.
subroutine, public qs_scf_compute_properties(qs_env, wf_type, do_mp2)
computes properties for a given hamilonian using the current wfn
types that represent a quickstep subsys
subroutine, public qs_subsys_set(subsys, cp_subsys, local_particles, local_molecules, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, nelectron_total, nelectron_spin)
...
Calculates integral matrices for RIGPW method.
subroutine, public build_ri_matrices(lri_env, qs_env, calculate_forces)
creates and initializes an lri_env
subroutine, public rt_admm_force(qs_env)
Force contribution from the dependence of the ADMM projection on the nuclear positions.
subroutine, public calc_c_mat_force(qs_env)
calculates the three additional force contributions needed in EMD P_imag*C , P_imag*B*S^-1*S_der ,...
Routines to perform the RTP in the velocity gauge.
subroutine, public velocity_gauge_nl_force(qs_env, particle_set)
Calculate the force associated to non-local pseudo potential in the velocity gauge.
subroutine, public velocity_gauge_kinetic_force(qs_env)
Force from the field-dependent kinetic terms of the velocity gauge, 1/2 (p + A)^2 = 1/2 p^2 + A....
subroutine, public velocity_gauge_ks_matrix(qs_env, subtract_nl_term)
...
Split and build its own idependent core_core SE interaction module.
subroutine, public se_core_core_interaction(qs_env, para_env, calculate_forces)
Evaluates the core-core interactions for NDDO methods.
Calculation of the Hamiltonian integral matrix <a|H|b> for semi-empirical methods.
subroutine, public build_se_core_matrix(qs_env, para_env, calculate_forces)
...
subroutine, public tb_init_ham(qs_env, calculate_forces)
Prepare geometry-dependent data once, before SCF, including requested core forces.
subroutine, public build_tblite_matrices(qs_env, calculate_forces)
...
Optional native tblite command-line diagnostics.
subroutine, public tb_reference_cli_compare(qs_env)
Run native tblite CLI and compare against CP2K/tblite.
subroutine, public project_virial_to_periodic_subspace(virial, periodic)
Project all virial components to the periodic subspace of a low-dimensional cell.
subroutine, public symmetrize_virial(virial)
Symmetrize the virial components.
Calculation of Overlap and Hamiltonian matrices in xTB Reference: Stefan Grimme, Christoph Bannwarth,...
subroutine, public build_xtb_matrices(qs_env, calculate_forces)
...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
Contains information on the energy correction functional for KG.
stores all the informations relevant to an mpi environment
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.