Psi4
mintshelper.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 _psi_src_lib_libmints_helper_h
30 #define _psi_src_lib_libmints_helper_h
31 
35 
36 #include <vector>
37 
38 namespace psi {
39 
40 class CdSalcList;
41 class CorrelationFactor;
42 class TwoBodyAOInt;
43 class PetiteList;
44 class ThreeCenterOverlapInt;
45 class OneBodyAOInt;
46 
52  private:
55  std::shared_ptr<PSIO> psio_;
56  std::shared_ptr<MatrixFactory> factory_;
57  std::shared_ptr<Molecule> molecule_;
58  std::shared_ptr<IntegralFactory> integral_;
59  std::shared_ptr<BasisSet> basisset_;
60  std::shared_ptr<SOBasisSet> sobasis_;
61  std::shared_ptr<TwoBodyAOInt> eriInts_;
62  std::shared_ptr<BasisSet> rel_basisset_;
63  int print_;
64  int nthread_;
65 
67  double cutoff_;
68 
69  // In-core O(N^5) transqt
70  SharedMatrix mo_eri_helper(SharedMatrix Iso, SharedMatrix Co, SharedMatrix Cv);
71  // In-core O(N^5) transqt
74  SharedMatrix mo_spin_eri_helper(SharedMatrix Iso, int n1, int n2);
75 
76  SharedMatrix ao_helper(const std::string& label, std::shared_ptr<TwoBodyAOInt> ints);
77  SharedMatrix ao_shell_getter(const std::string& label, std::shared_ptr<TwoBodyAOInt> ints, int M, int N, int P,
78  int Q);
79 
80  SharedMatrix ao_3coverlap_helper(const std::string& label, std::shared_ptr<ThreeCenterOverlapInt> ints);
81 
82  void common_init();
83 
84  void one_body_ao_computer(std::vector<std::shared_ptr<OneBodyAOInt>> ints, SharedMatrix out, bool symm);
85  void grad_two_center_computer(std::vector<std::shared_ptr<OneBodyAOInt>> ints, SharedMatrix D, SharedMatrix out);
86 
87  public:
88  void init_helper(std::shared_ptr<Wavefunction> wavefunction = std::shared_ptr<Wavefunction>());
89  void init_helper(std::shared_ptr<BasisSet> basis);
90 
92  MintsHelper(std::shared_ptr<BasisSet> basis, Options& options = Process::environment.options, int print = 0);
93 
95  MintsHelper(std::shared_ptr<Wavefunction> wavefunction);
97  ~MintsHelper();
98 
99  OperatorSymmetry operator_symmetry(int order) { return OperatorSymmetry(order, molecule_, integral_, factory_); }
100 
102  int nbf() const;
103 
105  void set_print(int print) { print_ = print; }
106  void set_nthread(int nthread) { nthread_ = nthread; }
107 
109  std::shared_ptr<PetiteList> petite_list() const;
110 
111  enum { kFromCartesianAO = true, kFromBF = false };
115  std::shared_ptr<PetiteList> petite_list(bool include_pure_transform) const;
117  std::shared_ptr<BasisSet> basisset() const;
119  std::shared_ptr<SOBasisSet> sobasisset() const;
121  std::shared_ptr<MatrixFactory> factory() const;
123  std::shared_ptr<IntegralFactory> integral() const;
124 
125  void set_rel_basisset(std::shared_ptr<BasisSet> rel_basis) { rel_basisset_ = rel_basis; }
126 
128  void integrals();
129  void integrals_erf(double w = -1.0);
130  void integrals_erfc(double w = -1.0);
131 
133  void one_electron_integrals();
135  void integral_gradients();
137  void integral_hessians();
138 
140  SharedMatrix ao_eri(std::shared_ptr<IntegralFactory> = nullptr);
141  SharedMatrix ao_eri(std::shared_ptr<BasisSet> bs1, std::shared_ptr<BasisSet> bs2, std::shared_ptr<BasisSet> bs3,
142  std::shared_ptr<BasisSet> bs4);
144  SharedMatrix ao_eri_shell(int M, int N, int P, int Q);
145 
146  // Derivatives of OEI in AO and MO basis
147  std::vector<SharedMatrix> ao_oei_deriv1(const std::string& oei_type, int atom);
148  std::vector<SharedMatrix> ao_oei_deriv2(const std::string& oei_type, int atom1, int atom2);
149  std::vector<SharedMatrix> ao_overlap_kinetic_deriv1_helper(const std::string& type, int atom);
150  std::vector<SharedMatrix> ao_potential_deriv1_helper(int atom);
151  std::vector<SharedMatrix> ao_overlap_kinetic_deriv2_helper(const std::string& type, int atom1, int atom2);
152  std::vector<SharedMatrix> ao_potential_deriv2_helper(int atom1, int atom2);
153  std::vector<SharedMatrix> mo_oei_deriv1(const std::string& oei_type, int atom, SharedMatrix C1, SharedMatrix C2);
154  std::vector<SharedMatrix> mo_oei_deriv2(const std::string& oei_type, int atom1, int atom2, SharedMatrix C1,
155  SharedMatrix C2);
156  // Derivatives of TEI in AO and MO basis
157  std::vector<SharedMatrix> ao_tei_deriv1(int atom, double omega = 0.0, std::shared_ptr<IntegralFactory> = nullptr);
158  std::vector<SharedMatrix> ao_tei_deriv2(int atom1, int atom2);
159  std::vector<SharedMatrix> mo_tei_deriv1(int atom, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3,
160  SharedMatrix C4);
161  std::vector<SharedMatrix> mo_tei_deriv2(int atom1, int atom2, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3,
162  SharedMatrix C4);
163 
165  SharedMatrix ao_erf_eri(double omega, std::shared_ptr<IntegralFactory> = nullptr);
167  SharedMatrix ao_erfc_eri(double omega);
169  SharedMatrix ao_f12(std::shared_ptr<CorrelationFactor> corr);
170  SharedMatrix ao_f12(std::shared_ptr<CorrelationFactor> corr, std::shared_ptr<BasisSet> bs1,
171  std::shared_ptr<BasisSet> bs2, std::shared_ptr<BasisSet> bs3, std::shared_ptr<BasisSet> bs4);
173  SharedMatrix ao_f12_scaled(std::shared_ptr<CorrelationFactor> corr);
174  SharedMatrix ao_f12_scaled(std::shared_ptr<CorrelationFactor> corr, std::shared_ptr<BasisSet> bs1,
175  std::shared_ptr<BasisSet> bs2, std::shared_ptr<BasisSet> bs3,
176  std::shared_ptr<BasisSet> bs4);
178  SharedMatrix ao_f12_squared(std::shared_ptr<CorrelationFactor> corr);
179  SharedMatrix ao_f12_squared(std::shared_ptr<CorrelationFactor> corr, std::shared_ptr<BasisSet> bs1,
180  std::shared_ptr<BasisSet> bs2, std::shared_ptr<BasisSet> bs3,
181  std::shared_ptr<BasisSet> bs4);
183  SharedMatrix ao_f12g12(std::shared_ptr<CorrelationFactor> corr);
185  SharedMatrix ao_f12_double_commutator(std::shared_ptr<CorrelationFactor> corr);
187  SharedMatrix ao_3coverlap();
188  SharedMatrix ao_3coverlap(std::shared_ptr<BasisSet> bs1, std::shared_ptr<BasisSet> bs2,
189  std::shared_ptr<BasisSet> bs3);
190 
193  SharedMatrix mo_eri(SharedMatrix Cocc, SharedMatrix Cvir);
197  SharedMatrix mo_erf_eri(double omega, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3, SharedMatrix C4);
199  SharedMatrix mo_erfc_eri(double omega, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3, SharedMatrix C4);
201  SharedMatrix mo_f12(std::shared_ptr<CorrelationFactor> corr, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3,
202  SharedMatrix C4);
204  SharedMatrix mo_f12_squared(std::shared_ptr<CorrelationFactor> corr, SharedMatrix C1, SharedMatrix C2,
205  SharedMatrix C3, SharedMatrix C4);
207  SharedMatrix mo_f12g12(std::shared_ptr<CorrelationFactor> corr, SharedMatrix C1, SharedMatrix C2, SharedMatrix C3,
208  SharedMatrix C4);
210  SharedMatrix mo_f12_double_commutator(std::shared_ptr<CorrelationFactor> corr, SharedMatrix C1, SharedMatrix C2,
211  SharedMatrix C3, SharedMatrix C4);
212 
215  SharedMatrix mo_erf_eri(double omega, SharedMatrix Cocc, SharedMatrix Cvir);
216 
220  SharedMatrix mo_spin_eri(SharedMatrix Co, SharedMatrix Cv);
221 
223  SharedMatrix ao_overlap();
224  SharedMatrix ao_overlap(std::shared_ptr<BasisSet>, std::shared_ptr<BasisSet>);
226  SharedMatrix ao_kinetic();
227  SharedMatrix ao_kinetic(std::shared_ptr<BasisSet>, std::shared_ptr<BasisSet>);
229  SharedMatrix ao_potential();
230  SharedMatrix ao_potential(std::shared_ptr<BasisSet>, std::shared_ptr<BasisSet>);
232  SharedMatrix ao_ecp();
233  SharedMatrix ao_ecp(std::shared_ptr<BasisSet>, std::shared_ptr<BasisSet>);
235  SharedMatrix ao_pvp();
237  SharedMatrix ao_dkh(int dkh_order = -1);
239  SharedMatrix so_dkh(int dkh_order = -1);
241  std::vector<SharedMatrix> ao_dipole();
243  std::vector<SharedMatrix> ao_quadrupole();
245  std::vector<SharedMatrix> ao_traceless_quadrupole();
247  std::vector<SharedMatrix> ao_efp_multipole_potential(const std::vector<double>& origin = {0., 0., 0.},
248  int deriv = 0);
250  std::vector<SharedMatrix> electric_field(const std::vector<double>& origin = {0., 0., 0.}, int deriv = 0);
252  std::vector<SharedMatrix> ao_angular_momentum();
254  std::vector<SharedMatrix> ao_nabla();
256  SharedMatrix so_overlap();
258  SharedMatrix so_kinetic();
260  SharedMatrix so_ecp();
262  SharedMatrix so_potential(bool include_perturbations = true);
264  std::vector<SharedMatrix> so_dipole();
266  std::vector<SharedMatrix> so_nabla();
268  std::vector<SharedMatrix> so_angular_momentum();
270  std::vector<SharedMatrix> so_quadrupole();
272  std::vector<SharedMatrix> so_traceless_quadrupole();
273 
275  std::shared_ptr<CdSalcList> cdsalcs(int needed_irreps = 0xF, bool project_out_translations = true,
276  bool project_out_rotations = true);
277 
280 
282  SharedMatrix overlap_grad(SharedMatrix D);
283 
284  // Computes all "core" gradient terms T + V + perturb
285  SharedMatrix core_hamiltonian_grad(SharedMatrix D);
286 
287  SharedMatrix kinetic_grad(SharedMatrix D);
288  SharedMatrix potential_grad(SharedMatrix D);
289  SharedMatrix perturb_grad(SharedMatrix D);
290  SharedMatrix perturb_grad(SharedMatrix D, double xlambda, double ylambda, double zlambda);
291 
293  void play();
294 };
295 } // namespace psi
296 
297 #endif
OperatorSymmetry operator_symmetry(int order)
Definition: mintshelper.h:99
std::shared_ptr< Molecule > molecule_
Definition: mintshelper.h:57
std::shared_ptr< BasisSet > basis
Definition: dx_write.cc:59
void set_rel_basisset(std::shared_ptr< BasisSet > rel_basis)
Definition: mintshelper.h:125
std::shared_ptr< IntegralFactory > integral_
Definition: mintshelper.h:58
std::shared_ptr< PSIO > psio_
Definition: mintshelper.h:55
void PSI_API integrals(psi::OneBodyAOInt &integral, ambit::Tensor *target)
Definition: integrals.cc:48
int print_
Definition: mintshelper.h:63
void set_print(int print)
Sets the print level.
Definition: mintshelper.h:105
void set_nthread(int nthread)
Definition: mintshelper.h:106
std::shared_ptr< TwoBodyAOInt > eriInts_
Definition: mintshelper.h:61
Options & options_
The Options reference for basis sets and things.
Definition: mintshelper.h:54
static Environment environment
Definition: process.h:116
int nthread_
Definition: mintshelper.h:64
Definition: liboptions.h:353
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
#define PSI_API
Definition: pragma.h:155
std::shared_ptr< BasisSet > rel_basisset_
Definition: mintshelper.h:62
Definition: mintshelper.h:51
Definition: pointgrp.h:109
Definition: multipolesymmetry.h:45
std::shared_ptr< MatrixFactory > factory_
Definition: mintshelper.h:56
std::shared_ptr< SOBasisSet > sobasis_
Definition: mintshelper.h:60
double cutoff_
Value which any two-electron integral is below is discarded.
Definition: mintshelper.h:67
std::shared_ptr< BasisSet > basisset_
Definition: mintshelper.h:59