Skip to content

Commit 52e75a5

Browse files
Merge pull request #19 from deepmodeling/develop
Merge With Latest
2 parents d502509 + ab2e27a commit 52e75a5

File tree

414 files changed

+14736
-46880
lines changed

Some content is hidden

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

414 files changed

+14736
-46880
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: 32 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)
@@ -153,6 +154,8 @@
153154
- [out\_mat\_t](#out_mat_t)
154155
- [out\_mat\_dh](#out_mat_dh)
155156
- [out\_mat\_xc](#out_mat_xc)
157+
- [out\_mat\_xc2](#out_mat_xc2)
158+
- [out\_mat\_l](#out_mat_l)
156159
- [out\_eband\_terms](#out_eband_terms)
157160
- [out\_hr\_npz/out\_dm\_npz](#out_hr_npzout_dm_npz)
158161
- [dm\_to\_rho](#dm_to_rho)
@@ -173,6 +176,7 @@
173176
- [dos\_emin\_ev](#dos_emin_ev)
174177
- [dos\_emax\_ev](#dos_emax_ev)
175178
- [dos\_nche](#dos_nche)
179+
- [stm\_bias](#stm_bias)
176180
- [NAOs](#naos)
177181
- [bessel\_nao\_ecut](#bessel_nao_ecut)
178182
- [bessel\_nao\_tolerence](#bessel_nao_tolerence)
@@ -1705,6 +1709,12 @@ These variables are used to control the output of properties.
17051709
- lcao-only: output the density of states (DOS) and the projected density of states (PDOS)
17061710
- **Default**: 0
17071711

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+
17081718
### out_band
17091719

17101720
- **Type**: Boolean \[Integer\](optional)
@@ -1799,6 +1809,20 @@ These variables are used to control the output of properties.
17991809
The band (KS orbital) energy for each (k-point, spin, band) will be printed in the file `OUT.${suffix}/vxc_out.dat`. If EXX is calculated, the local and EXX part of band energy will also be printed in `OUT.${suffix}/vxc_local_out.dat`and `OUT.${suffix}/vxc_exx_out.dat`, respectively. All the `vxc*_out.dat` files contains 3 integers (nk, nspin, nband) followed by nk\*nspin\*nband lines of energy Hartree and eV.
18001810
- **Default**: False
18011811

1812+
### out_mat_xc2
1813+
1814+
- **Type**: Boolean
1815+
- **Availability**: Numerical atomic orbital (NAO) basis
1816+
- **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`.
1817+
- **Default**: False
1818+
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+
18021826
### out_eband_terms
18031827

18041828
- **Type**: Boolean
@@ -1947,9 +1971,16 @@ These variables are used to control the calculation of DOS. [Detailed introducti
19471971
### dos_nche
19481972

19491973
- **Type**: Integer
1950-
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.
19511975
- **Default**: 100
19521976

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+
19531984
[back to top](#full-list-of-input-keywords)
19541985

19551986
## NAOs

docs/quick_start/output.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@ The following files are the central output files for ABACUS. After executing the
66

77
Different from `INPUT` given by the users, `OUT.suffix/INPUT` contains all parameters in ABACUS.
88

9-
> **Note:** `OUT.suffix/INPUT` contain the initial default of ABACUS instead of the real parameters used in calculations. This file is stored for reproduction in case the default value is changed during development. If you want to figure out the real parameters used in calculations, you can open `OUT.suffix/runing_scf.log` and research corresponding parameter you are interested.
9+
> **Note:** `OUT.suffix/INPUT` contains the **actual parameters used in the calculation**, including:
10+
> 1. **User-specified parameters** (explicitly defined in your input file or command-line arguments, overriding default parameters).
11+
> 2. **System default parameters** (automatically applied when not explicitly provided by the user).
12+
13+
14+
This file ensures calculations can be fully reproduced, even if default values change in future ABACUS versions.
15+
Also notice that in rare cases, a small number of parameters may be dynamically reset to appropriate values during runtime.
1016

1117
For a complete list of input parameters, please consult this [instruction](../advanced/input_files/input-main.md).
1218

1319
## *running_scf.log*
1420

1521
`running_scf.log` contains information on nearly all function calls made during the execution of ABACUS.
1622

17-
## *KPT*
23+
## *KPT.info*
1824

1925
This file contains the information of all generated k-points, as well as the list of k-points actually used for calculations after considering symmetry.
2026

@@ -39,4 +45,4 @@ ABACUS generates a `.cif` format structure file based on the input file `STRU`,
3945

4046
## *warning.log*
4147

42-
The file contains all the warning messages generated during the ABACUS run.
48+
The file contains all the warning messages generated during the ABACUS run.

source/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ if(USE_ROCM)
104104
module_hamilt_pw/hamilt_pwdft/kernels/rocm/wf_op.hip.cu
105105
module_hamilt_pw/hamilt_pwdft/kernels/rocm/vnl_op.hip.cu
106106
module_base/kernels/rocm/math_kernel_op.hip.cu
107-
module_base/kernels/rocm/math_kernel_op.hip_vec.cu
107+
module_base/kernels/rocm/math_kernel_op_vec.hip.cu
108108
module_base/kernels/rocm/math_ylm_op.hip.cu
109109
module_hamilt_general/module_xc/kernels/rocm/xc_functional_op.hip.cu
110110
)

source/Makefile.Objects

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ VPATH=./src_global:\
3535
./module_hsolver/module_pexsi:\
3636
./module_elecstate:\
3737
./module_elecstate/kernels:\
38-
./module_elecstate/potentials:\
38+
./module_elecstate/module_pot:\
3939
./module_elecstate/module_charge:\
4040
./module_elecstate/module_dm:\
4141
./module_psi:\
@@ -208,7 +208,7 @@ OBJS_DEEPKS=LCAO_deepks.o\
208208
deepks_orbpre.o\
209209
deepks_vdelta.o\
210210
deepks_vdpre.o\
211-
deepks_hmat.o\
211+
deepks_vdrpre.o\
212212
deepks_pdm.o\
213213
deepks_phialpha.o\
214214
LCAO_deepks_io.o\
@@ -266,6 +266,7 @@ OBJS_ESOLVER_LCAO=esolver_ks_lcao.o\
266266
lcao_after_scf.o\
267267
esolver_gets.o\
268268
lcao_others.o\
269+
esolver_dm2rho.o\
269270

270271
OBJS_GINT=gint.o\
271272
gint_gamma_env.o\
@@ -461,6 +462,14 @@ OBJS_SURCHEM=surchem.o\
461462

462463
OBJS_SYMMETRY=symm_other.o\
463464
symmetry_basic.o\
465+
symm_analysis.o\
466+
symm_check.o\
467+
symm_getgroup.o\
468+
symm_hermite.o\
469+
symm_lattice.o\
470+
symm_magnetic.o\
471+
symm_pricell.o\
472+
symm_rho.o\
464473
symmetry.o\
465474

466475
OBJS_XC=xc_functional.o\
@@ -488,6 +497,7 @@ OBJS_IO=input_conv.o\
488497
write_dos_pw.o\
489498
nscf_band.o\
490499
cal_dos.o\
500+
cal_ldos.o\
491501
cif_io.o\
492502
dos_nao.o\
493503
numerical_descriptor.o\
@@ -545,6 +555,7 @@ OBJS_IO=input_conv.o\
545555
read_input_item_output.o\
546556
read_set_globalv.o\
547557
orb_io.o\
558+
cal_pLpR.o\
548559

549560
OBJS_IO_LCAO=cal_r_overlap_R.o\
550561
write_orb_info.o\

source/driver.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,27 @@ Driver::~Driver()
2323

2424
void Driver::init()
2525
{
26-
ModuleBase::TITLE("Driver", "init");
26+
// 1) Let's start by printing a title.
27+
ModuleBase::TITLE("Driver", "ABACUS_begins");
2728

29+
// 2) Print the current time, since it may run a long time.
2830
time_t time_start = std::time(nullptr);
2931
ModuleBase::timer::start();
3032

31-
// (1) read the input parameters.
32-
// INPUT should be initalized here and then pass to atomic world, mohan
33-
// 2024-05-12 INPUT should not be GlobalC, mohan 2024-05-12
34-
Driver::reading();
35-
36-
// (2) welcome to the atomic world!
33+
// 3) Welcome to the atomic world! Let's do some fancy stuff here.
3734
this->atomic_world();
3835

39-
// (3) output information
36+
// 4) All timers recorders are printed.
37+
ModuleBase::timer::finish(GlobalV::ofs_running);
38+
39+
// 5) All memory recorders are printed.
40+
ModuleBase::Memory::print_all(GlobalV::ofs_running);
41+
42+
// 6) Print the final time, hopefully it will not cost too long.
4043
time_t time_finish = std::time(nullptr);
4144
ModuleIO::print_time(time_start, time_finish);
4245

43-
// (4) close all of the running logs
46+
// 7) Clean up: close all of the running logs
4447
ModuleBase::Global_File::close_all_log(GlobalV::MY_RANK, PARAM.inp.out_alllog,PARAM.inp.calculation);
4548

4649
}
@@ -169,16 +172,13 @@ void Driver::reading()
169172
void Driver::atomic_world()
170173
{
171174
ModuleBase::TITLE("Driver", "atomic_world");
172-
//--------------------------------------------------
173-
// choose basis sets:
174-
// pw: plane wave basis set
175-
// lcao_in_pw: LCAO expaned by plane wave basis set
176-
// lcao: linear combination of atomic orbitals
177-
//--------------------------------------------------
175+
ModuleBase::timer::tick("Driver", "atomic_world");
176+
177+
// reading information
178+
this->reading();
178179

179180
// where the actual stuff is done
180181
this->driver_run();
181182

182-
ModuleBase::timer::finish(GlobalV::ofs_running);
183-
ModuleBase::Memory::print_all(GlobalV::ofs_running);
183+
ModuleBase::timer::tick("Driver", "atomic_world");
184184
}

source/driver_run.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@
2525
*/
2626
void Driver::driver_run()
2727
{
28-
ModuleBase::TITLE("Driver", "driver_line");
29-
ModuleBase::timer::tick("Driver", "driver_line");
28+
ModuleBase::TITLE("Driver", "driver_run");
3029

3130
//! 1: setup cell and atom information
3231
// this warning should not be here, mohan 2024-05-22
3332
#ifndef __LCAO
3433
if (PARAM.inp.basis_type == "lcao_in_pw" || PARAM.inp.basis_type == "lcao") {
34+
ModuleBase::timer::tick("Driver","driver_run");
3535
ModuleBase::WARNING_QUIT("driver",
3636
"to use LCAO basis, compile with __LCAO");
3737
}
@@ -93,6 +93,6 @@ void Driver::driver_run()
9393

9494
//! 6: output the json file
9595
Json::create_Json(&ucell, PARAM);
96-
ModuleBase::timer::tick("Driver", "driver_line");
96+
9797
return;
9898
}

source/module_base/blas_connector.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ void vector_add_vector(const int& dim, float *result, const float *vector1, cons
820820
}
821821
else if (device_type == base_device::GpuDevice){
822822
#ifdef __CUDA
823-
ModuleBase::constantvector_addORsub_constantVector_op<float, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
823+
ModuleBase::vector_add_vector_op<float, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
824824
#endif
825825
}
826826
}
@@ -838,7 +838,7 @@ void vector_add_vector(const int& dim, double *result, const double *vector1, co
838838
}
839839
else if (device_type == base_device::GpuDevice){
840840
#ifdef __CUDA
841-
ModuleBase::constantvector_addORsub_constantVector_op<double, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
841+
ModuleBase::vector_add_vector_op<double, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
842842
#endif
843843
}
844844
}
@@ -856,7 +856,7 @@ void vector_add_vector(const int& dim, std::complex<float> *result, const std::c
856856
}
857857
else if (device_type == base_device::GpuDevice){
858858
#ifdef __CUDA
859-
ModuleBase::constantvector_addORsub_constantVector_op<std::complex<float>, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
859+
ModuleBase::vector_add_vector_op<std::complex<float>, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
860860
#endif
861861
}
862862
}
@@ -874,7 +874,7 @@ void vector_add_vector(const int& dim, std::complex<double> *result, const std::
874874
}
875875
else if (device_type == base_device::GpuDevice){
876876
#ifdef __CUDA
877-
ModuleBase::constantvector_addORsub_constantVector_op<std::complex<double>, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
877+
ModuleBase::vector_add_vector_op<std::complex<double>, base_device::DEVICE_GPU>()(dim, result, vector1, constant1, vector2, constant2);
878878
#endif
879879
}
880880
}

source/module_base/formatter.h

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,22 @@ class FmtTable
191191
*
192192
* @param titles titles, its size should be the same as the number of columns
193193
* @param nrows number of rows
194-
* @param aligns Alignments instance, can be constructed with initializer_list<char> like {'r', 'c'}, for right and center alignment for values and titles
194+
* @param fmts format strings for each column, its size should be the same as the number of columns
195+
* @param indent indent for each column, default is 0
196+
* @param aligns Alignments instance, for alignment of values and titles, e.g. {Align::LEFT, Align::RIGHT} for left alignment of values and right alignment of titles
195197
* @param frames Frames instance, can be constructed with initializer_list<char> like {'-', '-', '-', ' ', ' '}, for up, middle, down, left and right frames
196198
* @param delimiters Delimiters instance, can be constructed with initializer_list<char> like {'-', ' '}, for horizontal and vertical delimiters
197199
*/
198200
FmtTable(const std::vector<std::string>& titles,
199-
const size_t& nrows,
201+
const size_t nrows,
200202
const std::vector<std::string>& fmts,
203+
const size_t indent = 0,
201204
const Alignments& aligns = {},
202205
const Frames& frames = {},
203-
const Delimiters& delimiters = {}): titles_(titles), data_(nrows, titles.size()), fmts_(fmts), aligns_(aligns), frames_(frames), delimiters_(delimiters)
204-
{ assert(titles.size() == fmts.size()); };
206+
const Delimiters& delimiters = {}):
207+
titles_(titles), data_(nrows, titles.size()), // data
208+
fmts_(fmts), indent_(indent), aligns_(aligns), frames_(frames), delimiters_(delimiters) // styles
209+
{ assert(titles.size() == fmts.size()||titles.size() == 0); };
205210
~FmtTable() {};
206211
/**
207212
* @brief import data from std::vector
@@ -269,22 +274,24 @@ class FmtTable
269274
*/
270275
std::string concat_title(const std::vector<std::string>& titles) const
271276
{
272-
std::string dst;
277+
std::string dst = "";
273278
// first sum width of all titles
274279
size_t width = std::accumulate(titles.begin(), titles.end(), 0, [](const size_t& acc, const std::string& s) { return acc + s.size(); });
275280
// add width of delimiters
276281
width += titles.size() - 1;
277282
// add width of left and right frames
278283
width += 2;
279-
dst += std::string(width, frames_.up_) + "\n" + std::string(1, frames_.l_);
284+
dst += std::string(indent_, ' ') + std::string(width, frames_.up_) + "\n"; // first line: the upper frame
285+
dst += std::string(indent_, ' ') + std::string(1, frames_.l_); // second line: the left frame + titles + right frame
280286
for(size_t i = 0; i < titles.size(); i++)
281287
{
282288
dst += titles[i];
283289
if (i != titles.size() - 1) {
284290
dst += delimiters_.v_;
285291
}
286292
}
287-
dst += std::string(1, frames_.r_) + "\n" + std::string(width, frames_.mid_) + "\n";
293+
dst += std::string(1, frames_.r_) + "\n";
294+
dst += std::string(indent_, ' ') + std::string(width, frames_.mid_) + "\n"; // third line: the middle frame
288295
return dst;
289296
}
290297
/**
@@ -303,10 +310,10 @@ class FmtTable
303310
width += row.size() - 1;
304311
// for the left and right frame
305312
width += 2;
306-
if (pos == 't') {
307-
dst += std::string(width, frames_.up_) + "\n";
313+
if (pos == 't') { // 't' for top
314+
dst += std::string(indent_, ' ') + std::string(width, frames_.up_) + "\n";
308315
}
309-
dst += std::string(1, frames_.l_);
316+
dst += std::string(indent_, ' ') + std::string(1, frames_.l_);
310317
for(size_t i = 0; i < row.size(); i++)
311318
{
312319
dst += row[i];
@@ -315,8 +322,8 @@ class FmtTable
315322
}
316323
}
317324
dst += std::string(1, frames_.r_) + "\n";
318-
if (pos == 'b') {
319-
dst += std::string(width, frames_.dw_) + "\n";
325+
if (pos == 'b') { // 'b' for bottom
326+
dst += std::string(indent_, ' ') + std::string(width, frames_.dw_) + "\n"; // the last line
320327
}
321328
return dst;
322329
}
@@ -397,6 +404,7 @@ class FmtTable
397404
std::vector<std::string> titles_;
398405
NDArray<std::string> data_; // data
399406
std::vector<std::string> fmts_; // format strings for each column
407+
size_t indent_ = 0; // indent for each column
400408
};
401409

402410
#endif

0 commit comments

Comments
 (0)