Skip to content

Commit 2502701

Browse files
authored
Merge branch 'deepmodeling:develop' into matrix
2 parents ff824b8 + b98fce1 commit 2502701

File tree

24 files changed

+554
-318
lines changed

24 files changed

+554
-318
lines changed

.github/workflows/build_test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ jobs:
2727
- name: Build
2828
run: |
2929
cmake -B build -DBUILD_TESTING=ON ${{ matrix.build_args }}
30-
cmake --build build -j4
31-
cmake --install build
30+
cmake --build build -j2

.github/workflows/container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- develop
77
- reconstruction
88
- newelpa
9-
9+
1010
jobs:
1111
build_container_and_push:
1212
runs-on: ubuntu-latest

.github/workflows/dynamic.yml

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,9 @@ on:
1111
default: '2'
1212

1313
jobs:
14-
start-runner:
15-
name: Start self-hosted EC2 runner
16-
runs-on: ubuntu-latest
17-
outputs:
18-
label: ${{ steps.start-ec2-runner.outputs.label }}
19-
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
20-
steps:
21-
- name: Configure AWS credentials
22-
uses: aws-actions/configure-aws-credentials@v1
23-
with:
24-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
25-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
26-
aws-region: ${{ secrets.AWS_REGION }}
27-
- name: Start EC2 runner
28-
id: start-ec2-runner
29-
uses: machulav/ec2-github-runner@v2
30-
with:
31-
mode: start
32-
github-token: ${{ secrets.PAT }}
33-
ec2-image-id: ami-07758124f42f794bf
34-
ec2-instance-type: c5.4xlarge
35-
subnet-id: subnet-f7edb991
36-
security-group-id: sg-fd5185e7
3714
test:
3815
name: Do the job on the runner
39-
needs: start-runner # required to start the main job when the runner is ready
40-
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
16+
runs-on: self-hosted
4117
container: ghcr.io/deepmodeling/abacus-development-kit:gnu
4218
steps:
4319
- name: Checkout
@@ -55,24 +31,3 @@ jobs:
5531
build_dir: html
5632
env:
5733
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
stop-runner:
59-
name: Stop self-hosted EC2 runner
60-
needs:
61-
- start-runner # required to get output from the start-runner job
62-
- test # required to wait when the main job is done
63-
runs-on: ubuntu-latest
64-
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
65-
steps:
66-
- name: Configure AWS credentials
67-
uses: aws-actions/configure-aws-credentials@v1
68-
with:
69-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
70-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71-
aws-region: ${{ secrets.AWS_REGION }}
72-
- name: Stop EC2 runner
73-
uses: machulav/ec2-github-runner@v2
74-
with:
75-
mode: stop
76-
github-token: ${{ secrets.PAT }}
77-
label: ${{ needs.start-runner.outputs.label }}
78-
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

.github/workflows/static.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55

66
jobs:
77
clang-tidy:
8-
runs-on: ubuntu-latest
8+
runs-on: self-hosted
99
container: ghcr.io/deepmodeling/abacus-development-kit:gnu
1010
steps:
1111
- name: Checkout Pull Request

.github/workflows/test.yml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,33 +10,9 @@ on:
1010
- planewave
1111
jobs:
1212

13-
start-runner:
14-
name: Start self-hosted EC2 runner
15-
runs-on: ubuntu-latest
16-
outputs:
17-
label: ${{ steps.start-ec2-runner.outputs.label }}
18-
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
19-
steps:
20-
- name: Configure AWS credentials
21-
uses: aws-actions/configure-aws-credentials@v1
22-
with:
23-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
24-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
25-
aws-region: ${{ secrets.AWS_REGION }}
26-
- name: Start EC2 runner
27-
id: start-ec2-runner
28-
uses: machulav/ec2-github-runner@v2
29-
with:
30-
mode: start
31-
github-token: ${{ secrets.PAT }}
32-
ec2-image-id: ami-07758124f42f794bf
33-
ec2-instance-type: c5.2xlarge
34-
subnet-id: subnet-f7edb991
35-
security-group-id: sg-fd5185e7
3613
test:
3714
name: Do the job on the runner
38-
needs: start-runner # required to start the main job when the runner is ready
39-
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
15+
runs-on: self-hosted
4016
container: ghcr.io/deepmodeling/abacus-development-kit:gnu
4117
steps:
4218
- name: Checkout
@@ -48,27 +24,6 @@ jobs:
4824
GTEST_COLOR: 'yes'
4925
run: |
5026
cmake -B build -DBUILD_TESTING=ON
51-
cmake --build build -j16
27+
cmake --build build -j8
5228
cmake --install build
5329
cmake --build build --target test ARGS="-V"
54-
stop-runner:
55-
name: Stop self-hosted EC2 runner
56-
needs:
57-
- start-runner # required to get output from the start-runner job
58-
- test # required to wait when the main job is done
59-
runs-on: ubuntu-latest
60-
if: ${{ always() }} # required to stop the runner even if the error happened in the previous jobs
61-
steps:
62-
- name: Configure AWS credentials
63-
uses: aws-actions/configure-aws-credentials@v1
64-
with:
65-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
66-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
67-
aws-region: ${{ secrets.AWS_REGION }}
68-
- name: Stop EC2 runner
69-
uses: machulav/ec2-github-runner@v2
70-
with:
71-
mode: stop
72-
github-token: ${{ secrets.PAT }}
73-
label: ${{ needs.start-runner.outputs.label }}
74-
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}

