Basis set and shell types#

These APIs define the core data structures for Gaussian-type orbital (GTO) basis sets. The GauXC::BasisSet is an ordered collection of shells that make up a full basis for a molecule or atom set. A GauXC::Shell represents a contracted Gaussian shell with its exponents, coefficients, origin, and angular momentum.

template<typename F>
struct BasisSet : public std::vector<Shell<F>>#

A class to manage a Gaussian type orbital (GTO) basis set.

Extends std::vector<Shell<F>>

Template Parameters:

F – Datatype representing the internal basis set storage

Public Functions

template<typename ...Args, typename = std::enable_if_t<can_construct_base_v<Args...>>>
inline explicit BasisSet(Args&&... args)#

Construct a BasisSet object.

Delegates to std::vector<Shell<F>>::vector

Template Parameters:
  • Args – Parameter pack for arguments that are passed to base constructor

  • <anonymous> – Used to disable this method via SFINAE if the base class can not be constructed from Args

BasisSet(const BasisSet&) = default#

Copy a BasisSet object.

BasisSet(BasisSet&&) noexcept = default#

Move a BasisSet object.

BasisSet &operator=(const BasisSet&) = default#

Copy-assign BasisSet object.

BasisSet &operator=(BasisSet&&) noexcept = default#

Move-assign BasisSet object.

inline int32_t nshells() const#

Return the number of GTO shells which comprise the BasisSet object.

Delegates to std::vector<Shell<F>>::size

Returns:

the number of GTO shells which comprise the BasisSet object

inline int32_t nbf() const#

Return the number of GTO basis functions which comprise the BasisSet object.

This routine accumulates the shell sizes (accounting for Cart/Sph angular factors) for each shell in the basis set.

Returns:

the number of GTO basis functions which comprise the BasisSet object.

inline int32_t nbf_cart() const#

Return the number of cartesian GTO basis functions which comprise the BasisSet object.

This routine accumulates the cartesian shell sizes for each shell in the basis set.

Returns:

the number of cartesian GTO basis functions which comprise the BasisSet object.

template<typename IntegralIterator>
inline int32_t nbf_subset(IntegralIterator shell_list_begin, IntegralIterator shell_list_end) const#

Determine the number of basis functions contained in a specified subset of the BasisSet object.

Performs the following operation: for( i in shell_list ) nbf += size of shell i

Template Parameters:

IntegralIterator – Iterator type representing the list of shell indices.

Parameters:
  • shell_list_begin[in] Start iterator for shell list

  • shell_list_end[in] End iterator for shell_list

Returns:

Number of basis functions in the specified shell subset.

template<typename IntegralIterator>
inline int32_t nbf_cart_subset(IntegralIterator shell_list_begin, IntegralIterator shell_list_end) const#

Determine the number of cartesian basis functions contained in a specified subset of the BasisSet object.

Performs the following operation: for( i in shell_list ) nbf += cartesian size of shell i

Template Parameters:

IntegralIterator – Iterator type representing the list of shell indices.

Parameters:
  • shell_list_begin[in] Start iterator for shell list

  • shell_list_end[in] End iterator for shell_list

Returns:

Number of cartesian basis functions in the specified shell subset.

template<typename F>
class Shell#

A class to represent the state of contracted Gaussian basis functions.

This class stores the exponents, contraction coefficients, origin, and angular momentum for a single shell in a Gaussian basis set.

Template Parameters:

F – Floating-point type for exponents and coefficients.

Public Types

using prim_array = std::array<F, detail::shell_nprim_max>#

Array type for storing primitive exponents and coefficients.

using cart_array = std::array<double, 3>#

Array type for storing the 3D Cartesian origin.

Public Functions

inline Shell()#

Default constructor. Creates an empty shell with no primitives.

Note

The cutoff radius is undefined until initialized by other methods.

inline Shell(PrimSize nprim, AngularMomentum l, SphericalType pure, prim_array alpha, prim_array coeff, cart_array O, bool _normalize = true)#

Construct a shell with specified parameters.

Parameters:
  • nprim – Number of primitives in the shell.

  • l – Angular momentum quantum number.

  • pure – Spherical (1) or Cartesian (0) Gaussians.

  • alpha – Array of primitive exponents.

  • coeff – Array of contraction coefficients.

  • O – Cartesian origin of the shell.

  • _normalize – If true, normalize the contraction coefficients (default: true).

