atomdb.species module

AtomDB, a database of atomic and ionic properties.

atomdb.species.default_required(name, typeof)

Default factory for required fields.

atomdb.species.default_vector()

Default factory for 1-dimensional np.ndarray.

atomdb.species.default_matrix()

Default factory for 2-dimensional np.ndarray.

atomdb.species.scalar(method)

Expose a SpeciesData field.

atomdb.species.spline(method)

Expose a SpeciesData field via the DensitySpline interface.

class atomdb.species.DensitySpline(x, y, log=False)

Bases: object

Interpolate density using a cubic spline over a 1-D grid.

Initialize the CubicSpline instance.

class atomdb.species.JSONEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)

Bases: JSONEncoder

JSON encoder handling simple numpy.ndarray objects.

Constructor for JSONEncoder, with sensible defaults.

If skipkeys is false, then it is a TypeError to attempt encoding of keys that are not str, int, float or None. If skipkeys is True, such items are simply skipped.

If ensure_ascii is true, the output is guaranteed to be str objects with all incoming non-ASCII characters escaped. If ensure_ascii is false, the output can contain non-ASCII characters.

If check_circular is true, then lists, dicts, and custom encoded objects will be checked for circular references during encoding to prevent an infinite recursion (which would cause an RecursionError). Otherwise, no such check takes place.

If allow_nan is true, then NaN, Infinity, and -Infinity will be encoded as such. This behavior is not JSON specification compliant, but is consistent with most JavaScript based encoders and decoders. Otherwise, it will be a ValueError to encode such floats.

If sort_keys is true, then the output of dictionaries will be sorted by key; this is useful for regression tests to ensure that JSON serializations can be compared on a day-to-day basis.

If indent is a non-negative integer, then JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0 will only insert newlines. None is the most compact representation.

If specified, separators should be an (item_separator, key_separator) tuple. The default is (‘, ‘, ‘: ‘) if indent is None and (‘,’, ‘: ‘) otherwise. To get the most compact JSON representation, you should specify (‘,’, ‘:’) to eliminate whitespace.

If specified, default is a function that gets called for objects that can’t otherwise be serialized. It should return a JSON encodable version of the object or raise a TypeError.

default(obj)

Default encode function.

encode(o)

Return a JSON string representation of a Python data structure.

>>> from json.encoder import JSONEncoder
>>> JSONEncoder().encode({"foo": ["bar", "baz"]})
'{"foo": ["bar", "baz"]}'
item_separator = ', '
iterencode(o, _one_shot=False)

Encode the given object and yield each string representation as available.

For example:

for chunk in JSONEncoder().iterencode(bigobject):
    mysocket.write(chunk)
key_separator = ': '
class atomdb.species.SpeciesData(elem=<factory>, atnum=<factory>, nelec=<factory>, nspin=<factory>, nexc=<factory>, atmass=None, cov_radius=None, vdw_radius=None, at_radius=None, polarizability=None, dispersion=None, energy=None, ip=None, mu=None, eta=None, obasis_name=None, rs=<factory>, mo_energy_a=<factory>, mo_energy_b=<factory>, mo_occs_a=<factory>, mo_occs_b=<factory>, mo_dens_a=<factory>, mo_dens_b=<factory>, dens_tot=<factory>, mo_d_dens_a=<factory>, mo_d_dens_b=<factory>, d_dens_tot=<factory>, mo_dd_dens_a=<factory>, mo_dd_dens_b=<factory>, dd_dens_tot=<factory>, mo_ked_a=<factory>, mo_ked_b=<factory>, ked_tot=<factory>)

Bases: object

Database entry fields for atomic and ionic species.

elem: str
atnum: int
nelec: int
nspin: int
nexc: int
atmass: float = None
cov_radius: float = None
vdw_radius: float = None
at_radius: float = None
polarizability: float = None
dispersion: float = None
energy: float = None
ip: float = None
mu: float = None
eta: float = None
obasis_name: str = None
rs: ndarray
mo_energy_a: ndarray
mo_energy_b: ndarray
mo_occs_a: ndarray
mo_occs_b: ndarray
mo_dens_a: ndarray
mo_dens_b: ndarray
dens_tot: ndarray
mo_d_dens_a: ndarray
mo_d_dens_b: ndarray
d_dens_tot: ndarray
mo_dd_dens_a: ndarray
mo_dd_dens_b: ndarray
dd_dens_tot: ndarray
mo_ked_a: ndarray
mo_ked_b: ndarray
ked_tot: ndarray
class atomdb.species.Species(dataset, fields, spinpol=1)