source/module_base/tool_quit.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#else
1010
#include "global_variable.h"
1111
#include "global_file.h"
12-
#include "../src_parallel/parallel_common.h"
1312
#include "timer.h"
1413
#include "memory.h"
1514
#endif
@@ -88,14 +87,14 @@ void WARNING_QUIT(const std::string &file,const std::string &description)
8887
//printf( " \e[32m%s\e[0m\n", description.c_str());
8988
//printf( " \e[32m%s\e[0m", "CHECK IN FILE : ");
9089
//printf( "\e[32m%s\e[0m", GlobalV::global_out_dir.c_str());
91-
//printf( "\e[32m%s\e[0m\n", "warning.log");
92-
//printf( "\e[32m%s\e[0m\n", " ---------------------------------------------------");
90+
//printf( "\e[32m%s\e[0m\n", "warning.log");
91+
//printf( "\e[32m%s\e[0m\n", " ---------------------------------------------------");
9392
printf( "[32m%s[0m\n", " -------------- SOMETHING TO WARN YOU ! ------------");
9493
printf( " [32m%s[0m\n", description.c_str());
9594
printf( " [32m%s[0m", "CHECK IN FILE : ");
9695
printf( "[32m%s[0m", GlobalV::global_out_dir.c_str());
97-
printf( "[32m%s[0m\n", "warning.log");
98-
printf( "[32m%s[0m\n", " ---------------------------------------------------");
96+
printf( "[32m%s[0m\n", "warning.log");
97+
printf( "[32m%s[0m\n", " ---------------------------------------------------");
9998
}
10099
else
101100
{
@@ -132,4 +131,4 @@ void WARNING_QUIT(const std::string &file,const std::string &description)
132131
QUIT();
133132
}
134133

135-
}
134+
}

