ergo
Step.h
Go to the documentation of this file.
1 /* Ergo, version 3.3, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2013 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 
36 #ifndef PUR_STEP
37 #define PUR_STEP
38 #include <limits>
39 namespace pur {
40 
41  template<typename Treal>
42  struct Step {
43  typedef Treal real;
44 
45  int poly;
46  real alpha;
53  real traceX;
54  real traceX2;
61  size_t nnzX;
62  size_t nnzX2;
67  Step() {}
68  Step(int const poly, real const alpha,
69  mat::Interval<real> eig_homo,
70  mat::Interval<real> eig_lumo,
71  real traceX,
72  real traceX2,
73  real chosen_thresh,
74  real actual_thresh,
75  size_t nnzX,
76  size_t nnzX2,
77  double wall_sec_thresh,
78  double wall_sec_square,
79  double wall_sec_XmX2norm,
80  double wall_sec_total)
81  : poly(poly), alpha(alpha),
82  eig_homo(eig_homo), eig_lumo(eig_lumo),
83  eig_homo_orig(eig_homo), eig_lumo_orig(eig_lumo),
84  traceX(traceX), traceX2(traceX2),
85  chosen_thresh(chosen_thresh),
86  actual_thresh(actual_thresh),
87  nnzX(nnzX), nnzX2(nnzX2),
88  wall_sec_thresh(wall_sec_thresh),
89  wall_sec_square(wall_sec_square),
90  wall_sec_XmX2norm(wall_sec_XmX2norm),
91  wall_sec_total(wall_sec_total) {}
92 
93  void propagate_homo_to_previous(Step<real> & previous) const;
94  void propagate_lumo_to_previous(Step<real> & previous) const;
95  }; // end struct Step
96 
97  template<typename Treal>
98  void Step<Treal>::
100  mat::Interval<real> zeroOneInt(0.0,1.0);
101  mat::Interval<real> homo = eig_homo;
102  homo.increase( actual_thresh );
103  homo.intersect_always_non_empty(zeroOneInt);
104  homo.invPuriStep(poly, alpha);
105  previous.eig_homo.intersect_always_non_empty(homo);
106  }
107  template<typename Treal>
108  void Step<Treal>::
110  mat::Interval<real> zeroOneInt(0.0,1.0);
111  mat::Interval<real> lumo = eig_lumo;
112  lumo.increase( actual_thresh );
113  lumo.intersect_always_non_empty(zeroOneInt);
114  lumo.invPuriStep(poly, alpha);
115  previous.eig_lumo.intersect_always_non_empty(lumo);
116  }
117 
118 
119 } // end namespace pur
120 #endif
real traceX
Definition: Step.h:53
Treal real
Definition: Step.h:43
mat::Interval< real > eig_homo
Interval containing the HOMO eigenvalue of X.
Definition: Step.h:47
Step()
Definition: Step.h:67
int poly
The step just taken, 0 for x*x and 1 for 2*x-x*x.
Definition: Step.h:45
size_t nnzX
Definition: Step.h:61
double wall_sec_square
Definition: Step.h:64
real traceX2
Definition: Step.h:54
void increase(Treal const value)
Increases interval with value in both directions.
Definition: Interval.h:131
double wall_sec_thresh
Definition: Step.h:63
void propagate_homo_to_previous(Step< real > &previous) const
Definition: Step.h:99
double wall_sec_XmX2norm
Definition: Step.h:65
void propagate_lumo_to_previous(Step< real > &previous) const
Definition: Step.h:109
void invPuriStep(int poly)
Definition: Interval.h:269
double wall_sec_total
Definition: Step.h:66
mat::Interval< real > eig_lumo
Interval containing the LUMO eigenvalue of X.
Definition: Step.h:49
real chosen_thresh
Definition: Step.h:55
Definition: Step.h:42
mat::Interval< real > eig_homo_orig
Original interval.
Definition: Step.h:51
size_t nnzX2
Definition: Step.h:62
mat::Interval< real > eig_lumo_orig
Original interval.
Definition: Step.h:52
real actual_thresh
If the matrix has been truncated, the error inflicted measured by the spectral norm.
Definition: Step.h:56
void intersect_always_non_empty(Interval const &other)
Definition: Interval.h:78
real alpha
Scaling parameter just before the step just taken.
Definition: Step.h:46
Step(int const poly, real const alpha, mat::Interval< real > eig_homo, mat::Interval< real > eig_lumo, real traceX, real traceX2, real chosen_thresh, real actual_thresh, size_t nnzX, size_t nnzX2, double wall_sec_thresh, double wall_sec_square, double wall_sec_XmX2norm, double wall_sec_total)
Definition: Step.h:68
Definition: Purification_scaled.h:44