Skip to content

Commit a4ef7e8

Browse files
authored
Update HSE examples, reduce the testing time, modify some outputs for HSE and LR calculations, reformat the output atomic positions, change 'jd' files in integreate tests to 'README' files (#6182)
* reduce the time costs in SDFT examples * modify SDFT codes, put Onsager.txt, je-je.txt, and Chebcoef to OUT directory * reduce the LCAO radius for NO_KP_AFM example * update 204_NO_KP_FM example * update example 260_NO_DJ_PK_PU_S1 * change to 644 for files in PP_ORB * add Fe_gga_6au_100Ry_2s1p1d.orb orbitals to reduce the testing time * reduce testing time for 260_NO_DJ_PK_PU_AFM_URAMPING * 260_NO_DJ_PK_PU_S1 * delete useless outputs * update surface chemistry example * modify the code for comparing Onsager.txt * update mulliken in 204_NO_KP_AFM example * update result.ref in 186_PW_SKG_ALL * update two test results * update output UNIFORM GRID information and 381 and 382 HSE examples * change 383_NO_GO to 383_NO_KP * update EXX examples * add 383 example * update HSE examples * update 385 and 386 cases, change 386 to kP * update some output format, including the atomic positions, the atomic velocties are printed out separately * update HSE directories * update HSE examples * delete 507 * add force and stress in 503 * keep updating HSE examples * delete ntype parameter, which is useless * update HSE testing information * add sz orbital in PP_ORB * update CASES_CPU.txt * update CASES_CPU.txt, move 284 to 511 * delete 291 * update autotests in unitcell_test * update some tests in ions_move * change jd to README * update some README * update some outputs
1 parent d266914 commit a4ef7e8

File tree

533 files changed

+1070
-1713
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

533 files changed

+1070
-1713
lines changed

source/module_basis/module_ao/ORB_gaunt_table.cpp

Lines changed: 16 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -162,16 +162,6 @@ int ORB_gaunt_table::get_lm_index(
162162
}
163163

164164

165-
/**********************//**
166-
* Rasch and Yu's Method
167-
***********************/
168-
///total pointers
169-
//int ORB_gaunt_table::P_EL(const int& L)
170-
//{
171-
// return (L+1) * (L+2) * (L+3) * (L+4) / 24;
172-
//}
173-
174-
175165
///effective pointers
176166
int ORB_gaunt_table::EP_EL(const int& L)
177167
{
@@ -201,13 +191,7 @@ void ORB_gaunt_table::init_Gaunt_CH(const int& Lmax)
201191
ModuleBase::TITLE("ORB_gaunt_table","init_Gaunt_CH");
202192
ModuleBase::timer::tick("ORB_gaunt_table","init_Gaunt_CH");
203193

204-
// assert(Lmax <= 6); // Peize Lin delete 2016-08-26. why?
205-
206194
int L = 2*Lmax + 1;
207-
208-
//int Np = this->P_EL(L);
209-
// assert(Np <= 5000); // Peize Lin delete 2016-08-26. why?
210-
211195
int Eff_Np = this->EP_EL(L);
212196

213197
ModuleBase::Memory::record("ORB::Gaunt_CH", sizeof(double) * Eff_Np * 30);
@@ -228,9 +212,6 @@ void ORB_gaunt_table::init_Gaunt_CH(const int& Lmax)
228212
if((l_sum % 2 == 0) && (l2 + l3 >= l1))
229213
{
230214
int uplmt_m2 = l1 - m3 > l2 ? l2 : l1 - m3;
231-
//int dim = l2 + uplmt_m2 + 1;
232-
233-
// assert(dim <= 30); // Peize Lin delete 2016-08-26. why?
234215

235216
int ic2 = 0;
236217
for(int m2 = -l2; m2 <= uplmt_m2; m2++)
@@ -239,9 +220,6 @@ void ORB_gaunt_table::init_Gaunt_CH(const int& Lmax)
239220
int m1 = -m2 - m3;
240221
assert(std::abs(m1) <= l1);
241222

242-
// Peize Lin delete assert 2016-08-26
243-
// assert(ic1 < 5000);
244-
// assert(ic2 < 30);
245223
Gaunt_CH[ic1][ic2] = Calc_Gaunt_CH(l1, m1, l2, m2, l3, m3);
246224
ic2++;
247225
}
@@ -269,7 +247,6 @@ double ORB_gaunt_table::Calc_Gaunt_CH
269247
const int& m3
270248
)
271249
{
272-
// ModuleBase::TITLE("ORB_gaunt_table","Calc_Gaunt_CH");
273250
ModuleBase::timer::tick("ORB_gaunt_table","Calc_Gaunt_CH");
274251

275252
double fac = sqrt((2*l1+1) * (2*l2+1) * (2*l3+1) / ModuleBase::FOUR_PI);
@@ -281,7 +258,8 @@ double ORB_gaunt_table::Calc_Gaunt_CH
281258

282259
double aux1 = sqrt(Fact(l1+m1) * Fact(l1-m1) * Fact(l2+m2) * Fact(l2-m2) * Fact(l3+m3) * Fact(l3-m3));
283260

284-
int kmin, kmax;
261+
int kmin = 0;
262+
int kmax = 0;
285263

286264
kmin = (l2-l3-m1) > (l1-l3+m2) ? (l2-l3-m1) : (l1-l3+m2);
287265
kmin = kmin > 0 ? kmin : 0;
@@ -324,16 +302,14 @@ double ORB_gaunt_table::Get_Gaunt_CH
324302

325303
if( (m1 + m2 + m3) != 0) return 0.0;
326304

327-
int L1, M1, L2, M2, L3, M3;
328-
329-
L1 = l1;
330-
M1 = m1;
331-
L2 = l2;
332-
M2 = m2;
305+
int L1 = l1;
306+
int M1 = m1;
307+
int L2 = l2;
308+
int M2 = m2;
333309
Swap(L1, M1, L2, M2);
334310

335-
L3 = l3;
336-
M3 = m3;
311+
int L3 = l3;
312+
int M3 = m3;
337313
Swap(L1, M1, L3, M3);
338314

339315
Swap(L2, M2, L3, M3);
@@ -345,19 +321,17 @@ double ORB_gaunt_table::Get_Gaunt_CH
345321
M3 = -M3;
346322
}
347323

348-
/*
349-
if(l1 == 2 && m1 == -1 && l2 == 2 && m2 == 2 && l3 == 2 && m3 == -1)
350-
{
351-
std::cout << L1 << " " << L2 << " " << L3 << std::endl;
352-
std::cout << M1 << " " << M2 << " " << M3 <<std::endl;
353-
}
354-
*/
355-
356324
int ic1 = index_func(L1, L2, L3, M3);
357325
int ic2 = M2 + L2;
358326

359-
try{ return Gaunt_CH.at(ic1).at(ic2); } // Peize Lin add 2016-08-26
360-
catch( std::out_of_range ){ return 0; }
327+
try
328+
{
329+
return Gaunt_CH.at(ic1).at(ic2);
330+
} // Peize Lin add 2016-08-26
331+
catch( std::out_of_range )
332+
{
333+
return 0;
334+
}
361335
}
362336

