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_transformtbint_h
00033 #define _chemistry_qc_mbptr12_transformtbint_h
00034
00035 #include <string>
00036 #include <util/ref/ref.h>
00037 #include <util/class/scexception.h>
00038 #include <chemistry/qc/basis/distshpair.h>
00039 #include <chemistry/qc/mbptr12/r12ia.h>
00040 #include <chemistry/qc/mbptr12/moindexspace.h>
00041 #include <chemistry/qc/mbptr12/transform_factory.h>
00042
00043 using namespace std;
00044
00045 namespace sc {
00046
00047 class MOIntsTransformFactory;
00048
00052 class TwoBodyMOIntsTransform : virtual public SavableState {
00053
00054
00055
00056 virtual void init_acc() = 0;
00057
00058
00059 virtual distsize_t compute_transform_dynamic_memory_(int ni) const = 0;
00060
00061 protected:
00064 static const double zero_integral = 1.0e-12;
00066 typedef struct {
00067 enum {Space1, Space2, Space3, Space4};
00068 } MOSpaces;
00069
00070 std::string name_;
00071 Ref<MOIntsTransformFactory> factory_;
00072
00073 Ref<MolecularEnergy> top_mole_;
00074 Ref<MessageGrp> msg_;
00075 Ref<MemoryGrp> mem_;
00076 Ref<ThreadGrp> thr_;
00077
00078 Ref<R12IntsAcc> ints_acc_;
00079
00080 Ref<MOIndexSpace> space1_;
00081 Ref<MOIndexSpace> space2_;
00082 Ref<MOIndexSpace> space3_;
00083 Ref<MOIndexSpace> space4_;
00084
00085 int num_te_types_;
00086 size_t memory_;
00087 bool dynamic_;
00088 double print_percent_;
00089 DistShellPair::SharedData spdata_;
00090 int debug_;
00091 MOIntsTransformFactory::StoreMethod ints_method_;
00092 std::string file_prefix_;
00093
00094
00095
00096 size_t mem_static_;
00097 int batchsize_;
00098 int npass_;
00099
00101 unsigned int restart_orbital() const;
00102
00103
00104 void init_vars();
00105
00106 void reinit_acc();
00107
00108 void alloc_mem(const size_t localmem);
00109
00110 void dealloc_mem();
00111
00112
00113
00114 int compute_transform_batchsize_(size_t mem_static, int rank_i);
00115
00116
00117 static int compute_nij(const int rank_i, const int rank_j, const int nproc, const int me);
00118
00122 void memory_report(std::ostream& os = ExEnv::out0()) const;
00126 void mospace_report(std::ostream& os = ExEnv::out0()) const;
00127
00130 void print_header(std::ostream& os = ExEnv::out0()) const;
00133 void print_footer(std::ostream& os = ExEnv::out0()) const;
00134
00135 public:
00136
00137 TwoBodyMOIntsTransform(StateIn&);
00138 TwoBodyMOIntsTransform(const std::string& name, const Ref<MOIntsTransformFactory>& factory,
00139 const Ref<MOIndexSpace>& space1, const Ref<MOIndexSpace>& space2,
00140 const Ref<MOIndexSpace>& space3, const Ref<MOIndexSpace>& space4);
00141 ~TwoBodyMOIntsTransform();
00142
00143 void save_data_state(StateOut&);
00144
00146 std::string name() const {return name_;}
00148 virtual std::string type() const =0;
00150 Ref<MemoryGrp> mem() const;
00152 Ref<MessageGrp> msg() const;
00154 Ref<R12IntsAcc> ints_acc() const;
00156 Ref<MOIndexSpace> space1() const;
00158 Ref<MOIndexSpace> space2() const;
00160 Ref<MOIndexSpace> space3() const;
00162 Ref<MOIndexSpace> space4() const;
00163
00165 double print_percent() const;
00167 int batchsize() const;
00169 int debug() const;
00171 bool dynamic() const;
00173 int num_te_types() const;
00177 virtual const size_t memgrp_blksize() const =0;
00178
00180 void set_top_mole(const Ref<MolecularEnergy>& top_mole) { top_mole_ = top_mole; }
00181
00184 void set_num_te_types(const int num_te_types);
00185 void set_memory(const size_t memory);
00186 void set_debug(int debug) { debug_ = debug; }
00187 void set_dynamic(bool dynamic) { dynamic_ = dynamic; }
00188 void set_print_percent(double print_percent) { print_percent_ = print_percent; }
00189
00191 virtual void compute() = 0;
00193 virtual void check_int_symm(double threshold = TwoBodyMOIntsTransform::zero_integral) const throw (ProgrammingError) =0;
00195 virtual void obsolete();
00196
00199 DistShellPair::SharedData *shell_pair_data() { return &spdata_; }
00200
00201 };
00202
00203 }
00204
00205 #endif
00206
00207
00208
00209
00210
00211
00212