MPQC 2.3.1
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
42using namespace std;
43
44namespace sc {
45
47
70class 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;
91
92 public:
93 R12IntsAcc(int num_te_types, int ni, int nj, int nx, int ny);
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:
R12IntsAcc accumulates transformed (MO) integrals stored as (ijxy) where i, j, x, and,...
Definition r12ia.h:70
tbint_type
Types of two-body operators that R12IntsAcc understands.
Definition r12ia.h:99
virtual void store_memorygrp(Ref< MemoryGrp > &mem, int ni, const size_t blksize=0)=0
Stores all pair block of integrals held in mem in a layout assumed throughout MBPT2_R12.
virtual void commit()
Commit the content of the accumulator for reading.
int tasks_with_access(vector< int > &twa_map) const
Returns the total number of tasks with access to integrals.
int ny() const
Rank of index space y.
Definition r12ia.h:111
virtual int ntasks() const =0
total number of tasks
virtual bool is_avail(int i, int j) const =0
Is this block available to this task?
void inc_next_orbital(int ni)
The index of the first orbital in the next integrals batch to be stored.
size_t blocksize() const
Size of each block of the integrals of one type, in double words.
Definition r12ia.h:113
virtual bool has_access(int proc) const =0
Does this task have access to all the integrals?
const bool is_active()
Check if can read content.
Definition r12ia.h:143
bool is_committed()
Has the content of the accumulator been commited for reading?
Definition r12ia.h:137
virtual void activate()
Call before starting to read content.
virtual void release_pair_block(int i, int j, tbint_type oper_type)=0
Releases an ij pair block of integrals (if needed)
virtual bool can_restart() const =0
Can this specialization be used in restarts?
int next_orbital() const
The index of the first orbital in the next integrals batch to be stored.
int num_te_types() const
The number of types of integrals that are being handled together.
Definition r12ia.h:103
int nx() const
Rank of index space x.
Definition r12ia.h:109
int ni() const
Rank of index space i.
Definition r12ia.h:105
virtual bool is_local(int i, int j) const =0
Is this block stored locally?
int nj() const
Rank of index space j.
Definition r12ia.h:107
virtual void deactivate()
Call when done reading content.
virtual double * retrieve_pair_block(int i, int j, tbint_type oper_type)=0
Retrieves an ij pair block of integrals.
virtual int taskid() const =0
ID of this task.
virtual void store_pair_block(int i, int j, double *ints)=0
All member functions of this class and its children indices i and j don't include frozen orbitals Sto...
void save_data_state(StateOut &)
Save the base classes (with save_data_state) and the members in the same order that the StateIn CTOR ...
A template class that maintains references counts.
Definition ref.h:332
Base class for objects that can save/restore state.
Definition state.h:46
Restores objects that derive from SavableState.
Definition statein.h:70
Serializes objects that derive from SavableState.
Definition stateout.h:61

Generated at Thu Jul 20 2023 00:00:00 for MPQC 2.3.1 using the documentation package Doxygen 1.9.7.