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 #include "psi4/libmints/typedefs.h"
29 #include <psi4/libpsio/psio.hpp>
30 #include <vector>
31 
32 namespace psi {
33 
34 // Forward declarations for Psi4
35 class Options;
36 class ERISieve;
37 class AIOHandler;
38 class BasisSet;
39 
40 namespace pk {
41 
42 class PKWorker;
43 
44 typedef std::shared_ptr<PKWorker> SharedPKWrkr;
45 
46 /*-
47  ijklBasisIterator: Iterator that goes through all two-electron integral
48  indices, in increasing order of canonical index ijkl.
49  Used to determine what goes in which bucket for PK.
50  Will be extended to include sieving.
51 -*/
52 
54 private:
55  int nbas_;
56  int i_, j_, k_, l_;
57  bool done_;
58  std::shared_ptr<ERISieve> sieve_;
59 public:
60  // Constructor
61  ijklBasisIterator(int nbas, std::shared_ptr<ERISieve> sieve) : nbas_(nbas),
62  done_(false), sieve_(sieve) {}
63 
64  // Iterator functions
65  void first();
66  void next();
67  bool is_done() { return done_; }
68 
69  // Accessor functions
70  int i() { return i_; }
71  int j() { return j_; }
72  int k() { return k_; }
73  int l() { return l_; }
74 };
75 
90 class PKManager {
91 private:
94  double cutoff_;
95  std::shared_ptr<BasisSet> primary_;
96  int nthreads_;
98  int nbf_;
100  size_t ntasks_;
101 
103  bool do_wK_;
105  double omega_;
106 
107 
109  std::shared_ptr<ERISieve> sieve_;
111  size_t pk_pairs_;
113  size_t pk_size_;
115  size_t memory_;
116 
118  std::vector<SharedPKWrkr> iobuffers_;
119 
121  std::vector<double*> D_vec_;
124  std::vector<SharedMatrix> D_;
126  std::vector< bool > symmetric_;
128  bool all_sym_;
130  std::vector<double*> JK_vec_;
131 
133  void set_wK(bool dowK) { do_wK_ = dowK; }
134  void set_omega(double omega_in) { omega_ = omega_in; }
135 
136 protected:
138  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
139 
140 public:
141 
143  PKManager(std::shared_ptr<BasisSet> primary, size_t memory,
144  Options& options);
146  virtual ~PKManager() {}
147 
149  bool do_wk() const { return do_wK_; }
150  double omega() const { return omega_; }
151  double cutoff() const { return cutoff_; }
152  int nthreads() const { return nthreads_; }
153  int nbf() const { return nbf_; }
154  std::shared_ptr< ERISieve > sieve() const { return sieve_; }
155  size_t pk_pairs() const { return pk_pairs_; }
156  size_t pk_size() const { return pk_size_; }
157  size_t ntasks() const { return ntasks_; }
158  size_t memory() const { return memory_; }
159  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
160  double* D_glob_vecs(int i) const { return D_vec_[i]; }
161  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
162  std::shared_ptr< BasisSet > primary() const { return primary_; }
163  bool is_sym(int i) const { return symmetric_[i]; }
164  bool all_sym() const { return all_sym_; }
165  SharedMatrix original_D(int N) const { return D_[N]; }
166 
169  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
170 
178  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio,
179  std::shared_ptr<BasisSet> primary, size_t memory, Options &options,
180  bool dowK, double omega_in = 0);
181 
182  // Base functions needed for the class to work
185  virtual void initialize()=0;
187  virtual void initialize_wK()=0;
189  virtual void form_PK() = 0;
191  virtual void form_PK_wK() = 0;
193  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
194  std::vector<SharedMatrix> Cr)=0;
196  virtual void finalize_JK() = 0;
197 
199  virtual void print_batches();
201  virtual void print_batches_wK() {}
203  virtual void allocate_buffers()=0;
205  virtual void compute_integrals(bool wK = false);
207  virtual void compute_integrals_wK();
209  virtual void finalize_PK()=0;
210 
211 
213  void integrals_buffering(const double *buffer, size_t P, size_t Q,
214  size_t R, size_t S);
216  void integrals_buffering_wK(const double *buffer, size_t P, size_t Q,
217  size_t R, size_t S);
218 
220  virtual void write() = 0;
222  virtual void write_wK() = 0;
223 
226  void form_D_vec(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr);
228  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
229  std::vector<SharedMatrix> K = std::vector<SharedMatrix>())=0;
231  void make_J_vec(std::vector<SharedMatrix> J);
233  void get_results(std::vector<SharedMatrix> J,std::string exch);
235  void form_K(std::vector<SharedMatrix> K);
237  virtual void form_wK(std::vector<SharedMatrix> wK);
239  void finalize_D();
240 };
241 
242 /* PKMgrDisk: Abstract base class to manage PK algorithms using disk I/O
243  */
244 
245 class PKMgrDisk : public PKManager {
246 private:
248  std::vector<size_t> batch_pq_min_;
250  std::vector<size_t> batch_pq_max_;
252  std::vector<size_t> batch_index_min_;
254  std::vector<size_t> batch_index_max_;
256  std::vector<int> batch_for_pq_;
257 
259  std::map< size_t, std::pair< int, int> > ind_for_pq_;
260 
263 
265  std::shared_ptr<PSIO> psio_;
267  std::shared_ptr<AIOHandler> AIO_;
269  int pk_file_;
271  bool writing_;
272 
273 public:
275  PKMgrDisk(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
276  size_t memory, Options &options);
278  virtual ~PKMgrDisk() {}
279 
281  void set_writing(bool tmp) { writing_ = tmp; }
282  bool writing() const { return writing_; }
283  int pk_file() const { return pk_file_; }
284  std::vector< size_t >& batch_ind_min() { return batch_index_min_;}
285  std::vector< size_t >& batch_ind_max() { return batch_index_max_;}
286  std::vector< size_t >& batch_pq_min() { return batch_pq_min_;}
287  std::vector< size_t >& batch_pq_max() { return batch_pq_max_;}
288  std::vector< int >& batch_for_pq() { return batch_for_pq_; }
289  std::shared_ptr< AIOHandler > AIO() const { return AIO_; }
290  std::shared_ptr< PSIO > psio() const { return psio_; }
291 
293  virtual void finalize_PK();
294 
296  virtual void initialize();
299  virtual void initialize_wK();
301  virtual void allocate_buffers_wK()=0;
303  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
304  std::vector<SharedMatrix> Cr);
305 
307  void batch_sizing();
309  virtual void print_batches();
310 
312  virtual void prestripe_files()=0;
314  virtual void prestripe_files_wK() = 0;
315 
317  virtual void write();
319  virtual void write_wK();
320 
322  void open_PK_file();
324  virtual void close_PK_file(bool keep);
325 
327  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
328  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
329 
331  virtual void finalize_JK();
332 };
333 
347 class PKMgrReorder : public PKMgrDisk {
348 private:
349  std::vector<char*> label_J_;
350  std::vector<char*> label_K_;
351  std::vector<char*> label_wK_;
352 
353  size_t max_mem_buf_;
354 
355 public:
357  PKMgrReorder(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
358  size_t memory, Options &options);
360  virtual ~PKMgrReorder() {}
361 
363  virtual void form_PK();
365  virtual void form_PK_wK();
366 
368  virtual void prestripe_files();
370  virtual void prestripe_files_wK();
371 
373  virtual void allocate_buffers();
376  virtual void allocate_buffers_wK();
380  virtual void finalize_PK();
381 
382 };
383 
399 class PKMgrYoshimine : public PKMgrDisk {
400 private:
406  //TODO: change the name of all variables for buckets
408 
411 
412 public:
414  PKMgrYoshimine(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
415  size_t memory, Options &options);
417  virtual ~PKMgrYoshimine() {}
418 
420  //TODO: Optimize the vastly excessive amount of pre-striping for the K file
421  virtual void prestripe_files();
423  virtual void prestripe_files_wK();
424 
426  virtual void form_PK();
428  virtual void form_PK_wK();
429 
431  virtual void allocate_buffers();
433  virtual void allocate_buffers_wK();
434 
436  virtual void compute_integrals(bool wK = false);
438  virtual void compute_integrals_wK();
439 
441  virtual void write();
443  virtual void write_wK();
444 
446  void sort_ints(bool wK = false);
448  void sort_ints_wK();
449 
451  void close_iwl_buckets();
453  void close_iwl_buckets_wK();
454 
456  void generate_J_PK(double* twoel_ints, size_t max_size);
458  void generate_K_PK(double* twoel_ints, size_t max_size);
460  void generate_wK_PK(double* twoel_ints, size_t max_size);
461 };
462 
463 /* PKMgrInCore: Class to manage in-core PK algorithm */
464 
474 class PKMgrInCore : public PKManager {
475 private:
477  std::unique_ptr<double []> J_ints_;
478  std::unique_ptr<double []> K_ints_;
479  std::unique_ptr<double []> wK_ints_;
480 
481 public:
483  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory,
484  Options &options) : wK_ints_(nullptr), PKManager(primary,memory,options) {}
486  virtual ~PKMgrInCore() {}
487 
489  virtual void initialize();
491  virtual void initialize_wK();
493  virtual void form_PK();
495  virtual void form_PK_wK();
497  virtual void prepare_JK(std::vector<SharedMatrix> D,std::vector<SharedMatrix> Cl,
498  std::vector<SharedMatrix> Cr);
499 
501  virtual void form_J(std::vector<SharedMatrix> J, std::string exch = "",
502  std::vector<SharedMatrix> K = std::vector<SharedMatrix>());
504  virtual void finalize_JK();
505 
507  virtual void write();
509  virtual void write_wK();
510 
512  virtual void print_batches();
513 
515  virtual void allocate_buffers();
517  virtual void finalize_PK();
518 
519 };
520 
521 }
522 }
523 
524 #endif
virtual void finalize_JK()
Finalize JK formation.
Definition: PKmanagers.cc:1622
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:422
virtual void compute_integrals_wK()
computing wK integrals
Definition: PKmanagers.cc:1132
Definition: PK_workers.h:216
virtual void form_PK()
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1475
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:290
void finalize_D()
Finalize and delete the density matrix vectors.
Definition: PKmanagers.cc:477
std::shared_ptr< ERISieve > sieve_
Sieving object for the integrals.
Definition: PKmanagers.h:109
bool all_sym() const
Definition: PKmanagers.h:164
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:118
virtual void write_wK()
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1489
int nbf() const
Definition: PKmanagers.h:153
double omega_
Value for omeaga.
Definition: PKmanagers.h:105
int i()
Definition: PKmanagers.h:70
Options & options_
Definition: PKmanagers.h:92
virtual void print_batches()
Function to print batch sizing information.
Definition: PKmanagers.cc:181
int k_
Definition: PKmanagers.h:56
virtual void initialize_wK()
Definition: PKmanagers.cc:502
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:250
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:825
Definition: PKmanagers.h:399
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:262
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:464
int i_
Definition: PKmanagers.h:56
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:284
std::vector< size_t > batch_index_max_
The index of the last integral in each batch.
Definition: PKmanagers.h:254
bool writing_
Is there any pending AIO writing ?
Definition: PKmanagers.h:271
std::vector< size_t > batch_pq_min_
The index of the first pair in each batch.
Definition: PKmanagers.h:248
virtual void finalize_JK()
Finalize JK matrix formation.
Definition: PKmanagers.cc:788
void set_omega(double omega_in)
Definition: PKmanagers.h:134
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:113
virtual void initialize_wK()=0
Initialize for wK integrals.
virtual void compute_integrals_wK()
Computing integrals for wK.
Definition: PKmanagers.cc:299
Definition: pointgrp.h:106
void next()
Definition: PKmanagers.cc:59
virtual void write_wK()
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1159
virtual void form_PK_wK()
Forming PK for wK integrals.
Definition: PKmanagers.cc:885
virtual void initialize_wK()
Initialize the wK integrals.
Definition: PKmanagers.cc:1434
virtual void prestripe_files_wK()=0
Opening files for wK integral storage.
virtual void initialize()
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1429
std::vector< size_t > batch_index_min_
The index of the first integral in each batch.
Definition: PKmanagers.h:252
Definition: PKmanagers.h:90
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:154
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:508
Definition: PKmanagers.h:347
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:146
std::shared_ptr< ERISieve > sieve_
Definition: PKmanagers.h:58
bool done_
Definition: PKmanagers.h:57
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:286
size_t ints_per_buf_
Number of integrals per buckets.
Definition: PKmanagers.h:407
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:130
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:479
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:100
size_t pk_pairs() const
Definition: PKmanagers.h:155
virtual void form_wK(std::vector< SharedMatrix > wK)
Forming wK.
Definition: PKmanagers.cc:471
size_t memory_
Total memory available in doubles.
Definition: PKmanagers.h:115
void generate_K_PK(double *twoel_ints, size_t max_size)
Generate the K PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1292
Definition: PKmanagers.h:245
virtual void finalize_PK()=0
Deallocating the thread buffers.
virtual void allocate_buffers_wK()
Definition: PKmanagers.cc:854
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:103
int pk_file() const
Definition: PKmanagers.h:283
bool writing() const
Definition: PKmanagers.h:282
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:402
void form_D_vec(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Definition: PKmanagers.cc:365
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:126
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:265
int iwl_file_wK_
Definition: PKmanagers.h:404
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
virtual ~PKMgrInCore()
Destructor for in-core class.
Definition: PKmanagers.h:486
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:159
virtual void write()
Write integrals on disk.
Definition: PKmanagers.cc:611
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
virtual void finalize_PK()
Definition: PKmanagers.cc:890
bool is_sym(int i) const
Definition: PKmanagers.h:163
virtual void finalize_PK()
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1491
PKMgrDisk(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for PKMgrDisk.
Definition: PKmanagers.cc:484
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:162
virtual void write()
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1487
size_t max_mem_buf_
Definition: PKmanagers.h:353
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:1501
std::vector< char * > label_J_
Definition: PKmanagers.h:349
Definition: PKmanagers.h:474
virtual void prestripe_files_wK()
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:814
double cutoff() const
Definition: PKmanagers.h:151
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:149
virtual void print_batches()
Printing the algorithm header.
Definition: PKmanagers.cc:1439
virtual void print_batches()
Printing out the batches.
Definition: PKmanagers.cc:601
int pk_file_
PK file number.
Definition: PKmanagers.h:269
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:259
double omega() const
Definition: PKmanagers.h:150
virtual void allocate_buffers()
Allocate the buffer threads.
Definition: PKmanagers.cc:1446
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:169
virtual void write()
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1137
virtual void initialize()
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:495
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:483
ijklBasisIterator(int nbas, std::shared_ptr< ERISieve > sieve)
Definition: PKmanagers.h:61
virtual void prestripe_files()
Pre-striping the PK file.
Definition: PKmanagers.cc:800
virtual void form_PK()=0
Forming the PK supermatrices.
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:287
size_t iwl_int_size_
Total size of one IWL buffer on disk in bytes.
Definition: PKmanagers.h:410
virtual void form_PK_wK()
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1482
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:334
std::vector< int > batch_for_pq_
Mapping pq indices to the correct batch.
Definition: PKmanagers.h:256
virtual ~PKMgrDisk()
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:278
std::vector< char * > label_K_
Definition: PKmanagers.h:350
Definition: liboptions.h:355
size_t ntasks() const
Definition: PKmanagers.h:157
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:478
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:201
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:121
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1223
PKMgrYoshimine(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:909
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void set_writing(bool tmp)
Setter/Getter functions.
Definition: PKmanagers.h:281
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1181
virtual void allocate_buffers()
Allocating the buffers for each thread.
Definition: PKmanagers.cc:961
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:133
bool is_done()
Definition: PKmanagers.h:67
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:95
void first()
Definition: PKmanagers.cc:52
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:94
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:477
virtual ~PKMgrYoshimine()
Destructor.
Definition: PKmanagers.h:417
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:160
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:285
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:42
size_t pk_pairs_
Size of triangular list of PK pairs.
Definition: PKmanagers.h:111
int iwl_file_K_
Definition: PKmanagers.h:403
int nthreads() const
Definition: PKmanagers.h:152
virtual void prestripe_files_wK()
Pre-striping for IWL wK pre-sorted files.
Definition: PKmanagers.cc:949
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:161
virtual ~PKMgrReorder()
Destructor.
Definition: PKmanagers.h:360
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:288
int l_
Definition: PKmanagers.h:56
void close_iwl_buckets()
Close the IWL bucket files.
Definition: PKmanagers.cc:1228
void fill_buffer(SharedPKWrkr tmp)
Setter objects for internal data.
Definition: PKmanagers.h:138
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:124
std::vector< char * > label_wK_
Definition: PKmanagers.h:351
virtual void write()=0
Write the buffers of integrals to PK storage.
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:267
virtual void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Steps to prepare JK formation.
Definition: PKmanagers.cc:1497
Definition: PKmanagers.h:53
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1235
int l()
Definition: PKmanagers.h:73
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:919
virtual void allocate_buffers_wK()
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:992
virtual void finalize_PK()
Finalize the PK file formation.
Definition: PKmanagers.cc:629
virtual void prestripe_files()=0
Opening files for integral storage.
size_t pk_size() const
Definition: PKmanagers.h:156
virtual void form_PK()
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:880
int nthreads_
Definition: PKmanagers.h:96
void open_PK_file()
Opening the PK file.
Definition: PKmanagers.cc:615
size_t memory() const
Definition: PKmanagers.h:158
void get_results(std::vector< SharedMatrix > J, std::string exch)
Extracting results from vectors to matrix.
Definition: PKmanagers.cc:439
int j()
Definition: PKmanagers.h:71
int nbf_
Number of basis functions.
Definition: PKmanagers.h:98
virtual void form_PK()
Gather all steps to form PK.
Definition: PKmanagers.cc:1011
virtual void compute_integrals(bool wK=false)
Computing the integrals.
Definition: PKmanagers.cc:1031
PKMgrReorder(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:793
int nbas_
Definition: PKmanagers.h:55
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:165
virtual void write_wK()
Write wK integrals on disk.
Definition: PKmanagers.cc:613
PKManager(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Base constructor.
Definition: PKmanagers.cc:149
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:82
virtual void close_PK_file(bool keep)
Closing the files.
Definition: PKmanagers.cc:617
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:305
virtual void form_PK_wK()
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1021
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:128
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:619
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1233
std::shared_ptr< AIOHandler > AIO() const
Definition: PKmanagers.h:289
int k()
Definition: PKmanagers.h:72
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:648
int j_
Definition: PKmanagers.h:56
void generate_wK_PK(double *twoel_ints, size_t max_size)
Generate the wK PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1372