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 : !> \brief Definition of physical constants:
10 : !>
11 : !> a_bohr : Bohr radius [m]
12 : !> a_fine : Fine-structure constant
13 : !> a_mass : Atomic mass unit [kg]; conversion factor [u] -> [kg]
14 : !> angstrom : Conversion factor [Bohr] -> [Angstrom]
15 : !> bar : Conversion factor [a.u.] -> [bar]
16 : !> bohr : Conversion factor [Angstrom] -> [Bohr]
17 : !> boltzmann : Boltzmann constant [J/K]
18 : !> c_light : Speed of light in vacuum [m/s]
19 : !> c_light_au : Speed of light in vacuum [a.u.]
20 : !> e_charge : Elementary charge [C]
21 : !> e_mass : Electron mass [kg]
22 : !> e_gfactor : Electron g factor [ ]
23 : !> esu : Conversion factors [a.u.] -> [esu]
24 : !> evolt : Conversion factor [a.u.] -> [eV]
25 : !> femtoseconds: Conversion factor [a.u.] -> [fs]
26 : !> h_bar : Planck constant [J*s]
27 : !> h_planck : Planck constant [J*s]
28 : !> hertz : Conversion factor [a.u.] -> [Hz]
29 : !> joule : Conversion factor [a.u.] -> [J]
30 : !> kcalmol : Conversion factor [a.u.] -> [kcal/mol]
31 : !> kelvin : Conversion factor [a.u.] -> [K]
32 : !> kjmol : Conversion factor [a.u.] -> [kJ/mol]
33 : !> massunit : Conversion factor [u] -> [a.u.]
34 : !> mu_perm : Magnetic constant or permeability of vacuum [N/A**2]
35 : !> n_avogadro : Avogadro constant [1/mol]
36 : !> newton : Conversion factor [a.u.] -> [N]
37 : !> pascal : Conversion factor [a.u.] -> [Pa]
38 : !> permittivity: Electric constant or permittivity of vacuum [F/m]
39 : !> picoseconds : Conversion factor [a.u.] -> [ps]
40 : !> rydberg : Rydberg constant [1/m]
41 : !> seconds : Conversion factor [a.u.] -> [s]
42 : !> vibfac : Conversion factor [a.u./Bohr**2] -> [1/cm]
43 : !> wavenumbers : Conversion factor [a.u.] -> [1/cm]
44 : !> debye : Conversion factor [a.u.] -> Debye
45 : !> \note
46 : !> Fundamental physical constants (SI units)
47 : !> Literature: - P. J. Mohr and B. N. Taylor,
48 : !> "CODATA recommended values of the fundamental physical
49 : !> constants: 1998 Rev. Mod. Phys. 72, 351-495 (2000)
50 : !> - P. J. Mohr and B. N. Taylor,
51 : !> "CODATA recommended values of the fundamental physical
52 : !> constants: 2002", Rev. Mod. Phys. 77, 1 (2005).
53 : !> - P. J. Mohr, B. N. Taylor, and D. B. Newell,
54 : !> "CODATA recommended values of the fundamental physical
55 : !> constants: 2006 Rev. Mod. Phys. 80, 633 (2008)
56 : !> - P. J. Mohr, B. N. Taylor, and D. B. Newell,
57 : !> "CODATA recommended values of the fundamental physical
58 : !> constants: 2010", Rev. Mod. Phys. 84, 1527-1605 (2012)
59 : !> \par History
60 : !> - Adapted for use in CP2K (JGH)
61 : !> - Updated to CODATA 1998 and cleaned (05.09.2003,MK)
62 : !> - Updated to CODATA 2006. (26.03.2008,AK)
63 : !> - Updated to CODATA 2010. (10.12.2012,MK)
64 : !> - Turned constants into Fortran parameters (2014, Ole Schuett)
65 : !> - Remove all but CODATA 2006 (2015, Ole Schuett)
66 : !> \author Matthias Krack (MK)
67 : ! **************************************************************************************************
68 : MODULE physcon
69 :
70 : USE kinds, ONLY: dp
71 : USE mathconstants, ONLY: pi
72 :
73 : IMPLICIT NONE
74 :
75 : PRIVATE
76 :
77 : PUBLIC :: a_bohr, a_fine, a_mass, angstrom, atm, bar, bohr, boltzmann, c_light_au, &
78 : debye, e_charge, e_gfactor, e_mass, evolt, femtoseconds, h_bar, &
79 : hertz, joule, kcalmol, kelvin, kjmol, massunit, mu_perm, n_avogadro, newton, &
80 : p_mass, pascal, picoseconds, seconds, vibfac, wavenumbers
81 :
82 : PUBLIC :: write_physcon
83 :
84 : ! CP2K uses the CODATA from 2006
85 :
86 : ! Exact constants
87 : ! Speed of light in vacuum [m/s]
88 : REAL(KIND=dp), PARAMETER :: c_light = 299792458.0_dp
89 : ! Speed of light in vacuum, in atomic units (=1/a_fine)
90 : REAL(KIND=dp), PARAMETER :: c_light_au = 137.035999679_dp
91 :
92 : ! Magnetic constant or permeability of vacuum [N/A**2]
93 : REAL(KIND=dp), PARAMETER :: mu_perm = 4.0_dp*pi*1.0E-7_dp
94 :
95 : ! Electric constant or permittivity of vacuum [F/m]
96 : REAL(KIND=dp), PARAMETER :: permittivity = 1.0_dp/(mu_perm*c_light**2)
97 :
98 : ! Recommended fundamental constants of physics
99 : ! and chemistry based on the 2006 adjustment
100 :
101 : ! Planck constant [J*s]
102 : REAL(KIND=dp), PARAMETER :: h_planck = 6.62606896E-34_dp
103 : REAL(KIND=dp), PARAMETER :: h_bar = h_planck/(2.0_dp*pi)
104 :
105 : ! Elementary charge [C]
106 : REAL(KIND=dp), PARAMETER :: e_charge = 1.602176487E-19_dp
107 :
108 : ! Electron mass [kg]
109 : REAL(KIND=dp), PARAMETER :: e_mass = 9.10938215E-31_dp
110 :
111 : ! Proton mass [kg]
112 : REAL(KIND=dp), PARAMETER :: p_mass = 1.672621637E-27_dp
113 :
114 : ! Electron g factor [ ]
115 : REAL(KIND=dp), PARAMETER :: e_gfactor = -2.0023193043622_dp
116 :
117 : ! Fine-structure constant
118 : !MK a_fine = 0.5_dp*mu_perm*c_light*e_charge**2/h_planck
119 : REAL(KIND=dp), PARAMETER :: a_fine = 7.2973525376E-3_dp
120 :
121 : ! Rydberg constant [1/m]
122 : !MK rydberg = 0.5_dp*e_mass*c_light*a_fine**2/h_planck
123 : REAL(KIND=dp), PARAMETER :: rydberg = 10973731.568527_dp
124 :
125 : ! Avogadro constant [1/mol]
126 : REAL(KIND=dp), PARAMETER :: n_avogadro = 6.02214179E+23_dp
127 :
128 : ! Boltzmann constant [J/K]
129 : REAL(KIND=dp), PARAMETER :: boltzmann = 1.3806504E-23_dp
130 :
131 : ! Atomic mass unit [kg]; conversion factor [u] -> [kg]
132 : REAL(KIND=dp), PARAMETER :: a_mass = 1.660538782E-27_dp
133 :
134 : ! Bohr radius [m]
135 : !MK a_bohr = a_fine/(4.0_dp*pi*rydberg)
136 : REAL(KIND=dp), PARAMETER :: a_bohr = 0.52917720859E-10_dp
137 :
138 : ! Conversion factors
139 :
140 : ! [u] -> [a.u.]
141 : REAL(KIND=dp), PARAMETER :: massunit = a_mass/e_mass
142 :
143 : ! [Bohr] -> [Angstrom]
144 : REAL(KIND=dp), PARAMETER :: angstrom = 1.0E+10_dp*a_bohr
145 :
146 : ! [Angstrom] -> [Bohr]
147 : REAL(KIND=dp), PARAMETER :: bohr = 1.0_dp/angstrom
148 :
149 : ! [a.u.] -> [s]
150 : REAL(KIND=dp), PARAMETER :: seconds = 1.0_dp/(4.0_dp*pi*rydberg*c_light)
151 :
152 : ! [a.u.] -> [fs]
153 : REAL(KIND=dp), PARAMETER :: femtoseconds = 1.0E+15_dp*seconds
154 :
155 : ! [a.u.] -> [ps]
156 : REAL(KIND=dp), PARAMETER :: picoseconds = 1.0E+12_dp*seconds
157 :
158 : ! [a.u.] -> [J]
159 : REAL(KIND=dp), PARAMETER :: joule = 2.0_dp*rydberg*h_planck*c_light
160 :
161 : ! [a.u.] -> [N]
162 : REAL(KIND=dp), PARAMETER :: newton = joule/a_bohr
163 :
164 : ! [a.u.] -> [K]
165 : REAL(KIND=dp), PARAMETER :: kelvin = joule/boltzmann
166 :
167 : ! [a.u.] -> [kJ/mol]
168 : REAL(KIND=dp), PARAMETER :: kjmol = 0.001_dp*joule*n_avogadro
169 :
170 : ! [a.u.] -> [kcal/mol]
171 : REAL(KIND=dp), PARAMETER :: kcalmol = kjmol/4.184_dp
172 :
173 : ! [a.u.] -> [Pa]
174 : REAL(KIND=dp), PARAMETER :: pascal = joule/a_bohr**3
175 :
176 : ! [a.u.] -> [bar]
177 : REAL(KIND=dp), PARAMETER :: bar = pascal/1.0E+5_dp
178 :
179 : ! [a.u.] -> [atm]
180 : REAL(KIND=dp), PARAMETER :: atm = pascal/1.013250E+5_dp
181 :
182 : ! [a.u.] -> [eV]
183 : REAL(KIND=dp), PARAMETER :: evolt = joule/e_charge
184 :
185 : ! [a.u.] -> [Hz]
186 : REAL(KIND=dp), PARAMETER :: hertz = joule/h_planck
187 :
188 : ! [a.u./Bohr**2] -> [1/cm] (wave numbers)
189 : REAL(KIND=dp), PARAMETER :: vibfac = 5.0_dp*SQRT(kjmol)/(pi*a_bohr*c_light)
190 :
191 : ! [a.u.] -> [1/cm] (wave numbers)
192 : REAL(KIND=dp), PARAMETER :: wavenumbers = 0.02_dp*rydberg
193 :
194 : ! [a.u.] -> [esu] (electrostatic units)
195 : REAL(KIND=dp), PARAMETER :: esu_1 = 1.0E+21_dp*a_bohr*c_light*e_charge
196 : !REAL(KIND=dp), PARAMETER :: esu_2 = esu_1/bohr
197 : !REAL(KIND=dp), PARAMETER :: esu_3 = esu_2/bohr
198 : !REAL(KIND=dp), PARAMETER :: esu(3) = (/ esu_1, esu_2, esu_3 /)
199 :
200 : ! [a.u.] -> [debye] (electrostatic units)
201 : REAL(KIND=dp), PARAMETER :: debye = esu_1
202 :
203 : CONTAINS
204 :
205 : ! **************************************************************************************************
206 : !> \brief Write all basic physical constants used by CP2K to a logical
207 : !> output unit.
208 : !> \param output_unit ...
209 : !> \date 14.11.2000
210 : !> \par History
211 : !> - Updated to CODATA 1998 and cleaned (05.09.2003,MK)
212 : !> - Updated to CODATA 2006. (26.03.2008,AK)
213 : !> \author JGH
214 : !> \version 1.1
215 : ! **************************************************************************************************
216 2513 : SUBROUTINE write_physcon(output_unit)
217 :
218 : INTEGER, INTENT(IN) :: output_unit
219 :
220 : WRITE (UNIT=output_unit, FMT="(T2,/,T2,A,/,/,(T2,A))") &
221 2513 : "*** Fundamental physical constants (SI units) ***", &
222 2513 : "*** Literature: B. J. Mohr and B. N. Taylor,", &
223 2513 : "*** CODATA recommended values of the fundamental physical", &
224 2513 : "*** constants: 2006, Web Version 5.1", &
225 5026 : "*** http://physics.nist.gov/constants"
226 :
227 : WRITE (UNIT=output_unit, FMT="(/,T2,A,T61,ES20.14)") &
228 2513 : "Speed of light in vacuum [m/s]", c_light
229 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
230 2513 : "Magnetic constant or permeability of vacuum [N/A**2]", mu_perm
231 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
232 2513 : "Electric constant or permittivity of vacuum [F/m]", permittivity
233 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
234 2513 : "Planck constant (h) [J*s]", h_planck
235 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
236 2513 : "Planck constant (h-bar) [J*s]", h_bar
237 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
238 2513 : "Elementary charge [C]", e_charge
239 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
240 2513 : "Electron mass [kg]", e_mass
241 : WRITE (UNIT=output_unit, FMT="(T2,A,T60,ES21.14)") &
242 2513 : "Electron g factor [ ]", e_gfactor
243 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
244 2513 : "Proton mass [kg]", p_mass
245 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
246 2513 : "Fine-structure constant", a_fine
247 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
248 2513 : "Rydberg constant [1/m]", rydberg
249 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
250 2513 : "Avogadro constant [1/mol]", n_avogadro
251 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
252 2513 : "Boltzmann constant [J/K]", boltzmann
253 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
254 2513 : "Atomic mass unit [kg]", a_mass
255 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
256 2513 : "Bohr radius [m]", a_bohr
257 :
258 : ! Conversion factors
259 :
260 : WRITE (UNIT=output_unit, FMT="(/,T2,A,/)") &
261 2513 : "*** Conversion factors ***"
262 :
263 : WRITE (UNIT=output_unit, FMT="(T2,A,T61,ES20.14)") &
264 2513 : "[u] -> [a.u.]", massunit, &
265 2513 : "[Angstrom] -> [Bohr] = [a.u.]", bohr, &
266 2513 : "[a.u.] = [Bohr] -> [Angstrom]", angstrom, &
267 2513 : "[a.u.] -> [s]", seconds, &
268 2513 : "[a.u.] -> [fs]", femtoseconds, &
269 2513 : "[a.u.] -> [J]", joule, &
270 2513 : "[a.u.] -> [N]", newton, &
271 2513 : "[a.u.] -> [K]", kelvin, &
272 2513 : "[a.u.] -> [kJ/mol]", kjmol, &
273 2513 : "[a.u.] -> [kcal/mol]", kcalmol, &
274 2513 : "[a.u.] -> [Pa]", pascal, &
275 2513 : "[a.u.] -> [bar]", bar, &
276 2513 : "[a.u.] -> [atm]", atm, &
277 2513 : "[a.u.] -> [eV]", evolt, &
278 2513 : "[a.u.] -> [Hz]", hertz, &
279 2513 : "[a.u.] -> [1/cm] (wave numbers)", wavenumbers, &
280 5026 : "[a.u./Bohr**2] -> [1/cm]", vibfac
281 2513 : WRITE (UNIT=output_unit, FMT="(T2,A)") ""
282 :
283 2513 : END SUBROUTINE write_physcon
284 :
285 : END MODULE physcon
|