Skip to content

Commit 0c9192c

Browse files
committed
Merge branch 'develop' of github.com:abacusmodeling/abacus-develop into v2.2.3
2 parents 31eddbf + d494b6d commit 0c9192c

File tree

5 files changed

+27
-16
lines changed

5 files changed

+27
-16
lines changed

source/input.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,7 @@ bool Input::Read(const std::string &fn)
15911591
while (ifs.good())
15921592
{
15931593
ifs >> word1;
1594+
if(ifs.eof() != 0) break;
15941595
strtolower(word1, word); // convert uppercase std::string to lower case; word1 --> word
15951596

15961597
if (strcmp("dftu_type", word) == 0)

source/src_lcao/LCAO_gen_fixedH.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@ void LCAO_gen_fixedH::build_Nonlocal_beta_new(double* HSloc) //update by liuyu 2
11881188
nlm_tot_thread.resize(adjs_all[iat].size());
11891189
#else
11901190
std::vector<std::unordered_map<int,std::vector<double>>> nlm_tot;
1191-
nlm_tot.resize(GlobalC::GridD.getAdjacentNum()+1);
1191+
nlm_tot.resize(adjs_all[iat].size());
11921192
#endif
11931193

11941194
const ModuleBase::Vector3<double> tau0 = atom0->tau[I0];

source/src_pw/vdwd2_parameters.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
Vdwd2_Parameters::Vdwd2_Parameters()
99
{
10-
init_C6();
11-
init_R0();
10+
default_C6();
11+
default_R0();
12+
C6 = C6_default;
13+
R0 = R0_default;
1214
}
1315

1416
void Vdwd2_Parameters::initial_parameters(const Input &input)
@@ -48,6 +50,7 @@ void Vdwd2_Parameters::initset(const UnitCell_pseudo &ucell)
4850

4951
void Vdwd2_Parameters::C6_input(const std::string &file, const std::string &unit)
5052
{
53+
C6 = C6_default;
5154
if( file != "default" )
5255
{
5356
std::ifstream ifs(file);
@@ -73,6 +76,7 @@ void Vdwd2_Parameters::C6_input(const std::string &file, const std::string &unit
7376

7477
void Vdwd2_Parameters::R0_input(const std::string &file, const std::string &unit)
7578
{
79+
R0 = R0_default;
7680
if( file != "default" )
7781
{
7882
std::ifstream ifs(file.c_str());
@@ -94,9 +98,9 @@ void Vdwd2_Parameters::R0_input(const std::string &file, const std::string &unit
9498
}
9599
}
96100

97-
void Vdwd2_Parameters::init_C6()
101+
void Vdwd2_Parameters::default_C6()
98102
{
99-
C6 =
103+
C6_default =
100104
{
101105
{"H", 0.14 },
102106
{"He", 0.08 },
@@ -187,9 +191,9 @@ void Vdwd2_Parameters::init_C6()
187191
};
188192
}
189193

190-
void Vdwd2_Parameters::init_R0()
194+
void Vdwd2_Parameters::default_R0()
191195
{
192-
R0 =
196+
R0_default =
193197
{
194198
{"H", 1.001 },
195199
{"He", 1.012 },

source/src_pw/vdwd2_parameters.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@
1414
class Vdwd2_Parameters
1515
{
1616
public:
17+
bool flag_vdwd2=false;
18+
1719
Vdwd2_Parameters();
1820

19-
void init_C6();
20-
void init_R0();
21+
std::map<std::string,double> C6;
22+
std::map<std::string,double> R0;
23+
2124
void C6_input(const std::string &file, const std::string &unit);
2225
void R0_input(const std::string &file, const std::string &unit);
23-
24-
bool flag_vdwd2;
25-
26-
std::map<std::string,double> C6;
27-
std::map<std::string,double> R0;
28-
26+
2927
double scaling;
3028
double damping;
3129

@@ -35,6 +33,14 @@ class Vdwd2_Parameters
3533

3634
void initset(const UnitCell_pseudo &ucell); //init sets of vdwd2 once this correction is called
3735
void initial_parameters(const Input &input); //initial parameters of Vdwd2 with INPUT file
36+
37+
private:
38+
39+
std::map<std::string,double> C6_default;
40+
std::map<std::string,double> R0_default;
41+
42+
void default_C6();
43+
void default_R0();
3844
};
3945

4046
#endif // define VDWD2_PARAMETERS_H

source/src_pw/vdwd3_parameters.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Vdwd3_Parameters
2424
void init_rcov();
2525
void init_r0ab();
2626

27-
bool flag_vdwd3;
27+
bool flag_vdwd3=false;
2828
bool abc; //third-order term?
2929
double rthr2; //R^2 distance neglect threshold (important for speed in case of large systems) (a.u.)
3030
double cn_thr2; //R^2 distance to cutoff for CN_calculation (a.u.)

0 commit comments

Comments
 (0)