Psi4
stability.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 STABILITY_H
30 #define STABILITY_H
31 
33 
34 namespace psi {
35 
36 class BasisSet;
37 class JK;
38 class VBase;
39 
40 namespace scf {
41 
42 class UStab {
43  protected:
44  std::vector<std::pair<SharedMatrix, SharedMatrix> > vecs_;
45  std::vector<double> vals_;
46 
47  bool unstable = false;
48  double unstable_val = 0.0;
49  std::pair<SharedMatrix, SharedMatrix> unstable_vec;
50 
51  int print_;
52  int bench_;
53  int debug_;
54  long int memory_;
55 
56  // SharedMatrix C_;
57 
64 
65  std::shared_ptr<Vector> eps_occa_;
66  std::shared_ptr<Vector> eps_vira_;
67  std::shared_ptr<Vector> eps_occb_;
68  std::shared_ptr<Vector> eps_virb_;
69 
70  std::shared_ptr<Wavefunction> reference_wavefunction_;
71  std::shared_ptr<Molecule> molecule_;
72  std::shared_ptr<BasisSet> basis_;
73 
75 
77 
79  double convergence_;
81  std::shared_ptr<JK> jk_;
82  std::shared_ptr<VBase> v_;
83 
84  double Eref_;
85 
86  void common_init();
87  void print_header();
88  void preiterations();
89 
90  public:
91  UStab(SharedWavefunction ref_wfn, Options& options);
92  virtual ~UStab();
93 
95  std::shared_ptr<JK> jk() const { return jk_; }
97  void set_jk(std::shared_ptr<JK> jk) { jk_ = jk; }
99  std::shared_ptr<VBase> v() const { return v_; }
101  void set_jk(std::shared_ptr<VBase> v) { v_ = v; }
103  bool is_unstable() const { return unstable; }
104 
106  double get_eigval() const { return unstable_val; }
107 
109 
111  void set_convergence(double convergence) { convergence_ = convergence; }
112 
114  void set_reference(std::shared_ptr<Wavefunction> reference);
115 
116  virtual double compute_energy();
118  void rotate_orbs(double scale);
119 };
120 
121 } // namespace scf
122 
123 } // namespace psi
124 
125 #endif // STABILITY_H
std::vector< std::pair< SharedMatrix, SharedMatrix > > vecs_
Definition: stability.h:44
std::shared_ptr< Wavefunction > reference_wavefunction_
Definition: stability.h:70
Definition: stability.h:42
SharedMatrix Cvira_
Definition: stability.h:60
int print_
Definition: stability.h:51
SharedMatrix Ca_
Definition: stability.h:62
SharedMatrix analyze()
Definition: stability.cc:209
bool unstable
Definition: stability.h:47
void set_convergence(double convergence)
=&gt; Setters &lt;= ///
Definition: stability.h:111
void reference()
Definition: reference.cc:51
virtual double compute_energy()
Definition: stability.cc:132
double ** scf
Definition: dx_write.cc:57
void print_header()
Definition: stability.cc:105
SharedMatrix Cvirb_
Definition: stability.h:61
void set_jk(std::shared_ptr< JK > jk)
Set the JK object, say from SCF.
Definition: stability.h:97
std::shared_ptr< Molecule > molecule_
Definition: stability.h:71
int bench_
Definition: stability.h:52
std::pair< SharedMatrix, SharedMatrix > unstable_vec
Definition: stability.h:49
std::shared_ptr< VBase > v_
Definition: stability.h:82
std::shared_ptr< JK > jk_
Global JK object, built in preiterations, destroyed in postiterations.
Definition: stability.h:81
void preiterations()
Definition: stability.cc:283
Options & options_
Definition: stability.h:76
double get_eigval() const
Get the eigenvalue for storage and comparison.
Definition: stability.h:106
void set_jk(std::shared_ptr< VBase > v)
Set the VBase object, say from SCF (except that wouldn&#39;t work, right?)
Definition: stability.h:101
double unstable_val
Definition: stability.h:48
std::shared_ptr< Vector > eps_occb_
Definition: stability.h:67
void set_reference(std::shared_ptr< Wavefunction > reference)
Update reference info.
Definition: stability.cc:79
std::shared_ptr< JK > jk() const
Gets a handle to the JK object, if built by preiterations.
Definition: stability.h:95
long int memory_
Definition: stability.h:54
void common_init()
Definition: stability.cc:71
SharedMatrix Cocca_
Definition: stability.h:58
std::shared_ptr< Vector > eps_occa_
Definition: stability.h:65
double convergence_
How far to converge the two-norm of the residual.
Definition: stability.h:79
std::shared_ptr< BasisSet > basis_
Definition: stability.h:72
void rotate_orbs(double scale)
Definition: stability.cc:255
Definition: liboptions.h:353
SharedMatrix Cb_
Definition: stability.h:63
SharedMatrix AO2USO_
Definition: stability.h:74
bool is_unstable() const
Is the wavefunction stable ?
Definition: stability.h:103
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
std::shared_ptr< Vector > eps_virb_
Definition: stability.h:68
std::shared_ptr< VBase > v() const
Gets a handle to the VBase object, if built by preiterations.
Definition: stability.h:99
virtual ~UStab()
Definition: stability.cc:69
UStab(SharedWavefunction ref_wfn, Options &options)
Definition: stability.cc:64
SharedMatrix Coccb_
Definition: stability.h:59
int debug_
Definition: stability.h:53
std::shared_ptr< Vector > eps_vira_
Definition: stability.h:66
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
std::vector< double > vals_
Definition: stability.h:45
double Eref_
Definition: stability.h:84