Skip to content

Commit 7dd4910

Browse files
committed
Merge branch 'develop' of https://github.com/deepmodeling/abacus-develop into develop
2 parents 11b3353 + 01e8920 commit 7dd4910

File tree

21 files changed

+332
-36
lines changed

21 files changed

+332
-36
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ target_link_libraries(${ABACUS_BIN_NAME} Threads::Threads)
5353
if(USE_OPENMP)
5454
find_package(OpenMP REQUIRED)
5555
target_link_libraries(${ABACUS_BIN_NAME} OpenMP::OpenMP_CXX)
56+
add_compile_options(${OpenMP_CXX_FLAGS})
57+
add_link_options(${OpenMP_CXX_LIBRARIES})
5658
endif()
5759

5860
include(CheckLanguage)

source/module_md/FIRE.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ void FIRE::first_half()
6464
}
6565
#ifdef __MPI
6666
MPI_Bcast(pos , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
67+
MPI_Bcast(vel , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
6768
#endif
6869

6970
ucell.update_pos_tau(pos);

source/module_md/MD_func.cpp

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,38 +75,35 @@ void MD_func::kinetic_stress(
7575
// This function calculates the classical kinetic energy of atoms
7676
// and its contribution to stress.
7777
//----------------------------------------------------------------------------
78-
if(GlobalV::MY_RANK==0) //only first rank do md
78+
kinetic = MD_func::GetAtomKE(unit_in.nat, vel, allmass);
79+
80+
if(GlobalV::CAL_STRESS)
7981
{
80-
kinetic = MD_func::GetAtomKE(unit_in.nat, vel, allmass);
82+
ModuleBase::matrix temp;
83+
temp.create(3,3); // initialize
8184

82-
if(GlobalV::CAL_STRESS)
85+
for(int ion=0; ion<unit_in.nat; ++ion)
8386
{
84-
ModuleBase::matrix temp;
85-
temp.create(3,3); // initialize
86-
87-
for(int ion=0; ion<unit_in.nat; ++ion)
87+
for(int i=0; i<3; ++i)
8888
{
89-
for(int i=0; i<3; ++i)
89+
for(int j=i; j<3; ++j)
9090
{
91-
for(int j=i; j<3; ++j)
92-
{
93-
temp(i, j) += allmass[ion] * vel[ion][i] * vel[ion][j];
94-
}
91+
temp(i, j) += allmass[ion] * vel[ion][i] * vel[ion][j];
9592
}
9693
}
94+
}
9795

98-
for(int i=0; i<3; ++i)
96+
for(int i=0; i<3; ++i)
97+
{
98+
for(int j=0; j<3; ++j)
9999
{
100-
for(int j=0; j<3; ++j)
100+
if(j<i)
101+
{
102+
stress(i, j) = stress(j, i);
103+
}
104+
else
101105
{
102-
if(j<i)
103-
{
104-
stress(i, j) = stress(j, i);
105-
}
106-
else
107-
{
108-
stress(i, j) = temp(i, j)/unit_in.omega;
109-
}
106+
stress(i, j) = temp(i, j)/unit_in.omega;
110107
}
111108
}
112109
}

source/module_md/MSST.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ void MSST::first_half()
7979
const int sd = mdp.msst_direction;
8080
const double dthalf = 0.5 * mdp.md_dt;
8181
double vol;
82-
if( GlobalV::MY_RANK == 0 )
83-
{
8482
energy_ = potential + kinetic;
8583

8684
// propagate the time derivative of volume 1/2 step
@@ -119,9 +117,9 @@ void MSST::first_half()
119117
{
120118
pos[i] += vel[i] * mdp.md_dt;
121119
}
122-
}
123120
#ifdef __MPI
124121
MPI_Bcast(pos , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
122+
MPI_Bcast(vel , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
125123
#endif
126124

127125
ucell.update_pos_tau(pos);
@@ -143,8 +141,6 @@ void MSST::second_half()
143141

144142
const int sd = mdp.msst_direction;
145143
const double dthalf = 0.5 * mdp.md_dt;
146-
if( GlobalV::MY_RANK == 0 )
147-
{
148144
energy_ = potential + kinetic;
149145

150146
// propagate velocities 1/2 step
@@ -159,7 +155,6 @@ void MSST::second_half()
159155

160156
// calculate Lagrangian position
161157
lag_pos -= mdp.msst_vel * ucell.omega / v0 * mdp.md_dt;
162-
}
163158

164159
ModuleBase::timer::tick("MSST", "second_half");
165160
}

source/module_md/verlet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ void Verlet::first_half()
8989
}
9090
#ifdef __MPI
9191
MPI_Bcast(pos , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
92+
MPI_Bcast(vel , ucell.nat*3,MPI_DOUBLE,0,MPI_COMM_WORLD);
9293
#endif
9394

9495
ucell.update_pos_tau(pos);
@@ -98,7 +99,6 @@ void Verlet::first_half()
9899

99100
void Verlet::second_half()
100101
{
101-
if(GlobalV::MY_RANK==0) //only first rank do md
102102
for(int i=0; i<ucell.nat; ++i)
103103
{
104104
for(int k=0; k<3; ++k)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
INPUT_PARAMETERS
2+
#Parameters (1.General)
3+
suffix autotest
4+
calculation scf
5+
ntype 1
6+
nbands 6
7+
symmetry 1
8+
pseudo_dir ../tools/PP_ORB/
9+
pseudo_type upf201
10+
11+
#Parameters (2.Iteration)
12+
ecutwfc 20
13+
scf_thr 1e-9
14+
scf_nmax 100
15+
16+
#Parameters (3.Basis)
17+
basis_type pw
18+
19+
out_wfc_r 1

tests/integrate/107_PW_outWfcR/KPT

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K_POINTS
2+
0
3+
Gamma
4+
1 1 1 0 0 0
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ATOMIC_SPECIES
2+
Si 14 Si_ONCV_PBE-1.0.upf
3+
4+
LATTICE_CONSTANT
5+
10.2 // add lattice constant
6+
7+
LATTICE_VECTORS
8+
0.5 0.5 0.0
9+
0.5 0.0 0.5
10+
0.0 0.5 0.5
11+
12+
ATOMIC_POSITIONS
13+
Direct
14+
15+
Si // Element type
16+
0.0 // magnetism
17+
2
18+
0.00 0.00 0.00 1 1 1
19+
0.25 0.25 0.25 1 1 1

tests/integrate/107_PW_outWfcR/jd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test the output of wfc_r, and compare the variance
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
etotref -197.1405644352783
2+
etotperatomref -98.5702822176
3+
variance_wfc_r_0_0 0.31340
4+
variance_wfc_r_0_1 2.68637
5+
variance_wfc_r_0_2 1.89907
6+
variance_wfc_r_0_3 1.96089
7+
variance_wfc_r_0_4 1.26491
8+
variance_wfc_r_0_5 0.84051
9+
totaltimeref 0.20294

0 commit comments

Comments
 (0)