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-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 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  // Temporary matrices
48 
49  double compute_initial_E();
50 
51  void common_init();
52 
53  public:
54  RHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional);
55  RHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional, Options& options,
56  std::shared_ptr<PSIO> psio);
57  virtual ~RHF();
58 
59  virtual SharedMatrix Da() const;
60 
61  virtual bool same_a_b_orbs() const { return true; }
62  virtual bool same_a_b_dens() const { return true; }
63 
64  bool diis();
66  double compute_orbital_gradient(bool save_fock, int max_diis_vectors);
67 
68  void form_C();
69  void form_D();
70  void form_F();
71  void form_G();
72  void form_V();
73  double compute_E();
74  void finalize();
75 
76  void damping_update(double);
77  int soscf_update(double soscf_conv, int soscf_min_iter, int soscf_max_iter, int soscf_print);
78  bool stability_analysis();
79 
81  virtual std::vector<SharedMatrix> onel_Hx(std::vector<SharedMatrix> x);
82  virtual std::vector<SharedMatrix> twoel_Hx(std::vector<SharedMatrix> x, bool combine = true,
83  std::string return_basis = "MO");
84  virtual std::vector<SharedMatrix> cphf_Hx(std::vector<SharedMatrix> x);
85  virtual std::vector<SharedMatrix> cphf_solve(std::vector<SharedMatrix> x_vec, double conv_tol = 1.e-4,
86  int max_iter = 10, int print_lvl = 1);
87 
88  std::shared_ptr<RHF> c1_deep_copy(std::shared_ptr<BasisSet> basis);
89 };
90 } // namespace scf
91 } // namespace psi
92 
93 #endif
std::shared_ptr< RHF > c1_deep_copy(std::shared_ptr< BasisSet > basis)
Definition: rhf.cc:937
Options & options() const
Definition: wavefunction.cc:572
bool diis()
Definition: rhf.cc:237
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:570
SharedMatrix D_
Definition: rhf.h:42
void damping_update(double)
Definition: rhf.cc:284
std::shared_ptr< BasisSet > basis
Definition: dx_write.cc:59
virtual bool same_a_b_dens() const
Definition: rhf.h:62
void finalize()
Definition: rhf.cc:106
virtual bool same_a_b_orbs() const
Definition: rhf.h:61
SharedMatrix Dold_
Definition: rhf.h:43
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:543
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:397
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: rhf.cc:131
void form_F()
Definition: rhf.cc:239
virtual std::vector< SharedMatrix > onel_Hx(std::vector< SharedMatrix > x)
Hessian-vector computers and solvers.
Definition: rhf.cc:338
SharedMatrix G_
Definition: rhf.h:44
void form_G()
Definition: rhf.cc:169
double compute_initial_E()
Definition: rhf.cc:289
RHF(SharedWavefunction ref_wfn, std::shared_ptr< SuperFunctional > functional)
Definition: rhf.cc:65
SharedMatrix wK_
Definition: rhf.h:47
SharedMatrix J_
Definition: rhf.h:45
int soscf_update(double soscf_conv, int soscf_min_iter, int soscf_max_iter, int soscf_print)
Definition: rhf.cc:787
virtual std::vector< SharedMatrix > cphf_Hx(std::vector< SharedMatrix > x)
Definition: rhf.cc:532
void form_V()
Computes the density matrix (V_)
Definition: rhf.cc:153
bool stability_analysis()
Check the stability of the wavefunction, and correct (if requested)
Definition: rhf.cc:817
virtual SharedMatrix Da() const
Definition: rhf.cc:129
void form_D()
Computes the density matrix (D_)
Definition: rhf.cc:262
double compute_orbital_gradient(bool save_fock, int max_diis_vectors)
Definition: rhf.cc:215
void form_C()
Compute the MO coefficients (C_)
Definition: rhf.cc:257
Definition: liboptions.h:353
double compute_E()
Compute energy for the iteration.
Definition: rhf.cc:294
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
SharedMatrix K_
Definition: rhf.h:46
Definition: hf.h:48
void common_init()
Definition: rhf.cc:78
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
Definition: rhf.h:39
virtual ~RHF()
Definition: rhf.cc:76