363337

@@ -374,8 +348,6 @@ double ORB_gaunt_table::Get_Gaunt_SH
374348
const int& mm3
375349
)
376350
{
377-
// ModuleBase::TITLE("ORB_gaunt_table","Get_Gaunt_SH");
378-
ModuleBase::timer::tick("ORB_gaunt_table","Get_Gaunt_SH");
379351

380352
//Tranform M index
381353
int m1 = Index_M(mm1);
@@ -442,7 +414,6 @@ double ORB_gaunt_table::Get_Gaunt_SH
442414
else return 0.0;
443415
}
444416

445-
ModuleBase::timer::tick("ORB_gaunt_table","Get_Gaunt_SH");
446417
}
447418

448419

source/module_cell/print_cell.cpp

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,33 +18,61 @@ namespace unitcell
1818
// assert (direct || Coordinate == "Cartesian" || Coordinate == "Cartesian_angstrom"); // this line causes abort in unittest ReadAtomPositionsCACXY.
1919
// previously there are two if-statements, the first is `if(Coordinate == "Direct")` and the second is `if(Coordinate == "Cartesian" || Coordiante == "Cartesian_angstrom")`
2020
// however the Coordinate can also be value among Cartesian_angstrom_center_xy, Cartesian_angstrom_center_xz, Cartesian_angstrom_center_yz and Cartesian_angstrom_center_xyz
21+
2122
// if Coordinate has value one of them, this print_tau will not print anything.
2223
std::regex pattern("Direct|Cartesian(_angstrom)?(_center_(xy|xz|yz|xyz))?");
2324
assert(std::regex_search(Coordinate, pattern));
2425
bool direct = (Coordinate == "Direct");
26+
27+
//----------------------
28+
// print atom positions
29+
//----------------------
2530
std::string table;
26-
table += direct? "DIRECT COORDINATES\n": FmtCore::format(" CARTESIAN COORDINATES ( UNIT = %15.8f Bohr ).\n", lat0);
27-
table += FmtCore::format("%8s%10s%10s%10s%8s%8s%8s%8s\n", "atom", "x", "y", "z", "mag", "vx", "vy", "vz");
31+
table += direct? " DIRECT COORDINATES\n": FmtCore::format(" CARTESIAN COORDINATES ( UNIT = %15.8f Bohr ).\n", lat0);
32+
table += FmtCore::format("%5s%19s%19s%19s%8s\n", "atom", "x", "y", "z", "mag");
2833
for(int it = 0; it < ntype; it++)
2934
{
3035
for (int ia = 0; ia < atoms[it].na; ia++)
3136
{
3237
const double& x = direct? atoms[it].taud[ia].x: atoms[it].tau[ia].x;
3338
const double& y = direct? atoms[it].taud[ia].y: atoms[it].tau[ia].y;
3439
const double& z = direct? atoms[it].taud[ia].z: atoms[it].tau[ia].z;
35-
table += FmtCore::format("%8s%10.3f%10.3f%10.3f%8.3f%8.3f%8.3f%8.3f\n",
40+
table += FmtCore::format("%5s%19.12f%19.12f%19.12f%8.4f\n",
3641
atoms[it].label,
3742
x,
3843
y,
3944
z,
40-
atoms[it].mag[ia],
41-
atoms[it].vel[ia].x,
42-
atoms[it].vel[ia].y,
43-
atoms[it].vel[ia].z);
45+
atoms[it].mag[ia]);
4446
}
4547
}
4648
table += "\n";
47-
ofs << table << std::endl;
49+
ofs << table;
50+
51+
52+
// print velocities
53+
ofs << " ATOMIC VELOCITIES" << std::endl;
54+
ofs << std::setprecision(12);
55+
ofs << std::setw(5) << "atom"
56+
<< std::setw(19) << "vx"
57+
<< std::setw(19) << "vy"
58+
<< std::setw(19) << "vz"
59+
<< std::endl;
60+
61+
for(int it = 0; it < ntype; it++)
62+
{
63+
for (int ia = 0; ia < atoms[it].na; ia++)
64+
{
65+
ofs << std::setw(5) << atoms[it].label;
66+
ofs << " " << std::setw(18) << atoms[it].vel[ia].x;
67+
ofs << " " << std::setw(18) << atoms[it].vel[ia].y;
68+
ofs << " " << std::setw(18) << atoms[it].vel[ia].z;
69+
ofs << std::endl;
70+
}
71+
}
72+
ofs << std::endl;
73+
ofs << std::setprecision(6); // return to 6, as original
74+
75+
4876
return;
4977
}
5078

