Coverage for strongcoca / units.py: 100%

29 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-04-15 18:15 +0000

1# This module contains components adapted from GPAW: 

2# gpaw.tddft.units 

3# https://gitlab.com/gpaw/gpaw/-/blob/aca9ed6f520d6a855013247119b50c630f5eebc9/gpaw/tddft/units.py 

4import numpy as np 

5 

6from ase.units import Hartree, Bohr, _hbar, _eps0, _me, _e, alpha 

7 

8 

9# Conversion factors between atomic units and eV/as 

10_autime: float = _hbar**3 * (4 * np.pi * _eps0)**2 / (_me * _e**4) 

11 

12au_to_as: float = _autime / 1e-18 

13"""Atomic unit of time to attoseconds.""" 

14as_to_au: float = 1 / au_to_as 

15"""Attoseconds to atomic unit of time.""" 

16au_to_fs: float = _autime / 1e-15 

17"""Atomic unit of time to femtoseconds.""" 

18fs_to_au: float = 1 / au_to_fs 

19"""Femtoseconds to atomic unit of time.""" 

20 

21au_to_eV: float = Hartree 

22"""Hartree to eV.""" 

23eV_to_au: float = 1 / au_to_eV 

24"""eV to Hartree.""" 

25 

26au_to_A: float = Bohr 

27"""Bohr radius to Å.""" 

28A_to_au: float = 1 / au_to_A 

29"""Å to Bohr radius.""" 

30 

31au_to_eA: float = Bohr * 1 

32"""Atomic unit of dipole moment to eÅ.""" 

33eA_to_au: float = 1 / au_to_eA 

34"""eÅ to atomic unit of dipole moment.""" 

35 

36# force 

37au_to_eVA: float = Hartree / Bohr 

38"""Atomic unit of force to eV/Å.""" 

39eVA_to_au: float = 1 / au_to_eVA 

40"""eV/Å to atomic unit of force.""" 

41 

42au_to_k: float = alpha 

43"""Atomic unit of frequency to Atomic unit of wavevector."""