Repository navigation
Expand file tree
/
Copy pathnormalisation.C
More file actions
572 lines (479 loc) · 20.9 KB
/
Copy pathnormalisation.C
File metadata and controls
572 lines (479 loc) · 20.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
#include <cstring> // for strlen.
#include "read_DO.h"
#include "FreeWilly.h"
#include "fsu_soft/besselj.hpp"
// includes for calculate_norm, point_*
#include "libmesh/fe_base.h"
#include "libmesh/fe_interface.h"
#include "libmesh/fe_compute_data.h"
#include "libmesh/parallel.h"
#include "libmesh/parallel_algebra.h"
#include "libmesh/tensor_value.h"
#include "libmesh/vector_value.h"
#include "libmesh/tensor_tools.h"
using namespace libMesh;
// Functions to get intensities and norms
Number calculate_overlap(EquationSystems& eq_sys, const std::string sys1, int var1, const std::string sys2, int var2 , IntegralType int_type){
//run at all processors at once:
//parallel_object_only(); --> can not be used here.
Number overlap=0;
// this should be checked somehow as well:
//libmesh_assert_not_equal_to(es1.comm(), es2.comm());
//libmesh_assert_not_equal_to(es1.get_dof_map().variable_type(var1),
// es2.get_dof_map().variable_type(var2));
//CondensedEigenSystem& es1=equation_systems.get_system<CondensedEigenSystem> (sys1);
//LinearImplicitSystem & es2 = equation_systems.get_system<LinearImplicitSystem> (sys2);
System & es1 = eq_sys.get_system<System> (sys1);
System & es2 = eq_sys.get_system<System> (sys2);
// Localize the potentially parallel vectors
//UniquePtr<NumericVector<Number> > local_v1 = NumericVector<Number>::build(es1.comm());
//local_v1->init((*es1.solution).size(), true, SERIAL);
//(*es1.solution).localize (*local_v1, es1.get_dof_map().get_send_list());
//UniquePtr<NumericVector<Number> > local_v2 = NumericVector<Number>::build(es2.comm());
//local_v2->init((*es2.solution).size(), true, SERIAL);
//(*es2.solution).localize (*local_v2, es2.get_dof_map().get_send_list());
const std::string & formulation = eq_sys.parameters.get<std::string>("formulation");
Real power=eq_sys.parameters.get<Real> ("power");
const FEType & fe_type = es2.get_dof_map().variable_type(var2);
// Allow space for dims 0-3, even if we don't use them all
std::vector<FEBase *> fe_ptrs(4,libmesh_nullptr);
std::vector<QBase *> q_rules(4,libmesh_nullptr);
const std::set<unsigned char> & elem_dims = es1.get_mesh().elem_dimensions();
// Prepare finite elements for each dimension present in the mesh
for (std::set<unsigned char>::const_iterator d_it = elem_dims.begin(); d_it != elem_dims.end(); ++d_it){
q_rules[*d_it] =fe_type.default_quadrature_rule (*d_it).release();
// Construct finite element object
fe_ptrs[*d_it] = FEBase::build(*d_it, fe_type).release();
// Attach quadrature rule to FE object
fe_ptrs[*d_it]->attach_quadrature_rule (q_rules[*d_it]);
}
std::vector<dof_id_type> dof_indices;
FEBase * cfe = libmesh_nullptr;
// Begin the loop over the elements
MeshBase::const_element_iterator el = es1.get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el = es1.get_mesh().active_local_elements_end();
for ( ; el != end_el; ++el){
const Elem * elem = *el;
const unsigned int dim = elem->dim();
//QGauss qrule (dim, FIFTH);
QGauss qrule (dim, fe_type.default_quadrature_order());
UniquePtr<FEBase> fe (FEBase::build(dim, fe_type));
UniquePtr<FEBase> inf_fe (FEBase::build_InfFE(dim, fe_type));
fe->attach_quadrature_rule (&qrule);
inf_fe->attach_quadrature_rule (&qrule);
if (elem->infinite())
cfe = inf_fe.get();
else
cfe = fe.get();
const std::vector<Real> & JxW = cfe->get_JxW();
const std::vector<Point> & q_point = cfe->get_xyz();
const std::vector<Real>& weight = cfe->get_Sobolev_weight(); // in publication called D
cfe->reinit(elem);
es1.get_dof_map().dof_indices (elem, dof_indices, var1);
//const unsigned int n_qp = qrule.n_points(); --> fails for infinite elements.
unsigned int n_qp = cfe->n_quadrature_points();
const unsigned int n_sf = cast_int<unsigned int>(dof_indices.size());
// Begin the loop over the Quadrature points.
for (unsigned int qp=0; qp<n_qp; qp++){
Number u_h = 0.;
Number v_h = 0.;
Point mapped_qp = FEInterface::inverse_map(dim, fe_type, elem, q_point[qp], TOLERANCE, true);
FEComputeData fe_data(eq_sys, mapped_qp);
FEInterface::compute_data(dim, fe_type, elem, fe_data);
for (unsigned int i=0; i != n_sf; ++i){
//Use FEComputeData because with infinite elements the value at q_point[i][qp]
// is not just phi[i][qp].
if(formulation=="symmetric"){
u_h += sqrt(weight[qp])* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
v_h += sqrt(weight[qp])* fe_data.shape[i] * (*es2.solution)(dof_indices[i]);
}
else if(formulation=="root"){
u_h += sqrt(sqrt(weight[qp]))* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
v_h += sqrt(sqrt(weight[qp]))* fe_data.shape[i] * (*es2.solution)(dof_indices[i]);
}
else if(formulation=="power"){
u_h += pow(weight[qp],power)* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
v_h += pow(weight[qp],power)* fe_data.shape[i] * (*es2.solution)(dof_indices[i]);
}
else{
u_h += fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
v_h += fe_data.shape[i] * (*es2.solution)(dof_indices[i]);
}
}
//out<<"later: "<<q_point[qp];
//out<<" "<<u_h<<std::endl;
//norm += JxW[qp] * TensorTools::norm_sq(u_h);
if(int_type==LENGTH)
// this expression is wrong:
overlap += JxW[qp] * std::conj(u_h) * q_point[qp].norm() * v_h* 0.;
else //if(int_type==OVERLAP)
overlap += JxW[qp] * std::conj(u_h) * v_h;
}
}
// Need to delete the FE and quadrature objects to prevent a memory leak
for(unsigned int i=0; i<fe_ptrs.size(); i++){
if(fe_ptrs[i])
{
delete fe_ptrs[i];
}
}
for(unsigned int i=0; i<q_rules.size(); i++){
if(q_rules[i])
{
delete q_rules[i];
}
}
es1.comm().sum(overlap);
//overlap = std::sqrt(overlap);
return overlap;
}
Real overlap_DO(EquationSystems& eq_sys, const std::string sys1, int var1, IntegralType int_type, bool infinite){
//run at all processors at once:
//parallel_object_only(); --> can not be used here.
Number overlap_x=0;
Number overlap_y=0;
Number overlap_z=0;
Number overlap=0;
// this should be checked somehow as well:
//libmesh_assert_not_equal_to(es1.comm(), es2.comm());
//libmesh_assert_not_equal_to(es1.get_dof_map().variable_type(var1),
// es2.get_dof_map().variable_type(var2));
//CondensedEigenSystem& es1=equation_systems.get_system<CondensedEigenSystem> (sys1);
//LinearImplicitSystem & es2 = equation_systems.get_system<LinearImplicitSystem> (sys2);
System & es1 = eq_sys.get_system<System> (sys1);
// Localize the potentially parallel vectors
//UniquePtr<NumericVector<Number> > local_v1 = NumericVector<Number>::build(es1.comm());
//local_v1->init((*es1.solution).size(), true, SERIAL);
//(*es1.solution).localize (*local_v1, es1.get_dof_map().get_send_list());
// get the dyson orbital:
DOrbit dyson (eq_sys.parameters.get<std::string>("DO_file"));
const std::string & formulation = eq_sys.parameters.get<std::string>("formulation");
Real power=eq_sys.parameters.get<Real> ("power");
const FEType & fe_type = es1.get_dof_map().variable_type(var1);
std::vector<dof_id_type> dof_indices;
FEBase * cfe = libmesh_nullptr;
// Begin the loop over the elements
MeshBase::const_element_iterator el = es1.get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el = es1.get_mesh().active_local_elements_end();
for(; el != end_el; ++el){
const Elem * elem = *el;
const unsigned int dim = elem->dim();
// skip infinite elements if inf
if (!infinite && elem->infinite())
continue;
//QGauss qrule (dim, FIFTH);
QGauss qrule (dim, fe_type.default_quadrature_order());
UniquePtr<FEBase> fe (FEBase::build(dim, fe_type));
UniquePtr<FEBase> inf_fe (FEBase::build_InfFE(dim, fe_type));
fe->attach_quadrature_rule (&qrule);
inf_fe->attach_quadrature_rule (&qrule);
if (elem->infinite())
cfe = inf_fe.get();
else
cfe = fe.get();
const std::vector<Real> & JxW = cfe->get_JxW();
const std::vector<Point> & q_point = cfe->get_xyz();
const std::vector<Real>& weight = cfe->get_Sobolev_weight(); // in publication called D
cfe->reinit(elem);
es1.get_dof_map().dof_indices (elem, dof_indices, var1);
//const unsigned int n_qp = qrule.n_points(); --> fails for infinite elements.
unsigned int n_qp = cfe->n_quadrature_points();
const unsigned int n_sf = cast_int<unsigned int>(dof_indices.size());
// Begin the loop over the Quadrature points.
for (unsigned int qp=0; qp<n_qp; qp++){
Number u_h = 0.;
Number do_val=dyson.evalDO(q_point[qp]);
Point mapped_qp = FEInterface::inverse_map(dim, fe_type, elem, q_point[qp], TOLERANCE, true);
FEComputeData fe_data(eq_sys, mapped_qp);
FEInterface::compute_data(dim, fe_type, elem, fe_data);
for (unsigned int i=0; i != n_sf; ++i){
//Use FEComputeData because with infinite elements the value at q_point[i][qp]
// is not just phi[i][qp].
if(formulation=="symmetric")
u_h += sqrt(weight[qp])* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else if(formulation=="root")
u_h += sqrt(sqrt(weight[qp]))* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else if(formulation=="power")
u_h += pow(weight[qp],power)* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else
u_h += fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
}
//norm += JxW[qp] * TensorTools::norm_sq(u_h);
if(int_type==LENGTH)
{
overlap_x += JxW[qp] * std::conj(u_h) * q_point[qp](0) * do_val;
overlap_y += JxW[qp] * std::conj(u_h) * q_point[qp](1) * do_val;
overlap_z += JxW[qp] * std::conj(u_h) * q_point[qp](2) * do_val;
//overlap += JxW[qp] * std::conj(do_val) * q_point[qp].norm() * do_val;
}
else //if(int_type==OVERLAP)
overlap+= JxW[qp] * std::conj(u_h) * do_val;
//overlap += JxW[qp] * std::conj(do_val) * do_val;
}
}
if(int_type==LENGTH)
{
overlap=overlap_x*conj(overlap_x)+
overlap_y*conj(overlap_y)+
overlap_z*conj(overlap_z);
}
else if (int_type==VELOCITY)
{
overlap=overlap_x*conj(overlap_x)+
overlap_y*conj(overlap_y)+
overlap_z*conj(overlap_z) ;
}
else
overlap*=conj(overlap);
es1.comm().sum(overlap);
// abs is needed here to avoid compiler errors.
return std::abs(overlap);
}
Number norm_DO(EquationSystems& eq_sys, bool infinite){
//run at all processors at once:
//parallel_object_only(); --> can not be used here.
Number overlap=0;
System & es = eq_sys.get_system<System> ("EigenSE");
// get the dyson orbital:
DOrbit dyson (eq_sys.parameters.get<std::string>("DO_file"));
const FEType & fe_type = es.get_dof_map().variable_type(0);
FEBase * cfe = libmesh_nullptr;
// Begin the loop over the elements
MeshBase::const_element_iterator el = es.get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el = es.get_mesh().active_local_elements_end();
for(; el != end_el; ++el){
const Elem * elem = *el;
const unsigned int dim = elem->dim();
// skip infinite elements if inf
if (!infinite && elem->infinite())
continue;
QGauss qrule (dim, FIFTH);
//QGauss qrule (dim, fe_type.default_quadrature_order());
UniquePtr<FEBase> fe (FEBase::build(dim, fe_type));
UniquePtr<FEBase> inf_fe (FEBase::build_InfFE(dim, fe_type));
fe->attach_quadrature_rule (&qrule);
inf_fe->attach_quadrature_rule (&qrule);
if (elem->infinite())
cfe = inf_fe.get();
else
cfe = fe.get();
const std::vector<Real> & JxW = cfe->get_JxW();
const std::vector<Point> & q_point = cfe->get_xyz();
cfe->reinit(elem);
//const unsigned int n_qp = qrule.n_points(); --> fails for infinite elements.
unsigned int n_qp = cfe->n_quadrature_points();
// Begin the loop over the Quadrature points.
for (unsigned int qp=0; qp<n_qp; qp++){
Number do_val=dyson.evalDO(q_point[qp]);
overlap += JxW[qp] * TensorTools::norm_sq(do_val);
}
}
es.comm().sum(overlap);
return overlap;
}
Real normalise(EquationSystems& equation_systems, bool infel){
//normalise eigen_system:
//Number norm_phi=calculate_overlap(equation_systems, "EigenSE", 0, "EigenSE", 0, OVERLAP);
//out<<"norm of phi: ";
//out<< sqrt(norm_phi) <<std::endl;
//compute <DO| mu |phi>
Real overlap = overlap_DO(equation_systems, "EigenSE", 0, LENGTH, infel);
// abs needed for type conversion.
return overlap; ///std::abs((norm_phi*conj(norm_phi)));
}
// functions used to project solution onto spherical waves
void Y_lm(Real x, Real y, Real z, int l_max, std::vector<Number>& solution){
//http://www.ppsloan.org/publications/StupidSH36.pdf
//12.5663706144=4*pi
solution.resize((l_max+1)*(l_max+1));
Real K_lm;
Real** value= new Real*[l_max+1];
// memory for value is allocated in pm_polynomial_value()!
//for(int m=0; m<=l_max; m++)
// value[m]=new Real[l_max+1];
double r=sqrt(x*x+y*y+z*z),
phival=0;
double theta[1];
if( r<1e-12){
theta[0]=0;
phival=0;
}
else{
theta[0]=z/r;
phival=atan2(y,x); //-pi -> pi
}
//value = p_polynomial_value(1, l, theta );
// value is not normalised!
for(int m=0; m<=l_max; m++){
// this is against the convention in QM: for m>0 && m%2==1
// it should have the negative of it; I don't care at this point.
value[m] = pm_polynomial_value ( 1, l_max, m, theta);
}
int k=0;
for(int l=0; l<=l_max; l++){
for(int m=-l; m<=l; m++){
K_lm=sqrt((2*l+1)*factorial(l-abs(m))/(12.5663706144*factorial(l+abs(m))));
solution[k]=value[abs(m)][l]*K_lm*Number(cos(m*phival),sin(m*phival));
k++;
}
}
for(int m=0; m<=l_max; m++)
delete [] value[m];
delete [] value;
}
void evalSphWave(int l_max, Point qp, Real k, std::vector<Number>& solution){
int error;
Number wave;
Real* R = new Real[l_max+1];
solution.resize((l_max+1)*(l_max+1));
std::vector<Number> angular;
//angular.resize((l_max+1)*(l_max+1));
Real kr=qp.norm()*k;
rjbesl(kr, 0 ,l_max+1, R, error);
assert(error>=0);
if (error!=l_max+1){
err<<"The evaluation of bessel functions returned"<<std::endl;
err<<" "<<error<<std::endl;
if ( 0 > qp.norm()*k )
err<<" qp.norm*k < 0"<<std::endl;
if ( qp.norm()*k > 1e+04 )
err<<" qp.norm*k > x_max "<<std::endl;
}
Y_lm(qp(0), qp(1), qp(2), l_max, angular);
int j=0;
for(int l=0; l<=l_max; l++){
for(int m=-l; m<=l; m++){
if(error< l)
//when the besselfunction did not converge.
solution[j]=0;
else
solution[j]=R[l]*angular[j];
if(solution[j]!=solution[j]){
err<<"!! "<<R[l]<<" "<<angular[j]<<" "<<j<<std::endl;
}
j++;
}
}
delete [] R;
}
void projection(EquationSystems& es, const std::string sys, int l_max, std::vector<Number>& overlap ){
// this should be checked somehow as well:
//libmesh_assert_not_equal_to(es1.comm(), es2.comm());
//libmesh_assert_not_equal_to(es1.get_dof_map().variable_type(var1),
// es2.get_dof_map().variable_type(var2));
//CondensedEigenSystem& es1=equation_systems.get_system<CondensedEigenSystem> (sys1);
//LinearImplicitSystem & es2 = equation_systems.get_system<LinearImplicitSystem> (sys2);
System & es1 = es.get_system<System> (sys);
std::vector<Number> spherical_qp;
//std::vector<Number> overlap;
std::vector<Number> normSphere;
overlap.resize((l_max+1)*(l_max+1));
normSphere.resize((l_max+1)*(l_max+1));
Number norm=0;
//Number norm2=0;
Real k = std::abs(es.parameters.get<Number>("momentum"));
const std::string & formulation = es.parameters.get<std::string>("formulation");
Real power=es.parameters.get<Real> ("power");
// Localize the potentially parallel vectors
//UniquePtr<NumericVector<Number> > local_v1 = NumericVector<Number>::build(es1.comm());
//local_v1->init((*es1.solution).size(), true, SERIAL);
//(*es1.solution).localize (*local_v1, es1.get_dof_map().get_send_list());
const FEType & fe_type = es1.get_dof_map().variable_type(0);
std::vector<dof_id_type> dof_indices;
FEBase * cfe = libmesh_nullptr;
// Begin the loop over the elements
MeshBase::const_element_iterator el = es1.get_mesh().active_local_elements_begin();
const MeshBase::const_element_iterator end_el = es1.get_mesh().active_local_elements_end();
for(; el != end_el; ++el){
const Elem * elem = *el;
const unsigned int dim = elem->dim();
// skip infinite elements
if (elem->infinite())
continue;
//QGauss qrule (dim, FIFTH);
QGauss qrule (dim, fe_type.default_quadrature_order());
UniquePtr<FEBase> fe (FEBase::build(dim, fe_type));
UniquePtr<FEBase> inf_fe (FEBase::build_InfFE(dim, fe_type));
fe->attach_quadrature_rule (&qrule);
inf_fe->attach_quadrature_rule (&qrule);
if (elem->infinite())
cfe = inf_fe.get();
else
cfe = fe.get();
const std::vector<Real> & JxW = cfe->get_JxW();
const std::vector<Point> & q_point = cfe->get_xyz();
const std::vector<Real>& weight = cfe->get_Sobolev_weight(); // in publication called D
cfe->reinit(elem);
es1.get_dof_map().dof_indices (elem, dof_indices, 0);
//const unsigned int n_qp = qrule.n_points(); --> fails for infinite elements.
unsigned int n_qp = cfe->n_quadrature_points();
const unsigned int n_sf = cast_int<unsigned int>(dof_indices.size());
// Begin the loop over the Quadrature points.
for (unsigned int qp=0; qp<n_qp; qp++){
Number u_h = 0.;
evalSphWave(l_max, q_point[qp], k, spherical_qp);
Point mapped_qp = FEInterface::inverse_map(dim, fe_type, elem, q_point[qp], TOLERANCE, true);
FEComputeData fe_data(es, mapped_qp);
FEInterface::compute_data(dim, fe_type, elem, fe_data);
for (unsigned int i=0; i != n_sf; ++i){
//Use FEComputeData because with infinite elements the value at q_point[i][qp]
// is not just phi[i][qp].
if(formulation=="symmetric")
u_h += sqrt(weight[qp])* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else if(formulation=="root")
u_h += sqrt(sqrt(weight[qp]))* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else if(formulation=="power")
u_h += pow(weight[qp],power)* fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
else
u_h += fe_data.shape[i] * (*es1.solution)(dof_indices[i]);
}
int j=0;
for(int l=0; l<=l_max; l++){
for(int m=-l; m<=l; m++){
overlap[j]+= JxW[qp] * std::conj(u_h) * spherical_qp[j];
normSphere[j]+=JxW[qp] * std::conj(spherical_qp[j]) * spherical_qp[j];
j++;
}
}
norm += JxW[qp] * TensorTools::norm_sq(u_h);
}
}
int j=0;
for(int l=0; l<=l_max; l++){
for(int m=-l; m<=l; m++){
overlap[j]=overlap[j]/(sqrt(normSphere[j])*sqrt(norm));
es1.comm().sum(overlap[j]);
j++;
}
}
//return overlap;
}
void ProjectSphericals (EquationSystems& es, int l_max, int /*i*/){
Number norm_phi=calculate_overlap(es, "EigenSE", 0, "EigenSE", 0, OVERLAP);
norm_phi=sqrt(norm_phi*conj(norm_phi));
Number tot_proj=0, this_proj;
int m;
libmesh_assert_greater(l_max,0);
std::vector<Number> contributions;
projection(es,"EigenSE", l_max, contributions);
// make some nice output:
out<<"====================================";
out<<std::endl;
int k=0;
for( int l=0; l<=l_max; l++){
for(m=-l; m<=l; m++){
this_proj=contributions[k];
tot_proj+=this_proj*conj(this_proj);
out<<"| l = "<<l<<" ";
out<<" m = "<<m<<" ";
k++;
out<<" \t"<<this_proj<<" ";
out<<"\t|"<<std::endl;
}
out<<std::endl;
}
out<<"|| Total: ";
out<<sqrt(tot_proj)<<" |"<<std::endl;
out<<"====================================";
out<<std::endl<<std::endl;
}