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 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 
34 #include <string>
35 
36 namespace psi {
37 
38 class PSIO;
39 class BasisSet;
40 class IntVector;
41 class Vector3;
42 class Options;
43 
45 
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:
74 
76  FittingMetric(std::shared_ptr<BasisSet> aux, bool force_C1 = false);
78  FittingMetric(std::shared_ptr<BasisSet> aux, double omega, bool force_C1 = false);
80  FittingMetric(std::shared_ptr<BasisSet> aux, std::shared_ptr<BasisSet> pois, bool force_C1 = false);
81 
84 
86  std::string get_algorithm() const {return algorithm_; }
88  bool is_poisson() const {return is_poisson_; }
90  bool is_inverted() const {return is_inverted_; }
91 
93  SharedMatrix get_metric() const {return metric_; }
95  std::shared_ptr<IntVector> get_pivots() const {return pivots_; }
97  std::shared_ptr<IntVector> get_reverse_pivots() const {return rev_pivots_; }
98 
100  std::shared_ptr<BasisSet> get_auxiliary_basis() const {return aux_; }
102  std::shared_ptr<BasisSet> get_poisson_basis() const {return pois_; }
103 
105  void form_fitting_metric();
107  void form_cholesky_inverse();
109  void form_QR_inverse(double tol = 1.0E-10);
111  void form_eig_inverse(double tol = 1.0E-10);
113  void form_full_inverse();
115  void form_full_eig_inverse(double tol = 1.0E-10);
117  void form_cholesky_factor();
118 };
119 
120 class DFTensor {
121 
122 protected:
123 
125  int debug_;
127  int print_;
128 
130  std::shared_ptr<Molecule> molecule_;
132  std::shared_ptr<BasisSet> primary_;
134  std::shared_ptr<BasisSet> auxiliary_;
137 
140 
147 
149  int nso_;
151  int nmo_;
152 
154  int naux_;
155 
157  int nfocc_;
159  int nocc_;
161  int naocc_;
163  int nfvir_;
165  int nvir_;
167  int navir_;
168 
169  void common_init();
170  void build_metric();
171  void print_header();
172 
173 public:
174 
175  DFTensor(std::shared_ptr<BasisSet> primary,
176  std::shared_ptr<BasisSet> auxiliary,
177  SharedMatrix C,
178  int nocc,
179  int nvir,
180  int naocc,
181  int navir,
182  Options& options);
183 
187  DFTensor(std::shared_ptr<BasisSet> primary,
188  std::shared_ptr<BasisSet> auxiliary,
189  SharedMatrix C,
190  int nocc,
191  int nvir);
192  ~DFTensor();
193 
194  SharedMatrix Qso();
195  SharedMatrix Qmo();
196  SharedMatrix Qoo();
197  SharedMatrix Qov();
198  SharedMatrix Qvv();
199 
200  SharedMatrix Imo();
202 };
203 
204 }
205 #endif
int nso_
Number of AO primary functions.
Definition: dftensor.h:149
int nocc_
Total number of occupieds.
Definition: dftensor.h:159
std::shared_ptr< BasisSet > get_poisson_basis() const
The poisson fitting basis.
Definition: dftensor.h:102
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:63
SharedMatrix C_
Full C matrix (must provide orthonormal MO basis)
Definition: dftensor.h:142
int nvir_
Total number of virtuals.
Definition: dftensor.h:165
~DFTensor()
Definition: dftensor.cc:72
bool is_inverted() const
Is the metric inverted?
Definition: dftensor.h:90
bool is_poisson() const
Are poisson functions used?
Definition: dftensor.h:88
SharedMatrix get_metric() const
The fitting metric or symmetric inverse.
Definition: dftensor.h:93
std::shared_ptr< IntVector > pivots_
The indices (per irrep) of pivots.
Definition: dftensor.h:61
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:49
int naocc_
Number of active occupieds.
Definition: dftensor.h:161
void print_header()
Definition: dftensor.cc:112
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
SharedMatrix Qvv()
Definition: dftensor.cc:252
SharedMatrix Idfmo()
Definition: dftensor.cc:321
SharedMatrix Qov()
Definition: dftensor.cc:217
int nfvir_
Number of frozen virtuals.
Definition: dftensor.h:163
int print_
Print level.
Definition: dftensor.h:127
std::string algorithm_
The fitting algorithm selected.
Definition: dftensor.h:66
int nfocc_
Number of frozen occupieds.
Definition: dftensor.h:157
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:151
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:132
SharedMatrix Imo()
Definition: dftensor.cc:316
void common_init()
Definition: dftensor.cc:75
std::shared_ptr< IntVector > get_reverse_pivots() const
The vector of back pivots (for stability) (global-&gt;pivoted)
Definition: dftensor.h:97
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:86
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:100
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:44
SharedMatrix Qmo()
Definition: dftensor.cc:284
std::shared_ptr< Molecule > molecule_
Molecule (fo convenience)
Definition: dftensor.h:130
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
SharedMatrix metric_
Symmetric inverse fitting metric.
Definition: dftensor.h:139
int navir_
Number of active virtuals.
Definition: dftensor.h:167
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:95
FittingMetric(std::shared_ptr< BasisSet > aux, bool force_C1=false)
DF Fitting Metric.
Definition: fittingmetric.cc:64
SharedMatrix Qso()
Definition: dftensor.cc:134
Definition: pointgrp.h:106
~FittingMetric()
Destructor.
Definition: fittingmetric.cc:77
SharedMatrix Cavir_
Active virtual C Matrix (for convenience)
Definition: dftensor.h:146
Options & options_
options reference
Definition: dftensor.h:136
int naux_
Number of grid points.
Definition: dftensor.h:154
void build_metric()
Definition: dftensor.cc:124
SharedMatrix Caocc_
Active occupied C Matrix (for convenience)
Definition: dftensor.h:144
bool is_poisson_
Is the metric poisson?
Definition: dftensor.h:52
Definition: dftensor.h:120
std::shared_ptr< BasisSet > auxiliary_
Dealias basis set.
Definition: dftensor.h:134
SharedMatrix Qoo()
Definition: dftensor.cc:185
bool force_C1_
Should we force C1?
Definition: dftensor.h:54
void pivot()
Fully pivot the fitting metric.
Definition: fittingmetric.cc:597
int debug_
Debug level.
Definition: dftensor.h:125