inline void set_shell_tolerance(double tol)#

Set tolerance for evaluating shell contributions.

Recomputes the cutoff radius if the tolerance changes.

Parameters:

tol – New tolerance value.

~Shell() noexcept = default#

Default destructor.

Shell(const Shell&) = default#

Default copy constructor.

Shell(Shell&&) noexcept = default#

Default move constructor.

Shell &operator=(const Shell&) = default#

Default copy assignment operator.

Shell &operator=(Shell&&) noexcept = default#

Default move assignment operator.

HOST_DEVICE_ACCESSIBLE inline int32_t nprim() const#

Get the number of primitives.

Returns:

Number of primitives in the shell.

HOST_DEVICE_ACCESSIBLE inline int32_t l() const#

Get the angular momentum quantum number.

Returns:

Angular momentum of the shell.

HOST_DEVICE_ACCESSIBLE inline int32_t pure() const#

Check if the shell uses spherical harmonics.

Note

This flag matches the value stored in SphericalType.

Returns:

1 for spherical, 0 for Cartesian.

HOST_DEVICE_ACCESSIBLE inline const F *alpha_data() const#

Get pointer to the exponent data.

Returns:

Const pointer to the array of exponents.

HOST_DEVICE_ACCESSIBLE inline const F *coeff_data() const#

Get pointer to the coefficient data.

Returns:

Const pointer to the array of contraction coefficients.

HOST_DEVICE_ACCESSIBLE inline const double *O_data() const#

Get pointer to the origin data.

Returns:

Const pointer to the 3D origin array.

HOST_DEVICE_ACCESSIBLE inline F *alpha_data()#

Get mutable pointer to the exponent data.

Returns:

Pointer to the array of exponents.

HOST_DEVICE_ACCESSIBLE inline F *coeff_data()#

Get mutable pointer to the coefficient data.

Returns:

Pointer to the array of contraction coefficients.

HOST_DEVICE_ACCESSIBLE inline double *O_data()#

Get mutable pointer to the origin data.

Returns:

Pointer to the 3D origin array.

HOST_DEVICE_ACCESSIBLE inline double cutoff_radius() const#

Get the cutoff radius.

Returns:

Real-space cutoff radius for this shell.

HOST_DEVICE_ACCESSIBLE inline int32_t cart_size() const#

Get the Cartesian size of the shell.

Returns:

Number of Cartesian basis functions: (l+1)*(l+2)/2.

HOST_DEVICE_ACCESSIBLE inline int32_t pure_size() const#

Get the spherical size of the shell.

Returns:

Number of spherical basis functions: 2*l+1.

HOST_DEVICE_ACCESSIBLE inline int32_t size() const#

Get the size of the shell.

Returns:

Number of basis functions (spherical or Cartesian based on pure_).

inline const prim_array &alpha() const#

Get the exponent array (const).

Returns:

Const reference to the exponent array.

inline const prim_array &coeff() const#

Get the coefficient array (const).

Returns:

Const reference to the contraction coefficient array.

inline const cart_array &O() const#

Get the origin array (const).

Returns:

Const reference to the origin array.

inline prim_array &alpha()#

Get the exponent array (mutable).

Returns:

Reference to the exponent array.

inline prim_array &coeff()#

Get the coefficient array (mutable).

Returns:

Reference to the contraction coefficient array.

inline cart_array &O()#

Get the origin array (mutable).

Returns:

Reference to the origin array.

inline void set_pure(bool p)#

Set the spherical/Cartesian flag.

Note

This flag matches the value stored in SphericalType.

Parameters:

p – True for spherical, false for Cartesian.

template<typename Archive>
inline void serialize(Archive &ar)#

Serialize the shell for archival storage.

Note

Includes cached cutoff radius and tolerance.

Template Parameters:

Archive – Archive type (e.g., cereal).

Parameters:

ar – Archive reference.

inline bool operator==(const Shell &other) const#

Compare two shells for equality.

Checks that both shells have the same number of primitives, angular momentum, spherical flag, origin, exponents, and coefficients.

Parameters:

otherShell to compare against.

Returns:

True if the shells are equal.