Developer API

api - The main API Module

Main interface to Basis Set Exchange internal basis sets

This module contains the interface for getting basis set data and references from the internal data store of basis sets. As much as possible, this is being kept separate from the typical reading/writing functionality of the library.

basis_set_exchange.api.filter_basis_sets(substr=None, family=None, role=None, elements=None, data_dir=None)

Filter basis sets by some criteria

All parameters are ANDed together and are not case sensitive.

Parameters:
  • substr (str) – Substring to search for in the basis set name

  • family (str) – Family the basis set belongs to

  • role (str) – Role of the basis set

  • elements (str or list) – List of elements that the basis set must include. Elements can be specified by Z-number (int or str) or by symbol (str). If this argument is a str (ie, ‘1-3,7-10’), it is expanded into a list. Z numbers and symbols (case insensitive) can be used interchangeably (see basis_set_exchange.misc.expand_elements())

  • data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

Returns:

Basis set metadata that matches the search criteria

Return type:

dict

basis_set_exchange.api.fix_data_dir(data_dir)

If data_dir is None, returns the default data_dir. Otherwise, returns the data_dir parameter unmodified

basis_set_exchange.api.get_all_basis_names(data_dir=None)

Obtain a list of all basis set names

The returned list is the internal representation of the basis set name.

The data is read from the METADATA.json file in the data directory.

Parameters:

data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

basis_set_exchange.api.get_basis(name, elements=None, version=None, fmt=None, uncontract_general=False, uncontract_spdf=False, uncontract_segmented=False, remove_free_primitives=False, make_general=False, optimize_general=False, augment_diffuse=0, augment_steep=0, get_aux=0, data_dir=None, header=True)

Obtain a basis set

This is the main function for getting basis set information. This function reads in all the basis data and returns it either as a string or as a python dictionary.

Parameters:
  • name (str) – Name of the basis set. This is not case sensitive.

  • elements (str or list) –

    List of elements that you want the basis set for. Elements can be specified by Z-number (int or str) or by symbol (str). If this argument is a str (ie, ‘1-3,7-10’), it is expanded into a list. Z numbers and symbols (case insensitive) can be used interchangeably (see basis_set_exchange.misc.expand_elements())

    If an empty string or list is passed, or if None is passed (the default), all elements for which the basis set is defined are included.

  • version (int or str) – Obtain a specific version of this basis set. By default, the latest version is returned.

  • fmt (str) –

    The desired output format of the basis set. By default, basis set information is returned as a python dictionary. Otherwise, if a format is specified, a string is returned. Use basis_set_exchange.api.get_formats() to programmatically obtain the available formats. The fmt argument is not case sensitive.

    Available formats are

    • bdf

    • gamess_us

    • gaussian94

    • json

    • nwchem

    • psi4

    • turbomole

  • uncontract_general (bool) – If True, remove general contractions by duplicating the set of primitive exponents with each vector of coefficients. Primitives with zero coefficient are removed, as are duplicate shells.

  • uncontract_spdf (bool) – If True, remove general contractions with combined angular momentum (sp, spd, etc) by duplicating the set of primitive exponents with each vector of coefficients. Primitives with zero coefficient are removed, as are duplicate shells.

  • uncontract_segmented (bool) – If True, remove segmented contractions by duplicating each primitive into new shells. Each coefficient is set to 1.0

  • make_general (bool) – If True, make the basis set as generally-contracted as possible. There will be one shell per angular momentum (for each element)

  • optimize_general (bool) – Optimize by removing general contractions that contain uncontracted functions (see basis_set_exchange.manip.optimize_general())

  • augment_diffuse (int) – Add n diffuse functions by even-tempered extrapolation

  • augment_steep (int) – Add n steep functions by even-tempered extrapolation

  • get_aux (int) – Instead of the orbital basis, get an auxiliary basis set. Options 0 (return orbital basis), 1 (return AutoAux basis), 2 (return Auto-ABS Coulomb fitting basis)

  • data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

