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-2018 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 three_index_df_H
30 #define three_index_df_H
31 
32 #include "psi4/libmints/typedefs.h"
33 #include "psi4/pragma.h"
34 
35 #include <string>
36 
37 namespace psi {
38 
39 class PSIO;
40 class BasisSet;
41 class IntVector;
42 class Vector3;
43 class Options;
44 
46 
47 protected:
49  std::shared_ptr<BasisSet> aux_;
51  std::shared_ptr<BasisSet> pois_;
55  bool force_C1_;
57  double omega_;
58 
62  std::shared_ptr<IntVector> pivots_;
64  std::shared_ptr<IntVector> rev_pivots_;
65 
67  std::string algorithm_;
70 
72  void pivot();
73 
74 public:
75 
77  FittingMetric(std::shared_ptr<BasisSet> aux, bool force_C1 = false);
79  FittingMetric(std::shared_ptr<BasisSet> aux, double omega, bool force_C1 = false);
81  FittingMetric(std::shared_ptr<BasisSet> aux, std::shared_ptr<BasisSet> pois, bool force_C1 = false);
82 
85 
87  std::string get_algorithm() const {return algorithm_; }
89  bool is_poisson() const {return is_poisson_; }
91  bool is_inverted() const {return is_inverted_; }
92 
94  SharedMatrix get_metric() const {return metric_; }
96  std::shared_ptr<IntVector> get_pivots() const {return pivots_; }
98  std::shared_ptr<IntVector> get_reverse_pivots() const {return rev_pivots_; }
99 
101  std::shared_ptr<BasisSet> get_auxiliary_basis() const {return aux_; }
103  std::shared_ptr<BasisSet> get_poisson_basis() const {return pois_; }
104 
106  void form_fitting_metric();
108  void form_cholesky_inverse();
110  void form_QR_inverse(double tol = 1.0E-10);
112  void form_eig_inverse(double tol = 1.0E-10);
114  void form_full_inverse();
116  void form_full_eig_inverse(double tol = 1.0E-10);
118  void form_cholesky_factor();
119 };
120 
122 
123 protected:
124 
126  int debug_;
128  int print_;
129 
131  std::shared_ptr<Molecule> molecule_;
133  std::shared_ptr<BasisSet> primary_;
135  std::shared_ptr<BasisSet> auxiliary_;
138 
141 
148 
150  int nso_;
152  int nmo_;
153 
155  int naux_;
156 
158  int nfocc_;
160  int nocc_;
162  int naocc_;
164  int nfvir_;
166  int nvir_;
168  int navir_;
169 
170  void common_init();
171  void build_metric();
172  void print_header();
173 
174 public:
175 
176  DFTensor(std::shared_ptr<BasisSet> primary,
177  std::shared_ptr<BasisSet> auxiliary,
178  SharedMatrix C,
179  int nocc,
180  int nvir,
181  int naocc,
182  int navir,
183  Options& options);
184 
188  DFTensor(std::shared_ptr<BasisSet> primary,
189  std::shared_ptr<BasisSet> auxiliary,
190  SharedMatrix C,
191  int nocc,
192  int nvir);
193  ~DFTensor();
194 
195  SharedMatrix Qso();
196  SharedMatrix Qmo();
197  SharedMatrix Qoo();
198  SharedMatrix Qov();
199  SharedMatrix Qvv();
200 
201  SharedMatrix Imo();
202  SharedMatrix Idfmo();
203 };
204 
205 }
206 #endif
int nso_
Number of AO primary functions.
Definition: dftensor.h:150
int nocc_
Total number of occupieds.
Definition: dftensor.h:160
std::shared_ptr< BasisSet > get_poisson_basis() const
The poisson fitting basis.
Definition: dftensor.h:103
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:64
SharedMatrix C_
Full C matrix (must provide orthonormal MO basis)
Definition: dftensor.h:143
int nvir_
Total number of virtuals.
Definition: dftensor.h:166
bool is_inverted() const
Is the metric inverted?
Definition: dftensor.h:91
bool is_poisson() const
Are poisson functions used?
Definition: dftensor.h:89
SharedMatrix get_metric() const
The fitting metric or symmetric inverse.
Definition: dftensor.h:94
std::shared_ptr< IntVector > pivots_
The indices (per irrep) of pivots.
Definition: dftensor.h:62
int naocc_
Number of active occupieds.
Definition: dftensor.h:162
bool is_inverted_
Is the metric inverted or just a J matrix?
Definition: dftensor.h:69
std::shared_ptr< BasisSet > aux_
Pointer to the auxiliary basis set.
Definition: dftensor.h:49
int nfvir_
Number of frozen virtuals.
Definition: dftensor.h:164
int print_
Print level.
Definition: dftensor.h:128
std::string algorithm_
The fitting algorithm selected.
Definition: dftensor.h:67
int nfocc_
Number of frozen occupieds.
Definition: dftensor.h:158
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:152
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:133
std::shared_ptr< IntVector > get_reverse_pivots() const
The vector of back pivots (for stability) (global-&gt;pivoted)
Definition: dftensor.h:98
SharedMatrix metric_
The fitting metric or symmetric inverse.
Definition: dftensor.h:60
std::shared_ptr< BasisSet > pois_
Pointer to the poisson basis set.
Definition: dftensor.h:51
std::string get_algorithm() const
What algorithm to use for symmetric inverse?
Definition: dftensor.h:87
double omega_
Range separation omega (0.0 if not used)
Definition: dftensor.h:57
std::shared_ptr< BasisSet > get_auxiliary_basis() const
The gaussian fitting basis.
Definition: dftensor.h:101
Definition: liboptions.h:355
void form_full_inverse()
Build the full inverse metric. NOT RECOMMENDED: Numerical stability (calls form_fitting_metric) ...
Definition: fittingmetric.cc:555
Definition: dftensor.h:45
common_init()
std::shared_ptr< Molecule > molecule_
Molecule (fo convenience)
Definition: dftensor.h:131
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void form_cholesky_factor()
Build the full metric&#39;s Cholesky factor. RECOMMENDED: Numerical stability.
Definition: fittingmetric.cc:579
#define PSI_API
Definition: pragma.h:128
SharedMatrix metric_
Symmetric inverse fitting metric.
Definition: dftensor.h:140
int navir_
Number of active virtuals.
Definition: dftensor.h:168
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:96
FittingMetric(std::shared_ptr< BasisSet > aux, bool force_C1=false)
DF Fitting Metric.
Definition: fittingmetric.cc:64
Definition: pointgrp.h:106
~FittingMetric()
Destructor.
Definition: fittingmetric.cc:77
SharedMatrix Cavir_
Active virtual C Matrix (for convenience)
Definition: dftensor.h:147
Options & options_
options reference
Definition: dftensor.h:137
int naux_
Number of grid points.
Definition: dftensor.h:155
SharedMatrix Caocc_
Active occupied C Matrix (for convenience)
Definition: dftensor.h:145
bool is_poisson_
Is the metric poisson?
Definition: dftensor.h:53
Definition: dftensor.h:121
std::shared_ptr< BasisSet > auxiliary_
Dealias basis set.
Definition: dftensor.h:135
bool force_C1_
Should we force C1?
Definition: dftensor.h:55
void pivot()
Fully pivot the fitting metric.
Definition: fittingmetric.cc:597
int debug_
Debug level.
Definition: dftensor.h:126