Skip to content

Commit d3843a1

Browse files
committed
Remove unit module; use scipy.constants
1 parent 4ffbb50 commit d3843a1

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

atomdb/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
from atomdb.version import *
2020

21-
from atomdb.units import *
22-
2321
from atomdb.api import *
2422

2523
from atomdb.promolecule import *

atomdb/datasets/nist/__init__.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515

1616
r"""NIST compile function."""
1717

18-
from tempfile import NamedTemporaryFile
19-
2018
import os
2119

2220
import numpy as np
2321

22+
from scipy import constants
23+
2424
import h5py as h5
2525

2626
import csv
@@ -88,6 +88,8 @@ def run(elem, charge, mult, nexc, dataset, datapath):
8888
if not mult == mults[0]:
8989
raise ValueError(f"{elem} with {charge} and multiplicity {mult} not available.")
9090
energy = energy[0]
91+
# Convert energy to Hartree from cm^{-1}
92+
energy *= 2 * constants.centi * constants.Rydberg
9193
elif -2 <= charge < 0:
9294
# Anions
9395
# Get the multiplicity (the one with lowest energy) from the corresponding neutral
@@ -125,13 +127,16 @@ def run(elem, charge, mult, nexc, dataset, datapath):
125127
table_mus = [row for row in table_mus if len(row[1]) > 0]
126128
table_etas = data[tabid[2] :]
127129
table_etas = [row for row in table_etas if len(row[1]) > 0]
128-
# Get property at table(natom, charge)
130+
# Get property at table(natom, charge); convert to Hartree
129131
colid = table_ips[0].index(str(charge))
130132
ip = float(table_ips[natom][colid]) if len(table_ips[natom][colid]) > 1 else None
133+
ip *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)
131134
colid = table_mus[0].index(str(charge))
132135
mu = float(table_mus[natom][colid]) if len(table_mus[natom][colid]) > 1 else None
136+
mu *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)
133137
colid = table_etas[0].index(str(charge))
134138
eta = float(table_etas[natom][colid]) if len(table_etas[natom][colid]) > 1 else None
139+
eta *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)
135140

136141
# Return Species instance
137142
return atomdb.Species(

0 commit comments

Comments
 (0)