(git:ed6f26b)
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-2025 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) &
86 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
87 "Dispersion energy: ", energy%dispersion
88 IF (energy%gcp /= 0.0_dp) &
89 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
90 "gCP energy: ", energy%gcp
91 IF (energy%efield /= 0.0_dp) &
92 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
93 "Electric field interaction energy: ", energy%efield
94
95 ELSEIF (dft_control%qs_control%semi_empirical) THEN
96 cpabort("NONSCF not available")
97 ELSEIF (dft_control%qs_control%dftb) THEN
98 cpassert(energy%dftb3 == 0.0_dp)
99 energy%total = energy%total + energy%band + energy%qmmm_el
100 WRITE (unit=iounit, fmt="(/,T2,A,T40,A,F10.2,T61,F20.10)") &
101 "Diagonalization", "Time:", tdiag, energy%total
102 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
103 "Core Hamiltonian energy: ", energy%core, &
104 "Repulsive potential energy: ", energy%repulsive, &
105 "Dispersion energy: ", energy%dispersion
106 IF (energy%efield /= 0.0_dp) &
107 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
108 "Electric field interaction energy: ", energy%efield
109 ELSEIF (dft_control%qs_control%xtb) THEN
110 energy%total = energy%total + energy%band + energy%qmmm_el
111 WRITE (unit=iounit, fmt="(/,T2,A,T40,A,F10.2,T61,F20.10)") &
112 "Diagonalization", "Time:", tdiag, energy%total
113 cpassert(dft_control%qs_control%xtb_control%gfn_type == 0)
114 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
115 "Core Hamiltonian energy: ", energy%core, &
116 "Repulsive potential energy: ", energy%repulsive, &
117 "SRB Correction energy: ", energy%srb, &
118 "Charge equilibration energy: ", energy%eeq, &
119 "Dispersion energy: ", energy%dispersion
120 IF (dft_control%qs_control%xtb_control%do_nonbonded) &
121 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
122 "Correction for nonbonded interactions: ", energy%xtb_nonbonded
123 IF (energy%efield /= 0.0_dp) &
124 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
125 "Electric field interaction energy: ", energy%efield
126 ELSE
127 cpabort("NONSCF not available")
128 END IF
129 IF (dft_control%smear) THEN
130 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
131 "Electronic entropic energy:", energy%kTS
132 WRITE (unit=iounit, fmt="((T3,A,T56,F25.14))") &
133 "Fermi energy:", energy%efermi
134 END IF
135 IF (energy%qmmm_el /= 0.0_dp) THEN
136 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
137 "QM/MM Electrostatic energy: ", energy%qmmm_el
138 IF (qs_env%qmmm_env_qm%image_charge) THEN
139 WRITE (unit=iounit, fmt="(T3,A,T56,F25.14)") &
140 "QM/MM image charge energy: ", energy%image_charge
141 END IF
142 END IF
143
144 WRITE (unit=iounit, fmt="(/,(T3,A,T56,F25.14))") &
145 "Total energy: ", energy%total
146
147 CALL m_flush(iounit)
148 END IF
149
150 END SUBROUTINE qs_nonscf_print_summary
151
152END 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:130
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, 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, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, 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, ecoul_1c, rho0_s_rs, rho0_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)
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.