Psi4
libmints/local.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 program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_lib_libmints_local_h_
29 #define _psi_src_lib_libmints_local_h_
30 
31 #include <vector>
32 #include <memory>
33 
34 namespace psi {
35 class Options;
36 
37 class Matrix;
38 
39 class BasisSet;
40 
41 class Localizer
42 {
43 protected:
44 
45  // => Parameters <= //
46 
48  int print_;
50  int debug_;
52  int bench_;
53 
55  double convergence_;
57  int maxiter_;
58 
60  std::shared_ptr <BasisSet> primary_;
62  std::shared_ptr <Matrix> C_;
63 
64  // => Targets <= //
65 
67  std::shared_ptr <Matrix> L_;
69  std::shared_ptr <Matrix> U_;
71  bool converged_;
72 
74  void common_init();
75 
76 public:
77 
78  // => Constructors <= //
79 
80  Localizer(std::shared_ptr <BasisSet> primary_, std::shared_ptr <Matrix> C);
81 
82  virtual ~Localizer();
83 
84  static std::shared_ptr <Localizer> build(const std::string &type, std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
85 
86  static std::shared_ptr <Localizer> build(const std::string &type, std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C, Options &options);
87 
88  static std::shared_ptr <Localizer> build(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C, Options &options);
89 
90  // => Computers <= //
91 
93  virtual void print_header() const = 0;
94 
96  virtual void localize() = 0;
97 
99  std::shared_ptr <Matrix> fock_update(std::shared_ptr <Matrix> F_orig);
100 
101  // => Accessors <= //
102 
103  std::shared_ptr <Matrix> L() const
104  { return L_; }
105 
106  std::shared_ptr <Matrix> U() const
107  { return U_; }
108 
109  bool converged() const
110  { return converged_; }
111 
112  // => Knobs <= //
113 
114  void set_print(int print)
115  { print_ = print; }
116 
117  void set_debug(int debug)
118  { debug_ = debug; }
119 
120  void set_bench(int bench)
121  { bench_ = bench; }
122 
123  void set_convergence(double convergence)
124  { convergence_ = convergence; }
125 
126  void set_maxiter(int maxiter)
127  { maxiter_ = maxiter; }
128 
129 };
130 
131 class BoysLocalizer : public Localizer
132 {
133 
134 protected:
135 
137  void common_init();
138 
139 public:
140  BoysLocalizer(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
141 
142  virtual ~BoysLocalizer();
143 
144  virtual void print_header() const;
145 
146  virtual void localize();
147 
148 };
149 
150 class PMLocalizer : public Localizer
151 {
152 
153 protected:
154 
156  void common_init();
157 
158 public:
159  PMLocalizer(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
160 
161  virtual ~PMLocalizer();
162 
163  virtual void print_header() const;
164 
165  virtual void localize();
166 
167 };
168 
169 } //Namespace psi
170 
171 #endif
std::shared_ptr< Matrix > L() const
Definition: libmints/local.h:103
void set_convergence(double convergence)
Definition: libmints/local.h:123
Definition: libmints/local.h:131
virtual void localize()
Perform the localization algorithm.
Definition: libmints/local.cc:156
PMLocalizer(std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:345
std::shared_ptr< Matrix > U() const
Definition: libmints/local.h:106
int print_
Print flag.
Definition: libmints/local.h:48
void set_maxiter(int maxiter)
Definition: libmints/local.h:126
void set_bench(int bench)
Definition: libmints/local.h:120
Localizer(std::shared_ptr< BasisSet > primary_, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:39
std::shared_ptr< Matrix > C_
Delocalized Orbitals.
Definition: libmints/local.h:62
std::shared_ptr< Matrix > fock_update(std::shared_ptr< Matrix > F_orig)
Given a Fock matrix in the original basis (usually diagonal), produce an ordered copy in the local ba...
Definition: libmints/local.cc:92
BoysLocalizer(std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:137
static std::shared_ptr< Localizer > build(const std::string &type, std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:84
virtual ~BoysLocalizer()
Definition: libmints/local.cc:142
virtual void localize()
Perform the localization algorithm.
Definition: libmints/local.cc:364
int debug_
Debug flug.
Definition: libmints/local.h:50
virtual ~Localizer()
Definition: libmints/local.cc:50
virtual void print_header() const =0
Print out the localization algorithm and parameters.
void common_init()
Set defaults.
Definition: libmints/local.cc:145
int maxiter_
Maximum number of iterations.
Definition: libmints/local.h:57
void common_init()
Set defaults.
Definition: libmints/local.cc:353
std::shared_ptr< Matrix > U_
MO -&gt; LO transformation.
Definition: libmints/local.h:69
Definition: liboptions.h:359
std::shared_ptr< BasisSet > primary_
Primary orbital basis set.
Definition: libmints/local.h:60
Definition: libmints/local.h:150
virtual void localize()=0
Perform the localization algorithm.
std::shared_ptr< Matrix > L_
Localized Orbitals.
Definition: libmints/local.h:67
Definition: libmints/local.h:41
virtual void print_header() const
Print out the localization algorithm and parameters.
Definition: libmints/local.cc:148
virtual ~PMLocalizer()
Definition: libmints/local.cc:350
int bench_
Bench flag.
Definition: libmints/local.h:52
virtual void print_header() const
Print out the localization algorithm and parameters.
Definition: libmints/local.cc:356
void common_init()
Set defaults.
Definition: libmints/local.cc:53
bool converged() const
Definition: libmints/local.h:109
double convergence_
Relative convergence criteria.
Definition: libmints/local.h:55
void set_debug(int debug)
Definition: libmints/local.h:117
bool converged_
Did the algorithm converge?
Definition: libmints/local.h:71
void set_print(int print)
Definition: libmints/local.h:114