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 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 _psi_src_lib_libmints_local_h_
30 #define _psi_src_lib_libmints_local_h_
31 
32 #include <vector>
33 #include <memory>
34 
35 namespace psi {
36 class Options;
37 
38 class Matrix;
39 
40 class BasisSet;
41 
42 class Localizer
43 {
44 protected:
45 
46  // => Parameters <= //
47 
49  int print_;
51  int debug_;
53  int bench_;
54 
56  double convergence_;
58  int maxiter_;
59 
61  std::shared_ptr <BasisSet> primary_;
63  std::shared_ptr <Matrix> C_;
64 
65  // => Targets <= //
66 
68  std::shared_ptr <Matrix> L_;
70  std::shared_ptr <Matrix> U_;
72  bool converged_;
73 
75  void common_init();
76 
77 public:
78 
79  // => Constructors <= //
80 
81  Localizer(std::shared_ptr <BasisSet> primary_, std::shared_ptr <Matrix> C);
82 
83  virtual ~Localizer();
84 
85  static std::shared_ptr <Localizer> build(const std::string &type, std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
86 
87  static std::shared_ptr <Localizer> build(const std::string &type, std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C, Options &options);
88 
89  static std::shared_ptr <Localizer> build(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C, Options &options);
90 
91  // => Computers <= //
92 
94  virtual void print_header() const = 0;
95 
97  virtual void localize() = 0;
98 
100  std::shared_ptr <Matrix> fock_update(std::shared_ptr <Matrix> F_orig);
101 
102  // => Accessors <= //
103 
104  std::shared_ptr <Matrix> L() const
105  { return L_; }
106 
107  std::shared_ptr <Matrix> U() const
108  { return U_; }
109 
110  bool converged() const
111  { return converged_; }
112 
113  // => Knobs <= //
114 
115  void set_print(int print)
116  { print_ = print; }
117 
118  void set_debug(int debug)
119  { debug_ = debug; }
120 
121  void set_bench(int bench)
122  { bench_ = bench; }
123 
124  void set_convergence(double convergence)
125  { convergence_ = convergence; }
126 
127  void set_maxiter(int maxiter)
128  { maxiter_ = maxiter; }
129 
130 };
131 
132 class BoysLocalizer : public Localizer
133 {
134 
135 protected:
136 
138  void common_init();
139 
140 public:
141  BoysLocalizer(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
142 
143  virtual ~BoysLocalizer();
144 
145  virtual void print_header() const;
146 
147  virtual void localize();
148 
149 };
150 
151 class PMLocalizer : public Localizer
152 {
153 
154 protected:
155 
157  void common_init();
158 
159 public:
160  PMLocalizer(std::shared_ptr <BasisSet> primary, std::shared_ptr <Matrix> C);
161 
162  virtual ~PMLocalizer();
163 
164  virtual void print_header() const;
165 
166  virtual void localize();
167 
168 };
169 
170 } //Namespace psi
171 
172 #endif
std::shared_ptr< Matrix > L() const
Definition: libmints/local.h:104
void set_convergence(double convergence)
Definition: libmints/local.h:124
Definition: libmints/local.h:132
virtual void localize()
Perform the localization algorithm.
Definition: libmints/local.cc:157
PMLocalizer(std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:346
std::shared_ptr< Matrix > U() const
Definition: libmints/local.h:107
int print_
Print flag.
Definition: libmints/local.h:49
void set_maxiter(int maxiter)
Definition: libmints/local.h:127
void set_bench(int bench)
Definition: libmints/local.h:121
Localizer(std::shared_ptr< BasisSet > primary_, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:40
std::shared_ptr< Matrix > C_
Delocalized Orbitals.
Definition: libmints/local.h:63
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:93
BoysLocalizer(std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:138
static std::shared_ptr< Localizer > build(const std::string &type, std::shared_ptr< BasisSet > primary, std::shared_ptr< Matrix > C)
Definition: libmints/local.cc:85
virtual ~BoysLocalizer()
Definition: libmints/local.cc:143
virtual void localize()
Perform the localization algorithm.
Definition: libmints/local.cc:365
int debug_
Debug flug.
Definition: libmints/local.h:51
virtual ~Localizer()
Definition: libmints/local.cc:51
virtual void print_header() const =0
Print out the localization algorithm and parameters.
void common_init()
Set defaults.
Definition: libmints/local.cc:146
int maxiter_
Maximum number of iterations.
Definition: libmints/local.h:58
void common_init()
Set defaults.
Definition: libmints/local.cc:354
std::shared_ptr< Matrix > U_
MO -&gt; LO transformation.
Definition: libmints/local.h:70
Definition: liboptions.h:360
std::shared_ptr< BasisSet > primary_
Primary orbital basis set.
Definition: libmints/local.h:61
Definition: libmints/local.h:151
virtual void localize()=0
Perform the localization algorithm.
std::shared_ptr< Matrix > L_
Localized Orbitals.
Definition: libmints/local.h:68
Definition: libmints/local.h:42
virtual void print_header() const
Print out the localization algorithm and parameters.
Definition: libmints/local.cc:149
virtual ~PMLocalizer()
Definition: libmints/local.cc:351
int bench_
Bench flag.
Definition: libmints/local.h:53
virtual void print_header() const
Print out the localization algorithm and parameters.
Definition: libmints/local.cc:357
void common_init()
Set defaults.
Definition: libmints/local.cc:54
bool converged() const
Definition: libmints/local.h:110
double convergence_
Relative convergence criteria.
Definition: libmints/local.h:56
void set_debug(int debug)
Definition: libmints/local.h:118
bool converged_
Did the algorithm converge?
Definition: libmints/local.h:72
void set_print(int print)
Definition: libmints/local.h:115