Skip to content

Commit

Permalink
fix after rebase 0730
Browse files Browse the repository at this point in the history
  • Loading branch information
maki49 committed Jul 30, 2024
1 parent fa66fae commit fe4a6b5
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 54 deletions.
13 changes: 0 additions & 13 deletions source/module_base/scalapack_connector.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,6 @@ class ScalapackConnector
B, &IB, &JB, DESCB, &beta, C, &IC, &JC, DESCC);
}

static inline
void gemm(
const char transa, const char transb,
const int M, const int N, const int K,
const double alpha,
const double* A, const int IA, const int JA, const int* DESCA,
const double* B, const int IB, const int JB, const int* DESCB,
const double beta,
double* C, const int IC, const int JC, const int* DESCC)
{
pdgemm_(&transa, &transb, &M, &N, &K, &alpha, A, &IA, &JA, DESCA,
B, &IB, &JB, DESCB, &beta, C, &IC, &JC, DESCC);
}
static inline
void getrf(
const int M, const int N,
Expand Down
10 changes: 5 additions & 5 deletions source/module_cell/klist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry& symm,
{
//if it's a new ibz kpoint.
//nkstot_ibz indicate the index of ibz kpoint.
this->kvec_d_ibz[nkstot_ibz] = kvec_d[i];
kvec_d_ibz[nkstot_ibz] = kvec_d[i];
// output in kpoints file
ibz_index[i] = nkstot_ibz;

Expand Down Expand Up @@ -938,11 +938,11 @@ void K_Vectors::ibz_kpoint(const ModuleSymmetry::Symmetry& symm,
{
kvec_rot = kvec_d[i] * kgmatrix[j];
restrict_kpt(kvec_rot);
for (int k = 0; k < this->nkstot_ibz; ++k)
for (int k = 0; k < nkstot_ibz; ++k)
{
if (symm.equal(kvec_rot.x, this->kvec_d_ibz[k].x) &&
symm.equal(kvec_rot.y, this->kvec_d_ibz[k].y) &&
symm.equal(kvec_rot.z, this->kvec_d_ibz[k].z))
if (symm.equal(kvec_rot.x, kvec_d_ibz[k].x) &&
symm.equal(kvec_rot.y, kvec_d_ibz[k].y) &&
symm.equal(kvec_rot.z, kvec_d_ibz[k].z))
{
isym = j;
exist_number = k;
Expand Down
37 changes: 18 additions & 19 deletions source/module_cell/klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class K_Vectors
{
public:
public:
std::vector<ModuleBase::Vector3<double>> kvec_c; /// Cartesian coordinates of k points
std::vector<ModuleBase::Vector3<double>> kvec_d; /// Direct coordinates of k points

Expand All @@ -26,7 +26,6 @@ class K_Vectors
/// dim: [iks_ibz][(isym, kvec_d)]
std::vector<std::map<int, ModuleBase::Vector3<double>>> kstars;


K_Vectors();
~K_Vectors();
K_Vectors& operator=(const K_Vectors&) = default;
Expand All @@ -52,11 +51,11 @@ class K_Vectors
* @note Only available for nspin = 1 or 2 or 4.
*/
void set(const ModuleSymmetry::Symmetry& symm,
const std::string& k_file_name,
const int& nspin,
const ModuleBase::Matrix3& reciprocal_vec,
const ModuleBase::Matrix3& latvec,
std::ofstream& ofs);
const std::string& k_file_name,
const int& nspin,
const ModuleBase::Matrix3& reciprocal_vec,
const ModuleBase::Matrix3& latvec,
std::ofstream& ofs);

/**
* @brief Generates irreducible k-points in the Brillouin zone considering symmetry operations.
Expand All @@ -72,10 +71,10 @@ class K_Vectors
* @param match A boolean flag that indicates if the results matches the real condition.
*/
void ibz_kpoint(const ModuleSymmetry::Symmetry& symm,
bool use_symm,
std::string& skpt,
const UnitCell& ucell,
bool& match);
bool use_symm,
std::string& skpt,
const UnitCell& ucell,
bool& match);
// LiuXh add 20180515

/**
Expand Down Expand Up @@ -114,11 +113,11 @@ class K_Vectors
* @return int Returns the global index of the k-point.
*
* @note The function calculates the global index by dividing the total number of k-points (nkstot) by the number of
* process pools (KPAR), and adding the remainder if the process pool ID (MY_POOL) is less than the remainder.
* @note The function is declared as inline for efficiency.
*/
inline int getik_global(const int& ik) const;

<<<<<<< HEAD
int get_nks() const
{
return this->nks;
Expand Down Expand Up @@ -154,11 +153,11 @@ class K_Vectors
this->nkstot_full = value;
}

/// dim: [iks_ibz][(isym, kvec_d)]
std::vector<std::map<int, ModuleBase::Vector3<double>>> kstars;

private:
>>>>>>> 627516392 (symmetry rotation for EXX)
int nks; // number of symmetry-reduced k points in this pool(processor, up+dw)
int nkstot; /// number of symmetry-reduced k points in full k mesh
int nkstot_full; /// number of k points before symmetry reduction in full k mesh

int nspin;
bool kc_done;
bool kd_done;
Expand Down Expand Up @@ -283,8 +282,8 @@ class K_Vectors
* be recalculated.
*/
void update_use_ibz(const int& nkstot_ibz,
const std::vector<ModuleBase::Vector3<double>>& kvec_d_ibz,
const std::vector<double>& wk_ibz);
const std::vector<ModuleBase::Vector3<double>>& kvec_d_ibz,
const std::vector<double>& wk_ibz);

/**
* @brief Sets both the direct and Cartesian k-vectors.
Expand Down Expand Up @@ -405,4 +404,4 @@ inline int K_Vectors::getik_global(const int& ik) const
}
}

#endif // KVECT_H
#endif // KVECT_H
2 changes: 1 addition & 1 deletion source/module_io/input_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ void Input_Conv::Convert()
GlobalC::exx_info.info_global.separate_loop = PARAM.inp.exx_separate_loop;
GlobalC::exx_info.info_global.hybrid_step = PARAM.inp.exx_hybrid_step;
GlobalC::exx_info.info_global.mixing_beta_for_loop1 = PARAM.inp.exx_mixing_beta;
GlobalC::exx_info.info_global.exx_symmetry_realspace = INPUT.exx_symmetry_realspace;
GlobalC::exx_info.info_global.exx_symmetry_realspace = PARAM.inp.exx_symmetry_realspace;
GlobalC::exx_info.info_lip.lambda = PARAM.inp.exx_lambda;

GlobalC::exx_info.info_ri.real_number = std::stoi(PARAM.inp.exx_real_number);
Expand Down
10 changes: 4 additions & 6 deletions source/module_ri/Exx_LRI_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,13 @@ void Exx_LRI_Interface<T, Tdata>::exx_eachiterinit(const elecstate::DensityMatri
if (!GlobalC::exx_info.info_global.separate_loop && this->two_level_step)
{
const bool flag_restart = (iter == 1) ? true : false;
if (this->exx_spacegroup_symmetry)
this->mix_DMk_2D.mix(symrot_.restore_dm(kv, dm.get_DMK_vector(), *dm.get_paraV_pointer()), flag_restart);
else
this->mix_DMk_2D.mix(dm.get_DMK_vector(), flag_restart);
if (this->exx_spacegroup_symmetry) { this->mix_DMk_2D.mix(symrot_.restore_dm(kv, dm.get_DMK_vector(), *dm.get_paraV_pointer()), flag_restart); }
else { this->mix_DMk_2D.mix(dm.get_DMK_vector(), flag_restart); }
const std::vector<std::map<int,std::map<std::pair<int, std::array<int, 3>>,RI::Tensor<Tdata>>>>
Ds = GlobalV::GAMMA_ONLY_LOCAL
? RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_gamma_out(), *dm.get_paraV_pointer(), GlobalV::NSPIN)
: RI_2D_Comm::split_m2D_ktoR<Tdata>(*this->exx_ptr->p_kv, this->mix_DMk_2D.get_DMk_k_out(), *dm.get_paraV_pointer(), GlobalV::NSPIN, this->exx_spacegroup_symmetry);
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.symmetry_rotate_realspace) { this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer(), &this->symrot_); }
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace) { this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer(), &this->symrot_); }
else { this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer()); }
}
}
Expand Down Expand Up @@ -216,7 +214,7 @@ bool Exx_LRI_Interface<T, Tdata>::exx_after_converge(
// this->symrot_.test_HR_rotation(GlobalC::ucell.symm, GlobalC::ucell.atoms, GlobalC::ucell.st, 'H', *(dynamic_cast<hamilt::HamiltLCAO<T, double>*>(&hamilt)->getHR()));
// exit(0);

if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.symmetry_rotate_realspace)
if (this->exx_spacegroup_symmetry && GlobalC::exx_info.info_global.exx_symmetry_realspace)
{
this->exx_ptr->cal_exx_elec(Ds, *dm.get_paraV_pointer(), &this->symrot_);
// this->symrot_.print_HR(this->exx_ptr->Hexxs[0], "Hexxs_irreducible"); // test
Expand Down
6 changes: 3 additions & 3 deletions source/module_ri/exx_symmetry/symmetry_rotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ namespace ModuleSymmetry
};
std::vector<std::vector<std::complex<double>>> dm_k_full;
int nspin0 = GlobalV::NSPIN == 2 ? 2 : 1;
dm_k_full.reserve(kv.nkstot_full * nspin0); //nkstot_full didn't doubled by spin
int nk = kv.nkstot / nspin0;
dm_k_full.reserve(kv.get_nkstot_full() * nspin0); //nkstot_full didn't doubled by spin
int nk = kv.get_nkstot() / nspin0;
for (int is = 0;is < nspin0;++is)
for (int ik_ibz = 0;ik_ibz < nk;++ik_ibz)
for (auto& isym_kvd : kv.kstars[ik_ibz])
Expand All @@ -116,7 +116,7 @@ namespace ModuleSymmetry
/*
std::ofstream ofs("DM.dat");
int ik = 0;
for (int ikibz = 0;ikibz < kv.nkstot / nspin0;++ikibz)
for (int ikibz = 0;ikibz < kv.get_nkstot() / nspin0;++ikibz)
for (auto& isym_kvd : kv.kstars[ikibz])
{
ofs << "isym=" << isym_kvd.first << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,7 @@ class SymmetryRotationTest : public testing::Test
int myrank, dsize;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank);
MPI_Comm_size(MPI_COMM_WORLD, &dsize);
pv.set_block_size(1);
pv.set_proc_dim(dsize);
pv.mpi_create_cart(MPI_COMM_WORLD);
std::ofstream ofs;
pv.set_local2global(matsize, matsize, ofs, ofs);
pv.set_desc(matsize, matsize, pv.get_row_size());
pv.set_global2local(matsize, matsize, true, ofs);
pv.init(matsize, matsize, 1, MPI_COMM_WORLD);
}
ModuleBase::Matrix3 C41 = ModuleBase::Matrix3(0, 1, 0, -1, 0, 0, 0, 0, 1);
std::vector<std::complex<double>> wigerD_p_C41_ref = { ModuleBase::IMAG_UNIT, 0, 0, 0, 1, 0, 0, 0, -ModuleBase::IMAG_UNIT };
Expand Down

0 comments on commit fe4a6b5

Please sign in to comment.