source: ThirdParty/mpqc_open/src/lib/chemistry/qc/mbptr12/r12ia.h@ 41bd14

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 41bd14 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 6.9 KB
Line 
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
46/////////////////////////////////////////////////////////////////
47/** R12IntsAcc accumulates transformed (MO) integrals stored as (ijxy)
48 where i, j, x, and, y lie in spaces I, J, X, and Y, respectively.
49 ijxy is only the storage format, the actual type may be (ix|jy),
50 (ij|xy), etc.
51
52 Transformed integrals are usually computed
53 using a parallel MO integrals transformation procedure. In general, such
54 transformations will require multiple passes through AO integrals. Each pass
55 produces a batch of transformed integrals. For example, a batch in direct parallel MP2 energy
56 algorithm is a set of integrals {(ix|jy)}
57 in which i indices are in a finite subrange of O
58 and x, j, and y take any of their allowed values. For example, if batch I contains
59 all integrals (ix|jy) with i greater than or equal m but less than n, then batch I+1
60 contains integrals (ix|jy) with i greater than n. Integrals in batch 0 have indices
61 i greater than or equal to 0.
62
63 After each pass the MO integrals are contained in a MemoryGrp object. The object is
64 "stored" in accumulator using <tt>store_memorygrp(Ref<MemoryGrp>& mem, int ni)</tt>.
65 After all batches have been stored, the content of R12IntsAcc needs to be "committed"
66 using <tt>commit()</tt>. After that blocks of MO integrals can be accessed using
67 <tt>retrieve_pair_block</tt>.
68 */
69
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
85 /// total number of tasks
86 virtual int ntasks() const =0;
87 /// ID of this task
88 virtual int taskid() const =0;
89 /// The index of the first orbital in the next integrals batch to be stored
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
98 /// Types of two-body operators that R12IntsAcc understands
99 enum tbint_type { eri=0, r12=1, r12t1=2, r12t2=3};
100 static const int max_num_te_types_ = 4;
101
102 /// The number of types of integrals that are being handled together
103 int num_te_types() const { return num_te_types_; };
104 /// Rank of index space i
105 int ni() const { return ni_; }
106 /// Rank of index space j
107 int nj() const { return nj_; }
108 /// Rank of index space x
109 int nx() const { return nx_; }
110 /// Rank of index space y
111 int ny() const { return ny_; }
112 /// Size of each block of the integrals of one type, in double words
113 size_t blocksize() const { return blksize_; };
114 /// The index of the first orbital in the next integrals batch to be stored
115 int next_orbital() const;
116
117 /** Stores all pair block of integrals held in mem
118 in a layout assumed throughout MBPT2_R12.
119 Let's suppose the number of tasks is nproc, nj is the number of j indices,
120 ni is the number of i indices of integrals held in
121 mem at the moment. Then all integrals with a given i and j
122 are stored on task (i*nj+j)/nproc and this ij block is
123 (i*nj+j)%nproc -th block on this task. Each ij block contains
124 num_te_types_ subblocks of integrals. Each subblock of integrals
125 has blksize bytes allocated for it. Note that
126 blksize may be larger than blksize_ because an ij-block of partially
127 transformed integrals may be larger than the block of fully transformed integrals.
128 */
129 virtual void store_memorygrp(Ref<MemoryGrp>& mem, int ni, const size_t blksize = 0) =0;
130 /// All member functions of this class and its children
131 /// indices i and j don't include frozen orbitals
132 /// Stores an ij pair block of integrals (assumes the block resides locally)
133 virtual void store_pair_block(int i, int j, double *ints)=0;
134 /// Commit the content of the accumulator for reading
135 virtual void commit();
136 /// Has the content of the accumulator been commited for reading?
137 bool is_committed() { return committed_; }
138 /// Call before starting to read content
139 virtual void activate();
140 /// Call when done reading content
141 virtual void deactivate();
142 /// Check if can read content
143 const bool is_active() { return active_; }
144 /// Retrieves an ij pair block of integrals
145 virtual double* retrieve_pair_block(int i, int j, tbint_type oper_type) =0;
146 /// Releases an ij pair block of integrals (if needed)
147 virtual void release_pair_block(int i, int j, tbint_type oper_type) =0;
148 /// Is this block stored locally?
149 virtual bool is_local(int i, int j) const =0;
150 /// Is this block available to this task?
151 virtual bool is_avail(int i, int j) const =0;
152 /// Does this task have access to all the integrals?
153 virtual bool has_access(int proc) const =0;
154 /** Returns the total number of tasks with access to integrals.
155 If task i has access to the integrals, then twa_map[i] is its index among
156 the tasks with access, -1 otherwise. */
157 int tasks_with_access(vector<int>& twa_map) const;
158 /// Can this specialization be used in restarts?
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:
Note: See TracBrowser for help on using the repository browser.