Skip to content

Commit

Permalink
rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanWRh committed Jun 5, 2024
1 parent 311874c commit 1c5da6f
Show file tree
Hide file tree
Showing 18 changed files with 29 additions and 29 deletions.
10 changes: 5 additions & 5 deletions source/module_elecstate/module_dm/density_matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void DensityMatrix<TK, TR>::init_DMR(const hamilt::HContainer<TRShift>& DMR_in)
const int iat2 = DMR_in.get_atom_pair(iap).get_atom_j();
for(int ir = 0;ir<DMR_in.get_atom_pair(iap).get_R_size();ir++)
{
const ModuleBase::Vector3<int>& R_index = DMR_in.get_atom_pair(iap).get_R_index(ir);
const ModuleBase::Vector3<int> R_index = DMR_in.get_atom_pair(iap).get_R_index(ir);
hamilt::AtomPair<TR> tmp_ap(iat1, iat2, R_index, paraV_);
tmp_DMR->insert_pair(tmp_ap);
}
Expand Down Expand Up @@ -417,7 +417,7 @@ void DensityMatrix<TK,TR>::cal_DMR_test()
}
for (int ir = 0; ir < tmp_ap.get_R_size(); ++ir)
{
const ModuleBase::Vector3<int>& r_index = tmp_ap.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = tmp_ap.get_R_index(ir);
hamilt::BaseMatrix<TR>* tmp_matrix = tmp_ap.find_matrix(r_index);
#ifdef __DEBUG
if (tmp_matrix == nullptr)
Expand Down Expand Up @@ -484,7 +484,7 @@ void DensityMatrix<std::complex<double>, double>::cal_DMR()
}
for (int ir = 0; ir < tmp_ap.get_R_size(); ++ir)
{
const ModuleBase::Vector3<int>& r_index = tmp_ap.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = tmp_ap.get_R_index(ir);
hamilt::BaseMatrix<double>* tmp_matrix = tmp_ap.find_matrix(r_index);
#ifdef __DEBUG
if (tmp_matrix == nullptr)
Expand Down Expand Up @@ -644,7 +644,7 @@ void DensityMatrix<double, double>::cal_DMR()
throw std::string("Atom-pair not belong this process");
}
// R index
const ModuleBase::Vector3<int>& r_index = tmp_ap.get_R_index(0);
const ModuleBase::Vector3<int> r_index = tmp_ap.get_R_index(0);
#ifdef __DEBUG
assert(tmp_ap.get_R_size() == 1);
assert(r_index.x == 0 && r_index.y == 0 && r_index.z == 0);
Expand Down Expand Up @@ -695,7 +695,7 @@ void DensityMatrix<TK, TR>::sum_DMR_spin()
hamilt::AtomPair<TR>& tmp_ap_down = tmp_DMR_down->get_atom_pair(i);
for (int ir = 0; ir < tmp_ap_up.get_R_size(); ++ir)
{
const ModuleBase::Vector3<int>& r_index = tmp_ap_up.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = tmp_ap_up.get_R_index(ir);
hamilt::BaseMatrix<double>* tmp_matrix_up = tmp_ap_up.find_matrix(r_index);
hamilt::BaseMatrix<double>* tmp_matrix_down = tmp_ap_down.find_matrix(r_index);
TR* ptr_up = tmp_matrix_up->get_pointer();
Expand Down
4 changes: 2 additions & 2 deletions source/module_esolver/io_npz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ void ESolver_KS_LCAO<TK, TR>::output_mat_npz(std::string& zipname, const hamilt:
for(int iR=0;iR<HR_serial[0].get_atom_pair(iap).get_R_size();++iR)
{
auto& matrix = HR_serial[0].get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = HR_serial[0].get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = HR_serial[0].get_atom_pair(iap).get_R_index(iR);
filename = "mat_"+std::to_string(atom_i)+"_"+std::to_string(atom_j)+"_"
+std::to_string(r_index.x)+"_"+std::to_string(r_index.y)+"_"+std::to_string(r_index.z);
std::vector<size_t> shape = {(size_t)row_size,(size_t)col_size};
Expand All @@ -472,7 +472,7 @@ void ESolver_KS_LCAO<TK, TR>::output_mat_npz(std::string& zipname, const hamilt:
for(int iR=0;iR<hR.get_atom_pair(iap).get_R_size();++iR)
{
auto& matrix = hR.get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = hR.get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = hR.get_atom_pair(iap).get_R_index(iR);

filename = "mat_"+std::to_string(atom_i)+"_"+std::to_string(atom_j)+"_"
+std::to_string(r_index.x)+"_"+std::to_string(r_index.y)+"_"+std::to_string(r_index.z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void hamilt::OverlapNew<hamilt::OperatorLCAO<TK, TR>>::calculate_SR()

for (int iR = 0; iR < tmp.get_R_size(); ++iR)
{
const ModuleBase::Vector3<int>& R_index = tmp.get_R_index(iR);
const ModuleBase::Vector3<int> R_index = tmp.get_R_index(iR);
auto dtau = ucell->cal_dtau(iat1, iat2, R_index);
TR* data_pointer = tmp.get_pointer(iR);
this->cal_SR_IJR(iat1, iat2, paraV, dtau, data_pointer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void TDEkinetic<OperatorLCAO<TK, TR>>::initialize_HR_tmp(const Parallel_Orbitals
hamilt::AtomPair<TR>& tmp = this->hR->get_atom_pair(i);
for(int ir = 0;ir < tmp.get_R_size(); ++ir )
{
const ModuleBase::Vector3<int>& R_index = tmp.get_R_index(ir);
const ModuleBase::Vector3<int> R_index = tmp.get_R_index(ir);
const int iat1 = tmp.get_atom_i();
const int iat2 = tmp.get_atom_j();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void hamilt::TDNonlocal<hamilt::OperatorLCAO<TK, TR>>::initialize_HR_tmp(const P
hamilt::AtomPair<TR>& tmp = this->hR->get_atom_pair(i);
for(int ir = 0;ir < tmp.get_R_size(); ++ir )
{
const ModuleBase::Vector3<int>& R_index = tmp.get_R_index(ir);
const ModuleBase::Vector3<int> R_index = tmp.get_R_index(ir);
const int iat1 = tmp.get_atom_i();
const int iat2 = tmp.get_atom_j();

Expand Down
6 changes: 3 additions & 3 deletions source/module_hamilt_lcao/hamilt_lcaodft/spar_hsr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void sparse_format::cal_HContainer_d(
for(int iR=0;iR<hR.get_atom_pair(iap).get_R_size();++iR)
{
auto& matrix = hR.get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = hR.get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = hR.get_atom_pair(iap).get_R_index(iR);
Abfs::Vector3_Order<int> dR(r_index.x, r_index.y, r_index.z);
for(int i=0;i<row_size;++i)
{
Expand Down Expand Up @@ -194,7 +194,7 @@ void sparse_format::cal_HContainer_cd(
for(int iR=0;iR<hR.get_atom_pair(iap).get_R_size();++iR)
{
auto& matrix = hR.get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = hR.get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = hR.get_atom_pair(iap).get_R_index(iR);
Abfs::Vector3_Order<int> dR(r_index.x, r_index.y, r_index.z);
for(int i=0;i<row_size;++i)
{
Expand Down Expand Up @@ -238,7 +238,7 @@ void sparse_format::cal_HContainer_td(
for(int iR=0;iR<hR.get_atom_pair(iap).get_R_size();++iR)
{
auto& matrix = hR.get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = hR.get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = hR.get_atom_pair(iap).get_R_index(iR);
Abfs::Vector3_Order<int> dR(r_index.x, r_index.y, r_index.z);
for(int i=0;i<row_size;++i)
{
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_gint/gint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ void Gint::transfer_DM2DtoGrid(std::vector<hamilt::HContainer<double>*> DM2D)
int iat2 = ap.get_atom_j();
for(int ir = 0;ir<ap.get_R_size();++ir)
{
const ModuleBase::Vector3<int>& r_index = ap.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = ap.get_R_index(ir);
for (int is = 0; is < 4; is++)
{
tmp_pointer[is] = this->DMRGint[is]->find_matrix(iat1, iat2, r_index)->get_pointer();
Expand Down
4 changes: 2 additions & 2 deletions source/module_hamilt_lcao/module_hcontainer/atom_pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ std::tuple<std::vector<int>, T*> AtomPair<T>::get_matrix_values(int ir) const

// interface for get (rx, ry, rz) of index-th R-index in this->R_index, the return should be ModuleBase::Vector3<int>
template <typename T>
ModuleBase::Vector3<int> & AtomPair<T>::get_R_index(const int& index) const
ModuleBase::Vector3<int> AtomPair<T>::get_R_index(const int& index) const
{
if (index >= R_index.size() || index < 0)
{
Expand All @@ -803,7 +803,7 @@ ModuleBase::Vector3<int> & AtomPair<T>::get_R_index(const int& index) const
}

template <typename T>
ModuleBase::Vector3<int> & AtomPair<T>::get_R_index() const
ModuleBase::Vector3<int> AtomPair<T>::get_R_index() const
{
// return the ModuleBase::Vector3<int> of R_index[index]
return R_index[current_R];
Expand Down
4 changes: 2 additions & 2 deletions source/module_hamilt_lcao/module_hcontainer/atom_pair.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class AtomPair
BaseMatrix<T>& get_HR_values(const int& index) const;

// interface for get (rx, ry, rz) of index-th R-index in this->R_index, the return should be ModuleBase::Vector3<int>
ModuleBase::Vector3<int> & get_R_index(const int& index) const;
ModuleBase::Vector3<int> get_R_index(const int& index) const;
// interface for get (rx, ry, rz) of current_R, the return should be ModuleBase::Vector3<int>
ModuleBase::Vector3<int> & get_R_index() const;
ModuleBase::Vector3<int> get_R_index() const;
// interface for search (rx, ry, rz) in this->R_index, if found, current_R would be set to index
int find_R(const int& rx_in, const int& ry_in, const int& rz_in) const;
int find_R(const ModuleBase::Vector3<int>& R_in) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void folding_HR(const hamilt::HContainer<TR>& hR,
hamilt::AtomPair<TR>& tmp = hR.get_atom_pair(i);
for(int ir = 0;ir < tmp.get_R_size(); ++ir )
{
const ModuleBase::Vector3<int>& r_index = tmp.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = tmp.get_R_index(ir);
// cal k_phase
// if TK==std::complex<double>, kphase is e^{ikR}
const ModuleBase::Vector3<double> dR(r_index.x, r_index.y, r_index.z);
Expand Down
6 changes: 3 additions & 3 deletions source/module_hamilt_lcao/module_hcontainer/hcontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ size_t HContainer<T>::size_R_loop() const
*/
for (int iR = 0; iR < it->get_R_size(); iR++)
{
const ModuleBase::Vector3<int>& r_vec = it->get_R_index(iR);
const ModuleBase::Vector3<int> r_vec = it->get_R_index(iR);
int it_tmp = this->find_R(r_vec);
if (it_tmp == -1)
{
Expand Down Expand Up @@ -689,7 +689,7 @@ void HContainer<T>::shape_synchron( const HContainer<T>& other)
{
for(int ir = 0;ir < other.atom_pairs[i].get_R_size();++ir)
{
const ModuleBase::Vector3<int>& R_vec = other.atom_pairs[i].get_R_index(ir);
const ModuleBase::Vector3<int> R_vec = other.atom_pairs[i].get_R_index(ir);
if(tmp_pointer->find_R(R_vec) != -1)
{
// do nothing
Expand Down Expand Up @@ -726,7 +726,7 @@ std::vector<int> HContainer<T>::get_ijr_info() const
// loop R
for (int ir = 0; ir < number_R; ++ir)
{
const ModuleBase::Vector3<int>& R_vec = this->atom_pairs[i].get_R_index(ir);
const ModuleBase::Vector3<int> R_vec = this->atom_pairs[i].get_R_index(ir);
ijr_info.push_back(R_vec.x);
ijr_info.push_back(R_vec.y);
ijr_info.push_back(R_vec.z);
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_hcontainer/hcontainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ namespace hamilt
* // loop R-index
* for (int iR = 0; iR < atom_ij.size_R(); iR++)
* {
* const ModuleBase::Vector3<int>& r_index = atom_ij.get_R_index(iR);
* const ModuleBase::Vector3<int> r_index = atom_ij.get_R_index(iR);
* auto tmp_matrix = atom_ij.get_HR_values(r_index.x, r_index.y, r_index.z);
* // do something with tmp_matrix
* ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ TEST_F(HContainerTest, size_atom_pairs)
EXPECT_EQ(HR->get_atom_pair(0).get_atom_j(), 1);
EXPECT_EQ(HR->get_atom_pair(0).get_row_size(), 2);
EXPECT_EQ(HR->get_atom_pair(0).get_col_size(), 2);
const ModuleBase::Vector3<int>& R_ptr = HR->get_atom_pair(0).get_R_index();
const ModuleBase::Vector3<int> R_ptr = HR->get_atom_pair(0).get_R_index();
EXPECT_EQ(R_ptr.x, 1);
EXPECT_EQ(R_ptr.y, 0);
EXPECT_EQ(R_ptr.z, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ TEST_F(HContainerTest, size_atom_pairs)
EXPECT_EQ(HR->get_atom_pair(0).get_atom_j(), 1);
EXPECT_EQ(HR->get_atom_pair(0).get_row_size(), 2);
EXPECT_EQ(HR->get_atom_pair(0).get_col_size(), 2);
const ModuleBase::Vector3<int>& R_ptr = HR->get_atom_pair(0).get_R_index();
const ModuleBase::Vector3<int> R_ptr = HR->get_atom_pair(0).get_R_index();
EXPECT_EQ(R_ptr.x, 1);
EXPECT_EQ(R_ptr.y, 0);
EXPECT_EQ(R_ptr.z, 0);
Expand Down
2 changes: 1 addition & 1 deletion source/module_hamilt_lcao/module_hcontainer/transfer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ void HTransSerial<T>::cal_ap_indexes(int irank, std::vector<int>* ap_indexes)
// loop of R
for (int k = 0; k < atom_pair.get_R_size(); k++)
{
const ModuleBase::Vector3<int>& r_index = atom_pair.get_R_index(k);
const ModuleBase::Vector3<int> r_index = atom_pair.get_R_index(k);
// rx
*data++ = r_index.x;
// ry
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/fR_overlap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ void FR_overlap<T>::calculate_FR()

for (int iR = 0; iR < tmp.get_R_size(); ++iR)
{
const ModuleBase::Vector3<int>& R_index = tmp.get_R_index(iR);
const ModuleBase::Vector3<int> R_index = tmp.get_R_index(iR);
ModuleBase::Vector3<int> R_vector(R_index);
auto dtau = ucell->cal_dtau(iat1, iat2, R_vector) * ucell->lat0;
T* data_pointer = tmp.get_pointer(iR);
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/td_current_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void ModuleIO::cal_tmp_DM(elecstate::DensityMatrix<std::complex<double>, double>
}
for (int ir = 0; ir < tmp_ap.get_R_size(); ++ir)
{
const ModuleBase::Vector3<int>& r_index = tmp_ap.get_R_index(ir);
const ModuleBase::Vector3<int> r_index = tmp_ap.get_R_index(ir);
hamilt::BaseMatrix<double>* tmp_matrix = tmp_ap.find_matrix(r_index);
#ifdef __DEBUG
if (tmp_matrix == nullptr)
Expand Down
2 changes: 1 addition & 1 deletion source/module_io/to_wannier90_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ void toWannier90_LCAO::unkdotkb(
for(int iR = 0; iR < tmp_FR_container->get_atom_pair(iap).get_R_size(); ++iR)
{
auto& matrix = tmp_FR_container->get_atom_pair(iap).get_HR_values(iR);
const ModuleBase::Vector3<int>& r_index = tmp_FR_container->get_atom_pair(iap).get_R_index(iR);
const ModuleBase::Vector3<int> r_index = tmp_FR_container->get_atom_pair(iap).get_R_index(iR);
ModuleBase::Vector3<double> dR = ModuleBase::Vector3<double>(r_index.x, r_index.y, r_index.z) * GlobalC::ucell.latvec;
double phase = ikb_car * dR * ModuleBase::TWO_PI;
std::complex<double> kRn_phase = std::exp(ModuleBase::IMAG_UNIT * phase);
Expand Down

0 comments on commit 1c5da6f

Please sign in to comment.