Skip to content

Commit

Permalink
Merge pull request #33 from msricher/fixnist
Browse files Browse the repository at this point in the history
Remove unit module; use scipy.constants
  • Loading branch information
gabrielasd authored Mar 9, 2024
2 parents 4ffbb50 + d3843a1 commit 83385a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 0 additions & 2 deletions atomdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

from atomdb.version import *

from atomdb.units import *

from atomdb.api import *

from atomdb.promolecule import *
Expand Down
11 changes: 8 additions & 3 deletions atomdb/datasets/nist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

r"""NIST compile function."""

from tempfile import NamedTemporaryFile

import os

import numpy as np

from scipy import constants

import h5py as h5

import csv
Expand Down Expand Up @@ -88,6 +88,8 @@ def run(elem, charge, mult, nexc, dataset, datapath):
if not mult == mults[0]:
raise ValueError(f"{elem} with {charge} and multiplicity {mult} not available.")
energy = energy[0]
# Convert energy to Hartree from cm^{-1}
energy *= 2 * constants.centi * constants.Rydberg
elif -2 <= charge < 0:
# Anions
# Get the multiplicity (the one with lowest energy) from the corresponding neutral
Expand Down Expand Up @@ -125,13 +127,16 @@ def run(elem, charge, mult, nexc, dataset, datapath):
table_mus = [row for row in table_mus if len(row[1]) > 0]
table_etas = data[tabid[2] :]
table_etas = [row for row in table_etas if len(row[1]) > 0]
# Get property at table(natom, charge)
# Get property at table(natom, charge); convert to Hartree
colid = table_ips[0].index(str(charge))
ip = float(table_ips[natom][colid]) if len(table_ips[natom][colid]) > 1 else None
ip *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)
colid = table_mus[0].index(str(charge))
mu = float(table_mus[natom][colid]) if len(table_mus[natom][colid]) > 1 else None
mu *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)
colid = table_etas[0].index(str(charge))
eta = float(table_etas[natom][colid]) if len(table_etas[natom][colid]) > 1 else None
eta *= constants.eV / (2 * constants.Rydberg * constants.h * constants.c)

# Return Species instance
return atomdb.Species(
Expand Down

0 comments on commit 83385a1

Please sign in to comment.