Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions source/source_cell/klist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "source_base/parallel_global.h"
#include "source_base/parallel_reduce.h"
#include "source_cell/module_symmetry/symmetry.h"
#include "source_io/module_unk/berryphase.h"
#include "source_io/module_parameter/parameter.h"

void K_Vectors::cal_ik_global()
Expand Down Expand Up @@ -44,7 +43,8 @@ void K_Vectors::set(const UnitCell& ucell,
const int& nspin_in,
const ModuleBase::Matrix3& reciprocal_vec,
const ModuleBase::Matrix3& latvec,
std::ofstream& ofs)
std::ofstream& ofs,
const bool use_ibz)
{
ModuleBase::TITLE("K_Vectors", "set");

Expand Down Expand Up @@ -99,9 +99,8 @@ void K_Vectors::set(const UnitCell& ucell,


// (2)
// only berry phase need all kpoints including time-reversal symmetry!
// if symm_flag is not set, only time-reversal symmetry would be considered.
if (!berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != -1)
// reduce kpoints to IBZ according to symmetry operations
if (use_ibz)
{
bool match = true;
// calculate kpoints in IBZ and reduce kpoints according to symmetry
Expand Down
4 changes: 3 additions & 1 deletion source/source_cell/klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class K_Vectors
* @param nspin_in The number of spins.
* @param reciprocal_vec The reciprocal vector of the system.
* @param latvec The lattice vector of the system.
* @param use_ibz Whether to reduce k-points to the irreducible Brillouin zone.
*
* @return void
*
Expand All @@ -63,7 +64,8 @@ class K_Vectors
const int& nspin,
const ModuleBase::Matrix3& reciprocal_vec,
const ModuleBase::Matrix3& latvec,
std::ofstream& ofs);
std::ofstream& ofs,
const bool use_ibz);

int get_nks() const
{
Expand Down
2 changes: 0 additions & 2 deletions source/source_cell/test/klist_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#include "source_pw/module_pwdft/vl_pw.h"
#include "source_pw/module_pwdft/vnl_pw.h"
#include "source_pw/module_pwdft/parallel_grid.h"
#include "source_io/module_unk/berryphase.h"
#include "source_io/module_parameter/parameter.h"
#undef private
#include "source_base/mathzone.h"
#include "source_base/parallel_global.h"
#include "source_cell/parallel_kpoints.h"
bool berryphase::berry_phase_flag = false;

pseudo::pseudo()
{
Expand Down
8 changes: 4 additions & 4 deletions source/source_cell/test/klist_test_para.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
#include "source_pw/module_pwdft/vl_pw.h"
#include "source_pw/module_pwdft/vnl_pw.h"
#include "source_pw/module_pwdft/parallel_grid.h"
#include "source_io/module_unk/berryphase.h"
#undef private
bool berryphase::berry_phase_flag = false;

pseudo::pseudo()
{
Expand Down Expand Up @@ -236,7 +234,8 @@ TEST_F(KlistParaTest, Set)
GlobalV::RANK_IN_POOL,
GlobalV::MY_POOL);
ModuleSymmetry::Symmetry::symm_flag = 1;
kv->set(ucell,symm, k_file, kv->nspin, ucell.G, ucell.latvec, GlobalV::ofs_running);
const bool use_ibz = true;
kv->set(ucell, symm, k_file, kv->nspin, ucell.G, ucell.latvec, GlobalV::ofs_running, use_ibz);
EXPECT_EQ(kv->get_nkstot(), 35);
EXPECT_EQ(kv->get_nkstot_full(), 512);
EXPECT_GT(kv->get_nkstot_full(), kv->get_nkstot());
Expand Down Expand Up @@ -353,7 +352,8 @@ TEST_F(KlistParaTest, SetAfterVC)
GlobalV::RANK_IN_POOL,
GlobalV::MY_POOL);
ModuleSymmetry::Symmetry::symm_flag = 1;
kv->set(ucell,symm, k_file, kv->nspin, ucell.G, ucell.latvec, GlobalV::ofs_running);
const bool use_ibz = true;
kv->set(ucell, symm, k_file, kv->nspin, ucell.G, ucell.latvec, GlobalV::ofs_running, use_ibz);
EXPECT_EQ(kv->get_nkstot(), 35);
EXPECT_TRUE(kv->kc_done);
EXPECT_TRUE(kv->kd_done);
Expand Down
3 changes: 2 additions & 1 deletion source/source_esolver/esolver_fp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ void ESolver_FP::before_all_runners(UnitCell& ucell, const Input_para& inp)
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SETUP UNITCELL");

//! 7) setup k points in the Brillouin zone according to symmetry.
this->kv.set(ucell,ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running);
const bool use_ibz = !inp.berry_phase && ModuleSymmetry::Symmetry::symm_flag != -1;
this->kv.set(ucell, ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running, use_ibz);
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS");

//! 8) print information
Expand Down
3 changes: 2 additions & 1 deletion source/source_esolver/esolver_gets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ void ESolver_GetS::before_all_runners(UnitCell& ucell, const Input_para& inp)
}

// 1.3) Setup k-points according to symmetry.
this->kv.set(ucell, ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running);
const bool use_ibz = !inp.berry_phase && ModuleSymmetry::Symmetry::symm_flag != -1;
this->kv.set(ucell, ucell.symm, inp.kpoint_file, inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running, use_ibz);
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS");

ModuleIO::print_parameters(ucell, this->kv, inp);
Expand Down
3 changes: 0 additions & 3 deletions source/source_io/test/for_testing_klist.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#include "source_pw/module_pwdft/vl_pw.h"
#include "source_pw/module_pwdft/vnl_pw.h"
#include "source_pw/module_pwdft/parallel_grid.h"
#include "source_io/module_unk/berryphase.h"

bool berryphase::berry_phase_flag=0;

pseudo::pseudo(){}
pseudo::~pseudo(){}
Expand Down
4 changes: 3 additions & 1 deletion source/source_lcao/module_deepks/test/deepks_test_prep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,15 @@ template <typename T>
void test_deepks<T>::setup_kpt()
{
ModuleSymmetry::Symmetry::symm_flag = -1;
const bool use_ibz = false;
this->kv.set(ucell,
ucell.symm,
PARAM.inp.kpoint_file,
this->nspin,
ucell.G,
ucell.latvec,
GlobalV::ofs_running);
GlobalV::ofs_running,
use_ibz);
}

template class test_deepks<double>;
Expand Down
3 changes: 2 additions & 1 deletion source/source_lcao/module_lr/esolver_lrtd_lcao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,8 @@ LR::ESolver_LR<T, TR>::ESolver_LR(const Input_para& inp, UnitCell& ucell) : inpu
ucell.symm.analy_sys(ucell.lat, ucell.st, ucell.atoms, GlobalV::ofs_running);
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "SYMMETRY");
}
this->kv.set(ucell,ucell.symm, PARAM.inp.kpoint_file, PARAM.inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running);
const bool use_ibz = false;
this->kv.set(ucell, ucell.symm, PARAM.inp.kpoint_file, PARAM.inp.nspin, ucell.G, ucell.latvec, GlobalV::ofs_running, use_ibz);
ModuleBase::GlobalFunc::DONE(GlobalV::ofs_running, "INIT K-POINTS");
ModuleIO::print_parameters(ucell, this->kv, inp);

Expand Down
Loading