Returns:

The basis set in the desired format. If fmt is None, this will be a python dictionary. Otherwise, it will be a string.

Return type:

str or dict

basis_set_exchange.api.get_basis_family(basis_name, data_dir=None)

Lookup a family by a basis set name

basis_set_exchange.api.get_data_dir()

Get the default data directory of this installation

basis_set_exchange.api.get_formats(function_types=None)

Return information about the basis set formats available

The returned data is a map of format to display name. The format can be passed as the fmt argument to get_basis()

If a list is specified for function_types, only those formats supporting the given function types will be returned.

basis_set_exchange.api.get_reference_formats()

Return information about the reference/citation formats available

The returned data is a map of format to display name. The format can be passed as the fmt argument to get_references()

basis_set_exchange.api.get_references(basis_name, elements=None, version=None, fmt=None, data_dir=None)

Get the references/citations for a basis set

Parameters:
  • basis_name (str) – Name of the basis set. This is not case sensitive.

  • elements (list) – List of element numbers that you want the basis set for. By default, all elements for which the basis set is defined are included.

  • version (int) – Obtain a specific version of this basis set. By default, the latest version is returned.

  • fmt (str) –

    The desired output format of the basis set references. By default, basis set information is returned as a list of dictionaries. Use get_reference_formats() to programmatically obtain the available formats. The fmt argument is not case sensitive.

    Available reference formats are

    • bib

    • txt

    • json

  • data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

Returns:

The references for the given basis set in the desired format. If fmt is None, this will be a python dictionary. Otherwise, it will be a string.

Return type:

str or dict

basis_set_exchange.api.get_roles()

Return information about the available basis set roles available

The returned data is a map of role to display name. The format can be passed as the role argument to fmt argument to lookup_basis_by_role()

basis_set_exchange.api.lookup_basis_by_role(primary_basis, role, data_dir=None)

Lookup the name of an auxiliary basis set given a primary basis set and role

Parameters:
  • primary_basis (str) – The primary (orbital) basis set that we want the auxiliary basis set for. This is not case sensitive.

  • role (str) –

    Desired role/type of auxiliary basis set. Use get_roles() to programmatically obtain the available roles. The role argument is not case sensitive.

    Available roles are

    • jfit

    • jkfit

    • rifit

    • optri

    • admmfit

    • dftxfit

    • dftjfit

    • guess

  • data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

Returns:

The name of the auxiliary basis set for the given primary basis and role.

Return type:

str

basis_set_exchange.api.version()

Obtain the version of the basis set exchange library (as a string)

bundle - Creation of bundles/archives

Functions for creating archives of all basis sets

basis_set_exchange.bundle.create_bundle(outfile, fmt, reffmt, archive_type=None, data_dir=None)

Create a single archive file containing all basis sets in a given format

Parameters:
  • outfile (str) – Path to the file to create. Existing files will be overwritten

  • fmt (str) – Format of the basis set to archive (nwchem, turbomole, …)

  • reffmt (str) – Format of the basis set references to archive (nwchem, turbomole, …)

  • archive_type (str) – Type of archive to create. Can be ‘zip’ or ‘tbz’. Default is None, which will autodetect based on the outfile name

  • data_dir (str) – Data directory with all the basis set information. By default, it is in the ‘data’ subdirectory of this project.

Return type:

None

basis_set_exchange.bundle.get_archive_types()

Return information related to the types of archives available

compose - Composition of basis set information

Functions related to composing basis sets from individual components

basis_set_exchange.compose.compose_elemental_basis(file_relpath, data_dir)

Creates an ‘elemental’ basis from an elemental json file

This function reads the info from the given file, and reads all the component basis set information from the files listed therein. It then composes all the information together into one ‘elemental’ basis dictionary

convert - Conversion of formatted basis set data/files

Functions for basis set conversion

