MPQC  3.0.0-alpha
creator.h
1 //
2 // creator.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_mbptr12_creator_h
29 #define _chemistry_qc_mbptr12_creator_h
30 
31 #include <chemistry/qc/mbptr12/r12technology.h>
32 #include <chemistry/qc/lcao/moints_runtime.h>
33 
34 namespace sc {
35 
39  template<typename T>
40  class RangeCreator {
41  public:
42  RangeCreator(unsigned int n) :
43  n_(n), ncreated_(0) {
44  }
46  virtual T operator()() =0;
48  virtual T null() const {
49  return T(0);
50  }
51 
52  protected:
53  bool can_create() const {
54  return ncreated_ < n_;
55  }
56  void next() {
57  ++ncreated_;
58  }
59  unsigned int ncreated() const {
60  return ncreated_;
61  }
62 
63  private:
64  unsigned int n_;
65  unsigned int ncreated_;
66  };
67 
69  class DistArray4Creator: public RangeCreator<Ref<DistArray4> > {
70  public:
71  typedef Ref<DistArray4> ObjT;
72 
74  const std::vector<std::string>& tform_keys);
76  ObjT operator()();
77 
78  private:
79  const Ref<TwoBodyFourCenterMOIntsRuntime>& moints_rtime_;
80  const std::vector<std::string>& tform_keys_;
81  };
82 
84  class TwoBodyIntDescrCreator: public RangeCreator<Ref<TwoBodyIntDescr> > {
85  public:
86  typedef Ref<TwoBodyIntDescr> ObjT;
87 
89  const Ref<Integral>& integral,
90  bool CorrFunctionInBra = false,
91  bool CorrFunctionInKet = false);
93  ObjT operator()();
94 
95  private:
97  Ref<Integral> integral_;
98  bool CorrFunctionInBraKet_;
99  unsigned int nf12bra_;
100  unsigned int nf12ket_;
101  unsigned int braindex_;
102  unsigned int ketindex_;
103 
104  void increment_indices();
105  };
106 
108  class R12TwoBodyIntKeyCreator: public RangeCreator<std::string> {
109  public:
110  typedef std::string ObjT;
111 
113  const Ref<OrbitalSpace>& bra1,
114  const Ref<OrbitalSpace>& ket1,
115  const Ref<OrbitalSpace>& bra2,
116  const Ref<OrbitalSpace>& ket2,
117  const Ref<R12Technology::CorrelationFactor>& corrfactor,
118  bool CorrFunctionInBra = false,
119  bool CorrFunctionInKet = false,
120  std::string layout_key = std::string(TwoBodyIntLayout::b1b2_k1k2));
122  ObjT operator()();
123 
124  ObjT null() const;
125 
126  private:
129  const Ref<OrbitalSpace>& bra1_;
130  const Ref<OrbitalSpace>& bra2_;
131  const Ref<OrbitalSpace>& ket1_;
132  const Ref<OrbitalSpace>& ket2_;
133  bool CorrFunctionInBra_;
134  bool CorrFunctionInKet_;
135  std::string layout_key_;
136  unsigned int nf12bra_;
137  unsigned int nf12ket_;
138  unsigned int braindex_;
139  unsigned int ketindex_;
140 
141  void increment_indices();
142  };
143 
144 }
145 
146 #endif
147 
sc::DistArray4Creator
Creates new DistArray4 using TwoBodyFourCenterMOIntsRuntime and a vector of transform keys.
Definition: creator.h:69
sc::Ref
A template class that maintains references counts.
Definition: ref.h:361
sc::RangeCreator::operator()
virtual T operator()()=0
returns a new object T, or null() if done.
sc::TwoBodyIntDescrCreator
Creates TwoBodyIntDescr for correlation factor C.
Definition: creator.h:84
sc::DistArray4Creator::operator()
ObjT operator()()
Implementation of RangeCreator::operator()
sc::TwoBodyIntDescrCreator::operator()
ObjT operator()()
Implementation of RangeCreator::operator()
sc::R12TwoBodyIntKeyCreator
Creates R12TwoBodyIntKey for the given CorrelationFactor.
Definition: creator.h:108
sc::RangeCreator
RangeCreator<T> is Functor which can be used up to n times to create objects of type T.
Definition: creator.h:40
sc
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
sc::R12TwoBodyIntKeyCreator::operator()
ObjT operator()()
Implementation of RangeCreator::operator()

Generated at Sun Jan 26 2020 23:23:59 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.