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 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 LIBFOCK_DFT_H
30 #define LIBFOCK_DFT_H
31 #include "psi4/libmints/typedefs.h"
32 #include <vector>
33 #include <map>
34 
35 namespace psi {
36 class BasisSet;
37 class Options;
38 class DFTGrid;
39 class PointFunctions;
40 class SuperFunctional;
41 class BlockOPoints;
42 
43 // => BASE CLASS <= //
44 
52 class VBase {
53 
54 protected:
56  int debug_;
58  int print_;
62  int nbf_;
70  std::shared_ptr<BasisSet> primary_;
72  std::shared_ptr<SuperFunctional> functional_;
74  std::vector<std::shared_ptr<SuperFunctional>> functional_workers_;
76  std::vector<std::shared_ptr<PointFunctions>> point_workers_;
78  std::shared_ptr<DFTGrid> grid_;
80  std::map<std::string, double> quad_values_;
81 
85 
87  std::vector<SharedMatrix> D_AO_;
88 
89  // GRAC data
91 
92  // VV10 dispersion, return vv10_nlc energy
93  double vv10_nlc(SharedMatrix ret);
94 
96  void common_init();
97 public:
98  VBase(std::shared_ptr<SuperFunctional> functional,
99  std::shared_ptr<BasisSet> primary, Options& options);
100  virtual ~VBase();
101 
102  static std::shared_ptr<VBase> build_V(std::shared_ptr<BasisSet> primary,
103  std::shared_ptr<SuperFunctional> functional,
104  Options& options,
105  const std::string& type = "RV");
106 
107  std::shared_ptr<BasisSet> basis() const { return primary_; }
108  std::shared_ptr<SuperFunctional> functional() const { return functional_; }
109  std::vector<std::shared_ptr<PointFunctions>> properties() const { return point_workers_; }
110  std::shared_ptr<DFTGrid> grid() const { return grid_; }
111  std::shared_ptr<BlockOPoints> get_block(int block);
112  size_t nblocks();
113  std::map<std::string, double>& quadrature_values() { return quad_values_; }
114 
115  // Set the D matrix, get it back if needed
116  void set_D(std::vector<SharedMatrix> Dvec);
117  const std::vector<SharedMatrix>& Dao() const { return D_AO_; }
118 
119  // Set the site of the grac shift
120  void set_grac_shift(double value);
121 
123  virtual void compute_V(std::vector<SharedMatrix> ret);
124  virtual void compute_Vx(std::vector<SharedMatrix> Dx, std::vector<SharedMatrix> ret);
125  virtual SharedMatrix compute_gradient();
126  virtual SharedMatrix compute_hessian();
127 
128  void set_print(int print) { print_ = print; }
129  void set_debug(int debug) { debug_ = debug; }
130 
131  virtual void initialize();
132  virtual void finalize();
133 
134  virtual void print_header() const;
135 };
136 
137 // => APPLIED CLASSES <= //
138 
139 class RV : public VBase {
140 
141 protected:
142 
143 public:
144  RV(std::shared_ptr<SuperFunctional> functional,
145  std::shared_ptr<BasisSet> primary,
146  Options& options);
147  virtual ~RV();
148 
149  virtual void initialize();
150  virtual void finalize();
151 
152  virtual void compute_V(std::vector<SharedMatrix> ret);
153  virtual void compute_Vx(std::vector<SharedMatrix> Dx, std::vector<SharedMatrix> ret);
154  virtual SharedMatrix compute_gradient();
155  virtual SharedMatrix compute_hessian();
156 
157  virtual void print_header() const;
158 };
159 
160 class UV : public VBase {
161 
162 protected:
163 
164 public:
165  UV(std::shared_ptr<SuperFunctional> functional,
166  std::shared_ptr<BasisSet> primary,
167  Options& options);
168  virtual ~UV();
169 
170  virtual void initialize();
171  virtual void finalize();
172 
173  virtual void compute_V(std::vector<SharedMatrix> ret);
174  virtual void compute_Vx(std::vector<SharedMatrix> Dx, std::vector<SharedMatrix> ret);
175  virtual SharedMatrix compute_gradient();
176 
177  virtual void print_header() const;
178 };
179 
180 
181 }
182 #endif
void set_debug(int debug)
Definition: v.h:129
virtual void print_header() const
Definition: v.cc:415
std::shared_ptr< DFTGrid > grid_
Integration grid, built by KSPotential.
Definition: v.h:78
std::vector< std::shared_ptr< PointFunctions > > properties() const
Definition: v.h:109
void set_grac_shift(double value)
Definition: v.cc:156
int debug_
Debug flag.
Definition: v.h:56
std::map< std::string, double > & quadrature_values()
Definition: v.h:113
double vv10_rho_cutoff_
VV10 interior kernel threshold.
Definition: v.h:66
virtual void compute_Vx(std::vector< SharedMatrix > Dx, std::vector< SharedMatrix > ret)
Definition: v.cc:637
std::shared_ptr< DFTGrid > grid() const
Definition: v.h:110
Options & options_
Options object, used to build grid.
Definition: v.h:68
void set_D(std::vector< SharedMatrix > Dvec)
Definition: v.cc:97
double v2_rho_cutoff_
Rho threshold for the second derivative;.
Definition: v.h:64
virtual void compute_Vx(std::vector< SharedMatrix > Dx, std::vector< SharedMatrix > ret)
Definition: v.cc:1697
virtual void print_header() const
Definition: v.cc:204
virtual void compute_V(std::vector< SharedMatrix > ret)
Throws by default.
Definition: v.cc:416
virtual void compute_V(std::vector< SharedMatrix > ret)
Throws by default.
Definition: v.cc:1439
virtual void compute_V(std::vector< SharedMatrix > ret)
Throws by default.
Definition: v.cc:150
void set_print(int print)
Definition: v.h:128
std::shared_ptr< BasisSet > primary_
Basis set used in the integration.
Definition: v.h:70
std::vector< std::shared_ptr< SuperFunctional > > functional_workers_
Desired superfunctional kernal.
Definition: v.h:74
virtual SharedMatrix compute_hessian()
Definition: v.cc:147
void common_init()
Set things up.
Definition: v.cc:65
virtual void finalize()
Definition: v.cc:211
size_t nblocks()
Definition: v.cc:210
virtual ~RV()
Definition: v.cc:402
SharedMatrix USO2AO_
Definition: v.h:84
std::shared_ptr< BlockOPoints > get_block(int block)
Definition: v.cc:209
virtual void finalize()
Definition: v.cc:1431
virtual void initialize()
Definition: v.cc:134
virtual void print_header() const
Definition: v.cc:1435
Definition: v.h:52
bool grac_initialized_
Definition: v.h:90
std::map< std::string, double > quad_values_
Quadrature values obtained during integration.
Definition: v.h:80
double vv10_nlc(SharedMatrix ret)
Definition: v.cc:213
Definition: v.h:160
SharedMatrix AO2USO_
AO2USO matrix (if not C1)
Definition: v.h:83
int print_
Print flag.
Definition: v.h:58
std::vector< SharedMatrix > D_AO_
Vector of C1 D matrices (built by USO2AO)
Definition: v.h:87
UV(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:1415
virtual ~VBase()
Definition: v.cc:64
virtual void initialize()
Definition: v.cc:403
Definition: liboptions.h:355
VBase(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:59
std::shared_ptr< BasisSet > basis() const
Definition: v.h:107
RV(std::shared_ptr< SuperFunctional > functional, std::shared_ptr< BasisSet > primary, Options &options)
Definition: v.cc:399
virtual SharedMatrix compute_gradient()
Definition: v.cc:887
int num_threads_
Number of threads.
Definition: v.h:60
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:76
virtual ~UV()
Definition: v.cc:1418
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
int nbf_
Number of basis functions;.
Definition: v.h:62
virtual void finalize()
Definition: v.cc:414
std::shared_ptr< SuperFunctional > functional() const
Definition: v.h:108
virtual SharedMatrix compute_gradient()
Definition: v.cc:144
Definition: v.h:139
std::vector< std::shared_ptr< PointFunctions > > point_workers_
Point function computer (densities, gammas, basis values)
Definition: v.h:76
const std::vector< SharedMatrix > & Dao() const
Definition: v.h:117
std::shared_ptr< SuperFunctional > functional_
Desired superfunctional kernal.
Definition: v.h:72
virtual void compute_Vx(std::vector< SharedMatrix > Dx, std::vector< SharedMatrix > ret)
Definition: v.cc:153
virtual void initialize()
Definition: v.cc:1419
virtual SharedMatrix compute_gradient()
Definition: v.cc:2167
virtual SharedMatrix compute_hessian()
Definition: v.cc:1154