00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifdef __GNUG__
00029 #pragma interface
00030 #endif
00031
00032 #ifndef _chemistry_qc_mbptr12_creator_h
00033 #define _chemistry_qc_mbptr12_creator_h
00034
00035 #include <chemistry/qc/mbptr12/linearr12.h>
00036 #include <chemistry/qc/mbptr12/moints_runtime.h>
00037
00038 namespace sc {
00039
00043 template<typename T>
00044 class RangeCreator {
00045 public:
00046 RangeCreator(unsigned int n) :
00047 n_(n), ncreated_(0) {
00048 }
00050 virtual T operator()() =0;
00052 virtual T null() const {
00053 return T(0);
00054 }
00055
00056 protected:
00057 bool can_create() const {
00058 return ncreated_ < n_;
00059 }
00060 void next() {
00061 ++ncreated_;
00062 }
00063 unsigned int ncreated() const {
00064 return ncreated_;
00065 }
00066
00067 private:
00068 unsigned int n_;
00069 unsigned int ncreated_;
00070 };
00071
00073 class R12IntsAccCreator: public RangeCreator<Ref<R12IntsAcc> > {
00074 public:
00075 typedef Ref<R12IntsAcc> ObjT;
00076
00077 R12IntsAccCreator(const Ref<MOIntsRuntime>& moints_rtime,
00078 const std::vector<std::string>& tform_keys);
00080 ObjT operator()();
00081
00082 private:
00083 const Ref<MOIntsRuntime>& moints_rtime_;
00084 const std::vector<std::string>& tform_keys_;
00085 };
00086
00087 using LinearR12::CorrelationFactor;
00089 class TwoBodyIntDescrCreator: public RangeCreator<Ref<TwoBodyIntDescr> > {
00090 public:
00091 typedef Ref<TwoBodyIntDescr> ObjT;
00092
00093 TwoBodyIntDescrCreator(const Ref<CorrelationFactor>& corrfactor,
00094 const Ref<Integral>& integral,
00095 bool CorrFunctionInBra = false,
00096 bool CorrFunctionInKet = false);
00098 ObjT operator()();
00099
00100 private:
00101 Ref<CorrelationFactor> corrfactor_;
00102 Ref<Integral> integral_;
00103 bool CorrFunctionInBraKet_;
00104 unsigned int nf12bra_;
00105 unsigned int nf12ket_;
00106 unsigned int braindex_;
00107 unsigned int ketindex_;
00108
00109 void increment_indices();
00110 };
00111
00113 class R12TwoBodyIntKeyCreator: public RangeCreator<std::string> {
00114 public:
00115 typedef std::string ObjT;
00116
00117 R12TwoBodyIntKeyCreator(const Ref<MOIntsRuntime>& moints_rtime_,
00118 const Ref<OrbitalSpace>& bra1,
00119 const Ref<OrbitalSpace>& ket1,
00120 const Ref<OrbitalSpace>& bra2,
00121 const Ref<OrbitalSpace>& ket2,
00122 const Ref<CorrelationFactor>& corrfactor,
00123 bool CorrFunctionInBra = false,
00124 bool CorrFunctionInKet = false,
00125 std::string layout_key = std::string(MOIntsRuntime::Layout_b1b2_k1k2));
00127 ObjT operator()();
00128
00129 ObjT null() const;
00130
00131 private:
00132 Ref<MOIntsRuntime> moints_rtime_;
00133 Ref<CorrelationFactor> corrfactor_;
00134 const Ref<OrbitalSpace>& bra1_;
00135 const Ref<OrbitalSpace>& bra2_;
00136 const Ref<OrbitalSpace>& ket1_;
00137 const Ref<OrbitalSpace>& ket2_;
00138 bool CorrFunctionInBraKet_;
00139 std::string layout_key_;
00140 unsigned int nf12bra_;
00141 unsigned int nf12ket_;
00142 unsigned int braindex_;
00143 unsigned int ketindex_;
00144
00145 void increment_indices();
00146 };
00147
00148 }
00149
00150 #endif
00151