Skip to content

Commit 4a0cf9c

Browse files
author
dyzheng
committed
Merge remote-tracking branch 'origin/develop' into fix/dmk-dmr-fourier-sign
Conflict resolutions (build fixes required by the merged tree): - module_operator_lcao/test/CMakeLists.txt: ORB_atomic_lm.cpp -> orb_atomic_lm.cpp, matching develop's filename normalization (#7797) in the dm_trace test target sources. - module_lr/utils/exciton_plotter.cpp: add missing 'template' keyword for the dependent-template call eval_wfc_bloch<T> (upstream BSE module, #7718) that fails to compile with the standard C++11 rule.
2 parents 6891da7 + dd1a240 commit 4a0cf9c

805 files changed

Lines changed: 18899 additions & 5949 deletions

File tree

Some content is hidden

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

CMakeLists.txt

Lines changed: 43 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -184,71 +184,52 @@ if(COMMIT_INFO)
184184
endif()
185185
endif()
186186

187-
# Different exe files of ABACUS
188-
unset(ABACUS_BIN_NAME CACHE)
187+
# Determine the ABACUS executable name.
188+
if(NOT ENABLE_LCAO)
189+
set(_abacus_bin_level "pw")
190+
# TODO: Not well-defined now.
191+
elseif(ENABLE_LIBRI AND ENABLE_MLALGO)
192+
set(_abacus_bin_level "max")
193+
elseif(ENABLE_LIBRI)
194+
set(_abacus_bin_level "std")
195+
# TODO: Not well-defined now.
196+
elseif(ENABLE_MLALGO)
197+
set(_abacus_bin_level "ml")
198+
else()
199+
set(_abacus_bin_level "basic")
200+
endif()
189201

190-
# Case : LCAO or PW
191-
if(ENABLE_LCAO)
192-
# Case: CUDA is enabled (suffix with 'g' for GPU)
193-
if(USE_CUDA)
194-
if(ENABLE_MPI)
195-
if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO)
196-
set(ABACUS_BIN_NAME abacus_basic_gpu)
197-
elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO)
198-
set(ABACUS_BIN_NAME abacus_std_gpu)
199-
elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO)
200-
set(ABACUS_BIN_NAME abacus_ml_gpu)
201-
elseif(ENABLE_LIBRI AND ENABLE_MLALGO)
202-
set(ABACUS_BIN_NAME abacus_max_gpu)
203-
endif()
204-
endif()
205-
# Case: CPU is enabled (suffix with 'p' for parallel)
206-
else()
207-
if(ENABLE_MPI)
208-
if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO)
209-
set(ABACUS_BIN_NAME abacus_basic_para)
210-
elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO)
211-
set(ABACUS_BIN_NAME abacus_std_para)
212-
elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO)
213-
set(ABACUS_BIN_NAME abacus_ml_para)
214-
elseif(ENABLE_LIBRI AND ENABLE_MLALGO)
215-
set(ABACUS_BIN_NAME abacus_max_para)
216-
endif()
217-
else()
218-
if(NOT ENABLE_LIBRI AND NOT ENABLE_MLALGO)
219-
set(ABACUS_BIN_NAME abacus_basic_ser)
220-
elseif(ENABLE_LIBRI AND NOT ENABLE_MLALGO)
221-
set(ABACUS_BIN_NAME abacus_std_ser)
222-
elseif(NOT ENABLE_LIBRI AND ENABLE_MLALGO)
223-
set(ABACUS_BIN_NAME abacus_ml_ser)
224-
elseif(ENABLE_LIBRI AND ENABLE_MLALGO)
225-
set(ABACUS_BIN_NAME abacus_max_ser)
226-
endif()
227-
endif()
228-
endif()
229-
# Case : PW only
202+
if(ENABLE_MPI)
203+
set(_abacus_bin_para "para")
204+
elseif(ENABLE_OPENMP)
205+
set(_abacus_bin_para "omp")
230206
else()
231-
if(USE_CUDA)
232-
if(ENABLE_MPI)
233-
set(ABACUS_BIN_NAME abacus_pw_gpu)
234-
endif()
235-
else()
236-
if(ENABLE_MPI)
237-
set(ABACUS_BIN_NAME abacus_pw_para)
238-
else()
239-
set(ABACUS_BIN_NAME abacus_pw_ser)
240-
endif()
241-
endif()
207+
set(_abacus_bin_para "ser")
208+
endif()
209+
210+
if(USE_CUDA OR USE_ROCM)
211+
set(_abacus_bin_device "gpu")
212+
elseif(USE_CUDA_ON_DCU)
213+
set(_abacus_bin_device "dcu")
214+
elseif(USE_DSP)
215+
set(_abacus_bin_device "dsp")
216+
elseif(USE_SW)
217+
set(_abacus_bin_device "sw")
242218
endif()
243219

