BasisSet¶
- class qcdb.BasisSet(*args)[source]¶
Bases:
object
Basis set container class Reads the basis set from a checkpoint file object. Also reads the molecule from the checkpoint file storing the information in an internal Molecule class which can be accessed using molecule().
Attributes Summary
Methods Summary
add
(b)Adds this plus another basis set and returns the result.
ao_to_shell
(i)Given a Cartesian function (AO) number what shell does it correspond to.
atomic_basis_set
(center)Return a BasisSet object containing all shells at center i (0-index) * Used for Atomic HF computations for SAD Guesses * @param center Atomic center to provide a basis object for.
build
(molecule, shells)Builder factory method * @param molecule the molecule to build the BasisSet around * @param shells array of atom-numbered ShellInfo to build the BasisSet from * @return BasisSet corresponding to this molecule and set of shells
compute_phi
(phi_ao, x, y, z)Returns the values of the basis functions at a point
concatenate
(b)Concatenates two basis sets together into a new basis without reordering anything.
construct
(parser, mol, key[, deffit, ...])Returns a new BasisSet object configured from the mol Molecule object for key (generally a Psi4 keyword: BASIS, DF_BASIS_SCF, etc.).
constructor_basisset_center
(bs, center)Creates a new basis set object for an atom, from an existing basis set
constructor_role_mol_shellmap
(role, mol, ...)The most commonly used constructor.
Constructs a zero AO basis set
decontract
(shells)Procedure applied to list to ShellInfo-s shells that returns another list of shells, one for every AM and exponent pair in the input list.
export_for_libmints
(role)From complete BasisSet object, returns array where triplets of elements are each unique atom label, the hash of the string shells entry in gbs format and the shells entry in gbs format for that label.
Given a function what is its atomic center * @param i Function number * @return The atomic center for the i'th function.
Given a function number what shell does it correspond to.
Returns the vector of sorted shell list.
Returns the value of the sorted shell list.
Spherical harmonics? * @return true if using spherical harmonics
Initialize singleton values that are shared by all basis set objects.
make_filename
(name)Converts basis set name to a compatible filename.
max_am
()Maximum angular momentum used in the basis set.
Compute the maximum number of basis functions contained in a shell.
Maximum number of primitives in a shell.
molecule
()Molecule this basis is for.
name
()Returns the name of this basis set
nao
()Number of atomic orbitals (Cartesian).
nbf
()Number of basis functions (Spherical).
Number of primitives.
nshell
()Number of shells.
Return the number of shells on a given center.
print_by_level
([out, level])Print basis set information according to the level of detail in print_level @param out The file stream to use for printing.
print_detail
([out, numbersonly])Prints a detailed PSI3-style summary of the basis (per-atom) * @param out The file stream to use for printing.
print_detail_cfour
([out])Returns a string in CFOUR-style of the basis (per-atom) * Format from http://slater.chemie.uni-mainz.de/cfour/index.php?n=Main.OldFormatOfAnEntryInTheGENBASFile
print_detail_gamess
([out, numbersonly, ...])Prints a detailed PSI3-style summary of the basis (per-atom) * @param out The file stream to use for printing.
print_detail_nwchem
([out, numbersonly])Prints a detailed NWChem-style summary of the basis (per-atom) * @param out The file stream to use for printing.
print_summary
([out])Prints a short string summarizing the basis set * @param out The file stream to use for printing.
pyconstruct
(mol, key, target[, fitrole, ...])Builds a BasisSet object for mol (either a qcdb.Molecule or a string that can be instantiated into one) from basis set specifications passed in as python functions or as a string that names a basis to be applied to all atoms.
pyprint
([out])Print the basis set.
refresh
()Refresh internal basis set data.
set_name
(name)Sets the name of this basis set
shell
(si[, center])Return the si'th Gaussian shell on center * @param i Shell number * @return A shared pointer to the ShellInfo object for the i'th shell.
shell_on_center
(center, shell)Return the overall shell number
shell_sorter_am
(d1, d2)shell_sorter_ncenter
(d1, d2)Given a shell what is its first AO function * @param i Shell number * @return The function number for the first function for the i'th shell.
Given a shell what is its first basis function (spherical) function * @param i Shell number * @return The function number for the first function for the i'th shell.
Given a shell what is its atomic center * @param i Shell number * @return The atomic center for the i'th shell.
test_basis_set
(max_am)Returns a shell-labeled test basis set object * @param max_am maximum angular momentum to build * @return pair containing shell labels and four-center * test basis for use in benchmarking * See libmints/benchmark.cc for details The libmints version seems not to have been updated along with the classes.
Returns an empty basis set object.
zero_so_basis_set
(factory)NYI Returns an empty SO basis set object.
Attributes Documentation
- LIBINT_MAX_AM = 6¶
- exp_ao = [[], [], [], [], [], []]¶
Methods Documentation
- add(b)[source]¶
Adds this plus another basis set and returns the result. Equivalent to the ‘+’ operator. Appears defunct.
- atomic_basis_set(center)[source]¶
Return a BasisSet object containing all shells at center i (0-index) * Used for Atomic HF computations for SAD Guesses * @param center Atomic center to provide a basis object for. * @returns A new basis set object for the atomic center.
- static build(molecule, shells)[source]¶
Builder factory method * @param molecule the molecule to build the BasisSet around * @param shells array of atom-numbered ShellInfo to build the BasisSet from * @return BasisSet corresponding to this molecule and set of shells
- concatenate(b)[source]¶
Concatenates two basis sets together into a new basis without reordering anything. Unless you know what you’re doing, you should use the ‘+’ operator instead of this method. Appears defunct.
- classmethod construct(parser, mol, key, deffit=None, basstrings=None, return_atomlist=False, verbose=1)[source]¶
Returns a new BasisSet object configured from the mol Molecule object for key (generally a Psi4 keyword: BASIS, DF_BASIS_SCF, etc.). Fails utterly if a basis has not been set for key for every atom in mol, unless deffit is set (JFIT, JKFIT, or RIFIT), whereupon empty atoms are assigned to key from the BasisFamily. This function is significantly re-worked from its libmints analog.
- Parameters:
mol (
Molecule
) – A molecule object for which every atom has had a basisset set for keybasstrings (
Optional
[Dict
]) – Additional source for basis data. Keys are regularized basis names and values are gbs strings.return_atomlist – Return list of one-atom BasisSet-s, rather than single whole-mol BasisSet.
- constructor_basisset_center(bs, center)[source]¶
Creates a new basis set object for an atom, from an existing basis set
bs: the basis set to copy data from
center: the atom in bs to copy over
- constructor_role_mol_shellmap(role, mol, shell_map)[source]¶
The most commonly used constructor. Extracts basis set name for role from each atom of mol, looks up basis and role entries in the shell_map dictionary, retrieves the ShellInfo objects and returns the BasisSet.
- static decontract(shells)[source]¶
Procedure applied to list to ShellInfo-s shells that returns another list of shells, one for every AM and exponent pair in the input list. Decontracts the shells.
- export_for_libmints(role)[source]¶
From complete BasisSet object, returns array where triplets of elements are each unique atom label, the hash of the string shells entry in gbs format and the shells entry in gbs format for that label. This packaging is intended for return to libmints BasisSet::construct_from_pydict for instantiation of a libmints BasisSet clone of self.
- function_to_center(i)[source]¶
Given a function what is its atomic center * @param i Function number * @return The atomic center for the i’th function.
- initialize_singletons()[source]¶
Initialize singleton values that are shared by all basis set objects.
- static make_filename(name)[source]¶
Converts basis set name to a compatible filename. * @param basisname Basis name * @return Compatible file name.
- max_am()[source]¶
Maximum angular momentum used in the basis set. * @return Maximum angular momentum.
- max_function_per_shell()[source]¶
Compute the maximum number of basis functions contained in a shell. * @return The max number of basis functions in a shell.
- max_nprimitive()[source]¶
Maximum number of primitives in a shell. * Examines each shell and find the shell with the maximum number of primitives returns that * number of primitives. * @return Maximum number of primitives.
- molecule()[source]¶
Molecule this basis is for. * @return Shared pointer to the molecule for this basis set.
- nao()[source]¶
Number of atomic orbitals (Cartesian). * @return The number of atomic orbitals (Cartesian orbitals, always).
- nbf()[source]¶
Number of basis functions (Spherical). * @return The number of basis functions (Spherical, if has_puream() == true).
- nprimitive()[source]¶
Number of primitives. * @return The total number of primitives in all contractions.
- print_by_level(out=None, level=2)[source]¶
Print basis set information according to the level of detail in print_level @param out The file stream to use for printing. Defaults to outfile. @param print_level: defaults to 2 * < 1: Nothing * 1: Brief summary * 2: Summary and contraction details * > 2: Full details
- print_detail(out=None, numbersonly=False)[source]¶
Prints a detailed PSI3-style summary of the basis (per-atom) * @param out The file stream to use for printing. Defaults to outfile.
- print_detail_cfour(out=None)[source]¶
Returns a string in CFOUR-style of the basis (per-atom) * Format from http://slater.chemie.uni-mainz.de/cfour/index.php?n=Main.OldFormatOfAnEntryInTheGENBASFile
- print_detail_gamess(out=None, numbersonly=False, return_list=False)[source]¶
Prints a detailed PSI3-style summary of the basis (per-atom) * @param out The file stream to use for printing. Defaults to outfile.
- print_detail_nwchem(out=None, numbersonly=False)[source]¶
Prints a detailed NWChem-style summary of the basis (per-atom) * @param out The file stream to use for printing. Defaults to outfile.
- print_summary(out=None)[source]¶
Prints a short string summarizing the basis set * @param out The file stream to use for printing. Defaults to outfile.
- static pyconstruct(mol, key, target, fitrole='ORBITAL', other=None, return_atomlist=False, return_dict=False, verbose=1)[source]¶
Builds a BasisSet object for mol (either a qcdb.Molecule or a string that can be instantiated into one) from basis set specifications passed in as python functions or as a string that names a basis to be applied to all atoms. Always required is the keyword key and string/function target of the basis to be constructed. For orbital basis sets, key will likely be ‘BASIS’ and, together with target, these arguments suffice.
pyconstruct(smol, "BASIS", basisspec_psi4_yo_631pg_d_p_)
pyconstruct(mol, "BASIS", "6-31+G**")
When building an auxiliary basis, key is again the keyword, target is the string or function for the fitting basis (this may also be an empty string). In case the fitting basis isn’t fully specified, also provide a fitrole and the string/function of the orbital basis as other, so that orbital hints can be used to look up a suitable default basis in BasisFamily.pyconstruct(smol, "DF_BASIS_MP2", basisspec_psi4_yo_ccpvdzri, 'RIFIT', basisspec_psi4_yo_631pg_d_p_)
pyconstruct(mol, "DF_BASIS_MP2", "", "RIFIT", "6-31+G(d,p)")
- Parameters:
mol (
Union
[Molecule
,Dict
,str
]) – If not aqcdb.Molecule
, something that can be converted into one. If the latter, the basisset dict is returned rather than the BasisSet object. If you’ve got a psi4.core.Molecule, pass qcdb.Molecule(psimol.to_dict()).key (
str
) – {‘BASIS’, ‘DF_BASIS_SCF’, ‘DF_BASIS_MP2’, ‘DF_BASIS_CC’} Label (effectively Psi4 keyword) to append the basis on the molecule.target (
Union
[str
,Callable
]) – Defines the basis set to be constructed. Can be a string (naming a basis file) or a function (multiple files, shells). Required for fitrole=’ORBITAL’. For auxiliary bases to be built entirely from orbital default, can be empty string.fitrole (
str
) – {‘ORBITAL’, ‘JKFIT’, ‘RIFIT’}other (
Union
[str
,Callable
,None
]) – Only used when building fitting bases. Like target only supplies the definitions for the orbital basis.return_atomlist (
bool
) – Build one-atom basis sets (for SAD) rather than one whole-Mol basis setreturn_dict (
bool
) – Additionally return the dictionary representation of built BasisSetverbose (int) –
- Returns:
bas (
qcdb.BasisSet
) – Built BasisSet object for mol.dbas (dict, optional) – Only returned if return_dict=True. Suitable for feeding to libmints.
- pyprint(out=None)[source]¶
Print the basis set. * @param out The file stream to use for printing. Defaults to outfile.
- refresh()[source]¶
Refresh internal basis set data. Useful if someone has pushed to shells. Pushing to shells happens in the BasisSetParsers, so the parsers will call refresh(). This function is now defunct.
- shell(si, center=None)[source]¶
Return the si’th Gaussian shell on center * @param i Shell number * @return A shared pointer to the ShellInfo object for the i’th shell.
- shell_to_ao_function(i)[source]¶
Given a shell what is its first AO function * @param i Shell number * @return The function number for the first function for the i’th shell.
- shell_to_basis_function(i)[source]¶
Given a shell what is its first basis function (spherical) function * @param i Shell number * @return The function number for the first function for the i’th shell.
- shell_to_center(i)[source]¶
Given a shell what is its atomic center * @param i Shell number * @return The atomic center for the i’th shell.
- static test_basis_set(max_am)[source]¶
Returns a shell-labeled test basis set object * @param max_am maximum angular momentum to build * @return pair containing shell labels and four-center * test basis for use in benchmarking * See libmints/benchmark.cc for details The libmints version seems not to have been updated along with the classes.