basis_set_exchange.convert.convert_formatted_basis_file(file_path_in, file_path_out, in_fmt=None, out_fmt=None, encoding='utf-8-sig', make_gen=False)

Convert a formatted basis set file to another format

Parameters:
  • file_path_in (str) – Path to the file to be read

  • file_path_out (str) – Path to the file to be written.

  • in_fmt (str) – The format of the basis to be read. If None, it is detected from the file name

  • out_fmt (str) – The format of the basis to be written. If None, it is detected from the file name

  • encoding (str) – The encoding of the input file

Returns:

The basis set as a str with the new format

Return type:

str

basis_set_exchange.convert.convert_formatted_basis_str(basis_in, in_fmt, out_fmt)

Convert a formatted basis set to another format

Parameters:
  • basis_in (str) – String representing the formatted input basis set input

  • in_fmt (str) – The format of the basis set stored in basis_in

  • out_fmt (str) – The desired output format

Returns:

The basis set as a str with the new format

Return type:

str

fileio - Input/Output of files (including json)

Functions for reading and writing the standard JSON-based basis set format

basis_set_exchange.fileio.get_all_filelist(data_dir)

Returns a tuple containing the following (as lists)

  1. All metadata files

  2. All table basis files

  3. All element basis files

  4. All component basis files

The paths to all the files are returned as paths relative to data_dir

basis_set_exchange.fileio.read_json_basis(file_path)

Reads generic basis set information from a JSON file

After reading, the MolSSI BSE schema information is searched for and if not found, an exception is raised.

This function works with basis set metadata, table, element, and json files.

Parameters:

file_path (str) – Full path to the file to read

basis_set_exchange.fileio.read_metadata(file_path)

Reads a file containing the metadata for all the basis sets

Parameters:

file_path (str) – Full path to the file to read

basis_set_exchange.fileio.read_notes_file(file_path)

Returns the contents of a notes file.

If the notes file does not exist, None is returned

basis_set_exchange.fileio.read_references(file_path)

Read a JSON file containing info for all references

Parameters:

file_path (str) – Full path to the file to read

basis_set_exchange.fileio.read_schema(file_path)

Reads a JSON schema file

Parameters:

file_path (str) – Full path to the file to read

basis_set_exchange.fileio.write_json_basis(file_path, bs)

Write basis set information to a JSON file

This function works with basis set metadata, table, element, and json files.

Parameters:
  • file_path (str) – Full path to the file to write to. It will be overwritten if it exists

  • bs (dict) – Basis set information to write

basis_set_exchange.fileio.write_metadata(file_path, metadata)

Reads a file containing the metadata for all the basis sets

Parameters:
  • file_path (str) – Full path to the file to write to. It will be overwritten if it exists

  • metadata (dict) – Metadata information for all basis sets

basis_set_exchange.fileio.write_references(file_path, refs)

Write a dict containing info for all references to a JSON file

Parameters:
  • file_path (str) – Full path to the file to write to. It will be overwritten if it exists

  • refs (dict) – Reference information to write

lut - Lookup tables element information

Functions for looking up element names, numbers, and symbols and for converting between angular momentum conventions

This module has functions for looking up element information by symbol, name, or number. It also has functions for converting angular momentum between integers (0, 1, 2) and letters (s, p, d).

basis_set_exchange.lut.all_element_names()

Obtain a list of the names of all the elements

basis_set_exchange.lut.amchar_to_int(amchar, hij=False)

Convert an angular momentum integer to a character

The return value is a list of integers (to handle sp, spd, … orbitals)

For example, converts ‘p’ to [1] and ‘sp’ to [0,1]

If hij is True, the ordering spdfghijkl is used. Otherwise, the ordering will be spdfghikl (skipping j)

basis_set_exchange.lut.amint_to_char(am, hij=False, use_L=False)

Convert an angular momentum integer to a character

The input is a list (to handle sp, spd, … orbitals). The return value is a string

For example, converts [0] to ‘s’ and [0,1,2] to ‘spd’

