v2DM-DOCI  1.0
LocalMinimizer.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Copyright (C) 2014-2015 Ward Poelmans
5  *
6  * This file is part of v2DM-DOCI.
7  *
8  * v2DM-DOCI is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * Foobar is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * @END LICENSE
22  */
23 
24 #ifndef LOCALMINIMIZER_H
25 #define LOCALMINIMIZER_H
26 
27 #include <memory>
28 #include <vector>
29 #include <tuple>
30 #include <random>
31 
32 #include "Method.h"
33 #include "Hamiltonian.h"
34 #include "UnitaryMatrix.h"
35 #include "OrbitalTransform.h"
36 
37 namespace doci2DM {
38  class PotentialReduction;
39  class BoundaryPoint;
40 }
41 
42 namespace simanneal {
43 
45 {
46  public:
48 
50 
51  virtual ~LocalMinimizer();
52 
53  int Minimize(bool dist_choice=false, int start_iters=0);
54 
55  double get_energy() const;
56 
57  double calc_new_energy();
58 
59  double calc_new_energy(const CheMPS2::Hamiltonian &);
60 
61  void calc_energy();
62 
64 
66 
68 
69  doci2DM::Method& getMethod() const;
70 
71  void UseBoundaryPoint();
72 
73  void UsePotentialReduction();
74 
76 
78 
79  std::vector<std::tuple<int,int,double,double>> scan_orbitals();
80 
81  double get_conv_crit() const;
82 
83  void set_conv_crit(double);
84 
85  void set_conv_steps(int);
86 
87  int choose_orbitalpair(std::vector<std::tuple<int,int,double,double>> &);
88 
89  int Minimize_noOpt(double stopcrit);
90 
91  int Minimize_hybrid();
92 
93  private:
94 
96  double conv_crit;
97 
98  double energy;
99 
102 
103  std::unique_ptr<doci2DM::Method> method;
104 
106  std::unique_ptr<CheMPS2::Hamiltonian> ham;
107 
109  std::unique_ptr<simanneal::OrbitalTransform> orbtrans;
110 
112  std::unique_ptr<simanneal::UnitaryMatrix> opt_unitary;
113 
115  std::mt19937 mt;
116 
118  std::vector<int> allow_irreps;
119 };
120 
121 }
122 
123 #endif /* LOCALMINIMIZER_H */
124 
125 /* vim: set ts=3 sw=3 expandtab :*/
std::unique_ptr< simanneal::OrbitalTransform > orbtrans
the actual orbital transform
std::vector< std::tuple< int, int, double, double > > scan_orbitals()
int conv_steps
number of steps in convergence area
OrbitalTransform & getOrbitalTf() const
int Minimize_noOpt(double stopcrit)
simanneal::UnitaryMatrix & get_Optimal_Unitary()
doci2DM::BoundaryPoint & getMethod_BP() const
std::unique_ptr< CheMPS2::Hamiltonian > ham
Holds the current hamiltonian.
double conv_crit
criteria for convergence of the minimizer
std::unique_ptr< simanneal::UnitaryMatrix > opt_unitary
the current unitary
LocalMinimizer(const CheMPS2::Hamiltonian &)
doci2DM::PotentialReduction & getMethod_PR() const
int Minimize(bool dist_choice=false, int start_iters=0)
CheMPS2::Hamiltonian & getHam() const
std::vector< int > allow_irreps
only rotation within these irreps (if not empty)
int choose_orbitalpair(std::vector< std::tuple< int, int, double, double >> &)
doci2DM::Method & getMethod() const
std::unique_ptr< doci2DM::Method > method
std::mt19937 mt
our pseudo-random generator