Psi4
link.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-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_libfock_link_h
29 #define _psi_libfock_link_h
30 
31 #include <cfloat>
32 
33 #include "psi4/psi4-dec.h"
36 
37 #include "psi4/libpsio/psio.hpp"
38 
39 #include <iostream>
40 #include <cstdlib>
41 #include <cstdio>
42 #include <cmath>
43 #include <sstream>
44 
45 #include "psi4/psifiles.h"
46 #include "psi4/libciomr/libciomr.h"
47 #include "psi4/libpsio/psio.h"
48 #include "psi4/libiwl/iwl.h"
49 #include "psi4/libqt/qt.h"
50 
51 #include "psi4/libfock/apps.h"
52 #include "psi4/libfock/jk.h"
53 
54 #include "psi4/libmints/typedefs.h"
55 #include "psi4/libmints/sieve.h"
56 
57 
58 namespace psi {
59 
60  class LinK {
61 
62  protected:
63 
64  std::shared_ptr<BasisSet> basis_;
65 
66  bool do_J_;
67  bool do_K_;
68  bool do_wK_;
69 
70  //std::vector<SharedMatrix >& D_;
71  std::vector<SharedMatrix> D_;
72 
73  // the coulomb and exchange matrices, to be filled in and passed back out
74  std::vector<SharedMatrix> K_;
75  //std::vector<SharedMatrix> wK_;
76 
77  // ERIs
78  std::vector<std::shared_ptr<TwoBodyAOInt> > eri_;
80  std::shared_ptr<IntegralFactory> factory_;
82  std::shared_ptr<ERISieve> sieve_;
83 
84 
85  // for each mu, we have a vector of pairs (d_munu * numax, nu_ind)
86  std::vector<std::vector<std::pair<double, int> > > nu_for_mu_indices_;
87 
88  // shell_to_shell[mu_ind] is pairs Q_munu, nu_ind for each shell mu_ind,
89  // sorted by decreasing values of Q
90  std::vector<std::vector<std::pair<double, int> > > shell_to_shell_;
91 
92  // (mu_max | mu_max)^{1/2} for each mu
93  std::vector<double> shell_max_q_sqr_;
94 
97 
98  long long int num_integrals_;
99  long long int total_num_integrals_;
100 
101 
103 
104 
105  void FindSignificantNuforMu_(int mu_ind);
106  // sort these lists (for each mu) when finished
107 
108  // for each bra shell pair, form list of ket shell pairs
110 
111  void ContractIntegrals_(int mu_ind, int lambda_ind,
112  std::vector<std::pair<int,int> >& ml_integrals);
113 
114 
115  public:
116 
117  LinK(std::shared_ptr<BasisSet> basis_in,
118  std::vector<SharedMatrix>& density_in);
119 
120  ~LinK();
121 
122  void Compute();
123 
124  // Assuming this always gets called before Compute()
125  void Update(const std::vector<SharedMatrix>& D_new);
126 
127  std::vector<SharedMatrix>& J();
128 
129  std::vector<SharedMatrix>& K();
130 
131  void set_do_J(bool do_it);
132 
133  void set_do_K(bool do_it);
134 
135  void print_header() const;
136 
137 
138 
139  }; // class
140 
141 } // namespace
142 
143 #endif
Header file for the Quantum Trio LibraryDavid Sherrill 1994.