If hij is True, the ordering spdfghijkl is used. Otherwise, the ordering will be spdfghikl (skipping j)

If use_L is True, sp shells ([0,1]) will return l instead

basis_set_exchange.lut.electron_shells_start(nelectrons, max_am=20)

Return the starting principle quantum numbers of electron shells

For example, an ECP covering 10 electrons will covers 1s, 2s, 2p shells. The electrons shells will then start at 3s, 3p, 3d, and 4f (returned as [3, 3, 3, 4])

If an ECP covers 30 electrons, then the shells will start at [5, 4, 4, 4]

Only fully-covered shells are counted. If a shell is partly covered, an exception is raised.

The returned list is extended up to max_am.

Note: Since the main use of this is for ECPs, we only cover what can really be found on the periodic table. No excited states!

Parameters:
  • nelectrons (int) – Number of electrons covered by an ECP

  • max_am (int) – Fill out the starting principal quantum numbers up to this am

Returns:

The starting principal quantum numbers of s, p, d, and f shells.

Return type:

list

basis_set_exchange.lut.element_Z_from_name(name, as_str=False)

Obtain an element’s Z number given its name

If as_str is True, then a string is returned (ie, ‘1’ for Hydrogen)

An exception is thrown if the name is not found

basis_set_exchange.lut.element_Z_from_sym(sym, as_str=False)

Obtain an element’s Z-number given its symbol

If as_str is True, then a string is returned (ie, ‘1’ for Hydrogen)

An exception is thrown if the symbol is not found

basis_set_exchange.lut.element_data_from_Z(Z)

Obtain elemental data given a Z number

An exception is thrown if the Z number is not found

basis_set_exchange.lut.element_data_from_name(name)

Obtain elemental data given an elemental name

The given name is not case sensitive

An exception is thrown if the name is not found

basis_set_exchange.lut.element_data_from_sym(sym)

Obtain elemental data given an elemental symbol

The given symbol is not case sensitive

An exception is thrown if the symbol is not found

basis_set_exchange.lut.element_name_from_Z(Z, normalize=False)

Obtain an element’s name from its Z number

An exception is thrown if the Z number is not found

If normalize is True, the first letter will be capitalized

basis_set_exchange.lut.element_sym_from_Z(Z, normalize=False)

Obtain an element’s symbol from its Z number

An exception is thrown if the Z number is not found

If normalize is True, the first letter will be capitalized

manip - Manipulation of basis sets

Common basis set manipulations

This module contains functions for uncontracting and merging basis set data, as well as some other small functions.

basis_set_exchange.manip.autoabs_basis(basis, lmaxinc=1, fsam=1.5)

Create a Coulomb fitting basis set for the given orbital basis set.

See also

R. Yang, A. P. Rendell, and M. J. Frisch
‘Automatically generated Coulomb fitting basis sets:
Design and accuracy for systems containing H to Kr’
J. Chem. Phys. 127, 074102 (2007)
Parameters:

basis (dict) – Orbital basis set dictionary for which to generate the auxiliary basis

basis_set_exchange.manip.autoaux_basis(basis)

Create an auxiliary basis set for the given orbital basis set for use with the resolution of the identity approximation. This is a simplified version of the routine where the electrons potentially contained in the ECP are disregarded, leading to slightly larger (but more accurate) auxiliary sets.

See also

G. L. Stoychev, A. A. Auer, and F. Neese
‘Automatic Generation of Auxiliary Basis Sets’
J. Chem. Theory Comput. 13, 554 (2017)
basisdict

Orbital basis set dictionary for which to generate the auxiliary basis

basis_set_exchange.manip.create_element_data(bs_data, element_Z, key, key_exist_ok=False, element_exist_ok=True, create=<class 'list'>)

Creates an element and a subkey of the element in bs_data

Note that bs_data is modified!

basis_set_exchange.manip.geometric_augmentation(basis, nadd, use_copy=True, as_component=False, steep=False)

