Skip to content

Commit 069dd0c

Browse files
authored
Merge branch 'develop' into fft12
2 parents 10f0ad2 + ab2e27a commit 069dd0c

Some content is hidden

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

46 files changed

+1130
-494
lines changed

docs/advanced/acceleration/cuda.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ We provides [examples](https://github.com/deepmodeling/abacus-develop/tree/devel
4646
PW basis:
4747
- Only k point parallelization is supported, so the input keyword `kpar` will be set to match the number of MPI tasks automatically.
4848
- By default, CUDA architectures 60, 70, 75, 80, 86, and 89 are compiled (if supported). It can be overriden using the CMake variable [`CMAKE_CUDA_ARCHITECTURES`](https://cmake.org/cmake/help/latest/variable/CMAKE_CUDA_ARCHITECTURES.html) or the environmental variable [`CUDAARCHS`](https://cmake.org/cmake/help/latest/envvar/CUDAARCHS.html).
49+
4950
LCAO basis:
5051
- Unless there is a specific reason, avoid using multiple GPUs, as it can be slower than using a single GPU. This is because the generalized eigenvalue solution of the LCAO basis set will incur additional communication overhead when calculated on multiple cards. When the memory limit of a GPU card makes it insufficient to complete the task, it is recommended to use multiple cards for calculation.
5152
- When using elpa on GPUs, some ELPA internal logs will be output.

docs/advanced/input_files/input-main.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
- [out\_wfc\_r](#out_wfc_r)
141141
- [out\_wfc\_lcao](#out_wfc_lcao)
142142
- [out\_dos](#out_dos)
143+
- [out\_ldos](#out_ldos)
143144
- [out\_band](#out_band)
144145
- [out\_proj\_band](#out_proj_band)
145146
- [out\_stru](#out_stru)
@@ -154,6 +155,7 @@
154155
- [out\_mat\_dh](#out_mat_dh)
155156
- [out\_mat\_xc](#out_mat_xc)
156157
- [out\_mat\_xc2](#out_mat_xc2)
158+
- [out\_mat\_l](#out_mat_l)
157159
- [out\_eband\_terms](#out_eband_terms)
158160
- [out\_hr\_npz/out\_dm\_npz](#out_hr_npzout_dm_npz)
159161
- [dm\_to\_rho](#dm_to_rho)
@@ -174,6 +176,7 @@
174176
- [dos\_emin\_ev](#dos_emin_ev)
175177
- [dos\_emax\_ev](#dos_emax_ev)
176178
- [dos\_nche](#dos_nche)
179+
- [stm\_bias](#stm_bias)
177180
- [NAOs](#naos)
178181
- [bessel\_nao\_ecut](#bessel_nao_ecut)
179182
- [bessel\_nao\_tolerence](#bessel_nao_tolerence)
@@ -1706,6 +1709,12 @@ These variables are used to control the output of properties.
17061709
- lcao-only: output the density of states (DOS) and the projected density of states (PDOS)
17071710
- **Default**: 0
17081711

1712+
### out_ldos
1713+
1714+
- **Type**: Boolean
1715+
- **Description**: Whether to output the local density of states for given bias in cube file format, which is controlled by [stm_bias](#stm_bias).
1716+
- **Default**: False
1717+
17091718
### out_band
17101719

17111720
- **Type**: Boolean \[Integer\](optional)
@@ -1807,6 +1816,13 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t
18071816
- **Description**: Whether to print the exchange-correlation matrices in **numerical orbital representation** (unit: Ry): $\braket{\phi_i|V_\text{xc}^\text{(semi-)local}+V_\text{exx}+V_\text{DFTU}|\phi_j}(\mathbf{R})$ in CSR format (the same format as [out_mat_hs2](../elec_properties/hs_matrix.md#out_mat_hs2)) in the directory `OUT.${suffix}`. (Note that currently DeePKS term is not included. ) The files are named `Vxc_R_spin$s`.
18081817
- **Default**: False
18091818

1819+
### out_mat_l
1820+
1821+
- **Type**: Boolean [Integer\](optional)
1822+
- **Availability**: Numerical atomic orbital (NAO) basis
1823+
- **Description**: Whether to print the expectation value of the angular momentum operator $\hat{L}_x$, $\hat{L}_y$, and $\hat{L}_z$ in the basis of the localized atomic orbitals. The files are named `OUT.${suffix}/${suffix}_Lx.dat`, `OUT.${suffix}/${suffix}_Ly.dat`, and `OUT.${suffix}/${suffix}_Lz.dat`. The second integer controls the precision of the output.
1824+
- **Default**: False 8
1825+
18101826
### out_eband_terms
18111827

18121828
- **Type**: Boolean
@@ -1955,9 +1971,16 @@ These variables are used to control the calculation of DOS. [Detailed introducti
19551971
### dos_nche
19561972

19571973
- **Type**: Integer
1958-
The order of Chebyshev expansions when using Stochastic Density Functional Theory (SDFT) to calculate DOS.
1974+
- **Description**: The order of Chebyshev expansions when using Stochastic Density Functional Theory (SDFT) to calculate DOS.
19591975
- **Default**: 100
19601976

1977+
### stm_bias
1978+
1979+
- **Type**: Real
1980+
- **Description**: The bias voltage used to calculate local density of states to simulate scanning tunneling microscope, see details in [out_ldos](#out_ldos).
1981+
- **Default**: 1.0
1982+
- **Unit**: V
1983+
19611984
[back to top](#full-list-of-input-keywords)
19621985

19631986
## NAOs

source/Makefile.Objects

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ OBJS_IO=input_conv.o\
497497
write_dos_pw.o\
498498
nscf_band.o\
499499
cal_dos.o\
500+
cal_ldos.o\
500501
cif_io.o\
501502
dos_nao.o\
502503
numerical_descriptor.o\
@@ -554,6 +555,7 @@ OBJS_IO=input_conv.o\
554555
read_input_item_output.o\
555556
read_set_globalv.o\
556557
orb_io.o\
558+
cal_pLpR.o\
557559

558560
OBJS_IO_LCAO=cal_r_overlap_R.o\
559561
write_orb_info.o\

source/module_elecstate/elecstate_pw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ class ElecStatePW : public ElecState
4646
T** rhog = nullptr; // [Device] [spin][nrxx] rhog
4747
Real** kin_r = nullptr; // [Device] [spin][nrxx] kin_r
4848

49+
ModulePW::PW_Basis_K* basis = nullptr;
50+
4951
protected:
5052

5153
ModulePW::PW_Basis* rhopw_smooth = nullptr;
5254

53-
ModulePW::PW_Basis_K* basis = nullptr;
54-
5555
UnitCell* ucell = nullptr;
5656

5757
const pseudopot_cell_vnl* ppcell = nullptr;

source/module_elecstate/fp_energy.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ void fenergy::print_all() const
9696
std::cout << " total= " << etot << std::endl;
9797
}
9898

99-
/// @brief get the reference of fermi of a specific spin
99+
/// @brief set efermi of a specific spin
100100
/// @param is SPIN
101-
/// @return a reference of fermi(is)
102-
double& efermi::get_ef(const int& is)
101+
/// @param ef_in fermi(is)
102+
void efermi::set_efval(const int& is, const double& ef_in)
103103
{
104104
if (!two_efermi)
105105
{
106-
return this->ef;
106+
this->ef = ef_in;
107107
}
108108
else if (is == 0)
109109
{
110-
return this->ef_up;
110+
this->ef_up = ef_in;
111111
}
112112
else if (is == 1)
113113
{
114-
return this->ef_dw;
114+
this->ef_dw = ef_in;
115115
}
116116
else
117117
{

source/module_elecstate/fp_energy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct efermi
6464
double ef_up = 0.0; ///< spin up Fermi energy
6565
double ef_dw = 0.0; ///< spin down Fermi energy
6666
bool two_efermi = false; ///<
67-
double& get_ef(const int& is);
67+
void set_efval(const int& is, const double& ef_in);
6868
double get_efval(const int& is) const;
6969
std::vector<double> get_all_ef() const;
7070
};

source/module_elecstate/test/elecstate_fp_energy_test.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* - fenergy::calculate_harris()
1515
* - fenergy::clear_all()
1616
* - fenergy::print_all()
17-
* - efermi::get_ef()
17+
* - efermi::set_efval()
1818
* - efermi::get_efval()
1919
*/
2020
class fenergy : public ::testing::Test
@@ -61,19 +61,18 @@ TEST_F(fenergy, print_all)
6161
TEST_F(fenergy, eferm_get_ef)
6262
{
6363
eferm.two_efermi = false;
64-
double& tmp_ef = eferm.get_ef(0);
65-
tmp_ef = 0.7;
64+
eferm.set_efval(0, 0.7);
6665
EXPECT_EQ(eferm.ef, 0.7);
66+
eferm.set_efval(2, 0.77);
67+
EXPECT_EQ(eferm.ef, 0.77);
6768
eferm.two_efermi = true;
68-
double& tmp_efup = eferm.get_ef(0);
69-
tmp_efup = 1.0;
70-
EXPECT_EQ(eferm.ef_up, 1.0);
71-
double& tmp_efdw = eferm.get_ef(1);
72-
tmp_efdw = -1.0;
69+
eferm.set_efval(0, 0.6);
70+
EXPECT_EQ(eferm.ef_up, 0.6);
71+
eferm.set_efval(1, -1.0);
7372
EXPECT_EQ(eferm.ef_dw, -1.0);
7473

7574
testing::internal::CaptureStdout();
76-
EXPECT_EXIT(double& tmpp = eferm.get_ef(2);, ::testing::ExitedWithCode(1), "");
75+
EXPECT_EXIT(eferm.set_efval(3, 1.0);, ::testing::ExitedWithCode(1), "");
7776
std::string output = testing::internal::GetCapturedStdout();
7877
EXPECT_THAT(output, testing::HasSubstr("Please check NSPIN when TWO_EFERMI is true"));
7978
}

source/module_esolver/esolver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ESolver
2626
virtual void runner(UnitCell& cell, const int istep) = 0;
2727

2828
//! perform post processing calculations
29-
virtual void after_all_runners(UnitCell& ucell){};
29+
virtual void after_all_runners(UnitCell& ucell) = 0;
3030

3131
//! deal with exx and other calculation than scf/md/relax/cell-relax:
3232
//! such as nscf, get_wf and get_pchg

source/module_esolver/esolver_fp.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,4 +408,12 @@ void ESolver_FP::iter_finish(UnitCell& ucell, const int istep, int& iter, bool&
408408
}
409409
}
410410

411+
void ESolver_FP::after_all_runners(UnitCell& ucell)
412+
{
413+
GlobalV::ofs_running << "\n\n --------------------------------------------" << std::endl;
414+
GlobalV::ofs_running << std::setprecision(16);
415+
GlobalV::ofs_running << " !FINAL_ETOT_IS " << this->pelec->f_en.etot * ModuleBase::Ry_to_eV << " eV" << std::endl;
416+
GlobalV::ofs_running << " --------------------------------------------\n\n" << std::endl;
417+
}
418+
411419
} // namespace ModuleESolver

source/module_esolver/esolver_fp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class ESolver_FP: public ESolver
4949
//! Initialize of the first-principels energy solver
5050
virtual void before_all_runners(UnitCell& ucell, const Input_para& inp) override;
5151

52+
virtual void after_all_runners(UnitCell& ucell) override;
53+
5254
protected:
5355
//! Something to do before SCF iterations.
5456
virtual void before_scf(UnitCell& ucell, const int istep);

0 commit comments

Comments
 (0)