21 #ifndef _libint2_src_bin_libint_gaussoper_h_ 22 #define _libint2_src_bin_libint_gaussoper_h_ 24 #include <boost/type_traits/is_same.hpp> 26 #include <prefactors.h> 27 #include <global_macros.h> 32 template <
class F, BraketType BKType>
37 if (BKType == CBra || BKType == CKet)
38 throw std::logic_error(
"R12vec_dot_Nabla1 can only be applied to physicists brakets");
40 const char* zeta = (BKType == PBra) ?
"zeta_A" :
"zeta_B";
41 const char* XY = (BKType == PBra) ?
"AC" :
"BD";
43 const auto& f = bkt[0];
44 const auto& g = bkt[1];
48 using namespace libint2::prefactor;
50 result += make_pair(Scalar((
double)f.norm()),
53 const unsigned int nxyz = boost::is_same<F,CGF>::value ? 3 : 1;
54 for(
unsigned int xyz=0; xyz<nxyz; ++xyz) {
55 using namespace libint2::algebra;
57 const F& fm1 = f - _1;
58 const F& gp1 = g + _1;
60 const double f_xyz = (double)(f.qn(xyz));
61 result += make_pair(Scalar(-1.0*f_xyz),
63 result += make_pair(Scalar(f_xyz)*Vector(XY)[xyz],
66 const F& fp1 = f + _1;
67 const F& fp2 = fp1 + _1;
68 result += make_pair(Scalar(-2.0) * Scalar(zeta),
70 result += make_pair(Scalar(2.0) * Scalar(zeta),
72 result += make_pair(Scalar(-2.0) * Scalar(zeta) * Vector(XY)[xyz],
80 template <
class F, BraketType BKType>
85 if (BKType == CBra || BKType == CKet)
86 throw std::logic_error(
"R12vec_dot_Nabla2 can only be applied to physicists brakets");
88 const char* zeta = (BKType == PBra) ?
"zeta_C" :
"zeta_D";
89 const char* XY = (BKType == PBra) ?
"AC" :
"BD";
96 using namespace libint2::prefactor;
98 result += make_pair(Scalar(-1.0*g.norm()),
101 const unsigned int nxyz = boost::is_same<F,CGF>::value ? 3 : 1;
102 for(
unsigned int xyz=0; xyz<nxyz; ++xyz) {
103 using namespace libint2::algebra;
105 const F& fp1 = f + _1;
106 const F& gm1 = g - _1;
108 const double g_xyz = (double)(g.qn(xyz));
109 result += make_pair(Scalar(g_xyz),
111 result += make_pair(Scalar(g_xyz)*Vector(XY)[xyz],
114 const F& gp1 = g + _1;
115 const F& gp2 = gp1 + _1;
116 result += make_pair(Scalar(-2.0) * Scalar(zeta),
118 result += make_pair(Scalar(2.0) * Scalar(zeta),
120 result += make_pair(Scalar(-2.0) * Scalar(zeta) * Vector(XY)[xyz],
128 template <
class F, BraketType BKType>
133 if (BKType == CBra || BKType == CKet)
134 throw std::logic_error(
"Nabla1 can only be applied to physicists brakets");
136 const char* zeta = (BKType == PBra) ?
"zeta_A" :
"zeta_B";
143 using namespace libint2::prefactor;
144 using namespace libint2::algebra;
146 const unsigned int dir = boost::is_same<F,CGF>::value ? xyz : 0;
148 const F& fm1 = f - _1;
150 const double f_xyz = (double)(f.qn(dir));
151 result += make_pair(Scalar(f_xyz),
154 const F& fp1 = f + _1;
155 result += make_pair(Scalar(-2.0) * Scalar(zeta),
161 template <
class F, BraketType BKType>
166 if (BKType == CBra || BKType == CKet)
167 throw std::logic_error(
"Nabla2 can only be applied to physicists brakets");
169 const char* zeta = (BKType == PBra) ?
"zeta_C" :
"zeta_D";
176 using namespace libint2::prefactor;
177 using namespace libint2::algebra;
179 const unsigned int dir = boost::is_same<F,CGF>::value ? xyz : 0;
181 const F& gm1 = g - _1;
183 const double g_xyz = (double)(g.qn(dir));
184 result += make_pair(Scalar(g_xyz),
187 const F& gp1 = g + _1;
188 result += make_pair(Scalar(-2.0) * Scalar(zeta),
194 template <
class F, BraketType BKType>
200 if (BKType == CBra || BKType == CKet)
201 throw std::logic_error(
"R12v can only be applied to physicists brakets");
203 const char* XY = (BKType == PBra) ?
"AC" :
"BD";
210 using namespace libint2::prefactor;
211 using namespace libint2::algebra;
213 const unsigned int dir = boost::is_same<F,CGF>::value ? xyz : 0;
215 const F& fp1 = f + _1;
216 const F& gp1 = g + _1;
217 result += make_pair(Scalar(1.0),
219 result += make_pair(Scalar(-1.0),
221 result += make_pair(Vector(XY)[xyz],
228 #endif // header guard LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > R12vec_dot_Nabla1(const BraketPair< F, BKType > &bkt)
Applies R12vec_dot_Nabla1 to a physicists' braket.
Definition: gaussoper.h:36
Defaults definitions for various parameters assumed by Libint.
Definition: algebra.cc:24
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > Nabla1(const BraketPair< F, BKType > &bkt, int xyz)
Applies Nabla1 to a physicists' braket.
Definition: gaussoper.h:132
represents linear combination of objects of type T with coefficients of type C
Definition: algebra.h:223
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > R12v(const BraketPair< F, BKType > &bkt, unsigned int xyz)
Applies R12v to a physicists' braket.
Definition: gaussoper.h:198
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > R12vec_dot_Nabla2(const BraketPair< F, BKType > &bkt)
Applies R12vec_dot_Nabla2 to a physicists' braket.
Definition: gaussoper.h:84
bool exists(const IncableBFSet &A)
Return true if A is valid.
Definition: bfset.h:92
LinearCombination< SafePtr< DGVertex >, BraketPair< F, BKType > > Nabla2(const BraketPair< F, BKType > &bkt, int xyz)
Applies Nabla2 to a physicists' braket.
Definition: gaussoper.h:165
BraketPair is a trimmed down version of ArrayBraket specialized for same-particle or different-partic...
Definition: braket.h:244