Psi4
rhf.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 RHF_H
30 #define RHF_H
31 
32 #include "psi4/libpsio/psio.hpp"
33 #include "hf.h"
34 
35 namespace psi {
36 
37 namespace scf {
38 
39 class RHF : public HF {
40 protected:
41 
42  // Temporary matrices
49 
50  void form_C();
51  void form_D();
52  virtual void damp_update();
53  double compute_initial_E();
54  virtual double compute_E();
55  virtual bool stability_analysis();
56 
57  virtual void form_F();
58  virtual void form_G();
59  virtual void form_V();
60  virtual void compute_orbital_gradient(bool save_fock);
61 
62  bool diis();
63 
64  bool test_convergency();
65 
66  void common_init();
67 
68  // Finalize memory/files
69  virtual void finalize();
70 
72 
73  // Second-order convergence code
74  virtual int soscf_update(void);
75 
76 public:
77  RHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional);
78  RHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional,
79  Options& options, std::shared_ptr<PSIO> psio);
80  virtual ~RHF();
81 
82  virtual SharedMatrix Da() const;
83 
84  virtual bool same_a_b_orbs() const { return true; }
85  virtual bool same_a_b_dens() const { return true; }
86 
88  virtual std::vector<SharedMatrix> onel_Hx(std::vector<SharedMatrix> x);
89  virtual std::vector<SharedMatrix> twoel_Hx(std::vector<SharedMatrix> x, bool combine = true,
90  std::string return_basis = "MO");
91  virtual std::vector<SharedMatrix> cphf_Hx(std::vector<SharedMatrix> x);
92  virtual std::vector<SharedMatrix> cphf_solve(std::vector<SharedMatrix> x_vec,
93  double conv_tol = 1.e-4, int max_iter = 10,
94  int print_lvl = 1);
95 };
96 
97 }}
98 
99 #endif
Options & options() const
Definition: wavefunction.cc:412
bool diis()
Definition: rhf.cc:249
bool test_convergency()
Definition: rhf.cc:254
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:407
SharedMatrix D_
Definition: rhf.h:43
virtual bool same_a_b_dens() const
Definition: rhf.h:85
virtual void finalize()
Definition: rhf.cc:109
virtual bool same_a_b_orbs() const
Definition: rhf.h:84
SharedMatrix Dold_
Definition: rhf.h:44
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: rhf.cc:583
virtual int soscf_update(void)
Definition: rhf.cc:834
double ** scf
Definition: dx_write.cc:57
virtual std::vector< SharedMatrix > twoel_Hx(std::vector< SharedMatrix > x, bool combine=true, std::string return_basis="MO")
Definition: rhf.cc:431
std::shared_ptr< SuperFunctional > functional() const
The DFT Functional object (or null if it has been deleted)
Definition: hf.h:237
virtual void compute_orbital_gradient(bool save_fock)
Definition: rhf.cc:228
void save_density_and_energy()
Save the current density and energy.
Definition: rhf.cc:138
virtual void form_F()
Definition: rhf.cc:267
virtual std::vector< SharedMatrix > onel_Hx(std::vector< SharedMatrix > x)
Hessian-vector computers and solvers.
Definition: rhf.cc:367
SharedMatrix G_
Definition: rhf.h:45
virtual void form_G()
Definition: rhf.cc:179
double compute_initial_E()
Definition: rhf.cc:315
RHF(SharedWavefunction ref_wfn, std::shared_ptr< SuperFunctional > functional)
Definition: rhf.cc:63
SharedMatrix wK_
Definition: rhf.h:48
SharedMatrix J_
Definition: rhf.h:46
virtual std::vector< SharedMatrix > cphf_Hx(std::vector< SharedMatrix > x)
Definition: rhf.cc:571
virtual void form_V()
Computes the density matrix (V_)
Definition: rhf.cc:162
virtual bool stability_analysis()
Check the stability of the wavefunction, and correct (if requested)
Definition: rhf.cc:866
virtual SharedMatrix Da() const
Definition: rhf.cc:133
void form_D()
Computes the density matrix (D_)
Definition: rhf.cc:287
void form_C()
Compute the MO coefficients (C_)
Definition: rhf.cc:282
Definition: liboptions.h:355
virtual double compute_E()
Compute energy for the iteration.
Definition: rhf.cc:321
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
SharedMatrix K_
Definition: rhf.h:47
Definition: hf.h:48
virtual void damp_update()
Definition: rhf.cc:309
void common_init()
Definition: rhf.cc:80
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
Definition: rhf.h:39
virtual ~RHF()
Definition: rhf.cc:76