Psi4
local2.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 FISAPT_LOCAL2_H
30 #define FISAPT_LOCAL2_H
31 
32 #include <vector>
33 #include <memory>
34 
35 namespace psi {
36 
37 class Matrix;
38 class BasisSet;
39 
40 namespace fisapt {
41 
43 
44 protected:
45 
46  // => Overall Parameters <= //
47 
49  int print_;
51  int debug_;
53  int bench_;
54 
56  double convergence_;
58  int maxiter_;
59 
60  // => IAO Parameters <= //
61 
65  int power_;
67  double condition_;
68 
70  std::shared_ptr<Matrix> C_;
72  std::shared_ptr<BasisSet> primary_;
74  std::shared_ptr<BasisSet> minao_;
75 
76  // => Stars Parameters <= //
77 
79  bool use_stars_;
83  std::vector<int> stars_;
84 
85  // => IAO Data <= //
86 
88  std::vector<int> true_atoms_;
90  std::vector<int> true_iaos_;
92  std::vector<int> iaos_to_atoms_;
93 
95  std::shared_ptr<Matrix> S_;
97  std::shared_ptr<Matrix> A_;
98 
99 
101  void common_init();
102 
104  void build_iaos();
106  static std::map<std::string, std::shared_ptr<Matrix> > localize_task(
107  std::shared_ptr<Matrix> L, // Matrix of <i|m> [nocc x nmin]
108  const std::vector<std::vector<int> >& minao_inds, // List of minao indices per active center
109  const std::vector<std::pair<int, int> >& rot_inds, // List of allowed rotations (unique)
110  double convergence, // Convergence criterion
111  int maxiter, // Maximum number of iterations
112  int power // Localization metric power
113  );
115  static std::shared_ptr<Matrix> reorder_orbitals(
116  std::shared_ptr<Matrix> F,
117  const std::vector<int>& ranges);
119  std::shared_ptr<Matrix> orbital_charges(
120  std::shared_ptr<Matrix> L
121  );
122 
123 
124 public:
125 
126  // => Constructors <= //
127 
129  std::shared_ptr<BasisSet> primary,
130  std::shared_ptr<BasisSet> minao,
131  std::shared_ptr<Matrix> C);
132 
133  virtual ~IBOLocalizer2();
134 
136  static std::shared_ptr<IBOLocalizer2> build(
137  std::shared_ptr<BasisSet> primary,
138  std::shared_ptr<BasisSet> minao,
139  std::shared_ptr<Matrix> C,
140  Options& options);
141 
142  // => Computers <= //
143 
145  virtual void print_header() const;
146 
148  std::map<std::string, std::shared_ptr<Matrix> > localize(
149  std::shared_ptr<Matrix> Cocc, // Orbitals to localize [nbf x nmo], must live in C above
150  std::shared_ptr<Matrix> Focc, // Fock matrix of orbitals to localize [nmo x nmo]
151  const std::vector<int>& ranges = std::vector<int>() // [0, nfocc, nocc] will separately localize core and valence
152  );
154  void print_charges(double scale = 2.0);
155 
156  // => Knobs <= //
157 
158  void set_print(int print) { print_ = print; }
159  void set_debug(int debug) { debug_ = debug; }
160  void set_bench(int bench) { bench_ = bench; }
161  void set_convergence(double convergence) { convergence_ = convergence; }
162  void set_maxiter(int maxiter) { maxiter_ = maxiter; }
163  void set_use_ghosts(bool use_ghosts) { use_ghosts_ = use_ghosts; }
164  void set_condition(double condition) { condition_ = condition; }
165  void set_power(double power) { power_ = power; }
166  void set_use_stars(bool use_stars) { use_stars_ = use_stars; }
167  void set_stars_completeness(double stars_completeness) { stars_completeness_ = stars_completeness; }
168  void set_stars(const std::vector<int>& stars) { stars_ = stars; }
169 
170 };
171 
172 } // Namespace fisapt
173 
174 } // Namespace psi
175 
176 #endif
std::shared_ptr< Matrix > S_
Overlap matrix in full basis.
Definition: local2.h:95
void build_iaos()
Build the IAOs.
Definition: local2.cc:118
std::vector< int > true_iaos_
Map from non-ghosted IAOs to full IAOs: true_iaos[ind_true] = ind_full.
Definition: local2.h:90
double convergence_
Relative convergence criteria.
Definition: local2.h:56
int debug_
Debug flug.
Definition: local2.h:51
void set_convergence(double convergence)
Definition: local2.h:161
std::vector< int > true_atoms_
Map from non-ghosted to full atoms: true_atoms[ind_true] = ind_full.
Definition: local2.h:88
std::shared_ptr< Matrix > C_
Occupied orbitals, in primary basis.
Definition: local2.h:70
static std::shared_ptr< Matrix > reorder_orbitals(std::shared_ptr< Matrix > F, const std::vector< int > &ranges)
Energy-ordered local orbital permutation [nmo(local) x nmo(ordered)].
Definition: local2.cc:343
virtual ~IBOLocalizer2()
Definition: local2.cc:59
void set_condition(double condition)
Definition: local2.h:164
void set_power(double power)
Definition: local2.h:165
void set_bench(int bench)
Definition: local2.h:160
std::shared_ptr< Matrix > A_
Non-ghosted IAOs in full basis.
Definition: local2.h:97
IBOLocalizer2(std::shared_ptr< BasisSet > primary, std::shared_ptr< BasisSet > minao, std::shared_ptr< Matrix > C)
Definition: local2.cc:43
std::shared_ptr< BasisSet > minao_
MinAO orbital baiss set.
Definition: local2.h:74
static std::map< std::string, std::shared_ptr< Matrix > > localize_task(std::shared_ptr< Matrix > L, const std::vector< std::vector< int > > &minao_inds, const std::vector< std::pair< int, int > > &rot_inds, double convergence, int maxiter, int power)
Localization task (returns U and L)
Definition: local2.cc:237
std::shared_ptr< Matrix > orbital_charges(std::shared_ptr< Matrix > L)
Orbital atomic charges (natom x nmo)
Definition: local2.cc:544
void common_init()
Set defaults.
Definition: local2.cc:62
void set_stars_completeness(double stars_completeness)
Definition: local2.h:167
void set_use_stars(bool use_stars)
Definition: local2.h:166
PsiReturnType fisapt(SharedWavefunction ref_wfn, Options &options)
Definition: fisapt/wrapper.cc:40
void print_charges(double scale=2.0)
Print the charges.
Definition: local2.cc:563
Definition: liboptions.h:360
int bench_
Bench flag.
Definition: local2.h:53
int print_
Print flag.
Definition: local2.h:49
static std::shared_ptr< IBOLocalizer2 > build(std::shared_ptr< BasisSet > primary, std::shared_ptr< BasisSet > minao, std::shared_ptr< Matrix > C, Options &options)
Build IBO with defaults from Options object (including MINAO_BASIS)
Definition: local2.cc:76
int power_
IAO localization power (4 or 2)
Definition: local2.h:65
std::vector< int > iaos_to_atoms_
Map from non-ghosted IAOs to non-ghosted atoms.
Definition: local2.h:92
double condition_
Metric condition for IAO.
Definition: local2.h:67
std::shared_ptr< BasisSet > primary_
Primary orbital basis set.
Definition: local2.h:72
void set_maxiter(int maxiter)
Definition: local2.h:162
std::vector< int > stars_
List of centers for stars.
Definition: local2.h:83
std::map< std::string, std::shared_ptr< Matrix > > localize(std::shared_ptr< Matrix > Cocc, std::shared_ptr< Matrix > Focc, const std::vector< int > &ranges=std::vector< int >())
Localize the orbitals, returns the matrices L [nbf x nmo], U [nmo(dlocal) x nmo(local)], and F [nmo x nmo].
Definition: local2.cc:368
double stars_completeness_
Charge completeness for two-center orbitals.
Definition: local2.h:81
bool use_ghosts_
Use ghost IAOs?
Definition: local2.h:63
Definition: local2.h:42
void set_debug(int debug)
Definition: local2.h:159
virtual void print_header() const
Print out the localization algorithm and parameters.
Definition: local2.cc:105
bool use_stars_
Do stars treatment?
Definition: local2.h:79
void set_use_ghosts(bool use_ghosts)
Definition: local2.h:163
void set_print(int print)
Definition: local2.h:158
void set_stars(const std::vector< int > &stars)
Definition: local2.h:168
int maxiter_
Maximum number of iterations.
Definition: local2.h:58