Skip to content

Commit 2465749

Browse files
authored
Merge branch 'develop' into gpu_mem_recorder
2 parents aa7a88d + a2fdb95 commit 2465749

Some content is hidden

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

60 files changed

+401
-859
lines changed

.github/workflows/coverage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
env:
2626
OMP_NUM_THREADS: 1
2727
run: |
28-
cmake --build build --target test ARGS="-V --timeout 21600"
28+
cmake --build build --target test ARGS="-V --timeout 21600" || exit 0
2929
- name: Upload Coverage to Codecov
3030
uses: codecov/codecov-action@v4
3131
if: ${{ ! cancelled() }}

docs/advanced/input_files/input-main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ Note: In new angle mixing, you should set `mixing_beta_mag >> mixing_beta`. The
11761176

11771177
- **Type**: Integer
11781178
- **Description**: Print out energy for each band for every printe step
1179-
- **Default**: 100
1179+
- **Default**: `scf_nmax`
11801180

11811181
### scf_nmax
11821182

source/Makefile.Objects

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,8 @@ OBJS_ESOLVER=esolver.o\
245245
esolver_of.o\
246246
esolver_of_tool.o\
247247
esolver_of_interface.o\
248-
pw_fun.o\
249248
pw_init_after_vc.o\
250249
pw_init_globalc.o\
251-
pw_nscf.o\
252250
pw_others.o\
253251

254252
OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
@@ -259,7 +257,6 @@ OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
259257
set_matrix_grid.o\
260258
lcao_before_scf.o\
261259
lcao_gets.o\
262-
lcao_nscf.o\
263260
lcao_others.o\
264261
lcao_init_after_vc.o\
265262
lcao_fun.o\

