Psi4
cuhf.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 __math_test_cuhf_h__
30 #define __math_test_cuhf_h__
31 
32 #include "hf.h"
33 #include "psi4/libpsio/psio.hpp"
34 
35 namespace psi {
36 namespace scf {
37 
38 /*
39 
40  Constrained Unrestricted Hartree-Fock
41 
42  Reference: T. Tsuchimochi and G.E. Scuseria, J. Chem. Phys. 133,
43  141102 (2010)
44 
45  This is an alternative formulation of ROHF as a contrained UHF. A
46  Lagrangian constraint is placed on the usual UHF procedure to remove
47  the spin contamination. The result is an ROHF energy and semicanonical
48  ROHF orbitals. The need to pick coupling coefficients is removed.
49  Koopmans' theorem is valid for CUHF orbital energes.
50 
51  It is claimed that CUHF does not suffer from the convergence problems
52  of certain ROHF implementations (not sure how PSI's ROHF code does).
53  CUHF retains the UHF-like trait that Ca != Cb. Also, the converged CUHF
54  wavefunction yields the correct value for <S^2>, however, this is only
55  true at convergence. It is possible that this increased flexibility
56  improves convergence.
57 
58  -- EGH, August 15th, 2011
59 
60  TODO:
61 
62  Probably can't handle NSO != NMO right now, should either fix this code
63  or the transform functions from Matrix.
64 
65  Using the UHF form for the Lagrangian, this is probably correct, but
66  should be checked.
67 
68 */
69 
70 class CUHF final : public HF {
71  protected:
75  // Contributions to the Fock matrix from charge and spin density
77  // Charge density and natural orbitals (eigenvectors of charge density)
79  // Natural orbital occupations
81 
82  void form_initial_F() override;
83  double compute_initial_E() override;
84 
85  void compute_spin_contamination() override;
86 
87  void common_init();
88 
89  public:
90  CUHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional);
91  CUHF(SharedWavefunction ref_wfn, std::shared_ptr<SuperFunctional> functional, Options& options,
92  std::shared_ptr<PSIO> psio);
93  ~CUHF() override;
94 
95  bool diis() override;
96  void save_density_and_energy() override;
97  double compute_orbital_gradient(bool save_diis, int max_diis_vectors) override;
98 
99  void form_C() override;
100  void form_D() override;
101  void form_F() override;
102  void form_G() override;
103  double compute_E() override;
104  void finalize() override;
105 
106  void damping_update(double) override;
107  bool stability_analysis() override;
108 
109  std::shared_ptr<CUHF> c1_deep_copy(std::shared_ptr<BasisSet> basis);
110 
111  void compute_SAD_guess() override;
112 };
113 } // namespace scf
114 } // namespace psi
115 
116 #endif
~CUHF() override
Definition: cuhf.cc:68
SharedMatrix Da_old_
Definition: cuhf.h:73
Options & options() const
Definition: wavefunction.cc:648
std::shared_ptr< PSIO > psio() const
Definition: wavefunction.cc:646
std::shared_ptr< BasisSet > basis
Definition: dx_write.cc:59
SharedMatrix Fp_
Definition: cuhf.h:76
SharedMatrix J_
Definition: cuhf.h:74
void form_D() override
Computes the density matrix (D_)
Definition: cuhf.cc:322
double compute_E() override
Compute energy for the iteration.
Definition: cuhf.cc:355
SharedMatrix Cno_temp_
Definition: cuhf.h:78
void compute_SAD_guess() override
SAD Guess and propagation.
Definition: cuhf.cc:427
double ** scf
Definition: dx_write.cc:57
double compute_initial_E() override
Definition: cuhf.cc:353
SharedMatrix Dt_
Definition: cuhf.h:72
std::shared_ptr< SuperFunctional > functional() const
The DFT Functional object (or null if it has been deleted)
Definition: hf.h:296
bool stability_analysis() override
Check the stability of the wavefunction, and correct (if requested)
Definition: cuhf.cc:400
void damping_update(double) override
Definition: cuhf.cc:104
SharedMatrix Kb_
Definition: cuhf.h:74
SharedMatrix Dp_
Definition: cuhf.h:78
SharedVector No_
Definition: cuhf.h:80
Definition: cuhf.h:70
void common_init()
Definition: cuhf.cc:70
void form_C() override
Compute the MO coefficients (C_)
Definition: cuhf.cc:312
SharedMatrix Dt_old_
Definition: cuhf.h:72
std::shared_ptr< CUHF > c1_deep_copy(std::shared_ptr< BasisSet > basis)
Definition: cuhf.cc:405
SharedMatrix Cno_
Definition: cuhf.h:78
SharedMatrix Fm_
Definition: cuhf.h:76
double compute_orbital_gradient(bool save_diis, int max_diis_vectors) override
Definition: cuhf.cc:376
void form_initial_F() override
Definition: cuhf.cc:205
void save_density_and_energy() override
Save the current density and energy.
Definition: cuhf.cc:145
Definition: liboptions.h:352
void compute_spin_contamination() override
Definition: cuhf.cc:170
void finalize() override
Definition: cuhf.cc:113
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
bool diis() override
Definition: cuhf.cc:398
Definition: hf.h:48
SharedMatrix Ka_
Definition: cuhf.h:74
void form_F() override
Definition: cuhf.cc:230
void form_G() override
Definition: cuhf.cc:151
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
SharedMatrix Db_old_
Definition: cuhf.h:73
CUHF(SharedWavefunction ref_wfn, std::shared_ptr< SuperFunctional > functional)
Definition: cuhf.cc:57
std::shared_ptr< Vector > SharedVector
Definition: adc.h:51