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 program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  *
20  *@END LICENSE
21  */
22 
23 #ifndef PKMGR_H
24 #define PKMGR_H
25 
26 //TODO Const correctness of everything
27 
28 namespace psi {
29 
30 // Forward declarations for Psi4
31 class Options;
32 class ERISieve;
33 class AIOHandler;
34 class BasisSet;
35 
36 namespace pk {
37 
38 class PKWorker;
39 
40 typedef std::shared_ptr<PKWorker> SharedPKWrkr;
41 
42 /*-
43  ijklBasisIterator: Iterator that goes through all two-electron integral
44  indices, in increasing order of canonical index ijkl.
45  Used to determine what goes in which bucket for PK.
46  Will be extended to include sieving.
47 -*/
48 
50 private:
51  int nbas_;
52  int i_, j_, k_, l_;
53  bool done_;
54  std::shared_ptr<ERISieve> sieve_;
55 public:
56  // Constructor
57  ijklBasisIterator(int nbas, std::shared_ptr<ERISieve> sieve) : nbas_(nbas),
58  done_(false), sieve_(sieve) {}
59 
60  // Iterator functions
61  void first();
62  void next();
63  bool is_done() { return done_; }
64 
65  // Accessor functions
66  int i() { return i_; }
67  int j() { return j_; }
68  int k() { return k_; }
69  int l() { return l_; }
70 };
71 
86 class PKManager {
87 private:
90  double cutoff_;
91  std::shared_ptr<BasisSet> primary_;
92  int nthreads_;
94  int nbf_;
96  size_t ntasks_;
97 
99  bool do_wK_;
101  double omega_;
102 
103 
105  std::shared_ptr<ERISieve> sieve_;
107  size_t pk_pairs_;
109  size_t pk_size_;
111  size_t memory_;
112 
114  std::vector<SharedPKWrkr> iobuffers_;
115 
117  std::vector<double*> D_vec_;
120  std::vector<SharedMatrix> D_;
122  std::vector< bool > symmetric_;
124  bool all_sym_;
126  std::vector<double*> JK_vec_;
127 
129  void set_wK(bool dowK) { do_wK_ = dowK; }
130  void set_omega(double omega_in) { omega_ = omega_in; }
131 
132 protected:
134  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
135 
136 public:
137 
139  PKManager(std::shared_ptr<BasisSet> primary, size_t memory,
140  Options& options);
142  virtual ~PKManager() {}
143 
145  bool do_wk() const { return do_wK_; }
146  double omega() const { return omega_; }
147  double cutoff() const { return cutoff_; }
148  int nthreads() const { return nthreads_; }
149  int nbf() const { return nbf_; }
150  std::shared_ptr< ERISieve > sieve() const { return sieve_; }
151  size_t pk_pairs() const { return pk_pairs_; }
152  size_t pk_size() const { return pk_size_; }
153  size_t ntasks() const { return ntasks_; }
154  size_t memory() const { return memory_; }
155  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
156  double* D_glob_vecs(int i) const { return D_vec_[i]; }
157  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
158  std::shared_ptr< BasisSet > primary() const { return primary_; }
159  bool is_sym(int i) const { return symmetric_[i]; }
160  bool all_sym() const { return all_sym_; }
161  SharedMatrix original_D(int N) const { return D_[N]; }
162 
165  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
166 
174  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio,
175  std::shared_ptr<BasisSet> primary, size_t memory, Options &options,
176  bool dowK, double omega_in = 0);
177 
178  // Base functions needed for the class to work
181  virtual void initialize()=0;
183  virtual void initialize_wK()=0;
185  virtual void form_PK() = 0;
187  virtual void form_PK_wK() = 0;
189  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
190  std::vector<SharedMatrix> Cr)=0;
192  virtual void finalize_JK() = 0;
193 
195  virtual void print_batches();
197  virtual void print_batches_wK() {}
199  virtual void allocate_buffers()=0;
201  virtual void compute_integrals(bool wK = false);
203  virtual void compute_integrals_wK();
205  virtual void finalize_PK()=0;
206 
207 
209  void integrals_buffering(const double *buffer, unsigned int P, unsigned int Q,
210  unsigned int R, unsigned int S);
212  void integrals_buffering_wK(const double *buffer, unsigned int P, unsigned int Q,
213  unsigned int R, unsigned int S);
214 
216  virtual void write() = 0;
218  virtual void write_wK() = 0;
219 
222  void form_D_vec(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr);
224  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
225  std::vector<SharedMatrix> K = std::vector<SharedMatrix>())=0;
227  void make_J_vec(std::vector<SharedMatrix> J);
229  void get_results(std::vector<SharedMatrix> J,std::string exch);
231  void form_K(std::vector<SharedMatrix> K);
233  virtual void form_wK(std::vector<SharedMatrix> wK);
235  void finalize_D();
236 };
237 
238 /* PKMgrDisk: Abstract base class to manage PK algorithms using disk I/O
239  */
240 
241 class PKMgrDisk : public PKManager {
242 private:
244  std::vector<size_t> batch_pq_min_;
246  std::vector<size_t> batch_pq_max_;
248  std::vector<size_t> batch_index_min_;
250  std::vector<size_t> batch_index_max_;
252  std::vector<int> batch_for_pq_;
253 
255  std::map< size_t, std::pair< int, int> > ind_for_pq_;
256 
259 
261  std::shared_ptr<PSIO> psio_;
263  std::shared_ptr<AIOHandler> AIO_;
265  int pk_file_;
267  bool writing_;
268 
269 public:
271  PKMgrDisk(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
272  size_t memory, Options &options);
274  virtual ~PKMgrDisk() {}
275 
277  void set_writing(bool tmp) { writing_ = tmp; }
278  bool writing() const { return writing_; }
279  int pk_file() const { return pk_file_; }
280  std::vector< size_t >& batch_ind_min() { return batch_index_min_;}
281  std::vector< size_t >& batch_ind_max() { return batch_index_max_;}
282  std::vector< size_t >& batch_pq_min() { return batch_pq_min_;}
283  std::vector< size_t >& batch_pq_max() { return batch_pq_max_;}
284  std::vector< int >& batch_for_pq() { return batch_for_pq_; }
285  std::shared_ptr< AIOHandler > AIO() const { return AIO_; }
286  std::shared_ptr< PSIO > psio() const { return psio_; }
287 
289  virtual void finalize_PK();
290 
292  virtual void initialize();
295  virtual void initialize_wK();
297  virtual void allocate_buffers_wK()=0;
299  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
300  std::vector<SharedMatrix> Cr);
301 
303  void batch_sizing();
305  virtual void print_batches();
306 
308  virtual void prestripe_files()=0;
310  virtual void prestripe_files_wK() = 0;
311 
313  virtual void write();
315  virtual void write_wK();
316 
318  void open_PK_file();
320  virtual void close_PK_file(bool keep);
321 
323  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
324  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
325 
327  virtual void finalize_JK();
328 };
329 
343 class PKMgrReorder : public PKMgrDisk {
344 private:
345  std::vector<char*> label_J_;
346  std::vector<char*> label_K_;
347  std::vector<char*> label_wK_;
348 
349  size_t max_mem_buf_;
350 
351 public:
353  PKMgrReorder(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
354  size_t memory, Options &options);
356  virtual ~PKMgrReorder() {}
357 
359  virtual void form_PK();
361  virtual void form_PK_wK();
362 
364  virtual void prestripe_files();
366  virtual void prestripe_files_wK();
367 
369  virtual void allocate_buffers();
372  virtual void allocate_buffers_wK();
376  virtual void finalize_PK();
377 
378 };
379 
395 class PKMgrYoshimine : public PKMgrDisk {
396 private:
402  //TODO: change the name of all variables for buckets
404 
407 
408 public:
410  PKMgrYoshimine(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
411  size_t memory, Options &options);
413  virtual ~PKMgrYoshimine() {}
414 
416  //TODO: Optimize the vastly excessive amount of pre-striping for the K file
417  virtual void prestripe_files();
419  virtual void prestripe_files_wK();
420 
422  virtual void form_PK();
424  virtual void form_PK_wK();
425 
427  virtual void allocate_buffers();
429  virtual void allocate_buffers_wK();
430 
432  virtual void compute_integrals(bool wK = false);
434  virtual void compute_integrals_wK();
435 
437  virtual void write();
439  virtual void write_wK();
440 
442  void sort_ints(bool wK = false);
444  void sort_ints_wK();
445 
447  void close_iwl_buckets();
449  void close_iwl_buckets_wK();
450 
452  void generate_J_PK(double* twoel_ints, size_t max_size);
454  void generate_K_PK(double* twoel_ints, size_t max_size);
456  void generate_wK_PK(double* twoel_ints, size_t max_size);
457 };
458 
459 /* PKMgrInCore: Class to manage in-core PK algorithm */
460 
470 class PKMgrInCore : public PKManager {
471 private:
473  std::unique_ptr<double []> J_ints_;
474  std::unique_ptr<double []> K_ints_;
475  std::unique_ptr<double []> wK_ints_;
476 
477 public:
479  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory,
480  Options &options) : wK_ints_(nullptr), PKManager(primary,memory,options) {}
482  virtual ~PKMgrInCore() {}
483 
485  virtual void initialize();
487  virtual void initialize_wK();
489  virtual void form_PK();
491  virtual void form_PK_wK();
493  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
494  std::vector<SharedMatrix> Cr);
495 
497  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
498  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
500  virtual void finalize_JK();
501 
503  virtual void write();
505  virtual void write_wK();
506 
508  virtual void print_batches();
509 
511  virtual void allocate_buffers();
513  virtual void finalize_PK();
514 
515 };
516 
517 }
518 }
519 
520 #endif
virtual void finalize_JK()
Finalize JK formation.
Definition: PKmanagers.cc:1686
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:307
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:429
virtual void compute_integrals_wK()
computing wK integrals
Definition: PKmanagers.cc:1169
Definition: PK_workers.h:214
virtual void form_PK()
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1532
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:286
void finalize_D()
Finalize and delete the density matrix vectors.
Definition: PKmanagers.cc:485
std::shared_ptr< ERISieve > sieve_
Sieving object for the integrals.
Definition: PKmanagers.h:105
bool all_sym() const
Definition: PKmanagers.h:160
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:114
virtual void write_wK()
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1548
int nbf() const
Definition: PKmanagers.h:149
double omega_
Value for omeaga.
Definition: PKmanagers.h:101
int i()
Definition: PKmanagers.h:66
Options & options_
Definition: PKmanagers.h:88
virtual void print_batches()
Function to print batch sizing information.
Definition: PKmanagers.cc:180
int k_
Definition: PKmanagers.h:52
virtual void initialize_wK()
Definition: PKmanagers.cc:511
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:246
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:855
Definition: PKmanagers.h:395
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:194
int max_batches_
Maximum number of batches.
Definition: PKmanagers.h:258
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:472
int i_
Definition: PKmanagers.h:52
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:280
std::vector< size_t > batch_index_max_
The index of the last integral in each batch.
Definition: PKmanagers.h:250
bool writing_
Is there any pending AIO writing ?
Definition: PKmanagers.h:267
std::vector< size_t > batch_pq_min_
The index of the first pair in each batch.
Definition: PKmanagers.h:244
virtual void finalize_JK()
Finalize JK matrix formation.
Definition: PKmanagers.cc:818
void set_omega(double omega_in)
Definition: PKmanagers.h:130
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:109
virtual void initialize_wK()=0
Initialize for wK integrals.
virtual void compute_integrals_wK()
Computing integrals for wK.
Definition: PKmanagers.cc:301
Definition: pointgrp.h:105
void next()
Definition: PKmanagers.cc:54
virtual void write_wK()
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1198
virtual void form_PK_wK()
Forming PK for wK integrals.
Definition: PKmanagers.cc:916
virtual void initialize_wK()
Initialize the wK integrals.
Definition: PKmanagers.cc:1489
virtual void prestripe_files_wK()=0
Opening files for wK integral storage.
virtual void initialize()
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1484
std::vector< size_t > batch_index_min_
The index of the first integral in each batch.
Definition: PKmanagers.h:248
Definition: PKmanagers.h:86
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:150
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:517
Definition: PKmanagers.h:343
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:142
std::shared_ptr< ERISieve > sieve_
Definition: PKmanagers.h:54
bool done_
Definition: PKmanagers.h:53
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:282
size_t ints_per_buf_
Number of integrals per buckets.
Definition: PKmanagers.h:403
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:126
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:475
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:96
size_t pk_pairs() const
Definition: PKmanagers.h:151
virtual void form_wK(std::vector< SharedMatrix > wK)
Forming wK.
Definition: PKmanagers.cc:479
size_t memory_
Total memory available in doubles.
Definition: PKmanagers.h:111
void generate_K_PK(double *twoel_ints, size_t max_size)
Generate the K PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1339
Definition: PKmanagers.h:241
virtual void finalize_PK()=0
Deallocating the thread buffers.
virtual void allocate_buffers_wK()
Definition: PKmanagers.cc:885
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:99
int pk_file() const
Definition: PKmanagers.h:279
bool writing() const
Definition: PKmanagers.h:278
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:398
void form_D_vec(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Definition: PKmanagers.cc:369
SharedPKWrkr get_buffer()
Accessor that returns buffer corresponding to current thread.
Definition: PKmanagers.cc:172
std::vector< bool > symmetric_
Vector of booleans, true if corresponding density matrix is symmetric.
Definition: PKmanagers.h:122
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:261
int iwl_file_wK_
Definition: PKmanagers.h:400
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
virtual ~PKMgrInCore()
Destructor for in-core class.
Definition: PKmanagers.h:482
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:155
virtual void write()
Write integrals on disk.
Definition: PKmanagers.cc:627
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
virtual void finalize_PK()
Definition: PKmanagers.cc:921
bool is_sym(int i) const
Definition: PKmanagers.h:159
virtual void finalize_PK()
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1552
PKMgrDisk(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for PKMgrDisk.
Definition: PKmanagers.cc:492
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:158
virtual void write()
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1544
size_t max_mem_buf_
Definition: PKmanagers.h:349
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:1563
std::vector< char * > label_J_
Definition: PKmanagers.h:345
Definition: PKmanagers.h:470
virtual void prestripe_files_wK()
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:844
double cutoff() const
Definition: PKmanagers.h:147
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:145
virtual void print_batches()
Printing the algorithm header.
Definition: PKmanagers.cc:1494
virtual void print_batches()
Printing out the batches.
Definition: PKmanagers.cc:614
int pk_file_
PK file number.
Definition: PKmanagers.h:265
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:255
double omega() const
Definition: PKmanagers.h:146
virtual void allocate_buffers()
Allocate the buffer threads.
Definition: PKmanagers.cc:1501
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:165
virtual void write()
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1174
virtual void initialize()
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:504
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:479
ijklBasisIterator(int nbas, std::shared_ptr< ERISieve > sieve)
Definition: PKmanagers.h:57
virtual void prestripe_files()
Pre-striping the PK file.
Definition: PKmanagers.cc:830
virtual void form_PK()=0
Forming the PK supermatrices.
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:283
size_t iwl_int_size_
Total size of one IWL buffer on disk in bytes.
Definition: PKmanagers.h:406
virtual void form_PK_wK()
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1539
std::vector< int > batch_for_pq_
Mapping pq indices to the correct batch.
Definition: PKmanagers.h:252
virtual ~PKMgrDisk()
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:274
std::vector< char * > label_K_
Definition: PKmanagers.h:346
Definition: liboptions.h:359
size_t ntasks() const
Definition: PKmanagers.h:153
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:474
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:197
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:117
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1265
PKMgrYoshimine(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:940
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
void set_writing(bool tmp)
Setter/Getter functions.
Definition: PKmanagers.h:277
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1222
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:993
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:129
bool is_done()
Definition: PKmanagers.h:63
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:91
void first()
Definition: PKmanagers.cc:47
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:90
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:473
virtual ~PKMgrYoshimine()
Destructor.
Definition: PKmanagers.h:413
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:156
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:281
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:38
size_t pk_pairs_
Size of triangular list of PK pairs.
Definition: PKmanagers.h:107
int iwl_file_K_
Definition: PKmanagers.h:399
int nthreads() const
Definition: PKmanagers.h:148
virtual void prestripe_files_wK()
Pre-striping for IWL wK pre-sorted files.
Definition: PKmanagers.cc:981
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:157
virtual ~PKMgrReorder()
Destructor.
Definition: PKmanagers.h:356
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:284
int l_
Definition: PKmanagers.h:52
void close_iwl_buckets()
Close the IWL bucket files.
Definition: PKmanagers.cc:1270
void fill_buffer(SharedPKWrkr tmp)
Setter objects for internal data.
Definition: PKmanagers.h:134
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:120
std::vector< char * > label_wK_
Definition: PKmanagers.h:347
virtual void write()=0
Write the buffers of integrals to PK storage.
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:263
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Steps to prepare JK formation.
Definition: PKmanagers.cc:1558
Definition: PKmanagers.h:49
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1279
int l()
Definition: PKmanagers.h:69
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:950
virtual void allocate_buffers_wK()
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:1024
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:337
virtual void finalize_PK()
Finalize the PK file formation.
Definition: PKmanagers.cc:655
virtual void prestripe_files()=0
Opening files for integral storage.
size_t pk_size() const
Definition: PKmanagers.h:152
virtual void form_PK()
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:911
int nthreads_
Definition: PKmanagers.h:92
void open_PK_file()
Opening the PK file.
Definition: PKmanagers.cc:635
size_t memory() const
Definition: PKmanagers.h:154
void get_results(std::vector< SharedMatrix > J, std::string exch)
Extracting results from vectors to matrix.
Definition: PKmanagers.cc:446
int j()
Definition: PKmanagers.h:67
int nbf_
Number of basis functions.
Definition: PKmanagers.h:94
virtual void form_PK()
Gather all steps to form PK.
Definition: PKmanagers.cc:1044
virtual void compute_integrals(bool wK=false)
Computing the integrals.
Definition: PKmanagers.cc:1065
PKMgrReorder(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:823
int nbas_
Definition: PKmanagers.h:51
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:161
virtual void write_wK()
Write wK integrals on disk.
Definition: PKmanagers.cc:631
PKManager(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Base constructor.
Definition: PKmanagers.cc:147
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:77
virtual void close_PK_file(bool keep)
Closing the files.
Definition: PKmanagers.cc:639
virtual void form_PK_wK()
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1055
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:124
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:643
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1275
std::shared_ptr< AIOHandler > AIO() const
Definition: PKmanagers.h:285
int k()
Definition: PKmanagers.h:68
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:676
int j_
Definition: PKmanagers.h:52
void generate_wK_PK(double *twoel_ints, size_t max_size)
Generate the wK PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1424