Extends a basis set by adding extrapolated diffuse or steep functions.

For augmented Dunning sets (aug), the diffuse augmentation corresponds to multiple augmentation (aug -> daug, taug, …).

In order for the augmentation to make sense, the two outermost primitives have to be free i.e. uncontracted.

Parameters:
  • basis (dict) – Basis set dictionary to work with

  • nadd (int) – Number of functions to add (must be >=1). For diffuse augmentation on an augmented set: 1 -> daug, 2 -> taug, etc

  • use_copy (bool) – If True, the input basis set is not modified.

  • steep (bool) – If True, the augmentation is done for steep functions instead of diffuse functions.

basis_set_exchange.manip.make_general(basis, skip_spdf=False, use_copy=True)

Makes one large general contraction for each angular momentum

If use_copy is True, the input basis set is not modified.

The output of this function is not pretty. If you want to make it nicer, use sort_basis afterwards.

basis_set_exchange.manip.merge_element_data(dest, sources, use_copy=True)

Merges the basis set data for an element from multiple sources into dest.

The destination is not modified, and a (shallow) copy of dest is returned with the data from sources added.

If use_copy is True, then the data merged into dest will be a (deep) copy of that found in sources. Otherwise, data may be shared between dest and sources

basis_set_exchange.manip.optimize_general(basis, use_copy=True)

Optimizes the general contraction using the method of Hashimoto et al

See also

T. Hashimoto, K. Hirao, H. Tatewaki
‘Comment on Dunning’s correlation-consistent basis set’
Chemical Physics Letters v243, Issues 1-2, pp, 190-192 (1995)
basis_set_exchange.manip.prune_basis(basis, use_copy=True)

Removes primitives that have a zero coefficient, and removes duplicate primitives and shells

This only finds EXACT duplicates, and is meant to be used after other manipulations

If use_copy is True, the input basis set is not modified.

basis_set_exchange.manip.prune_shell(shell, use_copy=True)

Removes exact duplicates of primitives, and condenses duplicate exponents into general contractions

Also removes primitives if all coefficients are zero

basis_set_exchange.manip.remove_free_primitives(basis, use_copy=True)

Removes any free primitives from a basis set as a way to generate a minimal basis

The input basis set is not modified. The returned basis may have functions with coefficients of zero and may have duplicate shells.

If use_copy is True, the input basis set is not modified.

basis_set_exchange.manip.remove_primitive(electron_shell, idx_to_remove)

Removes a primitive (by index) of a electron_shell

The electron_shell passed in is modified

basis_set_exchange.manip.truhlar_calendarize(basis, month, use_copy=True)

Create the truhlar “month” basis sets from the corresponding aug basis set

In Papajak 2011, removal of diffuse function stopped before removal of s and p functions. This, conceivably, extends to d functions for transition metals. However, you can keep extending to further in the year by removing these functions, although it may affect stability. This is implemented in Gaussian with the t(month) basis sets - tjul, tjun, etc. The ‘tmonth’ and regular ‘month’ basis sets are equivalent until the ‘maug’ basis set is reached (containg no diffuse functions on H,He, s,p,d on transition metals, and s, p on other elements).

Since the regular ‘month’ basis sets are equivalent until maug, we do not adopt the t(month) nomenclature. Instead, you can just go further backwards through the months until you run out of diffuse functions or run out of months.

Parameters:
  • basis (dict) – Basis set dictionary to work with

  • month (str) – Month to create (‘apr’, ‘jul’, etc). Not case sensitive

  • use_copy (bool) – If True, the input basis set is not modified.

basis_set_exchange.manip.uncontract_general(basis, use_copy=True)

Removes the general contractions from a basis set

The input basis set is not modified. The returned basis may have functions with coefficients of zero and may have duplicate shells.

If use_copy is True, the input basis set is not modified.

basis_set_exchange.manip.uncontract_segmented(basis, use_copy=True)

Removes the segmented contractions from a basis set

