Skip to content

Commit bf01b41

Browse files
Merge branch 'develop' into develop
2 parents f5cd794 + db9c16c commit bf01b41

File tree

118 files changed

+1268
-1509
lines changed

Some content is hidden

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

118 files changed

+1268
-1509
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Version Check
2+
on:
3+
release:
4+
types: [published]
5+
6+
jobs:
7+
validate_version:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: 0 # Fetch complete git history for version comparison
13+
14+
# Extract last two tags for version comparison
15+
- name: Get version history
16+
id: versions
17+
run: |
18+
# Get previous tag (skip current tag)
19+
PREV_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1))
20+
# Current tag being published (extracted from GITHUB_REF)
21+
CURRENT_TAG=${GITHUB_REF#refs/tags/}
22+
echo "prev_tag=${PREV_TAG}" >> $GITHUB_OUTPUT
23+
echo "current_tag=${CURRENT_TAG}" >> $GITHUB_OUTPUT
24+
25+
# Validate version.h matches the release tag
26+
- name: Assert version increment
27+
run: |
28+
CODE_VERSION=$(grep -oP '#define\s+VERSION\s+"\K\d+(\.\d+){2,3}' source/version.h)
29+
30+
if [[ -z "$CODE_VERSION" ]]; then
31+
echo "::error::Failed to extract version from source/version.h"
32+
exit 1
33+
fi
34+
35+
# Verify that the version in version.h matches the tag
36+
if [[ "${{ steps.versions.outputs.current_tag }}" != "v${CODE_VERSION}" ]]; then
37+
echo "::error::Version mismatch: tag=${{ steps.versions.outputs.current_tag }} ≠ code=${CODE_VERSION}"
38+
exit 1
39+
fi
40+
41+
# Ensure the version has been incremented
42+
if [[ "${{ steps.versions.outputs.prev_tag}}" == "${{ steps.versions.outputs.current_tag }}" ]]; then
43+
echo "::error::Version unchanged: ${{ steps.versions.outputs.current_tag }}"
44+
exit 1
45+
fi

docs/advanced/elec_properties/density_matrix.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Extracting Density Matrices
22

3-
ABACUS can output the density matrix by adding the keyword "[out_dm](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-dm)" in INPUT file:
3+
ABACUS can output the density matrix by adding the keyword "[out_dmk](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-dm)" in INPUT file:
44
```
5-
out_dm 1
5+
out_dmk 1
66
```
77
After finishing the calculation, the information of the density matrix is stroed in files `OUT.${suffix}/SPIN${spin}_DM`, which looks like:
88
```
@@ -37,4 +37,4 @@ The following line is dimension of the density matrix, and the rest lines are th
3737

3838
The examples can be found in [examples/density_matrix](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/density_matrix)
3939

40-
- Note: now this function is valid only for LCAO gamma only calcualtion.
40+
- Note: now this function is valid only for LCAO gamma only calcualtion.
Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Extracting Hamiltonian and Overlap Matrices
22

3-
In ABACUS, we provide the option to write the Hamiltonian and Overlap matrices to files after SCF calculation.
3+
In ABACUS, we provide the option to write the Hamiltonian and Overlap matrices to files after SCF calculations.
44

5-
For periodic systems, there are two ways to represent the matrices, the first is to write the entire square matrices for each k point, namely $H(k)$ and $S(k)$; the second is the R space representation, $H(R)$ and $S(R)$, where R is the lattice vector. The two representations are connected by Fourier transform:
5+
For periodic systems, there are two ways to construct the matrices, the first is to write the entire square matrices for each $k$ point in the Brillouin zone, namely $H(k)$ and $S(k)$; the second one is the real space representation, $H(R)$ and $S(R)$, where R is the Bravis lattice vector. The two representations are connected by Fourier transform:
66

77
- $H(k)=\sum_R H(R)e^{-ikR}$
88

@@ -12,18 +12,9 @@ and
1212

1313
## out_mat_hs
1414

15-
Users can set the keyword [out_mat_hs](../input_files/input-main.md#out_mat_hs) to true for outputting the upper triangular part of the Hamiltonian matrices and overlap matrices for each k point into files in the directory `OUT.${suffix}`. It is available for both gamma_only and multi-k calculations.
15+
Users can set the keyword [out_mat_hs](../input_files/input-main.md#out_mat_hs) to true to print the upper triangular part of the Hamiltonian matrices and overlap matrices for each k point into files in the directory `OUT.${suffix}`. It is available for both gamma_only and multi-k calculations.
1616

17-
The files are named `data-$k-H` and `data-$k-S`, where `$k` is a composite index consisting of the k point index as well as the spin index. The corresponding sequence of the orbitals can be seen in [Basis Set](../pp_orb.md#basis-set).
18-
19-
For nspin = 1 and nspin = 4 calculations, there will be only one spin component, so `$k` runs from 0 up to `$nkpoints-1`. For nspin = 2, `$k` runs from `2*$nkpoints-1`. In the latter case, the files are arranged into blocks of up and down spins. For example, if there are 3 k points, then we have the following correspondence:
20-
21-
- data-0-H : 1st k point, spin up
22-
- data-1-H : 2nd k point, spin up
23-
- data-2-H : 3rd k point, spin up
24-
- data-3-H : 1st k point, spin down
25-
- data-4-H : 2nd k point, spin down
26-
- data-5-H : 3rd k point, spin down
17+
The $H(k)$ and $S(k)$ matrices are stored with numerical atomic orbitals as basis, and the corresponding sequence of the numerical atomic orbitals can be seen in [Basis Set](../pp_orb.md#basis-set).
2718

2819
As for information on the k points, one may look for the `SETUP K-POINTS` section in the running log.
2920

@@ -33,12 +24,10 @@ The rest of the file contains the upper triangular part of the specified matrice
3324

3425
## out_mat_hs2
3526

36-
The output of R-space matrices is controlled by the keyword [out_mat_hs2](../input_files/input-main.md#out_mat_hs2). This functionality is not available for gamma_only calculations. To generate such matrices for gamma only calculations, users should turn off [gamma_only](../input_files/input-main.md#gamma_only), and explicitly specify that gamma point is the only k point in the KPT file.
27+
The output of $H(R)$ and $S(R)$ matrices is controlled by the keyword [out_mat_hs2](../input_files/input-main.md#out_mat_hs2). This functionality is not available for gamma_only calculations. To generate such matrices for gamma only calculations, users should turn off [gamma_only](../input_files/input-main.md#gamma_only), and explicitly specify that gamma point is the only k point in the KPT file.
3728

3829
For single-point SCF calculations, if nspin = 1 or nspin = 4, two files `hrs1_nao.csr` and `sr_nao.csr` are generated, which contain the Hamiltonian matrix $H(R)$ and overlap matrix $S(R)$ respectively. For nspin = 2, three files `hrs1_nao.csr` and `hrs2_nao.csr` and `sr_nao.csr` are created, where the first two files correspodn to $H(R)$ for spin up and spin down, respectively.
3930

40-
As for molecular dynamics calculations, the format is controlled by [out_interval](../input_files/input-main.md#out_interval) and [out_app_flag](../input_files/input-main.md#out_app_flag) in the same manner as the position matrix as detailed in [out_mat_r](../input_files/input-main.md#out_mat_r).
41-
4231
Each file or each section of the appended file starts with three lines, the first gives the current ion/md step, the second gives the dimension of the matrix, and the last indicates how many different `R` are in the file.
4332

4433
The rest of the files are arranged in blocks. Each block starts with a line giving the lattice vector `R` and the number of nonzero matrix elements, such as:
@@ -56,10 +45,12 @@ The CSR format stores a sparse m × n matrix M in row form using three (one-dime
5645
- The arrays V and COL_INDEX are of length NNZ, and contain the non-zero values and the column indices of those values respectively.
5746
- The array ROW_INDEX is of length m + 1 and encodes the index in V and COL_INDEX where the given row starts. This is equivalent to ROW_INDEX[j] encoding the total number of nonzeros above row j. The last element is NNZ , i.e., the fictitious index in V immediately after the last valid index NNZ - 1.
5847

59-
## get_S
60-
We also offer the option of only calculating the overlap matrix without running SCF. For that purpose, in `INPUT` file we need to set the value keyword [calculation](../input_files/input-main.md#calculation) to be `get_S`.
48+
For calculations involving ionic movements, the output frequency of the matrix is controlled by [out_interval](../input_files/input-main.md#out_interval) and [out_app_flag](../input_files/input-main.md#out_app_flag).
49+
50+
## get_s
51+
We also offer the option of only calculating the overlap matrix without running SCF. For that purpose, in `INPUT` file we need to set the value keyword [calculation](../input_files/input-main.md#calculation) to be `get_s`.
6152

62-
A file named `SR.csr` will be generated in the working directory, which contains the overlap matrix.
53+
A file named `sr_nao.csr` will be generated in the working directory, which contains the overlap matrix.
6354

6455
> When `nspin` is set to 1 or 2, the dimension of the overlap matrix is nlocal $\times$ nlocal, where nlocal is the total number of numerical atomic orbitals.
6556
These numerical atomic orbitals are ordered from outer to inner loop as atom, angular quantum number $l$, zeta (multiple radial orbitals corresponding to each $l$), and magnetic quantum number $m$.
@@ -69,9 +60,9 @@ When `nspin` is set to 4, the dimension of the overlap matrix is (2 $\times$ nlo
6960
## examples
7061
We provide [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/matrix_hs) of outputting the matrices. There are four examples:
7162

72-
- out_hs2_multik : writing H(R) and S(R) for multi-k calculation
73-
- out_hs_gammaonly : writing H(k) and S(k) for gamma-only calculation
74-
- out_hs_multik : writing H(k) and S(k) for multi-k calculation
75-
- out_s_multik : running get_S for multi-k calculation
63+
- out_hs_gammaonly: writing H(k) and S(k) for gamma-only calculation
64+
- out_hs_multik: writing H(k) and S(k) for multi-k calculation
65+
- out_hs2_multik: writing H(R) and S(R) for multi-k calculation
66+
- out_s_multik: running calculation=get_s to obtain overlap matrix for multi-k calculation
7667

7768
Reference output files are provided in each directory.

docs/advanced/elec_properties/position_matrix.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ Each block here contains the matrix for the corresponding cell. There are three
2020

2121
In molecular dynamics (MD) calculations, if [out_app_flag](../input_files/input-main.md#out_app_flag) is set to true, then `data-rR-tr` is written in an append manner. Otherwise, output files will be put in a separate directory, `matrix`, and named as `$x`_data-rR-tr, where `$x` is the number of MD step. In addition, the output frequency is controlled by [out_interval](../input_files/input-main.md#out_interval). For example, if we are running a 10-step MD with out_interval = 3, then `$x` will be 0, 3, 6, and 9.
2222

23-
## get_S
24-
We also offer the option of only calculating the position matrix without running SCF. For that purpose, in `INPUT` file we need to set the keyword [calculation](../input_files/input-main.md#calculation) to `get_S`, and [out_mat_r](../input_files/input-main.md#out_mat_r) to `true`.
23+
## get_s
24+
We also offer the option of only calculating the position matrix without running SCF. For that purpose, in `INPUT` file we need to set the keyword [calculation](../input_files/input-main.md#calculation) to `get_s`, and [out_mat_r](../input_files/input-main.md#out_mat_r) to `true`.

0 commit comments

Comments
 (0)