File: hyperfine_21.py

package info (click to toggle)
gpaw 21.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,492 kB
  • sloc: python: 121,997; ansic: 14,138; sh: 1,125; csh: 139; makefile: 43
file content (16 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import numpy as np
from ase import Atoms
import ase.units as units
from gpaw import GPAW, PW
from gpaw.hyperfine import hyperfine_parameters

h = Atoms('H', magmoms=[1])
h.center(vacuum=3)
h.calc = GPAW(mode=PW(400), txt=None)
e = h.get_potential_energy()
A = hyperfine_parameters(h.calc)[0] * 5.586
a = np.trace(A) / 3
frequency = a * units._e / units._hplanck  # Hz
wavelength = units._c / frequency  # meters
print(f'{wavelength * 100:.1f} cm')
assert abs(wavelength - 0.232) < 0.0005