MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

r12ia.h
1 //
2 // r12ia.h
3 //
4 // Copyright (C) 2002 Edward Valeev
5 //
6 // Author: Edward Valeev <edward.valeev@chemistry.gatech.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_r12ia_h
29 #define _chemistry_qc_mbptr12_r12ia_h
30
31 #ifdef __GNUC__
32 #pragma interface
33 #endif
34
35 #include <vector>
36 #include <util/ref/ref.h>
37 #include <util/state/state.h>
38 #include <util/state/statein.h>
39 #include <util/state/stateout.h>
40 #include <util/group/memory.h>
41
42 using namespace std;
43
44 namespace sc {
45
47
70 class R12IntsAcc: virtual public SavableState {
71
72 int num_te_types_; // Number of types of integrals in a block (in R12 theories -- usually 3)
73
74 protected:
75 int ni_, nj_;
76 int nx_, ny_;
77 size_t nxy_; // nx_ * ny_ - the number of integrals of one type in a block
78 size_t blksize_; // the same in bytes
79 size_t blocksize_; // hence the size of the block of num_te_types of integrals is blksize_ * num_te_types
80
81 int next_orbital_; // The first index of the next batch to be stored
82 bool committed_; // Whether all data has been written out and ready to be read
83 bool active_; // Whether ready to read data
84
86 virtual int ntasks() const =0;
88 virtual int taskid() const =0;
90 void inc_next_orbital(int ni);
91
92 public:
93 R12IntsAcc(int num_te_types, int ni, int nj, int nx, int ny);
94 R12IntsAcc(StateIn&);
95 ~R12IntsAcc();
96 void save_data_state(StateOut&);
97
99 enum tbint_type { eri=0, r12=1, r12t1=2, r12t2=3};
100 static const int max_num_te_types_ = 4;
101
103 int num_te_types() const { return num_te_types_; };
105 int ni() const { return ni_; }
107 int nj() const { return nj_; }
109 int nx() const { return nx_; }
111 int ny() const { return ny_; }
113 size_t blocksize() const { return blksize_; };
115 int next_orbital() const;
116
129 virtual void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize = 0) =0;
133 virtual void store_pair_block(int i, int j, double *ints)=0;
135 virtual void commit();
137 bool is_committed() { return committed_; }
139 virtual void activate();
141 virtual void deactivate();
143 const bool is_active() { return active_; }
145 virtual double* retrieve_pair_block(int i, int j, tbint_type oper_type) =0;
147 virtual void release_pair_block(int i, int j, tbint_type oper_type) =0;
149 virtual bool is_local(int i, int j) const =0;
151 virtual bool is_avail(int i, int j) const =0;
153 virtual bool has_access(int proc) const =0;
157 int tasks_with_access(vector<int>& twa_map) const;
159 virtual bool can_restart() const =0;
160 };
161
162 }
163
164 #endif
165
166 // Local Variables:
167 // mode: c++
168 // c-file-style: "CLJ"
169 // End: