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-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 __math_test_uhf_h__
30 #define __math_test_uhf_h__
31 
32 #include "psi4/libpsio/psio.hpp"
33 #include "hf.h"
34 
35 namespace psi {
36 namespace scf {
37 
38 class UHF : public HF {
39 protected:
43 
44  void form_initialF();
45  void form_C();
46  void form_V();
47  void form_D();
48  double compute_initial_E();
49  virtual double compute_E();
50  virtual bool stability_analysis();
51  bool stability_analysis_pk();
52 
53  virtual void form_G();
54  virtual void form_F();
55 
56  virtual void compute_orbital_gradient(bool save_diis);
57  bool diis();
58 
59  bool test_convergency();
60  void save_information();
61 
62  void common_init();
63 
65 
66  // Finalize memory/files
67  virtual void finalize();
68 
69  // Scaling factor for orbital rotation
70  double step_scale_;
71  // Increment to explore different scaling factors
73  // Stability eigenvalue, for doing smart eigenvector following
74  double stab_val;
75 
76  // Compute UHF NOs
77  void compute_nos();
78 
79  // Damp down the density update
80  virtual void damp_update();
81 
82  // Second-order convergence code
83  void Hx(SharedMatrix x_a, SharedMatrix IFock_a, SharedMatrix Cocc_a,
84  SharedMatrix Cvir_a, SharedMatrix ret_a,
85  SharedMatrix x_b, SharedMatrix IFock_b, SharedMatrix Cocc_b,
86  SharedMatrix Cvir_b, SharedMatrix ret_b);
87  virtual int soscf_update(void);
88 
89 public:
90  UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional);
91  UHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional,
92  Options& options, std::shared_ptr<PSIO> psio);
93  virtual ~UHF();
94 
95  virtual bool same_a_b_orbs() const { return false; }
96  virtual bool same_a_b_dens() const { return false; }
97 
99  virtual std::vector<SharedMatrix> onel_Hx(std::vector<SharedMatrix> x);
100  virtual std::vector<SharedMatrix> twoel_Hx(std::vector<SharedMatrix> x, bool combine = true,
101  std::string return_basis = "MO");
102  virtual std::vector<SharedMatrix> cphf_Hx(std::vector<SharedMatrix> x);
103  virtual std::vector<SharedMatrix> cphf_solve(std::vector<SharedMatrix> x_vec,
104  double conv_tol = 1.e-4, int max_iter = 10,
105  int print_lvl = 1);
106 };
107 
108 }}
109 
110 #endif
void compute_nos()
Definition: uhf.cc:936
void form_D()
Computes the density matrix (D_)
Definition: uhf.cc:290
Options & options() const
Definition: wavefunction.cc:396
virtual void damp_update()
Definition: uhf.cc:324
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:391
void common_init()
Definition: uhf.cc:73
SharedMatrix J_
Definition: uhf.h:42
virtual bool same_a_b_dens() const
Definition: uhf.h:96
SharedMatrix Ga_
Definition: uhf.h:42
void form_C()
Compute the MO coefficients (C_)
Definition: uhf.cc:270
virtual void finalize()
Definition: uhf.cc:109
double step_scale_
Definition: uhf.h:70
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:240
void save_density_and_energy()
Save the current density and energy.
Definition: uhf.cc:140
SharedMatrix wKb_
Definition: uhf.h:42
SharedMatrix Gb_
Definition: uhf.h:42
virtual void form_G()
Definition: uhf.cc:167
double stab_val
Definition: uhf.h:74
bool diis()
Definition: uhf.cc:886
virtual void compute_orbital_gradient(bool save_diis)
Definition: uhf.cc:864
SharedMatrix Da_old_
Definition: uhf.h:41
double compute_initial_E()
Definition: uhf.cc:335
virtual std::vector< SharedMatrix > twoel_Hx(std::vector< SharedMatrix > x, bool combine=true, std::string return_basis="MO")
Definition: uhf.cc:435
double step_increment_
Definition: uhf.h:72
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)
virtual void form_F()
Definition: uhf.cc:256
void save_information()
Definition: uhf.cc:228
bool stability_analysis_pk()
SharedMatrix Dt_
Definition: uhf.h:40
virtual std::vector< SharedMatrix > cphf_Hx(std::vector< SharedMatrix > x)
Definition: uhf.cc:571
UHF(SharedWavefunction ref_wfn, std::shared_ptr< SuperFunctional > functional)
Definition: uhf.cc:56
void form_initialF()
Definition: uhf.cc:243
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:389
Definition: liboptions.h:360
virtual int soscf_update(void)
Definition: uhf.cc:831
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:147
virtual bool stability_analysis()
Check the stability of the wavefunction, and correct (if requested)
Definition: uhf.cc:891
virtual double compute_E()
Compute energy for the iteration.
Definition: uhf.cc:342
Definition: hf.h:50
virtual bool same_a_b_orbs() const
Definition: uhf.h:95
virtual ~UHF()
Definition: uhf.cc:69
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:583
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:52
bool test_convergency()
Definition: uhf.cc:232
Definition: uhf.h:38