Skip to content

Commit 2df3712

Browse files
19helloFei Yangmohanchen
authored
remove vector<vector> in bfgs and remove const number (#6613)
* fix relax_method parameter bug * remove vector<vector> in bfgs and remove const number * remove vector<vector> in bfgs and remove const number --------- Co-authored-by: Fei Yang <[email protected]> Co-authored-by: Mohan Chen <[email protected]>
1 parent 5da1df7 commit 2df3712

File tree

28 files changed

+144
-143
lines changed

28 files changed

+144
-143
lines changed

source/source_cell/module_neighbor/test/prepare_unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class UcellTestPrepare
9898
}
9999
//lattice info
100100
ucell->lat0 = this->lat0;
101-
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
101+
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
102102
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
103103
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
104104
ucell->latvec.e11 = this->latvec[0];

source/source_cell/read_atom_species.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ bool read_lattice_constant(std::ifstream& ifa,
150150
{
151151
ModuleBase::WARNING_QUIT("read_atom_species","Lattice constant <= 0.0");
152152
}
153-
lat0_angstrom = lat0 * 0.529177;
153+
lat0_angstrom = lat0 * ModuleBase::BOHR_TO_A;
154154
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Bohr)",lat0);
155155
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Angstrom)",lat0_angstrom);
156156
lat.tpiba = ModuleBase::TWO_PI / lat0;

source/source_cell/read_atoms.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,39 +414,39 @@ bool unitcell::read_atom_positions(UnitCell& ucell,
414414
}
415415
else if(Coordinate=="Cartesian_angstrom")
416416
{
417-
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0;
417+
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0;
418418
}
419419
else if(Coordinate=="Cartesian_angstrom_center_xy")
420420
{
421421
// calculate lattice center
422422
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
423423
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
424424
ucell.latcenter.z = 0.0;
425-
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
425+
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
426426
}
427427
else if(Coordinate=="Cartesian_angstrom_center_xz")
428428
{
429429
// calculate lattice center
430430
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
431431
ucell.latcenter.y = 0.0;
432432
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
433-
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
433+
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
434434
}
435435
else if(Coordinate=="Cartesian_angstrom_center_yz")
436436
{
437437
// calculate lattice center
438438
ucell.latcenter.x = 0.0;
439439
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
440440
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
441-
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
441+
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
442442
}
443443
else if(Coordinate=="Cartesian_angstrom_center_xyz")
444444
{
445445
// calculate lattice center
446446
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
447447
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
448448
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
449-
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
449+
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
450450
}
451451
else if(Coordinate=="Cartesian_au")
452452
{

source/source_cell/test/prepare_unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class UcellTestPrepare
9797
}
9898
//lattice info
9999
ucell->lat0 = this->lat0;
100-
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
100+
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
101101
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
102102
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
103103
ucell->latvec.e11 = this->latvec[0];

source/source_cell/update_cell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void setup_cell_after_vc(UnitCell& ucell, std::ofstream& log)
319319
ucell.omega * pow(ModuleBase::BOHR_TO_A, 3));
320320
}
321321

322-
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
322+
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
323323
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
324324
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
325325

source/source_estate/module_charge/charge_mixing_preconditioner.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ void Charge_Mixing::Kerker_screen_recip(std::complex<double>* drhog)
5656
amin = this->mixing_beta;
5757
}
5858

59-
gg0 = std::pow(fac * 0.529177 / *this->tpiba, 2);
59+
gg0 = std::pow(fac * ModuleBase::BOHR_TO_A / *this->tpiba, 2);
6060

6161
const double gg0_amin = this->mixing_gg0_min / amin;
6262

@@ -138,7 +138,7 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
138138
amin = this->mixing_beta;
139139
}
140140

141-
gg0 = std::pow(fac * 0.529177 / *this->tpiba, 2);
141+
gg0 = std::pow(fac * ModuleBase::BOHR_TO_A / *this->tpiba, 2);
142142

143143
const int is_idx = is * this->rhopw->npw;
144144
const double gg0_amin = this->mixing_gg0_min / amin;

source/source_estate/module_dm/test/prepare_unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class UcellTestPrepare
9696
}
9797
// lattice info
9898
ucell.lat0 = this->lat0;
99-
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
99+
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
100100
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
101101
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
102102
ucell.latvec.e11 = this->latvec[0];

source/source_estate/test/charge_mixing_test.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
619619
// kerker
620620
CMtest.mixing_gg0 = 1.0;
621621
CMtest.Kerker_screen_recip(drhog);
622-
double gg0 = std::pow(0.529177, 2);
622+
double gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
623623
for (int i = 0; i < pw_basis.npw; ++i)
624624
{
625625
double gg = this->pw_basis.gg[i];
@@ -650,7 +650,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
650650
// mixing_gg0 = 1.0, mixing_gg0_mag = 0.0
651651
CMtest.mixing_gg0 = 1.0;
652652
CMtest.Kerker_screen_recip(drhog);
653-
gg0 = std::pow(0.529177, 2);
653+
gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
654654
for (int i = 0; i < pw_basis.npw; ++i)
655655
{
656656
double gg = this->pw_basis.gg[i];
@@ -683,7 +683,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
683683
// mixing_gg0 = 1.0, mixing_gg0_mag = 0.0
684684
CMtest.mixing_gg0 = 1.0;
685685
CMtest.Kerker_screen_recip(drhog);
686-
gg0 = std::pow(0.529177, 2);
686+
gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
687687
for (int i = 0; i < pw_basis.npw; ++i)
688688
{
689689
double gg = this->pw_basis.gg[i];
@@ -701,8 +701,8 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
701701
CMtest.mixing_gg0 = 1.0;
702702
CMtest.mixing_gg0_mag = 2.0;
703703
CMtest.Kerker_screen_recip(drhog);
704-
double gg1 = std::pow(1.0 * 0.529177, 2);
705-
double gg2 = std::pow(2.0 * 0.529177, 2);
704+
double gg1 = std::pow(1.0 * ModuleBase::BOHR_TO_A, 2);
705+
double gg2 = std::pow(2.0 * ModuleBase::BOHR_TO_A, 2);
706706
for (int i = 0; i < pw_basis.npw; ++i)
707707
{
708708
double gg = this->pw_basis.gg[i];
@@ -782,7 +782,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRealTest)
782782
CMtest.mixing_gg0 = 1.0;
783783
PARAM.input.mixing_gg0_mag = 0.0;
784784
CMtest.Kerker_screen_recip(drhog);
785-
const double gg0 = std::pow(0.529177, 2);
785+
const double gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
786786
for (int i = 0; i < pw_basis.npw; ++i)
787787
{
788788
std::complex<double> ration = drhog[i] / drhog[i+pw_basis.npw];

source/source_estate/test/prepare_unitcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class UcellTestPrepare
8282
}
8383
//lattice info
8484
ucell->lat0 = this->lat0;
85-
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
85+
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
8686
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
8787
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
8888
ucell->latvec.e11 = this->latvec[0];

source/source_hamilt/module_surchem/test/setcell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class Setcell
5050
ucell.atoms[1].ncpp.psd = "O";
5151

5252
ucell.lat0 = 1;
53-
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
53+
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
5454
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
5555
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
5656

0 commit comments

Comments
 (0)