Psi4
PKmanagers.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2018 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This file is part of Psi4.
12  *
13  * Psi4 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU Lesser General Public License as published by
15  * the Free Software Foundation, version 3.
16  *
17  * Psi4 is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public License along
23  * with Psi4; if not, write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25  *
26  * @END LICENSE
27  */
28 
29 #ifndef PKMGR_H
30 #define PKMGR_H
31 
32 //TODO Const correctness of everything
33 #include "psi4/libmints/typedefs.h"
34 #include <psi4/libpsio/psio.hpp>
35 #include <vector>
36 
37 namespace psi {
38 
39 // Forward declarations for Psi4
40 class Options;
41 class ERISieve;
42 class AIOHandler;
43 class BasisSet;
44 
45 namespace pk {
46 
47 class PKWorker;
48 
49 typedef std::shared_ptr<PKWorker> SharedPKWrkr;
50 
51 /*-
52  ijklBasisIterator: Iterator that goes through all two-electron integral
53  indices, in increasing order of canonical index ijkl.
54  Used to determine what goes in which bucket for PK.
55  Will be extended to include sieving.
56 -*/
57 
59 private:
60  int nbas_;
61  int i_, j_, k_, l_;
62  bool done_;
63  std::shared_ptr<ERISieve> sieve_;
64 public:
65  // Constructor
66  ijklBasisIterator(int nbas, std::shared_ptr<ERISieve> sieve) : nbas_(nbas),
67  done_(false), sieve_(sieve) {}
68 
69  // Iterator functions
70  void first();
71  void next();
72  bool is_done() { return done_; }
73 
74  // Accessor functions
75  int i() { return i_; }
76  int j() { return j_; }
77  int k() { return k_; }
78  int l() { return l_; }
79 };
80 
95 class PKManager {
96 private:
99  double cutoff_;
100  std::shared_ptr<BasisSet> primary_;
103  int nbf_;
105  size_t ntasks_;
106 
108  bool do_wK_;
110  double omega_;
111 
112 
114  std::shared_ptr<ERISieve> sieve_;
116  size_t pk_pairs_;
118  size_t pk_size_;
120  size_t memory_;
121 
123  std::vector<SharedPKWrkr> iobuffers_;
124 
126  std::vector<double*> D_vec_;
129  std::vector<SharedMatrix> D_;
131  std::vector< bool > symmetric_;
133  bool all_sym_;
135  std::vector<double*> JK_vec_;
136 
138  void set_wK(bool dowK) { do_wK_ = dowK; }
139  void set_omega(double omega_in) { omega_ = omega_in; }
140 
141 protected:
143  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
144 
145 public:
146 
148  PKManager(std::shared_ptr<BasisSet> primary, size_t memory,
149  Options& options);
151  virtual ~PKManager() {}
152 
154  bool do_wk() const { return do_wK_; }
155  double omega() const { return omega_; }
156  double cutoff() const { return cutoff_; }
157  int nthreads() const { return nthreads_; }
158  int nbf() const { return nbf_; }
159  std::shared_ptr< ERISieve > sieve() const { return sieve_; }
160  size_t pk_pairs() const { return pk_pairs_; }
161  size_t pk_size() const { return pk_size_; }
162  size_t ntasks() const { return ntasks_; }
163  size_t memory() const { return memory_; }
164  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
165  double* D_glob_vecs(int i) const { return D_vec_[i]; }
166  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
167  std::shared_ptr< BasisSet > primary() const { return primary_; }
168  bool is_sym(int i) const { return symmetric_[i]; }
169  bool all_sym() const { return all_sym_; }
170  SharedMatrix original_D(int N) const { return D_[N]; }
171 
174  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
175 
183  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio,
184  std::shared_ptr<BasisSet> primary, size_t memory, Options &options,
185  bool dowK, double omega_in = 0);
186 
187  // Base functions needed for the class to work
190  virtual void initialize()=0;
192  virtual void initialize_wK()=0;
194  virtual void form_PK() = 0;
196  virtual void form_PK_wK() = 0;
198  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
199  std::vector<SharedMatrix> Cr)=0;
201  virtual void finalize_JK() = 0;
202 
204  virtual void print_batches();
206  virtual void print_batches_wK() {}
208  virtual void allocate_buffers()=0;
210  virtual void compute_integrals(bool wK = false);
212  virtual void compute_integrals_wK();
214  virtual void finalize_PK()=0;
215 
216 
218  void integrals_buffering(const double *buffer, size_t P, size_t Q,
219  size_t R, size_t S);
221  void integrals_buffering_wK(const double *buffer, size_t P, size_t Q,
222  size_t R, size_t S);
223 
225  virtual void write() = 0;
227  virtual void write_wK() = 0;
228 
231  void form_D_vec(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr);
233  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
234  std::vector<SharedMatrix> K = std::vector<SharedMatrix>())=0;
236  void make_J_vec(std::vector<SharedMatrix> J);
238  void get_results(std::vector<SharedMatrix> J,std::string exch);
240  void form_K(std::vector<SharedMatrix> K);
242  virtual void form_wK(std::vector<SharedMatrix> wK);
244  void finalize_D();
245 };
246 
247 /* PKMgrDisk: Abstract base class to manage PK algorithms using disk I/O
248  */
249 
250 class PKMgrDisk : public PKManager {
251 private:
253  std::vector<size_t> batch_pq_min_;
255  std::vector<size_t> batch_pq_max_;
257  std::vector<size_t> batch_index_min_;
259  std::vector<size_t> batch_index_max_;
261  std::vector<int> batch_for_pq_;
262 
264  std::map< size_t, std::pair< int, int> > ind_for_pq_;
265 
268 
270  std::shared_ptr<PSIO> psio_;
272  std::shared_ptr<AIOHandler> AIO_;
274  int pk_file_;
276  bool writing_;
277 
278 public:
280  PKMgrDisk(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
281  size_t memory, Options &options);
283  virtual ~PKMgrDisk() {}
284 
286  void set_writing(bool tmp) { writing_ = tmp; }
287  bool writing() const { return writing_; }
288  int pk_file() const { return pk_file_; }
289  std::vector< size_t >& batch_ind_min() { return batch_index_min_;}
290  std::vector< size_t >& batch_ind_max() { return batch_index_max_;}
291  std::vector< size_t >& batch_pq_min() { return batch_pq_min_;}
292  std::vector< size_t >& batch_pq_max() { return batch_pq_max_;}
293  std::vector< int >& batch_for_pq() { return batch_for_pq_; }
294  std::shared_ptr< AIOHandler > AIO() const { return AIO_; }
295  std::shared_ptr< PSIO > psio() const { return psio_; }
296 
298  virtual void finalize_PK();
299 
301  virtual void initialize();
304  virtual void initialize_wK();
306  virtual void allocate_buffers_wK()=0;
308  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
309  std::vector<SharedMatrix> Cr);
310 
312  void batch_sizing();
314  virtual void print_batches();
315 
317  virtual void prestripe_files()=0;
319  virtual void prestripe_files_wK() = 0;
320 
322  virtual void write();
324  virtual void write_wK();
325 
327  void open_PK_file();
329  virtual void close_PK_file(bool keep);
330 
332  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
333  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
334 
336  virtual void finalize_JK();
337 };
338 
352 class PKMgrReorder : public PKMgrDisk {
353 private:
354  std::vector<char*> label_J_;
355  std::vector<char*> label_K_;
356  std::vector<char*> label_wK_;
357 
358  size_t max_mem_buf_;
359 
360 public:
362  PKMgrReorder(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
363  size_t memory, Options &options);
365  virtual ~PKMgrReorder() {}
366 
368  virtual void form_PK();
370  virtual void form_PK_wK();
371 
373  virtual void prestripe_files();
375  virtual void prestripe_files_wK();
376 
378  virtual void allocate_buffers();
381  virtual void allocate_buffers_wK();
385  virtual void finalize_PK();
386 
387 };
388 
404 class PKMgrYoshimine : public PKMgrDisk {
405 private:
411  //TODO: change the name of all variables for buckets
413 
416 
417 public:
419  PKMgrYoshimine(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
420  size_t memory, Options &options);
422  virtual ~PKMgrYoshimine() {}
423 
425  //TODO: Optimize the vastly excessive amount of pre-striping for the K file
426  virtual void prestripe_files();
428  virtual void prestripe_files_wK();
429 
431  virtual void form_PK();
433  virtual void form_PK_wK();
434 
436  virtual void allocate_buffers();
438  virtual void allocate_buffers_wK();
439 
441  virtual void compute_integrals(bool wK = false);
443  virtual void compute_integrals_wK();
444 
446  virtual void write();
448  virtual void write_wK();
449 
451  void sort_ints(bool wK = false);
453  void sort_ints_wK();
454 
456  void close_iwl_buckets();
458  void close_iwl_buckets_wK();
459 
461  void generate_J_PK(double* twoel_ints, size_t max_size);
463  void generate_K_PK(double* twoel_ints, size_t max_size);
465  void generate_wK_PK(double* twoel_ints, size_t max_size);
466 };
467 
468 /* PKMgrInCore: Class to manage in-core PK algorithm */
469 
479 class PKMgrInCore : public PKManager {
480 private:
482  std::unique_ptr<double []> J_ints_;
483  std::unique_ptr<double []> K_ints_;
484  std::unique_ptr<double []> wK_ints_;
485 
486 public:
488  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory,
489  Options &options) : wK_ints_(nullptr), PKManager(primary,memory,options) {}
491  virtual ~PKMgrInCore() {}
492 
494  virtual void initialize();
496  virtual void initialize_wK();
498  virtual void form_PK();
500  virtual void form_PK_wK();
502  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
503  std::vector<SharedMatrix> Cr);
504 
506  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
507  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
509  virtual void finalize_JK();
510 
512  virtual void write();
514  virtual void write_wK();
515 
517  virtual void print_batches();
518 
520  virtual void allocate_buffers();
522  virtual void finalize_PK();
523 
524 };
525 
526 }
527 }
528 
529 #endif
virtual void finalize_JK()
Finalize JK formation.
Definition: PKmanagers.cc:1628
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:428
virtual void compute_integrals_wK()
computing wK integrals
Definition: PKmanagers.cc:1138
Definition: PK_workers.h:221
virtual void form_PK()
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1481
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:295
void finalize_D()
Finalize and delete the density matrix vectors.
Definition: PKmanagers.cc:483
std::shared_ptr< ERISieve > sieve_
Sieving object for the integrals.
Definition: PKmanagers.h:114
bool all_sym() const
Definition: PKmanagers.h:169
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:123
virtual void write_wK()
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1495
int nbf() const
Definition: PKmanagers.h:158
double omega_
Value for omeaga.
Definition: PKmanagers.h:110
int i()
Definition: PKmanagers.h:75
Options & options_
Definition: PKmanagers.h:97
virtual void print_batches()
Function to print batch sizing information.
Definition: PKmanagers.cc:186
int k_
Definition: PKmanagers.h:61
virtual void initialize_wK()
Definition: PKmanagers.cc:508
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:255
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:831
Definition: PKmanagers.h:404
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:200
int max_batches_
Maximum number of batches.
Definition: PKmanagers.h:267
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:470
int i_
Definition: PKmanagers.h:61
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:289
std::vector< size_t > batch_index_max_
The index of the last integral in each batch.
Definition: PKmanagers.h:259
bool writing_
Is there any pending AIO writing ?
Definition: PKmanagers.h:276
std::vector< size_t > batch_pq_min_
The index of the first pair in each batch.
Definition: PKmanagers.h:253
virtual void finalize_JK()
Finalize JK matrix formation.
Definition: PKmanagers.cc:794
void set_omega(double omega_in)
Definition: PKmanagers.h:139
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:118
virtual void initialize_wK()=0
Initialize for wK integrals.
virtual void compute_integrals_wK()
Computing integrals for wK.
Definition: PKmanagers.cc:305
Definition: pointgrp.h:104
void next()
Definition: PKmanagers.cc:64
virtual void write_wK()
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1165
virtual void form_PK_wK()
Forming PK for wK integrals.
Definition: PKmanagers.cc:891
virtual void initialize_wK()
Initialize the wK integrals.
Definition: PKmanagers.cc:1440
virtual void prestripe_files_wK()=0
Opening files for wK integral storage.
virtual void initialize()
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1435
std::vector< size_t > batch_index_min_
The index of the first integral in each batch.
Definition: PKmanagers.h:257
Definition: PKmanagers.h:95
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:159
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:514
Definition: PKmanagers.h:352
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:151
std::shared_ptr< ERISieve > sieve_
Definition: PKmanagers.h:63
bool done_
Definition: PKmanagers.h:62
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:291
size_t ints_per_buf_
Number of integrals per buckets.
Definition: PKmanagers.h:412
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:135
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:484
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:105
size_t pk_pairs() const
Definition: PKmanagers.h:160
virtual void form_wK(std::vector< SharedMatrix > wK)
Forming wK.
Definition: PKmanagers.cc:477
size_t memory_
Total memory available in doubles.
Definition: PKmanagers.h:120
void generate_K_PK(double *twoel_ints, size_t max_size)
Generate the K PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1298
Definition: PKmanagers.h:250
virtual void finalize_PK()=0
Deallocating the thread buffers.
virtual void allocate_buffers_wK()
Definition: PKmanagers.cc:860
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:108
int pk_file() const
Definition: PKmanagers.h:288
bool writing() const
Definition: PKmanagers.h:287
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:407
void form_D_vec(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Definition: PKmanagers.cc:371
SharedPKWrkr get_buffer()
Accessor that returns buffer corresponding to current thread.
Definition: PKmanagers.cc:178
std::vector< bool > symmetric_
Vector of booleans, true if corresponding density matrix is symmetric.
Definition: PKmanagers.h:131
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:270
int iwl_file_wK_
Definition: PKmanagers.h:409
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
virtual ~PKMgrInCore()
Destructor for in-core class.
Definition: PKmanagers.h:491
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:164
virtual void write()
Write integrals on disk.
Definition: PKmanagers.cc:617
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
virtual void finalize_PK()
Definition: PKmanagers.cc:896
bool is_sym(int i) const
Definition: PKmanagers.h:168
virtual void finalize_PK()
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1497
PKMgrDisk(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for PKMgrDisk.
Definition: PKmanagers.cc:490
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:167
virtual void write()
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1493
size_t max_mem_buf_
Definition: PKmanagers.h:358
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:1507
std::vector< char * > label_J_
Definition: PKmanagers.h:354
Definition: PKmanagers.h:479
virtual void prestripe_files_wK()
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:820
double cutoff() const
Definition: PKmanagers.h:156
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:154
virtual void print_batches()
Printing the algorithm header.
Definition: PKmanagers.cc:1445
virtual void print_batches()
Printing out the batches.
Definition: PKmanagers.cc:607
int pk_file_
PK file number.
Definition: PKmanagers.h:274
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:264
double omega() const
Definition: PKmanagers.h:155
virtual void allocate_buffers()
Allocate the buffer threads.
Definition: PKmanagers.cc:1452
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:174
virtual void write()
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1143
virtual void initialize()
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:501
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:488
ijklBasisIterator(int nbas, std::shared_ptr< ERISieve > sieve)
Definition: PKmanagers.h:66
virtual void prestripe_files()
Pre-striping the PK file.
Definition: PKmanagers.cc:806
virtual void form_PK()=0
Forming the PK supermatrices.
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:292
size_t iwl_int_size_
Total size of one IWL buffer on disk in bytes.
Definition: PKmanagers.h:415
virtual void form_PK_wK()
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1488
void integrals_buffering_wK(const double *buffer, size_t P, size_t Q, size_t R, size_t S)
Store the computed wK integrals in the appropriate buffers.
Definition: PKmanagers.cc:340
std::vector< int > batch_for_pq_
Mapping pq indices to the correct batch.
Definition: PKmanagers.h:261
virtual ~PKMgrDisk()
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:283
std::vector< char * > label_K_
Definition: PKmanagers.h:355
Definition: liboptions.h:353
size_t ntasks() const
Definition: PKmanagers.h:162
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:483
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:206
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:126
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1229
PKMgrYoshimine(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:915
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void set_writing(bool tmp)
Setter/Getter functions.
Definition: PKmanagers.h:286
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1187
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:967
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:138
bool is_done()
Definition: PKmanagers.h:72
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:100
void first()
Definition: PKmanagers.cc:57
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:99
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:482
virtual ~PKMgrYoshimine()
Destructor.
Definition: PKmanagers.h:422
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:165
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:290
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:47
size_t pk_pairs_
Size of triangular list of PK pairs.
Definition: PKmanagers.h:116
int iwl_file_K_
Definition: PKmanagers.h:408
int nthreads() const
Definition: PKmanagers.h:157
virtual void prestripe_files_wK()
Pre-striping for IWL wK pre-sorted files.
Definition: PKmanagers.cc:955
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:166
virtual ~PKMgrReorder()
Destructor.
Definition: PKmanagers.h:365
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:293
int l_
Definition: PKmanagers.h:61
void close_iwl_buckets()
Close the IWL bucket files.
Definition: PKmanagers.cc:1234
void fill_buffer(SharedPKWrkr tmp)
Setter objects for internal data.
Definition: PKmanagers.h:143
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:129
std::vector< char * > label_wK_
Definition: PKmanagers.h:356
virtual void write()=0
Write the buffers of integrals to PK storage.
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:272
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Steps to prepare JK formation.
Definition: PKmanagers.cc:1503
Definition: PKmanagers.h:58
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1241
int l()
Definition: PKmanagers.h:78
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:925
virtual void allocate_buffers_wK()
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:998
virtual void finalize_PK()
Finalize the PK file formation.
Definition: PKmanagers.cc:635
virtual void prestripe_files()=0
Opening files for integral storage.
size_t pk_size() const
Definition: PKmanagers.h:161
virtual void form_PK()
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:886
int nthreads_
Definition: PKmanagers.h:101
void open_PK_file()
Opening the PK file.
Definition: PKmanagers.cc:621
size_t memory() const
Definition: PKmanagers.h:163
void get_results(std::vector< SharedMatrix > J, std::string exch)
Extracting results from vectors to matrix.
Definition: PKmanagers.cc:445
int j()
Definition: PKmanagers.h:76
int nbf_
Number of basis functions.
Definition: PKmanagers.h:103
virtual void form_PK()
Gather all steps to form PK.
Definition: PKmanagers.cc:1017
virtual void compute_integrals(bool wK=false)
Computing the integrals.
Definition: PKmanagers.cc:1037
PKMgrReorder(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:799
int nbas_
Definition: PKmanagers.h:60
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:170
virtual void write_wK()
Write wK integrals on disk.
Definition: PKmanagers.cc:619
PKManager(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Base constructor.
Definition: PKmanagers.cc:154
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:87
virtual void close_PK_file(bool keep)
Closing the files.
Definition: PKmanagers.cc:623
void integrals_buffering(const double *buffer, size_t P, size_t Q, size_t R, size_t S)
Store the computed integrals in the appropriate buffers.
Definition: PKmanagers.cc:311
virtual void form_PK_wK()
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1027
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:133
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:625
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1239
std::shared_ptr< AIOHandler > AIO() const
Definition: PKmanagers.h:294
int k()
Definition: PKmanagers.h:77
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:654
int j_
Definition: PKmanagers.h:61
void generate_wK_PK(double *twoel_ints, size_t max_size)
Generate the wK PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1378