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-2019 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  protected:
48  std::shared_ptr<BasisSet> aux_;
50  std::shared_ptr<BasisSet> pois_;
54  bool force_C1_;
56  double omega_;
57 
61  std::shared_ptr<IntVector> pivots_;
63  std::shared_ptr<IntVector> rev_pivots_;
64 
66  std::string algorithm_;
69 
71  void pivot();
72 
73  public:
75  FittingMetric(std::shared_ptr<BasisSet> aux, bool force_C1 = false);
77  FittingMetric(std::shared_ptr<BasisSet> aux, double omega, bool force_C1 = false);
79  FittingMetric(std::shared_ptr<BasisSet> aux, std::shared_ptr<BasisSet> pois, bool force_C1 = false);
80 
83 
85  std::string get_algorithm() const { return algorithm_; }
87  bool is_poisson() const { return is_poisson_; }
89  bool is_inverted() const { return is_inverted_; }
90 
92  SharedMatrix get_metric() const { return metric_; }
94  std::shared_ptr<IntVector> get_pivots() const { return pivots_; }
96  std::shared_ptr<IntVector> get_reverse_pivots() const { return rev_pivots_; }
97 
99  std::shared_ptr<BasisSet> get_auxiliary_basis() const { return aux_; }
101  std::shared_ptr<BasisSet> get_poisson_basis() const { return pois_; }
102 
104  void form_fitting_metric();
106  void form_cholesky_inverse();
108  void form_QR_inverse(double tol = 1.0E-10);
110  void form_eig_inverse(double tol = 1.0E-10);
112  void form_full_inverse();
114  void form_full_eig_inverse(double tol = 1.0E-10);
116  void form_cholesky_factor();
117 };
118 
120  protected:
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 nbf_;
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  DFTensor(std::shared_ptr<BasisSet> primary, std::shared_ptr<BasisSet> auxiliary, SharedMatrix C, int nocc, int nvir,
172  int naocc, int navir, Options& options);
173 
177  DFTensor(std::shared_ptr<BasisSet> primary, std::shared_ptr<BasisSet> auxiliary, SharedMatrix C, int nocc,
178  int nvir);
179  ~DFTensor();
180 
181  SharedMatrix Qso();
182  SharedMatrix Qmo();
183  SharedMatrix Qoo();
184  SharedMatrix Qov();
185  SharedMatrix Qvv();
186 
187  SharedMatrix Imo();
188  SharedMatrix Idfmo();
189 };
190 }
191 #endif
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:101
void form_QR_inverse(double tol=1.0E-10)
Build the QR half inverse metric (calls form_fitting_metric)
Definition: fittingmetric.cc:345
void form_cholesky_inverse()
Build the Cholesky half inverse metric (calls form_fitting_metric)
Definition: fittingmetric.cc:327
std::shared_ptr< IntVector > rev_pivots_
The indices (per irrep) of reverse pivots.
Definition: dftensor.h:63
SharedMatrix C_
Full C matrix (must provide orthonormal MO basis)
Definition: dftensor.h:139
int nvir_
Total number of virtuals.
Definition: dftensor.h:162
bool is_inverted() const
Is the metric inverted?
Definition: dftensor.h:89
bool is_poisson() const
Are poisson functions used?
Definition: dftensor.h:87
SharedMatrix get_metric() const
The fitting metric or symmetric inverse.
Definition: dftensor.h:92
std::shared_ptr< IntVector > pivots_
The indices (per irrep) of pivots.
Definition: dftensor.h:61
int naocc_
Number of active occupieds.
Definition: dftensor.h:158
bool is_inverted_
Is the metric inverted or just a J matrix?
Definition: dftensor.h:68
std::shared_ptr< BasisSet > aux_
Pointer to the auxiliary basis set.
Definition: dftensor.h:48
int nfvir_
Number of frozen virtuals.
Definition: dftensor.h:160
int nbf_
Number of AO primary functions.
Definition: dftensor.h:146
int print_
Print level.
Definition: dftensor.h:124
std::string algorithm_
The fitting algorithm selected.
Definition: dftensor.h:66
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:72
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:438
std::shared_ptr< BasisSet > primary_
Primary basis set.
Definition: dftensor.h:129
std::shared_ptr< IntVector > get_reverse_pivots() const
The vector of back pivots (for stability) (global-&gt;pivoted)
Definition: dftensor.h:96
SharedMatrix metric_
The fitting metric or symmetric inverse.
Definition: dftensor.h:59
std::shared_ptr< BasisSet > pois_
Pointer to the poisson basis set.
Definition: dftensor.h:50
std::string get_algorithm() const
What algorithm to use for symmetric inverse?
Definition: dftensor.h:85
double omega_
Range separation omega (0.0 if not used)
Definition: dftensor.h:56
std::shared_ptr< BasisSet > get_auxiliary_basis() const
The gaussian fitting basis.
Definition: dftensor.h:99
Definition: liboptions.h:352
void form_full_inverse()
Build the full inverse metric. NOT RECOMMENDED: Numerical stability (calls form_fitting_metric) ...
Definition: fittingmetric.cc:446
Definition: dftensor.h:45
std::shared_ptr< Molecule > molecule_
Molecule (fo convenience)
Definition: dftensor.h:127
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:467
#define PSI_API
Definition: pragma.h:155
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:430
std::shared_ptr< IntVector > get_pivots() const
The vector of pivots (for stability) (pivoted-&gt;global)
Definition: dftensor.h:94
FittingMetric(std::shared_ptr< BasisSet > aux, bool force_C1=false)
DF Fitting Metric.
Definition: fittingmetric.cc:63
Definition: pointgrp.h:104
~FittingMetric()
Destructor.
Definition: fittingmetric.cc:70
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
SharedMatrix Caocc_
Active occupied C Matrix (for convenience)
Definition: dftensor.h:141
bool is_poisson_
Is the metric poisson?
Definition: dftensor.h:52
Definition: dftensor.h:119
std::shared_ptr< BasisSet > auxiliary_
Dealias basis set.
Definition: dftensor.h:131
bool force_C1_
Should we force C1?
Definition: dftensor.h:54
void pivot()
Fully pivot the fitting metric.
Definition: fittingmetric.cc:483
int debug_
Debug level.
Definition: dftensor.h:122