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 : srb = 0.0_dp, &
34 : eeq = 0.0_dp, &
35 : ies = 0.0_dp, &
36 : ex = 0.0_dp, &
37 : exc = 0.0_dp, &
38 : exc_aux_fit = 0.0_dp, &
39 : exc1 = 0.0_dp, &
40 : exc1_aux_fit = 0.0_dp, & !the GAPW contribution to ADMM
41 : hartree = 0.0_dp, &
42 : hartree_1c = 0.0_dp, &
43 : e_hartree = 0.0_dp, & ! contains the hartree energy of electrons only
44 : ! computed if requested
45 : image_charge = 0.0_dp, &
46 : qmmm_el = 0.0_dp, &
47 : qmmm_nu = 0.0_dp, &
48 : mulliken = 0.0_dp, &
49 : cdft = 0.0_dp, &
50 : ee = 0.0_dp, &
51 : ee_core = 0.0_dp, &
52 : efield = 0.0_dp, &
53 : efield_core = 0.0_dp, &
54 : s2_restraint = 0.0_dp, &
55 : dft_plus_u = 0.0_dp, & ! DFT+U energy contribution
56 : sccs_hartree = 0.0_dp, & ! SCCS Hartree energy of solute + solvent
57 : sccs_pol = 0.0_dp, & ! SCCS polarisation energy
58 : sccs_cav = 0.0_dp, & ! SCCS cavitation energy
59 : sccs_dis = 0.0_dp, & ! SCCS dispersion free energy
60 : sccs_rep = 0.0_dp, & ! SCCS repulsion free energy
61 : sccs_sol = 0.0_dp, & ! SCCS solvation free energy
62 : ktS = 0.0_dp, & ! electronic entropic contribution
63 : efermi = 0.0_dp, & ! Fermi energy
64 : band = 0.0_dp, & ! Band energy (Tr PH)
65 : dftb3 = 0.0_dp, & ! DFTB 3rd order correction
66 : nonscf_correction = 0.0_dp, & ! e.g. Harris correction
67 : mp2 = 0.0_dp, &
68 : ! single excitations correction for all
69 : ! non-scf orbital(density) corrections
70 : ! for example, almo delocalization corrction
71 : singles_corr = 0.0_dp, &
72 : ! excitation energy
73 : excited_state = 0.0_dp, &
74 : total = 0.0_dp, &
75 : tot_old = 0.0_dp, &
76 : kinetic = 0.0_dp, & !total kinetic energy [rk]
77 : s_square = 0.0_dp, &
78 : surf_dipole = 0.0_dp, &
79 : embed_corr = 0.0_dp, & ! correction for embedding potential
80 : xtb_xb_inter = 0.0_dp, & ! correction for halogen bonding within GFN1-xTB
81 : xtb_nonbonded = 0.0_dp ! correction for nonbonded interactions within GFN1-xTB
82 : REAL(KIND=dp), DIMENSION(:), POINTER :: ddapc_restraint => NULL()
83 : END TYPE qs_energy_type
84 :
85 : ! Public data types
86 :
87 : PUBLIC :: qs_energy_type
88 :
89 : ! Public subroutines
90 :
91 : PUBLIC :: allocate_qs_energy, &
92 : deallocate_qs_energy, &
93 : init_qs_energy
94 :
95 : CONTAINS
96 :
97 : ! **************************************************************************************************
98 : !> \brief Allocate and/or initialise a Quickstep energy data structure.
99 : !> \param qs_energy ...
100 : !> \date 13.06.2002
101 : !> \author MK
102 : !> \version 1.0
103 : ! **************************************************************************************************
104 6702 : SUBROUTINE allocate_qs_energy(qs_energy)
105 :
106 : TYPE(qs_energy_type), POINTER :: qs_energy
107 :
108 : CHARACTER(len=*), PARAMETER :: routineN = 'allocate_qs_energy'
109 :
110 : INTEGER :: handle
111 :
112 6702 : CALL timeset(routineN, handle)
113 6702 : IF (.NOT. ASSOCIATED(qs_energy)) THEN
114 6702 : ALLOCATE (qs_energy)
115 : NULLIFY (qs_energy%ddapc_restraint)
116 : END IF
117 :
118 6702 : CALL init_qs_energy(qs_energy)
119 6702 : CALL timestop(handle)
120 :
121 6702 : END SUBROUTINE allocate_qs_energy
122 :
123 : ! **************************************************************************************************
124 : !> \brief Deallocate a Quickstep energy data structure.
125 : !> \param qs_energy ...
126 : !> \date 13.06.2002
127 : !> \author MK
128 : !> \version 1.0
129 : ! **************************************************************************************************
130 6702 : SUBROUTINE deallocate_qs_energy(qs_energy)
131 : TYPE(qs_energy_type), POINTER :: qs_energy
132 :
133 6702 : IF (ASSOCIATED(qs_energy)) THEN
134 6702 : IF (ASSOCIATED(qs_energy%ddapc_restraint)) THEN
135 6702 : DEALLOCATE (qs_energy%ddapc_restraint)
136 : END IF
137 6702 : DEALLOCATE (qs_energy)
138 : ELSE
139 : CALL cp_abort(__LOCATION__, &
140 : "The qs_energy pointer is not associated "// &
141 0 : "and cannot be deallocated")
142 : END IF
143 :
144 6702 : END SUBROUTINE deallocate_qs_energy
145 :
146 : ! **************************************************************************************************
147 : !> \brief Initialise a Quickstep energy data structure.
148 : !> \param qs_energy ...
149 : !> \date 13.06.2002
150 : !> \author MK
151 : !> \version 1.0
152 : ! **************************************************************************************************
153 6702 : SUBROUTINE init_qs_energy(qs_energy)
154 :
155 : TYPE(qs_energy_type), POINTER :: qs_energy
156 :
157 6702 : IF (ASSOCIATED(qs_energy)) THEN
158 6702 : qs_energy%core = 0.0_dp
159 6702 : qs_energy%core_overlap = 0.0_dp
160 6702 : qs_energy%core_overlap0 = 0.0_dp
161 6702 : qs_energy%core_self = 0.0_dp
162 6702 : qs_energy%repulsive = 0.0_dp
163 6702 : qs_energy%dispersion = 0.0_dp
164 6702 : qs_energy%gcp = 0.0_dp
165 6702 : qs_energy%qmmm_el = 0.0_dp
166 6702 : qs_energy%qmmm_nu = 0.0_dp
167 6702 : qs_energy%ex = 0.0_dp
168 6702 : qs_energy%exc = 0.0_dp
169 6702 : qs_energy%exc_aux_fit = 0.0_dp
170 6702 : qs_energy%exc1 = 0.0_dp
171 6702 : qs_energy%exc1_aux_fit = 0.0_dp
172 6702 : qs_energy%e_hartree = 0.0_dp
173 6702 : qs_energy%hartree = 0.0_dp
174 6702 : qs_energy%hartree_1c = 0.0_dp
175 6702 : qs_energy%image_charge = 0.0_dp
176 6702 : qs_energy%mulliken = 0.0_dp
177 6702 : qs_energy%cdft = 0.0_dp
178 6702 : qs_energy%efield = 0.0_dp
179 6702 : qs_energy%efield_core = 0.0_dp
180 6702 : qs_energy%ee = 0.0_dp
181 6702 : qs_energy%ee_core = 0.0_dp
182 6702 : qs_energy%s2_restraint = 0.0_dp
183 6702 : qs_energy%dft_plus_u = 0.0_dp
184 6702 : qs_energy%sccs_hartree = 0.0_dp
185 6702 : qs_energy%sccs_pol = 0.0_dp
186 6702 : qs_energy%sccs_cav = 0.0_dp
187 6702 : qs_energy%sccs_dis = 0.0_dp
188 6702 : qs_energy%sccs_rep = 0.0_dp
189 6702 : qs_energy%sccs_sol = 0.0_dp
190 6702 : qs_energy%dftb3 = 0.0_dp
191 6702 : qs_energy%kTS = 0.0_dp
192 6702 : qs_energy%mp2 = 0.0_dp
193 6702 : qs_energy%efermi = 0.0_dp
194 6702 : qs_energy%kinetic = 0.0_dp
195 6702 : qs_energy%surf_dipole = 0.0_dp
196 6702 : qs_energy%excited_state = 0.0_dp
197 6702 : qs_energy%total = 0.0_dp
198 6702 : qs_energy%singles_corr = 0.0_dp
199 6702 : qs_energy%nonscf_correction = 0.0_dp
200 6702 : IF (.NOT. ASSOCIATED(qs_energy%ddapc_restraint)) THEN
201 6702 : ALLOCATE (qs_energy%ddapc_restraint(1))
202 : END IF
203 13404 : qs_energy%ddapc_restraint(:) = 0.0_dp
204 : ELSE
205 : CALL cp_abort(__LOCATION__, &
206 : "The qs_energy pointer is not associated "// &
207 0 : "and cannot be initialised")
208 : END IF
209 :
210 6702 : END SUBROUTINE init_qs_energy
211 :
212 0 : END MODULE qs_energy_types
|