This implicitly removes general contractions as well, but will leave sp, spd, … orbitals alone

The input basis set is not modified. The returned basis may have functions with coefficients of zero and may have duplicate shells.

If use_copy is True, the input basis set is not modified.

basis_set_exchange.manip.uncontract_spdf(basis, max_am=0, use_copy=True)

Removes sp, spd, spdf, etc, contractions from a basis set

The general contractions are replaced by uncontracted versions

Contractions up to max_am will be left in place. For example, if max_am = 1, spd will be split into sp and d

The input basis set is not modified. The returned basis may have functions with coefficients of zero and may have duplicate shells.

If use_copy is True, the input basis set is not modified.

memo - Custom memoization decorator

Class/decorator for memoizing BSE functionality

misc - Miscellaneous helper functions

Miscellaneous helper functions

basis_set_exchange.misc.basis_name_from_filename(filename)

Given a basis set name that was part of a filename, determine the basis set name

This is opposite of transform_basis_name()

Pass only the part of the filename that contains the basis set name

basis_set_exchange.misc.basis_name_to_filename(name)

Given a basis set name, transform it into a valid filename

This makes sure filenames don’t contain invalid characters

basis_set_exchange.misc.compact_elements(elements)

Create a string (with ranges) given a list of element numbers

For example, [1, 2, 3, 6, 7, 8, 10] will return “H-Li,C-O,Ne”

basis_set_exchange.misc.contraction_string(element, compact=False)

Forms a string specifying the contractions for an element

ie, (16s,10p) -> [4s,3p] or, if compact=True, 16s10p.4s3p

basis_set_exchange.misc.expand_elements(compact_el, as_str=False)

Create a list of integers given a string or list of compacted elements

This is partly the opposite of compact_elements, but is more flexible.

compact_el can be a list or a string. If compact_el is a list, each element is processed individually as a string (meaning list elements can contain commas, ranges, etc) If compact_el is a string, it is split by commas and then each section is processed.

In all cases, element symbols (case insensitive) and Z numbers (as integers or strings) can be used interchangeably. Ranges are also allowed in both lists and strings.

Some examples:

“H-Li,C-O,Ne” will return [1, 2, 3, 6, 7, 8, 10] “H-N,8,Na-12” will return [1, 2, 3, 4, 5, 6, 7, 8, 11, 12] [‘C’, ‘Al-15,S’, 17, ‘18’] will return [6, 13, 14, 15, 16, 17, 18]

