Psi4
points.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_points_H
30 #define libfock_points_H
31 
32 #include <cstdio>
33 #include <map>
34 #include <tuple>
35 
36 #include "psi4/libmints/typedefs.h"
37 
38 namespace psi {
39 
40 class BasisSet;
41 class Vector;
42 class BlockOPoints;
43 
44 
46 
47 protected:
49  std::shared_ptr<BasisSet> primary_;
51  bool puream_;
57  int deriv_;
59  std::map<std::string, SharedMatrix > basis_values_;
61  std::map<std::string, SharedMatrix > basis_temps_;
63  std::vector<std::vector<std::tuple<int,int,double> > > spherical_transforms_;
64 
66  void build_spherical();
68  virtual void allocate();
69 
70 public:
71  // => Constructors <= //
72 
73  BasisFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
74  virtual ~BasisFunctions();
75 
76  // => Computers <= //
77 
78  void compute_functions(std::shared_ptr<BlockOPoints> block);
79 
80  // => Accessors <= //
81 
82  SharedMatrix basis_value(const std::string& key);
83  std::map<std::string, SharedMatrix>& basis_values() { return basis_values_; }
84 
85  int max_functions() const { return max_functions_; }
86  int max_points() const { return max_points_; }
87  int deriv() const { return deriv_; }
88 
89  virtual void print(std::string OutFileRMR = "outfile", int print = 2) const;
90 
91  // => Setters <= //
92 
93  void set_deriv(int deriv) { deriv_ = deriv; allocate(); }
96 };
97 
99 
100 protected:
102  int ansatz_;
104  std::map<std::string, std::shared_ptr<Vector> > point_values_;
105 
106  // => Orbital Collocation <= //
107 
109  std::map<std::string, std::shared_ptr<Matrix> > orbital_values_;
110 
111 public:
112  // => Constructors <= //
113 
114  PointFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
115  virtual ~PointFunctions();
116 
117  // => Computers <= //
118 
119  virtual void compute_points(std::shared_ptr<BlockOPoints> block) = 0;
120 
121  // => Accessors <= //
122 
123  std::shared_ptr<Vector> point_value(const std::string& key);
124  std::map<std::string, SharedVector>& point_values() { return point_values_; }
125 
126  virtual std::vector<SharedMatrix> scratch() = 0;
127  virtual std::vector<SharedMatrix> D_scratch() = 0;
128 
129  int ansatz() const { return ansatz_; }
130 
131  // => Setters <= //
132 
134  virtual void set_pointers(SharedMatrix Da_occ_AO) = 0;
135  virtual void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO) = 0;
136 
137  // => Orbital Collocation <= //
138 
139  std::shared_ptr<Matrix> orbital_value(const std::string& key);
140  std::map<std::string, SharedMatrix>& orbital_values() { return orbital_values_; }
141 
142  virtual void compute_orbitals(std::shared_ptr<BlockOPoints> block) = 0;
143  virtual void set_Cs(SharedMatrix Cocc) = 0;
144  virtual void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc) = 0;
145 };
146 
147 class RKSFunctions : public PointFunctions {
148 
149 protected:
150  // => Pointers <= //
151 
154 
155  // => Temps <= //
156 
161 
163  void build_temps();
165  void allocate();
166 
167  // => Orbital Collocation <= //
168 
173 
174 public:
175  RKSFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
176  virtual ~RKSFunctions();
177 
178  void set_pointers(SharedMatrix Da_occ_AO);
179  void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO);
180 
181  void compute_points(std::shared_ptr<BlockOPoints> block);
182 
183  std::vector<SharedMatrix> scratch();
184  std::vector<SharedMatrix> D_scratch();
185 
186  void print(std::string OutFileRMR = "outfile", int print = 2) const;
187 
188  void compute_orbitals(std::shared_ptr<BlockOPoints> block);
189  void set_Cs(SharedMatrix Cocc);
190  void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc);
191 };
192 
193 class UKSFunctions : public PointFunctions {
194 
195 protected:
196  // => Pointers <= //
197 
202 
203  // => Temps <= //
204 
213 
215  void build_temps();
217  void allocate();
218 
219  // => Orbital Collocation <= //
220 
229 
230 public:
231  UKSFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
232  virtual ~UKSFunctions();
233 
234  void set_pointers(SharedMatrix Da_occ_AO);
235  void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO);
236 
237  void compute_points(std::shared_ptr<BlockOPoints> block);
238 
239  std::vector<SharedMatrix> scratch();
240  std::vector<SharedMatrix> D_scratch();
241 
242  void print(std::string OutFileRMR = "outfile", int print = 2) const;
243 
244  void compute_orbitals(std::shared_ptr<BlockOPoints> block);
245  void set_Cs(SharedMatrix Cocc);
246  void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc);
247 };
248 
249 
250 }
251 #endif
void set_Cs(SharedMatrix Cocc)
Definition: points.cc:521
std::map< std::string, SharedMatrix > basis_values_
Map of value names to Matrices containing values.
Definition: points.h:59
SharedMatrix D_local_
Local D matrix.
Definition: points.h:160
void set_pointers(SharedMatrix Da_occ_AO)
Definition: points.cc:377
std::map< std::string, SharedMatrix > & basis_values()
Definition: points.h:83
virtual void allocate()
Allocate registers.
Definition: points.cc:657
Definition: points.h:98
std::vector< std::vector< std::tuple< int, int, double > > > spherical_transforms_
[L]: pure_index, cart_index, coef
Definition: points.h:63
int max_functions_
Maximum number of functions in a block.
Definition: points.h:55
void compute_points(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:386
std::map< std::string, SharedVector > & point_values()
Definition: points.h:124
SharedMatrix Cb_AO_
Orbital coefficients, AO.
Definition: points.h:224
void compute_orbitals(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:259
SharedMatrix basis_value(const std::string &key)
Definition: points.cc:697
virtual ~RKSFunctions()
Definition: points.cc:48
SharedMatrix tempa_
Buffer for half-transform.
Definition: points.h:206
void build_spherical()
Setup spherical_transforms_.
Definition: points.cc:635
std::map< std::string, SharedMatrix > basis_temps_
Map of temp names to Matrices containing temps.
Definition: points.h:61
virtual std::vector< SharedMatrix > scratch()=0
int ansatz() const
Definition: points.h:129
void set_max_functions(int max_functions)
Definition: points.h:94
void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:580
virtual void set_Cs(SharedMatrix Cocc)=0
void compute_orbitals(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:534
std::shared_ptr< BasisSet > primary_
Basis set for this BasisFunctions.
Definition: points.h:49
virtual ~BasisFunctions()
Definition: points.cc:632
SharedMatrix Db_AO_
Density matrix, AO.
Definition: points.h:201
void set_pointers(SharedMatrix Da_occ_AO)
Definition: points.cc:102
void set_Cs(SharedMatrix Cocc)
Definition: points.cc:249
virtual std::vector< SharedMatrix > D_scratch()=0
virtual void compute_orbitals(std::shared_ptr< BlockOPoints > block)=0
SharedMatrix Ca_AO_
Orbital coefficients, AO.
Definition: points.h:222
int ansatz_
Ansatz (0 - LSDA, 1 - GGA, 2 - Meta-GGA)
Definition: points.h:102
SharedMatrix C_AO_
Orbital coefficients, AO.
Definition: points.h:170
SharedMatrix Db_local_
Local D matrix.
Definition: points.h:212
std::vector< SharedMatrix > D_scratch()
Definition: points.cc:334
SharedMatrix Cb_local_
Orbital coefficeints, local AO.
Definition: points.h:228
Definition: points.h:147
BasisFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:626
virtual void set_pointers(SharedMatrix Da_occ_AO)=0
int deriv_
Maximum derivative to compute.
Definition: points.h:57
SharedMatrix Ca_local_
Orbital coefficeints, local AO.
Definition: points.h:226
std::vector< SharedMatrix > scratch()
Definition: points.cc:51
virtual ~PointFunctions()
Definition: points.cc:613
SharedMatrix tempb_
Buffer for half-transform.
Definition: points.h:208
PointFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:608
virtual ~UKSFunctions()
Definition: points.cc:324
bool puream_
Pure AM or not.
Definition: points.h:51
virtual void compute_points(std::shared_ptr< BlockOPoints > block)=0
SharedMatrix D_AO_
Density matrix, AO.
Definition: points.h:153
RKSFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:43
std::map< std::string, SharedMatrix > & orbital_values()
Definition: points.h:140
Definition: points.h:45
void build_temps()
Build temporary work arrays.
Definition: points.cc:63
Definition: points.h:193
void set_max_points(int max_points)
Definition: points.h:95
void set_deriv(int deriv)
Definition: points.h:93
UKSFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:319
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:292
int deriv() const
Definition: points.h:87
int max_functions() const
Definition: points.h:85
void allocate()
Allocate registers.
Definition: points.cc:348
std::map< std::string, std::shared_ptr< Matrix > > orbital_values_
Map of value names to Matrices containing values.
Definition: points.h:109
SharedMatrix C_local_
Orbital coefficeints, local AO.
Definition: points.h:172
SharedMatrix temp_
Buffer for half-transform.
Definition: points.h:158
std::shared_ptr< Vector > point_value(const std::string &key)
Definition: points.cc:616
SharedMatrix Da_AO_
Density matrix, AO.
Definition: points.h:199
std::map< std::string, std::shared_ptr< Vector > > point_values_
Map of value names to Vectors containing values.
Definition: points.h:104
std::vector< SharedMatrix > D_scratch()
Definition: points.cc:57
int max_points() const
Definition: points.h:86
void set_ansatz(int ansatz)
Definition: points.h:133
std::shared_ptr< Matrix > orbital_value(const std::string &key)
Definition: points.cc:621
std::vector< SharedMatrix > scratch()
Definition: points.cc:327
SharedMatrix Da_local_
Local D matrix.
Definition: points.h:210
void compute_points(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:110
void compute_functions(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:701
int max_points_
Maximum number of points in a block.
Definition: points.h:53
void allocate()
Allocate registers.
Definition: points.cc:68
void build_temps()
Build temporary work arrays.
Definition: points.cc:341
virtual void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:1097