source/module_cell/test/unitcell_test.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,11 +1022,10 @@ TEST_F(UcellTest, PrintTauDirect)
10221022
ifs.open("print_tau_direct");
10231023
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
10241024
EXPECT_THAT(str, testing::HasSubstr("DIRECT COORDINATES"));
1025-
EXPECT_THAT(str, testing::HasSubstr(" C 0.100 0.100 0.100 0.000 0.100 0.100 0.100"));
1026-
EXPECT_THAT(str, testing::HasSubstr(" H 0.150 0.150 0.150 0.000 0.100 0.100 0.100"));
1025+
EXPECT_THAT(str, testing::HasSubstr(" C 0.100000000000 0.100000000000 0.100000000000 0.0000"));
1026+
EXPECT_THAT(str, testing::HasSubstr(" H 0.150000000000 0.150000000000 0.150000000000 0.0000"));
10271027
ifs.close();
10281028

1029-
// remove the file
10301029
remove("print_tau_direct");
10311030
}
10321031

@@ -1047,8 +1046,8 @@ TEST_F(UcellTest, PrintTauCartesian)
10471046
ifs.open("print_tau_Cartesian");
10481047
std::string str((std::istreambuf_iterator<char>(ifs)), std::istreambuf_iterator<char>());
10491048
EXPECT_THAT(str, testing::HasSubstr("CARTESIAN COORDINATES"));
1050-
EXPECT_THAT(str, testing::HasSubstr(" C 1.000 1.000 1.000 0.000 0.000 0.000 0.000"));
1051-
EXPECT_THAT(str, testing::HasSubstr(" H 1.500 1.500 1.500 0.000 0.000 0.000 0.000"));
1049+
EXPECT_THAT(str, testing::HasSubstr(" C 1.000000000000 1.000000000000 1.000000000000 0.0000"));
1050+
EXPECT_THAT(str, testing::HasSubstr(" H 1.500000000000 1.500000000000 1.500000000000 0.0000"));
10521051
ifs.close();
10531052

