Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \par History
10 : !> JGH (11.08.2002) exchange and correlation energy now in exc
11 : !> TL (25.05.2004) qmmm energy
12 : !> \author MK (13.06.2002)
13 : ! **************************************************************************************************
14 : MODULE qs_energy_types
15 :
16 : USE kinds, ONLY: dp
17 : #include "./base/base_uses.f90"
18 :
19 : IMPLICIT NONE
20 :
21 : PRIVATE
22 :
23 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_energy_types'
24 :
25 : TYPE qs_energy_type
26 : REAL(KIND=dp) :: core = 0.0_dp, &
27 : core_overlap = 0.0_dp, &
28 : core_overlap0 = 0.0_dp, &
29 : core_self = 0.0_dp, &
30 : repulsive = 0.0_dp, &
31 : dispersion = 0.0_dp, &
32 : gcp = 0.0_dp, &
33 : ex = 0.0_dp, &
34 : exc = 0.0_dp, &
35 : exc_aux_fit = 0.0_dp, &
36 : exc1 = 0.0_dp, &
37 : exc1_aux_fit = 0.0_dp, & !the GAPW contribution to ADMM
38 : hartree = 0.0_dp, &
39 : hartree_1c = 0.0_dp, &
40 : e_hartree = 0.0_dp, & ! contains the hartree energy of electrons only
41 : ! computed if requested
42 : image_charge = 0.0_dp, &
43 : qmmm_el = 0.0_dp, &
44 : qmmm_nu = 0.0_dp, &
45 : mulliken = 0.0_dp, &
46 : cdft = 0.0_dp, &
47 : ee = 0.0_dp, &
48 : ee_core = 0.0_dp, &
49 : efield = 0.0_dp, &
50 : efield_core = 0.0_dp, &
51 : s2_restraint = 0.0_dp, &
52 : dft_plus_u = 0.0_dp, & ! DFT+U energy contribution
53 : sccs_hartree = 0.0_dp, & ! SCCS Hartree energy of solute + solvent
54 : sccs_pol = 0.0_dp, & ! SCCS polarisation energy
55 : sccs_cav = 0.0_dp, & ! SCCS cavitation energy
56 : sccs_dis = 0.0_dp, & ! SCCS dispersion free energy
57 : sccs_rep = 0.0_dp, & ! SCCS repulsion free energy
58 : sccs_sol = 0.0_dp, & ! SCCS solvation free energy
59 : ktS = 0.0_dp, & ! electronic entropic contribution
60 : efermi = 0.0_dp, & ! Fermi energy
61 : dftb3 = 0.0_dp, & ! DFTB 3rd order correction
62 : nonscf_correction = 0.0_dp, & ! e.g. Harris correction
63 : mp2 = 0.0_dp, &
64 : ! single excitations correction for all
65 : ! non-scf orbital(density) corrections
66 : ! for example, almo delocalization corrction
67 : singles_corr = 0.0_dp, &
68 : ! excitation energy
69 : excited_state = 0.0_dp, &
70 : total = 0.0_dp, &
71 : tot_old = 0.0_dp, &
72 : kinetic = 0.0_dp, & !total kinetic energy [rk]
73 : s_square = 0.0_dp, &
74 : surf_dipole = 0.0_dp, &
75 : embed_corr = 0.0_dp, & ! correction for embedding potential
76 : xtb_xb_inter = 0.0_dp, & ! correction for halogen bonding within GFN1-xTB
77 : xtb_nonbonded = 0.0_dp ! correction for nonbonded interactions within GFN1-xTB
78 : REAL(KIND=dp), DIMENSION(:), POINTER :: ddapc_restraint => NULL()
79 : END TYPE qs_energy_type
80 :
81 : ! Public data types
82 :
83 : PUBLIC :: qs_energy_type
84 :
85 : ! Public subroutines
86 :
87 : PUBLIC :: allocate_qs_energy, &
88 : deallocate_qs_energy, &
89 : init_qs_energy
90 :
91 : CONTAINS
92 :
93 : ! **************************************************************************************************
94 : !> \brief Allocate and/or initialise a Quickstep energy data structure.
95 : !> \param qs_energy ...
96 : !> \date 13.06.2002
97 : !> \author MK
98 : !> \version 1.0
99 : ! **************************************************************************************************
100 6600 : SUBROUTINE allocate_qs_energy(qs_energy)
101 :
102 : TYPE(qs_energy_type), POINTER :: qs_energy
103 :
104 : CHARACTER(len=*), PARAMETER :: routineN = 'allocate_qs_energy'
105 :
106 : INTEGER :: handle
107 :
108 6600 : CALL timeset(routineN, handle)
109 6600 : IF (.NOT. ASSOCIATED(qs_energy)) THEN
110 6600 : ALLOCATE (qs_energy)
111 : NULLIFY (qs_energy%ddapc_restraint)
112 : END IF
113 :
114 6600 : CALL init_qs_energy(qs_energy)
115 6600 : CALL timestop(handle)
116 :
117 6600 : END SUBROUTINE allocate_qs_energy
118 :
119 : ! **************************************************************************************************
120 : !> \brief Deallocate a Quickstep energy data structure.
121 : !> \param qs_energy ...
122 : !> \date 13.06.2002
123 : !> \author MK
124 : !> \version 1.0
125 : ! **************************************************************************************************
126 6600 : SUBROUTINE deallocate_qs_energy(qs_energy)
127 : TYPE(qs_energy_type), POINTER :: qs_energy
128 :
129 6600 : IF (ASSOCIATED(qs_energy)) THEN
130 6600 : IF (ASSOCIATED(qs_energy%ddapc_restraint)) THEN
131 6600 : DEALLOCATE (qs_energy%ddapc_restraint)
132 : END IF
133 6600 : DEALLOCATE (qs_energy)
134 : ELSE
135 : CALL cp_abort(__LOCATION__, &
136 : "The qs_energy pointer is not associated "// &
137 0 : "and cannot be deallocated")
138 : END IF
139 :
140 6600 : END SUBROUTINE deallocate_qs_energy
141 :
142 : ! **************************************************************************************************
143 : !> \brief Initialise a Quickstep energy data structure.
144 : !> \param qs_energy ...
145 : !> \date 13.06.2002
146 : !> \author MK
147 : !> \version 1.0
148 : ! **************************************************************************************************
149 6600 : SUBROUTINE init_qs_energy(qs_energy)
150 :
151 : TYPE(qs_energy_type), POINTER :: qs_energy
152 :
153 6600 : IF (ASSOCIATED(qs_energy)) THEN
154 6600 : qs_energy%core = 0.0_dp
155 6600 : qs_energy%core_overlap = 0.0_dp
156 6600 : qs_energy%core_overlap0 = 0.0_dp
157 6600 : qs_energy%core_self = 0.0_dp
158 6600 : qs_energy%repulsive = 0.0_dp
159 6600 : qs_energy%dispersion = 0.0_dp
160 6600 : qs_energy%gcp = 0.0_dp
161 6600 : qs_energy%qmmm_el = 0.0_dp
162 6600 : qs_energy%qmmm_nu = 0.0_dp
163 6600 : qs_energy%ex = 0.0_dp
164 6600 : qs_energy%exc = 0.0_dp
165 6600 : qs_energy%exc_aux_fit = 0.0_dp
166 6600 : qs_energy%exc1 = 0.0_dp
167 6600 : qs_energy%exc1_aux_fit = 0.0_dp
168 6600 : qs_energy%e_hartree = 0.0_dp
169 6600 : qs_energy%hartree = 0.0_dp
170 6600 : qs_energy%hartree_1c = 0.0_dp
171 6600 : qs_energy%image_charge = 0.0_dp
172 6600 : qs_energy%mulliken = 0.0_dp
173 6600 : qs_energy%cdft = 0.0_dp
174 6600 : qs_energy%efield = 0.0_dp
175 6600 : qs_energy%efield_core = 0.0_dp
176 6600 : qs_energy%ee = 0.0_dp
177 6600 : qs_energy%ee_core = 0.0_dp
178 6600 : qs_energy%s2_restraint = 0.0_dp
179 6600 : qs_energy%dft_plus_u = 0.0_dp
180 6600 : qs_energy%sccs_hartree = 0.0_dp
181 6600 : qs_energy%sccs_pol = 0.0_dp
182 6600 : qs_energy%sccs_cav = 0.0_dp
183 6600 : qs_energy%sccs_dis = 0.0_dp
184 6600 : qs_energy%sccs_rep = 0.0_dp
185 6600 : qs_energy%sccs_sol = 0.0_dp
186 6600 : qs_energy%dftb3 = 0.0_dp
187 6600 : qs_energy%kTS = 0.0_dp
188 6600 : qs_energy%mp2 = 0.0_dp
189 6600 : qs_energy%efermi = 0.0_dp
190 6600 : qs_energy%kinetic = 0.0_dp
191 6600 : qs_energy%surf_dipole = 0.0_dp
192 6600 : qs_energy%excited_state = 0.0_dp
193 6600 : qs_energy%total = 0.0_dp
194 6600 : qs_energy%singles_corr = 0.0_dp
195 6600 : qs_energy%nonscf_correction = 0.0_dp
196 6600 : IF (.NOT. ASSOCIATED(qs_energy%ddapc_restraint)) THEN
197 6600 : ALLOCATE (qs_energy%ddapc_restraint(1))
198 : END IF
199 13200 : qs_energy%ddapc_restraint(:) = 0.0_dp
200 : ELSE
201 : CALL cp_abort(__LOCATION__, &
202 : "The qs_energy pointer is not associated "// &
203 0 : "and cannot be initialised")
204 : END IF
205 :
206 6600 : END SUBROUTINE init_qs_energy
207 :
208 0 : END MODULE qs_energy_types
|