220+
# if(USE_KML)
221+
# set(_abacus_bin_device "kp")
222+
# endif()
223+
224+
if(_abacus_bin_device)
225+
set(ABACUS_BIN_NAME "abacus_${_abacus_bin_level}_${_abacus_bin_device}")
226+
else()
227+
set(ABACUS_BIN_NAME "abacus_${_abacus_bin_level}_${_abacus_bin_para}")
228+
endif()
244229

245230
# Use DSP hardware
246-
if (USE_DSP)
247-
if(ENABLE_ELPA)
248-
message(WARNING USE_DSP is incompatible with ELPA; switching off ENABLE_ELPA)
249-
set(ENABLE_ELPA OFF)
250-
endif()
251-
set(ABACUS_BIN_NAME abacus_dsp)
231+
if(USE_DSP AND ENABLE_ELPA)
232+
message(FATAL_ERROR "USE_DSP is incompatible with ELPA.")
252233
endif()
253234

254235
list(APPEND CMAKE_MODULE_PATH
@@ -499,6 +480,9 @@ endif()
499480
# version. Use cmake with AMD-ROCm:
500481
# https://rocmdocs.amd.com/en/latest/Installation_Guide/Using-CMake-with-AMD-ROCm.html
501482
if(USE_ROCM)
483+
message(
484+
DEPRECATION
485+
"Option USE_ROCM is deprecated and will be ignored in a future release. ")
502486
cmake_minimum_required(VERSION 3.18)
503487
if(NOT DEFINED ROCM_PATH)
504488
set(ROCM_PATH

cmake/CollectBuildInfoVars.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,12 @@ else()
187187
set(ABACUS_LIBXC_VERSION "no")
188188
endif()
189189

190+
if(ENABLE_DFTD4)
191+
set(ABACUS_DFTD4_VERSION "yes (v${dftd4_VERSION})")
192+
else()
193+
set(ABACUS_DFTD4_VERSION "no")
194+
endif()
195+
190196
# Accelerators
191197
if(USE_CUDA AND CUDAToolkit_VERSION)
192198
set(ABACUS_CUDA_VERSION "yes (v${CUDAToolkit_VERSION})")
@@ -451,6 +457,7 @@ message(" LibRI = ${ABACUS_LIBRI_VERSION}")
451457
if(ENABLE_EXX_DEV)
452458
message(" (EXX developing features enabled)")
453459
endif()
460+
message(" DFT-D4 = ${ABACUS_DFTD4_VERSION}")
454461
message(" RAPIDJSON = ${ABACUS_RAPIDJSON_VERSION}")
455462
message(" PEXSI = ${ABACUS_PEXSI_VERSION}")
456463
message(" CNPY = ${ABACUS_CNPY_VERSION}")

cmake/modules/FindLibRI.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if(NOT LIBRI_DIR)
1616
include(FetchContent)
1717
FetchContent_Declare(
1818
LibRI
19-
URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/e6d78e0
19+
URL https://codeload.github.com/abacusmodeling/LibRI/tar.gz/b0eff7a
2020
)
2121
FetchContent_Populate(LibRI)
2222
set(LIBRI_DIR ${libri_SOURCE_DIR})

docs/CONTRIBUTING.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,12 @@ An practical example is class [LCAO_Deepks](https://github.com/deepmodeling/abac
172172
173173
## Documenting INPUT Parameters
174174
175-
ABACUS includes a built-in help system that allows users to query INPUT parameters directly from the command line (e.g., `abacus -h ecutwfc`). Parameter metadata is defined inline in the C++ source files (`source/source_io/module_parameter/read_input_item_*.cpp`) using `Input_Item` registrations.
175+
ABACUS includes a built-in help system that allows users to query INPUT parameters directly from the command line (e.g., `abacus -h ecutwfc`). Parameter metadata is defined inline in the C++ source files under `source/source_io/module_parameter/` using `Input_Item` registrations.
176176
177-
A checked-in file `docs/parameters.yaml` contains a YAML dump of all parameter metadata, generated from the binary itself. This file is used by Sphinx to produce the online documentation page `input-main.md`.
177+
The C++ `Input_Item` registrations are the source of truth for parameter metadata. The checked-in `docs/parameters.yaml` and `docs/advanced/input_files/input-main.md` files are generated artifacts: do not edit either file manually. `parameters.yaml` is generated from the binary and is used by Sphinx to produce `input-main.md`.
178+
179+
Availability expressions follow the grammar and invariants in
180+
[`developers_guide/input_availability.md`](developers_guide/input_availability.md).
178181
179182
### When to Update `docs/parameters.yaml`
180183
@@ -198,13 +201,13 @@ Then verify the YAML is valid:
198201
python3 -c "import yaml; d=yaml.safe_load(open('docs/parameters.yaml')); print(len(d['parameters']), 'parameters')"
199202
```
200203

201-
You can also regenerate the markdown documentation locally:
204+
Then regenerate the markdown documentation locally:
202205

203206
```bash
204207
python3 docs/generate_input_main.py docs/parameters.yaml --output docs/advanced/input_files/input-main.md
205208
```
206209

207-
**Important:** Include the updated `docs/parameters.yaml` and `input-main.md` in your commit when submitting a PR that modifies INPUT parameters. Reviewers should verify the YAML changes match the C++ source changes and the `input-main.md` is updated.
210+
**Important:** Include the updated `docs/parameters.yaml` and `input-main.md` in your commit when submitting a PR that modifies INPUT parameters. CI regenerates both files from the built binary and rejects any mismatch. Do not fix a documentation mismatch by editing either generated file; update the C++ `Input_Item` registration and regenerate them instead.
208211

209212
### Parameter Documentation Format
210213

@@ -218,7 +221,7 @@ When adding or modifying INPUT parameters in C++ source, set the following field
218221
item.description = "Description of what this parameter does.";
219222
item.default_value = "0";
220223
item.unit = "Ry"; // Optional, empty string if no unit
221-
item.availability = ""; // Optional, empty string if always available
224+
item.set_availability("basis_type==pw"); // Optional; omit if always available
222225
// ... read_value, reset_value, check_value functions ...
223226
this->add_item(item);
224227
}

docs/advanced/elec_properties/hs_matrix.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ The output of $H(R)$ and $S(R)$ matrices is controlled by [out_hsr](../input_fil
6565
| --- | --- |
6666
| `0` | Disabled |
6767
| `1` | Text CSR; an optional second value controls precision, for example `out_hsr 1 12` |
68-
| `2` | Reserved for future binary output; not implemented |
68+
| `2` | Native binary CSR using `.dat` files |
6969
| `3` | NPZ: `hrs1_nao.npz`, `hrs2_nao.npz` when needed, and `sr_nao.npz` |
7070

7171
The legacy keywords `out_mat_hs2 1 [precision]` and `out_hsr_npz 1` remain supported as aliases for text and NPZ output respectively. If `out_hsr` is present together with either legacy keyword, `out_hsr` takes precedence.
7272

73-
For a multi-k calculation, the files contain the individual real-space blocks stored for the Bravais lattice vectors $R$. For a gamma-only calculation, ABACUS stores the real-space contributions in a folded representation. Both text CSR and NPZ output write this internal representation directly: all stored $R$-space contributions are summed into a single block labelled `R = (0, 0, 0)`.
73+
For a multi-k calculation, the files contain the individual real-space blocks stored for the Bravais lattice vectors $R$. For a gamma-only calculation, ABACUS stores the real-space contributions in a folded representation. Text CSR, native binary, and NPZ output write this internal representation directly: all stored $R$-space contributions are summed into a single block labelled `R = (0, 0, 0)`.
7474

7575
The folded gamma-only output is sufficient to inspect the matrix used by the gamma-only real-space container, but it does not retain the original lattice-vector resolution and cannot be used to interpolate matrices at arbitrary k points. Terms that are added only while constructing $H(k)$, rather than stored in the internal $H(R)$ container, are not guaranteed to be present. Use [out_hsk](../input_files/input-main.md#out_hsk) when the final $H(\Gamma)$ and $S(\Gamma)$ matrices are required.
7676

@@ -89,6 +89,22 @@ In gamma-only mode, every generated file reports one Bravais lattice vector and
8989
# representation: gamma-only folded matrix; stored R-space contributions are summed into R = (0, 0, 0)
9090
```
9191

92+
### Native Binary CSR Format
93+
94+
Set `out_hsr 2` to write the same H(R) and S(R) matrix sets with a `.dat` suffix. For example, an `nspin = 2` calculation writes `hrs1_nao.dat`, `hrs2_nao.dat`, and `sr_nao.dat`. When `out_app_flag` is false, the one-based ionic step is included before `_nao`, for example `hrs1g1_nao.dat` and `srg1_nao.dat`.
95+
96+
Each ionic step is a complete record with no padding or self-describing header:
97+
98+
1. Native `int`: zero-based ionic step, matrix dimension, number of R blocks.
99+
2. For every R block in lexicographic `(Rx, Ry, Rz)` order, four native `int` values: `Rx`, `Ry`, `Rz`, and `nnz`.
100+
3. `nnz` matrix values in CSR order. Real matrices use one native `double`; complex matrices use consecutive real and imaginary `double` values.
101+
4. `nnz` native `int` column indices.
102+
5. `dimension + 1` native `long long` row pointers.
103+
104+
All R blocks stored by the internal HContainer are present, including blocks with zero nonzero values. The sparse threshold is `1e-10`, matching text CSR output. The format uses the host integer representation and byte order and therefore requires a compatible ABI. It does not contain unit-cell, spin, or matrix-label metadata; those are determined by the calculation input and filename.
105+
106+
When `out_app_flag` is true, the first ionic step truncates the shared file and later ionic steps append complete records. Otherwise every ionic step is written to its own file.
107+
92108
### NPZ Format
93109

94110
Set `out_hsr 3` to write `hrs1_nao.npz`, `hrs2_nao.npz` when a second spin channel is present, and `sr_nao.npz`. Matrix entry names include the atom-pair indices and the three components of $R$. Multi-k calculations retain the stored $R$ blocks, while gamma-only calculations contain only matrix entry names ending in `_0_0_0`.
@@ -125,7 +141,7 @@ The CSR format stores a sparse m × n matrix M in row form using three arrays (v
125141

126142
### Precision Control
127143

128-
Use `out_hsr 1 12` to output text CSR files with 12-digit precision (default is 8). Precision is ignored for NPZ output.
144+
Use `out_hsr 1 12` to output text CSR files with 12-digit precision (default is 8). Precision is ignored for native binary and NPZ output.
129145

130146
For calculations involving ionic movements, the output frequency of the matrix is controlled by [out_freq_ion](../input_files/input-main.md#out_freq_ion) and [out_app_flag](../input_files/input-main.md#out_app_flag).
131147

0 commit comments

Comments
 (0)