You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced/elec_properties/hs_matrix.md
+13-1Lines changed: 13 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Use [out_hsk](../input_files/input-main.md#out_hsk) to print the upper triangula
18
18
| --- | --- |
19
19
|`0`| Disabled |
20
20
|`1`| Text; an optional second value controls precision, for example `out_hsk 1 12`|
21
-
|`2`|Reserved for future binary output; not implemented|
21
+
|`2`|Native binary `.dat` output|
22
22
|`3`| Reserved for H(k)/S(k) NPZ output; not implemented |
23
23
24
24
The legacy keyword `out_mat_hs 1 [precision]` remains supported as an alias for `out_hsk 1 [precision]`. If both names are present, `out_hsk` takes precedence.
@@ -45,6 +45,18 @@ Each output block starts with a comment header containing the one-based ionic-st
45
45
46
46
For multi-k calculations, the matrices are Hermitian and each matrix element is written as `(real,imag)`. For gamma-only calculations, the matrices are symmetric and the matrix elements are written as real numbers.
47
47
48
+
### Native Binary Format
49
+
50
+
For `out_hsk 2`, the filenames in the table above use `.dat` instead of `.txt`. Each matrix record is written without padding or a self-describing header:
51
+
52
+
1. the matrix dimension as a native C++ `int`;
53
+
2. the upper-triangular elements in row-major order, from `(0,0)` through `(0,N-1)`, then `(1,1)` through `(1,N-1)`, and so on;
54
+
3. each gamma-only element as one native `double`, or each multi-k/spinor element as two consecutive native `double` values containing the real and imaginary parts.
55
+
56
+
The file therefore contains `sizeof(int) + N(N+1)/2 * sizeof(double)` bytes for a gamma-only record and `sizeof(int) + N(N+1) * sizeof(double)` bytes for a multi-k or spinor record. The format uses the host integer representation and byte order and is intended for readers using a compatible ABI.
57
+
58
+
When `out_app_flag` is true, the first ionic step truncates the shared file and every later step appends another complete record. When it is false, each ionic step has a separate filename containing `g${step}` before `_nao`.
59
+
48
60
## out_hsr
49
61
50
62
The output of $H(R)$ and $S(R)$ matrices is controlled by [out_hsr](../input_files/input-main.md#out_hsr). It is available for both gamma-only and multi-k LCAO calculations:
Copy file name to clipboardExpand all lines: docs/advanced/input_files/input-main.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2003,7 +2003,7 @@
2003
2003
-**Description**: Output the upper triangular part of the Hamiltonian and overlap matrices in reciprocal space for each k-point into files in the directory OUT.${suffix}. The first integer selects the format:
2004
2004
- 0: disabled;
2005
2005
- 1: text output; the optional second integer controls precision and defaults to 8;
2006
-
- 2: reserved for binary output, which is not implemented yet;
2006
+
- 2: binary output in the native ABACUS .dat format;
2007
2007
- 3: NPZ output, which is not implemented for H(k)/S(k).
2008
2008
2009
2009
The output is also controlled by out_freq_ion and out_app_flag. For more information, refer to hs_matrix.md.
@@ -2014,6 +2014,8 @@
2014
2014
- Multi-k, nspin = 1: hk1_nao.txt for the Hamiltonian matrix and sk1_nao.txt for the overlap matrix at the first k-point.
2015
2015
- Multi-k, nspin = 2: hk1s1_nao.txt and hk1s2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk1_nao.txt for the overlap matrix at the first k-point. Only one overlap matrix is written because it is identical for both spin channels.
2016
2016
- Multi-k, nspin = 4: hk1s4_nao.txt for the spinor Hamiltonian matrix and sk1_nao.txt for the spinor overlap matrix at the first k-point.
2017
+
For binary output, the same names use the .dat suffix. Each native binary record contains the matrix dimension as an int followed by the row-major upper triangle. Gamma-only elements are doubles; multi-k and spinor elements are pairs of doubles containing the real and imaginary parts. Native integer representation and byte order are used.
2018
+
When out_app_flag is true, the first ionic step truncates the file and later steps append complete records.
2017
2019
When out_app_flag is false, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt.
2018
2020
2019
2021
> Note: In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.
Copy file name to clipboardExpand all lines: docs/parameters.yaml
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3112,7 +3112,7 @@ parameters:
3112
3112
Output the upper triangular part of the Hamiltonian and overlap matrices in reciprocal space for each k-point into files in the directory OUT.${suffix}. The first integer selects the format:
3113
3113
* 0: disabled;
3114
3114
* 1: text output; the optional second integer controls precision and defaults to 8;
3115
-
* 2: reserved for binary output, which is not implemented yet;
3115
+
* 2: binary output in the native ABACUS .dat format;
3116
3116
* 3: NPZ output, which is not implemented for H(k)/S(k).
3117
3117
3118
3118
The output is also controlled by out_freq_ion and out_app_flag. For more information, refer to hs_matrix.md.
@@ -3122,6 +3122,8 @@ parameters:
3122
3122
* Multi-k, nspin = 1: hk1_nao.txt for the Hamiltonian matrix and sk1_nao.txt for the overlap matrix at the first k-point.
3123
3123
* Multi-k, nspin = 2: hk1s1_nao.txt and hk1s2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk1_nao.txt for the overlap matrix at the first k-point. Only one overlap matrix is written because it is identical for both spin channels.
3124
3124
* Multi-k, nspin = 4: hk1s4_nao.txt for the spinor Hamiltonian matrix and sk1_nao.txt for the spinor overlap matrix at the first k-point.
3125
+
For binary output, the same names use the .dat suffix. Each native binary record contains the matrix dimension as an int followed by the row-major upper triangle. Gamma-only elements are doubles; multi-k and spinor elements are pairs of doubles containing the real and imaginary parts. Native integer representation and byte order are used.
3126
+
When out_app_flag is true, the first ionic step truncates the file and later steps append complete records.
3125
3127
When out_app_flag is false, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt.
3126
3128
3127
3129
[NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.
Copy file name to clipboardExpand all lines: source/source_io/module_parameter/read_input_item_output.cpp
+3-5Lines changed: 3 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -534,7 +534,7 @@ Also controled by out_freq_ion and out_app_flag.
534
534
item.description = R"(Output the upper triangular part of the Hamiltonian and overlap matrices in reciprocal space for each k-point into files in the directory OUT.${suffix}. The first integer selects the format:
535
535
* 0: disabled;
536
536
* 1: text output; the optional second integer controls precision and defaults to 8;
537
-
* 2: reserved for binary output, which is not implemented yet;
537
+
* 2: binary output in the native ABACUS .dat format;
538
538
* 3: NPZ output, which is not implemented for H(k)/S(k).
539
539
540
540
The output is also controlled by out_freq_ion and out_app_flag. For more information, refer to hs_matrix.md.
@@ -544,6 +544,8 @@ The output is also controlled by out_freq_ion and out_app_flag. For more informa
544
544
* Multi-k, nspin = 1: hk1_nao.txt for the Hamiltonian matrix and sk1_nao.txt for the overlap matrix at the first k-point.
545
545
* Multi-k, nspin = 2: hk1s1_nao.txt and hk1s2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk1_nao.txt for the overlap matrix at the first k-point. Only one overlap matrix is written because it is identical for both spin channels.
546
546
* Multi-k, nspin = 4: hk1s4_nao.txt for the spinor Hamiltonian matrix and sk1_nao.txt for the spinor overlap matrix at the first k-point.
547
+
For binary output, the same names use the .dat suffix. Each native binary record contains the matrix dimension as an int followed by the row-major upper triangle. Gamma-only elements are doubles; multi-k and spinor elements are pairs of doubles containing the real and imaginary parts. Native integer representation and byte order are used.
548
+
When out_app_flag is true, the first ionic step truncates the file and later steps append complete records.
547
549
When out_app_flag is false, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt.
548
550
549
551
[NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.)";
@@ -576,10 +578,6 @@ When out_app_flag is false, g followed by the one-based ionic-step index is inse
576
578
{
577
579
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk format must be 0, 1, 2, or 3");
578
580
}
579
-
if (format == 2)
580
-
{
581
-
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk binary output is reserved but not implemented");
582
-
}
583
581
if (format == 3)
584
582
{
585
583
ModuleBase::WARNING_QUIT("ReadInput", "out_hsk NPZ output is not implemented");
0 commit comments