Skip to content

Commit e91c13e

Browse files
authored
Merge branch 'develop' into ccache-cuda
2 parents e9b29bf + e2d4606 commit e91c13e

File tree

590 files changed

+3340
-3109
lines changed

Some content is hidden

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

590 files changed

+3340
-3109
lines changed

.github/workflows/test.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,16 @@ jobs:
4848
run: |
4949
cmake --build build -j8
5050
cmake --install build
51-
- name: Test
51+
- name: Unit Test
5252
env:
5353
GTEST_COLOR: 'yes'
5454
OMP_NUM_THREADS: '2'
5555
run: |
56-
cmake --build build --target test ARGS="-V --timeout 1700"
56+
cmake --build build --target test ARGS="-V --timeout 1700 -E integrated_test"
57+
- name: Integrated Test
58+
env:
59+
GTEST_COLOR: 'yes'
60+
OMP_NUM_THREADS: '2'
61+
run: |
62+
cmake --build build --target test ARGS="-V --timeout 1700 -R integrated_test"
63+

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,4 +798,4 @@ install(PROGRAMS ${ABACUS_BIN_PATH}
798798

799799
if(ENABLE_COVERAGE)
800800
coverage_evaluate()
801-
endif()
801+
endif()

docs/advanced/input_files/input-main.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,10 +1645,13 @@ These variables are used to control the output of properties.
16451645
### out_dm
16461646

16471647
- **Type**: Boolean
1648-
- **Availability**: Numerical atomic orbital basis (gamma-only algorithm)
1648+
- **Availability**: Numerical atomic orbital basis
16491649
- **Description**: Whether to output the density matrix of localized orbitals into files in the folder `OUT.${suffix}`. The files are named as:
1650-
- nspin = 1: SPIN1_DM;
1651-
- nspin = 2: SPIN1_DM, and SPIN2_DM.
1650+
- For gamma only case:
1651+
- nspin = 1: SPIN1_DM;
1652+
- nspin = 2: SPIN1_DM, and SPIN2_DM.
1653+
- For multi-k points case:
1654+
- SPIN\*_K\*_DM, where \* stands for index of spin and kpoints;
16521655
- **Default**: False
16531656

16541657
### out_dm1

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_hamilt_general/module_surchem/surchem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,4 @@ void surchem::clear()
5555
surchem::~surchem()
5656
{
5757
this->clear();
58-
}
58+
}

0 commit comments

Comments
 (0)