MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
intdescr.h
1//
2// intdescr.h
3//
4// Copyright (C) 2005 Edward Valeev
5//
6// Author: Edward Valeev <evaleev@vt.edu>
7// Maintainer: EV
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _chemistry_qc_basis_intdescr_h
29#define _chemistry_qc_basis_intdescr_h
30
31#include <chemistry/qc/basis/integral.h>
32#include <chemistry/qc/basis/intparams.h>
33#include <chemistry/qc/basis/inttraits.h>
34
35namespace sc {
36
37 template <typename IntEval> struct IntEvalToOperSetType;
38 template <> struct IntEvalToOperSetType<TwoBodyInt> {
40 };
46 };
47
55 template <typename IntEval>
56 class IntegralSetDescr : public RefCount {
57 public:
59
61 virtual const Ref<Integral>& factory() const =0;
63 virtual Ref<IntEval> inteval() const =0;
65 virtual unsigned int num_sets() const =0;
67 virtual Ref<IntParams> params() const =0;
69 virtual typename IntEvalToOperSetType<IntEval>::value operset() const =0;
70
72 virtual unsigned int intset(TwoBodyOper::type t) const =0;
74 virtual TwoBodyOper::type intset(unsigned int t) const =0;
75
77 //PropertyIterator propiter();
78 };
79
80 template <int NumCenters> struct TwoBodyIntType;
81 template <> struct TwoBodyIntType<4> {
82 typedef TwoBodyInt value;
83 };
84 template <> struct TwoBodyIntType<3> {
86 };
87 template <> struct TwoBodyIntType<2> {
89 };
90
92 template <int NumCenters, TwoBodyOperSet::type TwoBodyIntSet>
93 class TwoBodyNCenterIntDescr : public IntegralSetDescr< typename TwoBodyIntType<NumCenters>::value > {
94 public:
96 typedef typename TraitsType::ParamsType ParamsType;
97 typedef typename TwoBodyIntType<NumCenters>::value EvalType;
98
99 static const unsigned int num_intsets = TraitsType::size;
101 const Ref<ParamsType>& params = Ref<ParamsType>(dynamic_cast<ParamsType*>(new IntParamsVoid))) :
102 factory_(IF),
103 params_(params) { }
105 const Ref<IntParams>& params) :
106 factory_(IF),
107 params_(0) {
108 params_ << params;
109 MPQC_ASSERT(params_);
110 }
112
114 const Ref<Integral>& factory() const { return factory_; }
115 // implementation of TwoBodyIntDescr::inteval()
117 return TraitsType::eval(factory_, params_);
118 }
119 // implementation of TwoBodyIntDescr::params()
121 return params_;
122 }
123 // implementation of TwoBodyIntDescr::operset()
124 TwoBodyOperSet::type operset() const { return TwoBodyIntSet; }
125 // implementation of TwoBodyIntDescr::num_sets()
126 unsigned int num_sets() const { return num_intsets; }
127 // Implementation of TwoBodyIntDescr::intset()
128 unsigned int intset(TwoBodyOper::type t) const {
129 return intSet(t);
130 }
131 // Implementation of TwoBodyIntDescr::intset()
132 TwoBodyOper::type intset(unsigned int t) const {
133 return intSet(t);
134 }
136 static unsigned int intSet(TwoBodyOper::type t) {
137 return TraitsType::intset(t);
138 }
140 static TwoBodyOper::type intSet(unsigned int t) {
141 return TraitsType::intset(t);
142 }
143
144 private:
146 Ref<Integral> factory_;
148 Ref<ParamsType> params_;
149
150 };
151
152
153 typedef IntegralSetDescr<TwoBodyInt> TwoBodyIntDescr;
154 typedef IntegralSetDescr<TwoBodyThreeCenterInt> TwoBodyThreeCenterIntDescr;
155 typedef IntegralSetDescr<TwoBodyTwoCenterInt> TwoBodyTwoCenterIntDescr;
156 template <int NumCenters, int NumParticles> struct NCentersToIntDescr;
157 template <> struct NCentersToIntDescr<4,2> {
158 typedef TwoBodyIntDescr value;
159 };
160 template <> struct NCentersToIntDescr<3,2> {
162 };
163 template <> struct NCentersToIntDescr<2,2> {
165 };
166
182
184 template <int NumCenters>
186 make(const Ref<Integral>& integral,
188 const Ref<IntParams>& params) {
189 typedef typename NCentersToIntDescr<NumCenters,2>::value ReturnType;
190 switch (type) {
191 case TwoBodyOperSet::ERI: {
193 return new ConcreteType(integral,params);
194 } break;
195 case TwoBodyOperSet::R12: {
197 return new ConcreteType(integral,params);
198 } break;
199 case TwoBodyOperSet::G12: {
201 return new ConcreteType(integral,params);
202 } break;
205 return new ConcreteType(integral,params);
206 } break;
209 return new ConcreteType(integral,params);
210 } break;
213 return new ConcreteType(integral,params);
214 } break;
217 return new ConcreteType(integral,params);
218 } break;
221 return new ConcreteType(integral,params);
222 } break;
225 return new ConcreteType(integral,params);
226 } break;
227 default:
228 MPQC_ASSERT(false);
229 }
230 return Ref< typename NCentersToIntDescr<NumCenters,2>::value >(); // dummy return statement to pacify picky compilers
231 }
232 };
233
234
235 template <int NumCenters> struct OneBodyIntType;
236 template <> struct OneBodyIntType<2> {
237 typedef OneBodyInt value;
238 };
239 template <> struct OneBodyIntType<1> {
241 };
242
245 template <> struct NCentersToIntDescr<2,1> {
246 typedef OneBodyIntDescr value;
247 };
248 template <> struct NCentersToIntDescr<1,1> {
250 };
251
253 template <int NumCenters, OneBodyOperSet::type OneBodyIntSet>
254 class OneBodyNCenterIntDescr : public IntegralSetDescr< typename OneBodyIntType<NumCenters>::value > {
255 public:
257 typedef typename TraitsType::ParamsType ParamsType;
258 typedef typename OneBodyIntType<NumCenters>::value EvalType;
259
260 static const unsigned int num_intsets = TraitsType::size;
262 const Ref<ParamsType>& params = Ref<ParamsType>(dynamic_cast<ParamsType*>(new IntParamsVoid))) :
263 factory_(IF),
264 params_(params) { }
266 const Ref<IntParams>& params) :
267 factory_(IF),
268 params_(0) {
269 params_ << params;
270 MPQC_ASSERT(params_);
271 }
273
275 const Ref<Integral>& factory() const { return factory_; }
276 // implementation of TwoBodyIntDescr::inteval()
278 return TraitsType::eval(factory_, params_);
279 }
280 // implementation of TwoBodyIntDescr::params()
282 return params_;
283 }
284 // implementation of OneBodyIntDescr::operset()
285 OneBodyOperSet::type operset() const { return OneBodyIntSet; }
286 // implementation of OneBodyIntDescr::num_sets()
287 unsigned int num_sets() const { return num_intsets; }
288 // Implementation of OneBodyIntDescr::intset()
289 unsigned int intset(OneBodyOper::type t) const {
290 return intSet(t);
291 }
292 // Implementation of OneBodyIntDescr::intset()
293 OneBodyOper::type intset(unsigned int t) const {
294 return intSet(t);
295 }
297 static unsigned int intSet(OneBodyOper::type t) {
298 return TraitsType::intset(t);
299 }
301 static OneBodyOper::type intSet(unsigned int t) {
302 return TraitsType::intset(t);
303 }
304
305 private:
307 Ref<Integral> factory_;
309 Ref<ParamsType> params_;
310
311 };
312
313
314}
315
316#endif
317
Passes params to Integral::electron_repulsion() and other factory methods which do not need parameter...
Definition intparams.h:107
IntegralSetDescr contains all information necessary to construct an IntEval object that computes a pa...
Definition intdescr.h:56
virtual TwoBodyOper::type intset(unsigned int t) const =0
Maps integral set t to its TwoBodyOper::type.
virtual Ref< IntParams > params() const =0
optional parameters that determine the operator set (e.g., geminal exponents, etc....
virtual unsigned int num_sets() const =0
how many integral sets
virtual Ref< IntEval > inteval() const =0
call appropriate method to produce TwoBodyInt corresponding to this Set
virtual IntEvalToOperSetType< IntEval >::value operset() const =0
the type of the operator set
virtual unsigned int intset(TwoBodyOper::type t) const =0
Maps integral set t to its index in this set.
virtual const Ref< Integral > & factory() const =0
the factory used to create integral evaluator
OneBodyInt is an abstract base class for objects that compute integrals between two basis functions.
Definition obint.h:49
Implements descriptors for various two-body evaluators.
Definition intdescr.h:254
Ref< IntParams > params() const
optional parameters that determine the operator set (e.g., geminal exponents, etc....
Definition intdescr.h:281
static OneBodyOper::type intSet(unsigned int t)
Static version of OneBodyIntDescr::intset()
Definition intdescr.h:301
static unsigned int intSet(OneBodyOper::type t)
Static version of OneBodyIntDescr::intset()
Definition intdescr.h:297
unsigned int num_sets() const
how many integral sets
Definition intdescr.h:287
OneBodyOperSet::type operset() const
the type of the operator set
Definition intdescr.h:285
Ref< EvalType > inteval() const
call appropriate method to produce TwoBodyInt corresponding to this Set
Definition intdescr.h:277
const Ref< Integral > & factory() const
which factory is used
Definition intdescr.h:275
OneBodyOper::type intset(unsigned int t) const
Maps integral set t to its TwoBodyOper::type.
Definition intdescr.h:293
OneBodyOneCenterInt is an abstract base class for objects that compute integrals between two basis fu...
Definition obint.h:124
The base class for all reference counted objects.
Definition ref.h:192
A template class that maintains references counts.
Definition ref.h:361
This is an abstract base type for classes that compute integrals involving two electrons and 2 functi...
Definition tbint.h:61
Implements descriptors for various two-body evaluators.
Definition intdescr.h:93
unsigned int num_sets() const
how many integral sets
Definition intdescr.h:126
static unsigned int intSet(TwoBodyOper::type t)
Static version of TwoBodyIntDescr::intset()
Definition intdescr.h:136
unsigned int intset(TwoBodyOper::type t) const
Maps integral set t to its index in this set.
Definition intdescr.h:128
Ref< EvalType > inteval() const
call appropriate method to produce TwoBodyInt corresponding to this Set
Definition intdescr.h:116
TwoBodyOperSet::type operset() const
the type of the operator set
Definition intdescr.h:124
static TwoBodyOper::type intSet(unsigned int t)
Static version of TwoBodyIntDescr::intset()
Definition intdescr.h:140
const Ref< Integral > & factory() const
which factory is used
Definition intdescr.h:114
Ref< IntParams > params() const
optional parameters that determine the operator set (e.g., geminal exponents, etc....
Definition intdescr.h:120
TwoBodyOper::type intset(unsigned int t) const
Maps integral set t to its TwoBodyOper::type.
Definition intdescr.h:132
This is an abstract base type for classes that compute integrals involving two electrons in three Gau...
Definition tbint.h:191
This is an abstract base type for classes that compute integrals involving two electrons in two Gauss...
Definition tbint.h:305
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Definition intdescr.h:183
Definition intdescr.h:37
Definition intdescr.h:156
Traits of a set of one-body integrals.
Definition inttraits.h:49
static Ref< EvalType > eval(const Ref< Integral > &factory, const Ref< ParamsType > &params)
creates an Eval object
Definition inttraits.h:60
OneBodyIntParamsType< Type >::value ParamsType
the type of IntParams object needed to initialize the evaluator for computing this set of integrals
Definition inttraits.h:54
static OneBodyOper::type intset(unsigned int t)
maps index of the integral type within this set to TwoBodyOper::type
Definition inttraits.h:66
static const int size
number of integral types
Definition inttraits.h:58
Definition intdescr.h:235
type
one-body operator sets (
Definition operator.h:168
type
Types of one-body operators, includes various context-dependent "projectors", such as 1-RDM,...
Definition operator.h:103
Traits of a set of two-body integrals.
Definition inttraits.h:137
static Ref< EvalType > eval(const Ref< Integral > &factory, const Ref< ParamsType > &params)
creates an Eval object
Definition inttraits.h:148
TwoBodyIntParamsType< Type >::value ParamsType
the type of IntParams object needed to initialize the evaluator for computing this set of integrals
Definition inttraits.h:142
static TwoBodyOper::type intset(unsigned int t)
maps index of the integral type within this set to TwoBodyOper::type
Definition inttraits.h:154
static const int size
number of integral types
Definition inttraits.h:146
Definition intdescr.h:80
type
Definition operator.h:344
@ G12
{eri, r12_0_g12, r12_m1_g12, t1g12, t2g12, g12t1g12}
Definition operator.h:347
@ R12
{eri, r12, r12t1, r12t2}
Definition operator.h:346
@ R12_0_G12
{r12_0_g12}
Definition operator.h:350
@ G12DKH
{g12p4g12_m_g12t1g12t1}
Definition operator.h:349
@ ERI
{eri}
Definition operator.h:345
@ R12_m1_G12
{r12_m1_g12}
Definition operator.h:351
@ G12_T1_G12
{g12t1g12}
Definition operator.h:352
@ G12NC
{eri, r12_0_g12, r12_m1_g12, g12t1g12, anti_g12g12}
Definition operator.h:348
@ DeltaFunction
{delta}
Definition operator.h:353
type
types of known two-body operators
Definition operator.h:318

Generated at Wed Sep 25 2024 02:45:29 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.