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/density_matrix.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,8 @@
1
1
# Extracting Density Matrices
2
2
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:
4
4
```
5
-
out_dm 1
5
+
out_dmk 1
6
6
```
7
7
After finishing the calculation, the information of the density matrix is stroed in files `OUT.${suffix}/SPIN${spin}_DM`, which looks like:
8
8
```
@@ -37,4 +37,4 @@ The following line is dimension of the density matrix, and the rest lines are th
37
37
38
38
The examples can be found in [examples/density_matrix](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/density_matrix)
39
39
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.
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.
4
4
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:
6
6
7
7
- $H(k)=\sum_R H(R)e^{-ikR}$
8
8
@@ -12,18 +12,9 @@ and
12
12
13
13
## out_mat_hs
14
14
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.
16
16
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).
27
18
28
19
As for information on the k points, one may look for the `SETUP K-POINTS` section in the running log.
29
20
@@ -33,12 +24,10 @@ The rest of the file contains the upper triangular part of the specified matrice
33
24
34
25
## out_mat_hs2
35
26
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.
37
28
38
29
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.
39
30
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
-
42
31
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.
43
32
44
33
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
56
45
- The arrays V and COL_INDEX are of length NNZ, and contain the non-zero values and the column indices of those values respectively.
57
46
- 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.
58
47
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`.
61
52
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.
63
54
64
55
> 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.
65
56
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
69
60
## examples
70
61
We provide [examples](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/matrix_hs) of outputting the matrices. There are four examples:
71
62
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
76
67
77
68
Reference output files are provided in each directory.
Copy file name to clipboardExpand all lines: docs/advanced/elec_properties/position_matrix.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,5 +20,5 @@ Each block here contains the matrix for the corresponding cell. There are three
20
20
21
21
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.
22
22
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