data_management.generate_basis ============================== .. py:module:: data_management.generate_basis .. autoapi-nested-parse:: This script will loop over a series of basis sets and write out a file that will fill them in. Usage ----- :: usage: generate_basis.py [-h] [-r] [-a ATOMS_DIR] basis_set_source src_dir positional arguments: basis_set_source Source directory for basis set files. If combined with the "-r" flag, this directory will be recursively searched for basis sets. src_dir Destination directory for generated source files. options: -h, --help show this help message and exit -r, --recursive Toggle on recursive search through the basis set source directory. Default OFF. -a ATOMS_DIR, --atoms_dir ATOMS_DIR The path to where ElementNames.txt can be found. This script creates the following files based on the include and source directories given. The directories are not created by this script and must be present before running it. :: +---src_dir | \---bases | | basis_set_list.hpp | load_basis_sets.cpp Classes ------- .. autoapisummary:: data_management.generate_basis.Shell Functions --------- .. autoapisummary:: data_management.generate_basis._write_basis_files data_management.generate_basis._write_atomic_basis data_management.generate_basis._write_bases data_management.generate_basis._parse_bases_gbs data_management.generate_basis._parse_bases_nw data_management.generate_basis._parse_bases data_management.generate_basis.main data_management.generate_basis.parse_args Module Contents --------------- .. py:class:: Shell(ls: list, num_format: str = '.10e', is_pure=True) Class representing a shell for an element. .. py:attribute:: ls .. py:attribute:: exp :value: [] .. py:attribute:: coefs :value: [] .. py:attribute:: gen :value: 0 .. py:attribute:: number_format .. py:attribute:: shelltype .. py:method:: add_prim(exp: str, coefs: list) -> None Add a primitive for the shell. :param exp: Primitive exponent :type exp: str :param coefs: Primitive contraction coefficients :type coefs: list of str .. py:method:: cxxify(center: str, tab: str = ' ') -> str Create a C++ source representation of the shell. :param center: chemist::Center to add the shell to :type center: str :param tab: String representing a tab, defaults to " " :type tab: str, optional .. py:function:: _write_basis_files(src_dir: str, bs_name: str, basis_set: dict, tab: str = ' ') -> None .. py:function:: _write_atomic_basis(src_dir: str, tab: str, d_name: str, s_name: str, z: str, shells: str) -> None .. py:function:: _write_bases(src_dir: str, bases: dict, tab=' ') -> None Writes basis set data to C++ files. :param src_dir: Source directory for source files. :type src_dir: str :param bases: Collection of basis sets parsed from files :type bases: dict :param tab: String representing a tab, defaults to " " :type tab: str, optional .. py:function:: _parse_bases_gbs(basis_set_filenames: list, sym2Z: dict, l2num: function) -> dict Parses basis set files from the filepaths given. :param basis_set_filepaths: Full paths to basis set files. :type basis_set_filepaths: list :param sym2Z: Dictionary associating atomic symbols to atomic numbers :type sym2Z: dict :param l2num: Function associating orbital letters with a number :type l2num: function :return: Collection of basis sets and the supported elements of each. :rtype: dict .. py:function:: _parse_bases_nw(basis_set_filepaths: list, sym2Z: dict, l2num: function) -> dict Parses basis set files from the filepaths given. :param basis_set_filepaths: Full paths to basis set files. :type basis_set_filepaths: list :param sym2Z: Dictionary associating atomic symbols to atomic numbers :type sym2Z: dict :param l2num: Function associating orbital letters with a number :type l2num: function :return: Collection of basis sets and the supported elements of each. :rtype: dict .. py:function:: _parse_bases(basis_set_filepaths: list, sym2Z: dict, l2num: function, format: str = 'nwchem') -> dict Parse basis set files of the specified format. This function redirects to the correct parsing function based on the file format given. The data structure returned is a dict with basis set names as keys, effectively making a mapping from basis set names to basis sets. The basis set values are another dict with atomic numbers as keys and a list of Shell as the values. This makes a structure, `basis_sets`, where the basis for `Z` in `basis_name` can be accessed as: .. code-block:: Python list_of_shells = basis_sets[basis_name][Z] :param basis_set_filepaths: Full paths to basis set files. :type basis_set_filepaths: list of str :param sym2Z: Mapping from lowercased atomic symbols to atomic numbers :type sym2Z: dict :param l2num: Conversion function from shell symbol (s, p, d, f, etc) to the corresponding number (0, 1, 2, 3, etc) :type l2num: function :param format: File formatting to parse, defaults to "nwchem" :type format: str, optional :return: Basis sets parsed :rtype: dict :raises RuntimeError: Unsupported basis file format. .. py:function:: main(args: argparse.Namespace) -> None Entry point function to generate basis set files. :param args: Command line argument namespace :type args: argparse.Namespace .. py:function:: parse_args() -> argparse.Namespace Parse command line arguments. :return: Values of command line arguments. :rtype: argparse.Namespace