Psi4
dftensor.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 three_index_df_H
29 #define three_index_df_H
30 
31 namespace psi {
32 
33 class PSIO;
34 class BasisSet;
35 class Matrix;
36 class Vector;
37 class Molecule;
38 class IntVector;
39 class Vector3;
40 
42 
43 protected:
45  std::shared_ptr<BasisSet> aux_;
47  std::shared_ptr<BasisSet> pois_;
51  bool force_C1_;
53  double omega_;
54 
58  std::shared_ptr<IntVector> pivots_;
60  std::shared_ptr<IntVector> rev_pivots_;
61 
63  std::string algorithm_;
66 
68  void pivot();
69 
70 public:
71 
73  FittingMetric(std::shared_ptr<BasisSet> aux, bool force_C1 = false);
75  FittingMetric(std::shared_ptr<BasisSet> aux, double omega, bool force_C1 = false);
77  FittingMetric(std::shared_ptr<BasisSet> aux, std::shared_ptr<BasisSet> pois, bool force_C1 = false);
78 
81 
83  std::string get_algorithm() const {return algorithm_; }
85  bool is_poisson() const {return is_poisson_; }
87  bool is_inverted() const {return is_inverted_; }
88 
90  SharedMatrix get_metric() const {return metric_; }
92  std::shared_ptr<IntVector> get_pivots() const {return pivots_; }
94  std::shared_ptr<IntVector> get_reverse_pivots() const {return rev_pivots_; }
95 
97  std::shared_ptr<BasisSet> get_auxiliary_basis() const {return aux_; }
99  std::shared_ptr<BasisSet> get_poisson_basis() const {return pois_; }
100 
102  void form_fitting_metric();
104  void form_cholesky_inverse();
106  void form_QR_inverse(double tol = 1.0E-10);
108  void form_eig_inverse(double tol = 1.0E-10);
110  void form_full_inverse();
112  void form_full_eig_inverse(double tol = 1.0E-10);
114  void form_cholesky_factor();
115 };
116 
117 class DFTensor {
118 
119 protected:
120 
122  int debug_;
124  int print_;
125 
127  std::shared_ptr<Molecule> molecule_;
129  std::shared_ptr<BasisSet> primary_;
131  std::shared_ptr<BasisSet> auxiliary_;
134 
137 
144 
146  int nso_;
148  int nmo_;
149 
151  int naux_;
152 
154  int nfocc_;
156  int nocc_;
158  int naocc_;
160  int nfvir_;
162  int nvir_;
164  int navir_;
165 
166  void common_init();
167  void build_metric();
168  void print_header();
169 
170 public:
171 
172  DFTensor(std::shared_ptr<BasisSet> primary,
173  std::shared_ptr<BasisSet> auxiliary,
174  SharedMatrix C,
175  int nocc,
176  int nvir,
177  int naocc,
178  int navir,
179  Options& options);
180 
184  DFTensor(std::shared_ptr<BasisSet> primary,
185  std::shared_ptr<BasisSet> auxiliary,
186  SharedMatrix C,
187  int nocc,
188  int nvir);
189  ~DFTensor();
190 
191  SharedMatrix Qso();
192  SharedMatrix Qmo();
193  SharedMatrix Qoo();
194  SharedMatrix Qov();
195  SharedMatrix Qvv();
196 
197  SharedMatrix Imo();
199 };
200 
201 }
202 #endif
int nso_
Number of AO primary functions.
Definition: dftensor.h:146
int nocc_
Total number of occupieds.
Definition: dftensor.h:156
std::shared_ptr< BasisSet > get_poisson_basis() const
The poisson fitting basis.
Definition: dftensor.h:99
void form_QR_inverse(double tol=1.0E-10)
Build the QR half inverse metric (calls form_fitting_metric)
Definition: fittingmetric.cc:357
void form_cholesky_inverse()
Build the Cholesky half inverse metric (calls form_fitting_metric)
Definition: fittingmetric.cc:336
std::shared_ptr< IntVector > rev_pivots_
The indices (per irrep) of reverse pivots.
Definition: dftensor.h:60
SharedMatrix C_
Full C matrix (must provide orthonormal MO basis)
Definition: dftensor.h:139
int nvir_
Total number of virtuals.
Definition: dftensor.h:162
~DFTensor()
Definition: dftensor.cc:76
bool is_inverted() const
Is the metric inverted?
Definition: dftensor.h:87
bool is_poisson() const
Are poisson functions used?
Definition: dftensor.h:85
SharedMatrix get_metric() const
The fitting metric or symmetric inverse.
Definition: dftensor.h:90
std::shared_ptr< IntVector > pivots_
The indices (per irrep) of pivots.
Definition: dftensor.h:58
DFTensor(std::shared_ptr< BasisSet > primary, std::shared_ptr< BasisSet > auxiliary, SharedMatrix C, int nocc, int nvir, int naocc, int navir, Options &options)
Definition: dftensor.cc:53
int naocc_
Number of active occupieds.
Definition: dftensor.h:158
void print_header()
Definition: dftensor.cc:116
bool is_inverted_
Is the metric inverted or just a J matrix?
Definition: dftensor.h:65
std::shared_ptr< BasisSet > aux_
Pointer to the auxiliary basis set.
Definition: dftensor.h:45
SharedMatrix Qvv()
Definition: dftensor.cc:256
SharedMatrix Idfmo()
Definition: dftensor.cc:325
SharedMatrix Qov()
Definition: dftensor.cc:221
int nfvir_
Number of frozen virtuals.
Definition: dftensor.h:160
int print_
Print level.
Definition: dftensor.h:124
std::string algorithm_
The fitting algorithm selected.
Definition: dftensor.h:63
int nfocc_
Number of frozen occupieds.
Definition: dftensor.h:154
void form_fitting_metric()
Build the raw fitting metric (sets up indices to canonical)
Definition: fittingmetric.cc:81
int nmo_
Number of MO primary functions.
Definition: dftensor.h:148
void form_full_eig_inverse(double tol=1.0E-10)
Build the full inverse metric.
Definition: fittingmetric.cc:500
std::shared_ptr< BasisSet > primary_
Primary basis set.
Definition: dftensor.h:129
SharedMatrix Imo()
Definition: dftensor.cc:320
void common_init()
Definition: dftensor.cc:79
std::shared_ptr< IntVector > get_reverse_pivots() const
The vector of back pivots (for stability) (global-&gt;pivoted)
Definition: dftensor.h:94
SharedMatrix metric_
The fitting metric or symmetric inverse.
Definition: dftensor.h:56
std::shared_ptr< BasisSet > pois_
Pointer to the poisson basis set.
Definition: dftensor.h:47
std::string get_algorithm() const
What algorithm to use for symmetric inverse?
Definition: dftensor.h:83
double omega_
Range separation omega (0.0 if not used)
Definition: dftensor.h:53
std::shared_ptr< BasisSet > get_auxiliary_basis() const
The gaussian fitting basis.
Definition: dftensor.h:97
Definition: liboptions.h:359
void form_full_inverse()
Build the full inverse metric. NOT RECOMMENDED: Numerical stability (calls form_fitting_metric) ...
Definition: fittingmetric.cc:555
Definition: dftensor.h:41
SharedMatrix Qmo()
Definition: dftensor.cc:288
std::shared_ptr< Molecule > molecule_
Molecule (fo convenience)
Definition: dftensor.h:127
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:50
void form_cholesky_factor()
Build the full metric&#39;s Cholesky factor. RECOMMENDED: Numerical stability.
Definition: fittingmetric.cc:579
SharedMatrix metric_
Symmetric inverse fitting metric.
Definition: dftensor.h:136
int navir_
Number of active virtuals.
Definition: dftensor.h:164
void form_eig_inverse(double tol=1.0E-10)
Build the eigendecomposed half inverse metric (calls form_fitting_metric)
Definition: fittingmetric.cc:445
std::shared_ptr< IntVector > get_pivots() const
The vector of pivots (for stability) (pivoted-&gt;global)
Definition: dftensor.h:92
FittingMetric(std::shared_ptr< BasisSet > aux, bool force_C1=false)
DF Fitting Metric.
Definition: fittingmetric.cc:64
SharedMatrix Qso()
Definition: dftensor.cc:138
Definition: pointgrp.h:105
~FittingMetric()
Destructor.
Definition: fittingmetric.cc:77
SharedMatrix Cavir_
Active virtual C Matrix (for convenience)
Definition: dftensor.h:143
Options & options_
options reference
Definition: dftensor.h:133
int naux_
Number of grid points.
Definition: dftensor.h:151
void build_metric()
Definition: dftensor.cc:128
SharedMatrix Caocc_
Active occupied C Matrix (for convenience)
Definition: dftensor.h:141
bool is_poisson_
Is the metric poisson?
Definition: dftensor.h:49
Definition: dftensor.h:117
std::shared_ptr< BasisSet > auxiliary_
Dealias basis set.
Definition: dftensor.h:131
SharedMatrix Qoo()
Definition: dftensor.cc:189
bool force_C1_
Should we force C1?
Definition: dftensor.h:51
void pivot()
Fully pivot the fitting metric.
Definition: fittingmetric.cc:597
int debug_
Debug level.
Definition: dftensor.h:122