Psi4
uhf.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 __math_test_uhf_h__
30 #define __math_test_uhf_h__
31 
32 #include "hf.h"
33 #include "psi4/libpsio/psio.hpp"
34 
35 namespace psi {
36 namespace scf {
37 
38 class UHF : public HF {
39  protected:
43 
44  void form_initialF();
45  double compute_initial_E();
46  bool stability_analysis_pk();
47 
48  void common_init();
49 
50  // Scaling factor for orbital rotation
51  double step_scale_;
52  // Increment to explore different scaling factors
54  // Stability eigenvalue, for doing smart eigenvector following
55  double stab_val;
56 
57  // Compute UHF NOs
58  void compute_nos();
59 
60  // Second-order convergence code
61  void Hx(SharedMatrix x_a, SharedMatrix IFock_a, SharedMatrix Cocc_a, SharedMatrix Cvir_a, SharedMatrix ret_a,
62  SharedMatrix x_b, SharedMatrix IFock_b, SharedMatrix Cocc_b, SharedMatrix Cvir_b, SharedMatrix ret_b);
63 
64  public:
65  UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional);
66  UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional, Options& options,
67  std::shared_ptr<PSIO> psio);
68  virtual ~UHF();
69 
70  virtual bool same_a_b_orbs() const { return false; }
71  virtual bool same_a_b_dens() const { return false; }
72 
73  bool diis();
75  double compute_orbital_gradient(bool save_diis, int max_diis_vectors);
76 
77  void form_C();
78  void form_D();
79  void form_F();
80  void form_G();
81  void form_V();
82  double compute_E();
83  void finalize();
84 
85  void damping_update(double);
86  int soscf_update(double soscf_conv, int soscf_min_iter, int soscf_max_iter, int soscf_print);
87  bool stability_analysis();
88 
90  virtual std::vector<SharedMatrix> onel_Hx(std::vector<SharedMatrix> x);
91  virtual std::vector<SharedMatrix> twoel_Hx(std::vector<SharedMatrix> x, bool combine = true,
92  std::string return_basis = "MO");
93  virtual std::vector<SharedMatrix> cphf_Hx(std::vector<SharedMatrix> x);
94  virtual std::vector<SharedMatrix> cphf_solve(std::vector<SharedMatrix> x_vec, double conv_tol = 1.e-4,
95  int max_iter = 10, int print_lvl = 1);
96 
97  std::shared_ptr<UHF> c1_deep_copy(std::shared_ptr<BasisSet> basis);
98 };
99 } // namespace scf
100 } // namespace psi
101 
102 #endif
void compute_nos()
Definition: uhf.cc:898
void form_D()
Computes the density matrix (D_)
Definition: uhf.cc:276
Options & options() const
Definition: wavefunction.cc:572
std::shared_ptr< UHF > c1_deep_copy(std::shared_ptr< BasisSet > basis)
Definition: uhf.cc:1022
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:570
void common_init()
Definition: uhf.cc:80
std::shared_ptr< BasisSet > basis
Definition: dx_write.cc:59
SharedMatrix J_
Definition: uhf.h:42
virtual bool same_a_b_dens() const
Definition: uhf.h:71
SharedMatrix Ga_
Definition: uhf.h:42
void form_C()
Compute the MO coefficients (C_)
Definition: uhf.cc:256
void finalize()
Definition: uhf.cc:116
double step_scale_
Definition: uhf.h:51
double ** scf
Definition: dx_write.cc:57
SharedMatrix wKa_
Definition: uhf.h:42
std::shared_ptr< SuperFunctional > functional() const
The DFT Functional object (or null if it has been deleted)
Definition: hf.h:296
void save_density_and_energy()
Save the current density and energy.
Definition: uhf.cc:146
SharedMatrix wKb_
Definition: uhf.h:42
SharedMatrix Gb_
Definition: uhf.h:42
void form_G()
Definition: uhf.cc:169
double stab_val
Definition: uhf.h:55
bool diis()
Definition: uhf.cc:850
double compute_orbital_gradient(bool save_diis, int max_diis_vectors)
Definition: uhf.cc:830
SharedMatrix Da_old_
Definition: uhf.h:41
double compute_initial_E()
Definition: uhf.cc:316
virtual std::vector< SharedMatrix > twoel_Hx(std::vector< SharedMatrix > x, bool combine=true, std::string return_basis="MO")
Definition: uhf.cc:412
double step_increment_
Definition: uhf.h:53
SharedMatrix Kb_
Definition: uhf.h:42
void Hx(SharedMatrix x_a, SharedMatrix IFock_a, SharedMatrix Cocc_a, SharedMatrix Cvir_a, SharedMatrix ret_a, SharedMatrix x_b, SharedMatrix IFock_b, SharedMatrix Cocc_b, SharedMatrix Cvir_b, SharedMatrix ret_b)
void form_F()
Definition: uhf.cc:237
bool stability_analysis_pk()
SharedMatrix Dt_
Definition: uhf.h:40
virtual std::vector< SharedMatrix > cphf_Hx(std::vector< SharedMatrix > x)
Definition: uhf.cc:544
UHF(SharedWavefunction ref_wfn, std::shared_ptr< SuperFunctional > functional)
Definition: uhf.cc:67
void form_initialF()
Definition: uhf.cc:225
SharedMatrix Dt_old_
Definition: uhf.h:40
virtual std::vector< SharedMatrix > onel_Hx(std::vector< SharedMatrix > x)
Hessian-vector computers and solvers.
Definition: uhf.cc:369
Definition: liboptions.h:353
SharedMatrix Db_old_
Definition: uhf.h:41
SharedMatrix Ka_
Definition: uhf.h:42
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
void form_V()
Computes the density matrix (V_)
Definition: uhf.cc:151
bool stability_analysis()
Check the stability of the wavefunction, and correct (if requested)
Definition: uhf.cc:852
double compute_E()
Compute energy for the iteration.
Definition: uhf.cc:322
Definition: hf.h:48
virtual bool same_a_b_orbs() const
Definition: uhf.h:70
virtual ~UHF()
Definition: uhf.cc:78
virtual std::vector< SharedMatrix > cphf_solve(std::vector< SharedMatrix > x_vec, double conv_tol=1.e-4, int max_iter=10, int print_lvl=1)
Definition: uhf.cc:555
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
int soscf_update(double soscf_conv, int soscf_min_iter, int soscf_max_iter, int soscf_print)
Definition: uhf.cc:798
Definition: uhf.h:38
void damping_update(double)
Definition: uhf.cc:306