(git:98357aa)
Loading...
Searching...
No Matches
qs_nonscf_utils.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 Routines for Quickstep NON-SCF run.
10!> \par History
11!> - initial setup [JGH, 2024]
12!> \author JGH (13.05.2024)
13! **************************************************************************************************
16 USE kinds, ONLY: dp
17 USE machine, ONLY: m_flush
22 USE qs_rho_types, ONLY: qs_rho_get,&
24#include "./base/base_uses.f90"
25
26 IMPLICIT NONE
27
28 PRIVATE
29
30 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_nonscf_utils'
31
33
34CONTAINS
35
36! **************************************************************************************************
37!> \brief writes a summary of information after diagonalization
38!> \param qs_env ...
39!> \param tdiag ...
40!> \param nelectron_total ...
41!> \param iounit ...
42! **************************************************************************************************
43 SUBROUTINE qs_nonscf_print_summary(qs_env, tdiag, nelectron_total, iounit)
44 TYPE(qs_environment_type), POINTER :: qs_env
45 REAL(kind=dp), INTENT(IN) :: tdiag
46 INTEGER, INTENT(IN) :: nelectron_total, iounit
47
48 REAL(kind=dp), DIMENSION(:), POINTER :: tot_rho_r
49 TYPE(dft_control_type), POINTER :: dft_control
50 TYPE(qs_charges_type), POINTER :: qs_charges
51 TYPE(qs_energy_type), POINTER :: energy
52 TYPE(qs_rho_type), POINTER :: rho
53
54 IF (iounit > 0) THEN
55 CALL get_qs_env(qs_env=qs_env, energy=energy, dft_control=dft_control)
56 IF (qs_env%harris_method) THEN
57 cpassert(.NOT. dft_control%qs_control%gapw)
58 cpassert(.NOT. dft_control%qs_control%gapw_xc)
59
60 CALL get_qs_env(qs_env=qs_env, rho=rho, qs_charges=qs_charges)
61 CALL qs_rho_get(rho, tot_rho_r=tot_rho_r)
62 WRITE (unit=iounit, fmt="(/,(T3,A,T41,2F20.10))") &
63 "Electronic density on regular grids: ", &
64 sum(tot_rho_r), &
65 sum(tot_rho_r) + nelectron_total, &
66 "Core density on regular grids:", &
67 qs_charges%total_rho_core_rspace, &
68 qs_charges%total_rho_core_rspace - real(nelectron_total + dft_control%charge, dp)
69 WRITE (unit=iounit, fmt="(T3,A,T41,F20.10)") &
70 "Total charge density on r-space grids: ", &
71 sum(tot_rho_r) + &
72 qs_charges%total_rho_core_rspace, &
73 "Total charge density g-space grids: ", &
74 qs_charges%total_rho_gspace
75
76 WRITE (unit=iounit, fmt="(/,T2,A,T40,A,F10.2,T61,F20.10)") &
77 "Diagonalization", "Time:", tdiag, energy%band
78
79 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
80 "Core Hamiltonian energy: ", energy%core, &
81 "Overlap energy of the core charge distribution:", energy%core_overlap, &
82 "Self energy of the core charge distribution: ", energy%core_self, &
83 "Hartree energy: ", energy%hartree, &
84 "Exchange-correlation energy: ", energy%exc
85 IF (energy%dispersion /= 0.0_dp) THEN
86 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
87 "Dispersion energy: ", energy%dispersion
88 END IF
89 IF (energy%gcp /= 0.0_dp) THEN
90 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
91 "gCP energy: ", energy%gcp
92 END IF
93 IF (energy%efield /= 0.0_dp) THEN
94 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
95 "Electric field interaction energy: ", energy%efield
96 END IF
97
98 ELSE IF (dft_control%qs_control%semi_empirical) THEN
99 cpabort("NONSCF not available")
100 ELSE IF (dft_control%qs_control%dftb) THEN
101 cpassert(energy%dftb3 == 0.0_dp)
102 energy%total = energy%total + energy%band + energy%qmmm_el
103 WRITE (unit=iounit, fmt="(/,T2,A,T40,A,F10.2,T61,F20.10)") &
104 "Diagonalization", "Time:", tdiag, energy%total
105 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
106 "Core Hamiltonian energy: ", energy%core, &
107 "Repulsive potential energy: ", energy%repulsive, &
108 "Dispersion energy: ", energy%dispersion
109 IF (energy%efield /= 0.0_dp) THEN
110 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
111 "Electric field interaction energy: ", energy%efield
112 END IF
113 ELSE IF (dft_control%qs_control%xtb) THEN
114 energy%total = energy%total + energy%band + energy%qmmm_el
115 WRITE (unit=iounit, fmt="(/,T2,A,T40,A,F10.2,T61,F20.10)") &
116 "Diagonalization", "Time:", tdiag, energy%total
117 cpassert(dft_control%qs_control%xtb_control%gfn_type == 0)
118 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
119 "Core Hamiltonian energy: ", energy%core, &
120 "Repulsive potential energy: ", energy%repulsive, &
121 "SRB Correction energy: ", energy%srb, &
122 "Charge equilibration energy: ", energy%eeq, &
123 "Dispersion energy: ", energy%dispersion
124 IF (dft_control%qs_control%xtb_control%do_nonbonded) THEN
125 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
126 "Correction for nonbonded interactions: ", energy%xtb_nonbonded
127 END IF
128 IF (energy%efield /= 0.0_dp) THEN
129 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
130 "Electric field interaction energy: ", energy%efield
131 END IF
132 ELSE
133 cpabort("NONSCF not available")
134 END IF
135 IF (dft_control%smear) THEN
136 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
137 "Electronic entropic energy:", energy%kTS
138 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
139 "Fermi energy:", energy%efermi
140 END IF
141 IF (energy%qmmm_el /= 0.0_dp) THEN
142 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
143 "QM/MM Electrostatic energy: ", energy%qmmm_el
144 IF (qs_env%qmmm_env_qm%image_charge) THEN
145 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
146 "QM/MM image charge energy: ", energy%image_charge
147 END IF
148 END IF
149
150 WRITE (unit=iounit, fmt="(/,(T3,A,T56,F25.14))") &
151 "Total energy: ", energy%total
152
153 CALL m_flush(iounit)
154 END IF
155
156 END SUBROUTINE qs_nonscf_print_summary
157
158END MODULE qs_nonscf_utils
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Machine interface based on Fortran 2003 and POSIX.
Definition machine.F:17
subroutine, public m_flush(lunit)
flushes units if the &GLOBAL flag is set accordingly
Definition machine.F:124
container for information about total charges on the grids
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 for Quickstep NON-SCF run.
subroutine, public qs_nonscf_print_summary(qs_env, tdiag, nelectron_total, iounit)
writes a summary of information after diagonalization
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...
Container for information about total charges on the grids.
keeps the density in various representations, keeping track of which ones are valid.