10541053
// remove the file

source/module_cell/test/unitcell_test_readpp.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,8 @@ TEST_F(UcellDeathTest, ReadCellPPWarning4) {
173173
testing::internal::CaptureStdout();
174174
EXPECT_NO_THROW(elecstate::read_cell_pseudopots(pp_dir, ofs, *ucell));
175175
output = testing::internal::GetCapturedStdout();
176-
EXPECT_THAT(output, testing::HasSubstr("dft_functional readin is: LDA"));
177-
EXPECT_THAT(output,
178-
testing::HasSubstr("dft_functional in pseudopot file is: PBE"));
179-
EXPECT_THAT(output,
180-
testing::HasSubstr("Please make sure this is what you need"));
176+
EXPECT_THAT(output, testing::HasSubstr("DFT FUNC. (PSEUDO) : PBE"));
177+
EXPECT_THAT(output, testing::HasSubstr("DFT FUNC. (SET TO) : LDA"));
181178
}
182179

183180
TEST_F(UcellDeathTest, ReadCellPPWarning5) {

source/module_elecstate/read_pseudo.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,17 +332,19 @@ void read_cell_pseudopots(const std::string& pp_dir, std::ofstream& log, UnitCel
332332
transform(xc_func1.begin(), xc_func1.end(), xc_func1.begin(), (::toupper));
333333
if (xc_func1 != ucell.atoms[i].ncpp.xc_func)
334334
{
335-
std::cout << " dft_functional readin is: " << PARAM.inp.dft_functional << std::endl;
336-
std::cout << " dft_functional in pseudopot file is: " << ucell.atoms[i].ncpp.xc_func << std::endl;
337-
std::cout << " Please make sure this is what you need" << std::endl;
338-
GlobalV::ofs_warning << " dft_functional readin is: " << PARAM.inp.dft_functional << std::endl;
339-
GlobalV::ofs_warning << " dft_functional in pseudopot file is: " << ucell.atoms[i].ncpp.xc_func
340-
<< std::endl;
341-
GlobalV::ofs_warning << " Please make sure this is what you need" << std::endl;
335+
std::cout << " NAME OF ELEMENT : " << ucell.atoms[i].label << std::endl;
336+
std::cout << " DFT FUNC. (PSEUDO) : " << ucell.atoms[i].ncpp.xc_func << std::endl;
337+
std::cout << " DFT FUNC. (SET TO) : " << xc_func1 << std::endl;
338+
std::cout << " MAKE SURE THIS DFT FUNCTIONAL IS WHAT YOU NEED" << std::endl;
339+
340+
341+
GlobalV::ofs_warning << " NAME OF ELEMENT : " << ucell.atoms[i].label << std::endl;
342+
GlobalV::ofs_warning << " DFT FUNC. (PSEUDO) : " << ucell.atoms[i].ncpp.xc_func << std::endl;
343+
GlobalV::ofs_warning << " DFT FUNC. (SET TO) : " << xc_func1 << std::endl;
344+
GlobalV::ofs_warning << " MAKE SURE THIS DFT FUNCTIONAL IS WHAT YOU NEED" << std::endl;
342345

343346
ucell.atoms[i].ncpp.xc_func = xc_func1;
344-
log << " XC functional updated to : " << PARAM.inp.dft_functional << std::endl;
345-
ModuleBase::GlobalFunc::OUT(log, "exchange-correlation functional", ucell.atoms[i].ncpp.xc_func);
347+
ModuleBase::GlobalFunc::OUT(log, "DFT functional set to", xc_func1);
346348
}
347349
}
348350
}

