Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
ae461dd
refactor(out_app_flag): change out_app_flag from bool to int and add …
Oct 16, 2026
2545b1b
feat(output): use unified subdirectories when out_app_flag=2
Oct 16, 2026
1beabad
test(io): update directory expectations for out_app_flag default
Oct 16, 2026
a4ce9a3
refactor(io): migrate remaining out_app_flag bool usage to int
Oct 16, 2026
5adf04b
chore: remove accidentally committed quality report file
Oct 16, 2026
e734403
fix(io): use local cached directory variables in ctrl_output_fp
Oct 16, 2026
9254e95
test(integrate): fix WFC file path in props_cube.sh for out_app_flag=0
Oct 16, 2026
00ece15
feat(io): create subdirs on demand and route dmk/lx/rr/tr to MAT
Oct 16, 2026
a77e356
feat(io): route dmr/tr/rr/dh/ds/lx outputs to MAT directory
Oct 18, 2026
3a38485
feat(io): unify STRU output directory and naming for relax and MD
Oct 18, 2026
aabef5f
feat(md): replace md_restartfreq with out_freq_ion + out_stru
Oct 18, 2026
443c337
fix(md): start MD STRU numbering from 1 (like relax)
Oct 18, 2026
b106783
fix(io): restore MD restart STRU lookup after out_app_flag rework
Oct 19, 2026
432649c
fix(io): address review comments on out_app_flag mode-2 rework
Oct 20, 2026
108b2b7
Merge upstream/develop into 2026-10-16-b
Oct 20, 2026
7e0ac77
feat(io): honor out_app_flag=1 for realspace cube outputs
Oct 20, 2026
ca73e2e
feat(io): write DM(k) to fixed filename when out_app_flag=1
Oct 20, 2026
0a8c069
feat(io): keep fixed T(R)/R(R) filenames when out_app_flag=1
Oct 20, 2026
9342534
fix(io): use real out_app_flag for PW wavefunction output
Oct 20, 2026
d0274b9
feat(io): omit geometry index in init cube names when out_app_flag=1
Oct 20, 2026
b8236ec
docs(input): describe fixed-name behavior of out_app_flag=1
Oct 20, 2026
8c9091d
fix(io): append DM(k) records in MD when out_app_flag=1
Oct 20, 2026
a9cba38
docs(governance): require one-based ionic-step indices in outputs
Oct 20, 2026
a658239
feat(io): full out_app_flag=1 semantics for DOS/PDOS/L/matrices
Oct 20, 2026
9b2b4ac
feat(io): single accumulated STRU file when out_app_flag=1
Oct 20, 2026
0933cf5
fix(io): terminate DM(k) matrix body with a newline
Oct 20, 2026
65a4a61
feat(io): append PW wavefunction frames when out_app_flag=1
Oct 20, 2026
c14f0c8
feat(io): add per-ionic-step provenance header to band output
Oct 20, 2026
747646c
fix(io): use compact spin label in band provenance header
Oct 20, 2026
9876bf4
test(out_app_flag): three-mode unit test coverage for naming and appe…
Oct 20, 2026
40c8bcd
fix(test): add missing link libs and K_Vectors/precision args
Oct 20, 2026
d5781b1
test(io): align step assertions and fix DM(k) test crashes
Oct 21, 2026
5ac2adf
test(io): update STEP header in sparse-matrix references to one-based
Oct 21, 2026
a61b91a
fix(io): align binary H(R)/S(R) step check and docs with one-based he…
Oct 21, 2026
613d6e8
fix(io): route per-atom dH component outputs through global_mat_dir
Oct 21, 2026
2f33b8a
fix(io): include H/dH component flags in MAT dir creation predicate
Oct 21, 2026
8c4ebb0
fix(io): route remaining PW outputs and drop LCAO-only availability f…
Oct 21, 2026
4ca63db
test(io): cover save_mat overwrite and write_hsk mode-2 rerun semantics
Oct 21, 2026
7cc8eb0
fix(md): keep legacy STRU directory layout when writing MD structures
Oct 21, 2026
13b21fb
fix(io): resolve MPI crashes in write_dipole when out_dipole=1
Oct 21, 2026
1a552f8
Merge branch 'develop' into 2026-10-16-b
mohanchen Oct 21, 2026
43c09cd
fix(elf): keep all ranks on the FFT path in write_elf
Oct 21, 2026
e141cc2
refactor(io): rename orbital info output from Orbital to nao.txt
Oct 21, 2026
5f944ea
feat(io): add provenance header to text LCAO wavefunction output
Oct 21, 2026
fe2b62f
test(lr): expect one-based STEP header in sparse DMR writer test
Oct 21, 2026
603824f
feat(io): append cube frames per ionic step under out_app_flag 1
Oct 21, 2026
d73fe29
feat(io): rename band-energy-term outputs and add provenance headers
Oct 21, 2026
406c8fe
Merge remote-tracking branch 'upstream/develop' into 2026-10-16-b
Oct 21, 2026
99c1eb9
Merge remote-tracking branch 'origin/2026-10-16-b' into 2026-10-16-b
Oct 21, 2026
0475b92
fix(io): reuse fixed dH/dS CSR filename in append mode and log every …
Oct 22, 2026
1eb4483
fix(test): skip provenance comment header when comparing LCAO wfc output
Oct 23, 2026
f26d911
refactor(io): rename band-decomposed XC output and relocate LIBRPA re…
Oct 23, 2026
964455d
refactor(io): rename LCAO k-space matrix output params and fix mislea…
Oct 23, 2026
dfbcbbb
refactor(io): rename mode-2 structure output dir STRU/ -> STRUC/
Oct 23, 2026
0d295c4
fix(lcao): skip Hartree gint on grid-parallel ranks with no local grid
Oct 23, 2026
a6650e3
fix(lcao): guard local/XC gint on grid-parallel ranks with no local grid
Oct 23, 2026
ec9ebf9
fix(lcao): keep gint collective matched on empty-grid ranks
Oct 23, 2026
3ed18db
fix(lcao): drop doubled 'k' in potential matrix filenames
Oct 23, 2026
a6c3a17
fix(md): restore MD restart from mode-1 cumulative STRU file
Oct 23, 2026
de91422
fix(tddft): reject cumulative WFC file on positive restart step
Oct 23, 2026
7076eaf
build(cell): link device lib into MODULE_CELL_stru_frame_io test
Oct 23, 2026
5c76699
build(io): link stru_frame_io into io_input test targets
Oct 23, 2026
e146c47
fix(output): truncate fixed-name files on first step of a fresh run
Oct 23, 2026
1ce77a9
fix(output): decouple PW wfc append decision from the filename sentinel
Oct 23, 2026
720f830
fix(input): create mode-2 subdirectories for out_hsr/out_pchg/out_wfc…
Oct 23, 2026
241386f
Merge develop and retain both serial INPUT test dependencies
ABACUS-PR-BOT Oct 26, 2026
1699b10
test(output): reuse cached MPI pool globals in WriteWfcAppendMode
Oct 28, 2026
a2d5de8
refactor(hs): pass output_mat_sparse config via parameters, not PARAM
Oct 28, 2026
a5b1b42
Merge branch 'develop' into 2026-10-16-b
mohanchen Oct 28, 2026
551dd94
Merge branch 'pr-8159' into 2026-10-16-b
Oct 28, 2026
0d62a96
fix(test): link stru_frame_io.cpp into MODULE_IO_input_error_mpi
Oct 28, 2026
7fa01a6
Merge branch 'develop' into 2026-10-16-b
Oct 29, 2026
738ba4e
fix(tddft): allow istep==0 to fall back to fixed-name WFC file
Oct 29, 2026
2e29441
fix(md): use global step index for output writers on restarted runs
Oct 29, 2026
4a83ef6
fix(io): truncate accumulators at fresh first frame in append mode
Oct 29, 2026
2d702fd
fix(md): pass local step index to electronic solver on restarted runs
Oct 30, 2026
cd00c72
fix(io): pick MD restart STRU by frame step to avoid stale shadowing
Oct 30, 2026
5547b89
fix(input): restore out_eband_terms alias and create dirs for out_hsr=3
Oct 30, 2026
f5c6235
fix(io): decouple DM(R) filename selection from append decision in mo…
Oct 30, 2026
d252e75
refactor(io): share compact spin tag helper across band/wfc headers
Oct 30, 2026
a7c7c3e
fix(test): replace direct MPI calls with wrappers in io/cell tests
Oct 30, 2026
37cd4c0
test(integrate): harden eband and wfc comparisons in validation scripts
Oct 30, 2026
941eb05
Revert "fix(md): pass local step index to electronic solver on restar…
Oct 31, 2026
421c36c
fix(input): reject out_stru=2 for MD and align its help text
Oct 31, 2026
84f5274
fix(io): forward the selected precision to the H(k) component writers
Oct 31, 2026
1dd2630
test(integrate): fail the multi-k wfc comparison when preprocessing f…
Oct 31, 2026
89aaa48
feat(io): rework out_app_flag into 0/1/2 output controller
Oct 31, 2026
1c5bde5
test(io): align out_app_flag tests with three-mode semantics
Oct 31, 2026
19a7e8c
docs(input): update out_app_flag and output param descriptions for 0/…
Oct 31, 2026
3488125
docs: align output-file docs with out_app_flag three-mode semantics
Oct 31, 2026
c97211d
test(integrate): update props_cube.sh for out_app_flag mode-2-only g …
Oct 31, 2026
115184b
fix(io): mode 1 writes only the last electronic iteration per ionic s…
Oct 31, 2026
386e195
Merge branch 'develop' into 2026-10-16-b
mohanchen Nov 1, 2026
5ca451a
Merge branch 'develop' (via origin/2026-10-16-b) into 2026-10-16-b
Nov 1, 2026
28e17b3
Merge develop for PR8159 integration baseline
ABACUS-PR-BOT Nov 1, 2026
7811506
Fix PR8159 build and solvent output integration
ABACUS-PR-BOT Nov 1, 2026
0d77820
fix(md): decouple restart cadence from output cadence
Nov 1, 2026
81a76e4
test(relax): match write_stru mock signature to header
Nov 1, 2026
0f3b05a
docs(io): align structure-output descriptions with MD behavior
Nov 1, 2026
3a35430
docs(input): state the structure-frame requirement for MD restart
Nov 1, 2026
b9ed06f
fix(io): version the native binary H(R)/S(R) record header
Nov 1, 2026
83f4afd
fix(io): truncate mode-1 fixed-name outputs on the first ionic step
Nov 1, 2026
a30fb4a
refactor(esolver): record the LCAO ionic step in a single place
Nov 1, 2026
48b7bc1
refactor(io): share provenance header helper across band/wfc/eband wr…
Nov 1, 2026
82d0a97
refactor(io): create mode-2 output subdirectories at write time
Nov 1, 2026
dd1c1b2
build(io): link stru_frame_io into the INPUT YAML target
Nov 1, 2026
8846951
fix(md): keep restarted initial force evaluation out of charge extrap…
Nov 2, 2026
500536d
Merge remote-tracking branch 'origin/2026-10-16-b' into 2026-10-16-b
Nov 2, 2026
218d302
Merge upstream/develop into 2026-10-16-b
Nov 2, 2026
ca7db6e
test: pin out_app_flag=1 for md_out_hk multi-frame references
Nov 2, 2026
64a0697
test(dftu): slim 17_DS_DFTU to two LCAO cases and refresh refs
Nov 2, 2026
d5c128d
test(ff): move 14_LJ_rescale_v restart inputs out of OUT.autotest
Nov 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ rules. Read the complete governance document before making or reviewing changes:
guards and `#ifdef`/`#ifndef` usages of existing macros are exempt.
21. Do not initialize member variables from `PARAM` in `.h`/`.hpp`
files; pass the value through the constructor or a setter instead.
22. Print ionic-step indices one-based (starting from 1) in user-facing
output files, matching the `g{N}` filename suffix convention; do not
write zero-based step counters such as `STEP: 0` into output files.
- Use LF line endings for text files. Only `.bat` and `.cmd` files may use CRLF.
- Keep source file additions deterministic: update the relevant `CMakeLists.txt`
or explain why the file is generated or included indirectly.
Expand Down
85 changes: 45 additions & 40 deletions docs/advanced/elec_properties/Mulliken.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,67 @@
# Mulliken Charge Analysis