Bases: object

Properties of atomic and ionic species.

Initialize a Species instance.

get_docstring()

Docstring of the species’ dataset.

to_dict()

Return the dictionary representation of the Species instance.

to_json()

Return the JSON string representation of the Species instance.

property dataset

Dataset.

property charge

Charge.

property nspin

Spin number \(N_S = N_α - N_β\).

property mult

Multiplicity \(M = \left|N_S\right| + 1\).

property spinpol

Spin polarization direction (±1) of the species.

property elem
property obasis_name
property atnum
property nelec
property atmass
property cov_radius
property vdw_radius
property at_radius
property polarizability
property dispersion_c6

Isolated atom C6 dispersion coefficients.

property nexc
property energy
property ip
property mu
property eta
dens_func(spin='t', index=None, log=False)
d_dens_func(spin='t', index=None, log=False)
dd_dens_func(spin='t', index=None, log=False)
ked_func(spin='t', index=None, log=False)
atomdb.species.compile(elem, charge, mult, nexc=0, dataset='slater', datapath='/home/runner/work/AtomDB/AtomDB/atomdb/datasets')

Compile an atomic or ionic species into the AtomDB database.

atomdb.species.dump(*species, datapath='/home/runner/work/AtomDB/AtomDB/atomdb/datasets')

Dump the Species instance(s) to a MessagePack file in the database.

atomdb.species.load(elem, charge, mult, nexc=0, dataset='slater', datapath='/home/runner/work/AtomDB/AtomDB/atomdb/datasets', remotepath='https://raw.githubusercontent.com/theochem/AtomDBdata/main/')

Load one or many atomic or ionic species from the AtomDB database.

atomdb.species.datafile(elem, charge, mult, nexc=0, dataset='slater', datapath='/home/runner/work/AtomDB/AtomDB/atomdb/datasets', remotepath='https://raw.githubusercontent.com/theochem/AtomDBdata/main/')

Return the name of the database file for a species.

This function returns the local path to the database file of a species in the AtomDB cache. If the file is not found, it is downloaded from the remote URL.

Parameters
  • elem (str | Ellipsis) – Element symbol or Ellipsis for wildcard.

  • charge (int | Ellipsis) – Charge or Ellipsis for wildcard.

  • mult (int | Ellipsis) – Multiplicity or Ellipsis for wildcard.

  • nexc (int, optional) – Excitation level, by default 0.

  • dataset (str, optional) – Dataset name, by default DEFAULT_DATASET.

  • datapath (str, optional) – Path to the local AtomDB cache, by default DEFAULT_DATAPATH variable value.

  • remotepath (str, optional) – Remote URL for AtomDB datasets, by default DEFAULT_REMOTE variable value

atomdb.species.raw_datafile(suffix, elem, charge, mult, nexc=0, dataset='slater', datapath='/home/runner/work/AtomDB/AtomDB/atomdb/datasets', remotepath='https://raw.githubusercontent.com/theochem/AtomDBdata/main/')

Returns the local path to the raw data file of a species

This function retrieves the raw data file of a species from the AtomDB cache if present. If the file is not found, it is downloaded from the remote URL.

Parameters
  • suffix (str) – File extension of the raw data file.

  • elem (str) – Element symbol.

  • charge (int) – Charge.

  • mult (int) – Multiplicity.

  • nexc (int, optional) – Excitation level, by default 0.

  • dataset (str, optional) – Dataset name, by default DEFAULT_DATASET.

  • datapath (str, optional) – Path to the local AtomDB cache, by default DEFAULT_DATAPATH variable value.

  • remotepath (str, optional) – Remote URL for AtomDB datasets, by default DEFAULT_REMOTE variable value.

Returns

Path to the raw data file.

Return type

str