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
2 changes: 1 addition & 1 deletion source/source_cell/module_neighbor/test/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class UcellTestPrepare
}
//lattice info
ucell->lat0 = this->lat0;
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
ucell->latvec.e11 = this->latvec[0];
Expand Down
2 changes: 1 addition & 1 deletion source/source_cell/read_atom_species.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ bool read_lattice_constant(std::ifstream& ifa,
{
ModuleBase::WARNING_QUIT("read_atom_species","Lattice constant <= 0.0");
}
lat0_angstrom = lat0 * 0.529177;
lat0_angstrom = lat0 * ModuleBase::BOHR_TO_A;
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Bohr)",lat0);
ModuleBase::GlobalFunc::OUT(ofs_running,"Lattice constant (Angstrom)",lat0_angstrom);
lat.tpiba = ModuleBase::TWO_PI / lat0;
Expand Down
10 changes: 5 additions & 5 deletions source/source_cell/read_atoms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,39 +414,39 @@ bool unitcell::read_atom_positions(UnitCell& ucell,
}
else if(Coordinate=="Cartesian_angstrom")
{
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0;
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0;
}
else if(Coordinate=="Cartesian_angstrom_center_xy")
{
// calculate lattice center
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
ucell.latcenter.z = 0.0;
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
}
else if(Coordinate=="Cartesian_angstrom_center_xz")
{
// calculate lattice center
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
ucell.latcenter.y = 0.0;
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
}
else if(Coordinate=="Cartesian_angstrom_center_yz")
{
// calculate lattice center
ucell.latcenter.x = 0.0;
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
}
else if(Coordinate=="Cartesian_angstrom_center_xyz")
{
// calculate lattice center
ucell.latcenter.x = (ucell.latvec.e11 + ucell.latvec.e21 + ucell.latvec.e31)/2.0;
ucell.latcenter.y = (ucell.latvec.e12 + ucell.latvec.e22 + ucell.latvec.e32)/2.0;
ucell.latcenter.z = (ucell.latvec.e13 + ucell.latvec.e23 + ucell.latvec.e33)/2.0;
ucell.atoms[it].tau[ia] = v / 0.529177 / ucell.lat0 + ucell.latcenter;
ucell.atoms[it].tau[ia] = v / ModuleBase::BOHR_TO_A / ucell.lat0 + ucell.latcenter;
}
else if(Coordinate=="Cartesian_au")
{
Expand Down
2 changes: 1 addition & 1 deletion source/source_cell/test/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class UcellTestPrepare
}
//lattice info
ucell->lat0 = this->lat0;
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
ucell->latvec.e11 = this->latvec[0];
Expand Down
2 changes: 1 addition & 1 deletion source/source_cell/update_cell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ void setup_cell_after_vc(UnitCell& ucell, std::ofstream& log)
ucell.omega * pow(ModuleBase::BOHR_TO_A, 3));
}

ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void Charge_Mixing::Kerker_screen_recip(std::complex<double>* drhog)
amin = this->mixing_beta;
}

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

const double gg0_amin = this->mixing_gg0_min / amin;

Expand Down Expand Up @@ -138,7 +138,7 @@ void Charge_Mixing::Kerker_screen_real(double* drhor)
amin = this->mixing_beta;
}

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

