Skip to content

Commit e1c9ae3

Browse files
committed
Fix check_gvx() bug when using mpirun.
1 parent b4eae9c commit e1c9ae3

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

source/module_hamilt_lcao/module_deepks/cal_gdmx.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ void LCAO_Deepks::cal_gdmx(const std::vector<std::vector<TK>>& dm,
172172
* overlap_1->get_value(row_indexes[iw1], ib + m1) * *dm_current;
173173

174174
//(<d/dX chi_nu|alpha_m'>)<chi_mu|alpha_m>
175-
accessor[i][iat][inl][m1][m2]
176-
+= grad_overlap_2[i]->get_value(col_indexes[iw2], ib + m1)
177-
* overlap_1->get_value(row_indexes[iw1], ib + m2) * *dm_current;
175+
accessor[i][iat][inl][m2][m1]
176+
+= grad_overlap_2[i]->get_value(col_indexes[iw2], ib + m2)
177+
* overlap_1->get_value(row_indexes[iw1], ib + m1) * *dm_current;
178178

179179
// (<chi_mu|d/dX alpha_m>)<chi_nu|alpha_m'> = -(<d/dX
180180
// chi_mu|alpha_m>)<chi_nu|alpha_m'>
@@ -184,9 +184,9 @@ void LCAO_Deepks::cal_gdmx(const std::vector<std::vector<TK>>& dm,
184184

185185
//(<chi_nu|d/dX alpha_m'>)<chi_mu|alpha_m> = -(<d/dX
186186
//chi_nu|alpha_m'>)<chi_mu|alpha_m>
187-
accessor[i][ibt2][inl][m1][m2]
188-
-= grad_overlap_2[i]->get_value(col_indexes[iw2], ib + m1)
189-
* overlap_1->get_value(row_indexes[iw1], ib + m2) * *dm_current;
187+
accessor[i][ibt2][inl][m2][m1]
188+
-= grad_overlap_2[i]->get_value(col_indexes[iw2], ib + m2)
189+
* overlap_1->get_value(row_indexes[iw1], ib + m1) * *dm_current;
190190
}
191191
}
192192
}

source/module_hamilt_lcao/module_deepks/cal_gvx.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,11 @@ void LCAO_Deepks::check_gvx(const int nat, const torch::Tensor& gvx)
9999
std::ofstream ofs_y;
100100
std::ofstream ofs_z;
101101

102-
ofs_x << std::setprecision(12);
103-
ofs_y << std::setprecision(12);
104-
ofs_z << std::setprecision(12);
105-
102+
if (GlobalV::MY_RANK != 0)
103+
{
104+
return;
105+
}
106+
106107
auto accessor = gvx.accessor<double, 4>();
107108

108109
for (int ia = 0; ia < nat; ia++)
@@ -125,7 +126,6 @@ void LCAO_Deepks::check_gvx(const int nat, const torch::Tensor& gvx)
125126
{
126127
for (int inl = 0; inl < inlmax / nat; inl++)
127128
{
128-
int nm = 2 * inl_l[inl] + 1;
129129
{
130130
ofs_x << accessor[ia][0][ib][inl] << " ";
131131
ofs_y << accessor[ia][1][ib][inl] << " ";

source/module_hamilt_lcao/module_deepks/test/Makefile.Objects

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ nnr.o\
1111
LCAO_deepks.o\
1212
LCAO_deepks_fdelta.o\
1313
LCAO_deepks_io.o\
14-
LCAO_deepks_mpi.o\
1514
LCAO_deepks_pdm.o\
1615
LCAO_deepks_phialpha.o\
1716
LCAO_deepks_vdelta.o\

0 commit comments

Comments
 (0)