7 inline void print_global(
const TR* tlocal,
const int nr,
const int nc,
const std::string name)
10 for (
int i = 0;i < nr;++i)
47 const Tap& ap = apR_isym_irapR.first.first;
48 const TC& R = apR_isym_irapR.first.second;
49 const int& isym = apR_isym_irapR.second.first;
50 const Tap& irap = apR_isym_irapR.second.second.first;
51 const TC& irR = apR_isym_irapR.second.second.second;
52 assert(irR == this->
irs_.
rotate_R(symm, isym, ap.first, ap.second, R));
55 const int irR_hc = irap_hc.
find_R(irR[0], irR[1], irR[2]);
56 if (irR_hc < 0)
continue;
59 const int R_hc = ap_hc.
find_R(R[0], R[1], R[2]);
60 if (R_hc < 0)
continue;
69 for (
int i = 0;i < block.
nr;++i)
70 for (
int j = 0;j < block.
nc;++j)
71 obj[starti + i + (startj + j) * nr] = block(j, i).
real();
75 for (
int i = 0;i < block.
nr;++i)
76 for (
int j = 0;j < block.
nc;++j)
77 obj[starti + i + (startj + j) * nr] = block(j, i);
84 int iat1 = ap_in.first, iat2 = ap_in.second;
88 std::vector<TR> T1, T2;
91 T.resize(atoms[it].nw * atoms[it].nw, 0.0);
92 const int iwstart = atoms[it].
stapos_wf + ia * atoms[it].
nw;
94 while (iw < atoms[it].nw)
96 int l = atoms[it].
iw2l[iw];
108 std::vector<TR> A(atoms[it1].nw * atoms[it2].nw, 0.0);
111 if (abr1 >= 0 && abc2 >= 0)
122 const char notrans =
'N', transpose =
'T', dagger =
'C';
124 std::vector<TR> AT2(atoms[it1].nw * atoms[it2].nw, 0.0);
125 std::vector<TR> TAT(atoms[it1].nw * atoms[it2].nw, 0.0);
129 1.0, A.data(), atoms[it2].
nw, T2.data(), atoms[it2].
nw, 0.0, AT2.data(), atoms[it2].
nw);
131 1.0, T1.data(), atoms[it1].
nw, AT2.data(), atoms[it2].
nw, 0.0, TAT.data(), atoms[it2].
nw);
133 else if (mode ==
'D')
136 1.0, T2.data(), atoms[it2].
nw, A.data(), atoms[it2].
nw, 0.0, AT2.data(), atoms[it1].
nw);
138 1.0, T1.data(), atoms[it1].
nw, AT2.data(), atoms[it1].
nw, 0.0, TAT.data(), atoms[it2].
nw);
140 else throw std::invalid_argument(
"Symmetry_rotation::rotate_atompair_tensor: invalid mode.");
151 iat1 = ap_out.first, iat2 = ap_out.second;
155 iw1start = atoms[it1].
stapos_wf + ia1 * atoms[it1].
nw;
156 iw2start = atoms[it2].
stapos_wf + ia2 * atoms[it2].
nw;
157 if (abr1 >= 0 && abc2 >= 0)
166 template<
typename TR>
171 auto get_irreducible_ijR_info = [&HR_full,
this]() -> std::vector<int>
173 std::vector<int> irreducible_ijR_info;
177 const int iat1 = irap_irR.first.first, iat2 = irap_irR.first.second;
178 irreducible_ijR_info.insert(irreducible_ijR_info.end(), { iat1, iat2, 0 });
180 for (
auto& R : irap_irR.second)
181 if (HR_full.
get_atom_pair(iat1, iat2).find_R(R[0], R[1], R[2]) >= 0)
183 irreducible_ijR_info.insert(irreducible_ijR_info.end(), R.begin(), R.end());
186 irreducible_ijR_info[irreducible_ijR_info.size() - 3 * nR - 1] = nR;
188 return irreducible_ijR_info;
193 const std::vector<int>& irreducible_ijR_info = get_irreducible_ijR_info();
198 const int iat1 = irap_irR.first.first, iat2 = irap_irR.first.second;
201 for (
auto& R : irap_irR.second)
202 if (irap.
find_R(R[0], R[1], R[2]) >= 0)
204 TR* irptr = irap.
get_HR_values(R[0], R[1], R[2]).get_pointer();
205 TR* ptr = ap_full.
get_HR_values(R[0], R[1], R[2]).get_pointer();
213 this->
restore_HR(symm, atoms, st, mode, HR_irreducible, HR_rotated);
215 for (
int iat1 = 0;iat1 < st.
nat;++iat1)
217 for (
int iat2 = 0;iat2 < st.
nat;++iat2)
222 for (
int irR = 0;irR < ap_full.
get_R_size();++irR)
226 const TR* rotated_ptr = ap_rotated.
get_HR_values(R[0], R[1], R[2]).get_pointer();
227 GlobalV::ofs_running <<
"atom pair: (" << iat1 <<
", " << iat2 <<
"), R: (" << R[0] <<
" " << R[1] <<
" " << R[2] <<
")\n";
int nw
Definition atom_spec.h:23
int stapos_wf
Definition atom_spec.h:33
std::vector< int > iw2l
Definition atom_spec.h:20
static void gemm(const char transa, const char transb, const int m, const int n, const int k, const float alpha, const float *a, const int lda, const float *b, const int ldb, const float beta, float *c, const int ldc, base_device::AbacusDevice_t device_type=base_device::AbacusDevice_t::CpuDevice)
Definition blas_connector_matrix.cpp:20
Definition complexmatrix.h:14
int nr
Definition complexmatrix.h:18
matrix real() const
Definition complexmatrix.cpp:265
int nc
Definition complexmatrix.h:19
static void tick(const std::string &class_name_in, const std::string &name_in)
Use twice at a time: the first time, set start_flag to false; the second time, calculate the time dur...
Definition timer.cpp:57
TC rotate_R(const Symmetry &symm, const int isym, const int iat1, const int iat2, const TC &R, const char gauge='R') const
The sub functions to find irreducible sector: {abR}.
Definition irreducible_sector.cpp:5
std::map< Tap, std::set< TC > > irreducible_sector_
whether in 2D plain or not for each symmetry operation
Definition irreducible_sector.h:123
std::map< TapR, std::pair< int, TapR >, apR_less_func > full_map_to_irreducible_sector_
Definition irreducible_sector.h:128
std::vector< std::vector< RI::Tensor< std::complex< double > > > > rotmat_Slm_
the rotation matrix under the basis of S_l^m. size: [nsym][lmax][nm*nm]
Definition symmetry_rotation.h:166
void rotate_atompair_parallel(const TR *Alocal_in, const int isym, const Atom *atoms, const Statistics &st, const Tap &ap_in, const Tap &ap_out, const char mode, const Parallel_Orbitals &pv, TR *Alocal_out, const bool output=false) const
Definition symmetry_rotation_R_hcontainer.hpp:80
std::map< int, std::map< std::pair< int, TC >, RI::Tensor< Tdata > > > restore_HR(const Symmetry &symm, const Atom *atoms, const Statistics &st, const char mode, const std::map< int, std::map< std::pair< int, TC >, RI::Tensor< Tdata > > > &HR_irreduceble) const
Definition symmetry_rotation_R.hpp:40
void test_HR_rotation(const Symmetry &symm, const Atom *atoms, const Statistics &st, const char mode, const std::map< int, std::map< std::pair< int, TC >, RI::Tensor< Tdata > > > &HR_full)
Definition symmetry_rotation_R.hpp:241
RI::Tensor< Tdata > set_rotation_matrix(const Atom &a, const int &isym) const
Definition symmetry_rotation_R.hpp:127
Irreducible_Sector irs_
irreducible sector
Definition symmetry_rotation.h:175
int local2global_col(const int ilc) const
get the global index of a local index (col)
Definition parallel_2d.h:63
int local2global_row(const int ilr) const
get the global index of a local index (row)
Definition parallel_2d.h:57
Definition parallel_orbitals.h:9
int get_col_size() const
dimension getters for 2D-block-cyclic division of Hamiltonian matrix get_col_size() : total number of...
Definition parallel_orbitals.h:76
int get_row_size() const
Definition parallel_orbitals.h:77
std::vector< int > atom_begin_col
Definition parallel_orbitals.h:100
std::vector< int > atom_begin_row
Definition parallel_orbitals.h:99
Definition atom_pair.h:42
BaseMatrix< T > & get_HR_values(int rx_in, int ry_in, int rz_in)
get target BaseMatrix of target cell for const AtomPair, it will return a const BaseMatrix<T> object,...
Definition atom_pair.cpp:393
T * get_pointer(int ir=-1) const
get pointer of value from a submatrix
Definition atom_pair.cpp:844
const Parallel_Orbitals * get_paraV() const
get Parallel_Orbitals pointer of this AtomPair for checking 2d-block parallel
Definition atom_pair.cpp:358
ModuleBase::Vector3< int > get_R_index(const int &index) const
Definition atom_pair.cpp:795
size_t get_R_size() const
Definition atom_pair.h:288
int find_R(const int &rx_in, const int &ry_in, const int &rz_in) const
Definition atom_pair.cpp:441
Definition hcontainer.h:144
void set_zero()
set values of all <IJR> matrix to zero
Definition hcontainer.cpp:210
AtomPair< T > & get_atom_pair(int i, int j) const
return a reference of AtomPair with index of atom I and J in atom_pairs
Definition hcontainer.cpp:353
#define T
Definition exp.cpp:237
std::ofstream ofs_running
Definition global_variable.cpp:38
void TITLE(const std::string &class_name, const std::string &function_name, const bool disable)
Definition tool_title.cpp:18
Definition symm_other.cpp:4
void print_local(const Parallel_Orbitals &pv, const TR *tlocal, const std::string name)
Definition symmetry_rotation_R_hcontainer.hpp:17
void set_block(const int starti, const int startj, const RI::Tensor< std::complex< double > > &block, RI::Tensor< Tdata > &obj_tensor)
Definition symmetry_rotation_R.hpp:116
void print_global(const TR *tlocal, const int nr, const int nc, const std::string name)
Definition symmetry_rotation_R_hcontainer.hpp:7
std::array< int, 3 > TC
Definition irreducible_sector.h:14
void print_atompair_local(const Parallel_Orbitals &pv, const int iat1, const int iat2, const TR *tlocal, const std::string name)
Definition symmetry_rotation_R_hcontainer.hpp:27
std::pair< int, int > Tap
Definition irreducible_sector.h:13
void reduce_all(T &object)
reduce in all process
Definition depend_mock.cpp:14
usefull data and index maps
Definition unitcell_data.h:47
int nat
Definition unitcell_data.h:49
int * iat2it
Definition unitcell_data.h:50
int * iat2ia
Definition unitcell_data.h:51