Skip to content

Commit a0faa71

Browse files
Merge branch 'develop' into toolchain-codeload
2 parents cd830a9 + c44fc6b commit a0faa71

File tree

2,450 files changed

+4715
-9501
lines changed

Some content is hidden

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

2,450 files changed

+4715
-9501
lines changed

.github/workflows/cuda.yml

+18-3
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,22 @@ jobs:
3737
cmake --build build -j4
3838
cmake --install build
3939
40-
- name: Test
40+
- name: Test 11_PW_GPU
4141
run: |
42-
cd tests/integrate
43-
bash Autotest.sh -n 2 -f CASES_GPU.txt
42+
cd tests/11_PW_GPU
43+
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
44+
45+
- name: Test 12_NAO_Gamma_GPU
46+
run: |
47+
cd tests/12_NAO_Gamma_GPU
48+
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
49+
50+
- name: Test 13_NAO_multik_GPU
51+
run: |
52+
cd tests/13_NAO_multik_GPU
53+
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt
54+
55+
- name: Test 16_SDFT_GPU
56+
run: |
57+
cd tests/16_SDFT_GPU
58+
bash ../integrate/Autotest.sh -n 2 -f CASES_GPU.txt

.github/workflows/test.yml

+81-2
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,88 @@ jobs:
4848
run: |
4949
cmake --build build -j8
5050
cmake --install build
51-
- name: Test
51+
52+
- name: Integrated Test
53+
env:
54+
GTEST_COLOR: 'yes'
55+
OMP_NUM_THREADS: '2'
56+
run: |
57+
cmake --build build --target test ARGS="-V --timeout 1700 -R integrated_test"
58+
59+
- name: 01_PW Test
5260
env:
5361
GTEST_COLOR: 'yes'
5462
OMP_NUM_THREADS: '2'
5563
run: |
56-
cmake --build build --target test ARGS="-V --timeout 1700"
64+
cmake --build build --target test ARGS="-V --timeout 1700 -R 01_PW"
65+
66+
- name: 02_NAO_Gamma Test
67+
env:
68+
GTEST_COLOR: 'yes'
69+
OMP_NUM_THREADS: '2'
70+
run: |
71+
cmake --build build --target test ARGS="-V --timeout 1700 -R 02_NAO_Gamma"
72+
73+
- name: 03_NAO_multik Test
74+
env:
75+
GTEST_COLOR: 'yes'
76+
OMP_NUM_THREADS: '2'
77+
run: |
78+
cmake --build build --target test ARGS="-V --timeout 1700 -R 03_NAO_multik"
79+
80+
- name: 04_LJ_DP Test
81+
env:
82+
GTEST_COLOR: 'yes'
83+
OMP_NUM_THREADS: '2'
84+
run: |
85+
cmake --build build --target test ARGS="-V --timeout 1700 -R 04_LJ_DP"
86+
87+
- name: 05_rtTDDFT Test
88+
env:
89+
GTEST_COLOR: 'yes'
90+
OMP_NUM_THREADS: '2'
91+
run: |
92+
cmake --build build --target test ARGS="-V --timeout 1700 -R 05_rtTDDFT"
93+
94+
- name: 06_SDFT Test
95+
env:
96+
GTEST_COLOR: 'yes'
97+
OMP_NUM_THREADS: '2'
98+
run: |
99+
cmake --build build --target test ARGS="-V --timeout 1700 -R 06_SDFT"
100+
101+
- name: 07_OFDFT Test
102+
env:
103+
GTEST_COLOR: 'yes'
104+
OMP_NUM_THREADS: '2'
105+
run: |
106+
cmake --build build --target test ARGS="-V --timeout 1700 -R 07_OFDFT"
107+
108+
- name: 08_EXX Test
109+
env:
110+
GTEST_COLOR: 'yes'
111+
OMP_NUM_THREADS: '2'
112+
run: |
113+
cmake --build build --target test ARGS="-V --timeout 1700 -R 08_EXX"
114+
115+
- name: 09_DeePKS Test
116+
env:
117+
GTEST_COLOR: 'yes'
118+
OMP_NUM_THREADS: '2'
119+
run: |
120+
cmake --build build --target test ARGS="-V --timeout 1700 -R 09_DeePKS"
121+
122+
- name: 10_others Test
123+
env:
124+
GTEST_COLOR: 'yes'
125+
OMP_NUM_THREADS: '2'
126+
run: |
127+
cmake --build build --target test ARGS="-V --timeout 1700 -R 10_others"
128+
129+
- name: Unit Test
130+
env:
131+
GTEST_COLOR: 'yes'
132+
OMP_NUM_THREADS: '2'
133+
run: |
134+
cmake --build build --target test ARGS="-V --timeout 1700 -E 'integrate_test|01_PW|02_NAO_Gamma|03_NAO_multik|04_LJ_DP|05_rtTDDFT|06_SDFT|07_OFDFT|08_EXX|09_DeePKS|10_others|11_PW_GPU|16_SDFT_GPU'"
135+

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ find_program(CCACHE ccache)
190190
if(CCACHE)
191191
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE} ${CMAKE_CXX_COMPILER_LAUNCHER})
192192
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE} ${CMAKE_C_COMPILER_LAUNCHER})
193+
set(CMAKE_CUDA_COMPILER_LAUNCHER ${CCACHE} ${CMAKE_CUDA_COMPILER_LAUNCHER})
193194
endif()
194195

195196
# Choose build type from: Debug Release RelWithDebInfo MinSizeRel Select
@@ -797,4 +798,4 @@ install(PROGRAMS ${ABACUS_BIN_PATH}
797798

798799
if(ENABLE_COVERAGE)
799800
coverage_evaluate()
800-
endif()
801+
endif()

docs/advanced/input_files/input-main.md

+6-3
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

+16-45
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

+36-8
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

+4-5
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

+2-5
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) {

0 commit comments

Comments
 (0)