21#ifndef _libint2_src_bin_libint_vrr1onep1_h_
22#define _libint2_src_bin_libint_vrr1onep1_h_
24#include <generic_rr.h>
34template <
class BFSet, FunctionPosition where>
36 VRR_1_Overlap_1<BFSet, where>, BFSet,
37 GenIntegralSet_1_1<BFSet, OverlapOper, EmptySet> > {
44 static const unsigned int max_nchildren = 9;
53 using ParentType::target_;
54 using ParentType::RecurrenceRelation::expr_;
55 using ParentType::RecurrenceRelation::nflops_;
61 static std::string descr() {
return "OSVRROverlap"; }
64template <
class F, FunctionPosition where>
65VRR_1_Overlap_1<F, where>::VRR_1_Overlap_1(
66 const std::shared_ptr<TargetType>& Tint,
unsigned int dir)
67 : ParentType(Tint, dir) {
68 using namespace libint2::algebra;
69 using namespace libint2::prefactor;
71 const F& _1 = unit<F>(dir);
76 if (a.contracted() || b.contracted())
return;
83 const bool deriv = !dA.
zero() || !dB.
zero();
85 typedef TargetType ChildType;
91 auto a = (where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
93 auto b = (where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
96 auto AB = factory.make_child(a, b);
98 expr_ = Vector(where == InBra ?
"PA" :
"PB")[dir] * AB;
103 auto am1_exists =
exists(am1);
105 auto bm1_exists =
exists(bm1);
108 auto Am1B = factory.make_child(am1, b);
110 expr_ += (Scalar(a[dir]) * Scalar(
"oo2z")) * Am1B;
115 auto ABm1 = factory.make_child(a, bm1);
117 expr_ += (Scalar(b[dir]) * Scalar(
"oo2z")) * ABm1;
127 F a(where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
128 F b(where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
133 for (
unsigned int dxyz = 0; dxyz < 3; ++dxyz) {
134 if (is_simple() && dxyz != dir)
141 std::shared_ptr<DGVertex> _nullptr;
148 auto AB = factory.make_child(a, b);
150 if (where == InBra) {
151 expr_ -= Vector(dA)[dxyz] * Scalar(
"rho12_over_alpha1") * AB;
154 if (where == InKet) {
155 expr_ += Vector(dA)[dxyz] * Scalar(
"rho12_over_alpha2") * AB;
168 auto AB = factory.make_child(a, b);
170 if (where == InBra) {
171 expr_ += Vector(dB)[dxyz] * Scalar(
"rho12_over_alpha1") * AB;
174 if (where == InKet) {
175 expr_ -= Vector(dB)[dxyz] * Scalar(
"rho12_over_alpha2") * AB;
191template <CartesianAxis Axis, FunctionPosition where>
194 VRR_1_Overlap_1_1d<Axis, where>, CGF1d<Axis>,
195 GenIntegralSet_1_1<CGF1d<Axis>, OverlapOper, EmptySet> > {
205 static const unsigned int max_nchildren = 9;
206 static constexpr auto axis = Axis;
215 using ParentType::target_;
216 using ParentType::RecurrenceRelation::expr_;
217 using ParentType::RecurrenceRelation::nflops_;
223 static std::string descr() {
224 return std::string(
"OSVRROverlap") +
to_string(axis);
228template <CartesianAxis Axis, FunctionPosition where>
230 const std::shared_ptr<TargetType>& Tint,
unsigned int dir)
231 : ParentType(Tint, dir) {
234 using namespace libint2::algebra;
235 using namespace libint2::prefactor;
238 const F& _1 = unit<F>(dir);
241 F a(Tint->bra(0, 0));
242 F b(Tint->ket(0, 0));
243 if (a.contracted() || b.contracted())
return;
250 const bool deriv = !dA.
zero() || !dB.
zero();
252 typedef TargetType ChildType;
258 auto zero = Tint->bra(0, 0).zero() and Tint->ket(0, 0).zero() and not deriv;
260 std::shared_ptr<DGVertex> int00 = Vector(
"_0_Overlap_0")[Axis];
261 expr_ = Scalar(0u) + int00;
269 auto a = (where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
271 auto b = (where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
274 auto AB = factory.make_child(a, b);
276 expr_ = Vector(where == InBra ?
"PA" :
"PB")[Axis] * AB;
281 auto am1_exists =
exists(am1);
283 auto bm1_exists =
exists(bm1);
286 auto Am1B = factory.make_child(am1, b);
288 expr_ += (Scalar(a.qn()) * Scalar(
"oo2z")) * Am1B;
293 auto ABm1 = factory.make_child(a, bm1);
295 expr_ += (Scalar(b.qn()) * Scalar(
"oo2z")) * ABm1;
305 F a(where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
306 F b(where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
312 std::shared_ptr<DGVertex> _nullptr;
319 auto AB = factory.make_child(a, b);
321 if (where == InBra) {
322 expr_ -= Scalar(dA[0]) * Scalar(
"rho12_over_alpha1") * AB;
325 if (where == InKet) {
326 expr_ += Scalar(dA[0]) * Scalar(
"rho12_over_alpha2") * AB;
339 auto AB = factory.make_child(a, b);
341 if (where == InBra) {
342 expr_ += Scalar(dB[0]) * Scalar(
"rho12_over_alpha1") * AB;
345 if (where == InKet) {
346 expr_ -= Scalar(dB[0]) * Scalar(
"rho12_over_alpha2") * AB;
362template <
class BFSet, FunctionPosition where>
364 VRR_1_Kinetic_1<BFSet, where>, BFSet,
365 GenIntegralSet_1_1<BFSet, KineticOper, EmptySet> > {
372 static const unsigned int max_nchildren = 9;
381 using ParentType::target_;
382 using ParentType::RecurrenceRelation::expr_;
383 using ParentType::RecurrenceRelation::nflops_;
389 static std::string descr() {
return "OSVRRKinetic"; }
392template <
class F, FunctionPosition where>
394 const std::shared_ptr<TargetType>& Tint,
unsigned int dir)
395 : ParentType(Tint, dir) {
396 using namespace libint2::algebra;
397 using namespace libint2::prefactor;
399 const F& _1 = unit<F>(dir);
402 F a(Tint->bra(0, 0));
403 F b(Tint->ket(0, 0));
404 if (a.contracted() || b.contracted())
return;
411 const bool deriv = !dA.
zero() || !dB.
zero();
413 typedef TargetType Child1Type;
421 auto a = (where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
423 auto b = (where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
426 auto AB = factory.make_child(a, b);
428 expr_ = Vector(where == InBra ?
"PA" :
"PB")[dir] * AB;
434 auto Am1B = factory.make_child(am1, b);
435 auto S_Am1B = (where == InBra) ? overlap_factory.make_child(am1, b)
436 : std::shared_ptr<DGVertex>();
438 if (where == InBra) {
439 expr_ += Scalar(a[dir]) * (Scalar(
"oo2z") * Am1B -
440 Scalar(
"rho12_over_alpha1") * S_Am1B);
443 expr_ += Scalar(a[dir]) * Scalar(
"oo2z") * Am1B;
450 auto ABm1 = factory.make_child(a, bm1);
451 auto S_ABm1 = (where == InKet) ? overlap_factory.make_child(a, bm1)
452 : std::shared_ptr<DGVertex>();
454 if (where == InKet) {
455 expr_ += Scalar(b[dir]) * (Scalar(
"oo2z") * ABm1 -
456 Scalar(
"rho12_over_alpha2") * S_ABm1);
459 expr_ += Scalar(b[dir]) * Scalar(
"oo2z") * ABm1;
466 auto S_AB_target = where == InBra ? overlap_factory.make_child(a + _1, b)
467 : overlap_factory.make_child(a, b + _1);
469 expr_ += Scalar(
"two_rho12") * S_AB_target;
481 F a(where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
482 F b(where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
487 for (
unsigned int dxyz = 0; dxyz < 3; ++dxyz) {
488 if (is_simple() && dxyz != dir)
495 std::shared_ptr<DGVertex> _nullptr;
502 auto AB = factory.make_child(a, b);
504 if (where == InBra) {
505 expr_ -= Vector(dA)[dxyz] * Scalar(
"rho12_over_alpha1") * AB;
508 if (where == InKet) {
509 expr_ += Vector(dA)[dxyz] * Scalar(
"rho12_over_alpha2") * AB;
522 auto AB = factory.make_child(a, b);
524 if (where == InBra) {
525 expr_ += Vector(dB)[dxyz] * Scalar(
"rho12_over_alpha1") * AB;
528 if (where == InKet) {
529 expr_ -= Vector(dB)[dxyz] * Scalar(
"rho12_over_alpha2") * AB;
545template <
class BFSet, FunctionPosition where>
547 VRR_1_ElecPot_1<BFSet, where>, BFSet,
548 GenIntegralSet_1_1<BFSet, ElecPotOper, mType> > {
555 static const unsigned int max_nchildren = 9;
564 using ParentType::target_;
565 using ParentType::RecurrenceRelation::expr_;
566 using ParentType::RecurrenceRelation::nflops_;
572 static std::string descr() {
return "OSVRRElecPot"; }
577 std::string generate_label()
const override {
578 typedef typename TargetType::AuxIndexType
mType;
579 static std::shared_ptr<mType> aux0(
new mType(0u));
580 std::ostringstream os;
582 << genintegralset_label(target_->bra(), target_->ket(), aux0,
588template <
class F, FunctionPosition where>
590 const std::shared_ptr<TargetType>& Tint,
unsigned int dir)
591 : ParentType(Tint, dir) {
592 using namespace libint2::algebra;
593 using namespace libint2::prefactor;
595 const unsigned int m = Tint->aux()->elem(0);
596 const F& _1 = unit<F>(dir);
599 F a(Tint->bra(0, 0));
600 F b(Tint->ket(0, 0));
601 if (a.contracted() || b.contracted())
return;
608 const bool deriv = !dA.
zero() || !dB.
zero();
610 typedef TargetType ChildType;
616 auto a = (where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
618 auto b = (where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
621 auto AB_m = factory.make_child(a, b, m);
622 auto AB_mp1 = factory.make_child(a, b, m + 1);
624 expr_ = Vector(where == InBra ?
"PA" :
"PB")[dir] * AB_m -
625 Vector(
"PC")[dir] * AB_mp1;
631 auto Am1B_m = factory.make_child(am1, b, m);
632 auto Am1B_mp1 = factory.make_child(am1, b, m + 1);
634 expr_ += Scalar(a[dir]) * Scalar(
"oo2z") * (Am1B_m - Am1B_mp1);
640 auto ABm1_m = factory.make_child(a, bm1, m);
641 auto ABm1_mp1 = factory.make_child(a, bm1, m + 1);
643 expr_ += Scalar(b[dir]) * Scalar(
"oo2z") * (ABm1_m - ABm1_mp1);
653 F a(where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
654 F b(where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
659 for (
unsigned int dxyz = 0; dxyz < 3; ++dxyz) {
660 if (is_simple() && dxyz != dir)
667 std::shared_ptr<DGVertex> _nullptr;
674 auto AB_m = factory.make_child(a, b, m);
675 auto AB_mp1 = factory.make_child(a, b, m + 1);
677 if (where == InBra) {
680 Vector(dA)[dxyz] * (Scalar(
"rho12_over_alpha1") * AB_m +
681 Scalar(
"rho12_over_alpha2") * AB_mp1);
684 if (where == InKet) {
686 expr_ += Vector(dA)[dxyz] * Scalar(
"rho12_over_alpha2") *
700 auto AB_m = factory.make_child(a, b, m);
701 auto AB_mp1 = factory.make_child(a, b, m + 1);
703 if (where == InBra) {
705 expr_ += Vector(dB)[dxyz] * Scalar(
"rho12_over_alpha1") *
709 if (where == InKet) {
712 Vector(dB)[dxyz] * (Scalar(
"rho12_over_alpha2") * AB_m +
713 Scalar(
"rho12_over_alpha1") * AB_mp1);
730template <
class BFSet, FunctionPosition where>
733 VRR_1_SMultipole_1<BFSet, where>, BFSet,
734 GenIntegralSet_1_1<BFSet, SphericalMultipoleOper, EmptySet> > {
743 static const unsigned int max_nchildren = 8;
752 using ParentType::target_;
753 using ParentType::RecurrenceRelation::expr_;
754 using ParentType::RecurrenceRelation::nflops_;
755 using typename ParentType::RecurrenceRelation::ExprType;
757 static std::string descr() {
return "OSVRRSMultipole"; }
762 : ParentType(Tint, dir) {
763 using namespace libint2::algebra;
764 using namespace libint2::prefactor;
766 using Sign = SphericalMultipoleQuanta::Sign;
768 const F& _1 = unit<F>(dir);
771 F a(Tint->bra(0, 0));
772 F b(Tint->ket(0, 0));
773 if (a.contracted() || b.contracted())
return;
781 const bool deriv = !dA.
zero() || !dB.
zero();
785 auto O_l_m = Tint->oper()->descr();
786 const auto l = O_l_m.l();
787 const auto m = O_l_m.m();
788 const auto sign = O_l_m.sign();
790 typedef TargetType ChildType;
794 [&](
const F& bra,
const F& ket,
795 const OperType::Descriptor& descr) -> std::shared_ptr<DGVertex> {
796 return factory.make_child(bra, ket,
EmptySet(), descr);
801 if (Tint->bra(0, 0).norm() != 0 || Tint->ket(0, 0).norm() != 0) {
805 auto a = (where == InBra ? Tint->bra(0, 0) - _1 : Tint->bra(0, 0));
807 auto b = (where == InKet ? Tint->ket(0, 0) - _1 : Tint->ket(0, 0));
815 expr_ = Vector(where == InBra ?
"PA" :
"PB")[dir] * AB;
820 auto am1_exists =
exists(am1);
822 auto bm1_exists =
exists(bm1);
824 std::shared_ptr<ExprType> subexpr;
829 subexpr += Scalar(a[dir]) * Am1B;
836 subexpr += Scalar(b[dir]) * ABm1;
845 auto AB_O_lm1_mp1 =
make_child(a, b, O_lm1_mp1);
846 if (is_simple() && dir == 0) {
847 subexpr += Scalar(O_lm1_mp1.phase() > 0 ? 0.5 : -0.5) * AB_O_lm1_mp1;
854 auto AB_O_lm1_mm1 =
make_child(a, b, O_lm1_mm1);
855 if (is_simple() && dir == 0) {
856 subexpr -= Scalar(O_lm1_mm1.phase() > 0 ? 0.5 : -0.5) * AB_O_lm1_mm1;
864 const auto m_pfac = sign == Sign::plus ? 1 : -1;
867 auto AB_Om_lm1_mp1 =
make_child(a, b, Om_lm1_mp1);
868 if (is_simple() && dir == 1) {
869 subexpr += Scalar(m_pfac * (Om_lm1_mp1.phase() > 0 ? 0.5 : -0.5)) *
877 auto AB_Om_lm1_mm1 =
make_child(a, b, Om_lm1_mm1);
878 if (is_simple() && dir == 1) {
879 subexpr += Scalar(m_pfac * (Om_lm1_mm1.phase() > 0 ? 0.5 : -0.5)) *
889 if (is_simple() && dir == 2) {
890 subexpr += AB_O_lm1_m;
896 if (subexpr) expr_ += Scalar(
"oo2z") * subexpr;
900 if (dir != 0)
return;
901 auto a = Tint->bra(0, 0);
902 auto b = Tint->ket(0, 0);
906 assert(sign == Sign::plus);
913 auto S00 = overlap_factory.make_child(a, b);
915 expr_ = Scalar(1) * S00;
918 std::shared_ptr<ExprType> subexpr;
924 auto AB_Op_lm1_mm1 =
make_child(a, b, Op_lm1_mm1);
927 Scalar(sign == Sign::plus ?
"PO_x" :
"PO_y") * AB_Op_lm1_mm1;
931 auto AB_Om_lm1_mm1 =
make_child(a, b, Om_lm1_mm1);
933 if (sign == Sign::plus)
934 subexpr -= Scalar(
"PO_y") * AB_Om_lm1_mm1;
936 subexpr += Scalar(
"PO_x") * AB_Om_lm1_mm1;
941 expr_ = Scalar(-0.5 / m) * subexpr;
945 std::shared_ptr<ExprType>
952 subexpr = Scalar((2 * l - 1)) * Scalar(
"PO_z") * AB_O_lm1_m;
958 if (is_simple()) subexpr -= Scalar(
"PO2") * AB_O_lm2_m;
963 expr_ = Scalar(1.0 / ((l + m) * (l - m))) * subexpr;
Set of basis functions.
Definition bfset.h:43
Cartesian components of 3D CGF = 1D CGF.
Definition bfset.h:457
Helps GenericRecurrenceRelation to work around the compiler problem with make_child.
Definition generic_rr.h:150
Generic integral over a one-body operator with one bfs for each particle in bra and ket.
Definition integral_1_1.h:36
GenOper is a single operator described by descriptor Descr.
Definition oper.h:164
RRImpl must inherit GenericRecurrenceRelation<RRImpl>
Definition generic_rr.h:47
const std::shared_ptr< DGVertex > & make_child(const typename RealChildType::BasisFunctionType &A, const typename RealChildType::BasisFunctionType &B, const typename RealChildType::BasisFunctionType &C, const typename RealChildType::BasisFunctionType &D, const typename RealChildType::AuxIndexType &aux=typename RealChildType::AuxIndexType(), const typename RealChildType::OperType &oper=typename RealChildType::OperType())
make_child should really looks something like this, but gcc 4.3.0 craps out TODO test is this works
Definition generic_rr.h:129
bool is_simple() const override
Implementation of RecurrenceRelation::is_simple()
Definition generic_rr.h:81
const std::shared_ptr< DGVertex > & add_child(const std::shared_ptr< DGVertex > &child)
add child
Definition generic_rr.h:109
static bool default_directional()
is this recurrence relation parameterized by a direction (x, y, or z).
Definition generic_rr.h:101
static std::shared_ptr< RRImpl > Instance(const std::shared_ptr< TargetType > &Tint, unsigned int dir)
Return an instance if applicable, or a null pointer otherwise.
Definition generic_rr.h:55
Represents cartesian derivatives of atom-centered basis functions.
Definition bfset.h:101
bool zero() const
norm() == 0
Definition bfset.h:158
void inc(unsigned int xyz, unsigned int c=1u)
Add c quanta along xyz.
Definition bfset.h:140
QuantumNumbersA<T,N> is a set of N quantum numbers of type T implemented in terms of a C-style array.
Definition quanta.h:193
VRR Recurrence Relation for 1-e electrostatic potential integrals.
Definition vrr_1_onep_1.h:548
static bool directional()
Default directionality.
Definition vrr_1_onep_1.h:560
VRR Recurrence Relation for 1-e kinetic energy integrals.
Definition vrr_1_onep_1.h:365
static bool directional()
Default directionality.
Definition vrr_1_onep_1.h:377
VRR Recurrence Relation for 1-d overlap integrals.
Definition vrr_1_onep_1.h:195
static bool directional()
Default directionality.
Definition vrr_1_onep_1.h:211
VRR Recurrence Relation for 1-e overlap integrals.
Definition vrr_1_onep_1.h:37
static bool directional()
Default directionality.
Definition vrr_1_onep_1.h:49
VRR Recurrence Relation for 1-e spherical multipole moment aka regular solid harmonics integrals.
Definition vrr_1_onep_1.h:734
static bool directional()
Default directionality.
Definition vrr_1_onep_1.h:748
these objects help to construct BraketPairs
Definition src/bin/libint/braket.h:275
Defaults definitions for various parameters assumed by Libint.
Definition algebra.cc:24
bool exists(const IncableBFSet &A)
Return true if A is valid.
Definition bfset.h:96
DefaultQuantumNumbers< unsignedint, 1 >::Result mType
mType is the type that describes the auxiliary index of standard 2-body repulsion integrals
Definition quanta.h:395
std::string to_string(const T &x)
Converts x to its string representation.
Definition entity.h:121
DefaultQuantumNumbers< int, 0 >::Result EmptySet
EmptySet is the type that describes null set of auxiliary indices.
Definition quanta.h:390
SphericalMultipoleQuanta::Sign flip(const SphericalMultipoleQuanta::Sign &s)
plus <-> minus
Definition multipole.h:271
Represents quantum numbers of real spherical multipole operator defined in Eqs.
Definition oper.h:362