Skip to content

Commit b8b8d74

Browse files
authored
Merge pull request #1194 from dyzheng/v2.2.3
Feature: added optional value "-1" for variable "symmetry" for no time-reversal symmetry
2 parents c3aa985 + 419e001 commit b8b8d74

File tree

18 files changed

+37
-23
lines changed

18 files changed

+37
-23
lines changed

docs/input-main.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ This part of variables are used to control general system parameters.
158158
#### symmetry
159159

160160
- **Type**: Integer
161-
- **Description**: takes value 0 and 1, if set to 1, symmetry analysis will be performed to determine the type of Bravais lattice and associated symmetry operations.
161+
- **Description**: takes value 1, 0 and -1.
162+
- if set to 1, symmetry analysis will be performed to determine the type of Bravais lattice and associated symmetry operations. (point groups only)
163+
- if set to 0, only time reversal symmetry would be considered in symmetry operations, which implied k point and -k point would be treated as one double weight k point.
164+
- if set to -1, any symmetry will not be considered.
162165
- **Default**: 0
163166

164167
#### kpar

source/input.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void Input::Default(void)
177177
ks_solver = "default"; // xiaohui add 2013-09-01
178178
search_radius = -1.0; // unit: a.u. -1.0 has no meaning.
179179
search_pbc = true;
180-
symmetry = false;
180+
symmetry = 0;
181181
init_vel = false;
182182
symmetry_prec = 1.0e-5; // LiuXh add 2021-08-12, accuracy for symmetry
183183
cal_force = 0;
@@ -2015,7 +2015,7 @@ void Input::Bcast()
20152015
Parallel_Common::bcast_double(search_radius);
20162016
Parallel_Common::bcast_bool(search_pbc);
20172017
Parallel_Common::bcast_double(search_radius);
2018-
Parallel_Common::bcast_bool(symmetry);
2018+
Parallel_Common::bcast_int(symmetry);
20192019
Parallel_Common::bcast_bool(init_vel); // liuyu 2021-07-14
20202020
Parallel_Common::bcast_double(symmetry_prec); // LiuXh add 2021-08-12, accuracy for symmetry
20212021
Parallel_Common::bcast_int(cal_force);
@@ -2451,7 +2451,7 @@ void Input::Check(void)
24512451
else if (calculation == "md" || calculation == "sto-md") // mohan add 2011-11-04
24522452
{
24532453
GlobalV::CALCULATION = calculation;
2454-
symmetry = false;
2454+
symmetry = 0;
24552455
cal_force = 1;
24562456
if (mdp.md_nstep == 0)
24572457
{

source/input.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ class Input
4646

4747
bool init_vel; // read velocity from STRU or not liuyu 2021-07-14
4848

49-
bool symmetry; // turn on symmetry or not
49+
/* symmetry level:
50+
-1, no symmetry at all;
51+
0, only basic time reversal would be considered;
52+
1, point group symmetry would be considered*/
53+
int symmetry;
5054
double symmetry_prec; // LiuXh add 2021-08-12, accuracy for symmetry
5155
int kpar; // ecch pool is for one k point
5256

source/input_conv.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ void Input_Conv::Convert(void)
373373

374374
if (GlobalC::exx_global.info.hybrid_type != Exx_Global::Hybrid_Type::No)
375375
{
376+
//EXX case, convert all EXX related variables
376377
GlobalC::exx_global.info.hybrid_alpha = INPUT.exx_hybrid_alpha;
377378
XC_Functional::get_hybrid_alpha(INPUT.exx_hybrid_alpha);
378379
GlobalC::exx_global.info.hse_omega = INPUT.exx_hse_omega;
@@ -406,6 +407,9 @@ void Input_Conv::Convert(void)
406407
Exx_Abfs::Jle::Lmax = INPUT.exx_opt_orb_lmax;
407408
Exx_Abfs::Jle::Ecut_exx = INPUT.exx_opt_orb_ecut;
408409
Exx_Abfs::Jle::tolerence = INPUT.exx_opt_orb_tolerence;
410+
411+
//EXX does not support any symmetry analyse, force symmetry setting to -1
412+
ModuleSymmetry::Symmetry::symm_flag = -1;
409413
}
410414
#endif
411415
#endif

source/module_elecstate/test/updaterhok_pw_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ struct ENVPrepare
120120
std::string latname_;
121121
int ntype_;
122122
double pseudo_rcut_;
123-
bool symm_flag_;
123+
int symm_flag_;
124124
std::string kpoint_card_;
125125
int nspin_;
126126
bool gamma_only_;
@@ -155,7 +155,7 @@ struct ENVPrepare
155155
latname_ = "sc";
156156
ntype_ = 1;
157157
pseudo_rcut_ = 15.0;
158-
symm_flag_ = false;
158+
symm_flag_ = 0;
159159
kpoint_card_ = "./support/KPT";
160160
nspin_ = 1;
161161
gamma_only_ = false;

source/module_elecstate/test/updaterhok_pw_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "module_pw/pw_basis_k.h"
2828
#include "src_parallel/parallel_pw.h"
2929

30-
bool ModuleSymmetry::Symmetry::symm_flag;
30+
int ModuleSymmetry::Symmetry::symm_flag;
3131

3232
LCAO_Orbitals::LCAO_Orbitals(){}
3333
LCAO_Orbitals::~LCAO_Orbitals(){}

source/module_esolver/esolver_ks_lcao_elec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ namespace ModuleESolver
516516
}
517517

518518
// add by jingan
519-
if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag == 0)
519+
if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1)
520520
{
521521
berryphase bp(this->LOWF);
522522
bp.Macroscopic_polarization(this->psi);

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ namespace ModuleESolver
771771
// Do a Berry phase polarization calculation if required
772772
//=======================================================
773773

774-
if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag == 0)
774+
if (berryphase::berry_phase_flag && ModuleSymmetry::Symmetry::symm_flag != 1)
775775
{
776776
berryphase bp;
777777
bp.Macroscopic_polarization(this->psi);

source/module_symmetry/symmetry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Symmetry::~Symmetry()
2222
}
2323

2424

25-
bool Symmetry::symm_flag=false;
25+
int Symmetry::symm_flag=0;
2626

2727

2828
void Symmetry::analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_running)

source/module_symmetry/symmetry.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@ class Symmetry : public Symmetry_Basic
1313
Symmetry();
1414
~Symmetry();
1515

16-
// mohan add 2021-02-21
17-
static bool symm_flag;
16+
//symmetry flag for levels
17+
//-1 : no symmetry at all, k points would be total nks in KPT
18+
//0 : only basic time-reversal symmetry is considered, point k and -k would fold to k
19+
//1 : point group symmetry is considered
20+
static int symm_flag;
1821

1922
void analy_sys(const UnitCell_pseudo &ucell, std::ofstream &ofs_running);
2023
bool available;

0 commit comments

Comments
 (0)