source/driver_run.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,14 @@ void Driver::driver_run() {
6262
{
6363
Run_MD::md_line(GlobalC::ucell, p_esolver, PARAM);
6464
}
65-
else if (cal_type == "scf" || cal_type == "relax" || cal_type == "cell-relax")
65+
else if (cal_type == "scf" || cal_type == "relax" || cal_type == "cell-relax" || cal_type == "nscf")
6666
{
6767
Relax_Driver rl_driver;
6868
rl_driver.relax_driver(p_esolver);
6969
}
7070
else
7171
{
7272
//! supported "other" functions:
73-
//! nscf(PW,LCAO),
7473
//! get_pchg(LCAO),
7574
//! test_memory(PW,LCAO),
7675
//! test_neighbour(LCAO),

source/module_elecstate/elecstate_lcao.cpp

Lines changed: 27 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#include "elecstate_lcao.h"
22

3-
#include <vector>
4-
53
#include "cal_dm.h"
64
#include "module_base/timer.h"
75
#include "module_elecstate/module_dm/cal_dm_psi.h"
@@ -11,6 +9,8 @@
119
#include "module_hamilt_pw/hamilt_pwdft/global.h"
1210
#include "module_parameter/parameter.h"
1311

12+
#include <vector>
13+
1414
namespace elecstate
1515
{
1616

@@ -21,34 +21,31 @@ void ElecStateLCAO<std::complex<double>>::psiToRho(const psi::Psi<std::complex<d
2121
ModuleBase::TITLE("ElecStateLCAO", "psiToRho");
2222
ModuleBase::timer::tick("ElecStateLCAO", "psiToRho");
2323

24-
this->calculate_weights();
25-
26-
// the calculations of dm, and dm -> rho are, technically, two separate
27-
// functionalities, as we cannot rule out the possibility that we may have a
28-
// dm from other sources, such as read from file. However, since we are not
29-
// separating them now, I opt to add a flag to control how dm is obtained as
30-
// of now
31-
if (!PARAM.inp.dm_to_rho)
32-
{
33-
this->calEBand();
34-
35-
ModuleBase::GlobalFunc::NOTE("Calculate the density matrix.");
36-
37-
// this part for calculating DMK in 2d-block format, not used for charge
38-
// now
39-
// psi::Psi<std::complex<double>> dm_k_2d();
40-
41-
if (PARAM.inp.ks_solver == "genelpa" || PARAM.inp.ks_solver == "elpa" || PARAM.inp.ks_solver == "scalapack_gvx" || PARAM.inp.ks_solver == "lapack"
42-
|| PARAM.inp.ks_solver == "cusolver" || PARAM.inp.ks_solver == "cusolvermp"
43-
|| PARAM.inp.ks_solver == "cg_in_lcao") // Peize Lin test 2019-05-15
44-
{
45-
elecstate::cal_dm_psi(this->DM->get_paraV_pointer(),
46-
this->wg,
47-
psi,
48-
*(this->DM));
49-
this->DM->cal_DMR();
50-
}
51-
}
24+
// // the calculations of dm, and dm -> rho are, technically, two separate
25+
// // functionalities, as we cannot rule out the possibility that we may have a
26+
// // dm from other sources, such as read from file. However, since we are not
27+
// // separating them now, I opt to add a flag to control how dm is obtained as
28+
// // of now
29+
// if (!PARAM.inp.dm_to_rho)
30+
// {
31+
// ModuleBase::GlobalFunc::NOTE("Calculate the density matrix.");
32+
33+
// // this part for calculating DMK in 2d-block format, not used for charge
34+
// // now
35+
// // psi::Psi<std::complex<double>> dm_k_2d();
36+
37+
// if (PARAM.inp.ks_solver == "genelpa" || PARAM.inp.ks_solver == "elpa" || PARAM.inp.ks_solver ==
38+
// "scalapack_gvx" || PARAM.inp.ks_solver == "lapack"
39+
// || PARAM.inp.ks_solver == "cusolver" || PARAM.inp.ks_solver == "cusolvermp"
40+
// || PARAM.inp.ks_solver == "cg_in_lcao") // Peize Lin test 2019-05-15
41+
// {
42+
// elecstate::cal_dm_psi(this->DM->get_paraV_pointer(),
43+
// this->wg,
44+
// psi,
45+
// *(this->DM));
46+
// this->DM->cal_DMR();
47+
// }
48+
// }
5249

5350
for (int is = 0; is < PARAM.inp.nspin; is++)
5451
{
@@ -83,23 +80,6 @@ void ElecStateLCAO<double>::psiToRho(const psi::Psi<double>& psi)
8380
ModuleBase::TITLE("ElecStateLCAO", "psiToRho");
8481
ModuleBase::timer::tick("ElecStateLCAO", "psiToRho");
8582

86-
this->calculate_weights();
87-
this->calEBand();
88-
89-
if (PARAM.inp.ks_solver == "genelpa" || PARAM.inp.ks_solver == "elpa" || PARAM.inp.ks_solver == "scalapack_gvx" || PARAM.inp.ks_solver == "lapack"
90-
|| PARAM.inp.ks_solver == "cusolver" || PARAM.inp.ks_solver == "cusolvermp" || PARAM.inp.ks_solver == "cg_in_lcao")
91-
{
92-
ModuleBase::timer::tick("ElecStateLCAO", "cal_dm_2d");
93-
94-
// get DMK in 2d-block format
95-
elecstate::cal_dm_psi(this->DM->get_paraV_pointer(),
96-
this->wg,
97-
psi,
98-
*(this->DM));
99-
this->DM->cal_DMR();
100-
ModuleBase::timer::tick("ElecStateLCAO", "cal_dm_2d");
101-
}
102-
10383
for (int is = 0; is < PARAM.inp.nspin; is++)
10484
{
10585
ModuleBase::GlobalFunc::ZEROS(this->charge->rho[is],

source/module_elecstate/elecstate_lcao.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ class ElecStateLCAO : public ElecState
7474
void dmToRho(std::vector<TK*> pexsi_DM, std::vector<TK*> pexsi_EDM);
7575
#endif
7676

77+
DensityMatrix<TK, double>* DM = nullptr;
78+
7779
protected:
7880
// calculate electronic charge density on grid points or density matrix in real space
7981
// the consequence charge density rho saved into rho_out, preparing for charge mixing.
@@ -85,7 +87,6 @@ class ElecStateLCAO : public ElecState
8587

8688
Gint_Gamma* gint_gamma = nullptr; // mohan add 2024-04-01
8789
Gint_k* gint_k = nullptr; // mohan add 2024-04-01
88-
DensityMatrix<TK, double>* DM = nullptr;
8990
};
9091

9192
template <typename TK>

source/module_elecstate/elecstate_pw.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ void ElecStatePW<T, Device>::psiToRho(const psi::Psi<T, Device>& psi)
8989
ModuleBase::timer::tick("ElecStatePW", "psiToRho");
9090

9191
this->init_rho_data();
92-
this->calculate_weights();
93-
94-
this->calEBand();
9592

9693
for(int is=0; is<PARAM.inp.nspin; is++)
9794
{

source/module_elecstate/elecstate_pw_sdft.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ void ElecStatePW_SDFT<T, Device>::psiToRho(const psi::Psi<T, Device>& psi)
1717

1818
if (GlobalV::MY_STOGROUP == 0)
1919
{
20-
this->calEBand();
21-
2220
for (int is = 0; is < nspin; is++)
2321
{
2422
setmem_var_op()(this->ctx, this->rho[is], 0, this->charge->nrxx);

source/module_elecstate/test/elecstate_print_test.cpp

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -390,37 +390,4 @@ TEST_F(ElecStatePrintTest, PrintEtotColorS4)
390390
PARAM.input.noncolin = true;
391391
GlobalV::MY_RANK = 0;
392392
elecstate.print_etot(converged, iter, scf_thr, scf_thr_kin, duration, printe, pw_diag_thr, avg_iter, print);
393-
}
394-
395-
// TEST_F(ElecStatePrintTest, PrintEtotWarning)
396-
// {
397-
// GlobalV::ofs_running.open("test.dat", std::ios::out);
398-
// bool converged = false;
399-
// int iter = 1;
400-
// double scf_thr = 0.1;
401-
// double scf_thr_kin = 0.0;
402-
// double duration = 2.0;
403-
// int printe = 0;
404-
// double pw_diag_thr = 0.1;
405-
// int avg_iter = 2;
406-
// bool print = true;
407-
// elecstate.charge = new Charge;
408-
// elecstate.charge->nrxx = 100;
409-
// elecstate.charge->nxyz = 1000;
410-
// PARAM.input.imp_sol = true;
411-
// PARAM.input.efield_flag = true;
412-
// PARAM.input.gate_flag = true;
413-
// PARAM.sys.two_fermi = false;
414-
// PARAM.input.out_bandgap = true;
415-
// GlobalV::MY_RANK = 0;
416-
// PARAM.input.basis_type = "pw";
417-
// PARAM.input.scf_nmax = 100;
418-
// elecstate::tmp_ks_solver = "unknown";
419-
// testing::internal::CaptureStdout();
420-
// EXPECT_EXIT(elecstate.print_etot(converged, iter, scf_thr, scf_thr_kin, duration, printe, pw_diag_thr, avg_iter, print), ::testing::ExitedWithCode(0), "");
421-
// output = testing::internal::GetCapturedStdout();
422-
// EXPECT_THAT(output, testing::HasSubstr("print_etot found unknown ks_solver_type"));
423-
// GlobalV::ofs_running.close();
424-
// delete elecstate.charge;
425-
// std::remove("test.dat");
426-
// }
393+
}

source/module_esolver/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ list(APPEND objects
1010
esolver_of.cpp
1111
esolver_of_interface.cpp
1212
esolver_of_tool.cpp
13-
pw_fun.cpp
1413
pw_init_after_vc.cpp
1514
pw_init_globalc.cpp
16-
pw_nscf.cpp
1715
pw_others.cpp
1816
)
1917
if(ENABLE_LCAO)
@@ -26,7 +24,6 @@ if(ENABLE_LCAO)
2624
dftu_cal_occup_m.cpp
2725
lcao_before_scf.cpp
2826
lcao_gets.cpp
29-
lcao_nscf.cpp
3027
lcao_others.cpp
3128
lcao_init_after_vc.cpp
3229
lcao_fun.cpp

0 commit comments

Comments
 (0)