Psi4
scf_grad.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 SCF_GRAD_H
30 #define SCF_GRAD_H
31 
33 #include "psi4/libmints/typedefs.h"
34 
35 namespace psi {
36 class SuperFunctional;
37 class VBase;
38 namespace scf {
39  class RHF;
40 }
41 
42 namespace scfgrad {
43 
44 class SCFDeriv : public Wavefunction {
45 
46 protected:
47 
49  void common_init();
50  std::shared_ptr<SuperFunctional> functional_;
51  std::shared_ptr<VBase> potential_;
52  std::map<std::string, SharedMatrix> gradients_;
53  std::map<std::string, SharedMatrix> hessians_;
54 
55 public:
57  ~SCFDeriv() override;
58 
59  double compute_energy() override { throw PSIEXCEPTION("SCFDeriv not implemented for the requested reference type."); }
60  virtual SharedMatrix compute_gradient() override;
61  virtual SharedMatrix compute_hessian() override;
62  virtual SharedMatrix hessian_response() { throw PSIEXCEPTION("SCFDeriv not implemented for the requested reference type."); }
63 };
64 
65 class RSCFDeriv : public SCFDeriv {
66 protected:
67  std::shared_ptr<scf::RHF> rhf_wfn_;
68 public:
69  RSCFDeriv(std::shared_ptr<scf::RHF> rhf_wfn, Options& options): SCFDeriv(std::dynamic_pointer_cast<Wavefunction>(rhf_wfn), options), rhf_wfn_(rhf_wfn) {}
70  ~RSCFDeriv() override {}
71  virtual SharedMatrix hessian_response() override;
72 };
73 
74 }} // Namespaces
75 
76 #endif
virtual SharedMatrix hessian_response()
Definition: scf_grad.h:62
Options & options() const
Definition: wavefunction.cc:648
~RSCFDeriv() override
Definition: scf_grad.h:70
std::shared_ptr< VBase > potential_
Definition: scf_grad.h:51
virtual SharedMatrix compute_gradient() override
Compute gradient. Subclasses override this function to compute the gradient.
Definition: scf_grad.cc:86
std::map< std::string, SharedMatrix > hessians_
Definition: scf_grad.h:53
std::shared_ptr< scf::RHF > rhf_wfn_
Definition: scf_grad.h:67
double ** scf
Definition: dx_write.cc:57
std::shared_ptr< SuperFunctional > functional_
Definition: scf_grad.h:50
virtual SharedMatrix hessian_response() override
Definition: response.cc:67
SCFDeriv(SharedWavefunction ref_wfn, Options &options)
Definition: scf_grad.cc:60
std::map< std::string, SharedMatrix > gradients_
Definition: scf_grad.h:52
void common_init()
Common initialization.
Definition: scf_grad.cc:79
SharedMatrix scfgrad(SharedWavefunction, Options &)
Definition: scfgrad/wrapper.cc:40
Definition: scf_grad.h:65
Definition: liboptions.h:353
virtual SharedMatrix compute_hessian() override
Compute Hessian. Subclasses override this function to compute the Hessian.
Definition: scf_grad.cc:290
RSCFDeriv(std::shared_ptr< scf::RHF > rhf_wfn, Options &options)
Definition: scf_grad.h:69
std::shared_ptr< Matrix > SharedMatrix
Definition: adc.h:49
~SCFDeriv() override
Definition: scf_grad.cc:76
Simple wavefunction base class.
Definition: wavefunction.h:85
Definition: scf_grad.h:44
double compute_energy() override
Compute energy. Subclasses override this function to compute its energy.
Definition: scf_grad.h:59
std::shared_ptr< Wavefunction > SharedWavefunction
Definition: typedefs.h:54
#define PSIEXCEPTION(message)
Definition: exception.h:48