basis_info
The BasisInfo class holds ML-relevant information about the basis.
- class BasisInfo(atomic_numbers: ndarray[uint8], basis_dict: dict[str, list | str], irreps_per_atom: ndarray[Irreps] | list[Irreps | str], integrals: ndarray[ndarray] | list[ndarray])[source]
Information about an OF basis for the LCAB Ansatz (see
, but the attribute :attr:`basis_dictcan be passed topyscf.gto.Moleas thebasiskeyword to construct a pyscf molecule.- atomic_numbers
Atomic numbers of the atom types in the basis. Shape (n_atom_types,).
- basis_dict
Dict of basis sets for each atom type, compatible with pyscf. Length n_atom_types.
- basis_dim_per_atom
Number of basis functions per atom type. Shape (n_atom_types,).
- irreps_per_atom
Irreps of the basis functions per atom type. Shape (n_atom_types,).
- atomic_number_to_atom_index
Mapping from atomic number to atom type index in the basis. Shape (max(atomic_numbers)+1,). e.g. for H, C, O: [-1, 0, -1, -1, -1, -1, 1, -1, 2]
- integrals
Integrals over the basis functions. Array of arrays of length n_atom_types.
- atom_ind_to_basis_function_ind
Mapping list from the atomic number index in the basis to index basis function indices of a concatenated basis function array. e.g. for H, C, O and basis dimensions 4, 5, 9: [[0,1,2,3], [4,5,6,7,8], [9,10,11,12,13,14,15,16,17]]
- l_per_basis_func
Orbital number l for each basis function. Shape (n_basis,).
- m_per_basis_func
Orbital number m for each basis function. Shape (n_basis,).
- shell_beginning_mask
Mask with ones at the beginning of each shell. Shape (n_basis,).
- basis_func_to_shell
Mapping from basis function index to shell index. Shape (n_basis,).
- shell_to_first_basis_func
Mapping from shell index to beginning of basis functions in that shell. Shape (n_shells,).
- n_shells_per_atom
Number of shells per atom type. Shape (n_atom_types,).
- l_per_shell
Orbital number l for each shell. Shape (n_shells,).
- m_per_shell
Orbital number m for each shell. Shape (n_shells,).
Warning
This is most likely only correct after transforming into the e3nn convention (and otherwise wrong for l=1).
- __init__(atomic_numbers: ndarray[uint8], basis_dict: dict[str, list | str], irreps_per_atom: ndarray[Irreps] | list[Irreps | str], integrals: ndarray[ndarray] | list[ndarray]) None[source]
Initialize the BasisInfo object.
- Parameters:
atomic_numbers – Atomic numbers of the atoms in the basis. Shape (n_atom_types,).
basis_dict – Dict of basis sets for each atom. Length {n_atom_types}.
irreps_per_atom – Irreps of the basis functions per atom. Shape (n_atom_types,).
integrals – Integrals over the basis functions. List of (n_atom_types,).
- classmethod from_atomic_numbers_with_even_tempered_basis(atomic_numbers: list[int] | ndarray, basis: str = '6-31G(2df,p)', beta: float = 2.5) BasisInfo[source]
Construct a BasisInfo object from a list of atomic numbers, using an even-tempered basis. The list or array of atomic numbers should have unique values!
- Parameters:
atomic_numbers – List of atomic numbers of the atoms in the basis.
basis – Basis set to use before converting to even-tempered basis. This matters and should be the same as was used during Kohn-Sham calculations. Defaults to “6-31G(2df,p)”.
beta – Exponent factor \(\beta\) of the even-tempered basis set. Defaults to 2.5.
- Returns:
BasisInfo object.
- classmethod from_dataset_info_yaml(path_to_data_info: str, atomic_numbers: ndarray) BasisInfo[source]
Construct a BasisInfo object from a yaml file corresponding to a dataset. Can create the basis info object corresponding to an even- tempered or any other basis set.
- Parameters:
path_to_data_info – The path to create the hydra config for this dataset.
atomic_numbers – List of atomic numbers of the atoms in the basis.
- Returns:
BasisInfo object.
- classmethod from_mol(mol: Mole)[source]
Construct a BasisInfo object from a molecule (not suited for ML functionals).
Uses the basis of the molecule as is. Only the basis functions of the elements actually present in the molecule will be included in the BasisInfo.
- Parameters:
mol – Molecule object.
- Returns:
BasisInfo object.
- classmethod from_nwchem(nwchem_str: str, atomic_numbers: ndarray | list[int] = None) BasisInfo[source]
Construct a BasisInfo object from a string in nwchem format.
- Parameters:
nwchem_str – String containing the basis in nwchem format.
atomic_numbers – List of atomic numbers of the atoms in the basis. If None, uses all atomic numbers present in the NWChem string.
- classmethod get_irreps_and_integrals(one_atom_mols: list[M]) tuple[dict[str, list], list[Irreps], list[ndarray]][source]
Get the irreps and integrals for a list of molecules with one atom each.
- Parameters:
one_atom_mols – List of molecules with one atom each.
- Returns:
List of irreps for each atom. List of integrals for each atom. Dict of basis sets for each atom.
- is_subset(other: BasisInfo) bool[source]
Check whether the BasisInfo object is a subset of another BasisInfo object.
- Parameters:
other – BasisInfo object to check against.
- Returns:
True if the BasisInfo object is a subset of the other BasisInfo object.
- property n_basis: int
Total number of basis functions.
- property n_shells: int
Total number of shells.
- property n_types: int
Number of atom types.
- split_field_by_atom_type(array_or_tensor: ndarray | Tensor, axis: int = 0) tuple[ndarray | Tensor, ...][source]
Split the given array or tensor into parts corresponding to different atom types.
- Parameters:
array_or_tensor – Array or tensor to split.
axis – Axis along which to split.
- Returns:
tuple of arrays or tensors, one for each atom.