Repository navigation
Expand file tree
/
Copy pathORB_atomic.cpp
More file actions
83 lines (72 loc) · 2.02 KB
/
Copy pathORB_atomic.cpp
File metadata and controls
83 lines (72 loc) · 2.02 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
#include "ORB_atomic.h"
#include "source_io/module_parameter/parameter.h"
Numerical_Orbital_AtomRelation Numerical_Orbital::NOAR;
Numerical_Orbital::Numerical_Orbital()
{
// make std::pair of new and delete
// question remains
this->rcut = 0.0;
this->max_nchi = 0;
this->type = 0;
}
Numerical_Orbital::~Numerical_Orbital()
{
}
void Numerical_Orbital::set_orbital_info(const int& type_in,
const std::string& label_in,
const int& lmax_in,
const int* nchi_in,
const int& total_nchi_in)
{
ModuleBase::TITLE("Numerical_Orbital", "set_type_info");
// (1) set type,label,lmax
this->type = type_in;
this->label = label_in;
this->lmax = lmax_in;
// (2) set nchi and total nchi.
this->nchi.resize(this->lmax + 1);
for (int i = 0; i < this->lmax + 1; i++)
{
this->nchi[i] = nchi_in[i];
}
// we need this to generate numerical_orbital_lm.
if (total_nchi_in < 0 || total_nchi_in > 500)
{
ModuleBase::WARNING_QUIT("Numerical_Orbital::init", "total_nchi < 0 or > 500");
}
else
{
this->total_nchi = total_nchi_in;
}
// (3) set the rcut and check the rcut
this->rcut = 0.0;
for (int i = 0; i < total_nchi_in; i++)
{
this->rcut = this->phiLN[i].rcut;
for (int j = 0; j < total_nchi_in; j++)
{
assert(rcut == this->phiLN[j].rcut);
}
}
assert(rcut > 0.0);
// (4) set max_nchi
this->max_nchi = 0;
for (int L = 0; L < lmax + 1; L++)
{
max_nchi = std::max(max_nchi, nchi[L]);
}
// (8) set find_chi
assert(lmax + 1 > 0);
this->find_chi.create(lmax + 1, max_nchi);
int ichi = 0;
for (int L = 0; L <= lmax; ++L)
{
for (int N = 0; N < nchi[L]; ++N)
{
find_chi(L, N) = ichi;
++ichi;
}
}
assert(ichi == total_nchi);
return;
}