From version 2.1.0, ABACUS has the function of Mulliken population analysis. The example can be found in [examples/mulliken](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/14_mulliken). \
To use this function, set [out_mul](../input_files/input-main.md#out_mul) to `1` in the INPUT file. After calculation, there will be an output file named `mulliken.txt` in the output directory. In MD calculations, the output interval is controlled by the keyword [out_freq_ion](../input_files/input-main.md#out_freq_ion). In the file, there are contents like (`nspin 1`):
To use this function, set [out_mul](../input_files/input-main.md#out_mul) to `1` in the INPUT file. After calculation, there will be an output file named `mulliken.txt` in the output directory. In MD calculations, the output interval is controlled by the keyword [out_freq_ion](../input_files/input-main.md#out_freq_ion). In the file, there are contents like (`nspin 1`, H<sub>2</sub>):

```
STEP: 0
CALCULATE THE MULLIkEN ANALYSIS FOR EACH ATOM
Total charge of spin 1: 8
Total charge: 8
Decomposed Mulliken populations
0 Zeta of Si Spin 1
s 0 1.2553358
sum over m 1.2553358
s 1 -0.030782972
sum over m -0.030782972
sum over m+zeta 1.2245529
pz 0 0.85945806
px 0 0.85945806
py 0 0.85945806
sum over m 2.5783742
pz 1 0.0065801228
px 1 0.0065801228
py 1 0.0065801228
sum over m 0.019740368
sum over m+zeta 2.5981145
dz^2 0 0.0189287
dxz 0 0.046491729
dyz 0 0.046491729
dx^2-y^2 0 0.0189287
dxy 0 0.046491729
sum over m 0.17733259
sum over m+zeta 0.17733259
Total Charge on atom: Si 4
--- Ionic Step 1 ---
Total charge 2
Decomposed Mulliken population analysis for each atom
l and m from Ylm, z stands for zeta orbital

------------------
Atom 1 is H
------------------
zeta spin1
s 1 0.9980
s 2 -0.0052
sum mz 0.9928

pz 1 0.0072
px 1 0.0000
py 1 0.0000
sum m 0.0072
sum mz 0.0072

sum lmz 1.0000

total charge on atom 1 1.0000
...
```

The file gives Mulliken charge in turn according to the order of atoms in the system. For example, the following block is for the first atom in system (`nspin 2`),
The ionic step index starts from 1. The file gives Mulliken charge in turn according to the order of atoms in the system. For example, the following block is for the first atom in system (`nspin 2`),

```
0 Zeta of Si Spin 1 Spin 2 Sum Diff
------------------
Atom 1 is Fe1
------------------
zeta spin1 spin2 sum diff
s 1 0.9437 0.8381 1.7818 0.1056
...
Total Charge on atom: Si 4
Total Magnetism on atom: Si -1.2739809e-14
sum lmz ...
```

And the next block is for the second atom in system, and so on.

```
1 Zeta of Si Spin 1 Spin 2 Sum Diff
------------------
Atom 2 is Fe2
------------------
zeta spin1 spin2 sum diff
...
```

For each atom, the file gives detailed Mulliken population analysis at different levels,

- magnetic quantum number level: such as lines beigin with ‘s,px,py,pz,...’
- azimuthal quantum number level: such as lines begin with ‘sum over m’.
- principal quantum number level: such as lines begin with ‘sum over m+zeta’. Here ‘zeta’
equals ‘zeta’ in the file, which means how many radial atomic orbitals there are for a given orbital angular momentum.
- atomic level: such as lines begin with ‘Total Charge on atom’.
- magnetic quantum number level: such as lines begin with 's, px, py, pz, ...'. The columns
are the radial index (`zeta`, one-based) followed by the spin channels.
- azimuthal quantum number level: such as lines begin with 'sum m', the sum over the
magnetic quantum number m for one radial orbital.
- principal quantum number level: such as lines begin with 'sum mz', the sum over both the
magnetic quantum number m and the radial index zeta for a given orbital angular momentum.
Here 'z' equals 'zeta' in the file, which means how many radial atomic orbitals there are
for a given orbital angular momentum.
- atomic level: such as lines begin with 'sum lmz' for the atom total and
'total charge on atom' for the charge assigned to the atom.

More orbital information can be found in 'Orbital' file output with 'mulliken.txt' when `out_mul 1`
More orbital information can be found in 'nao.txt' file output with 'mulliken.txt' when `out_mul 1`
8 changes: 4 additions & 4 deletions docs/advanced/elec_properties/density_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ out_dmk 1
```
After finishing the calculation, the density matrix is written into `OUT.${suffix}/`.

For current develop versions:
- gamma-only (`gamma_only = 1`): `dmg1_nao.txt` (`nspin=1/4`) or `dms1g1_nao.txt` and `dms2g1_nao.txt` (`nspin=2`)
- multi-k (`gamma_only = 0`): `dmk1g1_nao.txt`, `dmk2g1_nao.txt`, ... (`nspin=1/4`) or `dmk1s1g1_nao.txt`, `dmk1s2g1_nao.txt`, ... (`nspin=2`)
For current develop versions, the default filenames (with `out_app_flag = 0` or `1`) are:
- gamma-only (`gamma_only = 1`): `dm_nao.txt` (`nspin=1/4`) or `dms1_nao.txt` and `dms2_nao.txt` (`nspin=2`)
- multi-k (`gamma_only = 0`): `dmk1_nao.txt`, `dmk2_nao.txt`, ... (`nspin=1/4`) or `dmk1s1_nao.txt`, `dmk1s2_nao.txt`, ... (`nspin=2`)

Here `g{istep}` denotes the geometry/step index in the output filename.
With `out_app_flag = 2`, a one-based geometry-step suffix `g{istep}` is inserted before `_nao` (for example `dmk1g1_nao.txt`). With `out_app_flag = 0` the fixed file is truncated and overwritten at every write, and with `out_app_flag = 1` records are appended to the fixed file.

For 3.10-LTS, the corresponding keyword is `out_dm`, and file names follow the legacy style such as `SPIN1_DM` and `SPIN2_DM`.

Expand Down
4 changes: 2 additions & 2 deletions docs/advanced/elec_properties/dos.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Gamma
8 8 8 0 0 0
```

Run the program, and you will see a file named doss1g1.txt in the output directory. The columns are: energy(eV), dos (number of states in each energy bin), dos_int (integrated DOS), dos_smear(1/eV) (Gaussian-smeared DOS), dos_smear_int (integrated smeared DOS). Plot the file with graphing software, and you'll get the DOS.
Run the program, and you will see a file named doss1.txt in the output directory (with `out_app_flag = 2` the name carries a one-based `g{step}` index, e.g., `doss1g1.txt`). The columns are: energy(eV), dos (number of states in each energy bin), dos_int (integrated DOS), dos_smear(1/eV) (Gaussian-smeared DOS), dos_smear_int (integrated smeared DOS). Plot the file with graphing software, and you'll get the DOS.

The `dos` column is a raw per-bin histogram, while `dos_smear` is the physically meaningful density of states in 1/eV. The `abacus-plot` tool plots `dos_smear` by default; set `"smearing": false` in its config.json to plot the raw histogram instead, or apply your own smearing to the raw column with `abacus_plot.utils.gaussian_smearing`. For nspin=2, two files (doss1*/doss2*) are written, one per spin channel; the tool pairs them automatically whether you pass either file, a directory, or a list of both files. For nspin=4, a single spinor-summed file is written.

Expand All @@ -82,7 +82,7 @@ The `dos` column is a raw per-bin histogram, while `dos_smear` is the physically

## PDOS

Along with the DOS files, we also produce the projected density of states (PDOS) in files named pdoss{spin}g{geom}.txt (e.g., pdoss1g1.txt).
Along with the DOS files, we also produce the projected density of states (PDOS) in files named pdoss{spin}.txt; with `out_app_flag = 2` a one-based `g{geom}` index is inserted, e.g., pdoss1g1.txt.

The PDOS file uses a plain-text format. Each row corresponds to one energy point and one atom. Columns: energy(eV), atom (1-based), species, then pdos values ordered as s(1), p(3), d(5), f(7), etc. Zeta components are summed, and values below 1e-6 are zeroed out.

Expand Down
19 changes: 13 additions & 6 deletions docs/advanced/elec_properties/hs_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The output filenames depend on the k-point algorithm and `nspin`:

Here `${k}` is the one-based k-point index. For `nspin = 2`, the overlap matrix is spin-independent, so only one overlap file is written for each physical k point. The gamma-only algorithm does not support `nspin = 4`; use the multi-k algorithm with an explicit Gamma-only `KPT` file for a noncollinear calculation at Gamma.

When `out_app_flag` is false, `g${step}` is inserted before `_nao`, where `${step}` is the one-based ionic-step index. For example, the first spin channel at the first k point and first ionic step is written to `hk1s1g1_nao.txt`.
Only when `out_app_flag` is 2 is `g${step}` inserted before `_nao`, where `${step}` is the one-based ionic-step index. For example, the first spin channel at the first k point and first ionic step is written to `hk1s1g1_nao.txt`. With `out_app_flag = 0` the fixed file is truncated and overwritten at every write, and with `out_app_flag = 1` it accumulates one record per written step.

Each output block starts with a comment header containing the one-based ionic-step index, filename, `gamma only` flag, and matrix dimensions. It is followed by `Row 1`, `Row 2`, and so on. Each row contains the matrix elements from the diagonal through the upper triangle.

Expand All @@ -57,7 +57,7 @@ For `out_hsk 2`, the filenames in the table above use `.dat` instead of `.txt`.

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.

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`.
When `out_app_flag` is 1, the first ionic step truncates the shared file and every later step appends another complete record. When `out_app_flag` is 0, the fixed file is truncated and overwritten at every write. Only when `out_app_flag` is 2 does each ionic step have a separate filename containing `g${step}` before `_nao`.

## out_hsr

Expand Down Expand Up @@ -95,19 +95,26 @@ In gamma-only mode, every generated file reports one Bravais lattice vector and

### Native Binary CSR Format

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`.
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 2, the one-based ionic step is included before `_nao`, for example `hrs1g1_nao.dat` and `srg1_nao.dat`.

Each ionic step is a complete record with no padding or self-describing header:
Each ionic step is a complete record with no padding; its header is self-identifying through a magic value and a format version:

1. Native `int`: zero-based ionic step, matrix dimension, number of R blocks.
1. Versioned header: five native `int` values, namely the magic `0x48535242` (`HSRB`), the format version (`2`), the one-based ionic step, the matrix dimension, and the number of R blocks. The magic and version are absent from the unversioned layout described in the migration note below.
2. For every R block in lexicographic `(Rx, Ry, Rz)` order, four native `int` values: `Rx`, `Ry`, `Rz`, and `nnz`.
3. `nnz` matrix values in CSR order. Real matrices use one native `double`; complex matrices use consecutive real and imaginary `double` values.
4. `nnz` native `int` column indices.
5. `dimension + 1` native `long long` row pointers.

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.

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.
When `out_app_flag` is 1, the first ionic step truncates the shared file and later ionic steps append complete records. When `out_app_flag` is 0, the fixed file is truncated and overwritten at every write. Only when `out_app_flag` is 2 is every ionic step written to its own file.

> **Format version and migration note.** The native binary record is now versioned. Version `2` starts with the magic `0x48535242` and the version itself, and stores a one-based ionic step. Earlier files are unversioned and start directly with the ionic step, so the first `int` of an unversioned file is a small step index (`0` or `1`) rather than the magic, which makes the two layouts distinguishable.
> - **v3.11.0-beta9 and v3.11.0-beta10** wrote unversioned records with a **zero-based** ionic step (the first ionic step is stored as `0`).
> - **Development builds between that change and this versioning scheme** wrote unversioned records with a **one-based** ionic step, so an unversioned file cannot be interpreted from its content alone; the writer version is required.
> - **Version `2` and later** write the magic, the format version, and a **one-based** ionic step.
>
> The matrix data itself is unchanged; only the header and the step convention differ. Readers should reject a record whose first `int` is not the expected magic instead of guessing the layout, and must consult the format version before interpreting the remaining fields. Reading an unversioned beta file as version `2`, or a version `2` file as unversioned, shifts the reported ionic-step index and misaligns every following field.

### NPZ Format

Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/elec_properties/position_matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Each file or each section of the appended file starts with "STEP: " followed by

Each block here contains the matrix for the corresponding cell. There are three columns in each block, giving the matrix elements in x, y, z directions, respectively. There are altogether nbasis * nbasis lines in each block, which emulates the matrix elements.

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_freq_ion](../input_files/input-main.md#out_freq_ion). For example, if we are running a 10-step MD with out_freq_ion = 3, then `$x` will be 0, 3, 6, and 9.
In molecular dynamics (MD) calculations, the output frequency is controlled by [out_freq_ion](../input_files/input-main.md#out_freq_ion). With out_app_flag = 2, each written ionic step has its own file named `rrg${step}_nao.txt`, where `${step}` is the one-based ionic-step index; with out_app_flag = 0 or 1 the fixed name `rr_nao.txt` is reused (mode 0 truncates and overwrites it at every write, mode 1 appends one record per written step). The single-shot output of `calculation = get_s` is always named `rr_nao.txt`. The files are stored in `OUT.${suffix}` when [out_app_flag](../input_files/input-main.md#out_app_flag) is 0 or 1, and in its `MAT/` subdirectory when out_app_flag is 2. For example, if we are running a 10-step MD with out_freq_ion = 3 and out_app_flag = 2, the files are `MAT/rrg1_nao.txt`, `MAT/rrg4_nao.txt`, `MAT/rrg7_nao.txt`, and `MAT/rrg10_nao.txt`.

## get_s
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`.
Loading
Loading