ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
tmp_mocks.h
Go to the documentation of this file.
1#ifndef MODULE_HCONTAINER_TMP_MOCKS_H
2#define MODULE_HCONTAINER_TMP_MOCKS_H
3
5
6// Minimal definitions of the UnitCell/Atom members that the hcontainer tests
7// need. They live in a header and are `inline` so that every test target can
8// include them without dragging in source_cell; the real implementations are
9// linked by the production binary.
10
11inline Atom::Atom() {}
12inline Atom::~Atom() {}
13
16
17inline Magnetism::Magnetism() {}
18inline Magnetism::~Magnetism() {}
19
20inline pseudo::pseudo() {}
21inline pseudo::~pseudo() {}
22
23inline UnitCell::UnitCell() {}
24inline UnitCell::~UnitCell() {}
25
26inline SepPot::SepPot() {}
27inline SepPot::~SepPot() {}
28inline Sep_Cell::Sep_Cell() noexcept {}
29inline Sep_Cell::~Sep_Cell() noexcept {}
30
31inline void Atom::set_index()
32{
33 // Minimal mock: every orbital has (iw, l, m) = identity index. The
34 // angular-momentum kernel only inspects iw2l (l of each orbital block),
35 // which assemble_angular_momentum computes from l_nchi directly, so the
36 // other maps need to exist but can be zero-filled.
37 iw2l.assign(nw, 0);
38 iw2m.assign(nw, 0);
39 iw2n.assign(nw, 0);
40 iw2_ylm.assign(nw, 0);
41 iw2_new.assign(nw, false);
42}
43
44inline void UnitCell::set_iat2itia()
45{
46 // Minimal mock: populate the forward (it, ia) -> iat lookup together with
47 // the reverse iat -> it / iat -> ia vectors. Used by itiaiw2iwt inside
48 // assemble_angular_momentum and by get_tau / cal_dtau.
49 iat2it.resize(nat);
50 iat2ia.resize(nat);
51 itia2iat.create(ntype, namax);
52 int iat = 0;
53 for (int it = 0; it < ntype; ++it)
54 {
55 for (int ia = 0; ia < atoms[it].na; ++ia)
56 {
57 itia2iat(it, ia) = iat;
58 iat2it[iat] = it;
59 iat2ia[iat] = ia;
60 ++iat;
61 }
62 }
63}
64
65inline void UnitCell::set_iat2iwt(const int &npol_in)
66{
67 this->iat2iwt.resize(this->nat);
68 this->npol = npol_in;
69 int iat = 0;
70 int iwt = 0;
71 for (int it = 0; it < this->ntype; it++)
72 {
73 for (int ia = 0; ia < atoms[it].na; ia++)
74 {
75 this->iat2iwt[iat] = iwt;
76 iwt += atoms[it].nw * this->npol;
77 ++iat;
78 }
79 }
80 return;
81}
82
83#endif
~Atom_pseudo()
Definition atom_pseudo.cpp:11
Atom_pseudo()
Definition atom_pseudo.cpp:7
std::vector< int > iw2_ylm
use iw to find ylm index
Definition atom_spec.h:34
std::vector< int > iw2m
use iw to find m
Definition atom_spec.h:31
int nw
number of local orbitals (l,n,m) of this type
Definition atom_spec.h:36
~Atom()
Destructor.
Definition atom_spec.cpp:13
Atom()
Constructor.
Definition atom_spec.cpp:9
std::vector< int > iw2l
use iw to find L
Definition atom_spec.h:33
std::vector< int > iw2n
use iw to find n
Definition atom_spec.h:32
void set_index()
Set index arrays.
Definition atom_spec.cpp:17
std::vector< bool > iw2_new
use iw to find new flag
Definition atom_spec.h:35
Magnetism()
Constructor.
Definition magnetism.cpp:8
~Magnetism()
Destructor.
Definition magnetism.cpp:16
SepPot()
Definition symm_rho_soc_test.cpp:39
~SepPot()
Definition symm_rho_soc_test.cpp:40
~Sep_Cell() noexcept
Definition symm_rho_soc_test.cpp:42
Sep_Cell() noexcept
Definition symm_rho_soc_test.cpp:41
~UnitCell()
Definition symm_rho_soc_test.cpp:36
int ntype
number of atom species in UnitCell
Definition unitcell.h:154
Atom * atoms
Definition unitcell.h:165
std::vector< int > iat2iwt
iat ==> iwt, the first global index for orbital of this atom
Definition unitcell.h:272
UnitCell()
Definition symm_rho_soc_test.cpp:35
std::vector< int > iat2ia
iat==>ia
Definition unitcell.h:157
void set_iat2iwt(const int &npol_in)
Definition mock_unitcell.cpp:9
ModuleBase::IntArray itia2iat
(it, ia)==>iat, the index in nat (add 2009-3-2 by mohan)
Definition unitcell.h:160
void set_iat2itia()
Definition mock_unitcell.cpp:23
int nat
total number of atoms of all species in unitcell
Definition unitcell.h:155
int namax
the max na among all atom species
Definition unitcell.h:161
std::vector< int > iat2it
iat==>it, distinguish a atom belong to which type
Definition unitcell.h:156
int npol
Definition unitcell.h:273
~pseudo()
Definition symm_rho_soc_test.cpp:30
pseudo()
Definition symm_rho_soc_test.cpp:29