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 
65  public:
66  // Constructor
67  ijklBasisIterator(int nbas, std::shared_ptr<ERISieve> sieve) : nbas_(nbas), 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 
113  std::shared_ptr<ERISieve> sieve_;
115  size_t pk_pairs_;
117  size_t pk_size_;
119  size_t memory_;
120 
122  std::vector<SharedPKWrkr> iobuffers_;
123 
125  std::vector<double*> D_vec_;
128  std::vector<SharedMatrix> D_;
130  std::vector<bool> symmetric_;
132  bool all_sym_;
134  std::vector<double*> JK_vec_;
135 
137  void set_wK(bool dowK) { do_wK_ = dowK; }
138  void set_omega(double omega_in) { omega_ = omega_in; }
139 
140  protected:
142  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
143 
144  public:
146  PKManager(std::shared_ptr<BasisSet> primary, size_t memory, Options& options);
148  virtual ~PKManager() {}
149 
151  bool do_wk() const { return do_wK_; }
152  double omega() const { return omega_; }
153  double cutoff() const { return cutoff_; }
154  int nthreads() const { return nthreads_; }
155  int nbf() const { return nbf_; }
156  std::shared_ptr<ERISieve> sieve() const { return sieve_; }
157  size_t pk_pairs() const { return pk_pairs_; }
158  size_t pk_size() const { return pk_size_; }
159  size_t ntasks() const { return ntasks_; }
160  size_t memory() const { return memory_; }
161  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
162  double* D_glob_vecs(int i) const { return D_vec_[i]; }
163  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
164  std::shared_ptr<BasisSet> primary() const { return primary_; }
165  bool is_sym(int i) const { return symmetric_[i]; }
166  bool all_sym() const { return all_sym_; }
167  SharedMatrix original_D(int N) const { return D_[N]; }
168 
171  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
172 
180  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
181  size_t memory, Options& options, bool dowK, double omega_in = 0);
182 
183  // Base functions needed for the class to work
186  virtual void initialize() = 0;
188  virtual void initialize_wK() = 0;
190  virtual void form_PK() = 0;
192  virtual void form_PK_wK() = 0;
194  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
195  std::vector<SharedMatrix> Cr) = 0;
197  virtual void finalize_JK() = 0;
198 
200  virtual void print_batches();
202  virtual void print_batches_wK() {}
204  virtual void allocate_buffers() = 0;
206  virtual void compute_integrals(bool wK = false);
208  virtual void compute_integrals_wK();
210  virtual void finalize_PK() = 0;
211 
213  void integrals_buffering(const double* buffer, size_t P, size_t Q, size_t R, size_t S);
215  void integrals_buffering_wK(const double* buffer, size_t P, size_t Q, size_t R, size_t S);
216 
218  virtual void write() = 0;
220  virtual void write_wK() = 0;
221 
224  void form_D_vec(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr);
226  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
227  std::vector<SharedMatrix> K = std::vector<SharedMatrix>()) = 0;
229  void make_J_vec(std::vector<SharedMatrix> J);
231  void get_results(std::vector<SharedMatrix> J, std::string exch);
233  void form_K(std::vector<SharedMatrix> K);
235  virtual void form_wK(std::vector<SharedMatrix> wK);
237  void finalize_D();
238 };
239 
240 /* PKMgrDisk: Abstract base class to manage PK algorithms using disk I/O
241  */
242 
243 class PKMgrDisk : public PKManager {
244  private:
246  std::vector<size_t> batch_pq_min_;
248  std::vector<size_t> batch_pq_max_;
250  std::vector<size_t> batch_index_min_;
252  std::vector<size_t> batch_index_max_;
254  std::vector<int> batch_for_pq_;
255 
257  std::map<size_t, std::pair<int, int> > ind_for_pq_;
258 
261 
263  std::shared_ptr<PSIO> psio_;
265  std::shared_ptr<AIOHandler> AIO_;
267  int pk_file_;
269  bool writing_;
270 
271  public:
273  PKMgrDisk(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary, size_t memory, Options& options);
275  ~PKMgrDisk() override {}
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  void finalize_PK() override;
291 
293  void initialize() override;
296  void initialize_wK() override;
298  virtual void allocate_buffers_wK() = 0;
300  void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr) override;
301 
303  void batch_sizing();
305  void print_batches() override;
306 
308  virtual void prestripe_files() = 0;
310  virtual void prestripe_files_wK() = 0;
311 
313  void write() override;
315  void write_wK() override;
316 
318  void open_PK_file();
320  virtual void close_PK_file(bool keep);
321 
323  void form_J(std::vector<SharedMatrix> J, std::string exch = "",
324  std::vector<SharedMatrix> K = std::vector<SharedMatrix>()) override;
325 
327  void finalize_JK() override;
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, size_t memory, Options& options);
355  ~PKMgrReorder() override {}
356 
358  void form_PK() override;
360  void form_PK_wK() override;
361 
363  void prestripe_files() override;
365  void prestripe_files_wK() override;
366 
368  void allocate_buffers() override;
371  void allocate_buffers_wK() override;
375  void finalize_PK() override;
376 };
377 
393 class PKMgrYoshimine : public PKMgrDisk {
394  private:
400  // TODO: change the name of all variables for buckets
402 
405 
406  public:
408  PKMgrYoshimine(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary, size_t memory, Options& options);
410  ~PKMgrYoshimine() override {}
411 
413  // TODO: Optimize the vastly excessive amount of pre-striping for the K file
414  void prestripe_files() override;
416  void prestripe_files_wK() override;
417 
419  void form_PK() override;
421  void form_PK_wK() override;
422 
424  void allocate_buffers() override;
426  void allocate_buffers_wK() override;
427 
429  void compute_integrals(bool wK = false) override;
431  void compute_integrals_wK() override;
432 
434  void write() override;
436  void write_wK() override;
437 
439  void sort_ints(bool wK = false);
441  void sort_ints_wK();
442 
444  void close_iwl_buckets();
446  void close_iwl_buckets_wK();
447 
449  void generate_J_PK(double* twoel_ints, size_t max_size);
451  void generate_K_PK(double* twoel_ints, size_t max_size);
453  void generate_wK_PK(double* twoel_ints, size_t max_size);
454 };
455 
456 /* PKMgrInCore: Class to manage in-core PK algorithm */
457 
467 class PKMgrInCore : public PKManager {
468  private:
470  std::unique_ptr<double[]> J_ints_;
471  std::unique_ptr<double[]> K_ints_;
472  std::unique_ptr<double[]> wK_ints_;
473 
474  public:
476  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory, Options& options)
477  : wK_ints_(nullptr), PKManager(primary, memory, options) {}
479  ~PKMgrInCore() override {}
480 
482  void initialize() override;
484  void initialize_wK() override;
486  void form_PK() override;
488  void form_PK_wK() override;
490  void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr) override;
491 
493  void form_J(std::vector<SharedMatrix> J, std::string exch = "",
494  std::vector<SharedMatrix> K = std::vector<SharedMatrix>()) override;
496  void finalize_JK() override;
497 
499  void write() override;
501  void write_wK() override;
502 
504  void print_batches() override;
505 
507  void allocate_buffers() override;
509  void finalize_PK() override;
510 };
511 }
512 }
513 
514 #endif
void form_PK_wK() override
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1488
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:428
Definition: PK_workers.h:219
void finalize_PK() override
Definition: PKmanagers.cc:896
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:113
bool all_sym() const
Definition: PKmanagers.h:166
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:122
int nbf() const
Definition: PKmanagers.h:155
double omega_
Value for omeaga.
Definition: PKmanagers.h:110
void form_PK() override
Gather all steps to form PK.
Definition: PKmanagers.cc:1017
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
void allocate_buffers_wK() override
Definition: PKmanagers.cc:860
int k_
Definition: PKmanagers.h:61
void write() override
Write integrals on disk.
Definition: PKmanagers.cc:617
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:248
void write_wK() override
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1495
Definition: PKmanagers.h:393
void form_PK_wK() override
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1027
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)=0
Preparing JK computation.
void initialize_wK() override
Initialize the wK integrals.
Definition: PKmanagers.cc:1440
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:260
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:470
int i_
Definition: PKmanagers.h:61
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:471
std::vector< size_t > batch_index_max_
The index of the last integral in each batch.
Definition: PKmanagers.h:252
bool writing_
Is there any pending AIO writing ?
Definition: PKmanagers.h:269
std::vector< size_t > batch_pq_min_
The index of the first pair in each batch.
Definition: PKmanagers.h:246
void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr) override
Steps to prepare JK formation.
Definition: PKmanagers.cc:1503
void set_omega(double omega_in)
Definition: PKmanagers.h:138
void finalize_JK() override
Finalize JK formation.
Definition: PKmanagers.cc:1628
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:117
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:156
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
void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr) override
Prepare the JK formation for disk algorithms.
Definition: PKmanagers.cc:625
void form_PK() override
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1481
virtual void prestripe_files_wK()=0
Opening files for wK integral storage.
std::vector< size_t > batch_index_min_
The index of the first integral in each batch.
Definition: PKmanagers.h:250
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:257
void initialize_wK() override
Definition: PKmanagers.cc:508
Definition: PKmanagers.h:95
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:514
Definition: PKmanagers.h:343
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:148
std::shared_ptr< ERISieve > sieve_
Definition: PKmanagers.h:63
bool done_
Definition: PKmanagers.h:62
size_t ints_per_buf_
Number of integrals per buckets.
Definition: PKmanagers.h:401
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:134
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:105
size_t pk_pairs() const
Definition: PKmanagers.h:157
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:119
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:243
virtual void finalize_PK()=0
Deallocating the thread buffers.
void prestripe_files_wK() override
Pre-striping for IWL wK pre-sorted files.
Definition: PKmanagers.cc:955
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:108
int pk_file() const
Definition: PKmanagers.h:280
bool writing() const
Definition: PKmanagers.h:279
void allocate_buffers() override
Allocating the buffers for each thread.
Definition: PKmanagers.cc:831
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:396
~PKMgrYoshimine() override
Destructor.
Definition: PKmanagers.h:410
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
void compute_integrals_wK() override
computing wK integrals
Definition: PKmanagers.cc:1138
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:263
int iwl_file_wK_
Definition: PKmanagers.h:398
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:161
void print_batches() override
Printing the algorithm header.
Definition: PKmanagers.cc:1445
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
bool is_sym(int i) const
Definition: PKmanagers.h:165
void print_batches() override
Printing out the batches.
Definition: PKmanagers.cc:607
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< AIOHandler > AIO() const
Definition: PKmanagers.h:286
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:285
size_t max_mem_buf_
Definition: PKmanagers.h:349
std::vector< char * > label_J_
Definition: PKmanagers.h:345
Definition: PKmanagers.h:467
double cutoff() const
Definition: PKmanagers.h:153
void write() override
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1143
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:151
void compute_integrals(bool wK=false) override
Computing the integrals.
Definition: PKmanagers.cc:1037
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:164
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:281
int pk_file_
PK file number.
Definition: PKmanagers.h:267
double omega() const
Definition: PKmanagers.h:152
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:171
void form_PK() override
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:886
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:470
void prestripe_files_wK() override
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:820
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:476
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:287
ijklBasisIterator(int nbas, std::shared_ptr< ERISieve > sieve)
Definition: PKmanagers.h:67
void allocate_buffers() override
Allocating the buffers for each thread.
Definition: PKmanagers.cc:967
virtual void form_PK()=0
Forming the PK supermatrices.
size_t iwl_int_size_
Total size of one IWL buffer on disk in bytes.
Definition: PKmanagers.h:404
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:254
void write_wK() override
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1165
std::vector< char * > label_K_
Definition: PKmanagers.h:346
Definition: liboptions.h:352
void prestripe_files() override
Pre-striping the IWL pre-sorted bucket files.
Definition: PKmanagers.cc:925
size_t ntasks() const
Definition: PKmanagers.h:159
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:202
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:125
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1229
void write_wK() override
Write wK integrals on disk.
Definition: PKmanagers.cc:619
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:278
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1187
void write() override
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1493
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:137
bool is_done()
Definition: PKmanagers.h:72
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:100
void first()
Definition: PKmanagers.cc:57
void allocate_buffers() override
Allocate the buffer threads.
Definition: PKmanagers.cc:1452
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:99
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:162
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:115
int iwl_file_K_
Definition: PKmanagers.h:397
int nthreads() const
Definition: PKmanagers.h:154
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:163
std::vector< bool > symmetric_
Vector of booleans, true if corresponding density matrix is symmetric.
Definition: PKmanagers.h:130
void initialize() override
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:501
int l_
Definition: PKmanagers.h:61
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:284
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:283
void finalize_PK() override
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1497
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:142
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:128
std::vector< char * > label_wK_
Definition: PKmanagers.h:347
virtual void write()=0
Write the buffers of integrals to PK storage.
void prestripe_files() override
Pre-striping the PK file.
Definition: PKmanagers.cc:806
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:265
void initialize() override
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1435
Definition: PKmanagers.h:58
void finalize_JK() override
Finalize JK matrix formation.
Definition: PKmanagers.cc:794
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1241
~PKMgrReorder() override
Destructor.
Definition: PKmanagers.h:355
void allocate_buffers_wK() override
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:998
int l()
Definition: PKmanagers.h:78
virtual void finalize_JK()=0
Cleaning up after JK computation.
virtual void prestripe_files()=0
Opening files for integral storage.
size_t pk_size() const
Definition: PKmanagers.h:158
~PKMgrDisk() override
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:275
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:160
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
~PKMgrInCore() override
Destructor for in-core class.
Definition: PKmanagers.h:479
void form_J(std::vector< SharedMatrix > J, std::string exch="", std::vector< SharedMatrix > K=std::vector< SharedMatrix >()) override
Form J from PK supermatrix, shared_ptr() initialized to null.
Definition: PKmanagers.cc:654
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
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:472
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:282
void form_PK_wK() override
Forming PK for wK integrals.
Definition: PKmanagers.cc:891
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:167
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
void form_J(std::vector< SharedMatrix > J, std::string exch="", std::vector< SharedMatrix > K=std::vector< SharedMatrix >()) override
Form J matrix, shared_ptr() initializes to null.
Definition: PKmanagers.cc:1507
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:132
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1239
void finalize_PK() override
Finalize the PK file formation.
Definition: PKmanagers.cc:635
int k()
Definition: PKmanagers.h:77
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