Coverage for gpaw/tddft/units.py: 100%
28 statements
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
« prev ^ index » next coverage.py v7.7.1, created at 2025-07-14 00:18 +0000
1# https://www.answers.com/topic/hartree-units
3from math import pi
5from ase.units import _hbar, _eps0, _me, _e, _c, Bohr, Hartree, s
7_a0 = Bohr * 1e-10
8_autime = _hbar**3 * (4 * pi * _eps0)**2 / (_me * _e**4
9 ) # 1 autime ~ 2.42e-17 s
11# Conversion factors between ASE and GPAW units
13attosec_to_autime = 1e-18 / _autime # 1 as ~ 0.0413 autime
14autime_to_attosec = _autime * 1e18 # 1 autime ~ 24.2 as
16# ASE time unit is [Å sqrt(u/eV)]
17# Hartree time unit is [hbar/Hartree]
18asetime_to_autime = 1 / s / _autime # 1 ASE time unit ~ 420.9 autime
19autime_to_asetime = 1 / asetime_to_autime
21eV_to_hartree = 1.0 / Hartree # 1 eV ~ 0.0368 Eh
22hartree_to_eV = Hartree # 1 Eh ~ 27.2 eV
24hartree_to_aufrequency = 1.0 # Eh ~ autime^(-1) since hbar=1
25aufrequency_to_hartree = 1.0 # autime^(-1) ~ Eh since hbar=1
27eV_to_aufrequency = 1.0 / Hartree # 1 eV ~ 0.0368 autime^(-1)
28aufrequency_to_eV = Hartree # 1 autime^(-1) ~ 27.2 eV
30eA_to_audipolemoment = 1 / Bohr # 1 eÅ ~ 1.8897 aulength^(-1)
31audipolemoment_to_eA = 1 / eA_to_audipolemoment
33assert eV_to_aufrequency == eV_to_hartree * hartree_to_aufrequency
34assert aufrequency_to_eV == aufrequency_to_hartree * hartree_to_eV
36# Short-hand names
37eV_to_au = eV_to_aufrequency
38au_to_eV = aufrequency_to_eV
39as_to_au = attosec_to_autime
40au_to_as = autime_to_attosec
41au_to_fs = au_to_as / 1e3
42fs_to_au = as_to_au * 1e3
43eA_to_au = eA_to_audipolemoment
44au_to_eA = audipolemoment_to_eA
46# Rotatory strength
47# See https://doi.org/10.1016/0009-2614(95)01036-9
48rot_au_to_SI = _e**2 * _hbar / _me * _a0 # 1 au = 1.6e-52 J C m / T
49rot_au_to_cgs = rot_au_to_SI / (1e-6 / _c) # 1 au = 4.7e-38 erg esu cm / gauss