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_transformfactory_h
00033 #define _chemistry_qc_mbptr12_transformfactory_h
00034
00035 #include <string>
00036 #include <util/ref/ref.h>
00037 #include <util/group/memory.h>
00038 #include <chemistry/molecule/energy.h>
00039 #include <chemistry/qc/basis/integral.h>
00040 #include <chemistry/qc/mbptr12/orbitalspace.h>
00041 #include <chemistry/qc/mbptr12/linearr12.h>
00042
00043 using namespace std;
00044
00045 namespace sc {
00046
00052 class CreateTransformHints {
00053 public:
00054 CreateTransformHints();
00055 CreateTransformHints(const CreateTransformHints&);
00056 CreateTransformHints& operator=(const CreateTransformHints& other);
00057
00059 bool data_persistent() const
00060 {
00061 return data_persistent_;
00062 }
00063 void data_persistent(bool data_persistent_)
00064 {
00065 this->data_persistent_ = data_persistent_;
00066 }
00067
00068 private:
00069 bool data_persistent_;
00070 };
00071
00072 class TwoBodyMOIntsTransform;
00073
00074
00077 class MOIntsTransformFactory : virtual public SavableState {
00078
00079 public:
00080
00082 struct StoreMethod {
00083 enum type { mem_posix = 0, posix = 1, mem_mpi = 2, mpi = 3, mem_only = 4 };
00084 };
00086 enum StorageType {StorageType_First=0, StorageType_Last=1,
00087 StorageType_12=0, StorageType_13=1};
00089 enum TwoBodyTransformType {
00090 TwoBodyTransformType_ixjy=0, TwoBodyTransformType_ikjy=1,
00091 TwoBodyTransformType_ijxy=2, TwoBodyTransformType_iRjS=3,
00092 TwoBodyTransformType_First=TwoBodyTransformType_ixjy,
00093 TwoBodyTransformType_Last=TwoBodyTransformType_iRjS
00094 };
00095
00096 private:
00097
00099 typedef TwoBodyIntDescrERI DefaultTwoBodyIntDescr;
00100
00101 Ref<MolecularEnergy> top_mole_;
00102
00103 Ref<Integral> integral_;
00104 Ref<MessageGrp> msg_;
00105 Ref<MemoryGrp> mem_;
00106 Ref<ThreadGrp> thr_;
00107
00108 Ref<TwoBodyIntDescr> tbintdescr_;
00109
00110 Ref<OrbitalSpace> space1_;
00111 Ref<OrbitalSpace> space2_;
00112 Ref<OrbitalSpace> space3_;
00113 Ref<OrbitalSpace> space4_;
00114
00115 CreateTransformHints hints_;
00116 size_t memory_;
00117 bool dynamic_;
00118 double print_percent_;
00119 int debug_;
00120 StoreMethod::type ints_method_;
00121 std::string file_prefix_;
00122
00123
00124 friend class TwoBodyMOIntsTransform;
00125 void release_memory(size_t nbytes);
00126 void reserve_memory(size_t nbytes);
00127
00128 template <typename TransformType> Ref<TwoBodyMOIntsTransform>
00129 twobody_transform(const std::string& name,
00130 const Ref<TwoBodyIntDescr>& descrarg);
00131
00132 public:
00133
00134 MOIntsTransformFactory(StateIn&);
00135 MOIntsTransformFactory(const Ref<Integral>& integral,
00136 const Ref<OrbitalSpace>& space1, const Ref<OrbitalSpace>& space2 = 0,
00137 const Ref<OrbitalSpace>& space3 = 0, const Ref<OrbitalSpace>& space4 = 0);
00138 ~MOIntsTransformFactory();
00139
00140 void save_data_state(StateOut&);
00141
00143 void set_spaces(const Ref<OrbitalSpace>& space1, const Ref<OrbitalSpace>& space2 = 0,
00144 const Ref<OrbitalSpace>& space3 = 0, const Ref<OrbitalSpace>& space4 = 0);
00145
00147 void set_top_mole(const Ref<MolecularEnergy>& top_mole) { top_mole_ = top_mole; }
00149 void tbintdescr(const Ref<TwoBodyIntDescr>& descr) { tbintdescr_ = descr; }
00151 void set_ints_method(const StoreMethod::type method) { ints_method_ = method; }
00153 void set_file_prefix(const std::string& prefix) { file_prefix_ = prefix; }
00154 void set_debug(int debug) { debug_ = debug; }
00155 void set_dynamic(bool dynamic) { dynamic_ = dynamic; }
00156 void set_print_percent(double print_percent) { print_percent_ = print_percent; }
00157 void set_memory(size_t nbytes) { memory_ = nbytes; mem_->set_localsize(memory_); }
00158
00160 Ref<MemoryGrp> mem() const { return mem_; }
00162 Ref<MessageGrp> msg() const { return msg_; }
00164 Ref<Integral> integral() const { return integral_; }
00166 Ref<TwoBodyIntDescr> tbintdescr() const { return tbintdescr_; }
00168 const StoreMethod::type ints_method() const { return ints_method_; }
00169 const CreateTransformHints& hints() const { return hints_; }
00170 CreateTransformHints& hints() { return hints_; }
00172 const std::string file_prefix() const { return file_prefix_; }
00173 const int debug() const { return debug_; }
00174 const bool dynamic() const { return dynamic_; }
00175 const double print_percent() const { return print_percent_; }
00176 const size_t memory() const { return memory_; }
00177
00179 Ref<OrbitalSpace> space1() const;
00181 Ref<OrbitalSpace> space2() const;
00183 Ref<OrbitalSpace> space3() const;
00185 Ref<OrbitalSpace> space4() const;
00186
00189 Ref<TwoBodyMOIntsTransform>
00190 twobody_transform_13(const std::string& id, const Ref<TwoBodyIntDescr>& descr = 0);
00191
00194 Ref<TwoBodyMOIntsTransform>
00195 twobody_transform_12(const std::string& id, const Ref<TwoBodyIntDescr>& descr = 0);
00196
00199 Ref<TwoBodyMOIntsTransform>
00200 twobody_transform(StorageType storage, const std::string& id,
00201 const Ref<TwoBodyIntDescr>& descr = 0);
00202
00204 Ref<TwoBodyMOIntsTransform> twobody_transform(TwoBodyTransformType T,
00205 const std::string& name,
00206 const Ref<TwoBodyIntDescr>& descrarg);
00207
00208 };
00209
00210 }
00211
00212 #include <chemistry/qc/mbptr12/transform_tbint.h>
00213
00214 #endif
00215
00216
00217
00218
00219
00220
00221