28 #ifndef _chemistry_qc_mbptr12_distarray4_h
29 #define _chemistry_qc_mbptr12_distarray4_h
32 #include <util/ref/ref.h>
33 #include <util/state/state.h>
34 #include <util/state/statein.h>
35 #include <util/state/stateout.h>
36 #include <util/group/memory.h>
37 #include <util/group/message.h>
41 enum DistArray4Storage {DistArray4Storage_XY, DistArray4Storage_YX};
47 DistArray4Storage storage = DistArray4Storage_XY) :
48 num_te_types_(num_te_types), n1_(n1), n2_(n2), n3_(n3), n4_(n4),
52 int num_te_types()
const {
return num_te_types_; }
53 int n1()
const {
return n1_; }
54 int n2()
const {
return n2_; }
55 int n3()
const {
return n3_; }
56 int n4()
const {
return n4_; }
57 DistArray4Storage storage()
const {
return storage_; }
65 DistArray4Storage storage_;
98 DistArray4Storage
storage = DistArray4Storage_XY);
109 static const unsigned int max_num_te_types = 14;
114 int ni()
const {
return ni_; }
116 int nj()
const {
return nj_; }
118 int nx()
const {
return nx_; }
120 int ny()
const {
return ny_; }
122 const DistArray4Storage&
storage()
const {
return storage_; }
126 size_t blksize()
const {
return blksize_; }
141 double* buf = 0)
const =0;
145 int xstart,
int xfence,
int ystart,
int yfence,
146 double* buf)
const =0;
158 int xstart,
int xfence,
int ystart,
int yfence,
159 const double* ints) =0;
161 int ij_index(
int i,
int j)
const {
return i*nj_ + j; };
164 virtual bool is_avail(
int i,
int j)
const =0;
166 virtual bool is_local(
int i,
int j)
const =0;
174 const Ref<MessageGrp>& msg()
const {
return msg_; }
177 bool active()
const {
return active_; }
181 static const int classdebug_ = 0;
184 Ref<MessageGrp> msg_;
187 DistArray4Storage storage_;
196 size_t nxy()
const {
return nxy_; }
200 int me()
const {
return msg_->me(); }
206 Ref<DistArray4> make_distarray4(
int num_te_types,
int ni,
int nj,
int nx,
int ny,
207 DistArray4Storage storage = DistArray4Storage_XY);
211 extract(
const Ref<DistArray4>& A,
212 unsigned int te_type,
217 Ref<DistArray4>
permute23(
const Ref<DistArray4>& src);
221 Ref<DistArray4>
permute34(
const Ref<DistArray4>& src);
224 Ref<DistArray4>
permute12(
const Ref<DistArray4>& src);
229 axpy(
const Ref<DistArray4>& X,
231 const Ref<DistArray4>& Y,
251 const Ref<DistArray4>& bra,
252 unsigned int intsetidx_bra,
253 const Ref<DistArray4>& ket,
254 unsigned int intsetidx_ket,
263 const Ref<DistArray4>& bra,
264 unsigned int intsetidx_bra,
265 const RefSCMatrix& ket,
266 const int MatBra1Dim,
const int MatBra2Dim);
280 const Ref<DistArray4>& bra,
281 unsigned int intsetidx_bra,
282 const RefSCMatrix& ket,
283 const int MatBra1Dim,
const int MatBra2Dim);
294 const Ref<DistArray4>& bra,
295 unsigned int intsetidx_bra,
296 const RefSCMatrix& ket,
297 const int MatBra1Dim,
const int MatBra2Dim);
301 void contract3(
const Ref<DistArray4>& ijxy,
const RefSCMatrix& T, Ref<DistArray4>& ijzy);
304 void contract4(
const Ref<DistArray4>& ijxy,
const RefSCMatrix& T, Ref<DistArray4>& ijxz);
311 const Ref<DistArray4>& src);
316 const Ref<DistArray4>& src,
const int tensor_type);
341 void store_memorygrp(Ref<DistArray4>& acc, Ref<MemoryGrp>& mem,
int i_offset,
342 int ni,
const size_t blksize_memgrp = 0);
347 void restore_memorygrp(Ref<DistArray4>& acc, Ref<MemoryGrp>& mem,
int i_offset,
348 int ni, DistArray4Storage storage,
const size_t blksize_memgrp = 0);
void contract_DA4_RefMat_k2b2_34(Ref< DistArray4 > &braket, double scale, const Ref< DistArray4 > &bra, unsigned int intsetidx_bra, const RefSCMatrix &ket, const int MatBra1Dim, const int MatBra2Dim)
Contract X^Aj_ik = DA^Ax_iy * M^jk_xy; This is written for spin free[2]R12, where rdm matrices can be...
virtual Ref< DistArray4 > clone(const DistArray4Dimensions &dim=DistArray4Dimensions::default_dim())=0
how to clone.
Ref< DistArray4 > extract(const Ref< DistArray4 > &A, unsigned int te_type, double scale=1.0)
extracts te_type from A
int nj() const
Rank of index space j.
Definition: distarray4.h:116
int tasks_with_access(std::vector< int > &twa_map) const
Returns the total number of tasks with access to integrals.
void contract3(const Ref< DistArray4 > &ijxy, const RefSCMatrix &T, Ref< DistArray4 > &ijzy)
contracts ijxy with T_xz to produce ijzy
DistArray4 contains a set of one or more distributed dense 4-index arrays.
Definition: distarray4.h:94
int num_te_types() const
The number of types of integrals that are being handled together.
Definition: distarray4.h:112
void contract34_DA4_RefMat(Ref< DistArray4 > &braket, double scale, const Ref< DistArray4 > &bra, unsigned int intsetidx_bra, const RefSCMatrix &ket, const int MatBra1Dim, const int MatBra2Dim)
contracts ijxy("bra") with klxy ("ket", a RefSCMatrix) to produce ijkl ("braket"); The last two argum...
virtual void store_pair_block(int i, int j, tbint_type oper_type, const double *ints)=0
Stores an ij pair block of integrals.
A template class that maintains references counts.
Definition: ref.h:361
int me() const
rank of this task
Definition: distarray4.h:200
virtual void store_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, const double *ints)=0
Stores an rectangular subblock of ij block of integrals.
void symmetrize(const Ref< GPetiteList2 > &plist2, const Ref< Integral > &integral, const RefSymmSCMatrix &skel, const RefSymmSCMatrix &sym)
Uses plist2 to convert the "skeleton" matrix into the full matrix. Only applicable when the two basis...
virtual void release_pair_block(int i, int j, tbint_type oper_type) const =0
Releases the buffer that holds ij block of integrals. If it was allocated by DistArray4,...
virtual void deactivate()
call this after operations on this object are finished. May destroy data (see data_persistent()).
Definition: distarray4.h:131
int ny() const
Rank of index space y.
Definition: distarray4.h:120
int ntasks() const
total number of tasks
Definition: distarray4.h:198
Ref< DistArray4 > permute23(const Ref< DistArray4 > &src)
creates an array in which indices 2 and 3 are permuted
virtual bool has_access(int proc) const =0
Does this task have access to all blocks?
virtual const double * retrieve_pair_block(int i, int j, tbint_type oper_type, double *buf=0) const =0
Retrieves an ij block of integrals.
void contract4(const Ref< DistArray4 > &ijxy, const RefSCMatrix &T, Ref< DistArray4 > &ijxz)
contracts ijxy with T_yz to produce ijxz
virtual bool is_local(int i, int j) const =0
Is this block stored locally? If true, this implies that it can be retrieved efficiently (compare to ...
std::vector< unsigned int > operator<<(const GaussianBasisSet &B, const GaussianBasisSet &A)
computes a map from basis functions in A to the equivalent basis functions in B.
const DistArray4Storage & storage() const
physical storage of the integrals. The default storage is XY. Storage is not mutable.
Definition: distarray4.h:122
Definition: stateout.h:71
RefSCMatrix & copy_to_RefSCMat(RefSCMatrix &dst, const Ref< DistArray4 > &src, const int tensor_type)
copy a specific tensor to RefSCMatrix
Ref< DistArray4 > permute12(const Ref< DistArray4 > &src)
creates an array in which indices 1 and 2 are permuted
virtual bool data_persistent() const =0
if this returns false, call to deactivate may destroy data
int ni() const
Rank of index space i.
Definition: distarray4.h:114
unsigned int tbint_type
Types of two-body operators that DistArray4 understands.
Definition: distarray4.h:108
Definition: distarray4.h:43
void contract_DA4_RefMat_k1b2_34(Ref< DistArray4 > &braket, double scale, const Ref< DistArray4 > &bra, unsigned int intsetidx_bra, const RefSCMatrix &ket, const int MatBra1Dim, const int MatBra2Dim)
Contract X^Aj_ik = DA^Ax_yi * M^jk_xy; procedure: DA'^Ax_iy <- DA^Ax_yi from permute34 DA''^Ai_xy <- ...
Ref< DistArray4 > permute34(const Ref< DistArray4 > &src)
creates an array in which indices 3 and 4 are permuted
Base class for objects that can save/restore state.
Definition: state.h:45
virtual bool is_avail(int i, int j) const =0
Can this block be accessed via retrieve_pair_block from this task?
virtual void retrieve_pair_subblock(int i, int j, tbint_type oper_type, int xstart, int xfence, int ystart, int yfence, double *buf) const =0
Retrieves a rectangular subblock of ij block of integrals.
bool operator==(const Atom &a, const Atom &b)
void antisymmetrize(RefSCMatrix &Aanti, const RefSCMatrix &A, const Ref< OrbitalSpace > &bra, const Ref< OrbitalSpace > &ket, bool accumulate=false)
Antisymmetrizes 4-index quantity <ij|A|kl> -> <ij|A|kl> - <ij|A|lk> and saves to Aanti.
int nx() const
Rank of index space x.
Definition: distarray4.h:118
void contract34(Ref< DistArray4 > &braket, double scale, const Ref< DistArray4 > &bra, unsigned int intsetidx_bra, const Ref< DistArray4 > &ket, unsigned int intsetidx_ket, int debug=0)
contracts ijxy ("bra") with klxy ("ket") to produce ijkl ("braket")
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
int classdebug() const
return debug level for this class
Definition: distarray4.h:202
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
virtual void activate()
call this before operations on this object can begin
Definition: distarray4.h:129
void axpy(const Ref< DistArray4 > &X, double a, const Ref< DistArray4 > &Y, double scale=1.0)
axpy followed by scaling: Y += a*X; Y *= scale.
size_t blocksize() const
Size of each block of the integrals of one type, in double words.
Definition: distarray4.h:124
Generated at Sun Jan 26 2020 23:24:00 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.