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; };
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(); }
206Ref<DistArray4> make_distarray4(
int num_te_types,
int ni,
int nj,
int nx,
int ny,
207 DistArray4Storage storage = DistArray4Storage_XY);
212 unsigned int te_type,
252 unsigned int intsetidx_bra,
254 unsigned int intsetidx_ket,
264 unsigned int intsetidx_bra,
266 const int MatBra1Dim,
const int MatBra2Dim);
281 unsigned int intsetidx_bra,
283 const int MatBra1Dim,
const int MatBra2Dim);
295 unsigned int intsetidx_bra,
297 const int MatBra1Dim,
const int MatBra2Dim);
342 int ni,
const size_t blksize_memgrp = 0);
348 int ni, DistArray4Storage storage,
const size_t blksize_memgrp = 0);
DistArray4 contains a set of one or more distributed dense 4-index arrays.
Definition distarray4.h:94
virtual void store_pair_block(int i, int j, tbint_type oper_type, const double *ints)=0
Stores an ij pair block of integrals.
size_t blocksize() const
Size of each block of the integrals of one type, in double words.
Definition distarray4.h:124
virtual Ref< DistArray4 > clone(const DistArray4Dimensions &dim=DistArray4Dimensions::default_dim())=0
how to clone.
const DistArray4Storage & storage() const
physical storage of the integrals. The default storage is XY. Storage is not mutable.
Definition distarray4.h:122
virtual bool has_access(int proc) const =0
Does this task have access to all blocks?
int ntasks() const
total number of tasks
Definition distarray4.h:198
int classdebug() const
return debug level for this class
Definition distarray4.h:202
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.
int ny() const
Rank of index space y.
Definition distarray4.h:120
virtual void deactivate()
call this after operations on this object are finished. May destroy data (see data_persistent()).
Definition distarray4.h:131
unsigned int tbint_type
Types of two-body operators that DistArray4 understands.
Definition distarray4.h:108
virtual bool is_avail(int i, int j) const =0
Can this block be accessed via retrieve_pair_block from this task?
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.
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 ...
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.
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 bool data_persistent() const =0
if this returns false, call to deactivate may destroy data
virtual void activate()
call this before operations on this object can begin
Definition distarray4.h:129
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
int nx() const
Rank of index space x.
Definition distarray4.h:118
int ni() const
Rank of index space i.
Definition distarray4.h:114
int num_te_types() const
The number of types of integrals that are being handled together.
Definition distarray4.h:112
int me() const
rank of this task
Definition distarray4.h:200
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.
The RefSCMatrix class is a smart pointer to an SCMatrix specialization.
Definition matrix.h:135
A template class that maintains references counts.
Definition ref.h:361
Base class for objects that can save/restore state.
Definition state.h:45
Restores fundamental and user-defined types from images created with StateOut.
Definition statein.h:79
Serializes fundamental and user-defined types.
Definition stateout.h:71
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.
bool operator==(const Atom &a, const Atom &b)
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Ref< DistArray4 > permute23(const Ref< DistArray4 > &src)
creates an array in which indices 2 and 3 are permuted
void contract4(const Ref< DistArray4 > &ijxy, const RefSCMatrix &T, Ref< DistArray4 > &ijxz)
contracts ijxy with T_yz to produce ijxz
Ref< DistArray4 > permute12(const Ref< DistArray4 > &src)
creates an array in which indices 1 and 2 are permuted
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.
RefSCMatrix & copy_to_RefSCMat(RefSCMatrix &dst, const Ref< DistArray4 > &src, const int tensor_type)
copy a specific tensor to RefSCMatrix
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")
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...
Ref< DistArray4 > extract(const Ref< DistArray4 > &A, unsigned int te_type, double scale=1.0)
extracts te_type from A
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
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...
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.
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...
void contract3(const Ref< DistArray4 > &ijxy, const RefSCMatrix &T, Ref< DistArray4 > &ijzy)
contracts ijxy with T_xz to produce ijzy
Definition distarray4.h:43