source/module_esolver/esolver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,12 @@ ESolver* init_esolver(const Input_para& inp, UnitCell& ucell)
266266
}
267267
p_esolver->before_all_runners(ucell, inp);
268268
p_esolver->runner(ucell, 0); // scf-only
269+
269270
// force and stress is not needed currently,
270271
// they will be supported after the analytical gradient
271272
// of LR-TDDFT is implemented.
272273
// after_all_runners() is for output, it is not needed here.
273-
std::cout << "Setting up the esolver for excited states..." << std::endl;
274+
std::cout << " PREPARING FOR EXCITED STATES." << std::endl;
274275
// initialize the 2nd ESolver_LR at the temporary pointer
275276
ModuleESolver::ESolver* p_esolver_lr = nullptr;
276277
if (PARAM.globalv.gamma_only_local)

source/module_io/print_info.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,12 @@ void print_rhofft(ModulePW::PW_Basis* pw_rhod,
199199
ModulePW::PW_Basis_Big* pw_big,
200200
std::ofstream& ofs)
201201
{
202-
std::cout << " UNIFORM GRID DIM : " << pw_rho->nx << " * " << pw_rho->ny << " * " << pw_rho->nz << std::endl;
203-
std::cout << " UNIFORM GRID DIM(BIG) : " << pw_big->nbx << " * " << pw_big->nby << " * " << pw_big->nbz
202+
std::cout << " UNIFORM GRID DIM : " << pw_rho->nx << " * " << pw_rho->ny << " * " << pw_rho->nz << std::endl;
203+
std::cout << " UNIFORM GRID DIM(BIG): " << pw_big->nbx << " * " << pw_big->nby << " * " << pw_big->nbz
204204
<< std::endl;
205205
if (PARAM.globalv.double_grid)
206206
{
207-
std::cout << " UNIFORM GRID DIM(DENSE) : " << pw_rhod->nx << " * " << pw_rhod->ny << " * " << pw_rhod->nz
207+
std::cout << " UNIFORM GRID (DENSE) : " << pw_rhod->nx << " * " << pw_rhod->ny << " * " << pw_rhod->nz
208208
<< std::endl;
209209
}
210210

source/module_io/read_input_item_exx_dftu.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ void ReadInput::item_exx()
1111
Input_Item item("exx_hybrid_alpha");
1212
item.annotation = "fraction of Fock exchange in hybrid functionals";
1313
read_sync_string(input.exx_hybrid_alpha);
14-
item.reset_value = [](const Input_Item& item, Parameter& para) {
15-
if (para.input.exx_hybrid_alpha == "default")
14+
item.reset_value = [](const Input_Item& item, Parameter& para)
15+
{
16+
if (para.input.exx_hybrid_alpha == "default")
1617
{
1718
std::string& dft_functional = para.input.dft_functional;
1819
std::string dft_functional_lower = dft_functional;
@@ -70,8 +71,9 @@ void ReadInput::item_exx()
7071
item.annotation = "the maximal electronic iteration number in the "
7172
"evaluation of Fock exchange";
7273
read_sync_int(input.exx_hybrid_step);
73-
item.check_value = [](const Input_Item& item, const Parameter& para) {
74-
if (para.input.exx_hybrid_step <= 0)
74+
item.check_value = [](const Input_Item& item, const Parameter& para)
75+
{
76+
if (para.input.exx_hybrid_step <= 0)
7577
{
7678
ModuleBase::WARNING_QUIT("ReadInput", "exx_hybrid_step must > 0");
7779
}
@@ -493,4 +495,4 @@ void ReadInput::item_dftu()
493495
this->add_item(item);
494496
}
495497
}
496-
} // namespace ModuleIO
498+
} // namespace ModuleIO

0 commit comments

Comments
 (0)