21#ifndef _libint2_include_cartesian_h_
22#define _libint2_include_cartesian_h_
24#include <libint2/cgshell_ordering.h>
25#include <libint2/shell.h>
33template <
typename Real, std::
size_t N>
39template <
typename Real>
41 inline void operator()(
42 Real* intset,
const std::array<std::pair<Real*, size_t>, 2>& coeffs) {
44 for (
auto f0 = 0ul; f0 != coeffs[0].second; ++f0) {
45 for (
auto f1 = 0ul; f1 != coeffs[1].second; ++f1) {
46 const auto scalar01 = coeffs[0].first[f0] * coeffs[1].first[f1];
54template <
typename Real>
56 inline void operator()(
57 Real* intset,
const std::array<std::pair<Real*, size_t>, 4>& coeffs) {
59 for (
auto f0 = 0ul; f0 != coeffs[0].second; ++f0) {
60 for (
auto f1 = 0ul; f1 != coeffs[1].second; ++f1) {
61 const auto scalar01 = coeffs[0].first[f0] * coeffs[1].first[f1];
62 for (
auto f2 = 0ul; f2 != coeffs[2].second; ++f2) {
63 const auto scalar012 = scalar01 * coeffs[2].first[f2];
64 for (
auto f3 = 0ul; f3 != coeffs[3].second; ++f3) {
65 const auto scalar0123 = scalar012 * coeffs[3].first[f3];
78template <
typename Real>
79inline std::vector<Real> make_df_of_i_minux_1(
int imax) {
80 std::vector<Real> df_of_i_minux_1(std::max(2, imax + 1));
81 df_of_i_minux_1[0] = 1;
82 df_of_i_minux_1[1] = 1;
83 for (
int i = 2; i <= imax; ++i) {
85 (i - 1) * df_of_i_minux_1[i - 2];
87 return df_of_i_minux_1;
90template <
typename Real>
91inline std::vector<std::vector<Real>> make_cart_coeffs(
int lmax) {
92 static std::vector<Real> dfm1 =
93 make_df_of_i_minux_1<Real>(2 * lmax);
95 std::vector<std::vector<Real>> result(lmax + 1);
96 for (
int l = 0ul; l != lmax; ++l) {
97 const auto cart_shell_size = (l + 1) * (l + 2) / 2;
98 result[l].resize(cart_shell_size);
101 FOR_CART(ix, iy, iz, l)
103 result[l][ixyz] = sqrt(
104 dfm1.at(2 * l) / (dfm1.at(2 * ix) * dfm1.at(2 * iy) * dfm1.at(2 * iz)));
116template <
typename Real, std::
size_t N>
118 Real* intset, std::array<std::reference_wrapper<const Shell>, N> shells) {
119 static std::vector<std::vector<Real>> cart_coeffs =
120 detail::make_cart_coeffs<Real>(LIBINT_CARTGAUSS_MAX_AM);
121 const auto max_shellsize_pure = 2 * LIBINT_CARTGAUSS_MAX_AM + 1;
122 static std::vector<Real> pure_coeffs(max_shellsize_pure, Real(1));
124 std::array<std::pair<Real*, size_t>, N> coeffs;
125 for (
auto c = 0u; c != N; ++c) {
127 std::make_pair(shells[c].get().contr[0].pure
129 : &cart_coeffs[shells[c].get().contr[0].l][0],
130 shells[c].get().size());
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
void uniform_normalize_cartesian_shells(Real *intset, std::array< std::reference_wrapper< const Shell >, N > shells)
rescales cartesian Gaussians to convert from standard to uniform-normalized convention
Definition cartesian.h:117
Definition cartesian.h:34