Psi4
v.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 LIBFOCK_DFT_H
29 #define LIBFOCK_DFT_H
30 #include "psi4/libmints/typedefs.h"
31 #include <vector>
32 #include <map>
33 
34 namespace psi {
35 class BasisSet;
36 class Options;
37 class DFTGrid;
38 class PointFunctions;
39 class SuperFunctional;
40 
41 // => BASE CLASS <= //
42 
50 class VBase {
51 
52 protected:
54  int debug_;
56  int print_;
60  std::shared_ptr<BasisSet> primary_;
62  std::shared_ptr<SuperFunctional> functional_;
64  std::shared_ptr<PointFunctions> properties_;
66  std::shared_ptr<DFTGrid> grid_;
68  std::map<std::string, double> quad_values_;
69 
72 
74  std::vector<SharedMatrix> V_;
76  std::vector<SharedMatrix> V_AO_;
77 
79  std::vector<SharedMatrix> C_;
81  std::vector<SharedMatrix> D_;
83  std::vector<SharedMatrix> C_AO_;
85  std::vector<SharedMatrix> D_AO_;
86 
88  std::vector<SharedMatrix> Caocc_;
90  std::vector<SharedMatrix> Cavir_;
92  std::vector<SharedMatrix> P_;
94  std::vector<SharedMatrix> P_SO_;
96  std::vector<SharedMatrix> P_AO_;
97 
98  virtual void compute_D();
99  virtual void USO2AO();
100  virtual void AO2USO();
101 
103  virtual void compute_V() = 0;
105  void common_init();
106 public:
107  VBase(std::shared_ptr<SuperFunctional> functional,
108  std::shared_ptr<BasisSet> primary, Options& options);
109  virtual ~VBase();
110 
111  static std::shared_ptr<VBase> build_V(std::shared_ptr<BasisSet> primary,
112  std::shared_ptr<SuperFunctional> functional,
113  Options& options,
114  const std::string& type = "RV");
115 
116  std::shared_ptr<BasisSet> basis() const { return primary_; }
117  std::shared_ptr<SuperFunctional> functional() const { return functional_; }
118  std::shared_ptr<PointFunctions> properties() const { return properties_; }
119  std::shared_ptr<DFTGrid> grid() const { return grid_; }
120  std::map<std::string, double>& quadrature_values() { return quad_values_; }
121 
123  std::vector<SharedMatrix>& C() { return C_; }
124  std::vector<SharedMatrix>& Caocc() { return Caocc_; }
125  std::vector<SharedMatrix>& Cavir() { return Cavir_; }
126  std::vector<SharedMatrix>& P() { return P_; }
127  const std::vector<SharedMatrix>& V() const { return V_; }
128  const std::vector<SharedMatrix>& D() const { return D_; }
129 
131  virtual SharedMatrix compute_gradient();
132 
133  void set_print(int print) { print_ = print; }
134  void set_debug(int debug) { debug_ = debug; }
135 
136  virtual void initialize();
137  virtual void compute();
138  virtual void finalize();
139 
140  virtual void print_header() const;
141 };
142 
143 // => APPLIED CLASSES <= //
144 
145 class RV : public VBase {
146 
147 protected:
148 
149  // Actually build V_AO
150  virtual void compute_V();
151 
152 public:
153  RV(std::shared_ptr<SuperFunctional> functional,
154  std::shared_ptr<BasisSet> primary,
155  Options& options);
156  virtual ~RV();
157 
158  virtual void initialize();
159  virtual void finalize();
160 
161  virtual SharedMatrix compute_gradient();
162 
163  virtual void print_header() const;
164 };
165 
166 class UV : public VBase {
167 
168 protected:
169 
170  // Actually build V_AO
171  virtual void compute_V();
172 
173 public:
174  UV(std::shared_ptr<SuperFunctional> functional,
175  std::shared_ptr<BasisSet> primary,
176  Options& options);
177  virtual ~UV();
178 
179  virtual void initialize();
180  virtual void finalize();
181 
182  virtual SharedMatrix compute_gradient();
183 
184  virtual void print_header() const;
185 };
186 
187 class RK : public RV {
188 
189 protected:
190 
191  // Actually build V_AO
192  virtual void compute_V();
193 
194 public:
195  RK(std::shared_ptr<SuperFunctional> functional,
196  std::shared_ptr<BasisSet> primary,
197  Options& options);
198  virtual ~RK();
199 
200  virtual void print_header() const;
201 };
202 
203 class UK : public UV {
204 
205 protected:
206 
207  // Actually build V_AO
208  virtual void compute_V();
209 
210 public:
211  UK(std::shared_ptr<SuperFunctional> functional,
212  std::shared_ptr<BasisSet> primary,
213  Options& options);
214  virtual ~UK();
215 
216  virtual void print_header() const;
217 };
218 
219 }
220 #endif
void set_debug(int debug)
Definition: v.h:134
virtual void print_header() const
Definition: v.cc:426
std::vector< SharedMatrix > & P()
Definition: v.h:126
std::vector< SharedMatrix > P_SO_
Vector of Perturbation matrices (TDDFT, SO)
Definition: v.h:94
std::shared_ptr< DFTGrid > grid_
Integration grid, built by KSPotential.
Definition: v.h:66
std::vector< SharedMatrix > P_
Vector of Perturbation matrices (TDDFT, ia)
Definition: v.h:92
int debug_
Debug flag.
Definition: v.h:54
virtual void compute_V()
Actually build V_AO.
Definition: v.cc:430
std::map< std::string, double > & quadrature_values()
Definition: v.h:120
virtual void print_header() const
Definition: v.cc:1402
std::shared_ptr< DFTGrid > grid() const
Definition: v.h:119
Definition: v.h:203
virtual void compute_V()=0
Actually build V_AO.
std::vector< SharedMatrix > C_
Vector of occupied C matrices (used for D and KE density)
Definition: v.h:79
Options & options_
Options object, used to build grid.
Definition: v.h:58
virtual ~UK()
Definition: v.cc:1399
virtual void print_header() const
Definition: v.cc:398
virtual void USO2AO()
Definition: v.cc:164
void set_print(int print)
Definition: v.h:133
std::shared_ptr< BasisSet > primary_
Basis set used in the integration.
Definition: v.h:60
void common_init()
Set things up.
Definition: v.cc:58
virtual void finalize()
Definition: v.cc:394
std::vector< SharedMatrix > & Cavir()
Definition: v.h:125
virtual void print_header() const
Definition: v.cc:1385
std::vector< SharedMatrix > V_AO_
Vector of C1 V matrices (built by USO2AO)
Definition: v.h:76
virtual ~RV()
Definition: v.cc:410
RK(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:1377
Definition: v.h:187
std::vector< SharedMatrix > V_
Vector of V matrices (built by form_D)
Definition: v.h:74
virtual void finalize()
Definition: v.cc:860
virtual void compute_V()
Actually build V_AO.
Definition: v.cc:1406
virtual void compute_D()
Definition: v.cc:89
std::vector< SharedMatrix > & Caocc()
Definition: v.h:124
virtual void compute_V()
Actually build V_AO.
Definition: v.cc:869
virtual void initialize()
Definition: v.cc:366
virtual void print_header() const
Definition: v.cc:865
std::shared_ptr< PointFunctions > properties_
Point function computer (densities, gammas, basis values)
Definition: v.h:64
Definition: v.h:50
std::vector< SharedMatrix > C_AO_
Vector of C1 C matrices (built by USO2AO)
Definition: v.h:83
std::map< std::string, double > quad_values_
Quadrature values obtained during integration.
Definition: v.h:68
Definition: v.h:166
SharedMatrix AO2USO_
AO2USO matrix (if not C1)
Definition: v.h:71
int print_
Print flag.
Definition: v.h:56
std::vector< SharedMatrix > D_AO_
Vector of C1 D matrices (built by USO2AO)
Definition: v.h:85
UV(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:844
virtual ~VBase()
Definition: v.cc:55
virtual void initialize()
Definition: v.cc:413
const std::vector< SharedMatrix > & D() const
Definition: v.h:128
Definition: liboptions.h:359
VBase(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:48
std::shared_ptr< BasisSet > basis() const
Definition: v.h:116
RV(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:405
virtual SharedMatrix compute_gradient()
Throws by default.
Definition: v.cc:603
static std::shared_ptr< VBase > build_V(std::shared_ptr< BasisSet > primary, std::shared_ptr< SuperFunctional > functional, Options &options, const std::string &type="RV")
Definition: v.cc:63
virtual void compute_V()
Actually build V_AO.
Definition: v.cc:1389
virtual ~UV()
Definition: v.cc:849
UK(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:1394
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
virtual void finalize()
Definition: v.cc:421
std::vector< SharedMatrix > Caocc_
Vector of Caocc matrices (TDDFT)
Definition: v.h:88
std::shared_ptr< SuperFunctional > functional() const
Definition: v.h:117
std::vector< SharedMatrix > Cavir_
Vector of Cavir matrices (TDDFT)
Definition: v.h:90
virtual SharedMatrix compute_gradient()
Throws by default.
Definition: v.cc:390
Definition: v.h:145
virtual void AO2USO()
Definition: v.cc:339
std::vector< SharedMatrix > P_AO_
Vector of Perturbation matrices (TDDFT, AO)
Definition: v.h:96
std::vector< SharedMatrix > & C()
Grab this, clear, and push Cocc matrices (with symmetry) to change GS density.
Definition: v.h:123
std::shared_ptr< PointFunctions > properties() const
Definition: v.h:118
std::vector< SharedMatrix > D_
Vector of D matrices (built by form_D)
Definition: v.h:81
virtual void compute()
Definition: v.cc:372
std::shared_ptr< SuperFunctional > functional_
Desired superfunctional kernal.
Definition: v.h:62
const std::vector< SharedMatrix > & V() const
Definition: v.h:127
virtual ~RK()
Definition: v.cc:1382
virtual void initialize()
Definition: v.cc:852
virtual SharedMatrix compute_gradient()
Throws by default.
Definition: v.cc:1088