If as_str is True, the list will contain strings of the integers (ie, the first example above will return [‘1’, ‘2’, ‘3’, ‘6’, ‘7’, ‘8’, ‘10’]

basis_set_exchange.misc.max_am(shells)

Determine the maximum angular momentum of a list of shells or potentials

basis_set_exchange.misc.transform_basis_name(name)

Transforms the name of a basis set to an internal representation

This makes comparison of basis set names easier by, for example, converting the name to all lower case.

basis_set_exchange.misc.transpose_matrix(mat)

Transposes a matrix (list of lists) commonly done do coefficients

notes - Handling of notes

Functionality for handling basis set and family notes

basis_set_exchange.notes.process_notes(notes, ref_data)

Add reference information to the bottom of a notes file

:ref: tags are removed and the actual reference data is appended

printing - Functions for printing/outputting pieces of basis sets

Helpers for printing pieces of basis sets

basis_set_exchange.printing.component_basis_str(basis, elements=None)

Print a component basis set

If elements is not None, only the specified elements will be printed (see bse.misc.expand_elements())

basis_set_exchange.printing.ecp_pot_str(pot)

Return a string representing the data for an ECP potential

basis_set_exchange.printing.electron_shell_str(shell, shellidx=None)

Return a string representing the data for an electron shell

If shellidx (index of the shell) is not None, it will also be printed

basis_set_exchange.printing.element_data_str(z, eldata)

Return a string with all data for an element

This includes shell and ECP potential data

Parameters:
  • z (int or str) – Element Z-number

  • eldata (dict) – Data for the element to be printed

references - Handling of reference data

Some helper functions related to handling of references/citations

basis_set_exchange.references.compact_references(basis_dict, ref_data)

Creates a mapping of elements to reference keys

A list is returned, with each element of the list being a dictionary with entries ‘reference_info’ containing data for (possibly) multiple references, and ‘elements’ which is a list of element Z numbers that those references apply to

Parameters:
  • basis_dict (dict) – Dictionary containing basis set information

  • ref_data (dict) – Dictionary containing all reference information

basis_set_exchange.references.reference_text(key, ref)

Convert a single reference to plain text format

Parameters:
  • key (str) – Reference key (authorname2009a, etc)

  • ref (dict) – Information about a single reference

skel - Creating of python object skeletons of basis set data

Functions for creating skeletons of dictionaries/JSON files

basis_set_exchange.skel.create_skel(role)

Create the skeleton of a dictionary or JSON file

A dictionary is returned that contains the “molssi_bse_schema” key and other required keys, depending on the role

role can be either ‘component’, ‘element’, or ‘table’

sort - Sorting of basis set data

Sorting of BSE related dictionaries and data

basis_set_exchange.sort.sort_basis(basis, use_copy=True)

Sorts all the information in a basis set into a standard order

If use_copy is True, the input basis set is not modified.

basis_set_exchange.sort.sort_basis_dict(bs)

Sorts a basis set dictionary into a standard order

This, for example, allows the written file to be more easily read by humans by, for example, putting the name and description before more detailed fields.

This is generally for cosmetic reasons. However, users will generally like things in a consistent order

basis_set_exchange.sort.sort_potentials(potentials, use_copy=True)

Sort a list of ECP potentials into a standard order

The order within a potential is not modified.

The order of the shell list is in increasing angular momentum, with the largest angular momentum being moved to the front.

If use_copy is True, the input potentials are not modified.

basis_set_exchange.sort.sort_references_dict(refs)

Sorts a reference dictionary into a standard order

The keys of the references are also sorted, and the keys for the data for each reference are put in a more canonical order.

basis_set_exchange.sort.sort_shell(shell, use_copy=True)

Sort a basis set shell into a standard order

If use_copy is True, the input shells are not modified.

basis_set_exchange.sort.sort_shells(shells, use_copy=True)

Sort a list of basis set shells into a standard order

The order within a shell is by decreasing value of the exponent.

The order of the shell list is in increasing angular momentum, and then by decreasing number of primitives, then decreasing value of the largest exponent.

If use_copy is True, the input shells are not modified.

basis_set_exchange.sort.sort_single_reference(ref_entry)

Sorts a dictionary containing data for a single reference into a standard order

validator - Validation of basis sets

Functions related to validating JSON files (including against schema)

basis_set_exchange.validator.validate_data(file_type, bs_data)

Validates json basis set data against a schema

Parameters:
  • file_type (str) – Type of the data to validate. May be ‘component’, ‘element’, ‘table’, ‘complete’, ‘minimal’, or ‘references’

  • bs_data – Data to be validated

Raises:
  • RuntimeError – If the file_type is not valid (and/or a schema doesn’t exist)

  • ValidationError – If the given file does not pass validation

  • FileNotFoundError – If the file given by file_path doesn’t exist

basis_set_exchange.validator.validate_data_dir(data_dir)

Validates all files in a data_dir

basis_set_exchange.validator.validate_file(file_type, file_path)

Validates a file against a schema

Parameters:
  • file_type (str) – Type of file to read. May be ‘component’, ‘element’, ‘table’, ‘complete’, ‘minimal’, or ‘references’

  • file_path – Full path to the file to be validated

Raises:
  • RuntimeError – If the file_type is not valid (and/or a schema doesn’t exist)

  • ValidationError – If the given file does not pass validation

  • FileNotFoundError – If the file given by file_path doesn’t exist