Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
21 changes: 18 additions & 3 deletions docs/advanced/elec_properties/density_matrix.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Extracting Density Matrices

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:
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_dmk)" in INPUT file:
```
out_dmk 1
```
After finishing the calculation, the information of the density matrix is stroed in files `OUT.${suffix}/SPIN${spin}_DM`, which looks like:
After finishing the calculation, the density matrix is written into `OUT.${suffix}/`.

For current develop versions:
- gamma-only (`gamma_only = 1`): `dm_nao.csr` (`nspin=1/4`) or `dms1_nao.csr` and `dms2_nao.csr` (`nspin=2`)
- multi-k (`gamma_only = 0`): `dmk1_nao.csr`, `dmk2_nao.csr`, ... (`nspin=1/4`) or `dmk1s1_nao.csr`, `dmk1s2_nao.csr`, ... (`nspin=2`)

Comment thread
sunliang98 marked this conversation as resolved.
For 3.10-LTS, the corresponding keyword is `out_dm`, and file names follow the legacy style such as `SPIN1_DM` and `SPIN2_DM`.

The file content looks like:
```
test
5.39761
Expand Down Expand Up @@ -37,16 +45,23 @@ The following line is dimension of the density matrix, and the rest lines are th

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

- Note: now this function is valid only for LCAO gamma only calcualtion.
- Note: Version difference summary:
- develop: `out_dmk` supports both gamma-only and multi-k-point output.
- 3.10-LTS: use `out_dm`.

## Real-space Density Matrix (CSR format)

ABACUS can also output the real-space density matrix DM(R) in CSR (Compressed Sparse Row) format by setting:
```
out_dmr 1
```
This feature is only valid for multi-k calculations (`gamma_only = 0`).

After the calculation, the density matrix files are written to `OUT.${suffix}/`:
- develop naming pattern: `dmr{s}{spin index}{g}{geometry index}{_nao}.csr`
- `nspin=1`: `dmrs1_nao.csr`
- `nspin=2` (spin-polarized): `dmrs1_nao.csr` (spin-up) and `dmrs2_nao.csr` (spin-down)

For 3.10-LTS, the corresponding keyword is `out_dm1`, and the file names are `data-DMR-sparse_SPIN0.csr` and `data-DMR-sparse_SPIN1.csr`, etc.

These files can be used to restart calculations by setting `init_chg dm` in the INPUT file together with `read_file_dir` pointing to the directory containing the CSR files. This is supported for both `nspin=1` and `nspin=2`.
5 changes: 4 additions & 1 deletion docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,10 @@
- nspin = 1 and 4: dmk1_nao.csr, dmk2_nao.csr, ...;
- nspin = 2: dmk1s1_nao.csr... and dmk1s2_nao.csr... for the two spin channels.

> Note: In the 3.10-LTS version, the parameter is named out_dm and the file names are SPIN1_DM and SPIN2_DM, etc.
> Note: Version difference (develop vs 3.10-LTS):
>
> - In develop, out_dmk supports both gamma-only and multi-k-point density-matrix output.
> - In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc.
- **Default**: False

### out_dmr
Expand Down
4 changes: 3 additions & 1 deletion docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2864,7 +2864,9 @@ parameters:
* nspin = 1 and 4: dmk1_nao.csr, dmk2_nao.csr, ...;
* nspin = 2: dmk1s1_nao.csr... and dmk1s2_nao.csr... for the two spin channels.

[NOTE] In the 3.10-LTS version, the parameter is named out_dm and the file names are SPIN1_DM and SPIN2_DM, etc.
[NOTE] Version difference (develop vs 3.10-LTS):
* In develop, out_dmk supports both gamma-only and multi-k-point density-matrix output.
* In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc.
default_value: "False"
unit: ""
availability: Numerical atomic orbital basis
Expand Down
Loading