const int is_idx = is * this->rhopw->npw;
const double gg0_amin = this->mixing_gg0_min / amin;
Expand Down
2 changes: 1 addition & 1 deletion source/source_estate/module_dm/test/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class UcellTestPrepare
}
// lattice info
ucell.lat0 = this->lat0;
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
ucell.latvec.e11 = this->latvec[0];
Expand Down
12 changes: 6 additions & 6 deletions source/source_estate/test/charge_mixing_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
// kerker
CMtest.mixing_gg0 = 1.0;
CMtest.Kerker_screen_recip(drhog);
double gg0 = std::pow(0.529177, 2);
double gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
for (int i = 0; i < pw_basis.npw; ++i)
{
double gg = this->pw_basis.gg[i];
Expand Down Expand Up @@ -650,7 +650,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
// mixing_gg0 = 1.0, mixing_gg0_mag = 0.0
CMtest.mixing_gg0 = 1.0;
CMtest.Kerker_screen_recip(drhog);
gg0 = std::pow(0.529177, 2);
gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
for (int i = 0; i < pw_basis.npw; ++i)
{
double gg = this->pw_basis.gg[i];
Expand Down Expand Up @@ -683,7 +683,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
// mixing_gg0 = 1.0, mixing_gg0_mag = 0.0
CMtest.mixing_gg0 = 1.0;
CMtest.Kerker_screen_recip(drhog);
gg0 = std::pow(0.529177, 2);
gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
for (int i = 0; i < pw_basis.npw; ++i)
{
double gg = this->pw_basis.gg[i];
Expand All @@ -701,8 +701,8 @@ TEST_F(ChargeMixingTest, KerkerScreenRecipTest)
CMtest.mixing_gg0 = 1.0;
CMtest.mixing_gg0_mag = 2.0;
CMtest.Kerker_screen_recip(drhog);
double gg1 = std::pow(1.0 * 0.529177, 2);
double gg2 = std::pow(2.0 * 0.529177, 2);
double gg1 = std::pow(1.0 * ModuleBase::BOHR_TO_A, 2);
double gg2 = std::pow(2.0 * ModuleBase::BOHR_TO_A, 2);
for (int i = 0; i < pw_basis.npw; ++i)
{
double gg = this->pw_basis.gg[i];
Expand Down Expand Up @@ -782,7 +782,7 @@ TEST_F(ChargeMixingTest, KerkerScreenRealTest)
CMtest.mixing_gg0 = 1.0;
PARAM.input.mixing_gg0_mag = 0.0;
CMtest.Kerker_screen_recip(drhog);
const double gg0 = std::pow(0.529177, 2);
const double gg0 = std::pow(ModuleBase::BOHR_TO_A, 2);
for (int i = 0; i < pw_basis.npw; ++i)
{
std::complex<double> ration = drhog[i] / drhog[i+pw_basis.npw];
Expand Down
2 changes: 1 addition & 1 deletion source/source_estate/test/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class UcellTestPrepare
}
//lattice info
ucell->lat0 = this->lat0;
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
ucell->latvec.e11 = this->latvec[0];
Expand Down
2 changes: 1 addition & 1 deletion source/source_hamilt/module_surchem/test/setcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Setcell
ucell.atoms[1].ncpp.psd = "O";

ucell.lat0 = 1;
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;

Expand Down
2 changes: 1 addition & 1 deletion source/source_io/output_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ void print_force(std::ofstream& ofs_running,
double fac = 1.0;
if (!ry)
{
fac = ModuleBase::Ry_to_eV / 0.529177;
fac = ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A;
}

std::vector<std::string> atom_label;
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/test/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class UcellTestPrepare
}
//lattice info
ucell->lat0 = this->lat0;
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
ucell->latvec.e11 = this->latvec[0];
Expand Down
2 changes: 1 addition & 1 deletion source/source_io/test_serial/prepare_unitcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class UcellTestPrepare
}
//lattice info
ucell->lat0 = this->lat0;
ucell->lat0_angstrom = ucell->lat0 * 0.529177;
ucell->lat0_angstrom = ucell->lat0 * ModuleBase::BOHR_TO_A;
ucell->tpiba = ModuleBase::TWO_PI/ucell->lat0;
ucell->tpiba2 = ucell->tpiba * ucell->tpiba;
ucell->latvec.e11 = this->latvec[0];
Expand Down
6 changes: 3 additions & 3 deletions source/source_io/write_dipole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ void ModuleIO::write_dipole(const UnitCell& ucell,

#ifndef __MPI
double dipole_elec_x = 0.0, dipole_elec_y = 0.0, dipole_elec_z = 0.0;
double lat_factor_x = ucell.lat0 * 0.529177 / rhopw->nx;
double lat_factor_y = ucell.lat0 * 0.529177 / rhopw->ny;
double lat_factor_z = ucell.lat0 * 0.529177 / rhopw->nz;
double lat_factor_x = ucell.lat0 * ModuleBase::BOHR_TO_A / rhopw->nx;
double lat_factor_y = ucell.lat0 * ModuleBase::BOHR_TO_A / rhopw->ny;
double lat_factor_z = ucell.lat0 * ModuleBase::BOHR_TO_A / rhopw->nz;

for (int k = 0; k < rhopw->nz; k++)
{
Expand Down
2 changes: 1 addition & 1 deletion source/source_lcao/FORCE_STRESS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ void Force_Stress_LCAO<T>::getForceStress(UnitCell& ucell,
GlobalV::ofs_running << " " << std::setw(8) << iat;
for (int i = 0; i < 3; i++)
{
if (std::abs(fcs(iat, i) * ModuleBase::Ry_to_eV / 0.529177)
if (std::abs(fcs(iat, i) * ModuleBase::Ry_to_eV / ModuleBase::BOHR_TO_A)
< Force_Stress_LCAO::force_invalid_threshold_ev)
{
fcs(iat, i) = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ TEST_F(spinconstrain::SpinConstrainTest, CheckRestriction)
std::vector<ModuleBase::Vector3<double>> search = {
{0.0, 0.0, 40}
};
double alpha_trial = 0.1 / 13.605698;
double alpha_trial = 0.1 / ModuleBase::Ry_to_eV;
testing::internal::CaptureStdout();
sc.check_restriction(search, alpha_trial);
std::string output = testing::internal::GetCapturedStdout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class UcellTestPrepare
}
// lattice info
ucell.lat0 = this->lat0;
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
ucell.latvec.e11 = this->latvec[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class UcellTestPrepare
}
// lattice info
ucell.lat0 = this->lat0;
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;
ucell.latvec.e11 = this->latvec[0];
Expand Down
2 changes: 1 addition & 1 deletion source/source_md/test/setcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Setcell
ucell.atom_label[0] = "Ar";

ucell.lat0 = 1;
ucell.lat0_angstrom = ucell.lat0 * 0.529177;
ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A;
ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0;
ucell.tpiba2 = ucell.tpiba * ucell.tpiba;

Expand Down
Loading
Loading