File: hyperfine_csv.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 (10 lines) | stat: -rw-r--r-- 379 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
# creates: g-factors.csv
from math import pi
import ase.units as units
from gpaw.hyperfine import gyromagnetic_ratios

with open('g-factors.csv', 'w') as fd:
    print('Nucleus, g-factor', file=fd)
    for symbol, (n, ratio) in gyromagnetic_ratios.items():
        g = ratio * 1e6 * 4 * pi * units._mp / units._e
        print(f'":math:`^{{{n}}}`\\ {symbol}", {g:.3f}', file=fd)