Psi4
PKmanagers.h
Go to the documentation of this file.
1 /*
2  *@BEGIN LICENSE
3  *
4  * PSI4: an ab initio quantum chemistry software package
5  *
6  * This file is part of Psi4.
7  *
8  * Psi4 is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation, version 3.
11  *
12  * Psi4 is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License along
18  * with Psi4; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  *@END LICENSE
22  */
23 
24 #ifndef PKMGR_H
25 #define PKMGR_H
26 
27 //TODO Const correctness of everything
28 
29 namespace psi {
30 
31 // Forward declarations for Psi4
32 class Options;
33 class ERISieve;
34 class AIOHandler;
35 class BasisSet;
36 
37 namespace pk {
38 
39 class PKWorker;
40 
41 typedef std::shared_ptr<PKWorker> SharedPKWrkr;
42 
43 /*-
44  ijklBasisIterator: Iterator that goes through all two-electron integral
45  indices, in increasing order of canonical index ijkl.
46  Used to determine what goes in which bucket for PK.
47  Will be extended to include sieving.
48 -*/
49 
51 private:
52  int nbas_;
53  int i_, j_, k_, l_;
54  bool done_;
55  std::shared_ptr<ERISieve> sieve_;
56 public:
57  // Constructor
58  ijklBasisIterator(int nbas, std::shared_ptr<ERISieve> sieve) : nbas_(nbas),
59  done_(false), sieve_(sieve) {}
60 
61  // Iterator functions
62  void first();
63  void next();
64  bool is_done() { return done_; }
65 
66  // Accessor functions
67  int i() { return i_; }
68  int j() { return j_; }
69  int k() { return k_; }
70  int l() { return l_; }
71 };
72 
87 class PKManager {
88 private:
91  double cutoff_;
92  std::shared_ptr<BasisSet> primary_;
93  int nthreads_;
95  int nbf_;
97  size_t ntasks_;
98 
100  bool do_wK_;
102  double omega_;
103 
104 
106  std::shared_ptr<ERISieve> sieve_;
108  size_t pk_pairs_;
110  size_t pk_size_;
112  size_t memory_;
113 
115  std::vector<SharedPKWrkr> iobuffers_;
116 
118  std::vector<double*> D_vec_;
121  std::vector<SharedMatrix> D_;
123  std::vector< bool > symmetric_;
125  bool all_sym_;
127  std::vector<double*> JK_vec_;
128 
130  void set_wK(bool dowK) { do_wK_ = dowK; }
131  void set_omega(double omega_in) { omega_ = omega_in; }
132 
133 protected:
135  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
136 
137 public:
138 
140  PKManager(std::shared_ptr<BasisSet> primary, size_t memory,
141  Options& options);
143  virtual ~PKManager() {}
144 
146  bool do_wk() const { return do_wK_; }
147  double omega() const { return omega_; }
148  double cutoff() const { return cutoff_; }
149  int nthreads() const { return nthreads_; }
150  int nbf() const { return nbf_; }
151  std::shared_ptr< ERISieve > sieve() const { return sieve_; }
152  size_t pk_pairs() const { return pk_pairs_; }
153  size_t pk_size() const { return pk_size_; }
154  size_t ntasks() const { return ntasks_; }
155  size_t memory() const { return memory_; }
156  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
157  double* D_glob_vecs(int i) const { return D_vec_[i]; }
158  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
159  std::shared_ptr< BasisSet > primary() const { return primary_; }
160  bool is_sym(int i) const { return symmetric_[i]; }
161  bool all_sym() const { return all_sym_; }
162  SharedMatrix original_D(int N) const { return D_[N]; }
163 
166  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
167 
175  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio,
176  std::shared_ptr<BasisSet> primary, size_t memory, Options &options,
177  bool dowK, double omega_in = 0);
178 
179  // Base functions needed for the class to work
182  virtual void initialize()=0;
184  virtual void initialize_wK()=0;
186  virtual void form_PK() = 0;
188  virtual void form_PK_wK() = 0;
190  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
191  std::vector<SharedMatrix> Cr)=0;
193  virtual void finalize_JK() = 0;
194 
196  virtual void print_batches();
198  virtual void print_batches_wK() {}
200  virtual void allocate_buffers()=0;
202  virtual void compute_integrals(bool wK = false);
204  virtual void compute_integrals_wK();
206  virtual void finalize_PK()=0;
207 
208 
210  void integrals_buffering(const double *buffer, unsigned int P, unsigned int Q,
211  unsigned int R, unsigned int S);
213  void integrals_buffering_wK(const double *buffer, unsigned int P, unsigned int Q,
214  unsigned int R, unsigned int S);
215 
217  virtual void write() = 0;
219  virtual void write_wK() = 0;
220 
223  void form_D_vec(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr);
225  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
226  std::vector<SharedMatrix> K = std::vector<SharedMatrix>())=0;
228  void make_J_vec(std::vector<SharedMatrix> J);
230  void get_results(std::vector<SharedMatrix> J,std::string exch);
232  void form_K(std::vector<SharedMatrix> K);
234  virtual void form_wK(std::vector<SharedMatrix> wK);
236  void finalize_D();
237 };
238 
239 /* PKMgrDisk: Abstract base class to manage PK algorithms using disk I/O
240  */
241 
242 class PKMgrDisk : public PKManager {
243 private:
245  std::vector<size_t> batch_pq_min_;
247  std::vector<size_t> batch_pq_max_;
249  std::vector<size_t> batch_index_min_;
251  std::vector<size_t> batch_index_max_;
253  std::vector<int> batch_for_pq_;
254 
256  std::map< size_t, std::pair< int, int> > ind_for_pq_;
257 
260 
262  std::shared_ptr<PSIO> psio_;
264  std::shared_ptr<AIOHandler> AIO_;
266  int pk_file_;
268  bool writing_;
269 
270 public:
272  PKMgrDisk(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
273  size_t memory, Options &options);
275  virtual ~PKMgrDisk() {}
276 
278  void set_writing(bool tmp) { writing_ = tmp; }
279  bool writing() const { return writing_; }
280  int pk_file() const { return pk_file_; }
281  std::vector< size_t >& batch_ind_min() { return batch_index_min_;}
282  std::vector< size_t >& batch_ind_max() { return batch_index_max_;}
283  std::vector< size_t >& batch_pq_min() { return batch_pq_min_;}
284  std::vector< size_t >& batch_pq_max() { return batch_pq_max_;}
285  std::vector< int >& batch_for_pq() { return batch_for_pq_; }
286  std::shared_ptr< AIOHandler > AIO() const { return AIO_; }
287  std::shared_ptr< PSIO > psio() const { return psio_; }
288 
290  virtual void finalize_PK();
291 
293  virtual void initialize();
296  virtual void initialize_wK();
298  virtual void allocate_buffers_wK()=0;
300  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
301  std::vector<SharedMatrix> Cr);
302 
304  void batch_sizing();
306  virtual void print_batches();
307 
309  virtual void prestripe_files()=0;
311  virtual void prestripe_files_wK() = 0;
312 
314  virtual void write();
316  virtual void write_wK();
317 
319  void open_PK_file();
321  virtual void close_PK_file(bool keep);
322 
324  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
325  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
326 
328  virtual void finalize_JK();
329 };
330 
344 class PKMgrReorder : public PKMgrDisk {
345 private:
346  std::vector<char*> label_J_;
347  std::vector<char*> label_K_;
348  std::vector<char*> label_wK_;
349 
350  size_t max_mem_buf_;
351 
352 public:
354  PKMgrReorder(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
355  size_t memory, Options &options);
357  virtual ~PKMgrReorder() {}
358 
360  virtual void form_PK();
362  virtual void form_PK_wK();
363 
365  virtual void prestripe_files();
367  virtual void prestripe_files_wK();
368 
370  virtual void allocate_buffers();
373  virtual void allocate_buffers_wK();
377  virtual void finalize_PK();
378 
379 };
380 
396 class PKMgrYoshimine : public PKMgrDisk {
397 private:
403  //TODO: change the name of all variables for buckets
405 
408 
409 public:
411  PKMgrYoshimine(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
412  size_t memory, Options &options);
414  virtual ~PKMgrYoshimine() {}
415 
417  //TODO: Optimize the vastly excessive amount of pre-striping for the K file
418  virtual void prestripe_files();
420  virtual void prestripe_files_wK();
421 
423  virtual void form_PK();
425  virtual void form_PK_wK();
426 
428  virtual void allocate_buffers();
430  virtual void allocate_buffers_wK();
431 
433  virtual void compute_integrals(bool wK = false);
435  virtual void compute_integrals_wK();
436 
438  virtual void write();
440  virtual void write_wK();
441 
443  void sort_ints(bool wK = false);
445  void sort_ints_wK();
446 
448  void close_iwl_buckets();
450  void close_iwl_buckets_wK();
451 
453  void generate_J_PK(double* twoel_ints, size_t max_size);
455  void generate_K_PK(double* twoel_ints, size_t max_size);
457  void generate_wK_PK(double* twoel_ints, size_t max_size);
458 };
459 
460 /* PKMgrInCore: Class to manage in-core PK algorithm */
461 
471 class PKMgrInCore : public PKManager {
472 private:
474  std::unique_ptr<double []> J_ints_;
475  std::unique_ptr<double []> K_ints_;
476  std::unique_ptr<double []> wK_ints_;
477 
478 public:
480  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory,
481  Options &options) : wK_ints_(nullptr), PKManager(primary,memory,options) {}
483  virtual ~PKMgrInCore() {}
484 
486  virtual void initialize();
488  virtual void initialize_wK();
490  virtual void form_PK();
492  virtual void form_PK_wK();
494  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
495  std::vector<SharedMatrix> Cr);
496 
498  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
499  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
501  virtual void finalize_JK();
502 
504  virtual void write();
506  virtual void write_wK();
507 
509  virtual void print_batches();
510 
512  virtual void allocate_buffers();
514  virtual void finalize_PK();
515 
516 };
517 
518 }
519 }
520 
521 #endif
virtual void finalize_JK()
Finalize JK formation.
Definition: PKmanagers.cc:1687
void integrals_buffering(const double *buffer, unsigned int P, unsigned int Q, unsigned int R, unsigned int S)
Store the computed integrals in the appropriate buffers.
Definition: PKmanagers.cc:308
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:430
virtual void compute_integrals_wK()
computing wK integrals
Definition: PKmanagers.cc:1170
Definition: PK_workers.h:214
virtual void form_PK()
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1533
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:287
void finalize_D()
Finalize and delete the density matrix vectors.
Definition: PKmanagers.cc:486
std::shared_ptr< ERISieve > sieve_
Sieving object for the integrals.
Definition: PKmanagers.h:106
bool all_sym() const
Definition: PKmanagers.h:161
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:115
virtual void write_wK()
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1549
int nbf() const
Definition: PKmanagers.h:150
double omega_
Value for omeaga.
Definition: PKmanagers.h:102
int i()
Definition: PKmanagers.h:67
Options & options_
Definition: PKmanagers.h:89
virtual void print_batches()
Function to print batch sizing information.
Definition: PKmanagers.cc:181
int k_
Definition: PKmanagers.h:53
virtual void initialize_wK()
Definition: PKmanagers.cc:512
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:247
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:856
Definition: PKmanagers.h:396
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)=0
Preparing JK computation.
virtual void compute_integrals(bool wK=false)
Actually computing the integrals.
Definition: PKmanagers.cc:195
int max_batches_
Maximum number of batches.
Definition: PKmanagers.h:259
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:473
int i_
Definition: PKmanagers.h:53
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:281
std::vector< size_t > batch_index_max_
The index of the last integral in each batch.
Definition: PKmanagers.h:251
bool writing_
Is there any pending AIO writing ?
Definition: PKmanagers.h:268
std::vector< size_t > batch_pq_min_
The index of the first pair in each batch.
Definition: PKmanagers.h:245
virtual void finalize_JK()
Finalize JK matrix formation.
Definition: PKmanagers.cc:819
void set_omega(double omega_in)
Definition: PKmanagers.h:131
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:110
virtual void initialize_wK()=0
Initialize for wK integrals.
virtual void compute_integrals_wK()
Computing integrals for wK.
Definition: PKmanagers.cc:302
Definition: pointgrp.h:106
void next()
Definition: PKmanagers.cc:55
virtual void write_wK()
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1199
virtual void form_PK_wK()
Forming PK for wK integrals.
Definition: PKmanagers.cc:917
virtual void initialize_wK()
Initialize the wK integrals.
Definition: PKmanagers.cc:1490
virtual void prestripe_files_wK()=0
Opening files for wK integral storage.
virtual void initialize()
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1485
std::vector< size_t > batch_index_min_
The index of the first integral in each batch.
Definition: PKmanagers.h:249
Definition: PKmanagers.h:87
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:151
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:518
Definition: PKmanagers.h:344
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:143
std::shared_ptr< ERISieve > sieve_
Definition: PKmanagers.h:55
bool done_
Definition: PKmanagers.h:54
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:283
size_t ints_per_buf_
Number of integrals per buckets.
Definition: PKmanagers.h:404
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:127
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:476
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:97
size_t pk_pairs() const
Definition: PKmanagers.h:152
virtual void form_wK(std::vector< SharedMatrix > wK)
Forming wK.
Definition: PKmanagers.cc:480
size_t memory_
Total memory available in doubles.
Definition: PKmanagers.h:112
void generate_K_PK(double *twoel_ints, size_t max_size)
Generate the K PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1340
Definition: PKmanagers.h:242
virtual void finalize_PK()=0
Deallocating the thread buffers.
virtual void allocate_buffers_wK()
Definition: PKmanagers.cc:886
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:100
int pk_file() const
Definition: PKmanagers.h:280
bool writing() const
Definition: PKmanagers.h:279
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:399
void form_D_vec(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Definition: PKmanagers.cc:370
SharedPKWrkr get_buffer()
Accessor that returns buffer corresponding to current thread.
Definition: PKmanagers.cc:173
std::vector< bool > symmetric_
Vector of booleans, true if corresponding density matrix is symmetric.
Definition: PKmanagers.h:123
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:262
int iwl_file_wK_
Definition: PKmanagers.h:401
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
virtual ~PKMgrInCore()
Destructor for in-core class.
Definition: PKmanagers.h:483
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:156
virtual void write()
Write integrals on disk.
Definition: PKmanagers.cc:628
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
virtual void finalize_PK()
Definition: PKmanagers.cc:922
bool is_sym(int i) const
Definition: PKmanagers.h:160
virtual void finalize_PK()
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1553
PKMgrDisk(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for PKMgrDisk.
Definition: PKmanagers.cc:493
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:159
virtual void write()
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1545
size_t max_mem_buf_
Definition: PKmanagers.h:350
virtual void form_J(std::vector< SharedMatrix > J, std::string exch="", std::vector< SharedMatrix > K=std::vector< SharedMatrix >())
Form J matrix, shared_ptr() initializes to null.
Definition: PKmanagers.cc:1564
std::vector< char * > label_J_
Definition: PKmanagers.h:346
Definition: PKmanagers.h:471
virtual void prestripe_files_wK()
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:845
double cutoff() const
Definition: PKmanagers.h:148
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:146
virtual void print_batches()
Printing the algorithm header.
Definition: PKmanagers.cc:1495
virtual void print_batches()
Printing out the batches.
Definition: PKmanagers.cc:615
int pk_file_
PK file number.
Definition: PKmanagers.h:266
std::map< size_t, std::pair< int, int > > ind_for_pq_
Mapping the min and max pq&#39;s to p,q pairs.
Definition: PKmanagers.h:256
double omega() const
Definition: PKmanagers.h:147
virtual void allocate_buffers()
Allocate the buffer threads.
Definition: PKmanagers.cc:1502
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:166
virtual void write()
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1175
virtual void initialize()
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:505
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:480
ijklBasisIterator(int nbas, std::shared_ptr< ERISieve > sieve)
Definition: PKmanagers.h:58
virtual void prestripe_files()
Pre-striping the PK file.
Definition: PKmanagers.cc:831
virtual void form_PK()=0
Forming the PK supermatrices.
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:284
size_t iwl_int_size_
Total size of one IWL buffer on disk in bytes.
Definition: PKmanagers.h:407
virtual void form_PK_wK()
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1540
std::vector< int > batch_for_pq_
Mapping pq indices to the correct batch.
Definition: PKmanagers.h:253
virtual ~PKMgrDisk()
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:275
std::vector< char * > label_K_
Definition: PKmanagers.h:347
Definition: liboptions.h:360
size_t ntasks() const
Definition: PKmanagers.h:154
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:475
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:198
virtual void allocate_buffers()=0
Allocating the thread buffers.
virtual void initialize()=0
std::vector< double * > D_vec_
Vector of triangular D matrices.
Definition: PKmanagers.h:118
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1266
PKMgrYoshimine(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:941
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void set_writing(bool tmp)
Setter/Getter functions.
Definition: PKmanagers.h:278
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1223
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:994
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:130
bool is_done()
Definition: PKmanagers.h:64
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:92
void first()
Definition: PKmanagers.cc:48
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:91
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:474
virtual ~PKMgrYoshimine()
Destructor.
Definition: PKmanagers.h:414
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:157
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:282
virtual void form_J(std::vector< SharedMatrix > J, std::string exch="", std::vector< SharedMatrix > K=std::vector< SharedMatrix >())=0
Forming J, shared_ptr() initializes to null.
std::shared_ptr< PKWorker > SharedPKWrkr
Definition: PKmanagers.h:39
size_t pk_pairs_
Size of triangular list of PK pairs.
Definition: PKmanagers.h:108
int iwl_file_K_
Definition: PKmanagers.h:400
int nthreads() const
Definition: PKmanagers.h:149
virtual void prestripe_files_wK()
Pre-striping for IWL wK pre-sorted files.
Definition: PKmanagers.cc:982
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:158
virtual ~PKMgrReorder()
Destructor.
Definition: PKmanagers.h:357
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:285
int l_
Definition: PKmanagers.h:53
void close_iwl_buckets()
Close the IWL bucket files.
Definition: PKmanagers.cc:1271
void fill_buffer(SharedPKWrkr tmp)
Setter objects for internal data.
Definition: PKmanagers.h:135
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:121
std::vector< char * > label_wK_
Definition: PKmanagers.h:348
virtual void write()=0
Write the buffers of integrals to PK storage.
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:264
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Steps to prepare JK formation.
Definition: PKmanagers.cc:1559
Definition: PKmanagers.h:50
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1280
int l()
Definition: PKmanagers.h:70
virtual void finalize_JK()=0
Cleaning up after JK computation.
virtual void prestripe_files()
Pre-striping the IWL pre-sorted bucket files.
Definition: PKmanagers.cc:951
virtual void allocate_buffers_wK()
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:1025
void integrals_buffering_wK(const double *buffer, unsigned int P, unsigned int Q, unsigned int R, unsigned int S)
Store the computed wK integrals in the appropriate buffers.
Definition: PKmanagers.cc:338
virtual void finalize_PK()
Finalize the PK file formation.
Definition: PKmanagers.cc:656
virtual void prestripe_files()=0
Opening files for integral storage.
size_t pk_size() const
Definition: PKmanagers.h:153
virtual void form_PK()
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:912
int nthreads_
Definition: PKmanagers.h:93
void open_PK_file()
Opening the PK file.
Definition: PKmanagers.cc:636
size_t memory() const
Definition: PKmanagers.h:155
void get_results(std::vector< SharedMatrix > J, std::string exch)
Extracting results from vectors to matrix.
Definition: PKmanagers.cc:447
int j()
Definition: PKmanagers.h:68
int nbf_
Number of basis functions.
Definition: PKmanagers.h:95
virtual void form_PK()
Gather all steps to form PK.
Definition: PKmanagers.cc:1045
virtual void compute_integrals(bool wK=false)
Computing the integrals.
Definition: PKmanagers.cc:1066
PKMgrReorder(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:824
int nbas_
Definition: PKmanagers.h:52
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:162
virtual void write_wK()
Write wK integrals on disk.
Definition: PKmanagers.cc:632
PKManager(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Base constructor.
Definition: PKmanagers.cc:148
static std::shared_ptr< PKManager > build_PKManager(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options, bool dowK, double omega_in=0)
build_PKManager Static instance constructor, used to get a proper instance of PKManager through autom...
Definition: PKmanagers.cc:78
virtual void close_PK_file(bool keep)
Closing the files.
Definition: PKmanagers.cc:640
virtual void form_PK_wK()
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1056
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:125
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Prepare the JK formation for disk algorithms.
Definition: PKmanagers.cc:644
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1276
std::shared_ptr< AIOHandler > AIO() const
Definition: PKmanagers.h:286
int k()
Definition: PKmanagers.h:69
virtual void form_J(std::vector< SharedMatrix > J, std::string exch="", std::vector< SharedMatrix > K=std::vector< SharedMatrix >())
Form J from PK supermatrix, shared_ptr() initialized to null.
Definition: PKmanagers.cc:677
int j_
Definition: PKmanagers.h:53
void generate_wK_PK(double *twoel_ints, size_t max_size)
Generate the wK PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1425