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-2019 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_;
101  bool do_csam_;
102  std::shared_ptr<BasisSet> primary_;
105  int nbf_;
107  size_t ntasks_;
108 
110  bool do_wK_;
112  double omega_;
113 
115  std::shared_ptr<ERISieve> sieve_;
117  size_t pk_pairs_;
119  size_t pk_size_;
121  size_t memory_;
122 
124  std::vector<SharedPKWrkr> iobuffers_;
125 
127  std::vector<double*> D_vec_;
130  std::vector<SharedMatrix> D_;
132  std::vector<bool> symmetric_;
134  bool all_sym_;
136  std::vector<double*> JK_vec_;
137 
139  void set_wK(bool dowK) { do_wK_ = dowK; }
140  void set_omega(double omega_in) { omega_ = omega_in; }
141 
142  protected:
144  void fill_buffer(SharedPKWrkr tmp) { iobuffers_.push_back(tmp); }
145 
146  public:
148  PKManager(std::shared_ptr<BasisSet> primary, size_t memory, Options& options);
150  virtual ~PKManager() {}
151 
153  bool do_wk() const { return do_wK_; }
154  double omega() const { return omega_; }
155  double cutoff() const { return cutoff_; }
156  int nthreads() const { return nthreads_; }
157  int nbf() const { return nbf_; }
158  std::shared_ptr<ERISieve> sieve() const { return sieve_; }
159  size_t pk_pairs() const { return pk_pairs_; }
160  size_t pk_size() const { return pk_size_; }
161  size_t ntasks() const { return ntasks_; }
162  size_t memory() const { return memory_; }
163  SharedPKWrkr buffer(int i) const { return iobuffers_[i]; }
164  double* D_glob_vecs(int i) const { return D_vec_[i]; }
165  double* JK_glob_vecs(int i) const { return JK_vec_[i]; }
166  std::shared_ptr<BasisSet> primary() const { return primary_; }
167  bool is_sym(int i) const { return symmetric_[i]; }
168  bool all_sym() const { return all_sym_; }
169  SharedMatrix original_D(int N) const { return D_[N]; }
170 
173  void set_ntasks(size_t tmp) { ntasks_ = tmp; }
174 
182  static std::shared_ptr<PKManager> build_PKManager(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary,
183  size_t memory, Options& options, bool dowK, double omega_in = 0);
184 
185  // Base functions needed for the class to work
188  virtual void initialize() = 0;
190  virtual void initialize_wK() = 0;
192  virtual void form_PK() = 0;
194  virtual void form_PK_wK() = 0;
196  virtual void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl,
197  std::vector<SharedMatrix> Cr) = 0;
199  virtual void finalize_JK() = 0;
200 
202  virtual void print_batches();
204  virtual void print_batches_wK() {}
206  virtual void allocate_buffers() = 0;
208  virtual void compute_integrals(bool wK = false);
210  virtual void compute_integrals_wK();
212  virtual void finalize_PK() = 0;
213 
215  void integrals_buffering(const double* buffer, size_t P, size_t Q, size_t R, size_t S);
217  void integrals_buffering_wK(const double* buffer, size_t P, size_t Q, 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, size_t memory, Options& options);
277  ~PKMgrDisk() override {}
278 
280  void set_writing(bool tmp) { writing_ = tmp; }
281  bool writing() const { return writing_; }
282  int pk_file() const { return pk_file_; }
283  std::vector<size_t>& batch_ind_min() { return batch_index_min_; }
284  std::vector<size_t>& batch_ind_max() { return batch_index_max_; }
285  std::vector<size_t>& batch_pq_min() { return batch_pq_min_; }
286  std::vector<size_t>& batch_pq_max() { return batch_pq_max_; }
287  std::vector<int>& batch_for_pq() { return batch_for_pq_; }
288  std::shared_ptr<AIOHandler> AIO() const { return AIO_; }
289  std::shared_ptr<PSIO> psio() const { return psio_; }
290 
292  void finalize_PK() override;
293 
295  void initialize() override;
298  void initialize_wK() override;
300  virtual void allocate_buffers_wK() = 0;
302  void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr) override;
303 
305  void batch_sizing();
307  void print_batches() override;
308 
310  virtual void prestripe_files() = 0;
312  virtual void prestripe_files_wK() = 0;
313 
315  void write() override;
317  void write_wK() override;
318 
320  void open_PK_file();
322  virtual void close_PK_file(bool keep);
323 
325  void form_J(std::vector<SharedMatrix> J, std::string exch = "",
326  std::vector<SharedMatrix> K = std::vector<SharedMatrix>()) override;
327 
329  void finalize_JK() override;
330 };
331 
345 class PKMgrReorder : public PKMgrDisk {
346  private:
347  std::vector<char*> label_J_;
348  std::vector<char*> label_K_;
349  std::vector<char*> label_wK_;
350 
351  size_t max_mem_buf_;
352 
353  public:
355  PKMgrReorder(std::shared_ptr<PSIO> psio, std::shared_ptr<BasisSet> primary, size_t memory, Options& options);
357  ~PKMgrReorder() override {}
358 
360  void form_PK() override;
362  void form_PK_wK() override;
363 
365  void prestripe_files() override;
367  void prestripe_files_wK() override;
368 
370  void allocate_buffers() override;
373  void allocate_buffers_wK() override;
377  void finalize_PK() override;
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, size_t memory, Options& options);
412  ~PKMgrYoshimine() override {}
413 
415  // TODO: Optimize the vastly excessive amount of pre-striping for the K file
416  void prestripe_files() override;
418  void prestripe_files_wK() override;
419 
421  void form_PK() override;
423  void form_PK_wK() override;
424 
426  void allocate_buffers() override;
428  void allocate_buffers_wK() override;
429 
431  void compute_integrals(bool wK = false) override;
433  void compute_integrals_wK() override;
434 
436  void write() override;
438  void write_wK() override;
439 
441  void sort_ints(bool wK = false);
443  void sort_ints_wK();
444 
446  void close_iwl_buckets();
448  void close_iwl_buckets_wK();
449 
451  void generate_J_PK(double* twoel_ints, size_t max_size);
453  void generate_K_PK(double* twoel_ints, size_t max_size);
455  void generate_wK_PK(double* twoel_ints, size_t max_size);
456 };
457 
458 /* PKMgrInCore: Class to manage in-core PK algorithm */
459 
469 class PKMgrInCore : public PKManager {
470  private:
472  std::unique_ptr<double[]> J_ints_;
473  std::unique_ptr<double[]> K_ints_;
474  std::unique_ptr<double[]> wK_ints_;
475 
476  public:
478  PKMgrInCore(std::shared_ptr<BasisSet> primary, size_t memory, Options& options)
479  : wK_ints_(nullptr), PKManager(primary, memory, options) {}
481  ~PKMgrInCore() override {}
482 
484  void initialize() override;
486  void initialize_wK() override;
488  void form_PK() override;
490  void form_PK_wK() override;
492  void prepare_JK(std::vector<SharedMatrix> D, std::vector<SharedMatrix> Cl, std::vector<SharedMatrix> Cr) override;
493 
495  void form_J(std::vector<SharedMatrix> J, std::string exch = "",
496  std::vector<SharedMatrix> K = std::vector<SharedMatrix>()) override;
498  void finalize_JK() override;
499 
501  void write() override;
503  void write_wK() override;
504 
506  void print_batches() override;
507 
509  void allocate_buffers() override;
511  void finalize_PK() override;
512 };
513 }
514 }
515 
516 #endif
void form_PK_wK() override
Sequence of steps to form wK PK matrix.
Definition: PKmanagers.cc:1492
void make_J_vec(std::vector< SharedMatrix > J)
Preparing triangular vector for J/K.
Definition: PKmanagers.cc:432
Definition: PK_workers.h:219
void finalize_PK() override
Definition: PKmanagers.cc:900
void finalize_D()
Finalize and delete the density matrix vectors.
Definition: PKmanagers.cc:487
std::shared_ptr< ERISieve > sieve_
Sieving object for the integrals.
Definition: PKmanagers.h:115
bool all_sym() const
Definition: PKmanagers.h:168
std::vector< SharedPKWrkr > iobuffers_
Array of IOBuffer_PK for task handling.
Definition: PKmanagers.h:124
int nbf() const
Definition: PKmanagers.h:157
double omega_
Value for omeaga.
Definition: PKmanagers.h:112
void form_PK() override
Gather all steps to form PK.
Definition: PKmanagers.cc:1021
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:190
void allocate_buffers_wK() override
Definition: PKmanagers.cc:864
int k_
Definition: PKmanagers.h:61
void write() override
Write integrals on disk.
Definition: PKmanagers.cc:621
std::vector< size_t > batch_pq_max_
The index of the last pair in each batch.
Definition: PKmanagers.h:250
void write_wK() override
Finalize integral arrays for wK.
Definition: PKmanagers.cc:1499
Definition: PKmanagers.h:395
void form_PK_wK() override
Steps to form the supermatrix for wK.
Definition: PKmanagers.cc:1031
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:1444
virtual void compute_integrals(bool wK=false)
Actually computing the integrals.
Definition: PKmanagers.cc:204
int max_batches_
Maximum number of batches.
Definition: PKmanagers.h:262
void form_K(std::vector< SharedMatrix > K)
Forming K.
Definition: PKmanagers.cc:474
int i_
Definition: PKmanagers.h:61
std::unique_ptr< double[]> K_ints_
Definition: PKmanagers.h:473
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
void prepare_JK(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr) override
Steps to prepare JK formation.
Definition: PKmanagers.cc:1507
void set_omega(double omega_in)
Definition: PKmanagers.h:140
void finalize_JK() override
Finalize JK formation.
Definition: PKmanagers.cc:1632
size_t pk_size_
Total size of the four-index triangular PK.
Definition: PKmanagers.h:119
std::shared_ptr< ERISieve > sieve() const
Definition: PKmanagers.h:158
virtual void initialize_wK()=0
Initialize for wK integrals.
virtual void compute_integrals_wK()
Computing integrals for wK.
Definition: PKmanagers.cc:309
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:629
void form_PK() override
Sequence of steps to form PK matrix.
Definition: PKmanagers.cc:1485
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:252
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
void initialize_wK() override
Definition: PKmanagers.cc:512
Definition: PKmanagers.h:95
void batch_sizing()
Determining the batch sizes.
Definition: PKmanagers.cc:518
Definition: PKmanagers.h:345
virtual ~PKManager()
Base destructor, does nothing.
Definition: PKmanagers.h:150
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:403
std::vector< double * > JK_vec_
Vector of triangular result J/K matrices.
Definition: PKmanagers.h:136
size_t ntasks_
Number of tasks for integral computation.
Definition: PKmanagers.h:107
size_t pk_pairs() const
Definition: PKmanagers.h:159
virtual void form_wK(std::vector< SharedMatrix > wK)
Forming wK.
Definition: PKmanagers.cc:481
size_t memory_
Total memory available in doubles.
Definition: PKmanagers.h:121
void generate_K_PK(double *twoel_ints, size_t max_size)
Generate the K PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1302
Definition: PKmanagers.h:245
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:959
bool do_wK_
Do wK in addition to regular J and K?
Definition: PKmanagers.h:110
int pk_file() const
Definition: PKmanagers.h:282
bool writing() const
Definition: PKmanagers.h:281
void allocate_buffers() override
Allocating the buffers for each thread.
Definition: PKmanagers.cc:835
int iwl_file_J_
Files of pre-sorted IWL integral buckets.
Definition: PKmanagers.h:398
~PKMgrYoshimine() override
Destructor.
Definition: PKmanagers.h:412
void form_D_vec(std::vector< SharedMatrix > D, std::vector< SharedMatrix > Cl, std::vector< SharedMatrix > Cr)
Definition: PKmanagers.cc:375
SharedPKWrkr get_buffer()
Accessor that returns buffer corresponding to current thread.
Definition: PKmanagers.cc:182
void compute_integrals_wK() override
computing wK integrals
Definition: PKmanagers.cc:1142
std::shared_ptr< PSIO > psio_
PSIO handler (boost pointer for compatibility)
Definition: PKmanagers.h:265
int iwl_file_wK_
Definition: PKmanagers.h:400
virtual void form_PK_wK()=0
Forming PK supermatrices for wK.
SharedPKWrkr buffer(int i) const
Definition: PKmanagers.h:163
void print_batches() override
Printing the algorithm header.
Definition: PKmanagers.cc:1449
virtual void allocate_buffers_wK()=0
Allocating new buffers for wK integrals.
bool is_sym(int i) const
Definition: PKmanagers.h:167
void print_batches() override
Printing out the batches.
Definition: PKmanagers.cc:611
PKMgrDisk(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for PKMgrDisk.
Definition: PKmanagers.cc:494
std::shared_ptr< AIOHandler > AIO() const
Definition: PKmanagers.h:288
std::vector< int > & batch_for_pq()
Definition: PKmanagers.h:287
size_t max_mem_buf_
Definition: PKmanagers.h:351
std::vector< char * > label_J_
Definition: PKmanagers.h:347
Definition: PKmanagers.h:469
double cutoff() const
Definition: PKmanagers.h:155
void write() override
Writing of the last partially filled buffers.
Definition: PKmanagers.cc:1147
bool do_wk() const
Accessor functions for simple data.
Definition: PKmanagers.h:153
void compute_integrals(bool wK=false) override
Computing the integrals.
Definition: PKmanagers.cc:1041
std::shared_ptr< BasisSet > primary() const
Definition: PKmanagers.h:166
std::vector< size_t > & batch_ind_min()
Definition: PKmanagers.h:283
int pk_file_
PK file number.
Definition: PKmanagers.h:269
double omega() const
Definition: PKmanagers.h:154
void set_ntasks(size_t tmp)
Definition: PKmanagers.h:173
void form_PK() override
Sequence of operations to form PK for reorder algo.
Definition: PKmanagers.cc:890
std::unique_ptr< double[]> J_ints_
Large in core arrays for integral storage.
Definition: PKmanagers.h:472
void prestripe_files_wK() override
Pre-striping PK file for wK integrals.
Definition: PKmanagers.cc:824
PKMgrInCore(std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor for in-core class.
Definition: PKmanagers.h:478
std::shared_ptr< PSIO > psio() const
Definition: PKmanagers.h:289
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:971
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:406
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:344
std::vector< int > batch_for_pq_
Mapping pq indices to the correct batch.
Definition: PKmanagers.h:256
void write_wK() override
Writing of the last partially filled buffers for wK.
Definition: PKmanagers.cc:1169
std::vector< char * > label_K_
Definition: PKmanagers.h:348
Definition: liboptions.h:353
void prestripe_files() override
Pre-striping the IWL pre-sorted bucket files.
Definition: PKmanagers.cc:929
size_t ntasks() const
Definition: PKmanagers.h:161
virtual void print_batches_wK()
Some printing for wK integrals;.
Definition: PKmanagers.h:204
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:127
void sort_ints_wK()
Reading and sorting wK integrals for PK file.
Definition: PKmanagers.cc:1233
void write_wK() override
Write wK integrals on disk.
Definition: PKmanagers.cc:623
PKMgrYoshimine(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:919
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void set_writing(bool tmp)
Setter/Getter functions.
Definition: PKmanagers.h:280
void sort_ints(bool wK=false)
Reading and sorting integrals to generate PK file.
Definition: PKmanagers.cc:1191
void write() override
No disk write, only finalizes integral arrays.
Definition: PKmanagers.cc:1497
void set_wK(bool dowK)
Setter functions for internal wK options.
Definition: PKmanagers.h:139
bool is_done()
Definition: PKmanagers.h:72
std::shared_ptr< BasisSet > primary_
Definition: PKmanagers.h:102
void first()
Definition: PKmanagers.cc:57
void allocate_buffers() override
Allocate the buffer threads.
Definition: PKmanagers.cc:1456
double cutoff_
Integral cutoff to apply.
Definition: PKmanagers.h:99
double * D_glob_vecs(int i) const
Definition: PKmanagers.h:164
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:117
int iwl_file_K_
Definition: PKmanagers.h:399
int nthreads() const
Definition: PKmanagers.h:156
double * JK_glob_vecs(int i) const
Definition: PKmanagers.h:165
std::vector< bool > symmetric_
Vector of booleans, true if corresponding density matrix is symmetric.
Definition: PKmanagers.h:132
void initialize() override
Initialize sequence for Disk algorithms.
Definition: PKmanagers.cc:505
int l_
Definition: PKmanagers.h:61
std::vector< size_t > & batch_pq_max()
Definition: PKmanagers.h:286
std::vector< size_t > & batch_pq_min()
Definition: PKmanagers.h:285
void finalize_PK() override
Finalize PK, i.e. deallocate buffers.
Definition: PKmanagers.cc:1501
void close_iwl_buckets()
Close the IWL bucket files.
Definition: PKmanagers.cc:1238
void fill_buffer(SharedPKWrkr tmp)
Setter objects for internal data.
Definition: PKmanagers.h:144
std::vector< SharedMatrix > D_
Definition: PKmanagers.h:130
std::vector< char * > label_wK_
Definition: PKmanagers.h:349
virtual void write()=0
Write the buffers of integrals to PK storage.
void prestripe_files() override
Pre-striping the PK file.
Definition: PKmanagers.cc:810
std::shared_ptr< AIOHandler > AIO_
AIO Handler.
Definition: PKmanagers.h:267
void initialize() override
Initialize sequence for in-core algorithm.
Definition: PKmanagers.cc:1439
Definition: PKmanagers.h:58
void finalize_JK() override
Finalize JK matrix formation.
Definition: PKmanagers.cc:798
void generate_J_PK(double *twoel_ints, size_t max_size)
Generate the J PK supermatrix from IWL integrals.
Definition: PKmanagers.cc:1245
~PKMgrReorder() override
Destructor.
Definition: PKmanagers.h:357
void allocate_buffers_wK() override
Allocating buffers for wK integrals.
Definition: PKmanagers.cc:1002
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:160
~PKMgrDisk() override
Destructor for PKMgrDisk, does nothing.
Definition: PKmanagers.h:277
int nthreads_
Definition: PKmanagers.h:103
void open_PK_file()
Opening the PK file.
Definition: PKmanagers.cc:625
size_t memory() const
Definition: PKmanagers.h:162
void get_results(std::vector< SharedMatrix > J, std::string exch)
Extracting results from vectors to matrix.
Definition: PKmanagers.cc:449
int j()
Definition: PKmanagers.h:76
int nbf_
Number of basis functions.
Definition: PKmanagers.h:105
~PKMgrInCore() override
Destructor for in-core class.
Definition: PKmanagers.h:481
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:658
PKMgrReorder(std::shared_ptr< PSIO > psio, std::shared_ptr< BasisSet > primary, size_t memory, Options &options)
Constructor.
Definition: PKmanagers.cc:803
int nbas_
Definition: PKmanagers.h:60
bool do_csam_
CSAM Screening (defaults to false)
Definition: PKmanagers.h:101
std::unique_ptr< double[]> wK_ints_
Definition: PKmanagers.h:474
virtual void write_wK()=0
Write the buffers of wK integrals to PK storage.
std::vector< size_t > & batch_ind_max()
Definition: PKmanagers.h:284
void form_PK_wK() override
Forming PK for wK integrals.
Definition: PKmanagers.cc:895
SharedMatrix original_D(int N) const
Definition: PKmanagers.h:169
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:627
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:315
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:1511
bool all_sym_
Are all density matrices symmetric?
Definition: PKmanagers.h:134
void close_iwl_buckets_wK()
Close the IWL bucket file for wK.
Definition: PKmanagers.cc:1243
void finalize_PK() override
Finalize the PK file formation.
Definition: PKmanagers.cc:639
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:1382