25
25
#include " Shell.hh"
26
26
#include " gint/IntegralUpdateKeys.hh"
27
27
#include " read_basisset.hh"
28
+ #include < iterator>
28
29
#include < krims/DataFiles/FindDataFile.hh>
29
30
#include < krims/FileSystem.hh>
30
31
@@ -45,7 +46,13 @@ std::vector<std::pair<double, std::array<double, 3>>> inline make_libint_point_c
45
46
return ret;
46
47
}
47
48
48
- /* * Convert a gint::gaussian::Basis to a libint basis */
49
+ // If boost has the container::small_vector available libint uses this datastructure.
50
+ // Unfortunately a std::vector cannot be directly converted to this datastructure
51
+ // and we need to distinguish between two codepaths, namely one with explict conversion
52
+ // and one without
53
+ /* * Convert a gint::gaussian::Basis to a libint basis if the vector types agree */
54
+ template <bool vectors_types_agree =
55
+ std::is_same<libint2::svector<real_type>, std::vector<real_type>>::value>
49
56
std::vector<libint2::Shell> make_libint_basis (Basis basis) {
50
57
std::vector<libint2::Shell> ret;
51
58
ret.reserve (basis.size ());
@@ -55,7 +62,26 @@ std::vector<libint2::Shell> make_libint_basis(Basis basis) {
55
62
libint2::Shell tosh{std::move (sh.exponents ), {std::move (cntr)}, std::move (sh.origin )};
56
63
ret.push_back (std::move (tosh));
57
64
}
65
+ return ret;
66
+ }
67
+
68
+ /* * Convert a gint::gaussian::Basis to a libint basis if the vector types do not agree */
69
+ template <>
70
+ std::vector<libint2::Shell> make_libint_basis<false >(Basis basis) {
71
+ std::vector<libint2::Shell> ret;
72
+ ret.reserve (basis.size ());
58
73
74
+ for (const Shell& sh : basis) {
75
+ libint2::svector<real_type> l_coefficients{
76
+ std::make_move_iterator (sh.coefficients .begin ()),
77
+ std::make_move_iterator (sh.coefficients .end ())};
78
+ libint2::svector<real_type> l_exponents{std::make_move_iterator (sh.exponents .begin ()),
79
+ std::make_move_iterator (sh.exponents .end ())};
80
+
81
+ libint2::Shell::Contraction cntr{sh.l , sh.pure , std::move (l_coefficients)};
82
+ libint2::Shell tosh{std::move (l_exponents), {std::move (cntr)}, std::move (sh.origin )};
83
+ ret.push_back (std::move (tosh));
84
+ }
59
85
return ret;
60
86
}
61
87
0 commit comments