source/module_md/test/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,21 @@ list(APPEND depend_files
4242

4343
AddTest(
4444
TARGET md_LJ_pot
45+
LIBS ${math_libs}
4546
SOURCES LJ_pot_test.cpp
4647
${depend_files}
4748
)
4849

4950
AddTest(
5051
TARGET md_func
52+
LIBS ${math_libs}
5153
SOURCES MD_func_test.cpp
5254
${depend_files}
5355
)
5456

5557
AddTest(
5658
TARGET md_fire
59+
LIBS ${math_libs}
5760
SOURCES FIRE_test.cpp
5861
../verlet.cpp
5962
../FIRE.cpp
@@ -62,6 +65,7 @@ AddTest(
6265

6366
AddTest(
6467
TARGET md_nve
68+
LIBS ${math_libs}
6569
SOURCES NVE_test.cpp
6670
../verlet.cpp
6771
../NVE.cpp
@@ -70,6 +74,7 @@ AddTest(
7074

7175
AddTest(
7276
TARGET md_nvt_ads
77+
LIBS ${math_libs}
7378
SOURCES NVT_ADS_test.cpp
7479
../verlet.cpp
7580
../NVT_ADS.cpp
@@ -78,6 +83,7 @@ AddTest(
7883

7984
AddTest(
8085
TARGET md_nvt_nhc
86+
LIBS ${math_libs}
8187
SOURCES NVT_NHC_test.cpp
8288
../verlet.cpp
8389
../NVT_NHC.cpp
@@ -86,6 +92,7 @@ AddTest(
8692

8793
AddTest(
8894
TARGET md_msst
95+
LIBS ${math_libs}
8996
SOURCES MSST_test.cpp
9097
../verlet.cpp
9198
../MSST.cpp
@@ -94,6 +101,7 @@ AddTest(
94101

95102
AddTest(
96103
TARGET md_lgv
104+
LIBS ${math_libs}
97105
SOURCES Langevin_test.cpp
98106
../verlet.cpp
99107
../Langevin.cpp

source/module_orbital/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ add_library(
1313
ORB_table_beta.cpp
1414
ORB_table_phi.cpp
1515
)
16+
17+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
18+
IF (BUILD_TESTING)
19+
set(CMAKE_CXX_STANDARD 14)
20+
add_subdirectory(test)
21+
endif()
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#include<gtest/gtest.h>
2+
#include"ORB_unittest.h"
3+
4+
//Test whether the 2-center-int results
5+
// and its derivative from two clases are equal.
6+
// - ORB_gen_table::snap_psipsi(job=0) and Center2_Orb::Orb11::cal_overlap
7+
// - ORB_gen_table::snap_psipsi(job=1) and Center2_Orb::Orb11::cal_grad_overlap
8+
TEST_F(test_orb, equal_test)
9+
{
10+
11+
this->set_center2orbs();
12+
//equal test
13+
//orb
14+
double olm_0[1] = { 0 };
15+
double olm_1[3] = { 0,0,0 };
16+
//center2orb
17+
double clm_0 = 0;
18+
ModuleBase::Vector3<double> clm_1;
19+
20+
//test parameters
21+
const double rmax = 5; //Ry
22+
srand((unsigned)time(NULL));
23+
ModuleBase::Vector3<double> R1(0, 0, 0);
24+
ModuleBase::Vector3<double> R2(randr(rmax), randr(rmax), randr(rmax));
25+
std::cout << "random R2=(" << R2.x << "," << R2.y << "," << R2.z << ")" << std::endl;
26+
ModuleBase::Vector3<double> dR = ModuleBase::Vector3<double>(0.001, 0.001, 0.001);
27+
//4. calculate overlap and grad_overlap by both methods
28+
int T1 = 0;
29+
30+
for (int T2 = 0;T2 < ORB.get_ntype();++T2)
31+
{
32+
for (int L1 = 0;L1 < ORB.Phi[T1].getLmax();++L1)
33+
{
34+
for (int N1 = 0;N1 < ORB.Phi[T1].getNchi(L1);++N1)
35+
{
36+
for (int L2 = 0;L2 < ORB.Phi[T2].getLmax();++L2)
37+
{
38+
for (int N2 = 0;N2 < ORB.Phi[T2].getNchi(L2);++N2)
39+
{
40+
for (int m1 = 0;m1 < 2 * L1 + 1;++m1)
41+
{
42+
for (int m2 = 0;m2 < 2 * L2 + 1;++m2)
43+
{
44+
OGT.snap_psipsi(
45+
ORB, olm_0, 0, 'S',
46+
R1, T1, L1, m1, N1,
47+
R2, T2, L2, m2, N2,
48+
1, NULL);
49+
OGT.snap_psipsi(
50+
ORB, olm_1, 1, 'S',
51+
R1, T1, L1, m1, N1,
52+
R2, T2, L2, m2, N2,
53+
1, NULL);
54+
//std::cout << this->mock_center2_orb11[T1][T2][L1][N1][L2][N2]->cal_overlap(R1, R2, m1, m2);
55+
clm_0 =
56+
test_center2_orb11[T1][T2][L1][N1][L2][N2]->cal_overlap(R1, R2, m1, m2);
57+
clm_1 =
58+
test_center2_orb11[T1][T2][L1][N1][L2][N2]->cal_grad_overlap(R1, R2, m1, m2);
59+
EXPECT_NEAR(olm_0[0], clm_0, 1e-10);
60+
EXPECT_NEAR(olm_1[0], clm_1.x, 1e-10);
61+
EXPECT_NEAR(olm_1[1], clm_1.y, 1e-10);
62+
EXPECT_NEAR(olm_1[2], clm_1.z, 1e-10);
63+
ModuleBase::GlobalFunc::ZEROS(olm_1, 3);
64+
}
65+
}
66+
}
67+
68+
}
69+
}
70+
}
71+
}
72+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
remove_definitions(-D__MPI)
2+
3+
list(APPEND depend_files
4+
../../module_base/math_integral.cpp
5+
../../module_base/math_sphbes.cpp
6+
../../module_base/math_polyint.cpp
7+
../../module_base/math_ylmreal.cpp
8+
../../module_base/ylm.cpp
9+
../../module_base/memory.cpp
10+
../../module_base/complexarray.cpp
11+
../../module_base/complexmatrix.cpp
12+
../../module_base/matrix.cpp
13+
../../module_base/realarray.cpp
14+
../../module_base/intarray.cpp
15+
../../module_base/sph_bessel.cpp
16+
../../module_base/sph_bessel_recursive-d1.cpp
17+
../../module_base/sph_bessel_recursive-d2.cpp
18+
../../module_base/tool_title.cpp
19+
../../module_base/tool_quit.cpp
20+
../../module_base/tool_check.cpp
21+
../../module_base/timer.cpp
22+
../../module_base/mathzone_add1.cpp
23+
../../module_base/global_variable.cpp
24+
../../module_base/global_function.cpp
25+
../../module_base/global_file.cpp
26+
../ORB_control.cpp
27+
../ORB_read.cpp
28+
../ORB_atomic.cpp
29+
../ORB_atomic_lm.cpp
30+
../ORB_nonlocal.cpp
31+
../ORB_nonlocal_lm.cpp
32+
../ORB_gaunt_table.cpp
33+
../ORB_table_beta.cpp
34+
../ORB_table_phi.cpp
35+
../ORB_table_alpha.cpp
36+
../ORB_gen_tables.cpp
37+
../../src_lcao/center2_orb-orb11.cpp
38+
)
39+
AddTest(
40+
TARGET orbital_equal_test
41+
LIBS ${math_libs}
42+
SOURCES 1_snap_equal_test.cpp ORB_unittest.cpp
43+
${depend_files}
44+
)
45+
install(DIRECTORY GaAs DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/../../../tests)
46+
install(DIRECTORY GaAs DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

0 commit comments

Comments
 (0)