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 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_points_H
29 #define libfock_points_H
30 
31 #include <cstdio>
32 #include <map>
33 #include <tuple>
34 
35 #include "psi4/libmints/typedefs.h"
36 
37 namespace psi {
38 
39 class PSIO;
40 class BasisSet;
41 class Matrix;
42 class Vector;
43 class IntVector;
44 class Vector3;
45 class BlockOPoints;
46 
47 
49 
50 protected:
52  std::shared_ptr<BasisSet> primary_;
54  bool puream_;
60  int deriv_;
62  std::map<std::string, SharedMatrix > basis_values_;
64  std::map<std::string, SharedMatrix > basis_temps_;
66  std::vector<std::vector<std::tuple<int,int,double> > > spherical_transforms_;
67 
69  void build_spherical();
71  virtual void allocate();
72 
73 public:
74  // => Constructors <= //
75 
76  BasisFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
77  virtual ~BasisFunctions();
78 
79  // => Computers <= //
80 
81  void compute_functions(std::shared_ptr<BlockOPoints> block);
82 
83  // => Accessors <= //
84 
85  SharedMatrix basis_value(const std::string& key);
86  std::map<std::string, SharedMatrix>& basis_values() { return basis_values_; }
87 
88  int max_functions() const { return max_functions_; }
89  int max_points() const { return max_points_; }
90  int deriv() const { return deriv_; }
91 
92  virtual void print(std::string OutFileRMR = "outfile", int print = 2) const;
93 
94  // => Setters <= //
95 
96  void set_deriv(int deriv) { deriv_ = deriv; allocate(); }
99 };
100 
102 
103 protected:
105  int ansatz_;
107  std::map<std::string, std::shared_ptr<Vector> > point_values_;
108 
109  // => Orbital Collocation <= //
110 
112  std::map<std::string, std::shared_ptr<Matrix> > orbital_values_;
113 
114 public:
115  // => Constructors <= //
116 
117  PointFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
118  virtual ~PointFunctions();
119 
120  // => Computers <= //
121 
122  virtual void compute_points(std::shared_ptr<BlockOPoints> block) = 0;
123 
124  // => Accessors <= //
125 
126  std::shared_ptr<Vector> point_value(const std::string& key);
127  std::map<std::string, SharedVector>& point_values() { return point_values_; }
128 
129  virtual std::vector<SharedMatrix> scratch() = 0;
130  virtual std::vector<SharedMatrix> D_scratch() = 0;
131 
132  int ansatz() const { return ansatz_; }
133 
134  // => Setters <= //
135 
137  virtual void set_pointers(SharedMatrix Da_occ_AO) = 0;
138  virtual void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO) = 0;
139 
140  // => Orbital Collocation <= //
141 
142  std::shared_ptr<Matrix> orbital_value(const std::string& key);
143  std::map<std::string, SharedMatrix>& orbital_values() { return orbital_values_; }
144 
145  virtual void compute_orbitals(std::shared_ptr<BlockOPoints> block) = 0;
146  virtual void set_Cs(SharedMatrix Cocc) = 0;
147  virtual void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc) = 0;
148 };
149 
150 class RKSFunctions : public PointFunctions {
151 
152 protected:
153  // => Pointers <= //
154 
157 
158  // => Temps <= //
159 
164 
166  void build_temps();
168  void allocate();
169 
170  // => Orbital Collocation <= //
171 
176 
177 public:
178  RKSFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
179  virtual ~RKSFunctions();
180 
181  void set_pointers(SharedMatrix Da_occ_AO);
182  void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO);
183 
184  void compute_points(std::shared_ptr<BlockOPoints> block);
185 
186  std::vector<SharedMatrix> scratch();
187  std::vector<SharedMatrix> D_scratch();
188 
189  void print(std::string OutFileRMR = "outfile", int print = 2) const;
190 
191  void compute_orbitals(std::shared_ptr<BlockOPoints> block);
192  void set_Cs(SharedMatrix Cocc);
193  void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc);
194 };
195 
196 class UKSFunctions : public PointFunctions {
197 
198 protected:
199  // => Pointers <= //
200 
205 
206  // => Temps <= //
207 
216 
218  void build_temps();
220  void allocate();
221 
222  // => Orbital Collocation <= //
223 
232 
233 public:
234  UKSFunctions(std::shared_ptr<BasisSet> primary, int max_points, int max_functions);
235  virtual ~UKSFunctions();
236 
237  void set_pointers(SharedMatrix Da_occ_AO);
238  void set_pointers(SharedMatrix Da_occ_AO, SharedMatrix Db_occ_AO);
239 
240  void compute_points(std::shared_ptr<BlockOPoints> block);
241 
242  std::vector<SharedMatrix> scratch();
243  std::vector<SharedMatrix> D_scratch();
244 
245  void print(std::string OutFileRMR = "outfile", int print = 2) const;
246 
247  void compute_orbitals(std::shared_ptr<BlockOPoints> block);
248  void set_Cs(SharedMatrix Cocc);
249  void set_Cs(SharedMatrix Caocc, SharedMatrix Cbocc);
250 };
251 
252 
253 }
254 #endif
void set_Cs(SharedMatrix Cocc)
Definition: points.cc:466
std::map< std::string, SharedMatrix > basis_values_
Map of value names to Matrices containing values.
Definition: points.h:62
SharedMatrix D_local_
Local D matrix.
Definition: points.h:163
void set_pointers(SharedMatrix Da_occ_AO)
Definition: points.cc:323
std::map< std::string, SharedMatrix > & basis_values()
Definition: points.h:86
virtual void allocate()
Allocate registers.
Definition: points.cc:601
Definition: points.h:101
std::vector< std::vector< std::tuple< int, int, double > > > spherical_transforms_
[L]: pure_index, cart_index, coef
Definition: points.h:66
int max_functions_
Maximum number of functions in a block.
Definition: points.h:58
void compute_points(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:333
std::map< std::string, SharedVector > & point_values()
Definition: points.h:127
SharedMatrix Cb_AO_
Orbital coefficients, AO.
Definition: points.h:227
void compute_orbitals(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:204
SharedMatrix basis_value(const std::string &key)
Definition: points.cc:641
virtual ~RKSFunctions()
Definition: points.cc:47
SharedMatrix tempa_
Buffer for half-transform.
Definition: points.h:209
void build_spherical()
Setup spherical_transforms_.
Definition: points.cc:578
std::map< std::string, SharedMatrix > basis_temps_
Map of temp names to Matrices containing temps.
Definition: points.h:64
virtual std::vector< SharedMatrix > scratch()=0
int ansatz() const
Definition: points.h:132
void set_max_functions(int max_functions)
Definition: points.h:97
void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:523
virtual void set_Cs(SharedMatrix Cocc)=0
void compute_orbitals(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:479
std::shared_ptr< BasisSet > primary_
Basis set for this BasisFunctions.
Definition: points.h:52
virtual ~BasisFunctions()
Definition: points.cc:575
SharedMatrix Db_AO_
Density matrix, AO.
Definition: points.h:204
void set_pointers(SharedMatrix Da_occ_AO)
Definition: points.cc:95
void set_Cs(SharedMatrix Cocc)
Definition: points.cc:193
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:225
int ansatz_
Ansatz (0 - LSDA, 1 - GGA, 2 - Meta-GGA)
Definition: points.h:105
SharedMatrix C_AO_
Orbital coefficients, AO.
Definition: points.h:173
SharedMatrix Db_local_
Local D matrix.
Definition: points.h:215
std::vector< SharedMatrix > D_scratch()
Definition: points.cc:281
SharedMatrix Cb_local_
Orbital coefficeints, local AO.
Definition: points.h:231
Definition: points.h:150
BasisFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:569
virtual void set_pointers(SharedMatrix Da_occ_AO)=0
int deriv_
Maximum derivative to compute.
Definition: points.h:60
SharedMatrix Ca_local_
Orbital coefficeints, local AO.
Definition: points.h:229
std::vector< SharedMatrix > scratch()
Definition: points.cc:50
virtual ~PointFunctions()
Definition: points.cc:556
SharedMatrix tempb_
Buffer for half-transform.
Definition: points.h:211
PointFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:551
virtual ~UKSFunctions()
Definition: points.cc:271
bool puream_
Pure AM or not.
Definition: points.h:54
virtual void compute_points(std::shared_ptr< BlockOPoints > block)=0
SharedMatrix D_AO_
Density matrix, AO.
Definition: points.h:156
RKSFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:42
std::map< std::string, SharedMatrix > & orbital_values()
Definition: points.h:143
Definition: points.h:48
void build_temps()
Build temporary work arrays.
Definition: points.cc:62
Definition: points.h:196
void set_max_points(int max_points)
Definition: points.h:98
void set_deriv(int deriv)
Definition: points.h:96
UKSFunctions(std::shared_ptr< BasisSet > primary, int max_points, int max_functions)
Definition: points.cc:266
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:238
int deriv() const
Definition: points.h:90
int max_functions() const
Definition: points.h:88
void allocate()
Allocate registers.
Definition: points.cc:295
std::map< std::string, std::shared_ptr< Matrix > > orbital_values_
Map of value names to Matrices containing values.
Definition: points.h:112
SharedMatrix C_local_
Orbital coefficeints, local AO.
Definition: points.h:175
SharedMatrix temp_
Buffer for half-transform.
Definition: points.h:161
std::shared_ptr< Vector > point_value(const std::string &key)
Definition: points.cc:559
SharedMatrix Da_AO_
Density matrix, AO.
Definition: points.h:202
std::map< std::string, std::shared_ptr< Vector > > point_values_
Map of value names to Vectors containing values.
Definition: points.h:107
std::vector< SharedMatrix > D_scratch()
Definition: points.cc:56
int max_points() const
Definition: points.h:89
void set_ansatz(int ansatz)
Definition: points.h:136
std::shared_ptr< Matrix > orbital_value(const std::string &key)
Definition: points.cc:564
std::vector< SharedMatrix > scratch()
Definition: points.cc:274
SharedMatrix Da_local_
Local D matrix.
Definition: points.h:213
void compute_points(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:104
void compute_functions(std::shared_ptr< BlockOPoints > block)
Definition: points.cc:645
int max_points_
Maximum number of points in a block.
Definition: points.h:56
void allocate()
Allocate registers.
Definition: points.cc:67
void build_temps()
Build temporary work arrays.
Definition: points.cc:288
virtual void print(std::string OutFileRMR="outfile", int print=2) const
Definition: points.cc:1016