gbasis.integrals package#
Collection of modules that compute different integrals of the contractions.
Submodules#
gbasis.integrals.angular_momentum module#
Module for evaluating the integral over the angular momentum operator.
- class gbasis.integrals.angular_momentum.AngularMomentumIntegral(contractions)#
Bases:
BaseTwoIndexSymmetric
Class for obtaining the angular momentum integral for a set of Gaussian contractions.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of AngularMomentumIntegral.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(contractions_one, contractions_two) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2, 3)
Return the integral over the angular momentum operator associated with a GeneralizedContractionShell instance. \(M_1\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. \(L_cart_1\) is the number of Cartesian contractions for the given angular momentum associated with the first index. \(M_2\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. \(L_cart_2\) is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart, 3)
Return the integral over the angular momentum operator associated with Cartesian Gaussians. \(K_cart\) is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph, 3)
Return the integral over the angular momentum operators associated with spherical Gaussians (atomic orbitals). \(K_sph\) is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types)np.ndarray(K_cont, K_cont, 3)
Return the integral over the angular momentum operators associated with the contraction in the given coordinate system. \(K_cont\) is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform, coord_type)np.ndarray(K_orbs, K_orbs, 3)
Return the integral over the angular momentum operator associated with linear combinations of spherical Gaussians (linear combinations of atomic orbitals). \(K_orbs\) is the number of basis functions produced after the linear combinations.
- static construct_array_contraction(contractions_one, contractions_two)#
Return the integrals over the angular momentum operator of the given contractions.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the kinetic energy integral.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the kinetic energy integral.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2, 3)
Integral over than angular momentum operator associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within contractions_one. \(M_1\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the contractions_one. \(L_cart_1\) is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within contractions_two. \(M_2\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the contractions_two. \(L_cart_2\) is the number of Cartesian contractions for the given angular momentum associated with the second index. Dimension 4 corresponds to the direction of the angular momentum \((x, y, z)\).
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance.
- gbasis.integrals.angular_momentum.angular_momentum_integral(basis, transform=None)#
Return the integral over \(hat{L}\) of the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transformnp.ndarray(K, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K, K, 3)
Array associated with the basis functions in the given shells of generalized contractions. Dimensions 0 and 1 of the array are associated with the basis functions in the basis set, where \(K\) is the total number of basis functions in the basis set. Dimension 2 corresponds to the direction of the angular momentum \((x, y, z)\).
gbasis.integrals.electron_repulsion module#
Electron-electron repulsion integral.
- class gbasis.integrals.electron_repulsion.ElectronRepulsionIntegral(contractions)#
Bases:
BaseFourIndexSymmetric
Class for constructing electron-electron repulsion integrals.
The first four axes of the returned array is associated with the given set of contracted Gaussian (or a linear combination of a set of Gaussians).
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the four indices of the array. Property of ElectronRepulsionIntegral.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(self, cont1, cont2, cont3, cont4) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2, M_3, L_cart_3, M_4, L_cart_4)
Return the electron-electron repulsion integrals associated with a GeneralizedContractionShell instances. \(M_1\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. \(L_cart_1\) is the number of Cartesian contractions for the given angular momentum associated with the first index. \(M_2\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. \(L_cart_2\) is the number of Cartesian contractions for the given angular momentum associated with the second index. \(M_3\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the third index. \(L_cart_3\) is the number of Cartesian contractions for the given angular momentum associated with the third index. \(M_4\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the fourth index. \(L_cart_4\) is the number of Cartesian contractions for the given angular momentum associated with the fourth index. Note that the integrals are in Chemists’ notation.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart, K_cart, K_cart)
Return the electron-electron repulsion integrals associated with Cartesian Gaussians. \(K_cart\) is the total number of Cartesian contractions within the instance. Note that the integrals are in Chemists’ notation.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph, K_sph, K_sph)
Return the electron-electron repulsion integrals associated with spherical Gaussians (atomic orbitals). \(K_sph\) is the total number of spherical contractions within the instance. Note that the integrals are in Chemists’ notation.
- construct_array_mix(self, coord_types)np.ndarray(K_cont, K_cont, K_cont, K_cont)
Return the electron-electron repulsion integrals associated with all of the contraction in the given coordinate system. \(K_cont\) is the total number of contractions within the given basis set. Note that the integrals are in Chemists’ notation.
- construct_array_lincomb(self, transform, coord_type) :
np.ndarray(K_orbs, K_orbs, K_orbs, K_orbs)
Return the electron-electron repulsion integrals associated with linear combinations of contractions in the given coordinate system. \(K_orbs\) is the number of basis functions produced after the linear combinations. Note that the integrals are in Chemists’ notation.
- boys_func(weighted_dist)#
Return the value of Boys function for the given orders and weighted distances.
The Coulombic Boys function can be written as a renormalized special case of the Kummer confluent hypergeometric function, as derived in Helgaker (eq. 9.8.39).
Parameters#
- ordersnp.ndarray(M, 1, 1, 1)
Differentiation order of the helper function. Same as m in eq. 23, Aldrichs, R. Phys. Chem. Chem. Phys., 2006, 8, 3072-3077. M is the number of orders that will be evaluated.
- weighted_distnp.ndarray(1, N, K_b, K_a)
Weighted interatomic distances.
\[\frac{\alpha_i \beta_j}{\alpha_i + \beta_j} * ||R_{PC}||^2\]where \(\alpha_i\) is the exponent of the ith primitive on the left side and the \(\beta_j\) is the exponent of the jth primitive on the right side. N is the number of point charges. K_a and K_b are the number of primitives on the left and right side, respectively. Note that the index 2 corresponds to the primitive on the right side and the index 3 corresponds to the primitive on the left side.
Returns#
- boys_evalnp.ndarray(M, N, K_b, K_a)
Output is the Boys function evaluated for each order and the weighted interatomic distance.
Notes#
There’s some documented instability for hyp1f1, mainly for large values or complex numbers. In this case it seems fine, since m should be less than 10 in most cases, and except for exceptional cases the input, while negative, shouldn’t be very large. In scipy > 0.16, this problem becomes a precision error in most cases where it was an overflow error before, so the values should be close even when they are wrong.
To use another boys_func, simply overwrite this function (via monkeypatching or inheritance) with the desired boys function. Make sure to follow the same API, i.e. have the same inputs including their shapes and types. Note that the index 2 corresponds to the primitive on the right side and the index 3 corresponds to the primitive on the left side.
- classmethod construct_array_contraction(cont_one, cont_two, cont_three, cont_four)#
Return electron-electron repulsion interaction integral for the given contractions.
Parameters#
- cont_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the array.
- cont_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the array.
- cont_threeGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the third index of the array.
- cont_fourGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the fourth index of the array.
Returns#
- array_contnp.ndarray(M_1, L_cart_1, M_2, L_cart_2, M_3, L_cart_3, M_4, L_cart_4)
Electron-electron repulsion integral associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within cont_one. \(M_1\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the cont_one. \(L_cart_1\) is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within cont_two. \(M_2\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the cont_two. \(L_cart_2\) is the number of Cartesian contractions for the given angular momentum associated with the second index. Dimension 4 corresponds to the segmented contraction within cont_three. \(M_3\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the third index. Dimension 5 corresponds to the angular momentum vector of the cont_three. \(L_cart_3\) is the number of Cartesian contractions for the given angular momentum associated with the third index. Dimension 6 corresponds to the segmented contraction within cont_four. \(M_4\) is the number of segmented contractions with the same exponents (and angular momentum) associated with the fourth index. Dimension 7 corresponds to the angular momentum vector of the cont_four. \(L_cart_4\) is the number of Cartesian contractions for the given angular momentum associated with the fourth index. Integrals are in Chemists’ notation, i.e. cont1 and cont2 are associated with the coordinate \(\mathbf{r}_1\) and cont3 and cont4 are associated with coordinate \(\mathbf{r}_2\).
Raises#
- TypeError
If cont_one is not a GeneralizedContractionShell instance. If cont_two is not a GeneralizedContractionShell instance. If cont_three is not a GeneralizedContractionShell instance. If cont_four is not a GeneralizedContractionShell instance.
Notes#
The integrals are in Chemists’ notation. This means that all of construct_array_cartesian, construct_array_spherical, construct_array_mix, and construct_array_lincomb are in Chemists’ notation. To use Physicists’ notation instead, see electron_repulsion_cartesian, electron_repulsion_spherical, electron_repulsion_mix, and electron_repulsion_lincomb, respectively.
- gbasis.integrals.electron_repulsion.electron_repulsion_integral(basis, transform=None, notation='physicist')#
Return the electron repulsion integrals fo the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transformnp.ndarray(K, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
- notation{“physicist”, “chemist”}
Convention with which the integrals are ordered. Default is Physicists’ notation.
Returns#
- arraynp.ndarray(K, K, K, K)
Electron-electron repulsion integral of the given basis set. If keyword argument transform is provided, then the integrals will be transformed accordingly. Dimensions 0, 1, 2, and 3 of the array are associated with the basis functions in the basis set, where \(K\) is the total number of basis functions in the basis set.
Raises#
- ValueError
If notation is not one of “physicist” or “chemist”.
gbasis.integrals.kinetic_energy module#
Module for evaluating the kinetic energy integral.
- class gbasis.integrals.kinetic_energy.KineticEnergyIntegral(contractions)#
Bases:
BaseTwoIndexSymmetric
Class for obtaining the kinetic energy integrals.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of KineticEnergyIntegral.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(contractions_one, contractions_two) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Return the kinetic energy integral associated with a GeneralizedContractionShell instance. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart)
Return the kinetic energy integral associated with Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph)
Return the kinetic energy integrals associated with spherical Gaussians (atomic orbitals). K_sph is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types)np.ndarray(K_cont, K_cont)
Return the kinetic energy integrals associated with the contraction in the given coordinate system. K_cont is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform, coord_type)np.ndarray(K_orbs, K_orbs)
Return the kinetic energy integral associated with linear combinations of spherical Gaussians (linear combinations of atomic orbitals). K_orbs is the number of basis functions produced after the linear combinations.
- static construct_array_contraction(contractions_one, contractions_two)#
Return the evaluations of the given contractions at the given coordinates.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the kinetic energy integral.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the kinetic energy integral.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Kinetic energy integral associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within contractions_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the contractions_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within contractions_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the contractions_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance.
- gbasis.integrals.kinetic_energy.kinetic_energy_integral(basis, transform=None)#
Return kinetic energy integral of the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transformnp.ndarray(K_orbs, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_orbs, K_orbs)
Kinetic energy integral of the given basis set. If keyword argument transform is provided, then the integrals will be transformed accordingly. Dimensions 0 and 1 of the array are associated with the basis functions in the basis set. K_orbs is the total number of basis functions in the basis set.
gbasis.integrals.libcint module#
gbasis.integrals.moment module#
Module for computing the moments of a basis set.
- class gbasis.integrals.moment.Moment(contractions)#
Bases:
BaseTwoIndexSymmetric
Class for obtaining the moment for a set of Gaussian contractions.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the moment.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of Moment.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(self, contraction)np.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Return the moment associated with a GeneralizedContractionShell instance. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart)
Return the moment integrals associated with Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph)
Return the moment integrals associated with spherical Gaussians (atomic orbitals). K_sph is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types, **kwargs)np.ndarray(K_cont, K_cont)
Return the moment integrals associated with all of the contraction in the given coordinate system. K_cont is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform, coord_type, **kwargs)np.ndarray(K_orbs, K_orbs)
Return the moment integrals associated with the linear combinations of contractions in the given coordinate system. K_orbs is the number of basis functions produced after the linear combinations.
- static construct_array_contraction(contractions_one, contractions_two, moment_coord, moment_orders)#
Return the evaluations of the given contractions at the given coordinates.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the array.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the array.
- moment_coordnp.ndarray(3,)
Center of the moment.
- moment_ordersnp.ndarray(D, 3)
Orders of the moment for each dimension (x, y, z). Note that a two dimensional array must be given, even if there is only one set of orders of the moment.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2, D)
Moment associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within contractions_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the contractions_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within contractions_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the contractions_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index. Dimension 4 corresponds to the orders of the moments. D is the number of orders for which the moment is computed.
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance. If moment_coord is not a one-dimensional numpy array with 3 elements. If moment_orders is not a two-dimensional numpy array with 3 columns and dtype int.
Notes#
Even though it will be faster to access the different orders of moments if it was associated with the first axis, the API will be consistent with the rest of the BaseTwoSymmetric class if the first four indices correspond to the segmented contraction and the angular momentum vector. If many orders of moments are calculated (the exact number depends on the size of the basis set), then it may be faster to access the moments if the fifth axis is moved back to the front prior to the access. Use np.transpose(array, (4, 0, 1, 2, 3)) to change the order.
- gbasis.integrals.moment.moment_integral(basis, moment_coord, moment_orders, transform=None)#
Return moment integral of the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- moment_coordnp.ndarray(3,)
Center of the moment.
- moment_ordersnp.ndarray(D, 3)
Orders of the moment for each dimension (x, y, z). Note that a two dimensional array must be given, even if there is only one set of orders of the moment.
- transformnp.ndarray(K_orbs, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_orbs, K_orbs, D)
Moment integral of the given basis set. Dimensions 0 and 1 of the array correspond to the basis functions. K_orbs is the number of basis functions in the basis set. Dimension 2 of the array corresponds to the moment. D is the number of different moments.
Notes#
If enough orders of moments are calculated (the exact number depends on the size of the basis set), then it may be faster to access the moments for each order if the fifth axis is moved back to the front prior to the access. Use np.transpose(array, (4, 0, 1, 2, 3)) to change the order.
gbasis.integrals.momentum module#
Module for evaluating the integral over the momentum operator.
- class gbasis.integrals.momentum.MomentumIntegral(contractions)#
Bases:
BaseTwoIndexSymmetric
Class for obtaining the momentum integral.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of MomentumIntegral.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(contractions_one, contractions_two) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2, 3)
Return the integral over the momentum operator associated with a GeneralizedContractionShell instance. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart, 3)
Return the integral over the momentum operator associated with Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph, 3)
Return the integral over the momentum operator associated with spherical Gaussians (atomic orbitals). K_sph is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types)np.ndarray(K_cont, K_cont, 3)
Return the integral over the momentum operator associated with the contraction in the given coordinate system. K_cont is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform, coord_type)np.ndarray(K_orbs, K_orbs, 3)
Return the integral over the momentum operator associated with linear combinations of spherical Gaussians (linear combinations of atomic orbitals). K_orbs is the number of basis functions produced after the linear combinations.
- static construct_array_contraction(contractions_one, contractions_two)#
Return the integrals over the momentum operator of the given contractions.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the kinetic energy integral.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the kinetic energy integral.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2, 3)
Integral over than momentum operator associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within cont_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the cont_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within cont_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the cont_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index. Dimension 4 corresponds to the dimension of the momentum (x, y, z).
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance.
- gbasis.integrals.momentum.momentum_integral(basis, transform=None)#
Return integral over momentum operator of the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transformnp.ndarray(K_orbs, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_orbs, K_orbs)
Momentum integral of the given basis set. Dimensions 0 and 1 of the array correspond to the basis functions. K_orbs is the number of basis functions in the basis set.
gbasis.integrals.nuclear_electron_attraction module#
Module for computing the nuclear electron attraction.
- gbasis.integrals.nuclear_electron_attraction.nuclear_electron_attraction_integral(basis, nuclear_coords, nuclear_charges, transform=None)#
Return the nuclear electron attraction integrals of the basis set in the Cartesian form.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) that will be used to construct an array.
- nuclear_coordsnp.ndarray(N_nuc, 3)
Coordinates of each atom.
- nuclear_chargesnp.ndarray(N_nuc)
Charges of each atom.
- transformnp.ndarray(K, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_cart, K_cart)
Array associated with the given set of contracted Cartesian Gaussians. Dimensions 0 and 1 are associated with the contracted Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
gbasis.integrals.overlap module#
Functions for computing overlap of a basis set.
- class gbasis.integrals.overlap.Overlap(contractions)#
Bases:
BaseTwoIndexSymmetric
Class for obtaining the overlap for a set of Gaussian contractions.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of Overlap.
Methods#
- __init__(self, contractions)
Initialize.
- construct_array_contraction(contractions_one, contractions_two) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Return the overlap associated with a GeneralizedContractionShell instance. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart)
Return the overlap integrals associated with Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph)
Return the overlap integrals associated with spherical Gaussians (atomic orbitals). K_sph is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types, **kwargs)np.ndarray(K_cont, K_cont)
Return the overlap integrals associated with the contraction in the given coordinate system. K_cont is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform, coord_type)np.ndarray(K_orbs, K_orbs)
Return the overlap integrals associated with the linear combinations of contractions in the given coordinate system. K_orbs is the number of basis functions produced after the linear combinations.
- static construct_array_contraction(contractions_one, contractions_two)#
Return the evaluations of the given contractions at the given coordinates.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the overlap.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the overlap.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Overlap associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within cont_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the cont_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within cont_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the cont_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance.
- gbasis.integrals.overlap.is_overlap_included(contractions_one, contractions_two)#
Return True or False in response to whether overlap integral is required.
\[d_{A_s;B_t} > \sqrt{-\frac{\alpha_{ min(\alpha_{s,A})} + \alpha_{ min(\alpha_{t,B})} }{ \alpha_{ min(\alpha_{s,A})} \alpha_{ min(\alpha_{t,B})} } \ln \varepsilon }\]where \(d\) is the cut-off distance at which shells do not interact with each other. \(A\) and B are the atoms each contraction are respectively centered on. :math: alpha is the gaussian exponent :math: s and t index the primitive gaussians in shells centered on atom A and B respectively.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the overlap.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the overlap.
Returns#
- valuebool
If overlap integral is required, return True
- gbasis.integrals.overlap.overlap_integral(basis, transform=None)#
Return overlap integral of the given basis set.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transformnp.ndarray(K_orbs, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_orbs, K_orbs)
Overlap integral of the given basis set. Dimensions 0 and 1 of the array correspond to the basis functions. K_orbs is the number of basis functions in the basis set.
gbasis.integrals.overlap_asymm module#
Functions for computing overlap between two basis sets.
- class gbasis.integrals.overlap_asymm.OverlapAsymmetric(contractions_one, contractions_two)#
Bases:
BaseTwoIndexAsymmetric
Class for obtaining the overlap between two sets of Gaussian contractions.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractions_onetuple of GeneralizedContractionShell
Contractions that are associated with the first index of the array. Property of OverlapAsymmetric.
- contractions_twotuple of GeneralizedContractionShell
Contractions that are associated with the second index of the array. Property of OverlapAsymmetric.
Methods#
- __init__(self, contractions_one, contractions_two)
Initialize.
- construct_array_contraction(contractions_one, contractions_two) :
np.ndarray(M_1, L_cart_1, M_2, L_cart_2) Return the overlap associated with the two GeneralizedContractionShell instances. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart_1, K_cart_2)
Return the overlap integrals between Cartesian Gaussians of the two basis sets. K_cart_1 is the total number of Cartesian contractions within contractions_one. K_cart_2 is the total number of Cartesian contractions within contractions_two.
- construct_array_spherical(self)np.ndarray(K_sph_1, K_sph_2)
Return the overlap integrals associated with spherical Gaussians (atomic orbitals) of the two basis sets. K_sph_1 is the total number of spherical contractions within contractions_one. K_sph_2 is the total number of spherical contractions within contractions_two.
- construct_array_mix(self, coord_types_one, coord_types_two) :
np.ndarray(K_cont_1, K_cont_2)
Return the overlap integrals associated with the contractions in the given coordinate systems of the two basis sets. K_cont_1 is the total number of contractions within the given basis set. K_cont_2 is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform_one, transform_two, coord_type_one, coord_type_two) :
np.ndarray(K_orbs_1, K_orbs_2)
Return the overlap integrals associated with the linear combinations of contractions of the two basis sets. K_orbs_1 is the number of basis functions produced after the linear combinations of the spherical contractions associated with contractions_one. K_orbs_2 is the number of basis functions produced after the linear combinations of the spherical contractions associated with contractions_two.
- static construct_array_contraction(contractions_one, contractions_two)#
Return the evaluations of the given contractions at the given coordinates.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the overlap.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the overlap.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2)
Overlap associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within cont_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the cont_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within cont_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the cont_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance.
- gbasis.integrals.overlap_asymm.overlap_integral_asymmetric(basis_one, basis_two, transform_one=None, transform_two=None)#
Return overlap integrals between two basis sets.
Parameters#
- basis_onelist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- basis_twolist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- transform_onenp.ndarray(K_orbs, K_cont)
Transformation matrix of the basis_one in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
- transform_onenp.ndarray(K_orbs, K_cont)
Transformation matrix of the basis_two in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- arraynp.ndarray(K_orbs_1, K_orbs_2)
Overlap integral of the given basis set. Dimensions 0 of the array correspond to the basis functions in basis_one. K_orbs_1 is the number of basis functions in the basis_one. Dimensions 1 of the array correspond to the basis functions in basis_two. K_orbs_2 is the number of basis functions in the basis_two.
gbasis.integrals.point_charge module#
Module for computing point charge integrals.
- class gbasis.integrals.point_charge.PointChargeIntegral(contractions)#
Bases:
BaseTwoIndexSymmetric
General class for calculating one-electron integrals for interaction with a point charge.
One electron integrals are assumed to have the following form:
\[\int \phi_a(\mathbf{r}) \phi_b(\mathbf{r}) g(|\mathbf{r} - \mathbf{R}_C|, Z) d\mathbf{r}\]where \(\phi_a\) is Gaussian contraction on the left, \(\phi_b\) is the Gaussian contraction on the right, \(\mathbf{R}_C\) is the position of the point charge, \(Z\) is the charge at the point charge, and \(g(|\mathbf{r} - \mathbf{R}_C|, Z)\) determines the type of the one-electorn integral.
Attributes#
- _axes_contractionstuple of tuple of GeneralizedContractionShell
Sets of contractions associated with each axis of the array.
- contractionstuple of GeneralizedContractionShell
Contractions that are associated with the first and second indices of the array. Property of PointChargeIntegral.
Methods#
- __init__(self, contractions)
Initialize.
- boys_funcnp.ndarray(np.ndarray(M, K_b, K_a))
Boys function used to evaluate the one-electron integral. M is the number of orders that will be evaluated. K_a and K_b are the number of primitives on the left and right side, respectively.
- construct_array_contraction(self, contractions_one, contractions_two, points_coords, points_charge)
Return the point charge integrals for the given GeneralizedContractionShell instances. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index.
- construct_array_cartesian(self)np.ndarray(K_cart, K_cart)
Return the one-electron integrals associated with Cartesian Gaussians. K_cart is the total number of Cartesian contractions within the instance.
- construct_array_spherical(self)np.ndarray(K_sph, K_sph)
Return the one-electron integrals associated with spherical Gaussians (atomic orbitals). K_sph is the total number of spherical contractions within the instance.
- construct_array_mix(self, coord_types, **kwargs)np.ndarray(K_cont, K_cont)
Return the one-electron integrals associated with the contraction in the given coordinate system. K_cont is the total number of contractions within the given basis set.
- construct_array_lincomb(self, transform)np.ndarray(K_orbs, K_orbs)
Return the one-electron integrals associated with the linear combinations of contractions in the given coordinate system. K_orbs is the number of basis functions produced after the linear combinations.
- static boys_func(orders, weighted_dist)#
Return the value of Boys function for the given orders and weighted distances.
The Coulombic Boys function can be written as a renormalized special case of the Kummer confluent hypergeometric function, as derived in Helgaker (eq. 9.8.39).
Parameters#
- ordersnp.ndarray(M, 1, 1, 1)
Differentiation order of the helper function. Same as m in eq. 23, Aldrichs, R. Phys. Chem. Chem. Phys., 2006, 8, 3072-3077. M is the number of orders that will be evaluated.
- weighted_distnp.ndarray(1, N, K_b, K_a)
Weighted interatomic distances.
\[\frac{\alpha_i \beta_j}{\alpha_i + \beta_j} * ||R_{PC}||^2\]where \(\alpha_i\) is the exponent of the ith primitive on the left side and the \(\beta_j\) is the exponent of the jth primitive on the right side. N is the number of point charges. K_a and K_b are the number of primitives on the left and right side, respectively. Note that the index 2 corresponds to the primitive on the right side and the index 3 corresponds to the primitive on the left side.
Returns#
- boys_evalnp.ndarray(M, N, K_b, K_a)
Output is the Boys function evaluated for each order and the weighted interatomic distance.
Notes#
There’s some documented instability for hyp1f1, mainly for large values or complex numbers. In this case it seems fine, since m should be less than 10 in most cases, and except for exceptional cases the input, while negative, shouldn’t be very large. In scipy > 0.16, this problem becomes a precision error in most cases where it was an overflow error before, so the values should be close even when they are wrong.
To use another boys_func, simply overwrite this function (via monkeypatching or inheritance) with the desired boys function. Make sure to follow the same API, i.e. have the same inputs including their shapes and types. Note that the index 2 corresponds to the primitive on the right side and the index 3 corresponds to the primitive on the left side.
- classmethod construct_array_contraction(contractions_one, contractions_two, points_coords, points_charge)#
Return point charge interaction integral for the given contractions and point charges.
Parameters#
- contractions_oneGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the first index of the array.
- contractions_twoGeneralizedContractionShell
Contracted Cartesian Gaussians (of the same shell) associated with the second index of the array.
- points_coordsnp.ndarray(N, 3)
Cartesian coordinates of each point charge. Rows correspond to the different point charges and columns correspond to the \(x, y, \text{and} z\) components.
- points_chargenp.ndarray(N)
Charge of each point charge.
Returns#
- array_contractionnp.ndarray(M_1, L_cart_1, M_2, L_cart_2, N)
Point charge integral associated with the given instances of GeneralizedContractionShell. Dimension 0 corresponds to the segmented contraction within cont_one. M_1 is the number of segmented contractions with the same exponents (and angular momentum) associated with the first index. Dimension 1 corresponds to the angular momentum vector of the cont_one. L_cart_1 is the number of Cartesian contractions for the given angular momentum associated with the first index. Dimension 2 corresponds to the segmented contraction within cont_two. M_2 is the number of segmented contractions with the same exponents (and angular momentum) associated with the second index. Dimension 3 corresponds to the angular momentum vector of the cont_two. L_cart_2 is the number of Cartesian contractions for the given angular momentum associated with the second index. Dimension 4 corresponds to the point charge. N is the number of point charges.
Raises#
- TypeError
If contractions_one is not a GeneralizedContractionShell instance. If contractions_two is not a GeneralizedContractionShell instance. If points_coords is not a two-dimensional numpy array of dtype int/float with 3 columns. If points_charge is not a one-dimensional numpy array of int/float.
- ValueError
If points_coords does not have the same number of rows as the size of points_charge.
- gbasis.integrals.point_charge.point_charge_integral(basis, points_coords, points_charge, transform=None)#
Return the point-charge interaction integrals of basis set in the given coordinate systems.
Parameters#
- basislist/tuple of GeneralizedContractionShell
Shells of generalized contractions.
- points_coordsnp.ndarray(N, 3)
Coordinates of the point charges (in atomic units). Rows correspond to the different point charges and columns correspond to the \(x, y, \text{and} z\) components.
- points_chargenp.ndarray(N)
Charge at each given point.
- transformnp.ndarray(K, K_cont)
Transformation matrix from the basis set in the given coordinate system (e.g. AO) to linear combinations of contractions (e.g. MO). Transformation is applied to the left, i.e. the sum is over the index 1 of transform and index 0 of the array for contractions. Default is no transformation.
Returns#
- eval_arraynp.ndarray(K, N)
Evaluations of the basis functions at the given coordinates. If keyword argument transform is provided, then the transformed basis functions will be evaluted at the given points. K is the total number of basis functions within the given basis set. N is the number of coordinates at which the contractions are evaluated.