diff --git a/.github/workflows/ase_plugin_test.yml b/.github/workflows/ase_plugin_test.yml index 822afcd957c..a4e7b4d8bc6 100644 --- a/.github/workflows/ase_plugin_test.yml +++ b/.github/workflows/ase_plugin_test.yml @@ -2,6 +2,10 @@ name: Atomic Simulation Environment (ASE) Plugin Test on: pull_request: + paths-ignore: + - 'docs/**' + - '**/*.md' + - '.coderabbit.yaml' defaults: run: diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index b00c17f2258..4e125de65c7 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -3,6 +3,10 @@ name: CUDA Test on: workflow_dispatch: pull_request: + paths-ignore: + - 'docs/**' + - '**/*.md' + - '.coderabbit.yaml' push: branches: - develop diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index fd5dd059db4..d2b84c6cbf6 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -2,6 +2,10 @@ name: Pyabacus Build and Test on: pull_request: + paths-ignore: + - 'docs/**' + - '**/*.md' + - '.coderabbit.yaml' defaults: run: diff --git a/.github/workflows/readme-metadata.yml b/.github/workflows/readme-metadata.yml new file mode 100644 index 00000000000..5978522ffca --- /dev/null +++ b/.github/workflows/readme-metadata.yml @@ -0,0 +1,52 @@ +name: README metadata + +# pytest.yml ignores docs and markdown-only changes, which also skips +# README edits even though the Python packages declare those files as +# their package readme. Keep a lightweight check on that path. + +on: + pull_request: + paths: + - '**/README.md' + - '**/pyproject.toml' + +defaults: + run: + shell: bash + +jobs: + metadata: + name: Package readme metadata + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7.0.1 + - name: Set up Python + uses: actions/setup-python@v7 + with: + python-version: 3.8 + - name: Validate readme declarations + run: | + python - <<'EOF' + import pathlib + import re + import sys + + failures = [] + for pyproject in sorted(pathlib.Path(".").rglob("pyproject.toml")): + text = pyproject.read_text(encoding="utf-8") + match = re.search(r'^\s*readme\s*=\s*["\']([^"\']+)["\']', text, re.M) + if match is None: + continue + readme = pyproject.parent / match.group(1) + if not readme.is_file(): + failures.append(f"{pyproject}: declared readme {match.group(1)} does not exist") + elif readme.stat().st_size == 0: + failures.append(f"{pyproject}: declared readme {match.group(1)} is empty") + else: + print(f"ok: {pyproject} -> {match.group(1)}") + + for failure in failures: + print(f"error: {failure}") + sys.exit(1 if failures else 0) + EOF diff --git a/docs/advanced/elec_properties/dos.md b/docs/advanced/elec_properties/dos.md index 969998a46ff..8c854caaf2c 100644 --- a/docs/advanced/elec_properties/dos.md +++ b/docs/advanced/elec_properties/dos.md @@ -87,13 +87,13 @@ Along with the DOS files, we also produce the projected density of states (PDOS) 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. ``` -# istep: 1 +# Ionic_Step 1 # npoints: 2736 # energy(eV) atom species pdos(1/eV), columns: s(m=0) p(m=0,+1,-1) d(m=0,+1,-1,+2,-2) f(m=0,+1,-1,+2,-2,+3,-3) -55.607730 1 Fe 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 ... ``` -The `# istep:` line is only present for geometry-optimization (istep) output. Within each angular momentum `l`, the `2l+1` columns follow the magnetic-quantum-number order `m = 0, +1, -1, +2, -2, ...`. +The `# Ionic_Step` line is only present for geometry-optimization (istep) output. Within each angular momentum `l`, the `2l+1` columns follow the magnetic-quantum-number order `m = 0, +1, -1, +2, -2, ...`. For nspin=2, two files are written (pdoss1* and pdoss2*), one per spin channel. For nspin=4, the two spinor components are summed into a single file. The unit of PDOS is also `(number of states)/(eV * unitcell)`. diff --git a/docs/advanced/elec_properties/hs_matrix.md b/docs/advanced/elec_properties/hs_matrix.md index 4cd3b715786..4a800b0b305 100644 --- a/docs/advanced/elec_properties/hs_matrix.md +++ b/docs/advanced/elec_properties/hs_matrix.md @@ -12,7 +12,7 @@ and ## out_hsk -Use [out_hsk](../input_files/input-main.md#out_hsk) to print the upper triangular part of the Hamiltonian and overlap matrices for each k point into `OUT.${suffix}`. It is available for both gamma-only and multi-k calculations. The format value is: +Use [out_hsk](../input_files/input-main.md#out_hsk) to print the Hamiltonian and overlap matrices for each k point into `OUT.${suffix}`. It is available for both gamma-only and multi-k calculations. The format value is: | Value | Format | | --- | --- | @@ -27,21 +27,21 @@ The $H(k)$ and $S(k)$ matrices are stored with numerical atomic orbitals as basi As for information on the k points, one may look for the `SETUP K-POINTS` section in the running log. -The output filenames depend on the k-point algorithm and `nspin`: +The output filenames depend on the k-point algorithm and `nspin`. Text output (`out_hsk 1`) and native binary output (`out_hsk 2`) use different gamma-only names, because only the text writer omits the `k` marker when there is no k-point index to report: -| Calculation mode | `nspin` | Hamiltonian files | Overlap files | -| --- | --- | --- | --- | -| `gamma_only = 1` | 1 | `hk_nao.txt` | `sk_nao.txt` | -| `gamma_only = 1` | 2 | `hks1_nao.txt`, `hks2_nao.txt` | `sk_nao.txt` | -| `gamma_only = 0` | 1 | `hk${k}_nao.txt` | `sk${k}_nao.txt` | -| `gamma_only = 0` | 2 | `hk${k}s1_nao.txt`, `hk${k}s2_nao.txt` | `sk${k}_nao.txt` | -| `gamma_only = 0` | 4 | `hk${k}s4_nao.txt` | `sk${k}_nao.txt` | +| Calculation mode | `nspin` | Text H(k) | Text S(k) | Binary H(k) | Binary S(k) | +| --- | --- | --- | --- | --- | --- | +| `gamma_only = 1` | 1 | `h_nao.txt` | `s_nao.txt` | `hk_nao.dat` | `sk_nao.dat` | +| `gamma_only = 1` | 2 | `hs1_nao.txt`, `hs2_nao.txt` | `s_nao.txt` | `hks1_nao.dat`, `hks2_nao.dat` | `sk_nao.dat` | +| `gamma_only = 0` | 1 | `hk${k}_nao.txt` | `sk${k}_nao.txt` | `hk${k}_nao.dat` | `sk${k}_nao.dat` | +| `gamma_only = 0` | 2 | `hk${k}s1_nao.txt`, `hk${k}s2_nao.txt` | `sk${k}_nao.txt` | `hk${k}s1_nao.dat`, `hk${k}s2_nao.dat` | `sk${k}_nao.dat` | +| `gamma_only = 0` | 4 | `hk${k}_nao.txt` | `sk${k}_nao.txt` | `hk${k}s4_nao.dat` | `sk${k}_nao.dat` | -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. +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. In text output the spinor Hamiltonian is stored as one complex matrix, so no spin suffix is added; the binary format keeps the historical `s4` marker. 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. +With `out_hsk 1`, each ionic-step record is a self-describing text block. It starts with `Ionic_Step ${step}`, followed by the number of spin directions, the one-based spin index, the total number of k points, the one-based k-point index, the Cartesian and direct coordinates, the k-point weight, the Fermi energy in Ry, the number of localized basis functions, and the matrix dimension. A `user_defined_lattice` block with the lattice vectors and atomic positions follows. The matrix body then stores every element of the dense $N \times N$ matrix in row-major order: row by row from $i = 0$ to $N-1$, and within each row from $j = 0$ to $N-1$. Both triangles and the diagonal are written; the body is not restricted to the upper triangle. Four complex values or eight real values are written per line, and values with magnitude below $10^{-10}$ are flushed to zero. 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. @@ -49,7 +49,7 @@ For multi-k calculations, the matrices are Hermitian and each matrix element is ### Native Binary Format -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: +For `out_hsk 2`, the binary filenames listed in the table above are used. Each matrix record is written without padding or a self-describing header: 1. the matrix dimension as a native C++ `int`; 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; @@ -105,7 +105,7 @@ Each ionic step is a complete record with no padding; its header is self-identif 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. +All R blocks stored by the internal HContainer are present, including blocks with zero nonzero values. The binary sparse threshold is `1e-10`; the text CSR files instead drop complex components below `1e-16` and keep real values unfiltered, so the two formats may differ on near-zero elements. 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 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. diff --git a/docs/advanced/elec_properties/hybrid_nscf.md b/docs/advanced/elec_properties/hybrid_nscf.md index 1994a14e5d7..472a34bcbe8 100644 --- a/docs/advanced/elec_properties/hybrid_nscf.md +++ b/docs/advanced/elec_properties/hybrid_nscf.md @@ -43,6 +43,24 @@ out_wfc_pw 0 out_chg 0 ``` +### Source file discovery + +`read_file_dir` may point to an output directory produced with any +`out_app_flag`; the source files do not have to be renamed. Fixed names take +precedence: + +| Source directory content | File used | +|---|---| +| `eig_occ.txt`, `wfk*_pw.dat` | The fixed names (modes 0 and 1) | +| Only numbered names | The latest written ionic step `g{step}`, and within it the latest electronic iteration `e{iter}`, for wavefunctions | + +When fixed names are absent, occupations are searched in `read_file_dir` and +wavefunctions in `read_file_dir` followed by its `PSI/` subdirectory, which is +where `out_app_flag 2` stores them. For a multi-step source the last written +step is selected automatically; use a single-step SCF source when a specific +snapshot is required. A fixed-name file produced with `out_app_flag 1` must +contain a single SCF snapshot, since appended multi-frame files are rejected. + Supports CPU/CUDA and `nspin 1/2`; use one MPI rank for CUDA. ACE, SOC, unscreened exchange, forces and stress are unsupported in this workflow. Set `symmetry -1`: input `0` is accepted but PW EXX resets it to `-1` at runtime. diff --git a/docs/advanced/elec_properties/position_matrix.md b/docs/advanced/elec_properties/position_matrix.md index c617c62f8fd..c13e8c821fe 100644 --- a/docs/advanced/elec_properties/position_matrix.md +++ b/docs/advanced/elec_properties/position_matrix.md @@ -1,24 +1,45 @@ # Extracting Position Matrices -In ABACUS, we provide the INPUT keyword [out_mat_r](../input_files/input-main.md#out_mat_r) to write the position matrices into a file named `data-rR-tr` in the directory `OUT.${suffix}`. The position matrices is defined as: +In ABACUS, we provide the INPUT keyword [out_mat_r](../input_files/input-main.md#out_mat_r) to write the position matrices into three files, one per Cartesian component: `rrx_nao.csr`, `rry_nao.csr` and `rrz_nao.csr`. They are stored in the matrix output directory, which is `OUT.${suffix}` when [out_app_flag](../input_files/input-main.md#out_app_flag) is 0 or 1 and its `MAT/` subdirectory when out_app_flag is 2; in the latter case a `g${step}` index is inserted before `_nao.csr`, where `${step}` is the one-based ionic-step index. The position matrices are defined as: $$\langle \chi_\mu|\hat{r}|\chi_\nu\rangle$$ This functionality is not available for gamma_only calculations. If you want to use it in gamma_only calculations, you should turn off [gamma_only](../input_files/input-main.md#gamma_only), and explicitly specifies that gamma point is the only k point in the KPT file. -Each file or each section of the appended file starts with "STEP: " followed by the current ion/md step, then the second line starts with "Matrix Dimension of $r(R)$: " followed by the dimension of the matrix, and the third line starts with "Matrix number of $r(R)$: " followed by the matrix number. The rest of the format is arranged into blocks, such as: +Each file or each section of the appended file starts with an informative header: ``` --5 -5 -5 //R (lattice vector) -... --5 -5 -4 //R (lattice vector) -... --5 -5 -3 //R (lattice vector) +Ionic_Step 1 + # print r matrix in real space r(R) x-component + 1 # number of spin directions + 1 # spin index + 6 # number of localized basis + 9 # number of Bravais lattice vector R + + user_defined_lattice + ... + + #----------------------------------------------------------------------# + # CSR Format # + ... + #----------------------------------------------------------------------# ``` -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. +The header records the ionic step, the matrix label and Cartesian component, the spin metadata, the number of localized basis functions and the number of non-empty Bravais lattice vectors actually written, followed by the `user_defined_lattice` cell block and the CSR format description. The rest of the file consists of one sparse block per non-empty Bravais lattice vector (an R vector is kept when at least one of the three Cartesian components has an element above the sparse threshold), such as: -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`. +``` +-5 -5 -5 12 // R (lattice vector) and number of non-zero elements + # CSR values + ... + # CSR column indices + ... + # CSR row pointers + ... +``` + +Values wrap every six entries and column indices every sixteen entries. Only Bravais lattice vectors for which at least one of the three components has a non-zero element are written; a component that is empty for a given `R` is still recorded as a valid zero block, so the three files share the same sequence of `R` blocks. + +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 files named `rrxg${step}_nao.csr`, `rryg${step}_nao.csr` and `rrzg${step}_nao.csr`, where `${step}` is the one-based ionic-step index; with out_app_flag = 0 or 1 the fixed names `rrx_nao.csr`, `rry_nao.csr` and `rrz_nao.csr` are reused (mode 0 truncates and overwrites them at every write, mode 1 appends one record per written step). The single-shot output of `calculation = get_s` is always written to the fixed names. For example, if we are running a 10-step MD with out_freq_ion = 3 and out_app_flag = 2, the x-component files are `MAT/rrxg1_nao.csr`, `MAT/rrxg4_nao.csr`, `MAT/rrxg7_nao.csr`, and `MAT/rrxg10_nao.csr`, and the y/z components follow the same pattern. ## 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`. diff --git a/examples/17_relax/04_relax_with_output_lcao/INPUT b/examples/17_relax/04_relax_with_output_lcao/INPUT index e8408708355..dc5b467a8c5 100644 --- a/examples/17_relax/04_relax_with_output_lcao/INPUT +++ b/examples/17_relax/04_relax_with_output_lcao/INPUT @@ -1,45 +1,92 @@ INPUT_PARAMETERS #Parameters (General) -suffix autotest - +suffix out_app_flag0 nbands 8 calculation cell-relax ecutwfc 10 scf_nmax 20 - basis_type lcao relax_nmax 5 - cal_stress 1 stress_thr 1e-6 cal_force 1 force_thr_ev 1.0e-3 - ks_solver scalapack_gvx mixing_type broyden mixing_beta 0.7 - relax_method cg_trad - -pseudo_dir ../../../tests/PP_ORB +pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB - nspin 2 +gamma_only 0 -out_chg 1 -out_pot 1 -out_dmk 1 -out_dmr 1 -#out_wfc_lcao 1 // OK -out_dos 1 -out_band 1 -out_stru 1 +# Output layout convention (applies to every out_ parameter below): +# out_app_flag=2: per-step files are routed into SUB/ directories with a g{step} suffix +# (MAT/ CHG/ POT/ PSI/ DOS/ BANDS/ ELF/ STRUC/); final-snapshot outputs +# (ldos, vxcrs) keep only the latest frame and drop g{step}. +# out_app_flag=0: fixed filenames in OUT.${suffix}/, truncated on every write (no SUB/, no g{step}). +# out_app_flag=1: fixed filenames in OUT.${suffix}/, frames appended and separated by '# Ionic_Step N'. +# Files that stay in OUT.${suffix}/ even in mode 2: eband_*.txt, eig_occg{step}.txt, +# mullikeng{step}.txt, pbands{spin}g{last}.xml, nao.txt, logs/info/restart files. +# The 'SUB/' prefixes below describe mode 2; in mode 0/1 the same content lands in OUT.${suffix}/. +# Every written frame carries a provenance header: text files open with '# ABACUS version: ...' +# and '# Written at ...' lines, CSR files append them to the 'Ionic_Step N' +# line, and cube files inline them on the first comment line. +# The k-space MAT/*.txt matrices (dmk, hk, sk, tk, vnlk, vlk, vhk, vxck) share one +# self-describing layout: metadata block, UnitCell lattice block, +# flat matrix body (no 'Row N' markers). -out_mat_l 1 -out_mat_r 1 -out_mat_t 1 -#out_mat_dh 1 +out_element_info 1 # OUT.{element_label}/ (pseudopotential + orbital files) -out_freq_ion 2 +out_stru 1 # mode0: STRU_NOW + STRU_FINAL; mode1: STRU_NOW + STRU_FINAL + STRU (appended); mode2: STRUC/STRU_NOW + STRUC/STRU_FINAL + STRUC/STRU{step} + +out_chg 1 # CHG/chgs{spin}g{step}.cube +out_pot 1 # POT/pots{spin}g{step}.cube +out_wfc_lcao 1 # PSI/wf{ki}s{spin}g{step}_nao.txt (多 k); wfs{spin}g{step}_nao.txt (gamma-only) -out_app_flag 2 +out_dos 1 # DOS/doss{spin}g{step}.txt, pdoss{spin}g{step}.txt +out_ldos 1 # DOS/ldos_{bias}ev.cube (final snapshot; header records the final step) +out_band 1 # BANDS/bands{spin}g{step}.txt (nspin=2 → bands1*, bands2*) + +out_elf 1 # ELF/elfs{spin}g{step}.cube, ELF/elftotg{step}.cube (mode 0/1: elfs{spin}.cube, elftot.cube in OUT.${suffix}) +out_mul 1 # mulliken.txt (mode 0/1), mullikeng{step}.txt (mode 2) + +out_dmk 1 # MAT/dmk{ki}s{spin}g{step}_nao.txt (多 k); dms{spin}g{step}_nao.txt (gamma-only) +out_dmr 1 # MAT/dmrs{spin}g{step}_nao.csr +out_hsk 1 # MAT/hk{ki}s{spin}g{step}_nao.txt, sk{ki}g{step}_nao.txt +out_hsr 1 # MAT/hrs{spin}g{step}_nao.csr, srg{step}_nao.csr +out_mat_ds 1 # MAT/dsrxg{step}_nao.csr, dsryg{step}_nao.csr, dsrzg{step}_nao.csr (spin-independent) +out_mat_l 1 # MAT/lxg{step}_nao.csr, lyg{step}_nao.csr, lzg{step}_nao.csr (H(R)-style CSR; + # imaginary part only, the NAO basis is real; not supported for nspin=4) +out_mat_r 1 # MAT/rrxg{step}_nao.csr, rryg{step}_nao.csr, rrzg{step}_nao.csr (three components) +out_mat_t 1 # MAT/trg{step}_nao.csr (spin-independent) +out_mat_tk 1 # MAT/tk{ki}g{step}_nao.txt (T(k), spin-independent) + +out_mat_h_t 1 # MAT/tk{ki}g{step}_nao.txt (legacy alias of out_mat_tk) +out_mat_h_vnl 1 # MAT/vnlk{ki}g{step}_nao.txt (spin-independent) +out_mat_h_vl 1 # MAT/vlk{ki}g{step}_nao.txt (spin-independent) +out_mat_h_vh 1 # MAT/vhk{ki}g{step}_nao.txt (spin-independent) +out_mat_h_vxc 1 # MAT/vxck{ki}s{spin}g{step}_nao.txt (spin-dependent) + +out_proj_band 1 # pbands{spin}.xml (mode 0/1), pbands{spin}g{last}.xml (mode 2); final snapshot only +#out_mat_dh 1 # HAS BUGS!!! (multi-rank runs may hang) per-atom dH(k)/dR_I text: + # MAT/dhk[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt (_ik{ki} only for multi-k), + # plus total dH/dR in CSR: MAT/dhr[xyz]s{spin}[g{step}]_nao.csr +#out_mat_dh_t 1 # MAT/dtk[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt +#out_mat_dh_vl 1 # MAT/dvlk[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt +#out_mat_dh_vnl 1 # MAT/dvnlk[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt +#out_mat_dh_vxc 1 # MAT/dvxck[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt +#out_mat_dh_vh 1 # MAT/dvhk[xyz]_iat{I}[_ik{ki}][s{spin}][g{step}]_nao.txt + +#out_mat_vnlk +#out_mat_vlk +#out_mat_vhk +#out_mat_vxck + +out_eband 1 # eband_kin/vl/vnl/hart/vxc*.txt per written ionic step (g{step} in mode 2) +out_mat_xc 1 # MAT/vxcmok{ki}s{spin}g{step}_nao.txt (KS-orbital repr.) +out_mat_xc2 1 # MAT/vxcrs{spin}_nao.csr (NAO repr., final snapshot; same H(R)-style CSR layout) +out_xc_r 1 # CHG/xc_rho_s{spin}.cube, xc_vrho_s{spin}.cube, xc_exc.cube, xc_sigma_*.cube, xc_vsigma_*.cube; full cube header, (g{step} in mode 2) + +out_freq_ion 2 +out_app_flag 0 diff --git a/interfaces/ASE_interface/abacuslite/io/latestio.py b/interfaces/ASE_interface/abacuslite/io/latestio.py index 2b5e4ac39a9..43dd96c9758 100644 --- a/interfaces/ASE_interface/abacuslite/io/latestio.py +++ b/interfaces/ASE_interface/abacuslite/io/latestio.py @@ -25,6 +25,97 @@ find_final_info_with_iter_header ) + +def find_eig_occ_files(directory: Path, + running_log_lines: Optional[List[str]] = None) -> List[Path]: + '''Discover eigenvalue/occupation files in the output directory. + + ABACUS writes eigenvalue data in three layouts depending on + ``out_app_flag``: + + - mode 0: one fixed ``eig_occ.txt`` holding only the latest written frame; + - mode 1: one fixed ``eig_occ.txt`` holding every written frame; + - mode 2: one ``eig_occg{N}.txt`` per written ionic step. + + When ``running_log_lines`` is given, only the files announced by the + current run are returned, so stale files left in a reused output + directory by an earlier run are ignored. An announced file that is + missing is dropped instead of falling back to an unannounced file: the + log is authoritative for the layout of the current run, and an old + ``eig_occ.txt`` must not be reported as the current results. If the log + carries no such announcement (older builds or hand-written fixtures), + the filename based discovery below is used instead. + + Parameters + ---------- + directory : Path + The ``OUT.${suffix}`` directory to search. + running_log_lines : list of str, optional + Lines of the running log of the current run. + + Returns + ------- + list of Path + Sorted list of eigenvalue files. Empty when none are found. + ''' + if running_log_lines is not None: + announced: List[Path] = [] + for line in running_log_lines: + match = re.search(r'Write\s+Eigenvalues and occupations to file:\s*(\S+)', + line, re.IGNORECASE) + if match is None: + continue + candidate = directory / Path(match.group(1)).name + if candidate not in announced: + announced.append(candidate) + if announced: + def _step_number(path: Path) -> int: + match = re.search(r'g(\d+)\.txt$', path.name) + return int(match.group(1)) if match else 0 + # The announcement set decides the layout. A missing announced + # file is reported as missing (by its absence) rather than being + # replaced by a stale unannounced file from an earlier run. + existing = [path for path in announced if path.exists()] + return sorted(existing, key=_step_number) + + single = directory / 'eig_occ.txt' + if single.exists(): + return [single] + numbered = sorted(directory.glob('eig_occg*.txt'), + key=lambda p: int(re.search(r'g(\d+)\.txt$', p.name).group(1))) + return numbered + + +def read_band_from_eig_occ_files(files: List[Path]) -> List[Dict[str, np.ndarray]]: + '''Read eigenvalue/occupation data from one or more eig_occ files. + + When multiple numbered files are given (mode 2), each file contributes + one frame. When a single file is given (mode 0/1), the frames are + parsed from its internal ``# Ionic_Step`` markers. + + Parameters + ---------- + files : list of Path + Files returned by :func:`find_eig_occ_files`. + + Returns + ------- + list of dict + A list of dictionaries containing the k-points and band energies. + Each dictionary has keys 'k', 'e', and 'occ'. + ''' + if not files: + return [] + if len(files) == 1: + return read_band_from_eig_occ(files[0]) + + # Mode 2: concatenate the per-step files and parse them together. + raw: List[str] = [] + for fn in files: + with open(fn) as f: + raw.extend(f.readlines()) + return read_band_from_eig_occ(raw) + def read_esolver_type_from_running_log(src: str | Path | List[str]) \ -> str: ''' @@ -93,7 +184,15 @@ def read_band_from_eig_occ(src: str | Path | List[str]) \ raw = [l.strip() for l in raw] raw = [l for l in raw if l] # remove empty lines - nframe = len([l for l in raw if l.endswith('# ionic step')]) + # The current writer emits the one-based step after the marker + # ("# Ionic_Step N"), while older outputs wrote it before + # ("N # Ionic_Step", and "N # ionic step" before the keyword was + # unified). All three spellings are accepted case-insensitively. + step_header_pat = r'^(?:\s*#\s*Ionic[ _]Step\s+(\d+)\s*' \ + + r'|\s*(\d+)\s*#\s*Ionic[ _]Step\s*)$' + step_matches = [re.match(step_header_pat, l, re.IGNORECASE) for l in raw] + steps = [int(m.group(1) or m.group(2)) for m in step_matches if m] + nframe = len(steps) ekb_leading_pat = r'spin=(\d)\s+k-point=(\d+)/(\d+)\s+Cartesian=\s*' \ + r'(-?\d(\.\d+)?(e-\d+)?)\s+' \ + r'(-?\d(\.\d+)?(e-\d+)?)\s+' \ @@ -136,8 +235,36 @@ def read_band_from_eig_occ(src: str | Path | List[str]) \ ekb_raw = ekb_raw.reshape(nframe, nspin, nk, nb, 2) ekb, occ = ekb_raw[:, :, :, :, 0], ekb_raw[:, :, :, :, 1] - return [{'k': ki, 'e': eki, 'occ': occi} - for ki, eki, occi in zip(k, ekb, occ)] + return [{'step': si, 'k': ki, 'e': eki, 'occ': occi} + for si, ki, eki, occi in zip(steps, k, ekb, occ)] + + +def align_eig_frames(elecstate: List[Dict[str, np.ndarray]], + step_ids: List[int]) \ + -> List[Optional[Dict[str, np.ndarray]]]: + '''Align written eigenvalue frames with the ionic steps of a trajectory. + + ABACUS may write fewer eigenvalue frames than there are ionic steps, for + example when ``out_freq_ion > 1`` skips steps or when ``out_app_flag=0`` + keeps only the final snapshot. Frames are matched by their recorded + ``Ionic_Step`` ID; a step without a written frame yields ``None`` instead + of borrowing the spectrum of another step. + + Parameters + ---------- + elecstate : list of dict + Frames returned by :func:`read_band_from_eig_occ_files`. + step_ids : list of int + One-based ionic step of every trajectory frame, in order. + + Returns + ------- + list of dict or None + One entry per element of ``step_ids``; ``None`` where no eigenvalue + frame was written. + ''' + by_step = {frame['step']: frame for frame in elecstate if 'step' in frame} + return [by_step.get(step) for step in step_ids] def read_traj_from_running_log(src: str | Path | List[str]) \ -> List[Dict[str, np.ndarray|str]]: @@ -441,8 +568,23 @@ def read_abacus_out(fileobj, if fileobj.name != 'running_md.log' else \ read_traj_from_md_dump(fileobj.parent / 'MD_dump') - # read the eigenvalues (nframe, nk, nbnd) - elecstate = read_band_from_eig_occ(fileobj.parent / 'eig_occ.txt') + # read the eigenvalues (nframe, nk, nbnd) written by the current run + eig_files = find_eig_occ_files(fileobj.parent, abacus_lines) + elecstate = read_band_from_eig_occ_files(eig_files) + + # Associate eigenvalue frames with ionic steps. The running log carries + # one "#ION MOVE#" header per ionic step; if it is unavailable or does not + # match the trajectory, fall back to the one-based step order. Steps + # without a written eigenvalue frame stay unavailable instead of reusing + # another step's spectrum. + iter_header = read_iter_header_from_running_log(abacus_lines) + step_ids: List[int] = [] + for ion_move, _ in iter_header: + if ion_move not in step_ids: + step_ids.append(ion_move) + if len(step_ids) != len(trajectory): + step_ids = list(range(1, len(trajectory) + 1)) + elecstate = align_eig_frames(elecstate, step_ids) # read the atomic forces (nframe, nat, 3) forces = read_forces_from_running_log(abacus_lines) @@ -464,7 +606,7 @@ def read_abacus_out(fileobj, # only keep the energies of the final iteration for each ion step energies = find_final_info_with_iter_header( read_energies_from_running_log(abacus_lines)[1], - read_iter_header_from_running_log(abacus_lines) + iter_header ) # read the magmom @@ -506,15 +648,17 @@ def read_abacus_out(fileobj, forces=frs, stress=strs, magmoms=mag[ind], efermi=ener['E_Fermi'], ibzkpts=kvecd, dipole=None) - # import the eigenvalues and occupations kpoint-by-kpoint + # import the eigenvalues and occupations kpoint-by-kpoint; a step + # without a written eigenvalue frame keeps an empty k-point list calc.kpts = [] - for ispn, (ekb, occ) in enumerate(zip(estat['e'], estat['occ'])): # loop over the spin - calc.kpts += [SinglePointKPoint(weight=wk[ik], - s=ispn, - k=kvecd[ik], - eps_n=ekb[ik,:], - f_n=occ[ik,:]) - for ik in range(len(kvecd))] + if estat is not None: + for ispn, (ekb, occ) in enumerate(zip(estat['e'], estat['occ'])): # loop over the spin + calc.kpts += [SinglePointKPoint(weight=wk[ik], + s=ispn, + k=kvecd[ik], + eps_n=ekb[ik,:], + f_n=occ[ik,:]) + for ik in range(len(kvecd))] # attach the calculator to the atoms atoms.calc = calc images.append(atoms) @@ -553,7 +697,8 @@ def test_read_abacus_out_reorders_calculator_magmoms(self): (Path(tmpdir) / 'eig_occ.txt').write_text('') with patch(__name__ + '.read_esolver_type_from_running_log', return_value='ksdft'), \ patch(__name__ + '.read_traj_from_running_log', return_value=[frame]), \ - patch(__name__ + '.read_band_from_eig_occ', return_value=elecstate), \ + patch(__name__ + '.find_eig_occ_files', return_value=[Path(tmpdir) / 'eig_occ.txt']), \ + patch(__name__ + '.read_band_from_eig_occ_files', return_value=elecstate), \ patch(__name__ + '.read_forces_from_running_log', return_value=[]), \ patch(__name__ + '.read_stress_from_running_log', return_value=[]), \ patch(__name__ + '.read_kpoints_from_running_log', return_value=kpoints), \ @@ -598,6 +743,7 @@ def test_read_band_from_eig_occ(self): elecstate = read_band_from_eig_occ(fn) # 2 frames, 1 spin channel (nspin 4), 1 kpoint, 35 bands self.assertEqual(len(elecstate), 2) + self.assertEqual([es['step'] for es in elecstate], [1, 2]) for es in elecstate: # loop over frames self.assertIn('k', es) self.assertEqual(es['k'].shape, (1, 1, 3)) # ispin, ik, 3 @@ -606,6 +752,144 @@ def test_read_band_from_eig_occ(self): self.assertIn('occ', es) self.assertEqual(es['occ'].shape, (1, 1, 35)) # ispin, ik, nbnd + def test_read_band_from_eig_occ_producer_header(self): + # A single snapshot from the current writer: the step follows the + # marker and two provenance lines precede it. + text = ( + '# ABACUS version: 3.10.0\n' + '# Written at 2026-11-09 15:18:58\n' + '# Ionic_Step 3\n' + ' Electronic state energy (eV) and occupations\n' + ' Spin number 1\n' + ' spin=1 k-point=1/1 Cartesian=0.0000000 0.0000000 0.0000000 (7 plane wave)\n' + ' 1 -8.734940678442698 1.000000000000000\n' + ' 2 7.011672764486192 0.000000000000000\n' + ) + elecstate = read_band_from_eig_occ(text.splitlines(keepends=True)) + self.assertEqual(len(elecstate), 1) + self.assertEqual(elecstate[0]['step'], 3) + self.assertEqual(elecstate[0]['e'].shape, (1, 1, 2)) + + def test_read_band_from_eig_occ_legacy_headers(self): + # Older spellings put the step before the marker; the keyword may be + # lower case. Both must still be parsed into the same frame layout. + body = ( + ' spin=1 k-point=1/1 Cartesian=0.0000000 0.0000000 0.0000000 (7 plane wave)\n' + ' 1 -8.734940678442698 1.000000000000000\n' + ' 2 7.011672764486192 0.000000000000000\n' + ) + for header in ['1 # Ionic_Step', '1 # ionic step']: + elecstate = read_band_from_eig_occ((header + '\n' + body).splitlines(keepends=True)) + self.assertEqual(len(elecstate), 1) + self.assertEqual(elecstate[0]['step'], 1) + self.assertEqual(elecstate[0]['e'].shape, (1, 1, 2)) + + def test_find_eig_occ_files(self): + import tempfile + + with tempfile.TemporaryDirectory() as tmpdir: + tmp = Path(tmpdir) + # no files + self.assertEqual(find_eig_occ_files(tmp), []) + # single file (mode 0/1) + (tmp / 'eig_occ.txt').write_text('') + self.assertEqual(find_eig_occ_files(tmp), [tmp / 'eig_occ.txt']) + # numbered files (mode 2) take precedence when single is absent + (tmp / 'eig_occ.txt').unlink() + (tmp / 'eig_occg2.txt').write_text('') + (tmp / 'eig_occg1.txt').write_text('') + (tmp / 'eig_occg3.txt').write_text('') + self.assertEqual(find_eig_occ_files(tmp), + [tmp / 'eig_occg1.txt', + tmp / 'eig_occg2.txt', + tmp / 'eig_occg3.txt']) + + def test_find_eig_occ_files_prefers_current_run(self): + import tempfile + + with tempfile.TemporaryDirectory() as tmpdir: + tmp = Path(tmpdir) + # A stale fixed file from an earlier run coexists with the files + # written by the current mode-2 run. + (tmp / 'eig_occ.txt').write_text('stale\n') + (tmp / 'eig_occg1.txt').write_text('') + (tmp / 'eig_occg2.txt').write_text('') + log = [ + ' Write Eigenvalues and occupations to file: OUT.ABACUS/eig_occg1.txt\n', + ' Write Eigenvalues and occupations to file: OUT.ABACUS/eig_occg2.txt\n', + ] + self.assertEqual(find_eig_occ_files(tmp, log), + [tmp / 'eig_occg1.txt', tmp / 'eig_occg2.txt']) + # Without a log announcement the legacy discovery still applies. + self.assertEqual(find_eig_occ_files(tmp), [tmp / 'eig_occ.txt']) + + def test_align_eig_frames_keeps_steps_distinct(self): + frames = [ + {'step': 1, 'k': None, 'e': None, 'occ': None}, + {'step': 3, 'k': None, 'e': None, 'occ': None}, + ] + aligned = align_eig_frames(frames, [1, 2, 3]) + self.assertIs(aligned[0], frames[0]) + self.assertIsNone(aligned[1]) + self.assertIs(aligned[2], frames[1]) + # mode 0 keeps only the final snapshot; earlier steps stay unavailable + final_only = align_eig_frames([{'step': 3, 'k': None, 'e': None, 'occ': None}], + [1, 2, 3]) + self.assertEqual([f is None for f in final_only], [True, True, False]) + + def test_read_band_from_eig_occ_files(self): + fn = self.testfiles / 'nspin4-gamma-eigocc' + # single file path + elecstate = read_band_from_eig_occ_files([fn]) + self.assertEqual(len(elecstate), 2) + # empty list + self.assertEqual(read_band_from_eig_occ_files([]), []) + # multiple files: split the single fixture into two step files + import tempfile + with tempfile.TemporaryDirectory() as tmpdir: + tmp = Path(tmpdir) + with open(fn) as f: + lines = f.readlines() + # find the frame boundary + step_idx = [i for i, l in enumerate(lines) if '# Ionic_Step' in l] + self.assertEqual(len(step_idx), 2) + file1 = tmp / 'eig_occg1.txt' + file2 = tmp / 'eig_occg2.txt' + with open(file1, 'w') as f: + f.writelines(lines[:step_idx[1]]) + with open(file2, 'w') as f: + f.writelines(lines[step_idx[1]:]) + elecstate = read_band_from_eig_occ_files([file1, file2]) + self.assertEqual(len(elecstate), 2) + + def test_read_band_from_eig_occ_accepts_legacy_step_marker(self): + # The reader promises to accept both the current "# Ionic_Step N" + # marker and the legacy "N # ionic step" spelling. Run the same + # fixture through both and compare the parsed frames. + fn = self.testfiles / 'nspin4-gamma-eigocc' + current = read_band_from_eig_occ_files([fn]) + + import tempfile + with tempfile.TemporaryDirectory() as tmpdir: + legacy = Path(tmpdir) / 'eig_occ.txt' + lines = [] + for line in fn.read_text(encoding='utf-8').splitlines(keepends=True): + match = re.match(r'^\s*#\s*Ionic[ _]Step\s+(\d+)\s*$', line, + re.IGNORECASE) + if match: + lines.append('{} # ionic step\n'.format(int(match.group(1)))) + else: + lines.append(line) + legacy.write_text(''.join(lines), encoding='utf-8') + parsed = read_band_from_eig_occ_files([legacy]) + + self.assertEqual(len(parsed), len(current)) + for frame, reference in zip(parsed, current): + self.assertEqual(frame['step'], reference['step']) + np.testing.assert_allclose(frame['k'], reference['k']) + np.testing.assert_allclose(frame['e'], reference['e']) + np.testing.assert_allclose(frame['occ'], reference['occ']) + def test_read_traj_from_running_log(self): traj = read_traj_from_running_log(self.testfiles / 'lcao-symm0-nspin2-multik-cellrelax') self.assertEqual(len(traj), 3) diff --git a/interfaces/ASE_interface/abacuslite/io/testfiles/nspin4-gamma-eigocc b/interfaces/ASE_interface/abacuslite/io/testfiles/nspin4-gamma-eigocc index 61c45239877..831a3d224a5 100644 --- a/interfaces/ASE_interface/abacuslite/io/testfiles/nspin4-gamma-eigocc +++ b/interfaces/ASE_interface/abacuslite/io/testfiles/nspin4-gamma-eigocc @@ -1,4 +1,6 @@ -1 # ionic step +# ABACUS version: 3.10.0 +# Written at 2026-11-09 15:18:58 +# Ionic_Step 1 Electronic state energy (eV) and occupations Spin number 4 spin=1 k-point=1/1 Cartesian=0.0000000 0.0000000 0.0000000 (1837 plane wave) @@ -38,7 +40,9 @@ 34 18.41424567719280 0.000000000000000 35 18.43990861265023 0.000000000000000 -2 # ionic step +# ABACUS version: 3.10.0 +# Written at 2026-11-09 15:19:01 +# Ionic_Step 2 Electronic state energy (eV) and occupations Spin number 4 spin=1 k-point=1/1 Cartesian=0.0000000 0.0000000 0.0000000 (1837 plane wave) diff --git a/interfaces/ASE_interface/tests/test_eig_occ_files.py b/interfaces/ASE_interface/tests/test_eig_occ_files.py new file mode 100644 index 00000000000..c6d308d0f32 --- /dev/null +++ b/interfaces/ASE_interface/tests/test_eig_occ_files.py @@ -0,0 +1,43 @@ +import tempfile +import unittest +from pathlib import Path + +from abacuslite.io.latestio import find_eig_occ_files + + +class TestFindEigOccFiles(unittest.TestCase): + """Discovery rules for eigenvalue/occupation files.""" + + def test_missing_announced_file_does_not_fall_back_to_stale_file(self): + # Mode 2 announced eig_occg1.txt, but the file is gone. The stale + # eig_occ.txt of an earlier mode 0/1 run must not be reported as the + # current results. + with tempfile.TemporaryDirectory() as tmp: + out = Path(tmp) + (out / 'eig_occ.txt').write_text('# Ionic_Step 1\n', encoding='utf-8') + log = ['Write Eigenvalues and occupations to file: OUT.x/eig_occg1.txt'] + self.assertEqual(find_eig_occ_files(out, log), []) + + def test_announced_files_keep_step_order(self): + with tempfile.TemporaryDirectory() as tmp: + out = Path(tmp) + (out / 'eig_occg2.txt').write_text('', encoding='utf-8') + (out / 'eig_occg1.txt').write_text('', encoding='utf-8') + log = [ + 'Write Eigenvalues and occupations to file: OUT.x/eig_occg2.txt', + 'Write Eigenvalues and occupations to file: OUT.x/eig_occg1.txt', + ] + found = find_eig_occ_files(out, log) + self.assertEqual([path.name for path in found], + ['eig_occg1.txt', 'eig_occg2.txt']) + + def test_no_announcement_keeps_filename_discovery(self): + with tempfile.TemporaryDirectory() as tmp: + out = Path(tmp) + (out / 'eig_occ.txt').write_text('', encoding='utf-8') + found = find_eig_occ_files(out, ['unrelated log line']) + self.assertEqual([path.name for path in found], ['eig_occ.txt']) + + +if __name__ == '__main__': + unittest.main() diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 6ba4c342ea7..ab2dcc715a7 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -792,6 +792,7 @@ OBJS_IO=module_parameter/input_conv.o\ td_efield_io.o\ td_vecpot_io.o\ module_chgpot/write_libxc_r.o\ + module_chgpot/libxc_r_suffix.o\ module_chgpot/get_pchg_pw.o\ module_output/output_log.o\ module_hs/output_mat_sparse.o\ @@ -854,6 +855,7 @@ OBJS_IO_LCAO=module_hs/pos_op_mat.o\ module_hs/dhs_sparse_writer.o\ module_hs/lat_r_csr.o\ module_hs/hsk_writer.o\ + module_hs/dense_text_body.o\ module_hs/hsr_writer.o\ module_hs/hsr_legacy.o\ module_dm/write_dmr.o\ diff --git a/source/source_base/module_out/csr_reader.cpp b/source/source_base/module_out/csr_reader.cpp index 0345c0723c0..e31a86d7a9b 100644 --- a/source/source_base/module_out/csr_reader.cpp +++ b/source/source_base/module_out/csr_reader.cpp @@ -7,6 +7,51 @@ namespace ModuleIO { +namespace +{ +/** + * @brief Extract the ionic step from a frame header line held in `ss`. + * @details Accepts the current bare "Ionic_Step N" spelling, the legacy + * compact "STEP: N" label and the historical "--- Ionic Step N ---" / + * "--- Ionic_Step N ---" forms, so files written by older versions remain + * readable. + * @param ss stream positioned at the start of the header line + * @param step output ionic step index + * @return true when a recognized marker and step value were parsed + */ +bool parseStepMarker(std::stringstream& ss, int& step) +{ + std::string first; + if (!(ss >> first)) + { + return false; + } + if (first == "STEP:" || first == "Ionic_Step") + { + return static_cast(ss >> step); + } + if (first != "---") + { + return false; + } + std::string ionic; + if (!(ss >> ionic)) + { + return false; + } + if (ionic == "Ionic_Step") + { + return static_cast(ss >> step); + } + if (ionic == "Ionic") + { + std::string label; + return static_cast(ss >> label >> step) && label == "Step"; + } + return false; +} +} // namespace + // constructor template csrFileReader::csrFileReader(const std::string& filename) : FileReader(filename) @@ -23,7 +68,22 @@ void csrFileReader::parseFile() nextDataLine(); const std::string line = ss.str(); const std::size_t begin = line.find_first_not_of(" \t"); - if (line.compare(begin, 5, "STEP:") == 0) + bool compact = begin != std::string::npos && line.compare(begin, 5, "STEP:") == 0; + if (!compact) + { + // The bare "Ionic_Step N" marker is shared by the compact and + // cell-aware headers; peek at the next physical line to tell them + // apart. Compact headers continue with "Matrix Dimension of ...", + // while cell-aware headers continue with a description comment. + std::string next; + if (peekLine(next)) + { + const std::size_t nbegin = next.find_first_not_of(" \t"); + compact = nbegin != std::string::npos + && next.compare(nbegin, 19, "Matrix Dimension of") == 0; + } + } + if (compact) { parseCompactHeader(); } @@ -45,8 +105,7 @@ void csrFileReader::parseCompactHeader() const auto invalid = []() { ModuleBase::WARNING_QUIT("csrFileReader::parseCompactHeader", "Malformed compact CSR file"); }; - std::string label; - if (!(ss >> label >> step) || label != "STEP:") { invalid(); } + if (!parseStepMarker(ss, step)) { invalid(); } const auto header_integer = [&](const std::string& prefix, int& value) { readLine(); const std::string line = ss.str(); @@ -68,11 +127,7 @@ void csrFileReader::parseCellHeader() const auto invalid = []() { ModuleBase::WARNING_QUIT("csrFileReader::parseCellHeader", "Malformed cell-aware CSR header"); }; - std::string marker; - std::string ionic; - std::string step_label; - if (!(ss >> marker >> ionic >> step_label >> step) - || marker != "---" || ionic != "Ionic" || step_label != "Step") { invalid(); } + if (!parseStepMarker(ss, step)) { invalid(); } readLine(); // matrix description readLine(); int spins = 0; @@ -189,11 +244,14 @@ void csrFileReader::validateFrameEnd() } std::string marker; tokens >> marker; - if (marker == "STEP:") { return; } + if (marker == "STEP:" || marker == "Ionic_Step") { return; } std::string ionic; - std::string step_label; - if (marker == "---" && tokens >> ionic >> step_label - && ionic == "Ionic" && step_label == "Step") { return; } + if (marker == "---" && tokens >> ionic) + { + if (ionic == "Ionic_Step") { return; } + std::string step_label; + if (ionic == "Ionic" && tokens >> step_label && step_label == "Step") { return; } + } ModuleBase::WARNING_QUIT("csrFileReader::validateFrameEnd", "Unexpected data after CSR frame"); } } diff --git a/source/source_base/module_out/csr_reader.h b/source/source_base/module_out/csr_reader.h index 8214fc33981..a30d24ce9cc 100644 --- a/source/source_base/module_out/csr_reader.h +++ b/source/source_base/module_out/csr_reader.h @@ -19,7 +19,7 @@ namespace ModuleIO * are rejected for both formats rather than producing an empty matrix. * The cell-aware format is like: * ``` - * --- Ionic Step 1 --- + * Ionic_Step 1 * # print density matrix in real space DM(R) * 26 # number of localized basis * 13 # number of Bravais lattice vector R diff --git a/source/source_base/module_out/filename.cpp b/source/source_base/module_out/filename.cpp index 3f1b464ca03..cbd4d287490 100644 --- a/source/source_base/module_out/filename.cpp +++ b/source/source_base/module_out/filename.cpp @@ -23,7 +23,7 @@ std::string filename_output( // {k(optional)}{k-point index}{g(optional)}{geometry index1}{_basis(nao|pw)} // + {".txt"/".dat"}" - std::set valid_properties = { "wf", "chg", "hk", "sk", "tk", "vxc", "vxck", "vlk", "vnlk", "vhk", "vexxk" }; + std::set valid_properties = { "wf", "chg", "hk", "sk", "t", "tk", "vxc", "vxcmo", "vxck", "vlk", "vnlk", "vhk", "vexxk" }; if (valid_properties.find(property) == valid_properties.end()) { ModuleBase::WARNING_QUIT("ModuleIO::filename_output", "unknown property in filename function"); diff --git a/source/source_base/module_out/sparse_matrix.cpp b/source/source_base/module_out/sparse_matrix.cpp index c0b3357762b..d1ebd5abfee 100644 --- a/source/source_base/module_out/sparse_matrix.cpp +++ b/source/source_base/module_out/sparse_matrix.cpp @@ -76,6 +76,24 @@ void SparseMatrix::printToCSR(std::ostream& ofs, int precision) ofs << '\n' << std::endl; } +/** + * @brief Write the CSR-format description banner used by every text CSR + * output (H(R)/S(R), DM(R), dH/dR, r(R), T(R), Vxc(R), L(R)). + * @param ofs Output stream. + */ +void write_csr_banner(std::ostream& ofs) +{ + ofs << " #----------------------------------------------------------------------#" << std::endl; + ofs << " # CSR Format #" << std::endl; + ofs << " # The outer loop corresponds to the number of Bravais lattice vectors. #" << std::endl; + ofs << " # The first line contains the index of the Bravais lattice vector #" << std::endl; + ofs << " # (Rx, Ry, Rz), followed by the number of non-zero elements. #" << std::endl; + ofs << " # The subsequent lines consist of three blocks of data, which are #" << std::endl; + ofs << " # values, column indices, row pointers. #" << std::endl; + ofs << " #----------------------------------------------------------------------#" << std::endl; + ofs << std::endl; +} + /** * @brief Read CSR data from arrays */ diff --git a/source/source_base/module_out/sparse_matrix.h b/source/source_base/module_out/sparse_matrix.h index 79e427a3940..c13bfb7857f 100644 --- a/source/source_base/module_out/sparse_matrix.h +++ b/source/source_base/module_out/sparse_matrix.h @@ -99,6 +99,13 @@ class SparseMatrix double _sparse_threshold = 1.0e-10; }; // class SparseMatrix +/** + * @brief Write the CSR-format description banner used by every text CSR + * output (H(R)/S(R), DM(R), dH/dR, r(R), T(R), Vxc(R), L(R)). + * @param ofs Output stream. + */ +void write_csr_banner(std::ostream& ofs); + } // namespace ModuleIO #endif // SPARSE_MATRIX_H \ No newline at end of file diff --git a/source/source_base/parallel_common.cpp b/source/source_base/parallel_common.cpp index 90073b9d535..4cdeb408197 100644 --- a/source/source_base/parallel_common.cpp +++ b/source/source_base/parallel_common.cpp @@ -92,14 +92,23 @@ void bcast_int(int* object, const int n) void bcast_bool(bool& object) { #ifdef __MPI + bcast_bool(object, MPI_COMM_WORLD); +#endif +} + +#ifdef __MPI +void bcast_bool(bool& object, const MPI_Comm& comm) +{ int swap = object; int my_rank; - MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); - MPI_Bcast(&swap, 1, MPI_INT, 0, MPI_COMM_WORLD); + MPI_Comm_rank(comm, &my_rank); + MPI_Bcast(&swap, 1, MPI_INT, 0, comm); if (my_rank != 0) + { object = static_cast(swap); -#endif + } } +#endif void bcast_char(char* object, const int n) { diff --git a/source/source_base/parallel_common.h b/source/source_base/parallel_common.h index bbb4aaf1d0d..aab84fe7011 100644 --- a/source/source_base/parallel_common.h +++ b/source/source_base/parallel_common.h @@ -36,6 +36,7 @@ void bcast_bool(bool& object); #ifdef __MPI //(3) bcast single on an explicit communicator, from the communicator's rank 0 +void bcast_bool(bool& object, const MPI_Comm& comm); void bcast_mpi_offset(MPI_Offset& object, const MPI_Comm& comm); #endif diff --git a/source/source_base/test/test_csr_reader.cpp b/source/source_base/test/test_csr_reader.cpp index 7f805b886ab..9e82b748ecb 100644 --- a/source/source_base/test/test_csr_reader.cpp +++ b/source/source_base/test/test_csr_reader.cpp @@ -7,7 +7,10 @@ namespace { -class CsrFormats : public testing::TestWithParam +// Header spellings covered by the parameter: 0 = legacy compact "STEP:", +// 1 = current compact "Ionic_Step", 2 = legacy cell-aware +// "--- Ionic Step ---", 3 = current cell-aware "Ionic_Step". +class CsrFormats : public testing::TestWithParam { protected: std::string path; @@ -16,17 +19,29 @@ class CsrFormats : public testing::TestWithParam void write(const std::string& blocks, const std::string& dimension, const std::string& count) { std::ofstream out(path); - if (GetParam()) + const int format = GetParam(); + if (format == 0) { out << "STEP: 7\nMatrix Dimension of Hexxs_0(R): " << dimension << "\nMatrix number of Hexxs_0(R): " << count << '\n'; } - else + else if (format == 1) + { + out << "Ionic_Step 7\nMatrix Dimension of Hexxs_0(R): " << dimension + << "\nMatrix number of Hexxs_0(R): " << count << '\n'; + } + else if (format == 2) { out << " --- Ionic Step 7 ---\n # matrix\n1 # spins\n1 # spin\n" << dimension << " # basis\n" << count << " # R blocks\n\n" << "user_defined_lattice\n1\n1 0 0\n0 1 0\n0 0 1\nSi\n1\nDirect\n0 0 0\n"; } + else + { + out << "Ionic_Step 7\n # matrix\n1 # spins\n1 # spin\n" + << dimension << " # basis\n" << count << " # R blocks\n\n" + << "user_defined_lattice\n1\n1 0 0\n0 1 0\n0 0 1\nSi\n1\nDirect\n0 0 0\n"; + } out << blocks; } }; @@ -147,5 +162,35 @@ TEST_P(CsrFormats, RejectsDataAfterTrailingComment) write("0 0 0 1\n1\n0\n0 1 1\n# end\n\n9\n", "2", "1"); EXPECT_EXIT({ModuleIO::csrFileReader reader(path);}, testing::ExitedWithCode(1), ""); } -INSTANTIATE_TEST_SUITE_P(BothHeaders, CsrFormats, testing::Bool()); +TEST(CsrInlineProvenance, CompactHeaderWithInlineComment) +{ + const std::string path = testing::TempDir() + "/abacus_inline_provenance_compact.csr"; + std::ofstream out(path); + out << "Ionic_Step 7 # ABACUS version: v3.11.0-beta12 # Written at 2026-11-09 14:32:59\n" + << "Matrix Dimension of Hexxs_0(R): 2\nMatrix number of Hexxs_0(R): 1\n" + << "0 0 0 1\n1\n0\n0 1 1\n"; + out.close(); + ModuleIO::csrFileReader reader(path); + EXPECT_EQ(reader.getStep(), 7); + EXPECT_EQ(reader.getMatrixDimension(), 2); + EXPECT_DOUBLE_EQ(reader.getMatrix(0)(0, 0), 1.0); + std::remove(path.c_str()); +} + +TEST(CsrInlineProvenance, CellAwareHeaderWithInlineComment) +{ + const std::string path = testing::TempDir() + "/abacus_inline_provenance_cell.csr"; + std::ofstream out(path); + out << "Ionic_Step 7 # ABACUS version: v3.11.0-beta12 # Written at 2026-11-09 14:32:59\n" + << " # matrix\n1 # spins\n1 # spin\n2 # basis\n1 # R blocks\n\n" + << "user_defined_lattice\n1\n1 0 0\n0 1 0\n0 0 1\nSi\n1\nDirect\n0 0 0\n" + << "0 0 0 1\n1\n0\n0 1 1\n"; + out.close(); + ModuleIO::csrFileReader reader(path); + EXPECT_EQ(reader.getStep(), 7); + EXPECT_EQ(reader.getMatrixDimension(), 2); + EXPECT_DOUBLE_EQ(reader.getMatrix(0)(0, 0), 1.0); + std::remove(path.c_str()); +} +INSTANTIATE_TEST_SUITE_P(AllHeaders, CsrFormats, testing::Values(0, 1, 2, 3)); } diff --git a/source/source_base/test/test_filename.cpp b/source/source_base/test/test_filename.cpp index 254040cb0b3..e546c02e6e2 100644 --- a/source/source_base/test/test_filename.cpp +++ b/source/source_base/test/test_filename.cpp @@ -111,6 +111,26 @@ TEST_F(FilenameOutputTest, GammaOnlyNoKLabel) EXPECT_EQ(fn, "OUT.test/wfs1_pw.dat"); } +// --------------------------------------------------------------------------- +// The kinetic matrix T(k) is spin-independent, so its caller always passes +// nspin = 1 together with the property "t". Gamma-only must not emit the +// k-point label, and multi-k must not double the "k" (tk1, not tkk1). +// --------------------------------------------------------------------------- +TEST_F(FilenameOutputTest, KineticPropertyUsesTWithoutDoubleK) +{ + const std::string fn_gamma = filename_output( + dir, "t", "nao", ik_local, ik2iktot, /*nspin=*/1, nkstot, + /*out_type=*/1, /*out_app_flag=*/1, /*gamma_only=*/true, + /*istep=*/-1, /*iter=*/-1); + EXPECT_EQ(fn_gamma, "OUT.test/t_nao.txt"); + + const std::string fn_multi = filename_output( + dir, "t", "nao", ik_local, ik2iktot, /*nspin=*/1, nkstot, + /*out_type=*/1, /*out_app_flag=*/1, /*gamma_only=*/false, + /*istep=*/-1, /*iter=*/-1); + EXPECT_EQ(fn_multi, "OUT.test/tk1_nao.txt"); +} + // --------------------------------------------------------------------------- // nspin=4 (noncollinear SOC) -> spin block is s4, no half-k split. // --------------------------------------------------------------------------- @@ -123,4 +143,37 @@ TEST_F(FilenameOutputTest, NoncollinearSpin4) EXPECT_EQ(fn, "OUT.test/wfk1s4g1_pw.dat"); } +// --------------------------------------------------------------------------- +// The MO-basis Vxc matrix (property "vxcmo") and the NAO-basis one +// (property "vxck") must never resolve to the same filename. +// --------------------------------------------------------------------------- +TEST_F(FilenameOutputTest, VxcMoDoesNotCollideWithVxck) +{ + const std::string fn_mo = filename_output( + dir, "vxcmo", "nao", ik_local, ik2iktot, nspin, nkstot, + /*out_type=*/1, /*out_app_flag=*/0, /*gamma_only=*/false, + /*istep=*/1, /*iter=*/-1); + const std::string fn_nao = filename_output( + dir, "vxck", "nao", ik_local, ik2iktot, nspin, nkstot, + /*out_type=*/1, /*out_app_flag=*/0, /*gamma_only=*/false, + /*istep=*/1, /*iter=*/-1); + + EXPECT_EQ(fn_mo, "OUT.test/vxcmok1s1_nao.txt"); + EXPECT_EQ(fn_nao, "OUT.test/vxck1s1_nao.txt"); + EXPECT_NE(fn_mo, fn_nao); +} + +// --------------------------------------------------------------------------- +// In mode 2 the MO-basis Vxc matrix carries the g{N} suffix like any other +// per-step matrix. +// --------------------------------------------------------------------------- +TEST_F(FilenameOutputTest, VxcMoMode2EmbedsStep) +{ + const std::string fn = filename_output( + dir, "vxcmo", "nao", ik_local, ik2iktot, nspin, nkstot, + /*out_type=*/1, /*out_app_flag=*/2, /*gamma_only=*/false, + /*istep=*/1, /*iter=*/-1); + EXPECT_EQ(fn, "OUT.test/vxcmok1s1g2_nao.txt"); +} + #endif // TEST_FILENAME_CPP diff --git a/source/source_cell/cell_index.cpp b/source/source_cell/cell_index.cpp index f6b9d3d8362..8271364fad6 100644 --- a/source/source_cell/cell_index.cpp +++ b/source/source_cell/cell_index.cpp @@ -1,6 +1,5 @@ #include "cell_index.h" -#include "source_base/name_angular.h" #include "source_base/tool_quit.h" CellIndex::CellIndex(const std::vector& atomLabels_in, @@ -260,34 +259,3 @@ void CellIndex::cal_orbitalCounts() this->orbitalCounts[it] = orbitalCount; } } - -void CellIndex::write_orb_info(const std::string& out_dir) const -{ - std::stringstream os; - os << out_dir << "nao.txt"; - std::ofstream out(os.str().c_str()); - out << std::setw(5) << "#io" << std::setw(8) << "spec" << std::setw(5) << "l" << std::setw(5) << "m" << std::setw(5) - << "z" << std::setw(5) << "sym" << std::endl; - - for (int iat = 0; iat < this->get_nat(); iat++) - { - for (int iw = 0; iw < this->get_nw(iat); ++iw) - { - const int L = this->iw2l(iat, iw); - const int Z = this->iw2z(iat, iw); - const int M = this->iw2m(iat, iw); - out << std::setw(5) << iat << std::setw(8) << this->get_atom_label(iat) << std::setw(5) << L << std::setw(5) - << M << std::setw(5) << Z + 1 << std::setw(15) << ModuleBase::Name_Angular[L][M] << std::endl; - } - } - out << std::endl << std::endl; - out << std::setw(5) << "#io" << std::setw(2) << "=" << std::setw(2) << "Orbital index in supercell" << std::endl; - out << std::setw(5) << "#spec" << std::setw(2) << "=" << std::setw(2) << "Atomic species label" << std::endl; - out << std::setw(5) << "#l" << std::setw(2) << "=" << std::setw(2) << "Angular mumentum quantum number" - << std::endl; - out << std::setw(5) << "#m" << std::setw(2) << "=" << std::setw(2) << "Magnetic quantum number" << std::endl; - out << std::setw(5) << "#z" << std::setw(2) << "=" << std::setw(2) << "Zeta index of orbital" << std::endl; - out << std::setw(5) << "#sym" << std::setw(2) << "=" << std::setw(2) << "Symmetry name of real orbital" - << std::endl; - out.close(); -} diff --git a/source/source_cell/cell_index.h b/source/source_cell/cell_index.h index ed24e521906..88d5fbed8cf 100644 --- a/source/source_cell/cell_index.h +++ b/source/source_cell/cell_index.h @@ -45,8 +45,6 @@ class CellIndex int get_nchi(int iat, int L) const; /// @brief get atom label of a given atom std::string get_atom_label(int iat, bool order = false) const; - /// @brief write orbital info into file - void write_orb_info(const std::string& out_dir) const; private: /// atomCounts is a vector used to store the number of atoms for each type diff --git a/source/source_cell/klist.cpp b/source/source_cell/klist.cpp index b1a1be33c76..d91b007204e 100644 --- a/source/source_cell/klist.cpp +++ b/source/source_cell/klist.cpp @@ -124,6 +124,7 @@ void K_Vectors::set(const UnitCell& ucell, std::ofstream ofkpt(skpt.str().c_str()); // clear kpoints ofkpt << skpt2 << skpt1; ofkpt.close(); + ofs << " Write K-point information to file: " << skpt.str() << std::endl; } int deg = (nspin_in == 1) ? 2 : 1; diff --git a/source/source_cell/module_symmetry/symm_analysis.cpp b/source/source_cell/module_symmetry/symm_analysis.cpp index 330aba413af..8f4d8d1b85f 100644 --- a/source/source_cell/module_symmetry/symm_analysis.cpp +++ b/source/source_cell/module_symmetry/symm_analysis.cpp @@ -23,7 +23,7 @@ void Symmetry::analy_sys(const Lattice& lat, Atom* atoms, ofs_running << " | |" << std::endl; ofs_running << " | #Symmetry Analysis# |" << std::endl; ofs_running << " | We calculate the norm of 3 vectors and the angles between them, |" << std::endl; - ofs_running << " | the type of Bravais lattice is given. We can judge if the unticell |" << std::endl; + ofs_running << " | the type of Bravais lattice is given. We can tell if the unitcell |" << std::endl; ofs_running << " | is a primitive cell. Finally we give the point group operation for |" << std::endl; ofs_running << " | this unitcell. We use the point group operations to perform |" << std::endl; ofs_running << " | symmetry analysis on given k-point mesh and the charge density. |" << std::endl; diff --git a/source/source_cell/module_symmetry/symm_lattice.cpp b/source/source_cell/module_symmetry/symm_lattice.cpp index 58bd6b10ffd..eea10858262 100644 --- a/source/source_cell/module_symmetry/symm_lattice.cpp +++ b/source/source_cell/module_symmetry/symm_lattice.cpp @@ -364,7 +364,7 @@ void Symmetry::lattice_type( if(convert_atoms) { GlobalV::ofs_running <ntype; ++it) diff --git a/source/source_cell/read_atoms.cpp b/source/source_cell/read_atoms.cpp index f5223a7a162..831a761b791 100644 --- a/source/source_cell/read_atoms.cpp +++ b/source/source_cell/read_atoms.cpp @@ -148,10 +148,11 @@ bool unitcell::read_atom_positions(UnitCell& ucell, // explicitly magnetized STRU. if (unitcell::is_magnetization_all_zero(ucell)) { - ofs_running << "\n WARNING: initial magmom is all zero and symmetry=1; " - << "autoset magnetism is SKIPPED to preserve the symmetry of the initial (nonmagnetic) structure.\n" - << " If spontaneous magnetism is expected, set magmom explicitly " - << "in STRU, or use symmetry = 0 or -1." << std::endl; + ofs_running << "\n WARNING: initial magmom is all zero and symmetry = 1." << std::endl; + ofs_running << " Autoset magnetism is skipped to preserve the symmetry" << std::endl; + ofs_running << " of the initial nonmagnetic structure." << std::endl; + ofs_running << " If spontaneous magnetism is expected, set magmom" << std::endl; + ofs_running << " explicitly in STRU, or use symmetry = 0 or -1." << std::endl; } } else diff --git a/source/source_cell/test/cell_index_test.cpp b/source/source_cell/test/cell_index_test.cpp index 06a932c92d7..ac269419086 100644 --- a/source/source_cell/test/cell_index_test.cpp +++ b/source/source_cell/test/cell_index_test.cpp @@ -2,7 +2,6 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" -#include /************************************************ * unit test of class CellIndex @@ -52,15 +51,3 @@ TEST_F(CellIndexTest, Index) EXPECT_EQ("C", cell_index.get_atom_label(0)); EXPECT_EQ("H", cell_index.get_atom_label(1)); } - -TEST_F(CellIndexTest, WriteOrbInfo) -{ - cell_index.write_orb_info("./"); - std::ifstream ifs("./nao.txt"); - std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("#io spec l m z sym")); - EXPECT_THAT(str, testing::HasSubstr("0 C 2 4 1 dxy")); - EXPECT_THAT(str, testing::HasSubstr("1 H 2 4 1 dxy")); - EXPECT_THAT(str, testing::HasSubstr("2 H 2 4 1 dxy")); - remove("./nao.txt"); -} \ No newline at end of file diff --git a/source/source_cell/ucell_io.cpp b/source/source_cell/ucell_io.cpp index 64c8f7b3e49..4a55da45f27 100644 --- a/source/source_cell/ucell_io.cpp +++ b/source/source_cell/ucell_io.cpp @@ -35,26 +35,54 @@ void UcellIO::write_ucell(std::ofstream& ofs, const UnitCell* ucell) } } -void UcellIO::read_ucell(std::ifstream& ifs) +bool UcellIO::read_ucell(std::ifstream& ifs) { std::string tmp; - for (int i = 0; i < 6; i++) + + // --- six metadata lines: latName + lat0 + three lattice vectors + atom labels --- + for (int i = 0; i < 6; ++i) { - std::getline(ifs, tmp); // latName + lat0 + latvec + atom label + if (!std::getline(ifs, tmp)) + { + return false; + } } - std::getline(ifs, tmp); // atom number of each type + // --- per-type atom counts, must yield at least one positive integer --- + if (!std::getline(ifs, tmp)) + { + return false; + } std::istringstream iss(tmp); int natom = 0; int total_natom = 0; while (iss >> natom) { + if (natom < 0) + { + // Negative counts make the block size indeterminate. + return false; + } total_natom += natom; } - for (int i = 0; i < total_natom + 1; i++) + if (total_natom <= 0) + { + // A malformed count line leaves total_natom at zero; the stream would + // then be sitting on the coordinate rows, and a subsequent small-matrix + // read could happily consume them as density-matrix entries. Reject + // this case explicitly so the caller can abort with a clean diagnostic. + return false; + } + + // --- "Direct" marker + total_natom coordinate lines --- + for (int i = 0; i < total_natom + 1; ++i) { - std::getline(ifs, tmp); // Direct + atom coordinates + if (!std::getline(ifs, tmp)) + { + return false; + } } + return true; } } // namespace ModuleIO diff --git a/source/source_cell/ucell_io.h b/source/source_cell/ucell_io.h index 2441fd17da2..7c4a1c758f8 100644 --- a/source/source_cell/ucell_io.h +++ b/source/source_cell/ucell_io.h @@ -24,11 +24,21 @@ class UcellIO { static void write_ucell(std::ofstream& ofs, const UnitCell* ucell); /** - * @brief Reads the unit cell information lines in a file. + * @brief Skips the UnitCell block that follows the DMK header. * - * @param ifs The input file stream. + * The function consumes the latName, lat0, three lattice vectors, atom + * labels, per-type atom counts, the "Direct" marker, and every coordinate + * line in order. On success the stream is positioned at the first line of + * the trailing matrix body. + * + * @param ifs The input file stream positioned at the start of the block. + * @return true when the full block is consumed without parse errors; + * false when any mandatory line cannot be read, or when the atom + * count line yields no positive integer (leaving the stream at + * the coordinates, which would otherwise be misinterpreted as + * the matrix body by the caller). */ - static void read_ucell(std::ifstream& ifs); + static bool read_ucell(std::ifstream& ifs); }; } // namespace ModuleIO diff --git a/source/source_cell/unitcell.h b/source/source_cell/unitcell.h index de3c04b8e02..b8c9962c57b 100644 --- a/source/source_cell/unitcell.h +++ b/source/source_cell/unitcell.h @@ -217,6 +217,12 @@ class UnitCell : public BaseCell { = false; ///< whether the ionic position has been updated bool cell_parameter_updated = false; ///< whether the cell parameters are updated + /// @brief whether the current runner call is the last ionic step of the run. + /// @details Set by the outer ionic driver (source_md) right before calling + /// ESolver::runner, so the output layer can write the final ionic step even + /// when it does not sit on the out_freq_ion cadence or its SCF did not + /// converge. It is not a user input and stays false for single-shot runs. + bool last_ion_step = false; /// @} /// @name Nonlocal info diff --git a/source/source_cell/unitcell_setup.cpp b/source/source_cell/unitcell_setup.cpp index 11ae80df0c5..e996015c167 100644 --- a/source/source_cell/unitcell_setup.cpp +++ b/source/source_cell/unitcell_setup.cpp @@ -74,7 +74,7 @@ void UnitCell::setup_cell(const std::string& fn, std::ofstream& log, const doubl log << " | |" << std::endl; log << " | #Setup Unitcell# |" << std::endl; log << " | From the input file and the structure file we know the number of |" << std::endl; - log << " | different elments in this unitcell, then we list the detail |" << std::endl; + log << " | different elements in this unitcell, then we list the detail |" << std::endl; log << " | information for each element, especially the zeta and polar atomic |" << std::endl; log << " | orbital number for each element. The total atom number is counted. |" << std::endl; log << " | We calculate the nearest atom distance for each atom and show the |" << std::endl; diff --git a/source/source_esolver/esolver_dm2rho.cpp b/source/source_esolver/esolver_dm2rho.cpp index 6c5dc31302a..f237dde200e 100644 --- a/source/source_esolver/esolver_dm2rho.cpp +++ b/source/source_esolver/esolver_dm2rho.cpp @@ -85,7 +85,7 @@ void ESolver_DM2rho::runner(BaseCell& basecell, const int istep) fn += ".cube"; // write electron density - const std::string desc_chg = ModuleIO::make_data_desc("charge density", "magnetization density m", is, nspin); + const std::string desc_chg = ModuleIO::make_data_desc("Charge density", "Magnetization density m", is, nspin); ModuleIO::write_vdata_palgrid(this->Pgrid, this->chr.rho[is], diff --git a/source/source_esolver/esolver_gets.cpp b/source/source_esolver/esolver_gets.cpp index c7c172caff9..69b4221c40b 100644 --- a/source/source_esolver/esolver_gets.cpp +++ b/source/source_esolver/esolver_gets.cpp @@ -208,31 +208,31 @@ void ESolver_GetS::runner(BaseCell& basecell, const int istep) } } - const std::string fn = PARAM.globalv.global_out_dir + "sr_nao.csr"; const std::string global_matrix_dir = PARAM.globalv.global_matrix_dir; + // Mode-2 MAT/ subdirectory is created lazily at write time. + ModuleBase::ensure_directory(global_matrix_dir); + auto* hamilt_ptr = static_cast>*>(this->p_hamilt); const bool binary = false; const double sparse_threshold = 1e-10; const int precision = 16; - ModuleIO::output_SR(pv, + ModuleIO::output_SR(ucell, + pv, gd, hamilt_ptr, - fn, binary, sparse_threshold, precision, - PARAM.globalv.global_out_dir, global_matrix_dir, PARAM.inp.calculation, PARAM.inp.out_app_flag, PARAM.inp.nspin, + istep, GlobalV::ofs_running); if (this->inp_->out_mat_r[0]) { - // Mode-2 MAT/ subdirectory is created lazily at write time. - ModuleBase::ensure_directory(global_matrix_dir); Position_op r_matrix; const bool cal_force = PARAM.inp.cal_force; const int nlocal = PARAM.globalv.nlocal; @@ -252,8 +252,6 @@ void ESolver_GetS::runner(BaseCell& basecell, const int istep) if (this->inp_->out_mat_ds[0]) { - // Mode-2 MAT/ subdirectory is created lazily at write time. - ModuleBase::ensure_directory(global_matrix_dir); LCAO_HS_Arrays HS_Arrays; // store sparse arrays ModuleIO::MatROutputOptions mat_R_options; mat_R_options.binary = binary; diff --git a/source/source_esolver/esolver_ks.cpp b/source/source_esolver/esolver_ks.cpp index 57307e60ada..bbc7f5b7873 100644 --- a/source/source_esolver/esolver_ks.cpp +++ b/source/source_esolver/esolver_ks.cpp @@ -17,6 +17,7 @@ #include "source_io/module_energy/write_bands.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_io/module_output/output_log.h" // use write_head +#include "source_io/module_output/write_notice.h" #include "source_estate/elecstate_print.h" // print_etot #include "source_pw/module_pwdft/dftu_base.h" // Plus_U_Base::u_converged in iter_finish #include "source_pw/module_pwdft/dftu_base_io.h" @@ -443,6 +444,21 @@ void ESolver_KS::iter_finish(UnitCell& ucell, const int istep, int& iter, bool & writer_pool, pw_world, &GlobalV::ofs_warning); + // Announce the auto-backup on the final electronic iteration, which is + // either convergence or the scf_nmax limit. + const bool final_iter = conv_esolver || iter == iter_limit; + if (final_iter && write_restart && writer_pool && GlobalV::MY_RANK == 0) + { + ModuleIO::write_notice(GlobalV::ofs_running, + "Charge density restart file", + prefix + "-CHARGE-DENSITY.restart"); + if (write_tau) + { + ModuleIO::write_notice(GlobalV::ofs_running, + "Kinetic energy density restart file", + prefix + "-TAU-DENSITY.restart"); + } + } } // the end, print time @@ -498,16 +514,30 @@ void ESolver_KS::after_scf(UnitCell& ucell, const int istep, const bool conv_eso ESolver_FP::after_scf(ucell, istep, conv_esolver); // 3) write eigenvalues and occupations to eig_occ.txt - ModuleIO::write_eig_file(this->pelec->ekb, - this->pelec->wg, - this->kv, - this->inp_->nbands, - this->inp_->nspin, - PARAM.globalv.global_out_dir, - istep); + // In RT-TDDFT istep is the cumulative electronic evolution step, so + // out_freq_ion counts electronic steps there and ionic steps otherwise. + // A non-positive frequency keeps the historical every-step write. + const int out_freq_ion = this->inp_->out_freq_ion; + const bool write_step_outputs = (out_freq_ion <= 0) || (istep % out_freq_ion == 0); + if (write_step_outputs) + { + ModuleIO::write_eig_file(this->pelec->ekb, + this->pelec->wg, + this->kv, + this->inp_->nbands, + this->inp_->nspin, + PARAM.globalv.global_out_dir, + istep, + this->inp_->out_app_flag); + } // 4) write band information to band.txt - ModuleIO::write_bands(*this->inp_, this->pelec->ekb, this->kv, GlobalV::ofs_running, istep); + // Same out_freq_ion rhythm as eig_occ.txt. + if (write_step_outputs) + { + const std::string global_band_dir = PARAM.globalv.global_band_dir; + ModuleIO::write_bands(*this->inp_, this->pelec->ekb, this->kv, GlobalV::ofs_running, global_band_dir, istep); + } } diff --git a/source/source_esolver/esolver_ks_lcao.cpp b/source/source_esolver/esolver_ks_lcao.cpp index 5fa30b230ca..1c71cc6eb2b 100644 --- a/source/source_esolver/esolver_ks_lcao.cpp +++ b/source/source_esolver/esolver_ks_lcao.cpp @@ -32,6 +32,7 @@ #include "source_io/module_ctrl/ctrl_runner_lcao.h" // use ctrl_runner_lcao() #include "source_io/module_ctrl/ctrl_scf_lcao.h" // use ctrl_scf_lcao() #include "source_io/module_output/print_info.h" +#include "source_io/module_output/write_orb_info.h" #include "source_io/module_parameter/input_parameter.h" #include "source_io/module_restart/restart.h" // GlobalC::restart for load_exx_flag #include "source_lcao/lcao_set.h" // mohan add 20251111 @@ -126,7 +127,15 @@ void ESolver_KS_LCAO::before_all_runners(BaseCell& basecell, const Input orb_); this->basis_index_ = make_basis_flattened_indexing(ucell, this->orb_); - // 6) generate matrices for optimized auxiliary basis functions when requested + // 6) write the NAO orbital table once; it depends only on the basis set and + // is shared by the PDOS, projected-band and Mulliken population outputs. + const bool need_orb_info = inp.out_dos > 0 || inp.out_mul || inp.out_proj_band; + if (need_orb_info && GlobalV::MY_RANK == 0) + { + ModuleIO::write_orb_info(&ucell, GlobalV::ofs_running); + } + + // 7) generate matrices for optimized auxiliary basis functions when requested if (inp.calculation == "gen_opt_abfs") { #ifdef __EXX @@ -306,7 +315,11 @@ void ESolver_KS_LCAO::before_scf(UnitCell& ucell, const int istep, const this->dmat, ucell, &(this->pv), - this->pelec->charge); + this->pelec->charge, + this->kv, + istep, + this->inp_->out_app_flag, + this->inp_->ks_solver); } if (this->inp_->init_chg == "hr") { @@ -843,6 +856,9 @@ void ESolver_KS_LCAO::after_scf(UnitCell& ucell, const int istep, const ESolver_KS::after_scf(ucell, istep, conv_esolver); //! 2) write LCAO output using the applicable ionic or RT-TDDFT electronic step + //! The outer ionic driver marks the final ionic step on the cell so the + //! output gate can always persist the final snapshot. + const bool is_final_step = ucell.last_ion_step; ModuleIO::ctrl_scf_lcao(ucell, *this->inp_, this->kv, @@ -868,6 +884,7 @@ void ESolver_KS_LCAO::after_scf(UnitCell& ucell, const int istep, const this->exx_info_, conv_esolver, this->scf_nmax_flag, + is_final_step, istep, GlobalV::ofs_running); diff --git a/source/source_esolver/esolver_ks_lcao_tddft.cpp b/source/source_esolver/esolver_ks_lcao_tddft.cpp index 59cc3ef8c3b..a6a72481e32 100644 --- a/source/source_esolver/esolver_ks_lcao_tddft.cpp +++ b/source/source_esolver/esolver_ks_lcao_tddft.cpp @@ -354,7 +354,7 @@ void ESolver_KS_LCAO_TDDFT::runner(BaseCell& basecell, const int ist // 3) after_scf //---------------------------------------------------------------- this->after_scf(ucell, totstep, conv_esolver); - if (this->inp_->out_freq_td > 0 && totstep % this->inp_->out_freq_td == 0 && GlobalV::MY_RANK == 0) + if (this->inp_->out_freq_ion > 0 && totstep % this->inp_->out_freq_ion == 0 && GlobalV::MY_RANK == 0) { td_field_manager_->write_restart(PARAM.globalv.global_out_dir); } diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 4e499c5ebba..b95fcc13218 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -165,6 +165,8 @@ void ESolver_KS_PW::before_scf(UnitCell& ucell, const int istep) ModuleBase::TITLE("ESolver_KS_PW", "before_scf"); ModuleBase::timer::start("ESolver_KS_PW", "before_scf"); + this->istep_ = istep; + ESolver_KS::before_scf(ucell, istep); //! Init variables (once the cell has changed) @@ -572,6 +574,7 @@ void ESolver_KS_PW::after_all_runners(BaseCell& basecell) this->ppcell, this->solvent, this->Pgrid, + this->istep_, *this->inp_, GlobalV::ofs_running); diff --git a/source/source_esolver/esolver_ks_pw.h b/source/source_esolver/esolver_ks_pw.h index a03e73c943e..d8f3eef37fd 100644 --- a/source/source_esolver/esolver_ks_pw.h +++ b/source/source_esolver/esolver_ks_pw.h @@ -52,6 +52,10 @@ class ESolver_KS_PW : public ESolver_KS /** @brief Let RT-TDDFT bind its endpoint field before wavefunction initialization uses H; ordinary DFT does nothing. */ virtual void prepare_init_hamilt(const UnitCell& ucell); + // Last ionic step executed; used by after_all_runners outputs that are + // written once after all runners have finished. + int istep_ = 0; + // Electronic wave function psi Setup_Psi_pw stp; diff --git a/source/source_esolver/lcao_others.cpp b/source/source_esolver/lcao_others.cpp index 9032008cc93..0a69c1600f5 100644 --- a/source/source_esolver/lcao_others.cpp +++ b/source/source_esolver/lcao_others.cpp @@ -202,6 +202,7 @@ void ESolver_KS_LCAO::others(BaseCell& basecell, const int istep) this->Pgrid, this->gd, this->inp_->out_pchg, + istep, global_out_dir, GlobalV::ofs_running); } @@ -214,6 +215,7 @@ void ESolver_KS_LCAO::others(BaseCell& basecell, const int istep) this->kv, this->inp_->out_pchg, this->inp_->if_separate_k, + istep, global_out_dir, GlobalV::ofs_running); } diff --git a/source/source_estate/write_init.cpp b/source/source_estate/write_init.cpp index a1057b1bfc0..ffc9267a776 100644 --- a/source/source_estate/write_init.cpp +++ b/source/source_estate/write_init.cpp @@ -3,7 +3,7 @@ // to cube files in real space. It is part of the module_io package. // // Output files are named according to the following convention: -// - Frequency is out_freq_td for RT-TDDFT and out_freq_ion otherwise. +// - Frequency is out_freq_ion; in RT-TDDFT it counts electronic evolution steps. // - Frequency = 0: chg_ini.cube/pot_ini.cube, chgs1_ini.cube/chgs2_ini.cube // - Frequency > 0: chgg{#}_ini.cube/potg{#}_ini.cube, chgs{#}g{#}_ini.cube // (modes 0/1 keep the fixed names without the g{#} index; only mode 2 numbers them) @@ -78,7 +78,7 @@ void ModuleIO::write_chg_init(const UnitCell& ucell, if (inp.out_chg[0] == 2) { - const int output_frequency = inp.esolver_type == "tddft" ? inp.out_freq_td : inp.out_freq_ion; + const int output_frequency = inp.out_freq_ion; const bool should_output = output_frequency == 0 || (output_frequency > 0 && istep % output_frequency == 0); if (should_output) @@ -110,7 +110,7 @@ void ModuleIO::write_chg_init(const UnitCell& ucell, } } - const std::string desc_chg = ModuleIO::make_data_desc("charge density", "magnetization density m", is, nspin); + const std::string desc_chg = ModuleIO::make_data_desc("Charge density", "Magnetization density m", is, nspin); ModuleIO::write_vdata_palgrid(para_grid, chr.rho[is], @@ -152,7 +152,7 @@ void ModuleIO::write_pot_init(const UnitCell& ucell, if (inp.out_pot[0] == 3) { - const int output_frequency = inp.esolver_type == "tddft" ? inp.out_freq_td : inp.out_freq_ion; + const int output_frequency = inp.out_freq_ion; const bool should_output = output_frequency == 0 || (output_frequency > 0 && istep % output_frequency == 0); if (should_output) @@ -167,7 +167,7 @@ void ModuleIO::write_pot_init(const UnitCell& ucell, { std::string filename = gen_ini_filename("pot", out_dir, nspin, is, istep, include_geom_step); - const std::string desc_pot = ModuleIO::make_data_desc("effective potential", "effective magnetic field b", is, nspin); + const std::string desc_pot = ModuleIO::make_data_desc("Effective potential", "Effective magnetic field b", is, nspin); ModuleIO::write_vdata_palgrid(para_grid, pelec->pot->get_eff_v(is), diff --git a/source/source_estate/write_init.h b/source/source_estate/write_init.h index 3a05e8c4005..0afecc4cfba 100644 --- a/source/source_estate/write_init.h +++ b/source/source_estate/write_init.h @@ -3,7 +3,7 @@ // to cube files in real space. It is part of the module_io package. // // Output files are named according to the following convention: -// - Frequency is out_freq_td for RT-TDDFT and out_freq_ion otherwise. +// - Frequency is out_freq_ion; in RT-TDDFT it counts electronic evolution steps. // - Frequency = 0: chg_ini.cube/pot_ini.cube, chgs1_ini.cube/chgs2_ini.cube // - Frequency > 0: chgg{#}_ini.cube/potg{#}_ini.cube, chgs{#}g{#}_ini.cube // - File indices start from 1 (istep + 1); RT-TDDFT uses electronic steps. @@ -40,7 +40,7 @@ std::string gen_ini_filename(const std::string& prefix, // Write initial charge density to cube file in real space. // Triggered when inp.out_chg[0] == 2. -// Use out_freq_td and an electronic istep for RT-TDDFT, out_freq_ion and an ionic istep otherwise. +// Use out_freq_ion; in RT-TDDFT istep is the cumulative electronic step, otherwise the ionic step. // Zero frequency overwrites the same file; positive frequency selects istep % frequency == 0. // File naming and one-based indices follow the convention above. void write_chg_init(const UnitCell& ucell, @@ -55,7 +55,7 @@ void write_chg_init(const UnitCell& ucell, // Write initial effective potential to cube file in real space. // Triggered when inp.out_pot[0] == 3. -// Use out_freq_td and an electronic istep for RT-TDDFT, out_freq_ion and an ionic istep otherwise. +// Use out_freq_ion; in RT-TDDFT istep is the cumulative electronic step, otherwise the ionic step. // Zero frequency overwrites the same file; positive frequency selects istep % frequency == 0. // File naming and one-based indices follow the convention above. void write_pot_init(const UnitCell& ucell, diff --git a/source/source_hamilt/module_hcontainer/output_hcontainer.cpp b/source/source_hamilt/module_hcontainer/output_hcontainer.cpp index 474a0483758..ae8ab4bcda7 100644 --- a/source/source_hamilt/module_hcontainer/output_hcontainer.cpp +++ b/source/source_hamilt/module_hcontainer/output_hcontainer.cpp @@ -31,15 +31,7 @@ Output_HContainer::Output_HContainer(hamilt::HContainer* hcontainer, template void Output_HContainer::write(bool write_empty) { - _ofs << " #----------------------------------------------------------------------#" << std::endl; - _ofs << " # CSR Format #" << std::endl; - _ofs << " # The outer loop corresponds to the number of Bravais lattice vectors. #" << std::endl; - _ofs << " # The first line contains the index of the Bravais lattice vector #" << std::endl; - _ofs << " # (Rx, Ry, Rz), followed by the number of non-zero elements. #" << std::endl; - _ofs << " # The subsequent lines consist of three blocks of data, which are #" << std::endl; - _ofs << " # values, column indices, row pointers. #" << std::endl; - _ofs << " #----------------------------------------------------------------------#" << std::endl; - _ofs << std::endl; + ModuleIO::write_csr_banner(_ofs); int size_for_loop_R = this->_hcontainer->size_R_loop(); int rx=0; diff --git a/source/source_hamilt/module_hcontainer/test/support/SR.csr b/source/source_hamilt/module_hcontainer/test/support/SR.csr index 874504ea537..7227eb5b30a 100644 --- a/source/source_hamilt/module_hcontainer/test/support/SR.csr +++ b/source/source_hamilt/module_hcontainer/test/support/SR.csr @@ -1,4 +1,4 @@ -STEP: 0 +Ionic_Step 0 Matrix Dimension of S(R): 26 Matrix number of S(R): 93 -2 -1 0 169 diff --git a/source/source_hamilt/module_hcontainer/test/test_hcontainer_read_csr.cpp b/source/source_hamilt/module_hcontainer/test/test_hcontainer_read_csr.cpp index 893bbbd6019..491baf2b02f 100644 --- a/source/source_hamilt/module_hcontainer/test/test_hcontainer_read_csr.cpp +++ b/source/source_hamilt/module_hcontainer/test/test_hcontainer_read_csr.cpp @@ -112,7 +112,7 @@ TEST_F(ReadHContainerTest, ReadAndOutputHContainer) hamilt::Output_HContainer output_SR(&SR, ofs_out, sparse_threshold, 8); // std::cout << SR.size_R_loop() << std::endl; // output_SR.write(-2, -1, 0); - ofs_out << "STEP: " << 0 << std::endl; + ofs_out << "Ionic_Step " << 0 << std::endl; ofs_out << "Matrix Dimension of S(R): " << paraV.para_2d().ncloc() << std::endl; ofs_out << "Matrix number of S(R): " << SR.size_R_loop() << std::endl; output_SR.write(); diff --git a/source/source_hamilt/module_hcontainer/test/tmp_mocks.cpp b/source/source_hamilt/module_hcontainer/test/tmp_mocks.cpp index 43b94037bd8..f9a23483d4b 100644 --- a/source/source_hamilt/module_hcontainer/test/tmp_mocks.cpp +++ b/source/source_hamilt/module_hcontainer/test/tmp_mocks.cpp @@ -44,6 +44,40 @@ SepPot::~SepPot(){} Sep_Cell::Sep_Cell() noexcept {} Sep_Cell::~Sep_Cell() noexcept {} +void Atom::set_index() +{ + // Minimal mock: every orbital has (iw, l, m) = identity index. The + // angular-momentum kernel only inspects iw2l (l of each orbital block), + // which assemble_angular_momentum computes from l_nchi directly, so the + // other maps need to exist but can be zero-filled. + iw2l.assign(nw, 0); + iw2m.assign(nw, 0); + iw2n.assign(nw, 0); + iw2_ylm.assign(nw, 0); + iw2_new.assign(nw, false); +} + +void UnitCell::set_iat2itia() +{ + // Minimal mock: populate the forward (it, ia) -> iat lookup together with + // the reverse iat -> it / iat -> ia vectors. Used by itiaiw2iwt inside + // assemble_angular_momentum and by get_tau / cal_dtau. + iat2it.resize(nat); + iat2ia.resize(nat); + itia2iat.create(ntype, namax); + int iat = 0; + for (int it = 0; it < ntype; ++it) + { + for (int ia = 0; ia < atoms[it].na; ++ia) + { + itia2iat(it, ia) = iat; + iat2it[iat] = it; + iat2ia[iat] = ia; + ++iat; + } + } +} + void UnitCell::set_iat2iwt(const int& npol_in) { this->iat2iwt.resize(this->nat); diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index 2faee863c14..f48bc3414eb 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -1,54 +1,56 @@ # Note: Help data is embedded in Input_Item registrations under module_parameter. # The old input_help_data.h generation has been removed. -list(APPEND objects - module_parameter/input_conv.cpp - module_ctrl/ctrl_output_fp.cpp - module_ctrl/ctrl_output_pw.cpp - module_ctrl/ctrl_output_td.cpp - module_ctrl/ctrl_output_td_pw.cpp - module_bessel/bessel_basis.cpp - module_output/cal_test.cpp - module_dos/cal_dos.cpp - module_dos/cal_ldos.cpp - module_ml/cal_mlkedf_desc.cpp - module_dos/write_dos_pw.cpp - module_energy/write_bands.cpp - module_energy/write_eig_occ.cpp - module_energy/td_eij_io.cpp - module_energy/td_eij_pw.cpp - module_bessel/numerical_basis.cpp - module_bessel/numerical_basis_overlap.cpp - module_bessel/numerical_basis_output.cpp - module_bessel/numerical_basis_jyjy.cpp - module_bessel/numerical_descriptor.cpp - module_output/print_info.cpp - module_output/read_cube.cpp - module_wf/read_wfc_pw.cpp - module_wf/read_wf2rho_pw.cpp - module_restart/restart.cpp - module_wf/write_wfc_pw.cpp - module_output/write_pao.cpp - module_output/write_cube.cpp - module_elf/write_elf.cpp - module_dipole/write_dipole.cpp - module_ml/write_mlkedf_desc.cpp - module_current/td_current_io.cpp - module_current/td_current_io_comm.cpp - module_current/td_current_pw.cpp - module_current/td_spin_pw_io.cpp - module_efield/td_efield_io.cpp - module_efield/td_vecpot_io.cpp - module_chgpot/write_libxc_r.cpp - module_output/output_log.cpp - module_output/td_conserv_io.cpp - module_json/para_json.cpp - parse_args.cpp - input_help.cpp - parse_command_line.cpp - module_chgpot/get_pchg_pw.cpp - module_wf/get_wf_pw.cpp -) +list( + APPEND + objects + module_parameter/input_conv.cpp + module_ctrl/ctrl_output_fp.cpp + module_ctrl/ctrl_output_pw.cpp + module_ctrl/ctrl_output_td.cpp + module_ctrl/ctrl_output_td_pw.cpp + module_bessel/bessel_basis.cpp + module_output/cal_test.cpp + module_dos/cal_dos.cpp + module_dos/cal_ldos.cpp + module_ml/cal_mlkedf_desc.cpp + module_dos/write_dos_pw.cpp + module_energy/write_bands.cpp + module_energy/write_eig_occ.cpp + module_energy/td_eij_io.cpp + module_energy/td_eij_pw.cpp + module_bessel/numerical_basis.cpp + module_bessel/numerical_basis_overlap.cpp + module_bessel/numerical_basis_output.cpp + module_bessel/numerical_basis_jyjy.cpp + module_bessel/numerical_descriptor.cpp + module_output/print_info.cpp + module_output/read_cube.cpp + module_wf/read_wfc_pw.cpp + module_wf/read_wf2rho_pw.cpp + module_restart/restart.cpp + module_wf/write_wfc_pw.cpp + module_output/write_pao.cpp + module_output/write_cube.cpp + module_elf/write_elf.cpp + module_dipole/write_dipole.cpp + module_ml/write_mlkedf_desc.cpp + module_current/td_current_io.cpp + module_current/td_current_io_comm.cpp + module_current/td_current_pw.cpp + module_current/td_spin_pw_io.cpp + module_efield/td_efield_io.cpp + module_efield/td_vecpot_io.cpp + module_chgpot/write_libxc_r.cpp + module_chgpot/libxc_r_suffix.cpp + module_output/output_log.cpp + module_output/td_conserv_io.cpp + module_json/para_json.cpp + parse_args.cpp + input_help.cpp + parse_command_line.cpp + module_chgpot/get_pchg_pw.cpp + module_wf/get_wf_pw.cpp) list( APPEND @@ -101,6 +103,7 @@ if(ENABLE_LCAO) module_hs/hs_sparse_io.cpp module_hs/dhs_sparse_writer.cpp module_hs/hsk_writer.cpp + module_hs/dense_text_body.cpp module_hs/hsr_writer.cpp module_hs/hsr_legacy.cpp module_hs/hterm_writer.cpp diff --git a/source/source_io/module_chgpot/get_pchg_lcao.cpp b/source/source_io/module_chgpot/get_pchg_lcao.cpp index 9add37b9758..1e8561ea842 100644 --- a/source/source_io/module_chgpot/get_pchg_lcao.cpp +++ b/source/source_io/module_chgpot/get_pchg_lcao.cpp @@ -23,6 +23,7 @@ void Get_pchg_lcao::begin_gamma(const UnitCell& ucell, const Parallel_Grid& pgrid, const Grid_Driver& grid_driver, const std::vector& out_pchg, + const int istep, const std::string& global_out_dir, std::ofstream& ofs_running) { @@ -78,9 +79,9 @@ void Get_pchg_lcao::begin_gamma(const UnitCell& ucell, std::stringstream ssc; ssc << global_out_dir << "pchgi" << ib + 1 << "s" << is + 1 << ".cube"; - const std::string desc_pchg = ModuleIO::make_data_desc("partial charge", "partial magnetization m", is, nspin_); + const std::string desc_pchg = ModuleIO::make_data_desc("Partial charge", "Partial magnetization m", is, nspin_); - ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, 0, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); + ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, istep, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); } } } @@ -93,6 +94,7 @@ void Get_pchg_lcao::begin_k(const ModulePW::PW_Basis& rho_pw, const K_Vectors& kv, const std::vector& out_pchg, const bool if_separate_k, + const int istep, const std::string& global_out_dir, std::ofstream& ofs_running) { @@ -170,9 +172,9 @@ void Get_pchg_lcao::begin_k(const ModulePW::PW_Basis& rho_pw, std::stringstream ssc; ssc << global_out_dir << "pchgi" << ib + 1 << "s" << is + 1 << "k" << ik + 1 << ".cube"; - const std::string desc_pchg = ModuleIO::make_data_desc("partial charge", "partial magnetization m", is, nspin_); + const std::string desc_pchg = ModuleIO::make_data_desc("Partial charge", "Partial magnetization m", is, nspin_); - ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, 0, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); + ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, istep, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); } } } @@ -210,9 +212,9 @@ void Get_pchg_lcao::begin_k(const ModulePW::PW_Basis& rho_pw, std::stringstream ssc; ssc << global_out_dir << "pchgi" << ib + 1 << "s" << is + 1 << ".cube"; - const std::string desc_pchg = ModuleIO::make_data_desc("partial charge", "partial magnetization m", is, nspin_); + const std::string desc_pchg = ModuleIO::make_data_desc("Partial charge", "Partial magnetization m", is, nspin_); - ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, 0, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); + ModuleIO::write_vdata_palgrid(pgrid, rho[is].data(), is, nspin_, istep, ssc.str(), 0.0, &ucell, precision, 0, false, false, false, ofs_running, desc_pchg); } } } @@ -260,7 +262,7 @@ void Get_pchg_lcao::prepare_get_pchg(std::ofstream& ofs_running) ofs_running << " | state i. The |psi(i,r)|^2 is printed out using numerical atomic |" << std::endl; ofs_running << " | orbitals as basis set. |" << std::endl; ofs_running << " | |" << std::endl; - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; + ofs_running << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl; ofs_running << "\n\n"; diff --git a/source/source_io/module_chgpot/get_pchg_lcao.h b/source/source_io/module_chgpot/get_pchg_lcao.h index 31508ec5ab9..c812b5a6920 100644 --- a/source/source_io/module_chgpot/get_pchg_lcao.h +++ b/source/source_io/module_chgpot/get_pchg_lcao.h @@ -27,6 +27,7 @@ class Get_pchg_lcao const Parallel_Grid& pgrid, const Grid_Driver& grid_driver, const std::vector& out_pchg, + const int istep, const std::string& global_out_dir, std::ofstream& ofs_running); @@ -38,6 +39,7 @@ class Get_pchg_lcao const K_Vectors& kv, const std::vector& out_pchg, bool if_separate_k, + const int istep, const std::string& global_out_dir, std::ofstream& ofs_running); diff --git a/source/source_io/module_chgpot/get_pchg_pw.cpp b/source/source_io/module_chgpot/get_pchg_pw.cpp index 554ef4caf8e..c6f1e099f54 100644 --- a/source/source_io/module_chgpot/get_pchg_pw.cpp +++ b/source/source_io/module_chgpot/get_pchg_pw.cpp @@ -473,7 +473,7 @@ void Get_pchg_pw::write_cube(const int band, filename << "k" << k_number; } filename << ".cube"; - const std::string desc_pchg = ModuleIO::make_data_desc("partial charge", "partial magnetization m", component, nspin_); + const std::string desc_pchg = ModuleIO::make_data_desc("Partial charge", "Partial magnetization m", component, nspin_); ModuleIO::write_vdata_palgrid(pgrid, values.data(), component, nspin_, 0, filename.str(), 0.0, &ucell, 11, 0, false, separate_k, false, ofs_running, desc_pchg); } diff --git a/source/source_io/module_chgpot/libxc_r_suffix.cpp b/source/source_io/module_chgpot/libxc_r_suffix.cpp new file mode 100644 index 00000000000..5eda51819ee --- /dev/null +++ b/source/source_io/module_chgpot/libxc_r_suffix.cpp @@ -0,0 +1,114 @@ +#include "libxc_r_suffix.h" + +#include + +namespace ModuleIO +{ + +std::vector libxc_r_channel_suffixes(const std::string& data_name, const int nspin) +{ + if (nspin != 1 && nspin != 2) + { + throw std::invalid_argument("libxc_r_channel_suffixes: nspin must be 1 or 2, got " + + std::to_string(nspin)); + } + const bool polarized = (nspin == 2); + + if (data_name == "rho" || data_name == "vrho") + { + return polarized ? std::vector{"s1", "s2"} : std::vector{"s1"}; + } + if (data_name == "exc" || data_name == "amag") + { + return {""}; + } + if (data_name == "sigma" || data_name == "vsigma" || data_name == "v2rho2") + { + return polarized ? std::vector{"00", "01", "11"} : std::vector{"00"}; + } + if (data_name == "v2rhosigma") + { + return polarized ? std::vector{"0_00", "0_01", "0_11", "1_00", "1_01", "1_11"} + : std::vector{"0_00"}; + } + if (data_name == "v2sigma2") + { + return polarized ? std::vector{"00_00", "00_01", "00_11", "01_01", "01_11", "11_11"} + : std::vector{"00_00"}; + } + if (data_name == "v3rho3") + { + return polarized ? std::vector{"0_0_0", "0_0_1", "0_1_1", "1_1_1"} + : std::vector{"0_0_0"}; + } + if (data_name == "v4rho4") + { + return polarized ? std::vector{"0_0_0_0", "0_0_0_1", "0_0_1_1", "0_1_1_1", "1_1_1_1"} + : std::vector{"0_0_0_0"}; + } + if (data_name == "v3rho2sigma") + { + return polarized ? std::vector{"00_00", "00_01", "00_11", + "01_00", "01_01", "01_11", + "11_00", "11_01", "11_11"} + : std::vector{"00_00"}; + } + if (data_name == "v3rhosigma2") + { + return polarized ? std::vector{"0_00_00", "0_00_01", "0_00_11", + "0_01_01", "0_01_11", "0_11_11", + "1_00_00", "1_00_01", "1_00_11", + "1_01_01", "1_01_11", "1_11_11"} + : std::vector{"0_00_00"}; + } + if (data_name == "v3sigma3") + { + return polarized ? std::vector{"00_00_00", "00_00_01", "00_00_11", + "00_01_01", "00_01_11", "00_11_11", + "01_01_01", "01_01_11", "01_11_11", + "11_11_11"} + : std::vector{"00_00_00"}; + } + if (data_name == "v4rho3sigma") + { + return polarized ? std::vector{"000_00", "000_01", "000_11", + "001_00", "001_01", "001_11", + "011_00", "011_01", "011_11", + "111_00", "111_01", "111_11"} + : std::vector{"000_00"}; + } + if (data_name == "v4rho2sigma2") + { + return polarized ? std::vector{"00_00_00", "00_00_01", "00_00_11", + "00_01_01", "00_01_11", "00_11_11", + "01_00_00", "01_00_01", "01_00_11", + "01_01_01", "01_01_11", "01_11_11", + "11_00_00", "11_00_01", "11_00_11", + "11_01_01", "11_01_11", "11_11_11"} + : std::vector{"00_00_00"}; + } + if (data_name == "v4rhosigma3") + { + return polarized ? std::vector{"0_00_00_00", "0_00_00_01", "0_00_00_11", + "0_00_01_01", "0_00_01_11", "0_00_11_11", + "0_01_01_01", "0_01_01_11", "0_01_11_11", + "0_11_11_11", "1_00_00_00", "1_00_00_01", + "1_00_00_11", "1_00_01_01", "1_00_01_11", + "1_00_11_11", "1_01_01_01", "1_01_01_11", + "1_01_11_11", "1_11_11_11"} + : std::vector{"0_00_00_00"}; + } + if (data_name == "v4sigma4") + { + return polarized ? std::vector{"00_00_00_00", "00_00_00_01", "00_00_00_11", + "00_00_01_01", "00_00_01_11", "00_00_11_11", + "00_01_01_01", "00_01_01_11", "00_01_11_11", + "00_11_11_11", "01_01_01_01", "01_01_01_11", + "01_01_11_11", "01_11_11_11", "11_11_11_11"} + : std::vector{"00_00_00_00"}; + } + + throw std::invalid_argument("libxc_r_channel_suffixes: unknown quantity " + data_name); +} + +} // namespace ModuleIO diff --git a/source/source_io/module_chgpot/libxc_r_suffix.h b/source/source_io/module_chgpot/libxc_r_suffix.h new file mode 100644 index 00000000000..4748f3d6408 --- /dev/null +++ b/source/source_io/module_chgpot/libxc_r_suffix.h @@ -0,0 +1,31 @@ +#ifndef LIBXC_R_SUFFIX_H +#define LIBXC_R_SUFFIX_H + +#include +#include + +namespace ModuleIO +{ + +/// @brief Build the channel suffixes appended to the cube file names of one Libxc quantity. +/// +/// The suffix encodes the Libxc channel index tuple, which differs per quantity order: +/// - rho / vrho : s1, s2 (real spin indices) +/// - exc / amag : empty suffix (scalar quantity) +/// - sigma / vsigma / v2rho2 : (00), (01), (11) for nspin=2 +/// - v2rhosigma : (0_00), (0_01), (0_11), (1_00), (1_01), (1_11) +/// - v2sigma2 : (00_00), (00_01), (00_11), (01_01), (01_11), (11_11) +/// - v3rho3 : (0_0_0), (0_0_1), (0_1_1), (1_1_1) +/// - v4rho4 : (0_0_0_0), (0_0_0_1), (0_0_1_1), (0_1_1_1), (1_1_1_1) +/// - v3rho2sigma : 9 channels, v3rhosigma2 : 12, v3sigma3 : 10 +/// - v4rho3sigma : 12 channels, v4rho2sigma2 : 18, v4rhosigma3 : 20, v4sigma4 : 15 +/// +/// @param data_name Quantity label used in the file name (e.g. "v2rhosigma"). +/// @param nspin Number of spin channels of the calculation, 1 or 2. +/// @return One suffix per Libxc channel, in Libxc packing order. +/// @throws std::invalid_argument if nspin is not 1 or 2, or data_name is unknown. +std::vector libxc_r_channel_suffixes(const std::string& data_name, int nspin); + +} // namespace ModuleIO + +#endif // LIBXC_R_SUFFIX_H diff --git a/source/source_io/module_chgpot/write_libxc_r.cpp b/source/source_io/module_chgpot/write_libxc_r.cpp index 0e65a7d5887..4554b34b928 100644 --- a/source/source_io/module_chgpot/write_libxc_r.cpp +++ b/source/source_io/module_chgpot/write_libxc_r.cpp @@ -6,13 +6,18 @@ #ifdef __LIBXC #include "write_libxc_r.h" +#include "libxc_r_suffix.h" #include "source_base/parallel_comm.h" #include "source_hamilt/module_xc/xc_functional.h" #include "source_hamilt/module_xc/libxc_abacus.h" #include "source_estate/module_charge/charge.h" +#include "source_cell/unitcell.h" #include "source_basis/module_pw/pw_basis_big.h" #include "source_io/module_output/cube_io.h" +#include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #include "source_base/global_variable.h" +#include "source_base/tool_quit.h" #include "source_io/module_parameter/parameter.h" #include "source_base/timer.h" #include "source_base/tool_title.h" @@ -30,8 +35,13 @@ void ModuleIO::write_libxc_r( const double &omega, // volume of cell const double tpiba, const Charge &chr, + const UnitCell &ucell, const ModulePW::PW_Basis_Big &pw_big, - const ModulePW::PW_Basis &pw_rhod) + const ModulePW::PW_Basis &pw_rhod, + const std::string &out_dir, + const int istep, + const int out_app_flag, + std::ofstream &ofs_running) { ModuleBase::TITLE("ModuleIO","write_libxc_r"); ModuleBase::timer::start("ModuleIO","write_libxc_r"); @@ -131,9 +141,9 @@ void ModuleIO::write_libxc_r( switch( order ) { case 4: v4rho3sigma .resize( nrxx * ((1==nspin)?1:12) ); - v4rho2sigma2.resize( nrxx * ((1==nspin)?1:15) ); - v4rhosigma3 .resize( nrxx * ((1==nspin)?1:20) ); - v4sigma4 .resize( nrxx * ((1==nspin)?1:15) ); + v4rho2sigma2.resize( nrxx * ((1==nspin)?1:18) ); + v4rhosigma3 .resize( nrxx * ((1==nspin)?1:20) ); + v4sigma4 .resize( nrxx * ((1==nspin)?1:15) ); case 3: v3rho2sigma .resize( nrxx * ((1==nspin)?1:9) ); v3rhosigma2 .resize( nrxx * ((1==nspin)?1:12) ); v3sigma3 .resize( nrxx * ((1==nspin)?1:10) ); @@ -228,24 +238,53 @@ void ModuleIO::write_libxc_r( } // end switch( func.info->family ) } // end for( xc_func_type &func : funcs ) - auto write_data = [&pw_big, &pw_rhod, nspin]( + auto write_data = [&pw_big, &pw_rhod, nspin, &out_dir, &ucell, istep, out_app_flag, &ofs_running]( const std::string data_name, const std::vector &data, - const int number_spin) + const std::vector &channel_suffixes) { + const int number_spin = static_cast(channel_suffixes.size()); + const int istep_one_based = istep + 1; + const std::string time_stamp = ModuleIO::local_timestamp(); for(int is=0; is 0); + if (append_frame) + { + open_mode |= std::ios::app; + } + ofs.open(file_name, open_mode); + if (!ofs.is_open()) + { + ModuleBase::WARNING_QUIT("write_libxc_r", "Cannot open file: " + file_name); + } + + ModuleIO::write_notice(ofs_running, "XC " + data_name, file_name); + + // Each file holds a single channel, so the header declares one spin + // direction; the first comment line carries the one-based ionic step. + std::vector comment(2); + comment[0] = "Ionic_Step " + std::to_string(istep_one_based) + + " Cubefile created from ABACUS. Inner loop is z, followed by y and x" + + ModuleIO::prov_inline(time_stamp); + comment[1] = "1 # number of spin directions"; + ModuleIO::write_cube_header_for_cell(ofs, ucell, pw_rhod.nx, pw_rhod.ny, pw_rhod.nz, + comment, PARAM.inp.out_xc_r[1]); } #ifdef __MPI @@ -278,54 +317,57 @@ void ModuleIO::write_libxc_r( } }; - write_data( "rho", rho, nspin ); - - if(1!=nspin && 2!=PARAM.inp.nspin) - { - write_data( "amag", amag, 1 ); - } - - if(is_gga) - { - write_data( "sigma", sigma, (1==nspin)?1:3 ); - } - - switch( order ) - { - case 4: write_data( "v4rho4", v4rho4, (1==nspin)?1:5 ); - case 3: write_data( "v3rho3", v3rho3, (1==nspin)?1:4 ); - case 2: write_data( "v2rho2", v2rho2, (1==nspin)?1:3 ); - case 1: write_data( "vrho" , vrho , nspin ); - case 0: write_data( "exc" , exc , 1 ); - break; - default: throw std::domain_error( - "order =" + std::to_string(order) + - " unfinished in " + std::string(__FILE__) + - " line " + std::to_string(__LINE__)); - break; - } - if(is_gga) - { - switch( order ) - { - case 4: write_data( "v4rho3sigma" , v4rho3sigma , (1==nspin)?1:12 ); - write_data( "v4rho2sigma2", v4rho2sigma2, (1==nspin)?1:15 ); - write_data( "v4rhosigma3" , v4rhosigma3 , (1==nspin)?1:20 ); - write_data( "v4sigma4" , v4sigma4 , (1==nspin)?1:15 ); - case 3: write_data( "v3rho2sigma" , v3rho2sigma , (1==nspin)?1:9 ); - write_data( "v3rhosigma2" , v3rhosigma2 , (1==nspin)?1:12 ); - write_data( "v3sigma3" , v3sigma3 , (1==nspin)?1:10 ); - case 2: write_data( "v2rhosigma" , v2rhosigma , (1==nspin)?1:6 ); - write_data( "v2sigma2" , v2sigma2 , (1==nspin)?1:6 ); - case 1: write_data( "vsigma" , vsigma , (1==nspin)?1:3 ); - case 0: break; - default: throw std::domain_error( - "order =" + std::to_string(order) + - " unfinished in " + std::string(__FILE__) + - " line " + std::to_string(__LINE__)); - break; - } - } + write_data("rho", rho, libxc_r_channel_suffixes("rho", nspin)); + + if (1 != nspin && 2 != PARAM.inp.nspin) + { + write_data("amag", amag, libxc_r_channel_suffixes("amag", nspin)); + } + + if (is_gga) + { + write_data("sigma", sigma, libxc_r_channel_suffixes("sigma", nspin)); + } + + switch (order) + { + case 4: write_data("v4rho4", v4rho4, libxc_r_channel_suffixes("v4rho4", nspin)); + case 3: write_data("v3rho3", v3rho3, libxc_r_channel_suffixes("v3rho3", nspin)); + case 2: write_data("v2rho2", v2rho2, libxc_r_channel_suffixes("v2rho2", nspin)); + case 1: write_data("vrho", vrho, libxc_r_channel_suffixes("vrho", nspin)); + case 0: write_data("exc", exc, libxc_r_channel_suffixes("exc", nspin)); + break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + if (is_gga) + { + switch (order) + { + case 4: + write_data("v4rho3sigma", v4rho3sigma, libxc_r_channel_suffixes("v4rho3sigma", nspin)); + write_data("v4rho2sigma2", v4rho2sigma2, libxc_r_channel_suffixes("v4rho2sigma2", nspin)); + write_data("v4rhosigma3", v4rhosigma3, libxc_r_channel_suffixes("v4rhosigma3", nspin)); + write_data("v4sigma4", v4sigma4, libxc_r_channel_suffixes("v4sigma4", nspin)); + case 3: + write_data("v3rho2sigma", v3rho2sigma, libxc_r_channel_suffixes("v3rho2sigma", nspin)); + write_data("v3rhosigma2", v3rhosigma2, libxc_r_channel_suffixes("v3rhosigma2", nspin)); + write_data("v3sigma3", v3sigma3, libxc_r_channel_suffixes("v3sigma3", nspin)); + case 2: + write_data("v2rhosigma", v2rhosigma, libxc_r_channel_suffixes("v2rhosigma", nspin)); + write_data("v2sigma2", v2sigma2, libxc_r_channel_suffixes("v2sigma2", nspin)); + case 1: write_data("vsigma", vsigma, libxc_r_channel_suffixes("vsigma", nspin)); + case 0: break; + default: throw std::domain_error( + "order =" + std::to_string(order) + + " unfinished in " + std::string(__FILE__) + + " line " + std::to_string(__LINE__)); + break; + } + } XC_Functional_Libxc::finish_func(funcs); diff --git a/source/source_io/module_chgpot/write_libxc_r.h b/source/source_io/module_chgpot/write_libxc_r.h index c0ec9c51b44..83cb95ff45e 100644 --- a/source/source_io/module_chgpot/write_libxc_r.h +++ b/source/source_io/module_chgpot/write_libxc_r.h @@ -10,8 +10,10 @@ #include #include +#include class Charge; +class UnitCell; namespace ModulePW { @@ -28,8 +30,13 @@ namespace ModuleIO const double &omega, // volume of cell const double tpiba, const Charge &chr, + const UnitCell &ucell, // cell used for the cube header (grid geometry and atoms) const ModulePW::PW_Basis_Big &pw_big, - const ModulePW::PW_Basis &pw_rhod); + const ModulePW::PW_Basis &pw_rhod, + const std::string &out_dir, // directory that receives the xc_*.cube files + const int istep, // zero-based ionic step; printed one-based in mode 2 + const int out_app_flag, // 0 overwrite, 1 append, 2 numbered files + std::ofstream &ofs_running); #ifdef __MPI extern void write_cube_core( diff --git a/source/source_io/module_ctrl/ctrl_output_fp.cpp b/source/source_io/module_ctrl/ctrl_output_fp.cpp index 24da68b8eb6..3f050bd3e92 100644 --- a/source/source_io/module_ctrl/ctrl_output_fp.cpp +++ b/source/source_io/module_ctrl/ctrl_output_fp.cpp @@ -43,7 +43,7 @@ void ctrl_output_fp(UnitCell& ucell, const std::string global_elf_dir = PARAM.globalv.global_elf_dir; const std::string global_dip_dir = PARAM.globalv.global_dip_dir; - const int output_frequency = inp.esolver_type == "tddft" ? inp.out_freq_td : inp.out_freq_ion; + const int output_frequency = inp.out_freq_ion; // Print the global electronic step for TDDFT and the ionic step otherwise. int istep_in = -1; if (output_frequency > 0) @@ -97,7 +97,7 @@ void ctrl_output_fp(UnitCell& ucell, fn += spin_block + geom_block + ".cube"; - const std::string desc_chg = ModuleIO::make_data_desc("charge density", "magnetization density m", is, nspin); + const std::string desc_chg = ModuleIO::make_data_desc("Charge density", "Magnetization density m", is, nspin); ModuleIO::write_vdata_palgrid(para_grid, chr.rho[is], @@ -121,7 +121,7 @@ void ctrl_output_fp(UnitCell& ucell, fn += spin_block + geom_block + ".cube"; - const std::string desc_tau = ModuleIO::make_data_desc("kinetic energy density", "kinetic energy density magnetization m", is, nspin); + const std::string desc_tau = ModuleIO::make_data_desc("Kinetic energy density", "Kinetic energy density magnetization m", is, nspin); ModuleIO::write_vdata_palgrid(para_grid, chr.kin_r[is], @@ -163,7 +163,7 @@ void ctrl_output_fp(UnitCell& ucell, fn += spin_block + geom_block + ".cube"; - const std::string desc_pot = ModuleIO::make_data_desc("effective potential", "effective magnetic field b", is, nspin); + const std::string desc_pot = ModuleIO::make_data_desc("Effective potential", "Effective magnetic field b", is, nspin); ModuleIO::write_vdata_palgrid(para_grid, pelec->pot->get_eff_v(is), @@ -269,14 +269,21 @@ void ctrl_output_fp(UnitCell& ucell, // 7) write xc(r) if (inp.out_xc_r[0] >= 0 && should_output) { + // Mode-2 CHG/ subdirectory is created lazily at write time. + ModuleBase::ensure_directory(global_chg_dir); ModuleIO::write_libxc_r(inp.out_xc_r[0], XC_Functional::get_func_id(), pw_rhod->nrxx, // number of real-space grid ucell.omega, // volume of cell ucell.tpiba, chr, + ucell, *pw_big, - *pw_rhod); + *pw_rhod, + global_chg_dir, + istep, + out_app_flag, + ofs_running); } #endif diff --git a/source/source_io/module_ctrl/ctrl_output_pw.cpp b/source/source_io/module_ctrl/ctrl_output_pw.cpp index 435a6412bd4..402a4d7df72 100644 --- a/source/source_io/module_ctrl/ctrl_output_pw.cpp +++ b/source/source_io/module_ctrl/ctrl_output_pw.cpp @@ -43,7 +43,7 @@ void ModuleIO::ctrl_iter_pw(const int istep, int istep_in = -1; int iter_in = -1; bool out_wfc_flag = false; - const int output_frequency = inp.esolver_type == "tddft" ? inp.out_freq_td : inp.out_freq_ion; + const int output_frequency = inp.out_freq_ion; if (output_frequency > 0) { if (istep % output_frequency == 0) @@ -125,7 +125,7 @@ void ModuleIO::ctrl_scf_pw(const int istep, ModuleBase::TITLE("ModuleIO", "ctrl_scf_pw"); ModuleBase::timer::start("ModuleIO", "ctrl_scf_pw"); - const int output_frequency = inp.esolver_type == "tddft" ? inp.out_freq_td : inp.out_freq_ion; + const int output_frequency = inp.out_freq_ion; const bool selected_step = output_frequency == 0 || (output_frequency > 0 && istep % output_frequency == 0); const bool output_td_state = inp.esolver_type != "tddft" || selected_step; @@ -304,6 +304,7 @@ void ModuleIO::ctrl_runner_pw(UnitCell& ucell, pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running) { @@ -330,6 +331,7 @@ void ModuleIO::ctrl_runner_pw(UnitCell& ucell, inp.out_ldos, inp.stm_bias, inp.nspin, + istep, global_dos_dir, PARAM.globalv.two_fermi, inp.nbands, @@ -498,6 +500,7 @@ template void ModuleIO::ctrl_runner_pw, base_device::DEVICE_ pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running); @@ -514,6 +517,7 @@ template void ModuleIO::ctrl_runner_pw, base_device::DEVICE pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running); @@ -531,6 +535,7 @@ template void ModuleIO::ctrl_runner_pw, base_device::DEVICE_ pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running); @@ -547,6 +552,7 @@ template void ModuleIO::ctrl_runner_pw, base_device::DEVICE pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running); #endif diff --git a/source/source_io/module_ctrl/ctrl_output_pw.h b/source/source_io/module_ctrl/ctrl_output_pw.h index a3c05b0d4b3..e500b677b86 100644 --- a/source/source_io/module_ctrl/ctrl_output_pw.h +++ b/source/source_io/module_ctrl/ctrl_output_pw.h @@ -55,6 +55,7 @@ void ctrl_runner_pw(UnitCell& ucell, pseudopot_cell_vnl& ppcell, surchem& solvent, Parallel_Grid& para_grid, + const int istep, const Input_para& inp, std::ofstream& ofs_running); diff --git a/source/source_io/module_ctrl/ctrl_runner_lcao.cpp b/source/source_io/module_ctrl/ctrl_runner_lcao.cpp index c3abe5f28ce..1f4ac856b9f 100644 --- a/source/source_io/module_ctrl/ctrl_runner_lcao.cpp +++ b/source/source_io/module_ctrl/ctrl_runner_lcao.cpp @@ -7,10 +7,7 @@ #include "../module_energy/write_proj_band_lcao.h" // projcted band structure #include "../module_dos/cal_ldos.h" // cal LDOS -#include "../module_energy/write_eband_terms.h" -#include "source_io/module_hs/vxc_op_mat.h" #include "source_io/module_hs/vxc_op_r.h" -#include "source_io/module_hs/vxc_op_tools.h" #ifdef __EXX #include "source_lcao/module_ri/exx_lri_interface.h" #endif @@ -48,7 +45,7 @@ void ctrl_runner_lcao(UnitCell& ucell, // unitcell // 1) write projected band structure if (inp.out_proj_band) { - ModuleIO::write_proj_band_lcao(psi, pv, pelec, kv, ucell, p_hamilt); + ModuleIO::write_proj_band_lcao(psi, pv, pelec, kv, ucell, p_hamilt, istep, inp.out_app_flag); } // 2) out ldos @@ -59,64 +56,10 @@ void ctrl_runner_lcao(UnitCell& ucell, // unitcell ModuleBase::ensure_directory(global_dos_dir); ModuleIO::Cal_ldos::cal_ldos_lcao(pelec->eferm, chr, dmat, kv, pelec->ekb, pelec->wg, psi[0], pgrid, pv, gd, ucell, - inp.stm_bias, inp.nspin, global_dos_dir, + inp.stm_bias, inp.nspin, istep, global_dos_dir, PARAM.globalv.two_fermi, inp.out_ldos[1], ofs_running); } - // 3) print out exchange-correlation potential: the band-decomposed orbital - // energies (eband_vxc.txt etc.) are produced for either switch, while - // the full MO-basis matrices (vxc_nao.txt etc.) are only for out_mat_xc. - const bool out_vxc_orb = inp.out_mat_xc || inp.out_eband; - if (out_vxc_orb) - { - const std::string global_mat_dir = PARAM.globalv.global_mat_dir; - // Only out_mat_xc writes matrices into MAT/ (out_eband files land in - // the output root); the mode-2 subdirectory is created lazily here. - if (inp.out_mat_xc) - { - ModuleBase::ensure_directory(global_mat_dir); - } - bool cal_exx = exx_info.info_global.cal_exx; - const double etot_xc = pelec->f_en.etot; -#ifdef __EXX - auto* hexxd_ptr = exx_nao.exd ? &exx_nao.exd->get_Hexxs() : nullptr; - auto* hexxc_ptr = exx_nao.exc ? &exx_nao.exc->get_Hexxs() : nullptr; -#endif - ModuleIO::write_Vxc(inp.nspin, - istep, - etot_xc, - PARAM.globalv.nlocal, - GlobalV::DRANK, - &pv, - *psi, - ucell, - sf, - solvent, - *pw_rho, - *pw_rhod, - vloc, - chr, - kv, - orb.cutoffs(), - pelec->wg, - gd, - inp.dft_plus_u, - PARAM.globalv.gamma_only_local, - inp.out_mat_xc, - global_mat_dir, - PARAM.globalv.global_out_dir, - inp.out_ndigits, - inp.ks_solver, - cal_exx, - exx_info -#ifdef __EXX - , - hexxd_ptr, - hexxc_ptr -#endif - ); - } - if (inp.out_mat_xc2[0]) { const std::string global_mat_dir = PARAM.globalv.global_mat_dir; @@ -145,7 +88,8 @@ void ctrl_runner_lcao(UnitCell& ucell, // unitcell global_mat_dir, cal_exx, hybrid_alpha, - real_number + real_number, + istep #ifdef __EXX , hexxd_ptr, @@ -153,38 +97,11 @@ void ctrl_runner_lcao(UnitCell& ucell, // unitcell #endif , sparse_thr, + inp.out_mat_xc2[1], ofs_running ); } - - // write eband terms - if (inp.out_eband) - { - const double etot = pelec->f_en.etot; - ModuleIO::write_eband_terms(inp.nspin, - istep, - etot, - GlobalV::MY_RANK, - PARAM.globalv.nlocal, - &pv, - *psi, - ucell, - sf, - solvent, - *pw_rho, - *pw_rhod, - vloc, - chr, - kv, - pelec->wg, - gd, - orb.cutoffs(), - orb, - two_center_bundle - ); - } - ModuleBase::timer::end("ModuleIO", "ctrl_runner_lcao"); } diff --git a/source/source_io/module_ctrl/ctrl_scf_lcao.cpp b/source/source_io/module_ctrl/ctrl_scf_lcao.cpp index 5aaba39060c..c073c41a1f8 100644 --- a/source/source_io/module_ctrl/ctrl_scf_lcao.cpp +++ b/source/source_io/module_ctrl/ctrl_scf_lcao.cpp @@ -3,6 +3,7 @@ #include "source_base/formatter.h" #include "source_base/fs_compat.h" // use ModuleBase::ensure_directory +#include "source_base/global_function.h" // use ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER #include "source_base/module_out/filename.h" #include "source_base/tool_quit.h" // use ModuleBase::WARNING_QUIT #include "source_estate/elecstate_lcao.h" // use elecstate::ElecState @@ -24,11 +25,18 @@ #include "../module_wannier/to_w90_lcao.h" // use toW90_LCAO #include "../module_wannier/to_w90_lcao_pw.h" // use toW90_LCAO_IN_PW #include "../module_hs/hs_dense_io.h" // use ModuleIO::save_mat() -#include "../module_hs/hsk_writer.h" // use ModuleIO::write_hsk() +#include "../module_hs/vxc_op_mat.h" // use ModuleIO::write_Vxc() +#include "../module_energy/write_eband_terms.h" // use ModuleIO::write_eband_terms() +#include "source_io/module_hs/hsk_writer.h" // use ModuleIO::write_hsk() +#include "source_io/module_hs/dense_text_body.h" // use ModuleIO::write_dense_text_body() +#include "source_base/module_external/scalapack_connector.h" // use Cpxgemr2d<>() +#include "source_hsolver/parallel_k2d.h" // use Parallel_2d +#include "source_cell/ucell_io.h" // use ModuleIO::UcellIO::write_ucell() #include "../module_dm/write_dmk.h" // use ModuleIO::write_dmk() #include "../module_dm/write_dmr.h" // use ModuleIO::write_dmr() #include "../module_dos/write_dos_lcao.h" // use ModuleIO::write_dos_lcao() #include "../module_wf/write_wfc_nao.h" // use ModuleIO::write_wfc_nao() +#include "../module_output/write_notice.h" // use ModuleIO::write_notice() #include "source_lcao/module_deltaspin/lambda_loop_helper.h" // print_Mi / print_Mag_Force free functions #include "source_lcao/module_deltaspin/spin_constrain.h" // use spinconstrain::SpinConstrain #include "source_lcao/module_operator_lcao/ekinetic.h" // use hamilt::EKinetic @@ -87,7 +95,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, const ModulePW::PW_Basis_K* pw_wfc, // for berryphase const ModulePW::PW_Basis* pw_rho, // for berryphase const ModulePW::PW_Basis_Big* pw_big, // for Wannier90 - const Structure_Factor& sf, // for Wannier90 + Structure_Factor& sf, // for Wannier90 const ModulePW::PW_Basis* pw_rhod, // dense charge grid (for dH veff pots) const ModuleBase::matrix& vloc, // local pseudopotential (for dH veff pots) surchem& solvent, // solvent model (for dH veff pots) @@ -97,35 +105,43 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, const Exx_Info& exx_info, const bool conv_esolver, const bool scf_nmax_flag, + const bool last_ion_step, const int istep, std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "ctrl_scf_lcao"); ModuleBase::timer::start("ModuleIO", "ctrl_scf_lcao"); + // The local storage of every square NAO matrix depends on the eigensolver: + // the column-major solvers keep mat[i + j * nrloc] in each local block. The + // text body of DM(k), H(k)/S(k) and T(k) is documented as row-major, so the + // writers need this flag to emit (i, j) instead of the transpose. + const std::string& ks_solver = PARAM.inp.ks_solver; + const bool column_major_source = ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(ks_solver); + //***** // if istep_in = -1, istep will not appear in file name // if iter_in = -1, iter will not appear in file name int istep_in = -1; int iter_in = -1; bool out_flag = false; - if (PARAM.inp.esolver_type != "tddft" && inp.out_freq_ion > 0) // default value of out_freq_ion is 0 - { - if (istep % inp.out_freq_ion == 0) - { - istep_in = istep; - out_flag = true; - } - } - else if (PARAM.inp.esolver_type == "tddft" && inp.out_freq_td > 0) // default value of out_freq_td is 0 + if (inp.out_freq_ion > 0) // default value of out_freq_ion is 0 { - if (istep % inp.out_freq_td == 0) + // The final ionic step is always written: even when it is off the + // output cadence, the final geometry still has to be persisted. The + // final step is independent of SCF convergence (an unconverged final + // step is still useful), and it is not duplicated when it happens to + // fall on the cadence because this function writes at most once. + if (istep % inp.out_freq_ion == 0 || last_ion_step) { istep_in = istep; out_flag = true; } } - else if (conv_esolver || scf_nmax_flag) // mohan add scf_nmax_flag on 20250921 + // With out_freq_ion == 0 every converged SCF is written; the final step is + // added as a fallback for a final SCF that neither converged nor reached + // scf_nmax. In RT-TDDFT istep is the cumulative electronic evolution step. + else if (conv_esolver || scf_nmax_flag || last_ion_step) // mohan add scf_nmax_flag on 20250921 { out_flag = true; } @@ -147,6 +163,8 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, const int npol = PARAM.globalv.npol; const int nlocal = PARAM.globalv.nlocal; const bool cal_force = inp.cal_force; + const int my_rank = GlobalV::MY_RANK; + const int drank = GlobalV::DRANK; //------------------------------------------------------------------ //! 1) print out density of states (DOS) @@ -210,7 +228,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, const int precision = inp.out_dmk[1]; ModuleIO::write_dmk(dm->get_dmk_vec(), kv, precision, efermis, &(ucell), pv.para_2d(), - global_mat_dir, istep, out_app_flag, ofs_running); + column_major_source, global_mat_dir, istep, out_app_flag, ofs_running); } //------------------------------------------------------------------ @@ -222,6 +240,11 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, // Mode-2 MAT/ subdirectory is created lazily at write time. ModuleBase::ensure_directory(global_mat_dir); const int precision = inp.out_hsk[1]; + std::vector efermis(nspin == 2 ? 2 : 1); + for (int ispin = 0; ispin < efermis.size(); ispin++) + { + efermis[ispin] = pelec->eferm.get_efval(ispin); + } ModuleIO::write_hsk(global_mat_dir, nspin, kv.get_nks(), @@ -230,6 +253,9 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, kv.isk, p_hamilt, pv, + kv, + &(ucell), + efermis, gamma_only, out_app_flag, istep, @@ -256,6 +282,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, kv.get_nkstot(), pv, nspin, + ofs_running, istep); } @@ -491,7 +518,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, // they land in MAT/ together with the other matrix outputs in mode 2 h_params.global_out_dir = global_mat_dir; h_params.global_matrix_dir = global_matrix_dir; - h_params.ks_solver = PARAM.inp.ks_solver; + h_params.ks_solver = ks_solver; h_params.drank = GlobalV::DRANK; h_params.ofs_running = &ofs_running; // out_mat_h_t is a legacy alias for out_mat_tk (resolved at input @@ -557,45 +584,184 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, two_center_bundle.kinetic_orb.get()); const int nspin_k = (nspin == 2 ? 2 : 1); + // T(k) is spin-independent, so its filename carries no spin suffix + // (same convention as S(k)); only the k index appears in the name. + const int nspin_kinetic_name = 1; + + const int precision = inp.out_mat_tk[1]; + const bool binary = false; // tk text output, consistent with hk/sk + const bool append_mat = (out_app_flag == 1) && (istep > 0); + + // Re-use the block-cyclic descriptor that save_mat uses so we + // can Cpxgemr2d the distributed kinetic matrix to rank 0. + const Parallel_Blkcyclic& pv_dist = pv.para_2d(); + Parallel_Blkcyclic pv_glb; +#ifdef __MPI + pv_glb.set(nlocal, nlocal, nlocal, pv_dist.ictxt()); +#endif + for (int ik = 0; ik < kv.get_nks() / nspin_k; ++ik) { ekinetic->init(ik); - const int out_label = 1; // 1: .txt, 2: .dat - + // Build filename: T(k) is spin-independent so the spin index is + // always 1. The property is always "t"; filename_output inserts + // the k-point index for multi-k runs and omits it for gamma_only. + const std::string t_property = "t"; + const int t_out_type = binary ? 2 : 1; std::string t_fn = ModuleIO::filename_output(global_mat_dir, - "tk", + t_property, "nao", ik, kv.ik2iktot, - inp.nspin, + nspin_kinetic_name, kv.get_nkstot(), - out_label, + t_out_type, out_app_flag, gamma_only, istep); - ModuleIO::save_mat(istep, - hsk.get_hk(), - PARAM.globalv.nlocal, - false, // bit - inp.out_mat_tk[1], - 1, // true for upper triangle matrix - (inp.out_app_flag == 1), - t_fn, - pv.para_2d(), - GlobalV::DRANK, - PARAM.inp.ks_solver); - - if (GlobalV::DRANK == 0) + // Gather the distributed T(k) matrix to rank 0 so we can write + // the full-matrix body without MPI-aware row-by-row logic. + std::vector t_global(my_rank == 0 ? nlocal * nlocal : 0); +#ifdef __MPI + Cpxgemr2d( + nlocal, nlocal, + hsk.get_hk(), 1, 1, + const_cast(pv_dist.desc()), + t_global.data(), 1, 1, + const_cast(pv_glb.desc()), + pv_glb.ictxt()); +#else + t_global.assign(hsk.get_hk(), hsk.get_hk() + nlocal * nlocal); +#endif + + if (my_rank == 0) { - ofs_running << " Write T(k) matrix in NAO basis to file: " << t_fn << std::endl; + std::ios_base::openmode mode = std::ios::out; + if (append_mat) + { + mode |= std::ios::app; + } + std::ofstream ofs(t_fn.c_str(), mode); + if (!ofs.is_open()) + { + ofs_running << " WARNING: cannot open " << t_fn << std::endl; + continue; + } + + // --- metadata block, aligned with write_dmk / write_hsk --- + ofs << "Ionic_Step " << istep + 1 << std::endl; + ofs << " " << nspin << " # number of spin directions" << std::endl; + ofs << " 1 # spin index (T(k) is spin-independent)" << std::endl; + ofs << " " << kv.get_nkstot_nospin() << " # total k points" << std::endl; + ofs << " " << kv.get_nkstot() << " # total k points after symmetrized (if open)" << std::endl; + ofs << " " << ik + 1 << " # k-point index" << std::endl; + ofs << " " << kv.kvec_c[ik].x << " " << kv.kvec_c[ik].y << " " << kv.kvec_c[ik].z << " # k point coordinate (Cartesian)" << std::endl; + ofs << " " << kv.kvec_d[ik].x << " " << kv.kvec_d[ik].y << " " << kv.kvec_d[ik].z << " # k point coordinate (direct)" << std::endl; + ofs << " " << kv.wk[ik] << " # weight of this k point" << std::endl; + ofs << " 0.0 # Fermi energy in Ry (not applicable to T(k))" << std::endl; + ofs << " " << nlocal << " # number of localized basis" << std::endl; + ofs << " " << nlocal << " " << nlocal << " # size of this matrix" << std::endl; + ofs << std::endl; + + // --- UnitCell lattice block --- + ModuleIO::UcellIO::write_ucell(ofs, &ucell); + ofs << std::endl; + + // --- full matrix body, aligned with write_dmk / write_hsk --- + ModuleIO::write_dense_text_body(ofs, t_global, nlocal, precision, + column_major_source); + + ModuleIO::write_matrix_notice(ofs_running, "T(k)", t_fn); } } delete ekinetic; } + //------------------------------------------------------------------ + //! 8b) Output exchange-correlation potential and band-decomposed energies + //------------------------------------------------------------------ + // Both run on the out_freq_ion rhythm: the MO-basis matrices only when + // out_mat_xc is on, the eband_vxc* files for either switch. + if (inp.out_mat_xc || inp.out_eband) + { + const Charge& chg = *pelec->charge; + if (inp.out_mat_xc) + { + // Mode-2 MAT/ subdirectory is created lazily at write time. + ModuleBase::ensure_directory(global_mat_dir); + } + const bool cal_exx = exx_info.info_global.cal_exx; + const double etot_xc = pelec->f_en.etot; +#ifdef __EXX + auto* hexxd_ptr = exx_nao.exd ? &exx_nao.exd->get_Hexxs() : nullptr; + auto* hexxc_ptr = exx_nao.exc ? &exx_nao.exc->get_Hexxs() : nullptr; +#endif + ModuleIO::write_Vxc(nspin, + istep, + etot_xc, + nlocal, + drank, + &pv, + *psi, + ucell, + sf, + solvent, + *pw_rho, + *pw_rhod, + vloc, + chg, + kv, + orb.cutoffs(), + pelec->wg, + gd, + inp.dft_plus_u, + gamma_only, + inp.out_mat_xc, + out_app_flag, + global_mat_dir, + global_out_dir, + inp.out_ndigits, + inp.ks_solver, + cal_exx, + exx_info, + ofs_running +#ifdef __EXX + , + hexxd_ptr, + hexxc_ptr +#endif + ); + if (inp.out_eband) + { + const double etot = pelec->f_en.etot; + ModuleIO::write_eband_terms(nspin, + istep, + out_app_flag, + etot, + my_rank, + nlocal, + &pv, + *psi, + ucell, + sf, + solvent, + *pw_rho, + *pw_rhod, + vloc, + chg, + kv, + pelec->wg, + gd, + orb.cutoffs(), + orb, + two_center_bundle, + ofs_running); + } + } + //------------------------------------------------------------------ //! 9) Output expectation of angular momentum operator //------------------------------------------------------------------ @@ -613,8 +779,8 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, PARAM.inp.out_level, PARAM.globalv.gamma_only_local, &ofs_running, - GlobalV::MY_RANK); - mylcalculator.calculate(inp.suffix, global_mat_dir, ucell, inp.out_mat_l[1], GlobalV::MY_RANK, istep_in, out_app_flag); + my_rank); + mylcalculator.calculate(inp.suffix, global_mat_dir, ucell, pv, inp.out_mat_l[1], my_rank, istep_in, out_app_flag); } //------------------------------------------------------------------ @@ -631,6 +797,7 @@ void ModuleIO::ctrl_scf_lcao(UnitCell& ucell, ucell, gd, istep, + out_app_flag, true); } @@ -854,7 +1021,7 @@ template void ModuleIO::ctrl_scf_lcao( const ModulePW::PW_Basis_K* pw_wfc, // for berryphase const ModulePW::PW_Basis* pw_rho, // for berryphase const ModulePW::PW_Basis_Big* pw_big, // for Wannier90 - const Structure_Factor& sf, // for Wannier90 + Structure_Factor& sf, // for Wannier90 const ModulePW::PW_Basis* pw_rhod, // dense charge grid (for dH veff pots) const ModuleBase::matrix& vloc, // local pseudopotential (for dH veff pots) surchem& solvent, // solvent model (for dH veff pots) @@ -864,6 +1031,7 @@ template void ModuleIO::ctrl_scf_lcao( const Exx_Info& exx_info, const bool conv_esolver, const bool scf_nmax_flag, + const bool last_ion_step, const int istep, std::ofstream& ofs_running); @@ -884,7 +1052,7 @@ template void ModuleIO::ctrl_scf_lcao, double>( const ModulePW::PW_Basis_K* pw_wfc, // for berryphase const ModulePW::PW_Basis* pw_rho, // for berryphase const ModulePW::PW_Basis_Big* pw_big, // for Wannier90 - const Structure_Factor& sf, // for Wannier90 + Structure_Factor& sf, // for Wannier90 const ModulePW::PW_Basis* pw_rhod, // dense charge grid (for dH veff pots) const ModuleBase::matrix& vloc, // local pseudopotential (for dH veff pots) surchem& solvent, // solvent model (for dH veff pots) @@ -894,6 +1062,7 @@ template void ModuleIO::ctrl_scf_lcao, double>( const Exx_Info& exx_info, const bool conv_esolver, const bool scf_nmax_flag, + const bool last_ion_step, const int istep, std::ofstream& ofs_running); @@ -913,7 +1082,7 @@ template void ModuleIO::ctrl_scf_lcao, std::complex const ModulePW::PW_Basis_K* pw_wfc, // for berryphase const ModulePW::PW_Basis* pw_rho, // for berryphase const ModulePW::PW_Basis_Big* pw_big, // for Wannier90 - const Structure_Factor& sf, // for Wannier90 + Structure_Factor& sf, // for Wannier90 const ModulePW::PW_Basis* pw_rhod, // dense charge grid (for dH veff pots) const ModuleBase::matrix& vloc, // local pseudopotential (for dH veff pots) surchem& solvent, // solvent model (for dH veff pots) @@ -923,5 +1092,6 @@ template void ModuleIO::ctrl_scf_lcao, std::complex const Exx_Info& exx_info, const bool conv_esolver, const bool scf_nmax_flag, + const bool last_ion_step, const int istep, std::ofstream& ofs_running); diff --git a/source/source_io/module_ctrl/ctrl_scf_lcao.h b/source/source_io/module_ctrl/ctrl_scf_lcao.h index 29bc527ba5a..265706cce9a 100644 --- a/source/source_io/module_ctrl/ctrl_scf_lcao.h +++ b/source/source_io/module_ctrl/ctrl_scf_lcao.h @@ -38,7 +38,7 @@ void ctrl_scf_lcao(UnitCell& ucell, const ModulePW::PW_Basis_K* pw_wfc, // for berryphase const ModulePW::PW_Basis* pw_rho, // for berryphase const ModulePW::PW_Basis_Big* pw_big, // for Wannier90 - const Structure_Factor& sf, // for Wannier90 + Structure_Factor& sf, // for Wannier90 const ModulePW::PW_Basis* pw_rhod, // dense charge grid (for dH veff pots) const ModuleBase::matrix& vloc, // local pseudopotential (for dH veff pots) surchem& solvent, // solvent model (for dH veff pots) @@ -48,6 +48,7 @@ void ctrl_scf_lcao(UnitCell& ucell, const Exx_Info& exx_info, const bool conv_esolver, const bool scf_nmax_flag, + const bool last_ion_step, const int istep, std::ofstream& ofs_running); } // namespace ModuleIO diff --git a/source/source_io/module_dhs/write_dh.cpp b/source/source_io/module_dhs/write_dh.cpp index 18fd2919b81..feb008be448 100644 --- a/source/source_io/module_dhs/write_dh.cpp +++ b/source/source_io/module_dhs/write_dh.cpp @@ -6,6 +6,7 @@ #include "source_io/module_hs/hs_dense_io.h" #include "source_io/module_hs/hsr_writer.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_cell/ucell_io.h" #include "source_io/module_parameter/parameter.h" #include "source_hamilt/module_hcontainer/hcontainer_funcs.h" @@ -79,7 +80,7 @@ void write_dh_perI(WriteDHParams& params, for (int d = 0; d < 3; ++d) { hamilt::HContainer* hR = g[d][iat]; - const std::string tag = std::string(1, dirc[d]) + "_iat" + std::to_string(iat + 1); + const std::string tag = std::string(1, dirc[d]) + "_ia" + std::to_string(iat + 1); // ---- real space dH(R), CSR (only when also_dhR; dH(k) below is always written) ---- if (params.also_dhR) @@ -102,9 +103,8 @@ void write_dh_perI(WriteDHParams& params, #endif if (params.ofs_running != nullptr) { - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - *params.ofs_running << " Write dH/dR (" << term_name << " term)" << spin_tag - << " matrix in NAO basis to file: " << fr << std::endl; + const std::string property = "dH/dR (" + term_name + " term)"; + ModuleIO::write_matrix_notice(*params.ofs_running, property, ispin, nspin, fr); } } } @@ -128,20 +128,17 @@ void write_dh_perI(WriteDHParams& params, #else hamilt::folding_HR(*hR, hk.data(), params.kv->kvec_d[ik], nlocal, 0); #endif - std::string fk = mat_dir + kprefix + tag; - if (nks > 1) - { - fk += "_ik" + std::to_string(params.kv->ik2iktot[ik]); - } - fk += "_nao.txt"; - const bool append_fk = (out_app_flag == 1) && (params.istep > 0); + std::string fk = kprefix + std::to_string(params.kv->ik2iktot[ik] + 1) + tag; + // Spin-polarized runs write one file per spin channel, and mode 2 + // numbers the file per ionic step, matching the other MAT outputs. + fk = mat_dir + ModuleIO::dhk_gen_fname(fk, ispin, nspin, numbered, params.istep); ModuleIO::save_mat(params.istep, hk.data(), nlocal, false, 8, false, - append_fk, + append, fk, pv.para_2d(), GlobalV::DRANK, diff --git a/source/source_io/module_dipole/write_dipole.cpp b/source/source_io/module_dipole/write_dipole.cpp index f1bc24b05b5..d6778bc15df 100644 --- a/source/source_io/module_dipole/write_dipole.cpp +++ b/source/source_io/module_dipole/write_dipole.cpp @@ -1,5 +1,6 @@ #include "source_base/parallel_reduce.h" #include "source_io/module_dipole/dipole_io.h" +#include "source_io/module_output/write_notice.h" #include @@ -67,7 +68,7 @@ void write_dipole(const UnitCell& ucell, } } - ofs_running << " Write dipole data to file: " << fn << std::endl; + ModuleIO::write_notice(ofs_running, "Dipole data", fn); // Empty local FFT partitions contribute zero but must still join the subsequent reduction. // Do NOT reject nplane == 0 alone: some MPI ranks legitimately hold zero diff --git a/source/source_io/module_dm/test/test_write_dmr.cpp b/source/source_io/module_dm/test/test_write_dmr.cpp index 62317d99bd7..2e5bcf22ca8 100644 --- a/source/source_io/module_dm/test/test_write_dmr.cpp +++ b/source/source_io/module_dm/test/test_write_dmr.cpp @@ -68,7 +68,7 @@ void fill_matrix(hamilt::HContainer& matrix, Parallel_Orbitals& pv, doub int count_frames(const std::string& content) { - const std::string tag = " --- Ionic Step "; + const std::string tag = "Ionic_Step "; int count = 0; std::string::size_type pos = 0; while ((pos = content.find(tag, pos)) != std::string::npos) @@ -104,7 +104,7 @@ TEST(WriteDmr, CsrHeaderKeepsCurrentFormat) ModuleIO::write_dmr_csr(filename, &ucell, 4, &matrix, 0, 1, 2, false); const std::string output = read_file(filename); - EXPECT_THAT(output, testing::HasSubstr(" --- Ionic Step 1 ---\n")); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 1 # ABACUS version:")); EXPECT_THAT(output, testing::HasSubstr(" # print density matrix in real space DM(R)\n")); EXPECT_THAT(output, testing::HasSubstr(" 2 # number of spin directions\n")); EXPECT_THAT(output, testing::HasSubstr(" 2 # spin index\n")); @@ -140,13 +140,13 @@ TEST(WriteDmr, ModeOneFixedNameTruncatesOnRerun) ModuleIO::write_dmr_csr(filename, &ucell, 4, &matrix, 1, 0, 1, true); const std::string after_first_run = read_file(filename); EXPECT_EQ(count_frames(after_first_run), 2); - EXPECT_THAT(after_first_run, testing::HasSubstr(" --- Ionic Step 2 ---\n")); + EXPECT_THAT(after_first_run, testing::HasSubstr("Ionic_Step 2 # ABACUS version:")); // First step of a rerun must truncate the accumulated frames. ModuleIO::write_dmr_csr(filename, &ucell, 4, &matrix, 0, 0, 1, true); const std::string after_rerun = read_file(filename); EXPECT_EQ(count_frames(after_rerun), 1); - EXPECT_THAT(after_rerun, testing::HasSubstr(" --- Ionic Step 1 ---\n")); + EXPECT_THAT(after_rerun, testing::HasSubstr("Ionic_Step 1 # ABACUS version:")); std::remove(filename.c_str()); } diff --git a/source/source_io/module_dm/test/write_dmk_test.cpp b/source/source_io/module_dm/test/write_dmk_test.cpp deleted file mode 100644 index 4d86118b8fe..00000000000 --- a/source/source_io/module_dm/test/write_dmk_test.cpp +++ /dev/null @@ -1,484 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "source_io/module_dm/write_dmk.h" -#include "source_base/global_variable.h" -#include "../../unittests/prepare_unitcell.h" - -#include "gmock/gmock.h" -#include "gtest/gtest.h" -#include "source_base/module_external/scalapack_connector.h" - -#ifdef __MPI -#include "mpi.h" -#endif - -Magnetism::Magnetism() { - this->tot_mag = 0.0; - this->abs_mag = 0.0; -} -Magnetism::~Magnetism() { } - -/************************************************ - * unit test of read_dmk and write_dmk - ***********************************************/ - -/** - * - Tested Functions: - * - read_dmk() - * - the function to read density matrix K from file - * - the serial version without MPI - * - write_dmk() - * - the function to write density matrix K to file - * - the serial version without MPI - */ - -void init_pv(int nlocal, Parallel_Blkcyclic& pv) -{ -#ifdef __MPI - pv.init(nlocal, nlocal, 1, MPI_COMM_WORLD, false); -#else - pv.set_serial(nlocal, nlocal); -#endif -} - -template -void gen_dmk(std::vector>& dmk, std::vector& efs, int nspin, int nk, int nlocal, Parallel_Blkcyclic& pv) -{ - int myrank = 0; -#ifdef __MPI - MPI_Comm_rank(MPI_COMM_WORLD, &myrank); -#endif - std::vector> dmk_global(nspin * nk, std::vector(nlocal * nlocal, T(0.0))); - if (myrank == 0) - { - for (int i = 0; i < nspin * nk; i++) - { - for (int j = 0; j < nlocal * nlocal; j++) - { - std::complex value = std::complex(1.0 * i + 0.1 * j, 0.1 * i + 1.0 * j); - dmk_global[i][j] = reinterpret_cast(&value)[0]; - } - } - } -#ifdef __MPI - Parallel_Blkcyclic pv_global; - pv_global.init(nlocal, nlocal, nlocal, MPI_COMM_WORLD, false); - dmk.resize(nspin * nk, std::vector(pv.size(), 0.0)); - for (int i = 0; i < nspin * nk; i++) - { - Cpxgemr2d(nlocal, - nlocal, - dmk_global[i].data(), - 1, - 1, - const_cast(pv_global.desc()), - dmk[i].data(), - 1, - 1, - const_cast(pv.desc()), - pv.ictxt()); - } -#else - dmk = dmk_global; -#endif - - efs.resize(nspin, 0.0); - for (int i = 0; i < nspin; i++) - { - efs[i] = 0.1 * i; - } -} - - -TEST(DMKTest, GenFileName) { - bool gamma_only = true; - int ispin = 0; - int nspin = 2; - int ik = 0; - int istep = 0; - std::string fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); - EXPECT_EQ(fname, "dms1g1_nao.txt"); - - ispin = 1; - - fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); - EXPECT_EQ(fname, "dms2g1_nao.txt"); - - ispin = 0; - gamma_only = false; - - fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); - EXPECT_EQ(fname, "dmk1s1g1_nao.txt"); - - ispin = 1; - ik = 1; - - fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); - EXPECT_EQ(fname, "dmk2s2g1_nao.txt"); -}; - - -TEST(DMKTest,WriteDMK) { - UnitCell* ucell; - UcellTestPrepare utp = UcellTestLib["Si"]; - ucell = utp.SetUcellInfo(); - - int nspin = 2; - int nk = 1; - int nk_multik = 2; - int nlocal = 20; - std::vector> dmk; - std::vector>> dmk_multik; - Parallel_Blkcyclic pv; - std::vector efs; - init_pv(nlocal, pv); - - gen_dmk(dmk, efs, nspin, nk, nlocal, pv); - gen_dmk(dmk_multik, efs, nspin, nk_multik, nlocal, pv); - const std::string out_dir = "./"; - - const int istep = -1; - K_Vectors kv; - kv.set_nkstot(1); - kv.set_nkstot_nospin(1); - kv.set_nks(1); - kv.set_spin_mult(2); - kv.kvec_c.resize(1); - kv.kvec_c[0].x = 0.0; - kv.kvec_c[0].y = 0.0; - kv.kvec_c[0].z = 0.0; - kv.kvec_d.resize(1); - kv.kvec_d[0].x = 0.0; - kv.kvec_d[0].y = 0.0; - kv.kvec_d[0].z = 0.0; - kv.wk.resize(1); - kv.wk[0] = 1.0; - kv.isk.resize(1); - kv.isk[0] = 0; - kv.kc_done = true; - kv.kd_done = true; - - std::ofstream ofs_log; - ModuleIO::write_dmk(dmk, kv, 3, efs, ucell, pv, out_dir, istep, 0, ofs_log); - ModuleIO::write_dmk(dmk_multik, kv, 3, efs, ucell, pv, out_dir, istep, 0, ofs_log); - - std::ifstream ifs; - - int pass = 0; - if (GlobalV::MY_RANK == 0) - { - std::string fn = "dms1_nao.txt"; - ifs.open(fn); - std::string str((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - ifs.close(); - - fn = "dms2_nao.txt"; - ifs.open(fn); - str = std::string((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - ifs.close(); - - fn = "dmk1s1_nao.txt"; - ifs.open(fn); - str = std::string((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - // the matrix body must end with a newline so appended records are not glued - EXPECT_EQ(str.back(), '\n'); - ifs.close(); - - fn = "dmk2s1_nao.txt"; - ifs.open(fn); - str = std::string((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - ifs.close(); - - fn = "dmk1s2_nao.txt"; - ifs.open(fn); - str = std::string((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - ifs.close(); - - fn = "dmk2s2_nao.txt"; - ifs.open(fn); - str = std::string((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); - EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); - ifs.close(); - remove("dms1_nao.txt"); - remove("dms2_nao.txt"); - remove("dmk1s1_nao.txt"); - remove("dmk2s1_nao.txt"); - remove("dmk1s2_nao.txt"); - remove("dmk2s2_nao.txt"); - } - - delete ucell; - // remove the generated files - -}; - -// --------------------------------------------------------------------------- -// out_app_flag = 0: one fixed filename, truncated and overwritten each call. -// --------------------------------------------------------------------------- -TEST(DMKTest, Mode0FixedNameOverwrite) { - UnitCell* ucell; - UcellTestPrepare utp = UcellTestLib["Si"]; - ucell = utp.SetUcellInfo(); - - int nspin = 2; - int nk = 1; - int nlocal = 20; - std::vector> dmk; - std::vector efs; - Parallel_Blkcyclic pv; - init_pv(nlocal, pv); - gen_dmk(dmk, efs, nspin, nk, nlocal, pv); - - K_Vectors kv; - kv.set_nkstot(1); - kv.set_nkstot_nospin(1); - kv.set_nks(1); - kv.set_spin_mult(2); - kv.kvec_c.resize(1); - kv.kvec_c[0].x = 0.0; - kv.kvec_c[0].y = 0.0; - kv.kvec_c[0].z = 0.0; - kv.kvec_d.resize(1); - kv.kvec_d[0].x = 0.0; - kv.kvec_d[0].y = 0.0; - kv.kvec_d[0].z = 0.0; - kv.wk.resize(1); - kv.wk[0] = 1.0; - kv.isk.resize(1); - kv.isk[0] = 0; - - const std::string out_dir = "./"; - const int out_app_flag = 0; - std::ofstream ofs_log; - - // Two different isteps -> the same fixed filename, overwritten each call. - ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, out_dir, /*istep=*/0, out_app_flag, ofs_log); - ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, out_dir, /*istep=*/1, out_app_flag, ofs_log); - - if (GlobalV::MY_RANK == 0) - { - std::ifstream ifs("dms1_nao.txt"); - std::string str((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - ifs.close(); - // The second write replaced the first record: only step 2 remains. - EXPECT_THAT(str, testing::HasSubstr(" --- Ionic Step 2 ---")); - EXPECT_THAT(str, testing::Not(testing::HasSubstr(" --- Ionic Step 1 ---"))); - // g-suffixed files must NOT exist. - ifs.open("dms1g1_nao.txt"); - EXPECT_FALSE(ifs.good()); - ifs.open("dms1g2_nao.txt"); - EXPECT_FALSE(ifs.good()); - remove("dms1_nao.txt"); - remove("dms2_nao.txt"); - } - delete ucell; -} - -// --------------------------------------------------------------------------- -// out_app_flag = 1: fixed filename, multiple calls append successive records. -// --------------------------------------------------------------------------- -TEST(DMKTest, Mode1FixedNameAppend) { - UnitCell* ucell; - UcellTestPrepare utp = UcellTestLib["Si"]; - ucell = utp.SetUcellInfo(); - - int nspin = 2; - int nk = 1; - int nlocal = 20; - std::vector> dmk; - std::vector efs; - Parallel_Blkcyclic pv; - init_pv(nlocal, pv); - gen_dmk(dmk, efs, nspin, nk, nlocal, pv); - - K_Vectors kv; - kv.set_nkstot(1); - kv.set_nkstot_nospin(1); - kv.set_nks(1); - kv.set_spin_mult(2); - kv.kvec_c.resize(1); - kv.kvec_c[0].x = 0.0; - kv.kvec_c[0].y = 0.0; - kv.kvec_c[0].z = 0.0; - kv.kvec_d.resize(1); - kv.kvec_d[0].x = 0.0; - kv.kvec_d[0].y = 0.0; - kv.kvec_d[0].z = 0.0; - kv.wk.resize(1); - kv.wk[0] = 1.0; - kv.isk.resize(1); - kv.isk[0] = 0; - - const std::string out_dir = "./"; - const int out_app_flag = 1; - std::ofstream ofs_log; - - // Two ionic steps -> both write to dms1_nao.txt. - ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, out_dir, /*istep=*/0, out_app_flag, ofs_log); - ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, out_dir, /*istep=*/1, out_app_flag, ofs_log); - - if (GlobalV::MY_RANK == 0) - { - std::ifstream ifs("dms1_nao.txt"); - std::string str((std::istreambuf_iterator(ifs)), - std::istreambuf_iterator()); - ifs.close(); - // Two "Ionic Step" headers present -> two appended records. - EXPECT_THAT(str, testing::HasSubstr(" --- Ionic Step 1 ---")); - EXPECT_THAT(str, testing::HasSubstr(" --- Ionic Step 2 ---")); - // g-suffixed file must NOT exist. - ifs.open("dms1g1_nao.txt"); - EXPECT_FALSE(ifs.good()); - remove("dms1_nao.txt"); - } - delete ucell; -} - -// --------------------------------------------------------------------------- -// out_app_flag = 2: per-step g{step} filename; directory routing is handled by -// set_global_dir and is covered by io_sys_var_test. -// --------------------------------------------------------------------------- -TEST(DMKTest, Mode2PerStepFile) { - UnitCell* ucell; - UcellTestPrepare utp = UcellTestLib["Si"]; - ucell = utp.SetUcellInfo(); - - int nspin = 2; - int nk = 1; - int nlocal = 20; - std::vector> dmk; - std::vector efs; - Parallel_Blkcyclic pv; - init_pv(nlocal, pv); - gen_dmk(dmk, efs, nspin, nk, nlocal, pv); - - K_Vectors kv; - kv.set_nkstot(1); - kv.set_nkstot_nospin(1); - kv.set_nks(1); - kv.set_spin_mult(2); - kv.kvec_c.resize(1); - kv.kvec_c[0].x = 0.0; - kv.kvec_c[0].y = 0.0; - kv.kvec_c[0].z = 0.0; - kv.kvec_d.resize(1); - kv.kvec_d[0].x = 0.0; - kv.kvec_d[0].y = 0.0; - kv.kvec_d[0].z = 0.0; - kv.wk.resize(1); - kv.wk[0] = 1.0; - kv.isk.resize(1); - kv.isk[0] = 0; - - const std::string out_dir = "./"; - const int out_app_flag = 2; - std::ofstream ofs_log; - - ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, out_dir, /*istep=*/2, out_app_flag, ofs_log); - - if (GlobalV::MY_RANK == 0) - { - std::ifstream ifs("dms1g3_nao.txt"); - EXPECT_TRUE(ifs.good()); - ifs.close(); - remove("dms1g3_nao.txt"); - } - delete ucell; -} - -/* -// no function in the main code calls read_dmk??? mohan note 2025-05-25 -TEST(DMKTest, ReadDMK) { - int nlocal = 26; - std::vector> dmk; - std::vector>> dmk_multik; - Parallel_Blkcyclic pv; - std::vector efs; - - init_pv(nlocal, pv); - - std::ofstream ofs_running("running_log.txt"); - - GlobalV::ofs_warning.open("warning.log"); - - K_Vectors kv; - kv.set_nkstot(1); - kv.set_nks(1); - kv.kvec_c.resize(1); - kv.kvec_c[0].x = 0.0; - kv.kvec_c[0].y = 0.0; - kv.kvec_c[0].z = 0.0; - EXPECT_TRUE(ModuleIO::read_dmk(1, 1, kv, pv, "./support/", dmk, ofs_running)); - ModuleIO::read_dmk(1, 1, kv, pv, "./support/", dmk_multik, ofs_running); - EXPECT_TRUE(ModuleIO::read_dmk(1, 1, kv, pv, "./support/", dmk_multik, ofs_running)); - EXPECT_EQ(dmk.size(), 1); - EXPECT_EQ(dmk_multik.size(), 1); - EXPECT_EQ(dmk[0].size(), pv.size()); - EXPECT_EQ(dmk_multik[0].size(), pv.size()); - if (GlobalV::MY_RANK == 0) - { - EXPECT_NEAR(dmk[0][0], 3.904e-01, 1e-6); - EXPECT_NEAR(dmk_multik[0][1].real(), -4.479e-03, 1e-6); - EXPECT_NEAR(dmk_multik[0][1].imag(), 3.208e-04, 1e-6); - } - - ofs_running.close(); - GlobalV::ofs_warning.close(); - remove("running_log.txt"); - remove("warning.log"); -} -*/ - - -#ifdef __MPI -int main(int argc, char** argv) -{ - GlobalV::MY_RANK = 0; - - MPI_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &GlobalV::NPROC); - MPI_Comm_rank(MPI_COMM_WORLD, &GlobalV::MY_RANK); - - testing::InitGoogleTest(&argc, argv); - ::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); - - if (GlobalV::MY_RANK != 0) { - delete listeners.Release(listeners.default_result_printer()); - } - - int result = RUN_ALL_TESTS(); - MPI_Bcast(&result, 1, MPI_INT, 0, MPI_COMM_WORLD); - - if (GlobalV::MY_RANK == 0 && result != 0) - { - std::cout << "ERROR:some tests are not passed" << std::endl; - } - - MPI_Finalize(); - return result; -} -#endif diff --git a/source/source_io/module_dm/write_dmk.cpp b/source/source_io/module_dm/write_dmk.cpp index eb8e8857233..9448dabdc22 100644 --- a/source/source_io/module_dm/write_dmk.cpp +++ b/source/source_io/module_dm/write_dmk.cpp @@ -1,11 +1,114 @@ #include "source_io/module_dm/write_dmk.h" +#include "source_io/module_hs/dense_text_body.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_base/parallel_common.h" #include "source_base/module_external/scalapack_connector.h" #include "source_base/timer.h" +#include "source_base/vector3.h" #include "source_cell/ucell_io.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace +{ +/// @brief Read the next line that carries data. +/// @details Empty lines and lines whose first non-blank character is '#' are +/// skipped, so a reader does not depend on the exact blank-line layout +/// of the writer. +/// @return false when the end of the file is reached. +bool read_data_line(std::ifstream& ifs, std::string& line) +{ + while (std::getline(ifs, line)) + { + const std::size_t first = line.find_first_not_of(" \t\r"); + if (first == std::string::npos) + { + continue; + } + if (line[first] == '#') + { + continue; + } + return true; + } + return false; +} + +/// @brief Parse the leading integer of a header line. +bool parse_leading_int(const std::string& line, int& value) +{ + std::istringstream iss(line); + return static_cast(iss >> value); +} + +/// @brief Parse the leading real number of a header line. +bool parse_leading_double(const std::string& line, double& value) +{ + std::istringstream iss(line); + return static_cast(iss >> value); +} + +/// @brief Parse the three leading real numbers of a header line into a vector. +bool parse_leading_vec3(const std::string& line, ModuleBase::Vector3& vec) +{ + std::istringstream iss(line); + return static_cast(iss >> vec.x >> vec.y >> vec.z); +} + +/// @brief Compare two k-point coordinates in direct space, allowing integer +/// offsets (i.e. differing by a reciprocal lattice vector). +/// @details The density matrix is invariant under k -> k + G because the +/// phase factor e^{ik·R} is unchanged; only a mismatch modulo the +/// reciprocal lattice is a genuine inconsistency. +bool same_kvec_direct(const ModuleBase::Vector3& a, + const ModuleBase::Vector3& b, + const double tol = 1e-6) +{ + const double dx = a.x - b.x; + const double dy = a.y - b.y; + const double dz = a.z - b.z; + return std::abs(dx - std::round(dx)) < tol + && std::abs(dy - std::round(dy)) < tol + && std::abs(dz - std::round(dz)) < tol; +} + +/// @brief Advance the stream to the frame opened by "Ionic_Step target_step". +/// @details Appended multi-step files (out_app_flag == 1) concatenate one +/// record per ionic step, each opened by a marker line, so reading a +/// given step requires locating its marker first. +/// @return false when the requested frame is absent. +bool seek_frame(std::ifstream& ifs, const int target_step) +{ + const std::string marker = "Ionic_Step"; + std::string line; + while (std::getline(ifs, line)) + { + const std::size_t pos = line.find(marker); + if (pos == std::string::npos) + { + continue; + } + std::istringstream iss(line.substr(pos + marker.size())); + int step = 0; + if (iss >> step && step == target_step) + { + return true; + } + } + return false; +} +} // namespace + std::string ModuleIO::dmk_gen_fname(const bool gamma_only, const int ispin, const int nspin, const int ik, const int istep) { // set istep = -1 if you don't want the 'g' index appears in the file name @@ -37,28 +140,68 @@ std::string ModuleIO::dmk_gen_fname(const bool gamma_only, const int ispin, cons -void ModuleIO::dmk_readData(std::ifstream& ifs, double& data) +bool ModuleIO::dmk_readData(std::ifstream& ifs, double& data) { - ifs >> data; + if (!(ifs >> data)) + { + return false; + } + if (ifs.fail()) + { + return false; + } + // The stream extractor accepts the literals "inf"/"nan" without setting + // failbit; a restart density must stay finite, so reject them here. + return std::isfinite(data); } -void ModuleIO::dmk_readData(std::ifstream& ifs, std::complex& data) +bool ModuleIO::dmk_readData(std::ifstream& ifs, std::complex& data) { std::string complex_str; - ifs >> complex_str; + if (!(ifs >> complex_str)) + { + return false; + } + + // A body element has the fixed form "(real,imag)". + if (complex_str.size() < 5 || complex_str.front() != '(' || complex_str.back() != ')') + { + return false; + } + const std::size_t comma_pos = complex_str.find(','); + if (comma_pos == std::string::npos || comma_pos == 1 || comma_pos == complex_str.size() - 2) + { + return false; + } + + const std::string real_str = complex_str.substr(1, comma_pos - 1); + const std::string imag_str = complex_str.substr(comma_pos + 1, complex_str.size() - comma_pos - 2); - size_t comma_pos = complex_str.find(','); - if (complex_str.front() == '(' && complex_str.back() == ')' && comma_pos != std::string::npos) + // strtod consumes the full substring on overflow (e.g. "1e999") and only + // reports the range error through errno, so the end-pointer check alone + // would accept an infinite component; errno must be checked explicitly. + errno = 0; + char* end_ptr = nullptr; + const double real_v = std::strtod(real_str.c_str(), &end_ptr); + if (end_ptr == real_str.c_str() || *end_ptr != '\0' || errno == ERANGE) + { + return false; + } + errno = 0; + const double imag_v = std::strtod(imag_str.c_str(), &end_ptr); + if (end_ptr == imag_str.c_str() || *end_ptr != '\0' || errno == ERANGE) { - double real = std::stod(complex_str.substr(1, comma_pos - 1)); - double imag = std::stod(complex_str.substr(comma_pos + 1, complex_str.size() - comma_pos - 2)); - data = std::complex(real, imag); + return false; } - else + // Also reject the literal "inf"/"nan" spellings that strtod parses + // without setting errno: a density matrix component must be finite. + if (!std::isfinite(real_v) || !std::isfinite(imag_v)) { - ModuleBase::WARNING_QUIT("ModuleIO::dmk_readData", - "Invalid complex number format in dmk: " + complex_str); + return false; } + + data = std::complex(real_v, imag_v); + return true; } template @@ -66,7 +209,10 @@ bool ModuleIO::read_dmk(const int nspin, const int nk, const K_Vectors &kv, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, + const int istep, + const int out_app_flag, std::vector>& dmk, std::ofstream &ofs_running) { @@ -78,102 +224,277 @@ bool ModuleIO::read_dmk(const int nspin, MPI_Comm_rank(pv.comm(), &my_rank); #endif - int nlocal = pv.nrglb(); - bool gamma_only = std::is_same::value; - std::vector> dmk_global(nspin * nk, std::vector(nlocal * nlocal, 0)); + const int nlocal = pv.nrglb(); + const bool gamma_only = std::is_same::value; + std::vector dmk_global(my_rank == 0 ? nlocal * nlocal : 0); + std::vector> dmk_read( + nspin * nk, std::vector(pv.nrloc() * pv.ncloc(), T(0))); + + // write_dmk emits an optional "Ionic_Step" frame marker followed by + // eleven header lines: nspin, spin index, nkstot_nospin, nkstot, ik, + // kvec_c, kvec_d, weight, Fermi energy, nlocal and the matrix size. + // Reading them in order also rejects files of a different layout, + // spin channel or k-mesh instead of silently mismatching them. + const int n_header = 11; + std::vector header(n_header); + std::string line; + +#ifdef __MPI + Parallel_Blkcyclic pv_glb; + pv_glb.set(nlocal, nlocal, nlocal, pv.ictxt()); +#endif bool read_success = true; - std::string tmp; - if (my_rank == 0) + for (int ispin = 0; ispin < nspin && read_success; ispin++) { - for (int ispin = 0; ispin < nspin; ispin++) + for (int ik = 0; ik < nk && read_success; ik++) { - for (int ik = 0; ik < nk; ik++) + const std::size_t index_k = static_cast(ik) + static_cast(nk) * ispin; + if (my_rank == 0) { - // to read density matrix in k space, remember to delete the step information 'g' - // set istep = -1 if you don't want the 'g' index appears in the file name - const int istep = -1; - std::string fn = dmk_dir + dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); - std::ifstream ifs(fn.c_str()); - - if (!ifs) + // Keep file-local error exits inside this scope so every rank + // reaches the cooperative status broadcast below. + do { - ofs_running << " Cannot find density matrix file " << fn << " for k-point " << ik+1 << std::endl; - ModuleBase::WARNING("ModuleIO::read_dmk", "Can't open density matrix (k) file < " + fn + " >."); - read_success = false; - break; - } - else - { - ofs_running << " Read density matrix file " << fn << " for k-point " << ik+1 << std::endl; - } + // Mirror the writer: only mode 2 embeds the ionic step in the + // filename, modes 0 and 1 reuse a fixed name. + const int istep_file = (out_app_flag == 2) ? istep : -1; + const std::string fn = dmk_dir + dmk_gen_fname( + gamma_only, + ispin, + nspin, + ik, + istep_file); + std::ifstream ifs(fn.c_str()); + + if (!ifs) + { + ofs_running << " Cannot find density matrix file " << fn << " for k-point " << ik + 1 + << std::endl; + ModuleBase::WARNING("ModuleIO::read_dmk", "Can't open density matrix (k) file < " + fn + " >."); + read_success = false; + break; + } + ofs_running << " Read density matrix file " << fn << " for k-point " << ik + 1 << std::endl; + + // A fixed-name file of a multi-step run (mode 1) holds one + // record per ionic step, so the requested frame has to be + // located first; a negative step keeps the first frame. + if (out_app_flag == 1 && istep >= 0) + { + if (!seek_frame(ifs, istep + 1)) + { + ofs_running << " Cannot find ionic step " << istep + 1 << " in density matrix file " << fn + << std::endl; + read_success = false; + break; + } + } - int spin_tmp = 0; - ModuleBase::GlobalFunc::READ_VALUE(ifs, spin_tmp); + // ---- header ---- + int frame_step = -1; + if (!read_data_line(ifs, line)) + { + ofs_running << " Empty density matrix file " << fn << std::endl; + read_success = false; + break; + } + if (line.find("Ionic_Step") != std::string::npos) + { + std::istringstream iss_step(line.substr(line.find("Ionic_Step") + 10)); + iss_step >> frame_step; + if (!read_data_line(ifs, line)) + { + ofs_running << " Truncated density matrix file " << fn << std::endl; + read_success = false; + break; + } + } + // A per-step file (mode 2) must describe the step its name + // announces, otherwise the restart would silently mix steps. + if (out_app_flag == 2 && frame_step >= 0 && frame_step != istep + 1) + { + ofs_running << " Ionic step mismatch in density matrix file " << fn << ": file says " + << frame_step << ", expected " << istep + 1 << std::endl; + read_success = false; + break; + } + header[0] = line; + for (int ih = 1; ih < n_header; ++ih) + { + if (!read_data_line(ifs, header[ih])) + { + ofs_running << " Truncated density matrix file " << fn << std::endl; + read_success = false; + break; + } + } + if (!read_success) + { + break; + } - double fermi_tmp = 0.0; - ModuleBase::GlobalFunc::READ_VALUE(ifs, fermi_tmp); + int nspin_file = 0; + int ispin_file = 0; + int nkstot_nospin_file = 0; + int nkstot_file = 0; + int ik_file = 0; + double ef_file = 0.0; + int nlocal_file = 0; + int nrow_file = 0; + int ncol_file = 0; + bool header_ok = parse_leading_int(header[0], nspin_file); + header_ok = header_ok && parse_leading_int(header[1], ispin_file); + header_ok = header_ok && parse_leading_int(header[2], nkstot_nospin_file); + header_ok = header_ok && parse_leading_int(header[3], nkstot_file); + header_ok = header_ok && parse_leading_int(header[4], ik_file); + header_ok = header_ok && parse_leading_double(header[8], ef_file); + header_ok = header_ok && parse_leading_int(header[9], nlocal_file); + { + std::istringstream iss(header[10]); + header_ok = header_ok && static_cast(iss >> nrow_file >> ncol_file); + } + if (!header_ok) + { + ofs_running << " Malformed header in density matrix file " << fn << std::endl; + read_success = false; + break; + } + if (nspin_file != nspin || ispin_file != ispin + 1) + { + ofs_running << " Spin mismatch in density matrix file " << fn + << ": file says nspin = " << nspin_file << ", spin index = " << ispin_file + << "; expected nspin = " << nspin << ", spin index = " << ispin + 1 << std::endl; + read_success = false; + break; + } + if (nkstot_nospin_file != kv.get_nkstot_nospin() || nkstot_file != kv.get_nkstot() || + ik_file != ik + 1) + { + ofs_running << " k-point mismatch in density matrix file " << fn + << ": file says nkstot = " << nkstot_file << " (nospin " << nkstot_nospin_file + << "), ik = " << ik_file << "; expected nkstot = " << kv.get_nkstot() << " (nospin " + << kv.get_nkstot_nospin() << "), ik = " << ik + 1 << std::endl; + read_success = false; + break; + } - int nlocal_tmp = 0; - ModuleBase::GlobalFunc::READ_VALUE(ifs, nlocal_tmp); + // The counts and the index alone do not pin down the k-point: + // a reordered or shifted mesh of the same size would pass the + // check above but describe a different density. The stored + // direct coordinates must therefore match the current mesh + // (modulo a reciprocal lattice vector, which leaves the + // phase e^{ik·R} unchanged). + ModuleBase::Vector3 kvec_d_file; + if (!parse_leading_vec3(header[6], kvec_d_file)) + { + ofs_running << " Malformed k-point coordinates in density matrix file " << fn << std::endl; + read_success = false; + break; + } + if (!same_kvec_direct(kvec_d_file, kv.kvec_d[ik])) + { + ofs_running << " k-point coordinate mismatch in density matrix file " << fn + << ": file says kvec_d = (" << kvec_d_file.x << ", " << kvec_d_file.y << ", " + << kvec_d_file.z << "); expected (" << kv.kvec_d[ik].x << ", " + << kv.kvec_d[ik].y << ", " << kv.kvec_d[ik].z << ")" << std::endl; + read_success = false; + break; + } + if (nlocal_file != nlocal || nrow_file != nlocal || ncol_file != nlocal) + { + ofs_running << " Basis size mismatch in density matrix file " << fn << ": file says " + << nlocal_file << " basis and a " << nrow_file << " x " << ncol_file + << " matrix, expected " << nlocal << std::endl; + read_success = false; + break; + } + ofs_running << " Fermi energy of " << fn << " is " << ef_file << " Ry" << std::endl; - if(nlocal_tmp==nlocal) - { - ofs_running << " number of basis (nlocal) is correct: " << nlocal << std::endl; - } - else - { - ModuleBase::WARNING_QUIT("ModuleIO::read_dmk","nlocal does not match!"); - } + // ---- UnitCell block between the header and the matrix body ---- + // Consume the blank separator line(s) first, then let the + // UnitCell reader skip its fixed set of lines. + while (true) + { + const std::streampos pos = ifs.tellg(); + if (!std::getline(ifs, line)) + { + break; + } + if (line.find_first_not_of(" \t\r") != std::string::npos) + { + ifs.seekg(pos); + break; + } + } + if (!ModuleIO::UcellIO::read_ucell(ifs)) + { + ofs_running << " Malformed UnitCell block in density matrix file " << fn + << ": could not parse the atom-count line or ran out of data" + << std::endl; + read_success = false; + break; + } - // read the DMK data - const size_t index_k = ik + nk * ispin; - for (int i = 0; i < nlocal; ++i) - { - const size_t index_i = i * nlocal; - for (int j = 0; j < nlocal; ++j) + // ---- matrix body, always row-major in the file ---- + for (int i = 0; i < nlocal && read_success; ++i) + { + for (int j = 0; j < nlocal; ++j) + { + T value = T(0); + if (!dmk_readData(ifs, value)) + { + read_success = false; + break; + } + dmk_global[ModuleIO::dense_buffer_index( + i, + j, + nlocal, + column_major)] = value; + } + } + if (!read_success) { - dmk_readData(ifs, dmk_global[index_k][index_i + j]); + ofs_running << " Failed to read the matrix body of density matrix file " << fn << std::endl; + break; } - } - ifs.close(); - } // ik + ifs.close(); + } while (false); + } // rank0 + +#ifdef __MPI + // Cooperative failure: every rank distributes the same matrix or + // stops together, so a rank-0 parse error cannot deadlock the run. + Parallel_Common::bcast_bool(read_success, pv.comm()); +#endif if (!read_success) { break; } - } // ispin - } // rank0 #ifdef __MPI - MPI_Bcast(&read_success, 1, MPI_C_BOOL, 0, pv.comm()); + Cpxgemr2d( + nlocal, + nlocal, + dmk_global.data(), + 1, + 1, + const_cast(pv_glb.desc()), + dmk_read[index_k].data(), + 1, + 1, + const_cast(pv.desc()), + pv_glb.ictxt()); +#else + dmk_read[index_k] = dmk_global; #endif + } // ik + } // ispin if (read_success) { -#ifdef __MPI - // seperate dmk data to each processor with 2D block distribution - dmk.resize(nspin * nk, std::vector(pv.nrloc() * pv.ncloc())); - Parallel_Blkcyclic pv_glb; - pv_glb.set(nlocal, nlocal, nlocal, pv.ictxt()); - for (int ik = 0; ik < nspin * nk; ik++) - { - Cpxgemr2d( - nlocal, - nlocal, - dmk_global[ik].data(), - 1, - 1, - const_cast(pv_glb.desc()), - dmk[ik].data(), - 1, - 1, - const_cast(pv.desc()), - pv_glb.ictxt()); - } -#else - dmk = dmk_global; -#endif + dmk.swap(dmk_read); } ModuleBase::timer::end("ModuleIO", "read_dmk"); return read_success; @@ -186,6 +507,7 @@ void ModuleIO::write_dmk(const std::vector>& dmk, const std::vector& efs, const UnitCell* ucell, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, const int istep, const int out_app_flag, @@ -215,7 +537,6 @@ void ModuleIO::write_dmk(const std::vector>& dmk, const int nspin = efs.size(); assert(nspin > 0); const int nk = dmk.size() / nspin; - const double dm_thr = 1.0e-16; // mohan set 2025-09-02 if (nk * nspin != dmk.size()) { @@ -223,13 +544,13 @@ void ModuleIO::write_dmk(const std::vector>& dmk, } Parallel_Blkcyclic pv_glb; + std::vector dmk_global(my_rank == 0 ? nlocal * nlocal : 0); for (int ispin = 0; ispin < nspin; ispin++) { for (int ik = 0; ik < nk; ik++) { - // gather dmk[ik] to dmk_global - std::vector dmk_global(my_rank == 0 ? nlocal * nlocal : 0); + // gather dmk[ik] to the reused global buffer #ifdef __MPI pv_glb.set(nlocal, nlocal, nlocal, pv.ictxt()); Cpxgemr2d( @@ -261,7 +582,7 @@ void ModuleIO::write_dmk(const std::vector>& dmk, } ofs.open(fn.c_str(), mode); - ofs << " --- Ionic Step " << istep+1 << " ---" << std::endl; + ofs << "Ionic_Step " << istep+1 << std::endl; if (!ofs) { @@ -270,8 +591,7 @@ void ModuleIO::write_dmk(const std::vector>& dmk, } else { - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - ofs_running << " Write DM(k)" << spin_tag << " matrix in NAO basis to file: " << fn << std::endl; + ModuleIO::write_matrix_notice(ofs_running, "DM(k)", ispin, nspin, fn); } @@ -287,6 +607,12 @@ void ModuleIO::write_dmk(const std::vector>& dmk, << " # k point coordinate (direct) " << std::endl; ofs << " " << kv.wk[ik] << " # weight of this k point" << std::endl; ofs << " " << efs[ispin] << " # Fermi energy in Ry " << std::endl; + // State the element convention in the file itself: dm_from_psi + // builds DM = sum_n w_n conj(c_n) c_n^T (conj on the first + // index), i.e. the complex conjugate of the physical one-body + // density matrix. This line lives inside the header block so + // read_data_line (which skips '#' lines) absorbs it. + ofs << "# matrix element (i,j) = sum_n w_n * conj(c_n,i) * c_n,j" << std::endl; ofs << " " << nlocal << " # number of localized basis " << std::endl; ofs << " " << nlocal << " " << nlocal << " # size of this matrix " << std::endl; ofs << std::endl; @@ -294,49 +620,10 @@ void ModuleIO::write_dmk(const std::vector>& dmk, // write ucell ModuleIO::UcellIO::write_ucell(ofs, ucell); - ofs << std::fixed; - ofs << std::scientific; - ofs << std::setprecision(precision); - ofs << std::right; - for (int i = 0; i < nlocal; ++i) - { - const size_t ii = i * nlocal; - for (int j = 0; j < nlocal; ++j) - { - if (std::is_same::value) - { - if (j % 8 == 0) - { - ofs << "\n"; - } - ofs << " " << dmk_global[ii + j]; - } - else if (std::is_same, T>::value) - { - if (j % 4 == 0) - { - ofs << "\n"; - } - - double real_v = std::real(dmk_global[ii + j]); - if(std::abs(real_v) < dm_thr) - { - real_v = 0.0; - } - double imag_v = std::imag(dmk_global[ii + j]); - if(std::abs(imag_v) < dm_thr) - { - imag_v = 0.0; - } - - ofs << " (" << real_v << "," << imag_v << ")"; - } - } - } - // Terminate the matrix body with a newline so that the next - // appended record (out_app_flag == 1) starts on a fresh line - // instead of being glued to the last value of this step. - ofs << std::endl; + // The file body is row-major; column_major selects the + // traversal order of the gathered (possibly column-major) + // DM(k) buffer so the transpose is not emitted. + ModuleIO::write_dense_text_body(ofs, dmk_global, nlocal, precision, column_major); ofs.close(); } // rank0 } // ik @@ -349,7 +636,10 @@ template bool ModuleIO::read_dmk(const int nspin, const int nk, const K_Vectors &kv, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, + const int istep, + const int out_app_flag, std::vector>& dmk, std::ofstream &ofs); @@ -357,7 +647,10 @@ template bool ModuleIO::read_dmk>(const int nspin, const int nk, const K_Vectors &kv, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, + const int istep, + const int out_app_flag, std::vector>>& dmk, std::ofstream &ofs); @@ -367,6 +660,7 @@ template void ModuleIO::write_dmk(const std::vector> const std::vector& efs, const UnitCell* ucell, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, const int istep, const int out_app_flag, @@ -378,6 +672,7 @@ template void ModuleIO::write_dmk>(const std::vector& efs, const UnitCell* ucell, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, const int istep, const int out_app_flag, diff --git a/source/source_io/module_dm/write_dmk.h b/source/source_io/module_dm/write_dmk.h index 3bc21e80f17..bf978ac8fce 100644 --- a/source/source_io/module_dm/write_dmk.h +++ b/source/source_io/module_dm/write_dmk.h @@ -23,13 +23,16 @@ std::string dmk_gen_fname(const bool gamma_only, const int ispin, const int nspi /** * @brief Read one double from a file. + * @return false when the extraction fails (truncated or malformed body). */ -void dmk_readData(std::ifstream& ifs, double& data); +bool dmk_readData(std::ifstream& ifs, double& data); /** * @brief Read one complex double from a file. + * @return false when the extraction fails (truncated, empty token or a token + * that is not of the "(re,im)" form). */ -void dmk_readData(std::ifstream& ifs, std::complex& data); +bool dmk_readData(std::ifstream& ifs, std::complex& data); /** * @brief Reads the DMK data from a file. @@ -40,7 +43,16 @@ void dmk_readData(std::ifstream& ifs, std::complex& data); * @param k-vector information. * @param pv The Parallel_Blkcyclic object. Will get the global size and local size * from it, and seperate the data into different processors accordingly. + * @param column_major Whether the local DMK blocks must be stored column-major + * (genelpa/elpa/scalapack_gvx and the other column-major solvers). The file body + * is row-major, so this selects the destination index of each element. * @param dmk_dir The directory path of the DMK file. + * @param istep The ionic step to read. With out_app_flag == 1 it selects the + * frame of the appended multi-step file, and a negative value keeps the first + * frame; with out_app_flag == 2 it has to match the g{istep+1} file name and + * the frame marker it contains. + * @param out_app_flag Must mirror the value used by write_dmk, because it + * decides whether the step is part of the filename. * @param dmk A vector to store the DMK data. If use MPI parallel, the data will * be seperated into different processors based on the Parallel_Blkcyclic object. * @return True if the DMK data is successfully read, false otherwise. @@ -50,13 +62,23 @@ bool read_dmk(const int nspin, const int nk, const K_Vectors &kv, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, + const int istep, + const int out_app_flag, std::vector>& dmk, std::ofstream &ofs_running); /** * @brief Writes the DMK data to a file. * + * @details The written matrix element is + * D(i,j) = sum_n w_n * conj(c_n,i) * c_n,j + * (complex conjugate on the first band index), matching the + * convention built by dm_from_psi; this is the complex conjugate of + * the physical one-body density matrix sum_n w_n c_n,i conj(c_n,j). + * The same line is also emitted as a '#' comment in the file header. + * * @tparam T The type of the DMK data. * @param dmk A vector containing the DMK data. The first dimension is nspin*nk, * and the second dimension is nlocal*nlocal. DMK is parallel in 2d-block type @@ -67,6 +89,9 @@ bool read_dmk(const int nspin, * size as the number of SPIN. * @param ucell A pointer to the UnitCell object. * @param pv The Parallel_Blkcyclic object. The 2d-block parallel information of DMK. + * @param column_major Whether the local DMK blocks are stored column-major + * (genelpa/elpa/scalapack_gvx and the other column-major solvers). The file + * body is always row-major, so this selects the traversal order. * @param dmk_dir The directory the DMK files are written into. * @param out_app_flag Append-mode selector: 1 reuses the fixed filename * across ionic steps and appends a new record per step in multi-step @@ -79,6 +104,7 @@ void write_dmk(const std::vector>& dmk, const std::vector& efs, const UnitCell* ucell, const Parallel_Blkcyclic& pv, + const bool column_major, const std::string& dmk_dir, const int istep, const int out_app_flag, diff --git a/source/source_io/module_dm/write_dmr.cpp b/source/source_io/module_dm/write_dmr.cpp index f9fdd33f350..e27df6b768e 100644 --- a/source/source_io/module_dm/write_dmr.cpp +++ b/source/source_io/module_dm/write_dmr.cpp @@ -1,37 +1,28 @@ #include "write_dmr.h" +#include "source_io/module_hs/hs_sparse_io_detail.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_base/global_variable.h" #include "source_hamilt/module_hcontainer/hcontainer_funcs.h" #include "source_hamilt/module_hcontainer/output_hcontainer.h" -#include "source_cell/ucell_io.h" namespace ModuleIO { std::string dmr_gen_fname(const int out_type, const int ispin, const bool numbered, const int istep) { - std::string fname = "dmr.csr"; + const std::string spin_suffix = "s" + std::to_string(ispin + 1); if (out_type == 1) { - if (numbered && istep >= 0) - { - // spa stands for sparse - fname = "dmrs" + std::to_string(ispin+1) + "g" + std::to_string(istep + 1) + "_nao.csr"; - } - else - { - fname = "dmrs" + std::to_string(ispin+1) + "_nao.csr"; - } + // spa stands for sparse + return detail::make_sparse_R_filename("dmr", spin_suffix, numbered, istep, ".csr"); } else if (out_type == 2) { - fname = "dmrs" + std::to_string(ispin+1) + "_nao.npz"; + return detail::make_sparse_R_filename("dmr", spin_suffix, false, istep, ".npz"); } - else - { - ModuleBase::WARNING("write_dmr", "the output type of density matrix DM(R) should be csr or npz."); - } - return fname; + ModuleBase::WARNING("write_dmr", "the output type of density matrix DM(R) should be csr or npz."); + return "dmr.csr"; } void write_dmr_csr(std::string& fname, @@ -59,21 +50,22 @@ void write_dmr_csr(std::string& fname, { ofs.open(fname); } + ModuleIO::detail::check_output_file_open(ofs, fname, "ModuleIO::write_dmr_csr"); - - ofs << " --- Ionic Step " << istep+1 << " ---" << std::endl; - ofs << " # print density matrix in real space DM(R)" << std::endl; - ofs << " " << nspin << " # number of spin directions" << std::endl; - ofs << " " << ispin+1 << " # spin index" << std::endl; - ofs << " " << dm_serial->get_nbasis() - << " # number of localized basis" << std::endl; - ofs << " " << dm_serial->size_R_loop() - << " # number of Bravais lattice vector R" << std::endl; - ofs << std::endl; - - // write ucell - ModuleIO::UcellIO::write_ucell(ofs, ucell); - ofs << std::endl; + const std::string description = " # print density matrix in real space DM(R)"; + const ModuleIO::detail::CsrTextHeader header = { + istep + 1, + description, + nspin, + ispin + 1, + dm_serial->get_nbasis(), + static_cast(dm_serial->size_R_loop()), + ucell, + std::string(), + false, + 0.0, + false}; + ModuleIO::detail::write_csr_text_header(ofs, header); // write HR_serial to ofs const double sparse_threshold = 1e-10; @@ -122,8 +114,7 @@ void write_dmr(const std::vector*> dmr, const int out_type = 1; std::string fname = dmr_dir + dmr_gen_fname(out_type, ispin, numbered, istep); write_dmr_csr(fname, ucell, precision, &dm_serial, istep, ispin, nspin, append); - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - ofs_running << " Write DM(R)" << spin_tag << " matrix in NAO basis to file: " << fname << std::endl; + ModuleIO::write_matrix_notice(ofs_running, "DM(R)", ispin, nspin, fname); } } } diff --git a/source/source_io/module_dos/cal_dos.cpp b/source/source_io/module_dos/cal_dos.cpp index 4305faa4b98..9dd73cd2582 100644 --- a/source/source_io/module_dos/cal_dos.cpp +++ b/source/source_io/module_dos/cal_dos.cpp @@ -4,6 +4,7 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_base/parallel_reduce.h" +#include "source_io/module_output/provenance_header.h" #include @@ -24,13 +25,13 @@ void ModuleIO::prepare_dos(std::ofstream& ofs_running, { ofs_running << "\n >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; ofs_running << " | |" << std::endl; - ofs_running << " | #Calcualte Density of States (DOS)# |" << std::endl; + ofs_running << " | #Calculate Density of States (DOS)# |" << std::endl; ofs_running << " | DOS stands for Density of States. It represents the number of |" << std::endl; ofs_running << " | available electronic states per unit energy range. |" << std::endl; ofs_running << " | By analyzing the DOS, we can gain insights into how electrons are |" << std::endl; ofs_running << " | distributed among different energy levels within the material. |" << std::endl; ofs_running << " | |" << std::endl; - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; + ofs_running << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl; ofs_running << std::setprecision(6); @@ -43,9 +44,9 @@ void ModuleIO::prepare_dos(std::ofstream& ofs_running, } else { - ModuleBase::GlobalFunc::OUT(ofs_running, "Spin up, Fermi energy (Ry)", + ModuleBase::GlobalFunc::OUT(ofs_running, "Spin up, Fermi energy (eV)", energy_fermi.ef_up * ModuleBase::Ry_to_eV); - ModuleBase::GlobalFunc::OUT(ofs_running, "Spin dw, Fermi energy (Ry)", + ModuleBase::GlobalFunc::OUT(ofs_running, "Spin dw, Fermi energy (eV)", energy_fermi.ef_dw * ModuleBase::Ry_to_eV); } @@ -117,6 +118,8 @@ bool ModuleIO::cal_dos(const int& is, // index for spin if (GlobalV::MY_RANK == 0) { + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; const bool append_step = (out_app_flag == 1) && (istep > 0); if (append_step) { @@ -126,7 +129,7 @@ bool ModuleIO::cal_dos(const int& is, // index for spin { ofs_dos.open(fn.c_str()); } - ofs_dos << istep+1 << " # ionic step" << std::endl; + ofs_dos << ModuleIO::prov_step(istep_one_based, time_stamp); } #ifdef __MPI diff --git a/source/source_io/module_dos/cal_ldos.cpp b/source/source_io/module_dos/cal_ldos.cpp index 5e8e14de0d9..785ea5e48b5 100644 --- a/source/source_io/module_dos/cal_ldos.cpp +++ b/source/source_io/module_dos/cal_ldos.cpp @@ -27,6 +27,7 @@ void Cal_ldos::cal_ldos_lcao( const UnitCell& ucell, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int out_ldos_precision, @@ -94,7 +95,7 @@ void Cal_ldos::cal_ldos_lcao( ldos_space.data(), 0, nspin, - 0, + istep, fn.str(), 0, &ucell, @@ -126,6 +127,7 @@ void cal_ldos_pw(const elecstate::ElecStatePW>* pelec, const std::vector& out_ldos, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int nbands, @@ -143,12 +145,12 @@ void cal_ldos_pw(const elecstate::ElecStatePW>* pelec, { const int out_ldos_precision = out_ldos[1]; ModuleIO::stm_mode_pw(pelec, psi, ctx, pgrid, ucell, - stm_bias, nspin, global_out_dir, two_fermi, + stm_bias, nspin, istep, global_out_dir, two_fermi, out_ldos_precision, ofs_running); } if (out_ldos[0] == 2 || out_ldos[0] == 3) { - ModuleIO::ldos_mode_pw(pelec, psi, ctx, pgrid, ucell, + ModuleIO::ldos_mode_pw(pelec, psi, ctx, pgrid, ucell, istep, global_out_dir, nbands, dos_edelta_ev, dos_scale, dos_setemax, dos_emax_ev, dos_setemin, dos_emin_ev, two_fermi, dos_sigma, ldos_line, ofs_running); @@ -163,6 +165,7 @@ void stm_mode_pw(const elecstate::ElecStatePW>* pelec, const UnitCell& ucell, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int out_ldos_precision, @@ -231,7 +234,7 @@ void stm_mode_pw(const elecstate::ElecStatePW>* pelec, << ".cube"; const int precision = out_ldos_precision; - ModuleIO::write_vdata_palgrid(pgrid, ldos.data(), 0, nspin, 0, fn.str(), 0, &ucell, precision, 0, two_fermi, false, false, ofs_running, "local DOS"); + ModuleIO::write_vdata_palgrid(pgrid, ldos.data(), 0, nspin, istep, fn.str(), 0, &ucell, precision, 0, two_fermi, false, false, ofs_running, "local DOS"); } } @@ -241,6 +244,7 @@ void ldos_mode_pw(const elecstate::ElecStatePW>* pelec, const Device* ctx, const Parallel_Grid& pgrid, const UnitCell& ucell, + const int istep, const std::string& global_out_dir, const int nbands, const double dos_edelta_ev, @@ -487,6 +491,7 @@ template void cal_ldos_pw(const elecstate::ElecStatePW< const std::vector& out_ldos, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int nbands, @@ -508,6 +513,7 @@ template void cal_ldos_pw(const elecstate::ElecStatePW< const std::vector& out_ldos, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int nbands, diff --git a/source/source_io/module_dos/cal_ldos.h b/source/source_io/module_dos/cal_ldos.h index 6b6380ee711..b67aa425b38 100644 --- a/source/source_io/module_dos/cal_ldos.h +++ b/source/source_io/module_dos/cal_ldos.h @@ -36,6 +36,7 @@ class Cal_ldos const UnitCell& ucell, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int out_ldos_precision, @@ -52,6 +53,7 @@ void cal_ldos_pw(const elecstate::ElecStatePW>* pelec, const std::vector& out_ldos, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int nbands, @@ -73,6 +75,7 @@ void stm_mode_pw(const elecstate::ElecStatePW>* pelec, const UnitCell& ucell, const std::vector& stm_bias, const int nspin, + const int istep, const std::string& global_out_dir, const bool two_fermi, const int out_ldos_precision, @@ -84,6 +87,7 @@ void ldos_mode_pw(const elecstate::ElecStatePW>* pelec, const Device* ctx, const Parallel_Grid& pgrid, const UnitCell& ucell, + const int istep, const std::string& global_out_dir, const int nbands, const double dos_edelta_ev, diff --git a/source/source_io/module_dos/cal_pdos_gamma.cpp b/source/source_io/module_dos/cal_pdos_gamma.cpp index 88702fbec49..6404fbe0173 100644 --- a/source/source_io/module_dos/cal_pdos_gamma.cpp +++ b/source/source_io/module_dos/cal_pdos_gamma.cpp @@ -6,7 +6,7 @@ #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_lcao/hamilt_lcao.h" -#include "source_io/module_output/write_orb_info.h" +#include "source_io/module_output/write_notice.h" void ModuleIO::cal_pdos( @@ -26,7 +26,8 @@ void ModuleIO::cal_pdos( const int out_app_flag, const int nlocal, const int nspin, - const std::string& global_out_dir) + const std::string& global_out_dir, + std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "cal_pdos_gamma"); @@ -149,7 +150,6 @@ void ModuleIO::cal_pdos( if (GlobalV::MY_RANK == 0) { write_pdos_text(ucell, pdos.data(), nspin, nlocal, npoints, - emin, dos_edelta_ev, global_out_dir, istep, out_app_flag); - ModuleIO::write_orb_info(&ucell); + emin, dos_edelta_ev, global_out_dir, istep, out_app_flag, ofs_running); } } diff --git a/source/source_io/module_dos/cal_pdos_gamma.h b/source/source_io/module_dos/cal_pdos_gamma.h index 0af1fca0540..c48fdd347e2 100644 --- a/source/source_io/module_dos/cal_pdos_gamma.h +++ b/source/source_io/module_dos/cal_pdos_gamma.h @@ -6,6 +6,7 @@ #include "source_psi/psi.h" // use psi::Psi #include "source_hamilt/hamilt.h" // use hamilt::Hamilt #include "source_basis/module_ao/parallel_orbitals.h" // use Parallel_Orbitals +#include #include namespace ModuleIO @@ -28,7 +29,8 @@ namespace ModuleIO const int out_app_flag, const int nlocal, const int nspin, - const std::string& global_out_dir); + const std::string& global_out_dir, + std::ofstream& ofs_running); } diff --git a/source/source_io/module_dos/cal_pdos_multik.cpp b/source/source_io/module_dos/cal_pdos_multik.cpp index 3a8cee8add0..6246c36c409 100644 --- a/source/source_io/module_dos/cal_pdos_multik.cpp +++ b/source/source_io/module_dos/cal_pdos_multik.cpp @@ -3,7 +3,7 @@ #include "source_base/parallel_reduce.h" #include "source_base/module_external/blas_connector.h" #include "source_base/module_external/scalapack_connector.h" -#include "source_io/module_output/write_orb_info.h" +#include "source_io/module_output/write_notice.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_lcao/hamilt_lcao.h" @@ -25,7 +25,8 @@ void ModuleIO::cal_pdos( const int out_app_flag, const int nlocal, const int nspin, - const std::string& global_out_dir) + const std::string& global_out_dir, + std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "cal_pdos_multik"); @@ -189,7 +190,6 @@ void ModuleIO::cal_pdos( if (GlobalV::MY_RANK == 0) { write_pdos_text(ucell, pdos.data(), nspin, nlocal, npoints, - emin, dos_edelta_ev, global_out_dir, istep, out_app_flag); - ModuleIO::write_orb_info(&ucell); + emin, dos_edelta_ev, global_out_dir, istep, out_app_flag, ofs_running); } } diff --git a/source/source_io/module_dos/cal_pdos_multik.h b/source/source_io/module_dos/cal_pdos_multik.h index a4b194d967b..f28a5cce6e6 100644 --- a/source/source_io/module_dos/cal_pdos_multik.h +++ b/source/source_io/module_dos/cal_pdos_multik.h @@ -6,6 +6,7 @@ #include "source_psi/psi.h" // use psi::Psi #include "source_hamilt/hamilt.h" // use hamilt::Hamilt #include "source_basis/module_ao/parallel_orbitals.h" // use Parallel_Orbitals +#include #include namespace ModuleIO @@ -29,7 +30,8 @@ namespace ModuleIO const int out_app_flag, const int nlocal, const int nspin, - const std::string& global_out_dir); + const std::string& global_out_dir, + std::ofstream& ofs_running); } diff --git a/source/source_io/module_dos/unittests/test_cal_dos.cpp b/source/source_io/module_dos/unittests/test_cal_dos.cpp index 82c99219112..c32e9cbc27f 100644 --- a/source/source_io/module_dos/unittests/test_cal_dos.cpp +++ b/source/source_io/module_dos/unittests/test_cal_dos.cpp @@ -71,7 +71,19 @@ TEST_F(DosTest,Dos) EXPECT_THAT(str, testing::HasSubstr("2.849588")); std::istringstream rows(str); std::string line; - std::getline(rows, line); // ionic step + // Skip the per-frame provenance comments, then the ionic-step marker. + while (std::getline(rows, line)) + { + if (line.find("# ABACUS version:") != std::string::npos) + { + continue; + } + if (line.find("# Written at ") != std::string::npos) + { + continue; + } + break; + } std::getline(rows, line); // declared grid size int declared_points = 0; std::istringstream(line) >> declared_points; @@ -222,12 +234,12 @@ TEST_F(DosTest, Mode1Appends) const int out_app_flag = 1; const int bndpar = 1; - // First call: istep=0 -> "1 # ionic step". + // First call: istep=0 -> "# Ionic_Step 1". ModuleIO::cal_dos(dosp.is, dosp.fa, dosp.de_ev, dosp.emax_ev, dosp.emin_ev, dosp.bcoeff, dosp.nks, dosp.nkstot, dosp.wk, dosp.isk, dosp.nbands, dosp.ekb, dosp.wg, /*istep=*/0, out_app_flag, bndpar); - // Second call: istep=1 -> "2 # ionic step", appended. + // Second call: istep=1 -> "# Ionic_Step 2", appended. ModuleIO::cal_dos(dosp.is, dosp.fa, dosp.de_ev, dosp.emax_ev, dosp.emin_ev, dosp.bcoeff, dosp.nks, dosp.nkstot, dosp.wk, dosp.isk, dosp.nbands, dosp.ekb, dosp.wg, @@ -241,9 +253,9 @@ TEST_F(DosTest, Mode1Appends) std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); ifs.close(); - // Two ionic step headers present. - EXPECT_THAT(str, testing::HasSubstr("1 # ionic step")); - EXPECT_THAT(str, testing::HasSubstr("2 # ionic step")); + // Two Ionic_Step headers present. + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 1")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 2")); remove(fname.c_str()); } } @@ -282,13 +294,13 @@ TEST_F(DosTest, Mode2Overwrites) std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); ifs.close(); - // Only the last ionic step header must be present. - EXPECT_THAT(str, testing::HasSubstr("2 # ionic step")); - // A simple count check: "1 # ionic step" must appear only inside + // Only the last Ionic_Step header must be present. + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 2")); + // A simple count check: "# Ionic_Step 1" must appear only inside // the DOS grid lines as a value, not as a header. Check that the // header for step 1 is absent by verifying it is NOT found as a // standalone header line. - EXPECT_THAT(str, testing::Not(testing::HasSubstr("\n1 # ionic step"))); + EXPECT_THAT(str, testing::Not(testing::HasSubstr("\n# Ionic_Step 1"))); remove(fname.c_str()); } } diff --git a/source/source_io/module_dos/unittests/test_write_dos_pw.cpp b/source/source_io/module_dos/unittests/test_write_dos_pw.cpp index 5e719bfe740..033bd48ece9 100644 --- a/source/source_io/module_dos/unittests/test_write_dos_pw.cpp +++ b/source/source_io/module_dos/unittests/test_write_dos_pw.cpp @@ -188,10 +188,20 @@ TEST_F(DosPWTest,Dos2) EXPECT_THAT(str1, testing::HasSubstr("2.847771")); std::istringstream rows(str1); std::string line; - std::getline(rows, line); // ionic step - std::getline(rows, line); // declared grid size + // Skip the provenance header ("# ABACUS version", "# Written at") and + // the ionic-step marker, then read the declared grid size. + bool found_declaration = false; int declared_points = 0; - std::istringstream(line) >> declared_points; + while (std::getline(rows, line)) + { + if (line.find("# number of points") != std::string::npos) + { + std::istringstream(line) >> declared_points; + found_declaration = true; + break; + } + } + ASSERT_TRUE(found_declaration); EXPECT_EQ(declared_points, 2526); std::getline(rows, line); // column names int row_count = 0; diff --git a/source/source_io/module_dos/unittests/test_write_pdos_text.cpp b/source/source_io/module_dos/unittests/test_write_pdos_text.cpp index add0fa08007..6baccffb0f6 100644 --- a/source/source_io/module_dos/unittests/test_write_pdos_text.cpp +++ b/source/source_io/module_dos/unittests/test_write_pdos_text.cpp @@ -60,6 +60,8 @@ class WritePdosTextTest : public ::testing::Test delete ucell; } + std::ofstream log; // running log of the writer under test + std::string read_file(const std::string& fname) { std::ifstream ifs(fname); @@ -72,7 +74,7 @@ class WritePdosTextTest : public ::testing::Test // Spin-unpolarized: writes pdoss1.txt with s and 3 p columns. TEST_F(WritePdosTextTest, BasicOutput) { - GlobalV::ofs_running.open("test_write_pdos_text.log"); + log.open("test_write_pdos_text.log"); const int nspin = 1; const int nlocal = 4; @@ -93,7 +95,7 @@ TEST_F(WritePdosTextTest, BasicOutput) } ModuleIO::write_pdos_text(*ucell, &pdos, nspin, nlocal, npoints, - emin, dos_edelta_ev, out_dir, istep, 0); + emin, dos_edelta_ev, out_dir, istep, 0, log); const std::string str = read_file("./pdoss1.txt"); @@ -109,7 +111,7 @@ TEST_F(WritePdosTextTest, BasicOutput) EXPECT_THAT(str, testing::HasSubstr(" 1.000000 1 Si 4.000000 104.000000 204.000000 304.000000")); remove("./pdoss1.txt"); - GlobalV::ofs_running.close(); + log.close(); remove("test_write_pdos_text.log"); } @@ -117,7 +119,7 @@ TEST_F(WritePdosTextTest, BasicOutput) // the record header. TEST_F(WritePdosTextTest, Mode0FixedNameWithStep) { - GlobalV::ofs_running.open("test_write_pdos_text.log"); + log.open("test_write_pdos_text.log"); const int nspin = 1; const int nlocal = 4; @@ -128,20 +130,20 @@ TEST_F(WritePdosTextTest, Mode0FixedNameWithStep) pdos.zero_out(); ModuleIO::write_pdos_text(*ucell, &pdos, nspin, nlocal, npoints, - emin, dos_edelta_ev, "./", 2, 0); + emin, dos_edelta_ev, "./", 2, 0, log); const std::string str = read_file("./pdoss1.txt"); - EXPECT_THAT(str, testing::HasSubstr("# istep: 3")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 3")); remove("./pdoss1.txt"); - GlobalV::ofs_running.close(); + log.close(); remove("test_write_pdos_text.log"); } // Spin-polarized (nspin=2): writes two files, pdos[is] per spin channel. TEST_F(WritePdosTextTest, SpinPolarized) { - GlobalV::ofs_running.open("test_write_pdos_text.log"); + log.open("test_write_pdos_text.log"); const int nspin = 2; const int nlocal = 4; @@ -164,7 +166,7 @@ TEST_F(WritePdosTextTest, SpinPolarized) } ModuleIO::write_pdos_text(*ucell, pdos_arr, nspin, nlocal, npoints, - emin, dos_edelta_ev, "./", -1, 0); + emin, dos_edelta_ev, "./", -1, 0, log); const std::string s1 = read_file("./pdoss1.txt"); const std::string s2 = read_file("./pdoss2.txt"); @@ -175,7 +177,7 @@ TEST_F(WritePdosTextTest, SpinPolarized) remove("./pdoss1.txt"); remove("./pdoss2.txt"); - GlobalV::ofs_running.close(); + log.close(); remove("test_write_pdos_text.log"); } @@ -184,7 +186,7 @@ TEST_F(WritePdosTextTest, SpinPolarized) // --------------------------------------------------------------------------- TEST_F(WritePdosTextTest, Mode1FixedNameAppend) { - GlobalV::ofs_running.open("test_write_pdos_text.log"); + log.open("test_write_pdos_text.log"); const int nspin = 1; const int nlocal = 4; @@ -198,21 +200,21 @@ TEST_F(WritePdosTextTest, Mode1FixedNameAppend) // First call: istep=0, mode 1 -> fixed name pdoss1.txt. ModuleIO::write_pdos_text(*ucell, &pdos, nspin, nlocal, npoints, - emin, dos_edelta_ev, "./", /*istep=*/0, out_app_flag); + emin, dos_edelta_ev, "./", /*istep=*/0, out_app_flag, log); // Second call: istep=1, mode 1 -> append to same file. ModuleIO::write_pdos_text(*ucell, &pdos, nspin, nlocal, npoints, - emin, dos_edelta_ev, "./", /*istep=*/1, out_app_flag); + emin, dos_edelta_ev, "./", /*istep=*/1, out_app_flag, log); const std::string str = read_file("./pdoss1.txt"); - // Two istep headers present -> two appended records. - EXPECT_THAT(str, testing::HasSubstr("# istep: 1")); - EXPECT_THAT(str, testing::HasSubstr("# istep: 2")); + // Two Ionic_Step headers present -> two appended records. + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 1")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 2")); // g-suffixed file must NOT exist. std::ifstream ifs("./pdoss1g1.txt"); EXPECT_FALSE(ifs.good()); remove("./pdoss1.txt"); - GlobalV::ofs_running.close(); + log.close(); remove("test_write_pdos_text.log"); } @@ -221,7 +223,7 @@ TEST_F(WritePdosTextTest, Mode1FixedNameAppend) // --------------------------------------------------------------------------- TEST_F(WritePdosTextTest, Mode2PerStepFile) { - GlobalV::ofs_running.open("test_write_pdos_text.log"); + log.open("test_write_pdos_text.log"); const int nspin = 1; const int nlocal = 4; @@ -233,12 +235,12 @@ TEST_F(WritePdosTextTest, Mode2PerStepFile) pdos.zero_out(); ModuleIO::write_pdos_text(*ucell, &pdos, nspin, nlocal, npoints, - emin, dos_edelta_ev, "./", 3, out_app_flag); + emin, dos_edelta_ev, "./", 3, out_app_flag, log); const std::string str = read_file("./pdoss1g4.txt"); - EXPECT_THAT(str, testing::HasSubstr("# istep: 4")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 4")); remove("./pdoss1g4.txt"); - GlobalV::ofs_running.close(); + log.close(); remove("test_write_pdos_text.log"); } diff --git a/source/source_io/module_dos/write_dos_lcao.cpp b/source/source_io/module_dos/write_dos_lcao.cpp index e068430f1e1..f4eaf987da7 100644 --- a/source/source_io/module_dos/write_dos_lcao.cpp +++ b/source/source_io/module_dos/write_dos_lcao.cpp @@ -2,6 +2,8 @@ #include "cal_dos.h" #include "cal_pdos_gamma.h" #include "cal_pdos_multik.h" +#include "source_base/global_variable.h" +#include "source_io/module_output/write_notice.h" namespace ModuleIO { @@ -87,6 +89,11 @@ void write_dos_lcao( istep, out_app_flag, bndpar); + + if (GlobalV::MY_RANK == 0) + { + ModuleIO::write_notice(ofs_running, "DOS", is, nspin, ss.str()); + } } @@ -107,9 +114,10 @@ void write_dos_lcao( out_app_flag, nlocal, nspin, - global_out_dir); + global_out_dir, + ofs_running); - ofs_running << " #DOS CALCULATION ENDS# " << std::endl; + ofs_running << " #DOS CALCULATION ENDS#" << std::endl; return; } diff --git a/source/source_io/module_dos/write_pdos_text.cpp b/source/source_io/module_dos/write_pdos_text.cpp index c3ded7e75c6..f931f94fd0e 100644 --- a/source/source_io/module_dos/write_pdos_text.cpp +++ b/source/source_io/module_dos/write_pdos_text.cpp @@ -1,6 +1,8 @@ #include "write_pdos_text.h" #include "source_base/global_variable.h" +#include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #include #include @@ -18,7 +20,8 @@ void ModuleIO::write_pdos_text( const double& dos_edelta_ev, const std::string& out_dir, const int istep, - const int out_app_flag) + const int out_app_flag, + std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "write_pdos_text"); @@ -32,6 +35,8 @@ void ModuleIO::write_pdos_text( // keep records from a previous run; only later steps (istep > 0) append. const int istep_file = (out_app_flag == 2) ? istep : -1; const bool append_step = (out_app_flag == 1) && (istep > 0); + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; for (int is = 0; is < nspin0; ++is) { @@ -53,7 +58,7 @@ void ModuleIO::write_pdos_text( // iw2m stores m as 0..2l, mapping to physical m values: // 0->0, 1->+1, 2->-1, 3->+2, 4->-2, 5->+3, 6->-3 // So columns are ordered: s, p(m=0,+1,-1), d(m=0,+1,-1,+2,-2), f(...) - ofs << "# istep: " << istep + 1 << std::endl; + ofs << ModuleIO::prov_step(istep_one_based, time_stamp); ofs << "# npoints: " << npoints << std::endl; ofs << "# energy(eV) atom species pdos(1/eV), columns: s(m=0) p(m=0,+1,-1) d(m=0,+1,-1,+2,-2) f(m=0,+1,-1,+2,-2,+3,-3)" << std::endl; @@ -136,5 +141,7 @@ void ModuleIO::write_pdos_text( } ofs.close(); + + ModuleIO::write_notice(ofs_running, "PDOS", is, nspin, ss.str()); } } diff --git a/source/source_io/module_dos/write_pdos_text.h b/source/source_io/module_dos/write_pdos_text.h index 434c6f7ebe9..8f20b5061c3 100644 --- a/source/source_io/module_dos/write_pdos_text.h +++ b/source/source_io/module_dos/write_pdos_text.h @@ -4,6 +4,8 @@ #include "source_base/matrix.h" #include "source_cell/unitcell.h" +#include + namespace ModuleIO { @@ -21,7 +23,8 @@ void write_pdos_text( const double& dos_edelta_ev, const std::string& out_dir, const int istep, - const int out_app_flag); + const int out_app_flag, + std::ofstream& ofs_running); } diff --git a/source/source_io/module_elf/write_elf.cpp b/source/source_io/module_elf/write_elf.cpp index 911c6cb47a1..c2601a98251 100644 --- a/source/source_io/module_elf/write_elf.cpp +++ b/source/source_io/module_elf/write_elf.cpp @@ -199,7 +199,7 @@ void write_elf( + std::to_string(is + 1) + geom_block + ".cube"; // nspin==4 never reaches this branch (only elftot is written), the magnetic label is a placeholder. - const std::string desc_elf = ModuleIO::make_data_desc("electron localization function", "electron localization function magnetization m", is, nspin); + const std::string desc_elf = ModuleIO::make_data_desc("Electron localization function", "Electron localization function magnetization m", is, nspin); ModuleIO::write_vdata_palgrid(pgrid, elf[is].data(), diff --git a/source/source_io/module_energy/write_bands.cpp b/source/source_io/module_energy/write_bands.cpp index 6d6880aa33f..5e65746a06b 100644 --- a/source/source_io/module_energy/write_bands.cpp +++ b/source/source_io/module_energy/write_bands.cpp @@ -1,6 +1,7 @@ #include "write_bands.h" #include "source_base/formatter.h" +#include "source_base/fs_compat.h" // use ModuleBase::ensure_directory #include "source_base/global_function.h" #include "source_base/global_variable.h" #include "source_base/module_parallel/para_band_output.h" @@ -9,6 +10,7 @@ #include "source_base/tool_title.h" #include "source_io/module_output/provenance_header.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_io/module_parameter/parameter.h" // mohan add 20250911 #ifdef __MPI @@ -29,18 +31,20 @@ namespace std::string build_band_header(const int istep, const std::string& spin_tag) { const int istep_one_based = istep + 1; - const std::string step_line = FmtCore::format("# IONIC STEP %d%s\n", istep_one_based, spin_tag.c_str()); + const std::string step_line = FmtCore::format("# Ionic_Step %d%s\n", istep_one_based, spin_tag.c_str()); return ModuleIO::provenance_header(ModuleIO::local_timestamp()) + step_line; } } // namespace void ModuleIO::write_bands(const Input_para& inp, const ModuleBase::matrix& ekb, const K_Vectors& kv, - std::ofstream& ofs_running, const int istep) + std::ofstream& ofs_running, const std::string& band_dir, const int istep) { // write band information to band.txt if (inp.out_band[0]) { + // Mode-2 BANDS/ subdirectory is created lazily at write time. + ModuleBase::ensure_directory(band_dir); // Taoni fix out_band under bndpar on 2026-08-21 const Parallel::ParaBandOutput band_output(ekb.nc, inp.nbands, Parallel::make_band_world()); const ModuleBase::matrix global_ekb = band_output.gather_matrix(ekb); @@ -48,7 +52,7 @@ void ModuleIO::write_bands(const Input_para& inp, const ModuleBase::matrix& ekb, for (int is = 0; is < nspin0; is++) { std::stringstream ss; - ss << PARAM.globalv.global_out_dir << "band"; + ss << band_dir << "band"; if (nspin0 == 1) { @@ -59,11 +63,15 @@ void ModuleIO::write_bands(const Input_para& inp, const ModuleBase::matrix& ekb, ss << "s" << is + 1; } + if (inp.out_app_flag == 2) + { + ss << "g" << istep + 1; + } + ss << ".txt"; const std::string eig_file = ss.str(); - const std::string log_spin_tag = ModuleIO::make_spin_tag(is, nspin0); - ofs_running << " Write eigenvalues" << log_spin_tag << " to file: " << eig_file << std::endl; + ModuleIO::write_notice(ofs_running, "Eigenvalues", is, nspin0, eig_file); const std::string header_spin_tag = ModuleIO::make_compact_spin_tag(is, nspin0); const std::string header = build_band_header(istep, header_spin_tag); @@ -75,7 +83,8 @@ void ModuleIO::write_bands(const Input_para& inp, const ModuleBase::matrix& ekb, inp.out_band[1], // precision global_ekb, kv, - header); + header, + inp.out_app_flag); } } } @@ -87,7 +96,8 @@ void ModuleIO::nscf_bands(const int& is, const int& precision, const ModuleBase::matrix& ekb, const K_Vectors& kv, - const std::string& header) + const std::string& header, + const int out_app_flag) { ModuleBase::TITLE("ModuleIO", "nscf_bands"); ModuleBase::timer::start("ModuleIO", "nscf_bands"); @@ -114,7 +124,7 @@ void ModuleIO::nscf_bands(const int& is, const int band_group = Parallel::make_band_world().rank(); if (GlobalV::MY_RANK == 0) { - if (PARAM.inp.out_app_flag == 1) + if (out_app_flag == 1) { // do nothing } @@ -178,7 +188,7 @@ void ModuleIO::nscf_bands(const int& is, if (GlobalV::MY_RANK == 0) { - if (PARAM.inp.out_app_flag == 1) + if (out_app_flag == 1) { ofs.open(eig_file.c_str(), std::ios::app); } diff --git a/source/source_io/module_energy/write_bands.h b/source/source_io/module_energy/write_bands.h index 39b912498e5..5e4543eaf01 100644 --- a/source/source_io/module_energy/write_bands.h +++ b/source/source_io/module_energy/write_bands.h @@ -20,6 +20,8 @@ namespace ModuleIO * @param ekb eigenvalues of k points and bands * @param kv klist * @param ofs_running running log stream + * @param band_dir directory that receives the band output files; the caller + * resolves it from the output directory configuration * @param istep zero-based index of the current ionic step, printed one-based * in the per-step provenance header */ @@ -27,6 +29,7 @@ void write_bands(const Input_para& inp, const ModuleBase::matrix& ekb, const K_Vectors& kv, std::ofstream& ofs_running, + const std::string& band_dir, const int istep); /** @@ -41,6 +44,7 @@ void write_bands(const Input_para& inp, * @param kv klist * @param header provenance header written once in front of the k-point block; * pass an empty string to omit it + * @param out_app_flag output append mode: 0 = truncate, 1 = append */ void nscf_bands(const int& is, const std::string &eig_file, @@ -49,7 +53,8 @@ void nscf_bands(const int& is, const int& precision, const ModuleBase::matrix& ekb, const K_Vectors& kv, - const std::string& header); + const std::string& header, + const int out_app_flag); } #endif diff --git a/source/source_io/module_energy/write_eband_terms.cpp b/source/source_io/module_energy/write_eband_terms.cpp index f6b78505e38..3c22a6cade5 100644 --- a/source/source_io/module_energy/write_eband_terms.cpp +++ b/source/source_io/module_energy/write_eband_terms.cpp @@ -2,6 +2,7 @@ #include "source_io/module_hs/vxc_op_tools.h" #include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #include "source_io/module_parameter/parameter.h" #include "source_lcao/module_operator_lcao/ekinetic.h" #include "source_lcao/module_operator_lcao/nonlocal.h" @@ -29,6 +30,7 @@ namespace ModuleIO template void write_eband_terms(const int nspin, const int istep, + const int out_app_flag, const double etot, const int my_rank, const int nbasis, @@ -46,7 +48,8 @@ void write_eband_terms(const int nspin, Grid_Driver& gd, const std::vector& orb_cutoff, const LCAO_Orbitals& orb, - const TwoCenterBundle& two_center_bundle + const TwoCenterBundle& two_center_bundle, + std::ofstream& ofs_running ) { // 0. prepare @@ -71,7 +74,7 @@ void write_eband_terms(const int nspin, // Only rank 0 writes; the orbital energies above are reduced on all ranks. auto write_term = [&](const std::vector>& e_orb, - const std::string& out_name, + const std::string& out_stem, const std::string& term_symbol) { if (my_rank != 0) @@ -80,7 +83,14 @@ void write_eband_terms(const int nspin, } const std::string header = build_eband_header(istep, etot_eV, term_symbol, time_stamp); const std::string& out_dir = PARAM.globalv.global_out_dir; - write_orb_energy(kv, nspin0, nbands, e_orb, out_name, header, out_dir); + const std::string out_name = eband_filename(out_stem, istep, out_app_flag); + // Mode 1 appends the frames written after the first ionic step; + // modes 0 and 2 truncate (mode 2 writes a separate g{step} file). + const bool append = (out_app_flag == 1) && (istep > 0); + write_orb_energy(kv, nspin0, nbands, e_orb, out_name, header, out_dir, append); + const std::string property = "Band-decomposed " + term_symbol + " energy"; + const std::string out_path = out_dir + out_name; + ModuleIO::write_notice(ofs_running, property, out_path); }; auto all_band_energy = [&wg](const int ik, const std::vector& e_orb)->double @@ -128,7 +138,7 @@ void write_eband_terms(const int nspin, cVc(kinetic_k_ao.get_hk(), &psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d)); } - write_term(e_orb_kinetic, "eband_kin.txt", "T"); + write_term(e_orb_kinetic, "eband_kin", "T"); } // 2. pp: local @@ -160,7 +170,7 @@ void write_eband_terms(const int nspin, e_orb_pp_local.emplace_back(orbital_energy(ik, nbands, cVc(v_pp_local_k_ao.get_hk(), &psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d)); } - write_term(e_orb_pp_local, "eband_vl.txt", "V_loc"); + write_term(e_orb_pp_local, "eband_vl", "V_loc"); } // 3. pp: nonlocal @@ -180,7 +190,7 @@ void write_eband_terms(const int nspin, e_orb_pp_nonlocal.emplace_back(orbital_energy(ik, nbands, cVc(v_pp_nonlocal_k_ao.get_hk(), &psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d)); } - write_term(e_orb_pp_nonlocal, "eband_vnl.txt", "V_nonlocal"); + write_term(e_orb_pp_nonlocal, "eband_vnl", "V_nonlocal"); } // 4. hartree @@ -213,33 +223,33 @@ void write_eband_terms(const int nspin, cVc(v_hartree_k_ao.get_hk(), &psi(ik, 0, 0), nbasis, nbands, *pv, p2d), p2d)); } for (auto& op : v_hartree_op) { delete op; } - write_term(e_orb_hartree, "eband_hart.txt", "V_H"); + write_term(e_orb_hartree, "eband_hart", "V_H"); } // NOTE: the XC term (eband_vxc.txt etc.) is written by write_Vxc from - // ctrl_runner_lcao.cpp for both out_mat_xc and out_eband, + // ctrl_scf_lcao.cpp for both out_mat_xc and out_eband, // so it is intentionally not handled here. } // Explicit template instantiations template void write_eband_terms( - const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi&, + const int, const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const ModuleBase::matrix&, Grid_Driver&, - const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle& + const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle&, std::ofstream& ); template void write_eband_terms, double>( - const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, + const int, const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const ModuleBase::matrix&, Grid_Driver&, - const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle& + const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle&, std::ofstream& ); template void write_eband_terms, std::complex>( - const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, + const int, const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const ModuleBase::matrix&, Grid_Driver&, - const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle& + const std::vector&, const LCAO_Orbitals&, const TwoCenterBundle&, std::ofstream& ); } // namespace ModuleIO diff --git a/source/source_io/module_energy/write_eband_terms.h b/source/source_io/module_energy/write_eband_terms.h index c2adf9b9d3a..e0b5d72b914 100644 --- a/source/source_io/module_energy/write_eband_terms.h +++ b/source/source_io/module_energy/write_eband_terms.h @@ -4,6 +4,7 @@ #include "source_base/matrix.h" #include "source_psi/psi.h" +#include #include class Grid_Driver; @@ -26,9 +27,11 @@ namespace ModuleIO /// @brief Write the band-decomposed energy of each Hamiltonian term /// (kinetic, local/nonlocal pp, Hartree) in KS orbital representation. -/// The XC term is handled by write_Vxc in ctrl_runner_lcao.cpp instead. +/// The XC term is handled by write_Vxc from ctrl_scf_lcao.cpp instead. /// @param nspin Number of spin components (1, 2 or 4) /// @param istep Zero-based ionic step index; written one-based in the header +/// @param out_app_flag Output mode: 0 overwrites, 1 appends, 2 writes one +/// numbered eband_*g{step}.txt file per written step /// @param etot Total energy of the current frame in Ry /// @param my_rank World rank; only rank 0 writes the files /// @tparam TK K-point data type (double or std::complex) @@ -36,6 +39,7 @@ namespace ModuleIO template void write_eband_terms(const int nspin, const int istep, + const int out_app_flag, const double etot, const int my_rank, const int nbasis, @@ -53,7 +57,8 @@ void write_eband_terms(const int nspin, Grid_Driver& gd, const std::vector& orb_cutoff, const LCAO_Orbitals& orb, - const TwoCenterBundle& two_center_bundle + const TwoCenterBundle& two_center_bundle, + std::ofstream& ofs_running ); } // namespace ModuleIO diff --git a/source/source_io/module_energy/write_eig_occ.cpp b/source/source_io/module_energy/write_eig_occ.cpp index 79c9be48797..e9679b1fd01 100644 --- a/source/source_io/module_energy/write_eig_occ.cpp +++ b/source/source_io/module_energy/write_eig_occ.cpp @@ -7,6 +7,8 @@ #include "source_base/global_variable.h" #include "source_base/timer.h" #include "source_base/parallel_comm.h" // use POOL_WORLD +#include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #ifdef __MPI #include // use MPI_Barrier @@ -170,7 +172,8 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb, const int nbands, const int nspin, const std::string& out_dir, - const int istep) + const int istep, + const int out_app_flag) { ModuleBase::TITLE("ModuleIO","write_eig_file"); ModuleBase::timer::start("ModuleIO", "write_eig_file"); @@ -221,16 +224,28 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb, #endif // file name to store eigenvalues - std::string filename = out_dir + "eig_occ.txt"; + // Modes 0 and 1 reuse the fixed filename (mode 0 overwrites, mode 1 appends + // each written step); only mode 2 embeds the one-based step number. + std::string filename = out_dir + "eig_occ"; + if (out_app_flag == 2) + { + filename += "g" + std::to_string(istep + 1); + } + filename += ".txt"; + + ModuleIO::write_notice(GlobalV::ofs_running, "Eigenvalues and occupations", filename); - GlobalV::ofs_running << " Write eigenvalues and occupations to file: " << filename << std::endl; + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; if (GlobalV::MY_RANK == 0) { std::ofstream ofs_eig0; const auto& inp = PARAM.inp; - const bool append = istep > 0 - || (inp.calculation == "md" && inp.mdp.md_restart); + // A restart of an MD run keeps the records of the previous run in + // mode 1; every other first-step write truncates the fixed file. + const bool restart_append = (inp.calculation == "md" && inp.mdp.md_restart); + const bool append = (out_app_flag == 1) && (istep > 0 || restart_append); if (append) { @@ -241,7 +256,7 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb, ofs_eig0.open(filename.c_str()); } - ofs_eig0 << istep+1 << " # ionic step" << std::endl; + ofs_eig0 << ModuleIO::prov_step(istep_one_based, time_stamp); ofs_eig0 << " Electronic state energy (eV) and occupations" << std::endl; ofs_eig0 << " Spin number " << nspin << std::endl; ofs_eig0.close(); diff --git a/source/source_io/module_energy/write_eig_occ.h b/source/source_io/module_energy/write_eig_occ.h index 5a39a26f661..47c0d1464a3 100644 --- a/source/source_io/module_energy/write_eig_occ.h +++ b/source/source_io/module_energy/write_eig_occ.h @@ -20,13 +20,18 @@ namespace ModuleIO /// @param nbands number of bands requested by INPUT /// @param nspin number of spin channels /// @param out_dir directory the file is written into + /// @param istep zero-based ionic step index; printed one-based and used for + /// the g{step} filename suffix in out_app_flag mode 2 + /// @param out_app_flag output mode: 0 overwrites, 1 appends, 2 writes one + /// numbered file per written step void write_eig_file(const ModuleBase::matrix &ekb, const ModuleBase::matrix &wg, const K_Vectors& kv, const int nbands, const int nspin, const std::string& out_dir, - const int istep); + const int istep, + const int out_app_flag); } #endif diff --git a/source/source_io/module_energy/write_proj_band_lcao.cpp b/source/source_io/module_energy/write_proj_band_lcao.cpp index 2bb2a1b58d3..5948b1f04ea 100644 --- a/source/source_io/module_energy/write_proj_band_lcao.cpp +++ b/source/source_io/module_energy/write_proj_band_lcao.cpp @@ -6,7 +6,7 @@ #include "source_base/module_external/scalapack_connector.h" #include "source_base/timer.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" -#include "source_io/module_output/write_orb_info.h" +#include "source_io/module_output/write_notice.h" #include "source_lcao/hamilt_lcao.h" template<> @@ -16,7 +16,9 @@ void ModuleIO::write_proj_band_lcao( const elecstate::ElecState* pelec, const K_Vectors& kv, const UnitCell &ucell, - hamilt::Hamilt* p_ham) + hamilt::Hamilt* p_ham, + const int istep, + const int out_app_flag) { ModuleBase::TITLE("ModuleIO", "write_proj_band_lcao"); ModuleBase::timer::start("ModuleIO", "write_proj_band_lcao"); @@ -108,11 +110,20 @@ void ModuleIO::write_proj_band_lcao( if (GlobalV::MY_RANK == 0) { std::stringstream ps2; - ps2 << PARAM.globalv.global_out_dir << "pbands" << is + 1 << ".xml"; - GlobalV::ofs_running << " Output projected bands are in file: " << ps2.str() << std::endl; + ps2 << PARAM.globalv.global_out_dir << "pbands" << is + 1; + // XML documents cannot be appended, so mode 1 keeps the fixed name + // and overwrites; only mode 2 writes one numbered file per step. + if (out_app_flag == 2) + { + ps2 << "g" << istep + 1; + } + ps2 << ".xml"; + ModuleIO::write_notice(GlobalV::ofs_running, "Projected bands", ps2.str()); std::ofstream out(ps2.str().c_str()); out << "" << std::endl; + // XML comment keeps the frame annotation invisible to XML parsers. + out << "" << std::endl; out << "" << PARAM.inp.nspin << "" << std::endl; if (PARAM.inp.nspin == 4) { @@ -176,7 +187,6 @@ void ModuleIO::write_proj_band_lcao( out.close(); } } // is - ModuleIO::write_orb_info(&ucell); ModuleBase::timer::end("ModuleIO", "write_proj_band_lcao"); return; @@ -189,7 +199,9 @@ void ModuleIO::write_proj_band_lcao( const elecstate::ElecState* pelec, const K_Vectors& kv, const UnitCell& ucell, - hamilt::Hamilt>* p_ham) + hamilt::Hamilt>* p_ham, + const int istep, + const int out_app_flag) { ModuleBase::TITLE("ModuleIO", "write_proj_band_lcao"); ModuleBase::timer::start("ModuleIO", "write_proj_band_lcao"); @@ -197,7 +209,7 @@ void ModuleIO::write_proj_band_lcao( GlobalV::ofs_running << "\n"; GlobalV::ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; GlobalV::ofs_running << " | |" << std::endl; - GlobalV::ofs_running << " | #Print out projected bands (psi in std::complex)# |" << std::endl; + GlobalV::ofs_running << " | #Print out projected bands (psi in std::complex)# |" << std::endl; GlobalV::ofs_running << " | |" << std::endl; GlobalV::ofs_running << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl; GlobalV::ofs_running << "\n"; @@ -313,11 +325,20 @@ void ModuleIO::write_proj_band_lcao( if (GlobalV::MY_RANK == 0) { std::stringstream ps2; - ps2 << PARAM.globalv.global_out_dir << "pbands" << is + 1 << ".xml"; - GlobalV::ofs_running << " Output projected bands in file: " << ps2.str() << std::endl; + ps2 << PARAM.globalv.global_out_dir << "pbands" << is + 1; + // XML documents cannot be appended, so mode 1 keeps the fixed name + // and overwrites; only mode 2 writes one numbered file per step. + if (out_app_flag == 2) + { + ps2 << "g" << istep + 1; + } + ps2 << ".xml"; + ModuleIO::write_notice(GlobalV::ofs_running, "Projected bands", ps2.str()); std::ofstream out(ps2.str().c_str()); out << "" << std::endl; + // XML comment keeps the frame annotation invisible to XML parsers. + out << "" << std::endl; out << "" << PARAM.inp.nspin << "" << std::endl; if (PARAM.inp.nspin == 4) { @@ -394,7 +415,6 @@ void ModuleIO::write_proj_band_lcao( out.close(); } } // is - ModuleIO::write_orb_info(&ucell); ModuleBase::timer::end("ModuleIO", "write_proj_band_lcao"); return; diff --git a/source/source_io/module_energy/write_proj_band_lcao.h b/source/source_io/module_energy/write_proj_band_lcao.h index 3dd4cfa8c4c..c9dfab96913 100644 --- a/source/source_io/module_energy/write_proj_band_lcao.h +++ b/source/source_io/module_energy/write_proj_band_lcao.h @@ -9,6 +9,10 @@ namespace ModuleIO { + /// @param ucell Unit cell + /// @param p_ham Hamiltonian used to build the projection overlaps + /// @param istep Zero-based ionic step index; written one-based + /// @param out_app_flag Output mode: 2 writes pbands{spin}g{step}.xml template void write_proj_band_lcao( const psi::Psi* psi, @@ -16,7 +20,9 @@ namespace ModuleIO const elecstate::ElecState* pelec, const K_Vectors& kv, const UnitCell &ucell, - hamilt::Hamilt* p_ham); + hamilt::Hamilt* p_ham, + const int istep, + const int out_app_flag); } #endif diff --git a/source/source_io/module_hs/angmom_op_mat.cpp b/source/source_io/module_hs/angmom_op_mat.cpp index eb094f0c147..306b2cf0345 100644 --- a/source/source_io/module_hs/angmom_op_mat.cpp +++ b/source/source_io/module_hs/angmom_op_mat.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -12,7 +13,9 @@ #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" #include "source_io/module_hs/angmom_op_mat.h" -#include "source_base/formatter.h" +#include "source_io/module_hs/hs_sparse_io.h" +#include "source_io/module_hs/hs_sparse_io_detail.h" +#include "source_io/module_output/write_notice.h" #include "source_base/parallel_common.h" #include "source_base/timer.h" /** @@ -53,6 +56,160 @@ const double kInvSqrt2 = std::sqrt(2) * 0.5; /// sparse threshold (1e-10) because this guards an analytical /// zero (m at extremal value), not a numerical matrix element. constexpr double kCoeffZeroThreshold = 1e-12; + +/// @brief Elements with a magnitude below this value are omitted from the +/// CSR output, matching the threshold used by the other sparse +/// matrix writers. +constexpr double kLMatrixThreshold = 1e-10; + +/** + * @brief Map a signed magnetic quantum number to its position inside one + * angular-momentum block. + * @details ABACUS orders the real spherical harmonics as + * 0, +1, -1, +2, -2, ... (see Ylm::get_ylm_real and + * TwoCenterIntegrator::snap), so the position is 0 for m = 0, + * 2m - 1 for m > 0 and -2m for m < 0. + * @param m Signed magnetic quantum number. + * @return Zero-based position inside the (2l+1)-dimensional block. + */ +int signed_m_to_position(const int m) +{ + if (m > 0) + { + return 2 * m - 1; + } + if (m < 0) + { + return -2 * m; + } + return 0; +} + +/** + * @brief First local orbital index of every angular-momentum block of one atom. + * @details For each l the atom stores l_nchi[l] radial functions, each carrying + * 2l+1 real spherical harmonics. The returned vector holds the offset + * of block l, so that the local orbital index of a given (l, iz, m) is + * offset[l] + iz * (2l+1) + signed_m_to_position(m). + * @param atom Atom whose orbital layout is inspected. + * @return Offsets indexed by l, with atom.nwl + 1 entries. + */ +std::vector orbital_block_offsets(const Atom& atom) +{ + std::vector offsets(atom.nwl + 1, 0); + for (int l = 0; l < atom.nwl; ++l) + { + const int block_size = atom.l_nchi[l] * (2 * l + 1); + offsets[l + 1] = offsets[l] + block_size; + } + return offsets; +} + +/** + * @brief Assemble one component of L(R) into a real sparse R matrix. + * @details The two-center integrals are evaluated on the fly for every + * neighboring atom pair; the resulting matrix elements are stored + * under the global NAO orbital indices of the two centers. Only + * entries above kLMatrixThreshold are kept. + * + * Since the NAO basis is real, L = -i r x grad gives matrix elements + * that are purely imaginary, so only the imaginary part is recorded. + * @param calculator Two-center integrator. + * @param neighbor_searcher Neighbor list driver. + * @param matrix Output sparse matrix keyed by R coordinate; entries hold the + * imaginary part of . + * @param all_R_coor Output set of R coordinates encountered during the scan. + * @param ucell Unit cell. + * @param dir Angular-momentum component, 'x', 'y' or 'z'. + */ +void assemble_angular_momentum( + const std::unique_ptr& calculator, + Grid_Driver& neighbor_searcher, + ModuleIO::SparseRMatrix& matrix, + std::set& all_R_coor, + const UnitCell& ucell, + const char dir) +{ + const bool valid_dir = (dir == 'x' || dir == 'y' || dir == 'z'); + assert(valid_dir); + + std::complex val = 0; + ModuleBase::Vector3 taui; + ModuleBase::Vector3 dtau; + AdjacentAtomInfo adjinfo; + for (int it = 0; it < ucell.ntype; it++) + { + const Atom& atyp_i = ucell.atoms[it]; + const std::vector offsets_i = orbital_block_offsets(atyp_i); + for (int ia = 0; ia < atyp_i.na; ia++) + { + const int iat_i = ucell.itia2iat(it, ia); + taui = ucell.get_tau(iat_i); + neighbor_searcher.Find_atom(ucell, taui, it, ia, &adjinfo); + for (int ia_adj = 0; ia_adj < adjinfo.adj_num + 1; ia_adj++) + { + const int jt = adjinfo.ntype[ia_adj]; + const int ja = adjinfo.natom[ia_adj]; + const Atom& atyp_j = ucell.atoms[jt]; + const ModuleBase::Vector3 iR = adjinfo.box[ia_adj]; + const int iat_j = ucell.itia2iat(jt, ja); + dtau = ucell.cal_dtau(iat_i, iat_j, iR) * ucell.lat0; + + const ModuleIO::RCoordinate R_coor(iR.x, iR.y, iR.z); + all_R_coor.insert(R_coor); + ModuleIO::SparseRBlock& block = matrix[R_coor]; + + const std::vector offsets_j = orbital_block_offsets(atyp_j); + for (int li = 0; li < atyp_i.nwl + 1; li++) + { + const int block_size_i = 2 * li + 1; + for (int iz = 0; iz < atyp_i.l_nchi[li]; iz++) + { + for (int mi = -li; mi <= li; mi++) + { + const int pos_i = signed_m_to_position(mi); + const int iw_i = offsets_i[li] + iz * block_size_i + pos_i; + const int row = ucell.itiaiw2iwt(it, ia, iw_i); + for (int lj = 0; lj < atyp_j.nwl + 1; lj++) + { + const int block_size_j = 2 * lj + 1; + for (int jz = 0; jz < atyp_j.l_nchi[lj]; jz++) + { + for (int mj = -lj; mj <= lj; mj++) + { + if (dir == 'x') + { + val = ModuleIO::cal_LxijR(calculator, + it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); + } + else if (dir == 'y') + { + val = ModuleIO::cal_LyijR(calculator, + it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); + } + else + { + val = ModuleIO::cal_LzijR(calculator, + it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); + } + + if (std::fabs(val.imag()) > kLMatrixThreshold) + { + const int pos_j = signed_m_to_position(mj); + const int iw_j = offsets_j[lj] + jz * block_size_j + pos_j; + const int col = ucell.itiaiw2iwt(jt, ja, iw_j); + block[row][col] = val.imag(); + } + } + } + } + } + } + } + } + } + } +} } // namespace std::complex ModuleIO::cal_LzijR( @@ -282,102 +439,11 @@ ModuleIO::Angmom_op::Angmom_op( tatom); } -void ModuleIO::Angmom_op::kernel( - std::ofstream* ofs, - const UnitCell& ucell, - const char dir, - const int precision) -{ - if (ofs == nullptr || !ofs->is_open()) - { - return; - } - // an easy sanity check - assert(dir == 'x' || dir == 'y' || dir == 'z'); - - // it, ia, il, iz, im, iRx, iRy, iRz, jt, ja, jl, jz, jm - // the iRx, iRy, iRz are the indices of the supercell in which the two-center-integral - // it and jt are indexes of atomtypes, - // ia and ja are indexes of atoms within the atomtypes, - // il and jl are indexes of the angular momentum, - // iz and jz are indexes of the zeta functions - // im and jm are indexes of the magnetic quantum numbers. - std::string fmtstr = "%4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d %4d"; - fmtstr += " %" + std::to_string(precision*2) + "." + std::to_string(precision) + "e"; - fmtstr += " %" + std::to_string(precision*2) + "." + std::to_string(precision) + "e\n"; - FmtCore fmt(fmtstr); - - // placeholders - std::complex val = 0; - ModuleBase::Vector3 taui; // the origin position - ModuleBase::Vector3 dtau; // the displacement - AdjacentAtomInfo adjinfo; // adjacent atom information carrier - for (int it = 0; it < ucell.ntype; it++) - { - const Atom& atyp_i = ucell.atoms[it]; - for (int ia = 0; ia < atyp_i.na; ia++) - { - taui = ucell.get_tau(ucell.itia2iat(it, ia)); - neighbor_searcher_->Find_atom(ucell, taui, it, ia, &adjinfo); - for (int ia_adj = 0; ia_adj < adjinfo.adj_num + 1; ia_adj++) // "+1" is to include itself - { - int jt = adjinfo.ntype[ia_adj]; // ityp - int ja = adjinfo.natom[ia_adj]; // iat with in atomtype - const Atom& atyp_j = ucell.atoms[jt]; - const ModuleBase::Vector3 iR = adjinfo.box[ia_adj]; - dtau = ucell.cal_dtau(ucell.itia2iat(it, ia), - ucell.itia2iat(jt, ja), - iR) * ucell.lat0; // convert to unit of Bohr - - // nested loop: calculate the two-center-integral - for (int li = 0; li < atyp_i.nwl + 1; li++) - { - for (int iz = 0; iz < atyp_i.l_nchi[li]; iz++) - { - for (int mi = -li; mi <= li; mi++) - { - for (int lj = 0; lj < atyp_j.nwl + 1; lj++) - { - for (int jz = 0; jz < atyp_j.l_nchi[lj]; jz++) - { - for (int mj = -lj; mj <= lj; mj++) - { - if (dir == 'x') - { - val = cal_LxijR(calculator_, - it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); - } - else if (dir == 'y') - { - val = cal_LyijR(calculator_, - it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); - } - else if (dir == 'z') - { - val = cal_LzijR(calculator_, - it, ia, li, iz, mi, jt, ja, lj, jz, mj, dtau); - } - - *ofs << fmt.format( - it, ia, li, iz, mi, - iR.x, iR.y, iR.z, - jt, ja, lj, jz, mj, - val.real(), val.imag()); - } - } - } - } - } - } - } - } - } -} - void ModuleIO::Angmom_op::calculate( const std::string& prefix, const std::string& outdir, const UnitCell& ucell, + const Parallel_Orbitals& pv, const int precision, const int rank, const int istep, @@ -386,47 +452,68 @@ void ModuleIO::Angmom_op::calculate( ModuleBase::TITLE("Angmom_op", "calculate"); ModuleBase::timer::start("Angmom_op", "calculate"); + // The CSR writer below indexes the scalar (npol = 1) real-harmonic basis. + // For nspin = 4 the spinor basis doubles nlocal and uses a different + // magnetic-quantum-number ordering, and L would have to be written as + // L (x) I_2; filling only the scalar block would silently halve any + // contraction with DM(R). This combination is rejected during INPUT + // validation; the check remains here as a defensive guard. + const int npol = ucell.get_npol(); + if (npol != 1) + { + ModuleBase::WARNING_QUIT("Angmom_op::calculate", + "out_mat_l is not supported for nspin = 4 (npol = 2)."); + } + if (rank != 0) { ModuleBase::timer::end("Angmom_op", "calculate"); return; } - std::ofstream ofout; - const std::string dir = "xyz"; + /// @brief Filename suffix: modes 0 and 1 reuse the fixed name (mode 0 /// overwrites, mode 1 appends each written step); only mode 2 /// carries "g{istep+1}" (e.g., "g1") following the out_freq_ion /// convention. - const std::string step_suffix = (istep >= 0 && out_app_flag == 2) ? "g" + std::to_string(istep + 1) : ""; - const bool append_step = (out_app_flag == 1) && (istep > 0); - const std::string title = "# it ia il iz im iRx iRy iRz jt ja jl jz jm Re[] Im[]\n" - "# it: atomtype index of the first atom\n" - "# ia: atomic index of the first atom within the atomtype\n" - "# il: angular momentum index of the first atom\n" - "# iz: zeta function index of the first atom\n" - "# im: magnetic quantum number of the first atom\n" - "# iRx, iRy, iRz: the indices of the supercell\n" - "# jt: atomtype index of the second atom\n" - "# ja: atomic index of the second atom within the atomtype\n" - "# jl: angular momentum index of the second atom\n" - "# jz: zeta function index of the second atom\n" - "# jm: magnetic quantum number of the second atom\n" - "# Re[], Im[]: the real and imaginary parts " - "of the value of the matrix element\n"; - + const bool numbered = (istep >= 0) && (out_app_flag == 2); + const std::string dir = "xyz"; + for (char d : dir) { - std::string fn = outdir + "l" + d + step_suffix + "_nao.txt"; - std::ios_base::openmode mode = std::ios::out; - if (append_step) - { - mode |= std::ios::app; - } - ofout.open(fn, mode); - ofout << title; - this->kernel(&ofout, ucell, d, precision); - ofout.close(); - *ofs_ << " Write L(R) (" << d << " component) matrix in NAO basis to file: " << fn << std::endl; + ModuleIO::SparseRMatrix matrix; + std::set all_R_coor; + assemble_angular_momentum(this->calculator_, + *this->neighbor_searcher_, + matrix, + all_R_coor, + ucell, + d); + + const std::string prefix = std::string("l") + d; + const std::string name = ModuleIO::detail::make_sparse_R_filename(prefix, + "", + numbered, + istep, + ".csr"); + std::string fn = outdir + name; + ModuleIO::SparseWriteOptions options; + options.filename = fn; + options.label = std::string("L") + d; + options.threshold = kLMatrixThreshold; + options.binary = false; + options.precision = precision; + options.istep = istep; + // Rank 0 owns the fully assembled matrix, so no MPI reduction is + // needed and every rank-local entry is already global. + options.reduce = false; + options.out_app_flag = out_app_flag; + options.csr_format = true; + options.ucell = &ucell; + + ModuleIO::save_sparse(matrix, all_R_coor, pv, options); + const std::string property = std::string("L(R) (") + d + " component)"; + ModuleIO::write_matrix_notice(*ofs_, property, fn); } + ModuleBase::timer::end("Angmom_op", "calculate"); } diff --git a/source/source_io/module_hs/angmom_op_mat.h b/source/source_io/module_hs/angmom_op_mat.h index c79a059ff46..725838f0d30 100644 --- a/source/source_io/module_hs/angmom_op_mat.h +++ b/source/source_io/module_hs/angmom_op_mat.h @@ -98,6 +98,8 @@ #include "source_cell/module_neighbor/sltk_grid_driver.h" #include "source_cell/module_neighbor/sltk_atom_arrange.h" +class Parallel_Orbitals; + namespace ModuleIO { /** @@ -175,17 +177,14 @@ namespace ModuleIO const int jt, const int ja, const int jl, const int jz, const int jm, const ModuleBase::Vector3& vR); - // the calculation of matrix elements will be outputted - // in the way that indexed by: - // it, ia, il, iz, im, iRx, iRy, iRz, jt, ja, jl, jz, jm, in which the - // iRx, iRy, iRz are the indices of the supercell in which the two-center-integral - // it and jt are indexes of atomtypes, - // ia and ja are indexes of atoms within the atomtypes, - // il and jl are indexes of the angular momentum, - // iz and jz are indexes of the zeta functions - // im and jm are indexes of the magnetic quantum numbers. - // The output is a complex number, which is the value of the matrix element. - // Always the matrix is quite large, so direct print to file. + // The calculation of matrix elements is written to + // three real CSR files, lx_nao.csr, ly_nao.csr and lz_nao.csr (or + // lxg{istep+1}_nao.csr etc. when out_app_flag = 2). Each R block follows the + // same self-describing header and CSR layout as the H(R)/S(R) output, so + // the values are indexed by the global NAO orbital index (row) and column + // index instead of the (it, ia, il, iz, im ...) tuple. Because the NAO + // basis is real, every matrix element is purely imaginary; the files store + // only the imaginary part, and the real part is identically zero. class Angmom_op { public: @@ -223,20 +222,24 @@ namespace ModuleIO * @brief Calculate and write matrix elements. * * @param prefix the suffix of the output files (currently unused; - * filenames are fixed as l{x,y,z}[g{step}]_nao.txt) + * filenames are fixed as l{x,y,z}[g{step+1}]_nao.csr) * @param outdir the output directory * @param ucell the unit cell object + * @param pv the parallel orbital distribution, used for the global + * basis size of the CSR output * @param precision the precision of the output * @param rank the MPI rank * @param istep the ionic step index; -1 for single-point runs * @param out_app_flag append mode: with 1 the fixed filename - * l{x,y,z}_nao.txt is reused and each step appends; - * with 0 or 2 the filename carries `g{istep+1}` - * (e.g., lxg1_nao.txt) + * l{x,y,z}_nao.csr is reused and each step appends; + * with 2 the filename carries `g{istep+1}` + * (e.g., lxg1_nao.csr); with 0 the fixed filename is + * overwritten at every write */ void calculate(const std::string& prefix, const std::string& outdir, const UnitCell& ucell, + const Parallel_Orbitals& pv, const int precision, const int rank, const int istep, @@ -255,22 +258,6 @@ namespace ModuleIO // neighboring searcher std::unique_ptr neighbor_searcher_; - - /** - * @brief calculate the matrix elements. Due to - * the large size of the matrix, the result will be printed to file - * directly. - * - * @param ofs pointer to the ofstream object for printing, if nullptr, - * the result will not be printed - * @param ucell the unit cell object - * @param dir the direction of the angular momentum operator, 'x', 'y' or 'z' - * @param precision the precision of the output, default is 10 - */ - void kernel(std::ofstream* ofs, - const UnitCell& ucell, - const char dir = 'x', - const int precision = 10); }; } // namespace ModuleIO diff --git a/source/source_io/module_hs/dense_text_body.cpp b/source/source_io/module_hs/dense_text_body.cpp new file mode 100644 index 00000000000..221c94507fc --- /dev/null +++ b/source/source_io/module_hs/dense_text_body.cpp @@ -0,0 +1,117 @@ +#include "dense_text_body.h" + +#include +#include +#include +#include +#include + +namespace +{ +/// Components with a magnitude below this threshold are flushed to zero in the +/// complex body so that numerical noise does not clutter the output. +constexpr double k_dense_text_zero_thr = 1.0e-16; + +/// @brief Flat index of element (i, j) in the row-major file layout. +std::size_t row_major_index(const int i, const int j, const int nlocal) +{ + const std::size_t dim = static_cast(nlocal); + return static_cast(i) * dim + static_cast(j); +} + +/// @brief Flat index of element (i, j) in the gathered buffer. +/// @details A column-major buffer stores (i, j) at j * nlocal + i. +std::size_t source_index(const int i, const int j, const int nlocal, const bool column_major) +{ + return ModuleIO::dense_buffer_index(i, j, nlocal, column_major); +} + +/// @brief Validate the arguments shared by both overloads. +void check_arguments(const std::size_t mat_size, const int nlocal, const int precision) +{ + assert(nlocal > 0); + assert(precision > 0); + const std::size_t expected = static_cast(nlocal) * static_cast(nlocal); + assert(mat_size >= expected); + (void)mat_size; + (void)expected; +} + +/// @brief Apply the common stream formatting of the flat text body. +void set_body_format(std::ofstream& ofs, const int precision) +{ + ofs << std::fixed; + ofs << std::scientific; + ofs << std::setprecision(precision); + ofs << std::right; +} +} // namespace + +std::size_t ModuleIO::dense_buffer_index(const int i, const int j, const int nlocal, const bool column_major) +{ + assert(i >= 0); + assert(j >= 0); + assert(nlocal > 0); + if (column_major) + { + return row_major_index(j, i, nlocal); + } + return row_major_index(i, j, nlocal); +} + +void ModuleIO::write_dense_text_body(std::ofstream& ofs, + const std::vector& mat, + const int nlocal, + const int precision, + const bool column_major) +{ + check_arguments(mat.size(), nlocal, precision); + set_body_format(ofs, precision); + for (int i = 0; i < nlocal; ++i) + { + for (int j = 0; j < nlocal; ++j) + { + if (j % 8 == 0) + { + ofs << "\n"; + } + ofs << " " << mat[source_index(i, j, nlocal, column_major)]; + } + } + // Terminate the record so that an appended record starts on a fresh line. + ofs << std::endl; +} + +void ModuleIO::write_dense_text_body(std::ofstream& ofs, + const std::vector>& mat, + const int nlocal, + const int precision, + const bool column_major) +{ + check_arguments(mat.size(), nlocal, precision); + set_body_format(ofs, precision); + for (int i = 0; i < nlocal; ++i) + { + for (int j = 0; j < nlocal; ++j) + { + if (j % 4 == 0) + { + ofs << "\n"; + } + const std::complex& value = mat[source_index(i, j, nlocal, column_major)]; + double real_v = std::real(value); + if (std::abs(real_v) < k_dense_text_zero_thr) + { + real_v = 0.0; + } + double imag_v = std::imag(value); + if (std::abs(imag_v) < k_dense_text_zero_thr) + { + imag_v = 0.0; + } + ofs << " (" << real_v << "," << imag_v << ")"; + } + } + // Terminate the record so that an appended record starts on a fresh line. + ofs << std::endl; +} diff --git a/source/source_io/module_hs/dense_text_body.h b/source/source_io/module_hs/dense_text_body.h new file mode 100644 index 00000000000..35e8ff8aa51 --- /dev/null +++ b/source/source_io/module_hs/dense_text_body.h @@ -0,0 +1,70 @@ +#ifndef DENSE_TEXT_BODY_H +#define DENSE_TEXT_BODY_H + +#include +#include +#include +#include + +namespace ModuleIO +{ + +/// @brief Flat index of matrix element (i, j) in a gathered buffer. +/// @details A row-major buffer stores (i, j) at i * nlocal + j, while a +/// column-major buffer stores it at j * nlocal + i. Writers and +/// readers of the flat NAO text layout must share this mapping so that +/// the file always stays row-major. +/// @param[in] i row index, must be non-negative +/// @param[in] j column index, must be non-negative +/// @param[in] nlocal matrix dimension, must be positive +/// @param[in] column_major whether the buffer is stored column-major +std::size_t dense_buffer_index(const int i, const int j, const int nlocal, const bool column_major); + +/// @brief Write a dense square matrix body in the flat NAO text layout shared +/// by the DM(k), H(k)/S(k) and T(k) writers. +/// +/// The documented file layout is row-major: element (i, j) is emitted at +/// position (i * nlocal + j), 8 real or 4 complex values per line, and the +/// record is terminated by a single newline so that an appended record starts +/// on a fresh line. +/// +/// The gathered buffer keeps the storage order of the eigensolver. For the +/// column-major solvers (genelpa, elpa, scalapack_gvx, cusolver, cusolvermp, +/// pexsi and lapack) the local block is stored as mat[i + j * nrloc], so the +/// row-major destination of Cpxgemr2d keeps a column-major buffer. Reading such +/// a buffer as row-major emits the transpose of the matrix; for a Hermitian +/// matrix that is the complex conjugate, which flips the sign of every +/// imaginary off-diagonal element. The caller selects the traversal order with +/// column_major so the file always stays row-major. +/// +/// @param[in] ofs output stream, already open by the writing rank +/// @param[in] mat gathered nlocal-by-nlocal matrix on the writing rank +/// @param[in] nlocal matrix dimension, must be positive +/// @param[in] precision number of significant digits, must be positive +/// @param[in] column_major true when the gathered buffer is stored column-major +void write_dense_text_body(std::ofstream& ofs, + const std::vector& mat, + const int nlocal, + const int precision, + const bool column_major); + +/// @brief Complex overload of write_dense_text_body. +/// +/// Real and imaginary components whose magnitude is below an internal +/// threshold are flushed to zero so that numerical noise does not clutter the +/// output. +/// +/// @param[in] ofs output stream, already open by the writing rank +/// @param[in] mat gathered nlocal-by-nlocal matrix on the writing rank +/// @param[in] nlocal matrix dimension, must be positive +/// @param[in] precision number of significant digits, must be positive +/// @param[in] column_major true when the gathered buffer is stored column-major +void write_dense_text_body(std::ofstream& ofs, + const std::vector>& mat, + const int nlocal, + const int precision, + const bool column_major); + +} // namespace ModuleIO + +#endif // DENSE_TEXT_BODY_H diff --git a/source/source_io/module_hs/dhs_sparse_writer.cpp b/source/source_io/module_hs/dhs_sparse_writer.cpp index 19695c67ee6..b2997f3a6b5 100644 --- a/source/source_io/module_hs/dhs_sparse_writer.cpp +++ b/source/source_io/module_hs/dhs_sparse_writer.cpp @@ -4,9 +4,11 @@ #include "hs_sparse_io_detail.h" #include "lat_r_csr.h" #include "source_base/global_function.h" +#include "source_base/global_variable.h" #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include #include @@ -14,8 +16,31 @@ #include #include +namespace +{ +/** + * @brief Return the requested R block, or an empty block when it is absent. + * @param matrix Sparse derivative matrix of one component and spin channel. + * @param R_coor Bravais lattice vector indexing the block. + * @return Const reference to the block, or to a shared empty block. + */ +template +const ModuleIO::SparseRBlock& block_or_empty(const ModuleIO::SparseRMatrix& matrix, + const ModuleIO::RCoordinate& R_coor) +{ + auto iter = matrix.find(R_coor); + if (iter != matrix.end()) + { + return iter->second; + } + static const ModuleIO::SparseRBlock empty_block; + return empty_block; +} +} // namespace + void ModuleIO::save_dH_sparse(const int& istep, const Parallel_Orbitals& pv, + const UnitCell* ucell, LCAO_HS_Arrays& HS_Arrays, const double& sparse_thr, const bool& binary, @@ -29,6 +54,10 @@ void ModuleIO::save_dH_sparse(const int& istep, std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "save_dH_sparse"); ModuleBase::timer::start("ModuleIO", "save_dH_sparse"); + if (ucell == nullptr) + { + ModuleBase::WARNING_QUIT("ModuleIO::save_dH_sparse", "UnitCell pointer must not be null."); + } SparseWriteOptions lat_r_options; lat_r_options.threshold = sparse_thr; lat_r_options.binary = binary; @@ -70,10 +99,20 @@ void ModuleIO::save_dH_sparse(const int& istep, // value, printed one-based per governance rule 22. const int header_step = std::max(istep, 0) + 1; + // The overlap derivative dS/dR is spin-independent: cal_dS fills only the + // spin-0 channel, so a second spin file would be an all-zero matrix. + // Only the Hamiltonian derivative dH/dR is spin-dependent. + const bool spin_dependent = (fileflag == "h"); int spin_loop = 1; - if (nspin == 2) { + if (spin_dependent && nspin == 2) + { spin_loop = 2; } + // A spin-independent quantity has no spin channel to label in the log or + // in the self-describing header. + const int header_nspin = spin_dependent ? nspin : 1; + const std::string matrix_name = (fileflag == "s") ? "dS/dR" : "dH/dR"; + const std::string matrix_label = (fileflag == "s") ? "dS" : "dH"; for (auto& comp: comps) { @@ -119,20 +158,23 @@ void ModuleIO::save_dH_sparse(const int& istep, for (auto& comp: comps) { - for (int ispin = 0; ispin < 2; ++ispin) + for (int ispin = 0; ispin < spin_loop; ++ispin) { - if (include_step) - { - comp.fname[ispin] << global_matrix_dir - << "d" << fileflag << "r" << comp.axis - << "s" << (ispin + 1) << "g" << (istep + 1) << "_nao.csr"; - } - else + // dS/dR has no spin channel, so its name carries no spin suffix; + // dH/dR keeps the collinear spin index. + std::string spin_suffix; + if (spin_dependent) { - comp.fname[ispin] << global_matrix_dir - << "d" << fileflag << "r" << comp.axis - << "s" << (ispin + 1) << "_nao.csr"; + spin_suffix = "s" + std::to_string(ispin + 1); } + const std::string axis_token(1, comp.axis); + const std::string prefix = "d" + fileflag + "r" + axis_token; + const std::string name = ModuleIO::detail::make_sparse_R_filename(prefix, + spin_suffix, + include_step, + istep, + ".csr"); + comp.fname[ispin].str(global_matrix_dir + name); } } @@ -141,10 +183,9 @@ void ModuleIO::save_dH_sparse(const int& istep, // The first written ionic step (istep == 0) truncates the shared file; // later steps append one complete record each. Single-point runs pass // istep <= 0 and therefore always start a fresh file. - const bool open_in_append = (out_app_flag == 1) && istep > 0; + const bool open_in_append = detail::append_ionic_step(out_app_flag, istep); for (auto& comp: comps) { - const std::string label = std::string("dH") + comp.axis; for (int ispin = 0; ispin < spin_loop; ++ispin) { std::ios_base::openmode mode = std::ios::out; @@ -159,25 +200,41 @@ void ModuleIO::save_dH_sparse(const int& istep, // Announce every written file, including appended multi-step // records and binary output, so the running log tracks each write. - const char* matrix_name = (fileflag == "s") ? "dS/dR" : "dH/dR"; - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - ofs_running << " Write " << matrix_name << " (" << comp.axis << " component)" << spin_tag - << " matrix in NAO basis to file: " << comp.fname[ispin].str() << std::endl; + const std::string property = matrix_name + " (" + comp.axis + " component)"; + ModuleIO::write_matrix_notice(ofs_running, property, ispin, header_nspin, + comp.fname[ispin].str()); comp.ofs[ispin].open(comp.fname[ispin].str().c_str(), mode); detail::check_output_file_open(comp.ofs[ispin], comp.fname[ispin].str(), "ModuleIO::save_dH_sparse"); if (binary) { - comp.ofs[ispin].write(reinterpret_cast(&header_step), sizeof(int)); - comp.ofs[ispin].write(reinterpret_cast(&nlocal), sizeof(int)); - comp.ofs[ispin].write(reinterpret_cast(&output_R_number), sizeof(int)); + ModuleIO::detail::write_csr_binary_header(comp.ofs[ispin], + header_step, + nlocal, + output_R_number); } else { - comp.ofs[ispin] << "STEP: " << header_step << std::endl; - comp.ofs[ispin] << "Matrix Dimension of " << label << "(R): " << nlocal << std::endl; - comp.ofs[ispin] << "Matrix number of " << label << "(R): " << output_R_number << std::endl; + // Self-describing header matching the H(R)/S(R) CSR layout, + // so readers can recover the cell, basis size and R count + // without extra metadata. + const std::string description = " # print " + matrix_name + + " matrix in real space " + + matrix_label + comp.axis + "(R)"; + const ModuleIO::detail::CsrTextHeader header = { + header_step, + description, + header_nspin, + ispin + 1, + nlocal, + output_R_number, + ucell, + std::string(), + false, + 0.0, + true}; + ModuleIO::detail::write_csr_text_header(comp.ofs[ispin], header); } } } @@ -203,16 +260,13 @@ void ModuleIO::save_dH_sparse(const int& istep, for (auto& comp: comps) { for (int ispin = 0; ispin < spin_loop; ++ispin) { - if (binary) { - const int comp_count = static_cast(comp.nonzero_num[ispin][count]); - comp.ofs[ispin].write(reinterpret_cast(&dRx), sizeof(int)); - comp.ofs[ispin].write(reinterpret_cast(&dRy), sizeof(int)); - comp.ofs[ispin].write(reinterpret_cast(&dRz), sizeof(int)); - comp.ofs[ispin].write(reinterpret_cast(&comp_count), sizeof(int)); - } else { - comp.ofs[ispin] << dRx << " " << dRy << " " << dRz << " " - << comp.nonzero_num[ispin][count] << std::endl; - } + ModuleIO::detail::write_R_record(comp.ofs[ispin], + dRx, + dRy, + dRz, + comp.nonzero_num[ispin][count], + binary, + false); } } } @@ -220,13 +274,53 @@ void ModuleIO::save_dH_sparse(const int& istep, for (int ispin = 0; ispin < spin_loop; ++ispin) { for (auto& comp: comps) { - if (comp.nonzero_num[ispin][count] > 0) { - if (nspin != 4) { + const long long nnz = comp.nonzero_num[ispin][count]; + if (binary) + { + // Binary records keep the compact layout: an empty block + // contributes only its four-integer header. + if (nnz == 0) + { + continue; + } + if (nspin != 4) + { save_lat_r(comp.ofs[ispin], comp.sparse[ispin][R_coor], pv.para_2d(), lat_r_options); - } else { + } + else + { save_lat_r(comp.ofs[ispin], (*comp.soc_sparse)[R_coor], pv.para_2d(), lat_r_options); } } + else if (nnz == 0) + { + // A globally empty component still needs its zero block to + // match the shared R count, but it needs no row-wise + // reductions: print the empty CSR block directly. + if (nspin != 4) + { + ModuleIO::save_lat_r_empty_csr(comp.ofs[ispin], + pv.para_2d().nrglb(), + lat_r_options); + } + else + { + ModuleIO::save_lat_r_empty_csr>(comp.ofs[ispin], + pv.para_2d().nrglb(), + lat_r_options); + } + } + else if (nspin != 4) + { + const SparseRBlock& block = block_or_empty(comp.sparse[ispin], R_coor); + ModuleIO::save_lat_r_csr(comp.ofs[ispin], block, pv.para_2d(), lat_r_options); + } + else + { + const SparseRBlock>& block + = block_or_empty(*comp.soc_sparse, R_coor); + ModuleIO::save_lat_r_csr(comp.ofs[ispin], block, pv.para_2d(), lat_r_options); + } } } diff --git a/source/source_io/module_hs/dhs_sparse_writer.h b/source/source_io/module_hs/dhs_sparse_writer.h index 59677d8f6ce..d290d483c43 100644 --- a/source/source_io/module_hs/dhs_sparse_writer.h +++ b/source/source_io/module_hs/dhs_sparse_writer.h @@ -7,11 +7,13 @@ #include class Parallel_Orbitals; +class UnitCell; namespace ModuleIO { void save_dH_sparse(const int& istep, const Parallel_Orbitals& pv, + const UnitCell* ucell, LCAO_HS_Arrays& HS_Arrays, const double& sparse_thr, const bool& binary, diff --git a/source/source_io/module_hs/hs_dense_io.cpp b/source/source_io/module_hs/hs_dense_io.cpp index bc4cba1b879..fe362e07bed 100644 --- a/source/source_io/module_hs/hs_dense_io.cpp +++ b/source/source_io/module_hs/hs_dense_io.cpp @@ -5,6 +5,7 @@ #include "source_base/timer.h" #include "source_base/tool_quit.h" #include "source_base/global_function.h" +#include "source_io/module_output/provenance_header.h" #include #include @@ -160,8 +161,10 @@ void ModuleIO::save_mat(const int istep, { ModuleBase::WARNING_QUIT("ModuleIO::save_mat", "Cannot open matrix file: " + filename); } + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; out_matrix << "#------------------------------------------------------------------------" << std::endl; - out_matrix << "# ionic step " << istep+1 << std::endl; // istep starts from 0 + out_matrix << ModuleIO::prov_step(istep_one_based, time_stamp); out_matrix << "# filename " << filename << std::endl; out_matrix << "# gamma only " << gamma_only << std::endl; out_matrix << "# rows " << dim << std::endl; diff --git a/source/source_io/module_hs/hs_sparse_io.cpp b/source/source_io/module_hs/hs_sparse_io.cpp index 348ff6e9f41..d7529b481cd 100644 --- a/source/source_io/module_hs/hs_sparse_io.cpp +++ b/source/source_io/module_hs/hs_sparse_io.cpp @@ -1,12 +1,13 @@ #include "hs_sparse_io.h" #include "hs_sparse_io_detail.h" +#include "source_io/module_output/provenance_header.h" #include "source_base/global_function.h" #include "source_base/parallel_reduce.h" #include "source_base/timer.h" #include "lat_r_csr.h" -#include +#include #include #include #include @@ -36,17 +37,14 @@ void open_sparse_file(std::ofstream& ofs, const ModuleIO::SparseWriteOptions& op // Append from the second ionic step onward in append mode; the first // step (istep == 0) truncates so a rerun does not retain prior frames. // Single-point SCF passes istep = -1 and also starts a fresh file. - const bool append_on_restart = (options.out_app_flag == 1) && (options.istep > 0); + const bool append_on_restart = ModuleIO::detail::append_ionic_step(options.out_app_flag, + options.istep); if (append_on_restart) { mode |= std::ios::app; } ofs.open(options.filename.c_str(), mode); - if (!ofs.is_open()) - { - ModuleBase::WARNING_QUIT("ModuleIO::open_sparse_file", - "Cannot open sparse matrix file: " + options.filename); - } + ModuleIO::detail::check_output_file_open(ofs, options.filename, "ModuleIO::open_sparse_file"); } void write_sparse_header(std::ofstream& ofs, @@ -59,13 +57,12 @@ void write_sparse_header(std::ofstream& ofs, const int step = std::max(options.istep, 0) + 1; if (options.binary) { - ofs.write(reinterpret_cast(&step), sizeof(int)); - ofs.write(reinterpret_cast(&nlocal), sizeof(int)); - ofs.write(reinterpret_cast(&output_R_number), sizeof(int)); + ModuleIO::detail::write_csr_binary_header(ofs, step, nlocal, output_R_number); } else { - ofs << "STEP: " << step << std::endl; + const std::string time_stamp = ModuleIO::local_timestamp(); + ofs << "Ionic_Step " << step << ModuleIO::prov_inline(time_stamp) << std::endl; ofs << "Matrix Dimension of " + options.label + "(R): " << nlocal << std::endl; ofs << "Matrix number of " + options.label + "(R): " @@ -73,27 +70,22 @@ void write_sparse_header(std::ofstream& ofs, } } -void write_R_record(std::ofstream& ofs, - const ModuleIO::RCoordinate& R_coor, - const long long nonzero_count, - const bool binary) +void write_csr_style_header(std::ofstream& ofs, + const ModuleIO::SparseWriteOptions& options, + const int nlocal, + const int output_R_number) { - int dRx = R_coor.x; - int dRy = R_coor.y; - int dRz = R_coor.z; - if (binary) - { - const int count = static_cast(nonzero_count); - ofs.write(reinterpret_cast(&dRx), sizeof(int)); - ofs.write(reinterpret_cast(&dRy), sizeof(int)); - ofs.write(reinterpret_cast(&dRz), sizeof(int)); - ofs.write(reinterpret_cast(&count), sizeof(int)); - } - else - { - ofs << dRx << " " << dRy << " " << dRz << " " << nonzero_count - << std::endl; - } + // ionic step printed one-based per governance rule 22, consistent + // with the g{N} filename suffix (g1 holds the first ionic step) + const int step = std::max(options.istep, 0) + 1; + const std::string description + = " # print " + options.label + " matrix in real space " + options.label + "(R)"; + const int ispin_one_based = options.ispin + 1; + + const ModuleIO::detail::CsrTextHeader header = { + step, description, options.nspin, ispin_one_based, nlocal, output_R_number, + options.ucell, std::string(), false, 0.0, true}; + ModuleIO::detail::write_csr_text_header(ofs, header); } } // namespace @@ -114,18 +106,35 @@ void ModuleIO::save_sparse( const std::vector nonzero_num = detail::count_nonzeros_by_R(smat, all_R_coor, options.threshold, options.reduce); + const bool text_csr = options.csr_format && !options.binary; + // Sparse output only lists R blocks that carry at least one element above + // the threshold; the header count therefore matches the number of blocks + // actually written for both the self-describing CSR layout and the compact + // legacy layout. const int output_R_number = count_output_R(nonzero_num); std::ofstream ofs; if (!options.reduce || GlobalV::DRANK == 0) { open_sparse_file(ofs, options); - write_sparse_header(ofs, options, nlocal, output_R_number); + if (text_csr) + { + write_csr_style_header(ofs, options, nlocal, output_R_number); + } + else + { + write_sparse_header(ofs, options, nlocal, output_R_number); + } } + const SparseRBlock empty_block; int count = 0; for (const auto& R_coor: all_R_coor) { - if (nonzero_num[count] == 0) + const bool is_empty = (nonzero_num[count] == 0); + // Sparse output must not persist all-zero blocks: they carry no + // information and make files grow with the candidate R grid rather + // than with the non-zero R set. + if (is_empty) { count++; continue; @@ -133,17 +142,23 @@ void ModuleIO::save_sparse( if (!options.reduce || GlobalV::DRANK == 0) { - write_R_record(ofs, R_coor, nonzero_num[count], options.binary); + detail::write_R_record(ofs, + R_coor.x, + R_coor.y, + R_coor.z, + nonzero_num[count], + options.binary, + text_csr); } - if (smat.count(R_coor)) + const SparseRBlock& block = (smat.count(R_coor) != 0) ? smat.at(R_coor) : empty_block; + if (text_csr) { - save_lat_r(ofs, smat.at(R_coor), pv.para_2d(), options); + save_lat_r_csr(ofs, block, pv.para_2d(), options); } else { - SparseRBlock empty_map; - save_lat_r(ofs, empty_map, pv.para_2d(), options); + save_lat_r(ofs, block, pv.para_2d(), options); } ++count; } diff --git a/source/source_io/module_hs/hs_sparse_io.h b/source/source_io/module_hs/hs_sparse_io.h index 3371e78628f..c8596b61556 100644 --- a/source/source_io/module_hs/hs_sparse_io.h +++ b/source/source_io/module_hs/hs_sparse_io.h @@ -9,6 +9,8 @@ #include #include +class UnitCell; + namespace ModuleIO { using RCoordinate = Abfs::Vector3_Order; @@ -32,6 +34,17 @@ struct SparseWriteOptions // Must be provided explicitly by the caller instead of reading PARAM. std::string calculation; int out_app_flag = 0; + // Text output style: self-describing header with cell information and + // annotated CSR blocks, matching the H(R)/S(R) CSR files. Binary output + // keeps the compact record layout regardless of this flag. + bool csr_format = false; + // Unit cell written into the self-describing text header; required when + // csr_format is true. + const UnitCell* ucell = nullptr; + // Spin metadata written into the self-describing text header. Spin + // independent outputs keep the defaults (one spin direction, index 0). + int nspin = 1; + int ispin = 0; }; template diff --git a/source/source_io/module_hs/hs_sparse_io_detail.h b/source/source_io/module_hs/hs_sparse_io_detail.h index 42acacc2f31..b3a4013d753 100644 --- a/source/source_io/module_hs/hs_sparse_io_detail.h +++ b/source/source_io/module_hs/hs_sparse_io_detail.h @@ -2,18 +2,25 @@ #define HS_SPARSE_IO_DETAIL_H #include "hs_sparse_io.h" +#include "source_base/module_out/sparse_matrix.h" #include "source_base/parallel_reduce.h" #include "source_base/tool_quit.h" +#include "source_cell/ucell_io.h" +#include "source_io/module_output/provenance_header.h" #include #include +#include +#include #include #include /** - * @brief Internal helpers shared by hs_sparse_io.cpp and dhs_sparse_writer.cpp. + * @brief Internal helpers shared by the R-space sparse text writers. * Declared here (instead of duplicated in each anonymous namespace) so - * the threshold/nonzero logic cannot diverge between the two writers. + * the header layout, R records and file-append rules cannot diverge + * between hs_sparse_io.cpp, dhs_sparse_writer.cpp, pos_op_csr.cpp, + * hsr_writer.cpp and write_dmr.cpp. */ namespace ModuleIO { @@ -77,6 +84,198 @@ inline void check_output_file_open(const std::ofstream& ofs, ModuleBase::WARNING_QUIT(context, "Cannot open sparse matrix file: " + filename); } } + +/** + * @brief Decide whether the current ionic step appends to an existing file. + * @details Mode 1 appends all ionic steps after the first written one; mode 0 + * and mode 2 always start a fresh stream (mode 2 embeds the step in + * the file name). Single-point runs pass istep <= 0 and truncate. + * @param out_app_flag Output append mode from INPUT. + * @param istep Zero-based ionic step index. + * @return True when the stream must be opened in append mode. + */ +inline bool append_ionic_step(const int out_app_flag, const int istep) +{ + return out_app_flag == 1 && istep > 0; +} + +/** + * @brief Build the "[g]_nao" name shared by + * every R-space sparse output. + * @details Centralizing the suffix order keeps H(R), S(R), DM(R), dH/dR, + * r(R), T(R), Vxc(R) and L(R) file names consistent and avoids one + * writer drifting from the others. + * @param prefix Property prefix without spin or step, e.g. "dhrx", "rrx". + * @param spin_suffix Spin token appended to the prefix ("s1", "1") or empty + * when the quantity is spin independent. + * @param numbered Whether to embed the one-based ionic step. + * @param istep Zero-based ionic step index. + * @param extension File extension including the leading dot. + * @return Assembled file name without any directory prefix. + */ +inline std::string make_sparse_R_filename(const std::string& prefix, + const std::string& spin_suffix, + const bool numbered, + const int istep, + const std::string& extension) +{ + if (prefix.empty()) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::make_sparse_R_filename", + "File name prefix must not be empty."); + } + if (extension.empty() || extension[0] != '.') + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::make_sparse_R_filename", + "File extension must start with a dot."); + } + + std::string name = prefix + spin_suffix; + if (numbered && istep >= 0) + { + name += "g" + std::to_string(istep + 1); + } + name += "_nao" + extension; + return name; +} + +/** + * @brief Metadata shared by every self-describing CSR text writer. + * @details Callers set all fields explicitly so a new output type cannot + * silently inherit the wrong spin or cell metadata. + */ +struct CsrTextHeader +{ + int step; ///< One-based ionic step. + std::string description; ///< Full " # print ..." matrix description line. + int nspin; ///< Number of spin directions. + int ispin; ///< One-based spin index. + int nbasis; ///< Number of localized basis functions. + int number_of_R; ///< Number of R blocks actually written. + const UnitCell* ucell; ///< Unit cell; must not be null. + std::string representation_note; ///< Optional note written after the cell block. + bool has_efermi; ///< Append the Fermi energy to the spin line. + double efermi_eV; ///< Fermi energy in eV. + bool write_banner; ///< Write the CSR layout banner. +}; + +/** + * @brief Write the common self-describing header of a CSR text file. + * @param ofs Output text stream. + * @param header Header fields; ucell must not be null. + */ +inline void write_csr_text_header(std::ofstream& ofs, const CsrTextHeader& header) +{ + if (header.ucell == nullptr) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_csr_text_header", + "UnitCell pointer must not be null."); + } + if (header.nspin <= 0) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_csr_text_header", + "Number of spin directions must be positive."); + } + if (header.ispin < 1 || header.ispin > header.nspin) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_csr_text_header", + "Spin index must be within the spin range."); + } + if (header.nbasis <= 0) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_csr_text_header", + "Number of localized basis functions must be positive."); + } + if (header.number_of_R < 0) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_csr_text_header", + "Number of Bravais lattice vectors must not be negative."); + } + + const std::string time_stamp = ModuleIO::local_timestamp(); + ofs << "Ionic_Step " << header.step << ModuleIO::prov_inline(time_stamp) << std::endl; + ofs << header.description << std::endl; + ofs << " " << header.nspin << " # number of spin directions" << std::endl; + ofs << " " << header.ispin << " # spin index"; + if (header.has_efermi) + { + ofs << ", E_Fermi = " << std::setprecision(6) << header.efermi_eV << " eV"; + } + ofs << std::endl; + ofs << " " << header.nbasis << " # number of localized basis" << std::endl; + ofs << " " << header.number_of_R << " # number of Bravais lattice vector R" << std::endl; + ofs << std::endl; + + ModuleIO::UcellIO::write_ucell(ofs, header.ucell); + if (!header.representation_note.empty()) + { + ofs << "# representation: " << header.representation_note << std::endl; + } + ofs << std::endl; + + if (header.write_banner) + { + ModuleIO::write_csr_banner(ofs); + } +} + +/** + * @brief Write the three-integer binary CSR header. + * @param ofs Output binary stream. + * @param step One-based ionic step. + * @param nbasis Number of localized basis functions. + * @param number_of_R Number of R blocks actually written. + */ +inline void write_csr_binary_header(std::ofstream& ofs, + const int step, + const int nbasis, + const int number_of_R) +{ + ofs.write(reinterpret_cast(&step), sizeof(int)); + ofs.write(reinterpret_cast(&nbasis), sizeof(int)); + ofs.write(reinterpret_cast(&number_of_R), sizeof(int)); +} + +/** + * @brief Write the "Rx Ry Rz nnz" record that starts one R block. + * @param ofs Output stream. + * @param rx First Bravais lattice vector component. + * @param ry Second Bravais lattice vector component. + * @param rz Third Bravais lattice vector component. + * @param nnz Number of non-zero elements in the block. + * @param binary Whether the stream uses the binary record layout. + * @param leading_space Prefix the text record with a space (save_sparse layout). + */ +inline void write_R_record(std::ofstream& ofs, + const int rx, + const int ry, + const int rz, + const long long nnz, + const bool binary, + const bool leading_space) +{ + if (binary) + { + if (nnz > static_cast(std::numeric_limits::max())) + { + ModuleBase::WARNING_QUIT("ModuleIO::detail::write_R_record", + "Too many non-zero elements for the binary R record."); + } + const int count = static_cast(nnz); + ofs.write(reinterpret_cast(&rx), sizeof(int)); + ofs.write(reinterpret_cast(&ry), sizeof(int)); + ofs.write(reinterpret_cast(&rz), sizeof(int)); + ofs.write(reinterpret_cast(&count), sizeof(int)); + } + else + { + if (leading_space) + { + ofs << " "; + } + ofs << rx << " " << ry << " " << rz << " " << nnz << std::endl; + } +} } // namespace detail } // namespace ModuleIO diff --git a/source/source_io/module_hs/hsk_writer.cpp b/source/source_io/module_hs/hsk_writer.cpp index b603c6ddca4..2905a00fb11 100644 --- a/source/source_io/module_hs/hsk_writer.cpp +++ b/source/source_io/module_hs/hsk_writer.cpp @@ -1,7 +1,22 @@ #include "hsk_writer.h" +#include "dense_text_body.h" #include "hs_dense_io.h" +#include "source_base/module_external/scalapack_connector.h" #include "source_base/module_out/filename.h" // use filename_output function +#include "source_base/global_function.h" +#include "source_base/parallel_common.h" +#include "source_base/timer.h" +#include "source_cell/klist.h" +#include "source_cell/ucell_io.h" +#include "source_cell/unitcell.h" +#include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" + #include +#include +#include +#include +#include template void ModuleIO::write_hsk( @@ -13,6 +28,9 @@ void ModuleIO::write_hsk( const std::vector &isk, hamilt::Hamilt* p_hamilt, const Parallel_Orbitals &pv, + const K_Vectors &kv, + const UnitCell* ucell, + const std::vector &efs, const bool gamma_only, const int out_app_flag, const int istep, @@ -23,76 +41,273 @@ void ModuleIO::write_hsk( const int drank, std::ofstream &ofs_running) { + ModuleBase::TITLE("ModuleIO", "write_hsk"); + ModuleBase::timer::start("ModuleIO", "write_hsk"); + + // Binary output keeps the save_mat layout unchanged so callers that + // only consume .dat files (e.g. post-processing scripts) are not + // affected by the text-format alignment. + const bool binary = (out_type == 2); + + // The text body is documented as row-major (i, j). A column-major solver + // stores its local block as mat[i + j * nrloc], and the Cpxgemr2d serial + // destination keeps that layout, so reading mat[i * nlocal + j] would emit + // the transpose (H(k)^T = conj(H(k)) for a Hermitian matrix). The shared + // body writer selects the traversal order from this flag. + const bool column_major_source + = ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(ks_solver); - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - ">>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; - ofs_running << " | " - " |" << std::endl; - ofs_running << " | Write Hamiltonian matrix H(k) or overlap matrix S(k) in numerical |" << std::endl; - ofs_running << " | atomic orbitals at each k-point. |" << std::endl; - ofs_running << " | " - " |" << std::endl; - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - ">>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; ofs_running << "\n WRITE H(k) OR S(k)" << std::endl; + // text mode: align with write_dmk filename convention so that hk and dmk + // files share the same naming scheme (no .dat suffix). Binary mode + // still uses filename_output which appends the .dat/.bin suffix. + // + // The filename's k index is the IBZ k-point index (0..nkstot_nospin-1), + // not the global k-spin pair index (0..nkstot-1). That way hk1s1_nao.txt + // and hk1s2_nao.txt refer to the same IBZ k-point, matching dmk naming. + auto make_fname = [&](const std::string& property, const int ik_global, + const int ibz_ik, const int ispin, + const bool spin_suffix) -> std::string { + if (binary) + { + return ModuleIO::filename_output(global_out_dir, property, "nao", + ik_global, ik2iktot, nspin, nkstot, out_type, out_app_flag, + gamma_only, istep); + } + + // Text path mirrors dmk_gen_fname so that hk1s1_nao.txt and + // dmk1s1_nao.txt stay side-by-side and easy to compare. + std::string fn = global_out_dir + property; + if (!gamma_only) + { + fn += "k" + std::to_string(ibz_ik + 1); + } + if (spin_suffix) + { + fn += "s" + std::to_string(ispin + 1); + } + if (out_app_flag == 2) + { + fn += "g" + std::to_string(istep + 1); + } + fn += "_nao.txt"; + return fn; + }; + + // Each multi-step run (MD or relax) appends a new record to the fixed + // file, mirroring the open_sparse_file convention; single-point SCF + // passes istep = -1 and starts a fresh file. The first written step + // (istep == 0) truncates so a fresh run drops records left by a previous + // run; only later steps (istep > 0) append. + const bool append_on_restart = (out_app_flag == 1) && (istep > 0); + + const Parallel_Blkcyclic& pv_dist = pv.para_2d(); + const int my_rank = drank; + Parallel_Blkcyclic pv_glb; + for (int ik = 0; ik < nks; ++ik) { p_hamilt->updateHk(ik); - const bool binary = (out_type == 2); - // save_mat takes a Boolean append flag: only mode 1 appends, and only - // from the second ionic step onward (istep > 0); modes 0 and 2 overwrite - // their per-step files. - const bool append_mat = (out_app_flag == 1) && (istep > 0); hamilt::MatrixBlock h_mat; hamilt::MatrixBlock s_mat; - p_hamilt->matrix(h_mat, s_mat); - std::string h_fn = ModuleIO::filename_output(global_out_dir, - "hk","nao",ik,ik2iktot,nspin,nkstot, - out_type,out_app_flag,gamma_only,istep); - - ModuleIO::save_mat(istep, - h_mat.p, - nlocal, - binary, - precision, - 1, - append_mat, - h_fn, - pv.para_2d(), - drank, - ks_solver); - - // mohan note 2025-06-02 - // for overlap matrix, the two spin channels yield the same matrix - // so we only need to print matrix from one spin channel. + // ------------------------------------------------------------------ + // H(k) — always written for every k-point + // ------------------------------------------------------------------ + const int ispin = isk[ik]; + // IBZ k-point index: after symmetry reduction nkstot has already + // been shrunk to IBZ size and then doubled for spin-polarised + // calculations, so IBZ_k_count = nkstot / nspin. ispin == 0 owns + // ik in [0, IBZ_k_count), ispin == 1 owns [IBZ_k_count, nkstot), + // hence ibz_ik = ik - ispin * IBZ_k_count recovers the irreducible + // label that matches dmk/s1, dmk/s2, etc. + const int ibz_k_count = kv.get_nkstot() / nspin; + const int ibz_ik = ik - ispin * ibz_k_count; + // Text path property is the letter before "k" so that make_fname + // produces hk1s1 and sk1 matching dmk1s1. Binary path keeps the + // full "hk"/"sk" property since filename_output handles its own + // suffix scheme. + const std::string h_property = binary ? "hk" : "h"; + const bool hk_spin_suffix = (nspin == 2); + const std::string h_fn = make_fname(h_property, ik, ibz_ik, ispin, + hk_spin_suffix); + + if (binary) + { + // save_mat takes a Boolean append flag; modes 0 and 2 overwrite. + const bool append_mat = append_on_restart; + ModuleIO::save_mat(istep, + h_mat.p, + nlocal, + binary, + precision, + true, // triangular + append_mat, + h_fn, + pv_dist, + drank, + ks_solver); + } + else // text mode + { + // Gather the distributed H(k) matrix to rank 0 so we can write + // the full matrix body without MPI-aware row-by-row logic. + std::vector h_global(my_rank == 0 ? nlocal * nlocal : 0); +#ifdef __MPI + pv_glb.set(nlocal, nlocal, nlocal, pv_dist.ictxt()); + Cpxgemr2d( + nlocal, nlocal, + h_mat.p, 1, 1, + const_cast(pv_dist.desc()), + h_global.data(), 1, 1, + const_cast(pv_glb.desc()), + pv_glb.ictxt()); +#else + h_global.assign(h_mat.p, h_mat.p + nlocal * nlocal); +#endif + + if (my_rank == 0) + { + std::ios_base::openmode mode = std::ios::out; + if (append_on_restart) + { + mode |= std::ios::app; + } + std::ofstream ofs(h_fn.c_str(), mode); + if (!ofs.is_open()) + { + ModuleBase::WARNING("ModuleIO::write_hsk", + "Cannot open H(k) file < " + h_fn + " >."); + } + else + { + ModuleIO::write_matrix_notice(ofs_running, "H(k)", ispin, nspin, h_fn); + + // --- metadata block (mirrors write_dmk exactly) --- + ofs << "Ionic_Step " << istep + 1 << std::endl; + ofs << " " << nspin << " # number of spin directions" << std::endl; + ofs << " " << ispin + 1 << " # spin index" << std::endl; + ofs << " " << kv.get_nkstot_nospin() << " # total k points " << std::endl; + ofs << " " << kv.get_nkstot() << " # total k points after symmetrized (if open) " << std::endl; + ofs << " " << ibz_ik + 1 << " # k-point index " << std::endl; + ofs << " " << kv.kvec_c[ibz_ik].x << " " << kv.kvec_c[ibz_ik].y << " " << kv.kvec_c[ibz_ik].z + << " # k point coordinate (Cartesian) " << std::endl; + ofs << " " << kv.kvec_d[ibz_ik].x << " " << kv.kvec_d[ibz_ik].y << " " << kv.kvec_d[ibz_ik].z + << " # k point coordinate (direct) " << std::endl; + ofs << " " << kv.wk[ibz_ik] << " # weight of this k point" << std::endl; + ofs << " " << efs[ispin] << " # Fermi energy in Ry " << std::endl; + ofs << " " << nlocal << " # number of localized basis " << std::endl; + ofs << " " << nlocal << " " << nlocal << " # size of this matrix " << std::endl; + ofs << std::endl; + + // --- UnitCell lattice block --- + if (ucell != nullptr) + { + ModuleIO::UcellIO::write_ucell(ofs, ucell); + } + ofs << std::endl; + + // --- matrix body: flat, 4 complex / 8 double per line --- + ModuleIO::write_dense_text_body(ofs, h_global, nlocal, precision, column_major_source); + } + } // rank0 + } // text mode + + // ------------------------------------------------------------------ + // S(k) — skip spin-down channels because both spins share the same S + // ------------------------------------------------------------------ const int current_spin = isk[ik]; - if(current_spin == 1) + if (current_spin == 1) { continue; } + const std::string s_property = binary ? "sk" : "s"; + // S(k) is spin-independent so we never append a spin suffix. + const std::string s_fn = make_fname(s_property, ik, ibz_ik, 0, false); - std::string s_fn = ModuleIO::filename_output(global_out_dir, - "sk","nao",ik,ik2iktot,nspin,nkstot, - out_type,out_app_flag,gamma_only,istep); - - ofs_running << " The output filename is " << s_fn << std::endl; - - ModuleIO::save_mat(istep, - s_mat.p, - nlocal, - binary, - precision, - 1, - append_mat, - s_fn, - pv.para_2d(), - drank, - ks_solver); + if (binary) + { + const bool append_mat = append_on_restart; + ofs_running << " The output filename is " << s_fn << std::endl; + ModuleIO::save_mat(istep, + s_mat.p, + nlocal, + binary, + precision, + true, + append_mat, + s_fn, + pv_dist, + drank, + ks_solver); + } + else // text mode + { + std::vector s_global(my_rank == 0 ? nlocal * nlocal : 0); +#ifdef __MPI + Cpxgemr2d( + nlocal, nlocal, + s_mat.p, 1, 1, + const_cast(pv_dist.desc()), + s_global.data(), 1, 1, + const_cast(pv_glb.desc()), + pv_glb.ictxt()); +#else + s_global.assign(s_mat.p, s_mat.p + nlocal * nlocal); +#endif + + if (my_rank == 0) + { + std::ios_base::openmode mode = std::ios::out; + if (append_on_restart) + { + mode |= std::ios::app; + } + std::ofstream ofs(s_fn.c_str(), mode); + if (!ofs.is_open()) + { + ModuleBase::WARNING("ModuleIO::write_hsk", + "Cannot open S(k) file < " + s_fn + " >."); + continue; + } + ModuleIO::write_matrix_notice(ofs_running, "S(k)", s_fn); + + // --- metadata block --- + ofs << "Ionic_Step " << istep + 1 << std::endl; + ofs << " " << nspin << " # number of spin directions" << std::endl; + ofs << " 1 # spin index" << std::endl; + ofs << " " << kv.get_nkstot_nospin() << " # total k points " << std::endl; + ofs << " " << kv.get_nkstot() << " # total k points after symmetrized (if open) " << std::endl; + ofs << " " << ibz_ik + 1 << " # k-point index " << std::endl; + ofs << " " << kv.kvec_c[ibz_ik].x << " " << kv.kvec_c[ibz_ik].y << " " << kv.kvec_c[ibz_ik].z + << " # k point coordinate (Cartesian) " << std::endl; + ofs << " " << kv.kvec_d[ibz_ik].x << " " << kv.kvec_d[ibz_ik].y << " " << kv.kvec_d[ibz_ik].z + << " # k point coordinate (direct) " << std::endl; + ofs << " " << kv.wk[ibz_ik] << " # weight of this k point" << std::endl; + // S(k) has no Fermi-energy concept; write a zero placeholder + // and label it clearly so readers are not confused. + ofs << " 0.0 # Fermi energy in Ry (not applicable to S(k))" << std::endl; + ofs << " " << nlocal << " # number of localized basis " << std::endl; + ofs << " " << nlocal << " " << nlocal << " # size of this matrix " << std::endl; + ofs << std::endl; + + // --- UnitCell lattice block --- + if (ucell != nullptr) + { + ModuleIO::UcellIO::write_ucell(ofs, ucell); + } + ofs << std::endl; + + // --- matrix body --- + ModuleIO::write_dense_text_body(ofs, s_global, nlocal, precision, column_major_source); + } // rank0 + } // text mode } // end ik + + ModuleBase::timer::end("ModuleIO", "write_hsk"); } // Explicit instantiations @@ -100,11 +315,13 @@ template void ModuleIO::write_hsk( const std::string&, const int, const int, const int, const std::vector&, const std::vector&, hamilt::Hamilt*, const Parallel_Orbitals&, + const K_Vectors&, const UnitCell*, const std::vector&, const bool, const int, const int, const int, const int, const int, const std::string&, const int, std::ofstream&); template void ModuleIO::write_hsk>( const std::string&, const int, const int, const int, const std::vector&, const std::vector&, hamilt::Hamilt>*, const Parallel_Orbitals&, + const K_Vectors&, const UnitCell*, const std::vector&, const bool, const int, const int, const int, const int, const int, const std::string&, const int, std::ofstream&); diff --git a/source/source_io/module_hs/hsk_writer.h b/source/source_io/module_hs/hsk_writer.h index c6bf6bae9ec..fd483442e0a 100644 --- a/source/source_io/module_hs/hsk_writer.h +++ b/source/source_io/module_hs/hsk_writer.h @@ -11,9 +11,27 @@ // mohan note: this file holds the H(k)/S(k) writer // (formerly write_hsk in write_hs.h / write_hs.hpp). +class K_Vectors; +class UnitCell; + namespace ModuleIO { +/** + * @brief Write H(k) and S(k) matrices for each k-point to disk. + * + * Text output format is aligned with write_dmk: full metadata block + * (nspin, ik, k-point coords, weight, Fermi energy, basis count), + * followed by a UnitCell lattice block and then a flat matrix body + * (4 complex or 8 double values per line). Binary output continues + * to delegate to save_mat so its layout stays unchanged for callers + * that only consume binary files. + * + * @param kv K-point container (coords, weights, counts). + * @param ucell Pointer to the UnitCell for the lattice block; + * may be nullptr if the caller cannot provide one. + * @param efs Fermi energies — one per spin channel. + */ template void write_hsk(const std::string& global_out_dir, const int nspin, @@ -23,6 +41,9 @@ void write_hsk(const std::string& global_out_dir, const std::vector& isk, hamilt::Hamilt* p_hamilt, const Parallel_Orbitals& pv, + const K_Vectors& kv, + const UnitCell* ucell, + const std::vector& efs, const bool gamma_only, const int out_app_flag, const int istep, diff --git a/source/source_io/module_hs/hsr_legacy.cpp b/source/source_io/module_hs/hsr_legacy.cpp index 229a7b49cf3..45e32325c24 100644 --- a/source/source_io/module_hs/hsr_legacy.cpp +++ b/source/source_io/module_hs/hsr_legacy.cpp @@ -7,6 +7,8 @@ #include "source_lcao/spar_st.h" #include "dhs_sparse_writer.h" #include "hs_sparse_io.h" +#include "hs_sparse_io_detail.h" +#include "source_io/module_output/write_notice.h" #include #include @@ -39,7 +41,7 @@ void ModuleIO::output_dSR(const int& istep, // mohan update 2024-04-01 const std::string fileflag_s = "s"; - ModuleIO::save_dH_sparse(istep, pv, HS_Arrays, options.sparse_threshold, options.binary, + ModuleIO::save_dH_sparse(istep, pv, &ucell, HS_Arrays, options.sparse_threshold, options.binary, fileflag_s, options.precision, options.global_matrix_dir, options.calculation, options.out_app_flag, options.nspin, nlocal, ofs_running); @@ -85,7 +87,7 @@ void ModuleIO::output_dHR(const int& istep, } // mohan update 2024-04-01 const std::string fileflag_h = "h"; - ModuleIO::save_dH_sparse(istep, pv, HS_Arrays, options.sparse_threshold, options.binary, + ModuleIO::save_dH_sparse(istep, pv, &ucell, HS_Arrays, options.sparse_threshold, options.binary, fileflag_h, options.precision, options.global_matrix_dir, options.calculation, options.out_app_flag, options.nspin, nlocal, ofs_running); @@ -97,24 +99,33 @@ void ModuleIO::output_dHR(const int& istep, } template -void ModuleIO::output_SR(Parallel_Orbitals& pv, +void ModuleIO::output_SR(const UnitCell& ucell, + Parallel_Orbitals& pv, const Grid_Driver& grid, hamilt::Hamilt* p_ham, - const std::string& SR_filename, const bool& binary, const double& sparse_thr, const int precision, - const std::string& global_out_dir, const std::string& global_matrix_dir, const std::string& calculation, const int out_app_flag, const int nspin, + const int istep, std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "output_SR"); ModuleBase::timer::start("ModuleIO", "output_SR"); - ofs_running << " Write S(R) matrix in NAO basis to file: " << SR_filename << std::endl; + // Mode 2 places S(R) in the matrix directory with the one-based step in the + // name; modes 0 and 1 keep the fixed name in the same directory. + const bool numbered = (out_app_flag == 2); + const std::string fname = global_matrix_dir + + ModuleIO::detail::make_sparse_R_filename("sr", + "", + numbered, + istep, + ".csr"); + ModuleIO::write_matrix_notice(ofs_running, "S(R)", fname); LCAO_HS_Arrays HS_Arrays; @@ -126,9 +137,8 @@ void ModuleIO::output_SR(Parallel_Orbitals& pv, sparse_thr, p_ham); - const int istep = 0; ModuleIO::SparseWriteOptions options; - options.filename = SR_filename; + options.filename = fname; options.label = "S"; options.threshold = sparse_thr; options.binary = binary; @@ -137,6 +147,14 @@ void ModuleIO::output_SR(Parallel_Orbitals& pv, options.reduce = true; options.calculation = calculation; options.out_app_flag = out_app_flag; + // The overlap matrix is spin-independent and uses the same + // self-describing CSR header as the other R-space outputs, so a + // calculation with S(R) enabled does not produce a second, compact + // header layout for the same file name. + options.csr_format = true; + options.ucell = &ucell; + options.nspin = 1; + options.ispin = 0; if (nspin == 4) { @@ -176,18 +194,16 @@ void ModuleIO::output_TR(const int istep, std::stringstream sst; // Modes 0 and 1 keep the fixed name (mode 0 overwrites, mode 1 appends all // ionic steps); only mode 2 embeds the one-based ionic step. - if (istep >= 0 && options.out_app_flag == 2) - { - // insert the 1-indexed ionic-step suffix right after the "tr" prefix, - // i.e. tr_nao.csr -> trg{step+1}_nao.csr (aligned with lxg/rrg naming) - const std::string base = TR_filename.substr(0, TR_filename.size() - std::string("_nao.csr").size()); - sst << options.global_matrix_dir << base << "g" << (istep + 1) << "_nao.csr"; - } - else - { - sst << options.global_matrix_dir << TR_filename; - } - ofs_running << " Write T(R) matrix in NAO basis to file: " << sst.str() << std::endl; + const bool numbered = (istep >= 0) && (options.out_app_flag == 2); + const std::string base + = TR_filename.substr(0, TR_filename.size() - std::string("_nao.csr").size()); + const std::string name = ModuleIO::detail::make_sparse_R_filename(base, + "", + numbered, + istep, + ".csr"); + sst << options.global_matrix_dir << name; + ModuleIO::write_matrix_notice(ofs_running, "T(R)", sst.str()); sparse_format::cal_TR(ucell, pv, HS_Arrays, grid, two_center_bundle, orb, options.sparse_threshold); ModuleIO::SparseWriteOptions sparse_options; sparse_options.filename = sst.str(); @@ -199,6 +215,8 @@ void ModuleIO::output_TR(const int istep, sparse_options.reduce = true; sparse_options.calculation = options.calculation; sparse_options.out_app_flag = options.out_app_flag; + sparse_options.csr_format = true; + sparse_options.ucell = &ucell; ModuleIO::save_sparse(HS_Arrays.TR_sparse, HS_Arrays.all_R_coor, @@ -211,29 +229,29 @@ void ModuleIO::output_TR(const int istep, return; } -template void ModuleIO::output_SR(Parallel_Orbitals& pv, +template void ModuleIO::output_SR(const UnitCell& ucell, + Parallel_Orbitals& pv, const Grid_Driver& grid, hamilt::Hamilt* p_ham, - const std::string& SR_filename, const bool& binary, const double& sparse_thr, const int precision, - const std::string& global_out_dir, const std::string& global_matrix_dir, const std::string& calculation, const int out_app_flag, const int nspin, + const int istep, std::ofstream& ofs_running); -template void ModuleIO::output_SR>(Parallel_Orbitals& pv, +template void ModuleIO::output_SR>(const UnitCell& ucell, + Parallel_Orbitals& pv, const Grid_Driver& grid, hamilt::Hamilt>* p_ham, - const std::string& SR_filename, const bool& binary, const double& sparse_thr, const int precision, - const std::string& global_out_dir, const std::string& global_matrix_dir, const std::string& calculation, const int out_app_flag, const int nspin, + const int istep, std::ofstream& ofs_running); diff --git a/source/source_io/module_hs/hsr_legacy.h b/source/source_io/module_hs/hsr_legacy.h index cddd93aed3f..2b628d4feb0 100644 --- a/source/source_io/module_hs/hsr_legacy.h +++ b/source/source_io/module_hs/hsr_legacy.h @@ -72,18 +72,18 @@ void output_TR(const int istep, std::ofstream& ofs_running); template -void output_SR(Parallel_Orbitals& pv, +void output_SR(const UnitCell& ucell, + Parallel_Orbitals& pv, const Grid_Driver& grid, hamilt::Hamilt* p_ham, - const std::string& SR_filename, const bool& binary, const double& sparse_threshold, const int precision, - const std::string& global_out_dir, const std::string& global_matrix_dir, const std::string& calculation, const int out_app_flag, const int nspin, + const int istep, std::ofstream& ofs_running); } // namespace ModuleIO diff --git a/source/source_io/module_hs/hsr_writer.cpp b/source/source_io/module_hs/hsr_writer.cpp index 508e053ff23..3e57ed46d5e 100644 --- a/source/source_io/module_hs/hsr_writer.cpp +++ b/source/source_io/module_hs/hsr_writer.cpp @@ -1,9 +1,10 @@ #include "hsr_writer.h" +#include "hs_sparse_io_detail.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_base/module_out/sparse_matrix.h" #include "source_base/tool_quit.h" -#include "source_cell/ucell_io.h" #include "source_cell/unitcell.h" #include "source_base/global_variable.h" #include "source_basis/module_ao/parallel_orbitals.h" @@ -35,14 +36,8 @@ std::string ModuleIO::hsr_gen_fname(const std::string& prefix, const int out_type) { const std::string extension = out_type == 2 ? ".dat" : ".csr"; - if (numbered && istep >= 0) - { - return prefix + std::to_string(ispin + 1) + "g" + std::to_string(istep + 1) + "_nao" + extension; - } - else - { - return prefix + std::to_string(ispin + 1) + "_nao" + extension; - } + const std::string spin_suffix = std::to_string(ispin + 1); + return detail::make_sparse_R_filename(prefix, spin_suffix, numbered, istep, extension); } std::string ModuleIO::sr_gen_fname(const bool numbered, const int istep) @@ -53,11 +48,7 @@ std::string ModuleIO::sr_gen_fname(const bool numbered, const int istep) std::string ModuleIO::sr_gen_fname(const bool numbered, const int istep, const int out_type) { const std::string extension = out_type == 2 ? ".dat" : ".csr"; - if (numbered && istep >= 0) - { - return "srg" + std::to_string(istep + 1) + "_nao" + extension; - } - return "sr_nao" + extension; + return detail::make_sparse_R_filename("sr", "", numbered, istep, extension); } std::string ModuleIO::dhr_gen_fname(const std::string& prefix, @@ -65,17 +56,26 @@ std::string ModuleIO::dhr_gen_fname(const std::string& prefix, const bool numbered, const int istep) { - std::string fname = prefix + "rs" + std::to_string(ispin + 1); - if (numbered && istep >= 0) + const std::string spin_suffix = "s" + std::to_string(ispin + 1); + return detail::make_sparse_R_filename(prefix + "r", spin_suffix, numbered, istep, ".csr"); +} + +std::string ModuleIO::dhk_gen_fname(const std::string& prefix, + const int ispin, + const int nspin, + const bool numbered, + const int istep) +{ + std::string spin_suffix; + if (nspin == 2) { - fname += "g" + std::to_string(istep + 1); + spin_suffix = "s" + std::to_string(ispin + 1); } - fname += "_nao.csr"; - return fname; + return detail::make_sparse_R_filename(prefix, spin_suffix, numbered, istep, ".txt"); } template -void ModuleIO::write_hcontainer_csr(const std::string& fname, +bool ModuleIO::write_hcontainer_csr(const std::string& fname, const UnitCell* ucell, const int precision, hamilt::HContainer* mat_serial, @@ -101,36 +101,30 @@ void ModuleIO::write_hcontainer_csr(const std::string& fname, { ofs.open(fname); } - if (!ofs.is_open()) - { - ModuleBase::WARNING_QUIT("ModuleIO::write_hcontainer_csr", - "Cannot open HContainer CSR file: " + fname); - } - - ofs << " --- Ionic Step " << istep + 1 << " ---" << std::endl; - ofs << " # print " << label << " matrix in real space " << label << "(R)" << std::endl; - ofs << " " << nspin << " # number of spin directions" << std::endl; - ofs << " " << ispin + 1 << " # spin index"; - if (has_efermi) - { - ofs << ", E_Fermi = " << std::setprecision(6) << efermi_eV << " eV"; - } - ofs << std::endl; - ofs << " " << mat_serial->get_nbasis() << " # number of localized basis" << std::endl; - ofs << " " << mat_serial->size_R_loop() << " # number of Bravais lattice vector R" << std::endl; - ofs << std::endl; - - ModuleIO::UcellIO::write_ucell(ofs, ucell); - if (!representation_note.empty()) - { - ofs << "# representation: " << representation_note << std::endl; - } - ofs << std::endl; + ModuleIO::detail::check_output_file_open(ofs, fname, "ModuleIO::write_hcontainer_csr"); + + const std::string description = " # print " + label + " matrix in real space " + label + "(R)"; + const ModuleIO::detail::CsrTextHeader header = { + istep + 1, + description, + nspin, + ispin + 1, + mat_serial->get_nbasis(), + static_cast(mat_serial->size_R_loop()), + ucell, + representation_note, + has_efermi, + efermi_eV, + false}; + ModuleIO::detail::write_csr_text_header(ofs, header); const double sparse_threshold = 1e-10; hamilt::Output_HContainer out(mat_serial, ofs, sparse_threshold, precision); out.write(); + // close() flushes the buffer; checking good() afterwards lets the caller + // detect a disk-full or quota failure that the destructor would swallow. ofs.close(); + return ofs.good(); } namespace @@ -354,8 +348,7 @@ void ModuleIO::write_hsr(const std::vector*>& hr_vec, write_hcontainer_csr( fname, ucell, precision, &hr_serial, istep, append, ispin, nspin, "H", representation_note, efermi_eV, true); } - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - ofs_running << " Write H(R)" << spin_tag << " matrix in NAO basis to file: " << fname << std::endl; + ModuleIO::write_matrix_notice(ofs_running, "H(R)", ispin, nspin, fname); } } @@ -386,16 +379,16 @@ void ModuleIO::write_hsr(const std::vector*>& hr_vec, write_hcontainer_csr( fname, ucell, precision, &sr_serial, istep, append, 0, 1, "S", representation_note, 0.0, false); } - ofs_running << " Write S(R) matrix in NAO basis to file: " << fname << std::endl; + ModuleIO::write_matrix_notice(ofs_running, "S(R)", fname); } } } // Explicit instantiations -template void ModuleIO::write_hcontainer_csr( +template bool ModuleIO::write_hcontainer_csr( const std::string&, const UnitCell*, const int, hamilt::HContainer*, const int, const bool, const int, const int, const std::string&, const std::string&, const double, const bool); -template void ModuleIO::write_hcontainer_csr>( +template bool ModuleIO::write_hcontainer_csr>( const std::string&, const UnitCell*, const int, hamilt::HContainer>*, const int, const bool, const int, const int, const std::string&, const std::string&, const double, const bool); diff --git a/source/source_io/module_hs/hsr_writer.h b/source/source_io/module_hs/hsr_writer.h index cb062ce5555..5bdbb3428ec 100644 --- a/source/source_io/module_hs/hsr_writer.h +++ b/source/source_io/module_hs/hsr_writer.h @@ -49,12 +49,25 @@ std::string dhr_gen_fname(const std::string& prefix, const bool numbered, const int istep); +/// Generate filename for the k-space derivative matrices (dH(k), dT(k), ...). +/// A spin suffix is added only for nspin == 2 so the two spin channels do not +/// overwrite each other; a single spin channel keeps the bare name. +/// @param numbered whether the ionic step is embedded as a g{step} suffix (out_app_flag == 2) +std::string dhk_gen_fname(const std::string& prefix, + const int ispin, + const int nspin, + const bool numbered, + const int istep); + /// Write a single HContainer to CSR file with header. /// @param append whether to append to an existing file; the first written step (istep <= 0) truncates /// @param efermi_eV the Fermi energy in eV for this spin channel /// @param has_efermi whether to append the Fermi energy to the spin-index line +/// @return true only if the whole record was written and the stream closed +/// cleanly; callers must not announce the file in the running log +/// when this returns false. template -void write_hcontainer_csr(const std::string& fname, +bool write_hcontainer_csr(const std::string& fname, const UnitCell* ucell, const int precision, hamilt::HContainer* mat_serial, diff --git a/source/source_io/module_hs/hterm_writer.cpp b/source/source_io/module_hs/hterm_writer.cpp index 474ec56c230..abade0cc8f8 100644 --- a/source/source_io/module_hs/hterm_writer.cpp +++ b/source/source_io/module_hs/hterm_writer.cpp @@ -1,5 +1,6 @@ #include "hterm_writer.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_base/parallel_reduce.h" #include "source_base/basis_flattened_indexing.h" @@ -7,7 +8,6 @@ #include "source_basis/module_ao/elem_basis_idx_orb.h" #include "source_estate/module_pot/h_hartree_pw.h" #include "source_hamilt/module_xc/xc_functional.h" -#include "source_io/module_hs/hs_dense_io.h" #include "source_io/module_hs/hsr_writer.h" #include "source_base/module_out/filename.h" #include "source_cell/ucell_io.h" @@ -22,8 +22,12 @@ #include "source_lcao/module_ri/ri_2d_comm.h" #endif +#include #include +#include #include +#include +#include #include #include #include @@ -102,70 +106,207 @@ static void gather_and_write(const std::string& prefix, // the Hamiltonian, not the full H(R): they do not carry the Fermi annotation const double no_efermi = 0.0; #ifdef __MPI - write_hcontainer_csr(fname, &ucell, 8, &hr_serial, istep, append, ispin, nspin, label, "", no_efermi, false); + const bool written = write_hcontainer_csr(fname, &ucell, 8, &hr_serial, istep, append, ispin, nspin, label, "", no_efermi, false); #else - write_hcontainer_csr(fname, &ucell, 8, &hR, istep, append, ispin, nspin, label, "", no_efermi, false); + const bool written = write_hcontainer_csr(fname, &ucell, 8, &hR, istep, append, ispin, nspin, label, "", no_efermi, false); #endif - if (ofs_running != nullptr) + if (written && ofs_running != nullptr) { - const std::string spin_tag = ModuleIO::make_spin_tag(ispin, nspin); - *ofs_running << " Write H(R) (" << term_name << " term)" << spin_tag << " matrix in NAO basis to file: " << fname - << std::endl; + const std::string property = "H(R) (" + term_name + " term)"; + ModuleIO::write_matrix_notice(*ofs_running, property, ispin, nspin, fname); } } } -static void write_hk_common(hamilt::HContainer& hR, - const std::string& prefix, - const UnitCell& ucell, - const Parallel_Orbitals& pv, - const K_Vectors& kv, - const int nspin, - const int istep, - const bool append, - const int* iat2iwt, - const int nat, - const int nlocal, - const int precision, - const bool gamma_only, - const std::string& global_out_dir, - const int out_app_flag, - const std::string& ks_solver, - const int drank) +// Write one folded Hamiltonian-term matrix H(k) using the same text layout as +// write_dmk / write_hsk: metadata block, UnitCell block, flat matrix body +// (8 real or 4 complex values per line, no "Row N" markers). +// Returns true only if the record was fully written; on an open or write +// failure the caller must not announce the file in the running log. +static bool write_hk_text(const std::string& fname, + const std::vector>& hk_global, + const K_Vectors& kv, + const int ik, + const int ibz_ik, + const int nlocal, + const int precision, + const bool gamma_only, + const int nspin, + const int ispin, + const int istep, + const UnitCell& ucell, + const std::string& term_name, + const bool append) { - const int nspin_k = (nspin == 2 ? 2 : 1); - const int nks = kv.get_nks() / nspin_k; + // Mode 1 appends the records written after the first ionic step; the first + // written step (istep == 0) truncates so a rerun does not keep records left + // by an earlier run. Callers pass append == (out_app_flag == 1), so the + // first-step guard has to live here, next to the open() call. + const bool append_now = append && (istep > 0); + std::ios_base::openmode mode = std::ios::out; + if (append_now) + { + mode |= std::ios::app; + } + std::ofstream ofs(fname.c_str(), mode); + if (!ofs.is_open()) + { + ModuleBase::WARNING("ModuleIO::write_h_term", "Cannot open file < " + fname + " >."); + return false; + } - for (int ik = 0; ik < nks; ++ik) + // metadata block, mirrors write_dmk / write_hsk + ofs << "Ionic_Step " << istep + 1 << std::endl; + ofs << " " << nspin << " # number of spin directions" << std::endl; + ofs << " " << ispin + 1 << " # spin index" << std::endl; + ofs << " " << kv.get_nkstot_nospin() << " # total k points " << std::endl; + ofs << " " << kv.get_nkstot() << " # total k points after symmetrized (if open) " << std::endl; + ofs << " " << ibz_ik + 1 << " # k-point index " << std::endl; + ofs << " " << kv.kvec_c[ik].x << " " << kv.kvec_c[ik].y << " " << kv.kvec_c[ik].z + << " # k point coordinate (Cartesian) " << std::endl; + ofs << " " << kv.kvec_d[ik].x << " " << kv.kvec_d[ik].y << " " << kv.kvec_d[ik].z + << " # k point coordinate (direct) " << std::endl; + ofs << " " << kv.wk[ik] << " # weight of this k point" << std::endl; + // A single Hamiltonian term has no Fermi-energy concept; keep a zero + // placeholder with an explicit label so the column stays parseable. + ofs << " 0.0 # Fermi energy in Ry (not applicable to " << term_name << ")" << std::endl; + ofs << " " << nlocal << " # number of localized basis " << std::endl; + ofs << " " << nlocal << " " << nlocal << " # size of this matrix " << std::endl; + ofs << std::endl; + + // UnitCell lattice block + ModuleIO::UcellIO::write_ucell(ofs, &ucell); + + // matrix body: flat, 8 real / 4 complex values per line + const double dm_thr = 1.0e-16; + ofs << std::fixed; + ofs << std::scientific; + ofs << std::setprecision(precision); + ofs << std::right; + for (int i = 0; i < nlocal; ++i) { - const ModuleBase::Vector3& kvec_d = kv.kvec_d[ik]; - - std::vector> hk_global(nlocal * nlocal, 0); - hamilt::folding_HR(hR, hk_global.data(), kvec_d, nlocal, 0); - - const int out_label = 1; - std::string fname = ModuleIO::filename_output(global_out_dir, - prefix, - "nao", - ik, - kv.ik2iktot, - nspin, - kv.get_nkstot(), - out_label, - out_app_flag, - gamma_only, - istep); - ModuleIO::save_mat(istep, - hk_global.data(), - nlocal, - false, - precision, - false, - append, - fname, - pv.para_2d(), - drank, - ks_solver); + const size_t ii = i * nlocal; + for (int j = 0; j < nlocal; ++j) + { + if (gamma_only) + { + if (j % 8 == 0) + { + ofs << "\n"; + } + ofs << " " << hk_global[ii + j].real(); + } + else + { + if (j % 4 == 0) + { + ofs << "\n"; + } + double real_v = std::real(hk_global[ii + j]); + if (std::abs(real_v) < dm_thr) + { + real_v = 0.0; + } + double imag_v = std::imag(hk_global[ii + j]); + if (std::abs(imag_v) < dm_thr) + { + imag_v = 0.0; + } + ofs << " (" << real_v << "," << imag_v << ")"; + } + } + } + // Terminate the body so that an appended record (out_app_flag == 1) starts + // on a fresh line instead of being glued to the last value. + ofs << std::endl; + // Flush explicitly so that a mid-write failure (e.g. a full disk) is + // detected here instead of being dropped silently by the destructor. + ofs.flush(); + return ofs.good(); +} + +// Canonical running-log name of a Hamiltonian-term H(k) output prefix, so that +// the notice matches the quantity name used by the other matrix writers. +static std::string hk_property_name(const std::string& prefix) +{ + if (prefix == "vnlk") + { + return "Vnl(k)"; + } + if (prefix == "vlk") + { + return "Vl(k)"; + } + if (prefix == "vhk") + { + return "Vh(k)"; + } + if (prefix == "vxck") + { + return "Vxc(k)"; + } + return prefix; +} + +// Fold one Hamiltonian term at k point ik and write it in the dmk-compatible +// text layout. The HContainer passed in must already be complete (gathered to +// a serial container) on the writing rank. +static void write_hk_at_k(const hamilt::HContainer& hR, + const std::string& prefix, + const K_Vectors& kv, + const UnitCell& ucell, + const int nspin, + const int nspin_name, + const int ispin, + const int istep, + const bool append, + const int ik, + const int nlocal, + const int precision, + const bool gamma_only, + const std::string& global_out_dir, + const int out_app_flag, + const std::string& term_name, + const bool do_write, + std::ofstream* ofs_running) +{ + if (!do_write) + { + return; + } + + // IBZ k-point index, matching write_dmk / write_hsk: after symmetry + // reduction both spin copies of the same IBZ point carry the same label, + // so subtract half of nkstot for the spin-down block. + const int half_k = (nspin == 2) ? kv.get_nkstot() / 2 : 0; + const int ik0 = kv.ik2iktot[ik]; + const int ibz_ik = (nspin == 2 && ik0 >= half_k) ? (ik0 - half_k) : ik0; + + std::vector> hk_global(nlocal * nlocal, 0); + hamilt::folding_HR(hR, hk_global.data(), kv.kvec_d[ik], nlocal, 0); + + const int out_label = 1; // text + const std::string fname = ModuleIO::filename_output(global_out_dir, + prefix, + "nao", + ik, + kv.ik2iktot, + nspin_name, + kv.get_nkstot(), + out_label, + out_app_flag, + gamma_only, + istep); + + const bool written = write_hk_text(fname, hk_global, kv, ik, ibz_ik, nlocal, precision, gamma_only, + nspin, ispin, istep, ucell, term_name, append); + + if (written && ofs_running != nullptr) + { + // Spin-independent terms are written once with nspin_name == 1, which + // makes write_matrix_notice emit no spin label for them. + const std::string property = hk_property_name(prefix); + ModuleIO::write_matrix_notice(*ofs_running, property, ispin, nspin_name, fname); } } @@ -181,6 +322,10 @@ struct HTermSpec // Fills hR_tmp for spin channel ispin. setup_veff_hcontainer has already // been run when use_veff_layout is true; the builder adds the term values. std::function&, int)> build; + // Whether the term differs between the two spin channels when nspin == 2. + // Spin-independent terms are built and written once and carry no spin + // suffix in the filename, matching the S(k) convention. + bool spin_dependent; }; // Shared skeleton for the five non-EXX terms: loop over spin channels, build @@ -204,16 +349,48 @@ static void write_h_term(WriteHParams& params, const HTermSpec& spec) const std::string& global_out_dir = params.global_out_dir; const int out_app_flag = params.out_app_flag; - const int nspin_out = (nspin == 2 ? 2 : 1); + const int nspin_out = (spec.spin_dependent && nspin == 2) ? 2 : 1; + // Spin-independent terms pass nspin_name = 1 so that filename_output does + // not append a meaningless spin block; spin-dependent terms keep the real + // nspin so that the two channels land in s1 and s2 files. + const int nspin_name = spec.spin_dependent ? nspin : 1; + const int nks = kv.get_nks(); for (int ispin = 0; ispin < nspin_out; ispin++) { hamilt::HContainer hR_tmp(const_cast(&pv)); spec.build(hR_tmp, ispin); - write_hk_common(hR_tmp, spec.k_prefix, ucell, pv, kv, nspin, istep, append, iat2iwt, nat, - nlocal, params.precision, gamma_only, global_out_dir, out_app_flag, - params.ks_solver, params.drank); +#ifdef __MPI + // Gather the distributed HContainer onto the writing rank so that the + // folded H(k) is complete; folding the rank-local pieces directly + // would scatter the basis blocks into wrong matrix positions. + Parallel_Orbitals serialV; + serialV.para_2d().set_serial(nlocal, nlocal); + serialV.set_atomic_trace(iat2iwt, nat, nlocal); + hamilt::HContainer hR_serial(&serialV); + hamilt::gatherParallels(hR_tmp, &hR_serial, 0); + const hamilt::HContainer& hk_source = hR_serial; + const bool do_write = (params.drank == 0); +#else + const hamilt::HContainer& hk_source = hR_tmp; + const bool do_write = true; +#endif + + // Enumerate the local k points owned by this spin channel, exactly as + // write_hsk does, so that filename_output derives the correct spin and + // k index from ik2iktot. + for (int ik = 0; ik < nks; ++ik) + { + const int kspin = kv.isk[ik]; + if (kspin != ispin) + { + continue; + } + write_hk_at_k(hk_source, spec.k_prefix, kv, ucell, nspin, nspin_name, ispin, istep, + append, ik, nlocal, params.precision, gamma_only, global_out_dir, + out_app_flag, spec.term_name, do_write, params.ofs_running); + } if (also_hR) { @@ -241,6 +418,7 @@ void write_h_vnl(WriteHParams& params) spec.r_prefix = "vnl"; spec.r_label = "V^NL"; spec.term_name = "nonlocal"; + spec.spin_dependent = false; spec.build = [&](hamilt::HContainer& hR_tmp, int /*ispin*/) { hamilt::Nonlocal> tmp_nonlocal(nullptr, kv.kvec_d, &hR_tmp, &ucell, orb_cutoff, &gd, @@ -267,6 +445,7 @@ void write_h_vl(WriteHParams& params) spec.r_prefix = "vl"; spec.r_label = "V^L"; spec.term_name = "local"; + spec.spin_dependent = false; spec.build = [&](hamilt::HContainer& hR_tmp, int /*ispin*/) { setup_veff_hcontainer(hR_tmp, ucell, gd, pv, orb_cutoff); // All ranks must enter cal_gint_vl so the Alltoall inside @@ -297,6 +476,9 @@ void write_h_vh(WriteHParams& params) spec.r_prefix = "vh"; spec.r_label = "V^H"; spec.term_name = "hartree"; + // The Hartree potential depends only on the total density, so both spin + // rows of v_h are identical. + spec.spin_dependent = false; spec.build = [&](hamilt::HContainer& hR_tmp, int ispin) { setup_veff_hcontainer(hR_tmp, ucell, gd, pv, orb_cutoff); // All ranks must enter cal_gint_vl so the Alltoall inside @@ -341,6 +523,7 @@ void write_h_vxc(WriteHParams& params) spec.r_prefix = "vxc"; spec.r_label = "V^XC"; spec.term_name = "xc"; + spec.spin_dependent = true; spec.build = [&](hamilt::HContainer& hR_tmp, int ispin) { setup_veff_hcontainer(hR_tmp, ucell, gd, pv, orb_cutoff); // All ranks must enter cal_gint_vl so the Alltoall inside @@ -375,13 +558,13 @@ static void write_h_exx_impl(const UnitCell& ucell, const std::string& global_matrix_dir, const std::string& calculation, const int out_app_flag, - const std::string& ks_solver, - const int drank, const Exx_Info& exx_info, - std::ofstream* ofs_running) + std::ofstream* ofs_running, + const int drank) { const auto& Hexxs = ex->get_Hexxs(); // vector over spin of map> const int nspin_out = (nspin == 2 ? 2 : 1); + const int nks = kv.get_nks(); const double alpha = exx_info.info_global.hybrid_alpha; for (int ispin = 0; ispin < nspin_out; ispin++) @@ -392,9 +575,32 @@ static void write_h_exx_impl(const UnitCell& ucell, hamilt::reallocate_hcontainer(Hexxs, &hR_tmp); RI_2D_Comm::add_HexxR(ispin, alpha, Hexxs, pv, npol, hR_tmp, nullptr); - write_hk_common(hR_tmp, "vexxk", ucell, pv, kv, nspin, istep, append, iat2iwt, nat, - nlocal, precision, gamma_only, global_out_dir, out_app_flag, ks_solver, - drank); +#ifdef __MPI + // Same as write_h_term: gather so that the folded H(k) is complete on + // the writing rank. + Parallel_Orbitals serialV; + serialV.para_2d().set_serial(nlocal, nlocal); + serialV.set_atomic_trace(iat2iwt, nat, nlocal); + hamilt::HContainer hR_serial(&serialV); + hamilt::gatherParallels(hR_tmp, &hR_serial, 0); + const hamilt::HContainer& hk_source = hR_serial; + const bool do_write = (drank == 0); +#else + const hamilt::HContainer& hk_source = hR_tmp; + const bool do_write = true; +#endif + + for (int ik = 0; ik < nks; ++ik) + { + const int kspin = kv.isk[ik]; + if (kspin != ispin) + { + continue; + } + write_hk_at_k(hk_source, "vexxk", kv, ucell, nspin, nspin, ispin, istep, append, ik, + nlocal, precision, gamma_only, global_out_dir, out_app_flag, "exx", + do_write, ofs_running); + } if (also_hR) { @@ -430,8 +636,8 @@ void write_h_exx(WriteHParams& params, const Exx_Info& exx_info) write_h_exx_impl(ucell, pv, params.exd, kv, nspin, istep, append, iat2iwt, nat, also_hR, params.npol, params.nlocal, params.precision, params.gamma_only_local, params.global_out_dir, params.global_matrix_dir, - params.calculation, params.out_app_flag, params.ks_solver, params.drank, exx_info, - params.ofs_running); + params.calculation, params.out_app_flag, exx_info, + params.ofs_running, params.drank); } } else @@ -441,8 +647,8 @@ void write_h_exx(WriteHParams& params, const Exx_Info& exx_info) write_h_exx_impl(ucell, pv, params.exc, kv, nspin, istep, append, iat2iwt, nat, also_hR, params.npol, params.nlocal, params.precision, params.gamma_only_local, params.global_out_dir, params.global_matrix_dir, - params.calculation, params.out_app_flag, params.ks_solver, params.drank, exx_info, - params.ofs_running); + params.calculation, params.out_app_flag, exx_info, + params.ofs_running, params.drank); } } diff --git a/source/source_io/module_hs/lat_r_csr.cpp b/source/source_io/module_hs/lat_r_csr.cpp index 877ceea0f74..92d706a99d4 100644 --- a/source/source_io/module_hs/lat_r_csr.cpp +++ b/source/source_io/module_hs/lat_r_csr.cpp @@ -3,6 +3,7 @@ #include "source_base/parallel_reduce.h" #include "source_base/global_function.h" #include "source_base/global_variable.h" +#include "source_base/module_out/sparse_matrix.h" #include #include @@ -131,3 +132,97 @@ template void ModuleIO::save_lat_r>(std::ofstream& ofs, const SparseRBlock>& XR, const Parallel_Blkcyclic& layout, const SparseWriteOptions& options); + +template +void ModuleIO::save_lat_r_csr(std::ofstream& ofs, + const SparseRBlock& XR, + const Parallel_Blkcyclic& layout, + const SparseWriteOptions& options) +{ + const int nlocal = layout.nrglb(); + if (nlocal <= 0) + { + ModuleBase::WARNING_QUIT("ModuleIO::save_lat_r_csr", + "Block-cyclic global row size must be positive."); + } + + ModuleIO::SparseMatrix sparse_matrix(nlocal, nlocal); + sparse_matrix.setSparseThreshold(options.threshold); + + std::vector line(nlocal); + for (int row = 0; row < nlocal; ++row) + { + ModuleBase::GlobalFunc::ZEROS(line.data(), nlocal); + + if (!options.reduce || layout.irloc(row) >= 0) + { + auto iter = XR.find(row); + if (iter != XR.end()) + { + for (const auto& value: iter->second) + { + if (value.first >= static_cast(nlocal)) + { + ModuleBase::WARNING_QUIT("ModuleIO::save_lat_r_csr", + "Sparse column index out of range."); + } + line[value.first] = value.second; + } + } + } + + if (options.reduce) + { + Parallel_Reduce::reduce_all(line.data(), nlocal); + } + + if (!options.reduce || ofs.is_open()) + { + for (int col = 0; col < nlocal; ++col) + { + sparse_matrix.insert(row, col, line[col]); + } + } + } + + if (!options.reduce || ofs.is_open()) + { + sparse_matrix.printToCSR(ofs, options.precision); + } +} + +template void ModuleIO::save_lat_r_csr(std::ofstream& ofs, + const SparseRBlock& XR, + const Parallel_Blkcyclic& layout, + const SparseWriteOptions& options); + +template void ModuleIO::save_lat_r_csr>(std::ofstream& ofs, + const SparseRBlock>& XR, + const Parallel_Blkcyclic& layout, + const SparseWriteOptions& options); + +template +void ModuleIO::save_lat_r_empty_csr(std::ofstream& ofs, + const int nlocal, + const SparseWriteOptions& options) +{ + if (nlocal <= 0) + { + ModuleBase::WARNING_QUIT("ModuleIO::save_lat_r_empty_csr", + "Block-cyclic global row size must be positive."); + } + + if (!options.reduce || ofs.is_open()) + { + ModuleIO::SparseMatrix sparse_matrix(nlocal, nlocal); + sparse_matrix.printToCSR(ofs, options.precision); + } +} + +template void ModuleIO::save_lat_r_empty_csr(std::ofstream& ofs, + int nlocal, + const SparseWriteOptions& options); + +template void ModuleIO::save_lat_r_empty_csr>(std::ofstream& ofs, + int nlocal, + const SparseWriteOptions& options); diff --git a/source/source_io/module_hs/lat_r_csr.h b/source/source_io/module_hs/lat_r_csr.h index fe525a6e169..83710460b61 100644 --- a/source/source_io/module_hs/lat_r_csr.h +++ b/source/source_io/module_hs/lat_r_csr.h @@ -14,6 +14,42 @@ namespace ModuleIO const SparseRBlock& XR, const Parallel_Blkcyclic& layout, const SparseWriteOptions& options); + + /** + * @brief Write one R block in the H(R)/S(R)/r(R) CSR text layout. + * @details The block is reduced across ranks exactly like save_lat_r, then + * printed through SparseMatrix so that values wrap every six + * entries and an empty block still carries its three CSR + * sections. Only the root rank opens the output stream, so + * `ofs.is_open()` selects the rank that owns the assembled + * matrix and performs the printing; every rank still takes part + * in the collective reduction. + * @param ofs Output text stream. + * @param XR Sparse block of the selected matrix component. + * @param layout Block-cyclic distribution used for the MPI reduction. + * @param options Sparse output options (threshold, precision, reduction). + */ + template + void save_lat_r_csr(std::ofstream& ofs, + const SparseRBlock& XR, + const Parallel_Blkcyclic& layout, + const SparseWriteOptions& options); + + /** + * @brief Write an all-zero R block in the H(R)/S(R)/r(R) CSR text layout. + * @details Callers that already know a block is globally empty (for + * example from an allreduced nonzero count) use this instead of + * save_lat_r_csr to skip its row-wise MPI reductions. The emitted + * bytes are identical to save_lat_r_csr on an empty block: an + * empty SparseMatrix printed on the rank that owns the stream. + * @param ofs Output text stream. + * @param nlocal Number of localized basis functions. + * @param options Sparse output options (precision and reduce flag). + */ + template + void save_lat_r_empty_csr(std::ofstream& ofs, + int nlocal, + const SparseWriteOptions& options); } #endif diff --git a/source/source_io/module_hs/output_mat_sparse.cpp b/source/source_io/module_hs/output_mat_sparse.cpp index 75e31e8c99e..aeb4fe4aeca 100644 --- a/source/source_io/module_hs/output_mat_sparse.cpp +++ b/source/source_io/module_hs/output_mat_sparse.cpp @@ -83,7 +83,7 @@ void output_mat_sparse(const MatSparseOutputOptions& options, nlocal, ofs_running); } - //! generate a file containing the derivatives of the overlap matrix (in Ry/Bohr) + //! generate a file containing the derivatives of the overlap matrix (in 1/Bohr) if (options.out_mat_ds) { mat_R_options.precision = options.ds_precision; diff --git a/source/source_io/module_hs/pos_op_csr.cpp b/source/source_io/module_hs/pos_op_csr.cpp index a43490dc397..cda309c17f7 100644 --- a/source/source_io/module_hs/pos_op_csr.cpp +++ b/source/source_io/module_hs/pos_op_csr.cpp @@ -1,6 +1,7 @@ #include "pos_op_csr.h" #include "source_base/tool_quit.h" +#include "source_io/module_hs/hs_sparse_io_detail.h" #include @@ -20,6 +21,8 @@ void assemble_csr(const std::string& output_filename, const int output_R_number, const bool binary, const bool append, + const std::string& axis, + const UnitCell* ucell, const std::string& context) { std::ios_base::openmode output_mode = std::ios::out; @@ -42,15 +45,29 @@ void assemble_csr(const std::string& output_filename, if (binary) { - out_r.write(reinterpret_cast(&step), sizeof(int)); - out_r.write(reinterpret_cast(&nlocal), sizeof(int)); - out_r.write(reinterpret_cast(&output_R_number), sizeof(int)); + ModuleIO::detail::write_csr_binary_header(out_r, step, nlocal, output_R_number); } else { - out_r << "STEP: " << step << std::endl; - out_r << "Matrix Dimension of r(R): " << nlocal << std::endl; - out_r << "Matrix number of r(R): " << output_R_number << std::endl; + if (ucell == nullptr) + { + ModuleBase::WARNING_QUIT(context, "UnitCell pointer must not be null for text r(R) output."); + } + const std::string description = " # print r matrix in real space r(R) " + axis + + "-component"; + const ModuleIO::detail::CsrTextHeader header = { + step, + description, + 1, + 1, + nlocal, + output_R_number, + ucell, + std::string(), + false, + 0.0, + true}; + ModuleIO::detail::write_csr_text_header(out_r, header); } std::ifstream payload(payload_filename.c_str(), payload_mode); diff --git a/source/source_io/module_hs/pos_op_csr.h b/source/source_io/module_hs/pos_op_csr.h index 15dd9a0f762..6f640feccfb 100644 --- a/source/source_io/module_hs/pos_op_csr.h +++ b/source/source_io/module_hs/pos_op_csr.h @@ -3,12 +3,30 @@ #include +class UnitCell; + namespace ModuleIO { namespace detail { bool lat_r_nonempty(const int nonzero_num[3]); +/** + * @brief Assemble one r(R) component file from its temporary block payload. + * @details Text output uses the same self-describing header and CSR banner as + * H(R)/S(R)/dH(R) files, while binary output keeps the three-integer + * header followed by the raw block records. + * @param output_filename Final file name of this Cartesian component. + * @param payload_filename Temporary file holding the CSR block records. + * @param step One-based ionic step written into the header. + * @param nlocal Number of localized basis functions. + * @param output_R_number Number of Bravais lattice vectors written. + * @param binary Whether the payload and output are binary. + * @param append Whether to append to the existing output file. + * @param axis Cartesian component label ("x", "y" or "z"). + * @param ucell Unit cell written into the text header; must not be null. + * @param context Caller name used in diagnostics. + */ void assemble_csr(const std::string& output_filename, const std::string& payload_filename, int step, @@ -16,6 +34,8 @@ void assemble_csr(const std::string& output_filename, int output_R_number, bool binary, bool append, + const std::string& axis, + const UnitCell* ucell, const std::string& context); } // namespace detail } // namespace ModuleIO diff --git a/source/source_io/module_hs/pos_op_writer.cpp b/source/source_io/module_hs/pos_op_writer.cpp index d6dc49254a2..eed1857c574 100644 --- a/source/source_io/module_hs/pos_op_writer.cpp +++ b/source/source_io/module_hs/pos_op_writer.cpp @@ -4,8 +4,10 @@ #include "source_base/global_variable.h" #include "source_base/parallel_reduce.h" #include "source_base/timer.h" +#include "source_io/module_hs/hs_sparse_io_detail.h" #include "source_io/module_hs/lat_r_csr.h" #include "source_io/module_hs/pos_op_csr.h" +#include "source_io/module_output/write_notice.h" #include "source_cell/module_neighbor/sltk_grid_driver.h" #include @@ -68,23 +70,29 @@ void PosOpWriter::out_lat_r(const UnitCell& ucell, lat_r_options.precision = precision; lat_r_options.reduce = true; - std::stringstream tem1; - tem1 << global_out_dir << "tmp-rr_nao.txt"; - std::ofstream ofs_tem1; + // One temporary payload per Cartesian component; the final files are + // assembled after the R loop, once the total block count is known. + const char axis_label[3] = {'x', 'y', 'z'}; + std::stringstream tem[3]; + std::ofstream ofs_tem[3]; if (GlobalV::DRANK == 0) { - if (binary) - { - ofs_tem1.open(tem1.str().c_str(), std::ios::binary); - } - else - { - ofs_tem1.open(tem1.str().c_str()); - } - if (!ofs_tem1.is_open()) + for (int direction = 0; direction < 3; ++direction) { - ModuleBase::WARNING_QUIT("PosOpWriter::out_lat_r", "Cannot open temporary sparse matrix file: " + tem1.str()); + tem[direction] << global_out_dir << "tmp-rr" << axis_label[direction] << "_nao.txt"; + std::ios_base::openmode mode = std::ios::out; + if (binary) + { + mode |= std::ios::binary; + } + const std::string temp_name = tem[direction].str(); + ofs_tem[direction].open(temp_name.c_str(), mode); + if (!ofs_tem[direction].is_open()) + { + const std::string message = "Cannot open temporary sparse matrix file: " + temp_name; + ModuleBase::WARNING_QUIT("PosOpWriter::out_lat_r", message); + } } } @@ -176,78 +184,97 @@ void PosOpWriter::out_lat_r(const UnitCell& ucell, { output_R_number++; - if (GlobalV::DRANK == 0) - { - if (binary) - { - ofs_tem1.write(reinterpret_cast(&dRx), sizeof(int)); - ofs_tem1.write(reinterpret_cast(&dRy), sizeof(int)); - ofs_tem1.write(reinterpret_cast(&dRz), sizeof(int)); - } - else - { - ofs_tem1 << dRx << " " << dRy << " " << dRz << std::endl; - } - } - for (int direction = 0; direction < 3; ++direction) { + const int nnz = rR_nonzero_num[direction]; if (GlobalV::DRANK == 0) { if (binary) { - ofs_tem1.write(reinterpret_cast(&rR_nonzero_num[direction]), sizeof(int)); + ofs_tem[direction].write(reinterpret_cast(&dRx), sizeof(int)); + ofs_tem[direction].write(reinterpret_cast(&dRy), sizeof(int)); + ofs_tem[direction].write(reinterpret_cast(&dRz), sizeof(int)); + ofs_tem[direction].write(reinterpret_cast(&rR_nonzero_num[direction]), + sizeof(int)); } else { - ofs_tem1 << rR_nonzero_num[direction] << std::endl; + ofs_tem[direction] << dRx << " " << dRy << " " << dRz << " " << nnz << std::endl; } } - if (rR_nonzero_num[direction]) + if (binary) + { + if (nnz > 0) + { + ModuleIO::save_lat_r(ofs_tem[direction], + psi_r_psi_sparse[direction], + layout_, + lat_r_options); + } + } + else if (nnz == 0) { - ModuleIO::save_lat_r(ofs_tem1, psi_r_psi_sparse[direction], layout_, lat_r_options); + // A globally empty component still needs its zero block to + // match the shared R count, but it needs no row-wise + // reductions: print the empty CSR block directly. + ModuleIO::save_lat_r_empty_csr(ofs_tem[direction], + layout_.nrglb(), + lat_r_options); } else { - // do nothing + // Text output always emits the three CSR sections so that + // a non-empty block carries its values, column indices and + // row pointers in the shared CSR layout. + ModuleIO::save_lat_r_csr(ofs_tem[direction], + psi_r_psi_sparse[direction], + layout_, + lat_r_options); } } } } + // Append from the second ionic step onward in append mode; the first + // step (step == 0) truncates so a rerun does not retain prior frames. + // Single-point SCF passes step = -1 and also starts a fresh file. + const bool open_in_append = (out_app_flag == 1) && (step > 0); + // ionic step printed one-based per governance rule 22 + const int header_step = std::max(step, 0) + 1; + if (GlobalV::DRANK == 0) { - std::stringstream ssr; - // Modes 0 and 1 keep the fixed filename (mode 0 overwrites, mode 1 - // appends all ionic steps); only mode 2 embeds the one-based step. - if (step >= 0 && out_app_flag == 2) - { - ssr << global_matrix_dir << "rrg" << (step + 1) << "_nao.txt"; - } - else + for (int direction = 0; direction < 3; ++direction) { - ssr << global_matrix_dir << "rr_nao.txt"; + // Modes 0 and 1 keep the fixed filename (mode 0 overwrites, mode 1 + // appends all ionic steps); only mode 2 embeds the one-based step. + const std::string axis(1, axis_label[direction]); + const std::string prefix = "rr" + axis; + const bool numbered = (step >= 0) && (out_app_flag == 2); + const std::string name = ModuleIO::detail::make_sparse_R_filename(prefix, + "", + numbered, + step, + ".csr"); + const std::string output_name = global_matrix_dir + name; + const std::string payload_name = tem[direction].str(); + + ofs_tem[direction].close(); + ModuleIO::detail::assemble_csr(output_name, + payload_name, + header_step, + nlocal, + output_R_number, + binary, + open_in_append, + axis, + &ucell, + "PosOpWriter::out_lat_r"); + ModuleIO::write_matrix_notice(ofs_running, "r(R)", output_name); + + std::remove(payload_name.c_str()); } - - ofs_tem1.close(); - // Append from the second ionic step onward in append mode; the first - // step (step == 0) truncates so a rerun does not retain prior frames. - // Single-point SCF passes step = -1 and also starts a fresh file. - const bool open_in_append = (out_app_flag == 1) && (step > 0); - // ionic step printed one-based per governance rule 22 - const int header_step = std::max(step, 0) + 1; - ModuleIO::detail::assemble_csr(ssr.str(), - tem1.str(), - header_step, - nlocal, - output_R_number, - binary, - open_in_append, - "PosOpWriter::out_lat_r"); - ofs_running << " Write r(R) matrix in NAO basis to file: " << ssr.str() << std::endl; - - std::remove(tem1.str().c_str()); } ModuleBase::timer::end("PosOpWriter", "out_lat_r"); diff --git a/source/source_io/module_hs/unittests/CMakeLists.txt b/source/source_io/module_hs/unittests/CMakeLists.txt index d5888eff1f7..c2c6561bbe3 100644 --- a/source/source_io/module_hs/unittests/CMakeLists.txt +++ b/source/source_io/module_hs/unittests/CMakeLists.txt @@ -1,27 +1,42 @@ addtest( TARGET MODULE_IO_hsk_writer_test - LIBS parameter base device + LIBS parameter base device symmetry SOURCES test_hsk_writer.cpp ../hsk_writer.cpp ../hs_dense_io.cpp - ../../../source_basis/module_ao/parallel_orbitals.cpp) + ../dense_text_body.cpp + ../../../source_basis/module_ao/parallel_orbitals.cpp + ../../../source_cell/klist.cpp + ../../../source_cell/klist_io.cpp + ../../../source_cell/reciprocal_grid.cpp + ../../../source_cell/parallel_kpoints.cpp + ../../../source_cell/ucell_io.cpp) add_test( NAME MODULE_IO_hsk_writer_test_parallel COMMAND mpirun -np 2 "$" WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) +addtest( + TARGET MODULE_IO_dense_text_body_test + SOURCES test_dense_text_body.cpp ../dense_text_body.cpp) + addtest( TARGET MODULE_IO_lat_r_csr_test LIBS parameter - SOURCES test_lat_r_csr.cpp ../lat_r_csr.cpp - ../../../source_base/parallel_blkcyc.cpp - ../../../source_base/tool_title.cpp - ../../../source_base/global_variable.cpp - ../../../source_base/parallel_reduce.cpp - ../../../source_base/parallel_common.cpp - ../../../source_base/parallel_global.cpp - ../../../source_base/parallel_comm.cpp - ../../../source_base/tool_quit.cpp ../../../source_base/global_file.cpp ../../../source_base/global_function.cpp ../../../source_base/memory_recorder.cpp ../../../source_base/timer.cpp -) + SOURCES test_lat_r_csr.cpp + ../lat_r_csr.cpp + ../../../source_base/parallel_blkcyc.cpp + ../../../source_base/tool_title.cpp + ../../../source_base/global_variable.cpp + ../../../source_base/parallel_reduce.cpp + ../../../source_base/parallel_common.cpp + ../../../source_base/parallel_global.cpp + ../../../source_base/parallel_comm.cpp + ../../../source_base/tool_quit.cpp + ../../../source_base/global_file.cpp + ../../../source_base/global_function.cpp + ../../../source_base/memory_recorder.cpp + ../../../source_base/module_out/sparse_matrix.cpp + ../../../source_base/timer.cpp) if(ENABLE_LCAO) addtest( @@ -77,9 +92,14 @@ AddTest( addtest( TARGET MODULE_IO_angmom_op_mat_test - LIBS parameter base device neighbor + LIBS parameter base device neighbor hcontainer SOURCES test_angmom_op_mat.cpp ../angmom_op_mat.cpp + ../hs_sparse_io.cpp + ../lat_r_csr.cpp + ../../../source_cell/ucell_io.cpp + ../../../source_basis/module_ao/parallel_orbitals.cpp + ../../../source_hamilt/module_hcontainer/test/tmp_mocks.cpp ../../../source_basis/module_ao/orb_atomic_lm.cpp ../../../source_basis/module_ao/orb_atomic.cpp ../../../source_basis/module_nao/radial_set.cpp @@ -97,13 +117,19 @@ AddTest( addtest( TARGET MODULE_IO_pos_op_csr_test - LIBS parameter base device - SOURCES test_pos_op_csr.cpp ../pos_op_csr.cpp) + LIBS parameter base device hcontainer + SOURCES test_pos_op_csr.cpp + ../pos_op_csr.cpp + ../lat_r_csr.cpp + ../../../source_cell/ucell_io.cpp + ../../../source_basis/module_ao/parallel_orbitals.cpp + ../../../source_hamilt/module_hcontainer/test/tmp_mocks.cpp) addtest( TARGET MODULE_IO_hs_sparse_io_test LIBS parameter base device hcontainer SOURCES test_hs_sparse_io.cpp ../hs_sparse_io.cpp ../lat_r_csr.cpp + ../../../source_cell/ucell_io.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp ../../../source_hamilt/module_hcontainer/test/tmp_mocks.cpp) @@ -115,6 +141,7 @@ AddTest( ../hs_sparse_io.cpp ../lat_r_csr.cpp ../../../source_basis/module_ao/parallel_orbitals.cpp + ../../../source_cell/ucell_io.cpp ../../../source_hamilt/module_hcontainer/test/tmp_mocks.cpp) addtest( diff --git a/source/source_io/module_hs/unittests/csr_test_helpers.h b/source/source_io/module_hs/unittests/csr_test_helpers.h index d5372267914..6f0d52b776a 100644 --- a/source/source_io/module_hs/unittests/csr_test_helpers.h +++ b/source/source_io/module_hs/unittests/csr_test_helpers.h @@ -189,24 +189,25 @@ void init_sparse_output_globals() void remove_derivative_files(const std::string& fileflag, int step = -1) { std::vector filenames; - if (step >= 0) + const std::string suffix = (step >= 0) ? ("g" + std::to_string(step + 1) + "_nao.csr") : "_nao.csr"; + // Only dH/dR carries a spin index; dS/dR is spin-independent. + const bool spin_suffix = (fileflag == "h"); + for (const char axis : {'x', 'y', 'z'}) { - const std::string suffix = "g" + std::to_string(step + 1) + "_nao.csr"; - for (const char axis : {'x', 'y', 'z'}) + if (spin_suffix) { for (int ispin = 1; ispin <= 2; ++ispin) { filenames.push_back("d" + fileflag + "r" + axis + "s" + std::to_string(ispin) + suffix); } } - } - else - { - for (const char axis : {'x', 'y', 'z'}) + else { + filenames.push_back("d" + fileflag + "r" + axis + suffix); + // Clean up files left by the legacy spin-suffixed naming. for (int ispin = 1; ispin <= 2; ++ispin) { - filenames.push_back("d" + fileflag + "r" + axis + "s" + std::to_string(ispin) + "_nao.csr"); + filenames.push_back("d" + fileflag + "r" + axis + "s" + std::to_string(ispin) + suffix); } } } diff --git a/source/source_io/module_hs/unittests/test_angmom_op_mat.cpp b/source/source_io/module_hs/unittests/test_angmom_op_mat.cpp index 65dcc563121..2298baac208 100644 --- a/source/source_io/module_hs/unittests/test_angmom_op_mat.cpp +++ b/source/source_io/module_hs/unittests/test_angmom_op_mat.cpp @@ -17,10 +17,13 @@ */ #include +#include #include #include #include #include +#include +#include #ifdef __MPI #include #endif @@ -30,11 +33,431 @@ #include "source_basis/module_nao/radial_collection.h" #include "source_base/sph_bessel_tf.h" #include "source_base/ylm.h" +#include "source_cell/unitcell.h" +#include "source_cell/nonlocal_info_base.h" +#include "source_cell/module_neighbor/sltk_grid_driver.h" +#include "source_basis/module_ao/parallel_orbitals.h" +#include "source_base/parallel_common.h" +#include "source_base/parallel_reduce.h" +#include "source_base/parallel_comm.h" +#include "source_base/parallel_global.h" namespace { constexpr double kDoubleThreshold = 1e-12; + +/// Elements with a magnitude below this value are dropped by the assembly +/// layer; the expected matrix below applies the same cutoff. +constexpr double kLThreshold = 1e-10; + +/// Tolerance for comparing against CSR values, which the writer prints with +/// precision 8 (eight digits after the decimal point). +constexpr double kCsrValueTolerance = 1e-6; + +/// @brief Minimal NonlocalInfoBase stub for unit-testing the Angmom_op +/// constructor. Only get_rcutmax_Beta is actually called; the other +/// ten overrides return safe placeholders. +class StubNonlocalInfo : public NonlocalInfoBase +{ + public: + explicit StubNonlocalInfo(const double rcut_beta) + : rcut_beta_(rcut_beta), + zero_double_(0.0), + empty_label_() + { + } + + const double& get_rcutmax_Beta() const override { return rcut_beta_; } + int get_nproj(const int& /*type_in*/) const override { return 0; } + int get_nprojmax() const override { return 0; } + double get_rcut_max(const int& /*type_in*/) const override { return 0.0; } + const std::string& get_label(const int& /*type_in*/) const override { return empty_label_; } + int get_type(const int& /*type_in*/) const override { return 0; } + int get_proj_L(const int& /*type_in*/, const int& /*ip_in*/) const override { return 0; } + int get_proj_Nr(const int& /*type_in*/, const int& /*ip_in*/) const override { return 0; } + const double* get_proj_radial(const int& /*type_in*/, const int& /*ip_in*/) const override { return nullptr; } + const double* get_proj_beta_r(const int& /*type_in*/, const int& /*ip_in*/) const override { return nullptr; } + int get_proj_Nk(const int& /*type_in*/, const int& /*ip_in*/) const override { return 0; } + double get_proj_dk(const int& /*type_in*/, const int& /*ip_in*/) const override { return 0.0; } + double get_proj_dr_uniform(const int& /*type_in*/, const int& /*ip_in*/) const override { return 0.0; } + + private: + double rcut_beta_; + double zero_double_; + std::string empty_label_; +}; + +/// @brief Populate a minimal 1-atom cubic UnitCell that aligns with the +/// orbital fixture Si_gga_8au_100Ry_2s2p1d.orb (Lmax=2, nchi=[2,2,1]). +/// UnitCell is not movable, so the target is filled through a reference. +void populate_minimal_unitcell(UnitCell& ucell) +{ + // Lattice vectors: simple cubic, lat0 = 10 Bohr, large enough to cover + // the orbital cutoff of 8 Bohr with PBC. + ucell.lat0 = 10.0; + ucell.lat0_angstrom = ucell.lat0 * ModuleBase::BOHR_TO_A; + ucell.tpiba = ModuleBase::TWO_PI / ucell.lat0; + ucell.tpiba2 = ucell.tpiba * ucell.tpiba; + ucell.latvec.e11 = 10.0; ucell.latvec.e12 = 0.0; ucell.latvec.e13 = 0.0; + ucell.latvec.e21 = 0.0; ucell.latvec.e22 = 10.0; ucell.latvec.e23 = 0.0; + ucell.latvec.e31 = 0.0; ucell.latvec.e32 = 0.0; ucell.latvec.e33 = 10.0; + ucell.a1.x = ucell.latvec.e11; ucell.a1.y = ucell.latvec.e12; ucell.a1.z = ucell.latvec.e13; + ucell.a2.x = ucell.latvec.e21; ucell.a2.y = ucell.latvec.e22; ucell.a2.z = ucell.latvec.e23; + ucell.a3.x = ucell.latvec.e31; ucell.a3.y = ucell.latvec.e32; ucell.a3.z = ucell.latvec.e33; + + ucell.ntype = 1; + ucell.nat = 1; + ucell.namax = 1; + ucell.nwmax = 13; // 2s + 6p + 5d = 13 orbitals for l_nchi = [2,2,1] + ucell.latName = "sc"; + + // UnitCell::atoms is an owning Atom* array (new Atom[ntype]), deleted by + // the UnitCell destructor, so we allocate it here on the heap and let the + // ucell instance own the memory for the duration of the test. + ucell.atoms = new Atom[ucell.ntype]; + Atom& si = ucell.atoms[0]; + si.type = 0; + si.na = 1; + si.nwl = 2; + si.nw = 13; + si.l_nchi = {2, 2, 1}; + si.tau = {ModuleBase::Vector3(0.0, 0.0, 0.0)}; + si.taud = {ModuleBase::Vector3(0.0, 0.0, 0.0)}; + si.label = "Si"; + si.label_orb = "Si"; + si.set_index(); + + ucell.orbital_fn.push_back("Si_gga_8au_100Ry_2s2p1d.orb"); + ucell.infoNL = std::unique_ptr(new StubNonlocalInfo(1.0)); + + // Derived index arrays used by assemble_angular_momentum and itiaiw2iwt. + ucell.set_iat2itia(); + ucell.set_iat2iwt(/*npol_in=*/1); +} + +/// @brief Initialize a serial Parallel_Orbitals whose global row dimension +/// matches the total number of NAOs of our minimal UnitCell. +/// Parallel_Orbitals is not copyable, so we receive it by reference. +void init_serial_pv(const int dim, Parallel_Orbitals& pv) +{ + // Re-derive authoritative fields from the BlockCyclicDistribution, which + // is the single source of truth per the Parallel_Orbitals class contract. + ASSERT_EQ(pv.para_2d().init(dim, dim, /*nb=*/1, DIAG_WORLD, false), 0); + pv.para_2d().set_serial(dim, dim); +} + +/// @brief Read the leading lines of an L{x,y,z}_nao.csr file so the test can +/// check the provenance line and the CSR banner. +std::string read_file_head(const std::string& path) +{ + std::ifstream ifs(path); + std::string line; + std::ostringstream oss; + // Return the first 40 lines; enough to cover the full UnitCell header, + // CSR banner, and the first data block of any assembled R matrix. + for (int i = 0; i < 40 && std::getline(ifs, line); ++i) + { + oss << line << '\n'; + } + return oss.str(); +} + +/// @brief One Bravais-vector block read back from a *_nao.csr file. +struct CsrBlock +{ + int rx = 0; + int ry = 0; + int rz = 0; + int nnz = 0; + std::vector values; + std::vector columns; + std::vector row_ptrs; +}; + +/// @brief Accept only a line made of exactly four integers, which is the +/// "Rx Ry Rz nnz" header of one R block. Every other non-comment line +/// is either shorter (UnitCell header) or longer (data). +bool parse_block_header(const std::string& line, CsrBlock& block) +{ + std::istringstream iss(line); + int rx = 0; + int ry = 0; + int rz = 0; + int nnz = 0; + if (!(iss >> rx >> ry >> rz >> nnz)) + { + return false; + } + std::string trailing; + if (iss >> trailing) + { + return false; + } + block.rx = rx; + block.ry = ry; + block.rz = rz; + block.nnz = nnz; + return true; +} + +/// @brief Parse every R block of an L{x,y,z}_nao.csr file. The writer emits +/// "Rx Ry Rz nnz", then " # CSR values", " # CSR column indices" and +/// " # CSR row pointers" sections, each of which may wrap over lines. +std::vector read_csr_blocks(const std::string& path) +{ + enum Section + { + kHeader, + kValues, + kColumns, + kRowPtrs + }; + + std::ifstream ifs(path); + std::vector blocks; + std::string line; + Section section = kHeader; + CsrBlock current; + int dim = 0; + + while (std::getline(ifs, line)) + { + if (line.find("# number of localized basis") != std::string::npos) + { + std::istringstream iss(line); + iss >> dim; + continue; + } + if (line.find("# CSR values") != std::string::npos) + { + section = kValues; + continue; + } + if (line.find("# CSR column indices") != std::string::npos) + { + section = kColumns; + continue; + } + if (line.find("# CSR row pointers") != std::string::npos) + { + section = kRowPtrs; + continue; + } + if (line.find('#') != std::string::npos) + { + continue; // provenance, banner and count comments + } + if (line.find_first_not_of(" \t\r") == std::string::npos) + { + continue; // blank separator between sections + } + + if (section == kHeader) + { + parse_block_header(line, current); + continue; + } + + std::istringstream iss(line); + if (section == kValues) + { + double value = 0.0; + while (iss >> value) + { + current.values.push_back(value); + } + if (static_cast(current.values.size()) == current.nnz) + { + section = kHeader; + } + } + else if (section == kColumns) + { + int column = 0; + while (iss >> column) + { + current.columns.push_back(column); + } + if (static_cast(current.columns.size()) == current.nnz) + { + section = kHeader; + } + } + else + { + int row_ptr = 0; + while (iss >> row_ptr) + { + current.row_ptrs.push_back(row_ptr); + } + if (static_cast(current.row_ptrs.size()) == dim + 1) + { + blocks.push_back(current); + current = CsrBlock(); + section = kHeader; + } + } + } + return blocks; +} + +/// @brief Dense lookup inside one CSR block; missing entries read as zero. +double csr_value(const CsrBlock& block, const int row, const int col) +{ + const int begin = block.row_ptrs[row]; + const int end = block.row_ptrs[row + 1]; + for (int k = begin; k < end; ++k) + { + if (block.columns[k] == col) + { + return block.values[k]; + } + } + return 0.0; +} + +/// @brief Position of a signed magnetic quantum number inside its (2l+1) +/// block, using the ABACUS real-harmonic order 0, +1, -1, +2, -2, ... +int m_position(const int m) +{ + if (m > 0) + { + return 2 * m - 1; + } + if (m < 0) + { + return -2 * m; + } + return 0; +} + +/// @brief First local orbital index of every angular-momentum block of one +/// atom. Re-derived here from l_nchi instead of sharing the +/// production helper, so a change of the production mapping is caught. +std::vector block_offsets(const Atom& atom) +{ + std::vector offsets(atom.nwl + 1, 0); + for (int l = 0; l < atom.nwl; ++l) + { + const int block_size = atom.l_nchi[l] * (2 * l + 1); + offsets[l + 1] = offsets[l] + block_size; + } + return offsets; +} + +/// @brief Home-cell L matrix evaluated directly with the Lx/Ly/Lz kernels. +/// The one-atom cell makes every pair a self pair, so the displacement +/// handed to the kernels is zero. +std::vector> expected_l_matrix( + const std::unique_ptr& calculator, + const Atom& atom, + const char dir) +{ + const std::vector offsets = block_offsets(atom); + std::vector> mat(atom.nw, std::vector(atom.nw, 0.0)); + const ModuleBase::Vector3 dtau(0.0, 0.0, 0.0); + + for (int li = 0; li <= atom.nwl; ++li) + { + const int block_size_i = 2 * li + 1; + for (int iz = 0; iz < atom.l_nchi[li]; ++iz) + { + for (int mi = -li; mi <= li; ++mi) + { + const int iw_i = offsets[li] + iz * block_size_i + m_position(mi); + for (int lj = 0; lj <= atom.nwl; ++lj) + { + const int block_size_j = 2 * lj + 1; + for (int jz = 0; jz < atom.l_nchi[lj]; ++jz) + { + for (int mj = -lj; mj <= lj; ++mj) + { + std::complex val(0.0, 0.0); + if (dir == 'x') + { + val = ModuleIO::cal_LxijR(calculator, + 0, 0, li, iz, mi, 0, 0, lj, jz, mj, dtau); + } + else if (dir == 'y') + { + val = ModuleIO::cal_LyijR(calculator, + 0, 0, li, iz, mi, 0, 0, lj, jz, mj, dtau); + } + else + { + val = ModuleIO::cal_LzijR(calculator, + 0, 0, li, iz, mi, 0, 0, lj, jz, mj, dtau); + } + + if (std::fabs(val.imag()) > kLThreshold) + { + const int iw_j = offsets[lj] + jz * block_size_j + m_position(mj); + mat[iw_i][iw_j] = val.imag(); + } + } + } + } + } + } + } + return mat; +} + +/// @brief Compare a written CSR block against the expected dense matrix. +void expect_block_matches(const CsrBlock& block, const std::vector>& expected) +{ + const int dim = static_cast(expected.size()); + ASSERT_EQ(static_cast(block.row_ptrs.size()), dim + 1); + ASSERT_EQ(static_cast(block.columns.size()), block.nnz); + ASSERT_EQ(static_cast(block.values.size()), block.nnz); + + for (int row = 0; row < dim; ++row) + { + const int begin = block.row_ptrs[row]; + const int end = block.row_ptrs[row + 1]; + ASSERT_GE(begin, 0); + ASSERT_LE(begin, end); + ASSERT_LE(end, block.nnz); + + std::vector dense(dim, 0.0); + for (int k = begin; k < end; ++k) + { + const int col = block.columns[k]; + ASSERT_GE(col, 0); + ASSERT_LT(col, dim); + dense[col] = block.values[k]; + } + for (int col = 0; col < dim; ++col) + { + EXPECT_NEAR(dense[col], expected[row][col], kCsrValueTolerance) + << "CSR row " << row << ", column " << col; + } + } +} + +/// @brief Anchor the p block of Lz to the analytic 3x3 matrix documented at +/// the top of this file: px and py couple as -i and +i while pz is +/// inert. The writer stores the imaginary part, so -1 and +1 appear. +void expect_lz_p_block(const CsrBlock& block, const Atom& atom) +{ + const std::vector offsets = block_offsets(atom); + const int p_start = offsets[1]; + const int p_block_size = 3; + const int px_position = m_position(1); + const int py_position = m_position(-1); + + for (int shell = 0; shell < atom.l_nchi[1]; ++shell) + { + const int px = p_start + shell * p_block_size + px_position; + const int py = p_start + shell * p_block_size + py_position; + EXPECT_NEAR(csr_value(block, px, py), -1.0, kCsrValueTolerance); + EXPECT_NEAR(csr_value(block, py, px), 1.0, kCsrValueTolerance); + // A purely imaginary Hermitian block has a vanishing diagonal. + EXPECT_NEAR(csr_value(block, px, px), 0.0, kCsrValueTolerance); + EXPECT_NEAR(csr_value(block, py, py), 0.0, kCsrValueTolerance); + } } +} // namespace class CalpLpRTest : public ::testing::Test { @@ -160,16 +583,106 @@ TEST_F(CalpLpRTest, CalLyijRTest) } } +// --------------------------------------------------------------------------- +// Assembled-path test: construct Angmom_op with a minimal UnitCell and +// exercise calculate() end-to-end. The writer emits one CSR block per +// Bravais vector for each component; every block is read back and compared +// with the L kernels evaluated on an independently tabulated two-center +// table, so index mapping, thresholding and the CSR layout are all covered. +// --------------------------------------------------------------------------- +TEST(AngmomOpAssembly, WritesThreeCsrFiles) +{ + const std::string orbital_dir = "../../../../../tests/PP_ORB/"; + const std::string out_dir = testing::TempDir(); + const double search_radius = 10.0; + const bool gamma_only = true; + const bool searchpbc = false; + const int istep = 0; + const int out_app_flag = 1; + const int precision = 8; + + UnitCell ucell; + populate_minimal_unitcell(ucell); + const int basis_dim = ucell.atoms[0].nw; // 13 for our Si fixture + Parallel_Orbitals pv; + init_serial_pv(basis_dim, pv); + + std::ofstream ofs_null("/dev/null"); + ModuleIO::Angmom_op angmom(orbital_dir, ucell, search_radius, + /*tdestructor=*/1, /*tgrid=*/0, /*tatom=*/0, + searchpbc, /*out_level=*/"V", gamma_only, + &ofs_null, /*rank=*/0); + + angmom.calculate("lx", out_dir, ucell, pv, precision, /*rank=*/0, + istep, out_app_flag); + + // All three components must have been written as separate CSR files. + const std::string lx_path = out_dir + "lx_nao.csr"; + const std::string ly_path = out_dir + "ly_nao.csr"; + const std::string lz_path = out_dir + "lz_nao.csr"; + std::ifstream lx_fs(lx_path); + std::ifstream ly_fs(ly_path); + std::ifstream lz_fs(lz_path); + EXPECT_TRUE(lx_fs.is_open()) << lx_path; + EXPECT_TRUE(ly_fs.is_open()) << ly_path; + EXPECT_TRUE(lz_fs.is_open()) << lz_path; + + // The provenance line is one-based (Ionic_Step 1 for istep = 0) and the + // body must carry the CSR banner that precedes the matrix blocks. + const std::string lx_head = read_file_head(lx_path); + EXPECT_THAT(lx_head, ::testing::HasSubstr("Ionic_Step")); + EXPECT_THAT(lx_head, ::testing::HasSubstr("CSR Format")); + + // Independent oracle: tabulate the same two-center table the constructor + // builds, then evaluate the kernels directly. The assembled values are + // checked against the kernels, not against hard-coded numbers. + ModuleBase::SphericalBesselTransformer sbt(true); + const std::string oracle_orbital = orbital_dir + ucell.orbital_fn[0]; + RadialCollection oracle_orbs; + oracle_orbs.build(1, &oracle_orbital, 'o'); + oracle_orbs.set_transformer(sbt); + const double orbital_rcut = oracle_orbs.rcut_max(); + const int oracle_ngrid = int(orbital_rcut / 0.01) + 1; + const double oracle_cutoff = 2.0 * orbital_rcut; + oracle_orbs.set_uniform_grid(true, oracle_ngrid, oracle_cutoff, 'i', true); + std::unique_ptr oracle_calculator(new TwoCenterIntegrator); + oracle_calculator->tabulate(oracle_orbs, oracle_orbs, 'S', oracle_ngrid, oracle_cutoff); + + const std::vector paths = {lx_path, ly_path, lz_path}; + const std::vector components = {'x', 'y', 'z'}; + std::vector> all_blocks; + for (size_t ic = 0; ic < paths.size(); ++ic) + { + const std::vector blocks = read_csr_blocks(paths[ic]); + // The single atom has no periodic images inside the search radius, + // so exactly the home-cell block must be present. + ASSERT_EQ(blocks.size(), 1u) << paths[ic]; + EXPECT_EQ(blocks[0].rx, 0); + EXPECT_EQ(blocks[0].ry, 0); + EXPECT_EQ(blocks[0].rz, 0); + EXPECT_GT(blocks[0].nnz, 0) << paths[ic]; + + const std::vector> expected = + expected_l_matrix(oracle_calculator, ucell.atoms[0], components[ic]); + expect_block_matches(blocks[0], expected); + all_blocks.push_back(blocks); + } + + // Analytic anchor for the p block of Lz, as documented at the top of this + // file: = -i and = +i, independent of the oracle. + expect_lz_p_block(all_blocks[2][0], ucell.atoms[0]); +} + int main(int argc, char **argv) { #ifdef __MPI MPI_Init(&argc, &argv); + DIAG_WORLD = MPI_COMM_WORLD; #endif ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); - + const int result = RUN_ALL_TESTS(); #ifdef __MPI MPI_Finalize(); #endif - return 0; -} \ No newline at end of file + return result; +} diff --git a/source/source_io/module_hs/unittests/test_dense_text_body.cpp b/source/source_io/module_hs/unittests/test_dense_text_body.cpp new file mode 100644 index 00000000000..4cc682c9860 --- /dev/null +++ b/source/source_io/module_hs/unittests/test_dense_text_body.cpp @@ -0,0 +1,155 @@ +#include "../dense_text_body.h" + +#include +#include +#include +#include +#include +#include + +#include "gtest/gtest.h" + +namespace +{ +/// @brief Read a written matrix body back and tokenize every number in it. +/// @details Parentheses and commas of the complex layout are turned into +/// whitespace so that a single tokenizer serves both overloads; the +/// value order is preserved (real, imaginary, real, ...). +std::vector read_numbers(const std::string& fname) +{ + std::ifstream ifs(fname.c_str()); + std::stringstream buffer; + buffer << ifs.rdbuf(); + std::string text = buffer.str(); + for (std::size_t i = 0; i < text.size(); ++i) + { + const char c = text[i]; + if (c == '(' || c == ')' || c == ',') + { + text[i] = ' '; + } + } + std::istringstream iss(text); + std::vector values; + double value = 0.0; + while (iss >> value) + { + values.push_back(value); + } + return values; +} + +std::string read_text(const std::string& fname) +{ + std::ifstream ifs(fname.c_str()); + std::stringstream buffer; + buffer << ifs.rdbuf(); + return buffer.str(); +} + +std::string body_path(const std::string& name) +{ + const std::string temp_dir = testing::TempDir(); + return temp_dir + name; +} +} // namespace + +// The file body is row-major even when the gathered buffer is column-major, +// which is what the column-major eigensolvers leave behind. A non-symmetric +// probe makes an accidental transpose visible. +TEST(DenseTextBody, DoubleColumnMajorSourceWritesRowMajorBody) +{ + const int dim = 3; + // Column-major buffer of the row-major matrix 1..9. + const std::vector mat = {1.0, 4.0, 7.0, 2.0, 5.0, 8.0, 3.0, 6.0, 9.0}; + const std::string fname = body_path("dense_text_body_double_cm.txt"); + + std::ofstream ofs(fname.c_str()); + ASSERT_TRUE(ofs.is_open()); + ModuleIO::write_dense_text_body(ofs, mat, dim, 8, true); + ofs.close(); + + const std::vector values = read_numbers(fname); + ASSERT_EQ(values.size(), 9u); + for (int i = 0; i < dim * dim; ++i) + { + EXPECT_NEAR(values[i], static_cast(i + 1), 1e-12); + } + EXPECT_EQ(std::remove(fname.c_str()), 0); +} + +TEST(DenseTextBody, DoubleRowMajorSourceIsUnchanged) +{ + const int dim = 2; + const std::vector mat = {1.0, 2.0, 3.0, 4.0}; + const std::string fname = body_path("dense_text_body_double_rm.txt"); + + std::ofstream ofs(fname.c_str()); + ASSERT_TRUE(ofs.is_open()); + ModuleIO::write_dense_text_body(ofs, mat, dim, 8, false); + ofs.close(); + + const std::vector values = read_numbers(fname); + ASSERT_EQ(values.size(), 4u); + EXPECT_NEAR(values[0], 1.0, 1e-12); + EXPECT_NEAR(values[1], 2.0, 1e-12); + EXPECT_NEAR(values[2], 3.0, 1e-12); + EXPECT_NEAR(values[3], 4.0, 1e-12); + EXPECT_EQ(std::remove(fname.c_str()), 0); +} + +TEST(DenseTextBody, ComplexColumnMajorSourceWritesRowMajorBody) +{ + const int dim = 2; + // Row-major probe: (0,0)=1, (0,1)=2+3i, (1,0)=4+5i, (1,1)=6. + // The column-major buffer swaps the two off-diagonal elements, so an + // accidental transpose would emit 4+5i where 2+3i belongs. + const std::vector> mat + = {std::complex(1.0, 0.0), std::complex(4.0, 5.0), + std::complex(2.0, 3.0), std::complex(6.0, 0.0)}; + const std::string fname = body_path("dense_text_body_complex_cm.txt"); + + std::ofstream ofs(fname.c_str()); + ASSERT_TRUE(ofs.is_open()); + ModuleIO::write_dense_text_body(ofs, mat, dim, 8, true); + ofs.close(); + + const std::vector values = read_numbers(fname); + ASSERT_EQ(values.size(), 8u); + EXPECT_NEAR(values[0], 1.0, 1e-12); + EXPECT_NEAR(values[1], 0.0, 1e-12); + EXPECT_NEAR(values[2], 2.0, 1e-12); + EXPECT_NEAR(values[3], 3.0, 1e-12); + EXPECT_NEAR(values[4], 4.0, 1e-12); + EXPECT_NEAR(values[5], 5.0, 1e-12); + EXPECT_NEAR(values[6], 6.0, 1e-12); + EXPECT_NEAR(values[7], 0.0, 1e-12); + EXPECT_EQ(std::remove(fname.c_str()), 0); +} + +// Components below the internal threshold are flushed to zero, and the record +// ends with a single newline so that appended records start on a fresh line. +TEST(DenseTextBody, ComplexNoiseIsFlushedAndRecordIsTerminated) +{ + const int dim = 2; + const std::vector> mat + = {std::complex(1.0, 1.0e-18), std::complex(1.0e-20, 0.0), + std::complex(0.0, 0.0), std::complex(2.0, -3.0)}; + const std::string fname = body_path("dense_text_body_complex_thr.txt"); + + std::ofstream ofs(fname.c_str()); + ASSERT_TRUE(ofs.is_open()); + ModuleIO::write_dense_text_body(ofs, mat, dim, 8, false); + ofs.close(); + + const std::vector values = read_numbers(fname); + ASSERT_EQ(values.size(), 8u); + EXPECT_NEAR(values[1], 0.0, 1e-30); + EXPECT_NEAR(values[2], 0.0, 1e-30); + EXPECT_NEAR(values[7], -3.0, 1e-12); + + const std::string text = read_text(fname); + ASSERT_FALSE(text.empty()); + EXPECT_EQ(text[text.size() - 1], '\n'); + EXPECT_EQ(std::remove(fname.c_str()), 0); +} diff --git a/source/source_io/module_hs/unittests/test_dhs_sparse_writer.cpp b/source/source_io/module_hs/unittests/test_dhs_sparse_writer.cpp index aa2b9df9772..ea48d25087c 100644 --- a/source/source_io/module_hs/unittests/test_dhs_sparse_writer.cpp +++ b/source/source_io/module_hs/unittests/test_dhs_sparse_writer.cpp @@ -32,6 +32,8 @@ TEST(DhsSparseWriter, TextCountsOnlyValuesAboveThreshold) Parallel_Orbitals pv; init_serial_orbitals(pv); + UnitCell ucell; + init_unitcell(ucell); LCAO_HS_Arrays arrays; const Abfs::Vector3_Order r_vector(0, 0, 0); arrays.all_R_coor.insert(r_vector); @@ -40,39 +42,27 @@ TEST(DhsSparseWriter, TextCountsOnlyValuesAboveThreshold) arrays.dHRx_sparse[0][r_vector][1][0] = 0.0; arrays.dHRx_sparse[0][r_vector][1][1] = -2.0; - ModuleIO::save_dH_sparse(5, pv, arrays, 1e-10, false, "h", 8, "./", "scf", false, 1, 2, ofs_running); + ModuleIO::save_dH_sparse(5, pv, &ucell, arrays, 1e-10, false, "h", 8, "./", "scf", false, 1, 2, ofs_running); - const std::vector lines = read_lines("dhrxs1_nao.csr"); - ASSERT_GE(lines.size(), 7); + const std::string output = read_file("dhrxs1_nao.csr"); // istep = 5 is the sixth ionic step, printed one-based as 6 - EXPECT_EQ(lines[0], "STEP: 6"); - EXPECT_EQ(lines[1], "Matrix Dimension of dHx(R): 2"); - EXPECT_EQ(lines[2], "Matrix number of dHx(R): 1"); - EXPECT_EQ(lines[3], "0 0 0 2"); - EXPECT_THAT(lines[4], testing::HasSubstr("1.00000000e+00")); - EXPECT_THAT(lines[4], testing::HasSubstr("-2.00000000e+00")); - - std::istringstream column_stream(lines[5]); - std::vector columns; - int column = 0; - while (column_stream >> column) - { - columns.push_back(column); - } - EXPECT_THAT(columns, testing::ElementsAre(0, 1)); - - std::istringstream indptr_stream(lines[6]); - std::vector indptr; - long long ptr = 0; - while (indptr_stream >> ptr) - { - indptr.push_back(ptr); - } - EXPECT_THAT(indptr, testing::ElementsAre(0, 1, 2)); - - const std::vector y_lines = read_lines("dhrys1_nao.csr"); - ASSERT_GE(y_lines.size(), 4); - EXPECT_EQ(y_lines[3], "0 0 0 0"); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 6 # ABACUS version:")); + EXPECT_THAT(output, testing::HasSubstr(" # print dH/dR matrix in real space dHx(R)\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # number of spin directions\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # spin index\n")); + EXPECT_THAT(output, testing::HasSubstr(" 2 # number of localized basis\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # number of Bravais lattice vector R\n")); + EXPECT_THAT(output, testing::HasSubstr("user_defined_lattice\n")); + EXPECT_THAT(output, testing::HasSubstr("Direct\n 0 0.25 0.5\n")); + // Values below the threshold are dropped; printToCSR wraps every six entries. + EXPECT_THAT(output, testing::HasSubstr("0 0 0 2\n # CSR values\n 1.00000000e+00 -2.00000000e+00\n" + " # CSR column indices\n 0 1\n" + " # CSR row pointers\n 0 1 2\n")); + + // Empty blocks still carry the three CSR sections and zero row pointers. + const std::string y_output = read_file("dhrys1_nao.csr"); + EXPECT_THAT(y_output, testing::HasSubstr("0 0 0 0\n # CSR values\n # CSR column indices\n" + " # CSR row pointers\n 0 0 0\n")); remove_derivative_files("h"); } @@ -84,6 +74,8 @@ TEST(DhsSparseWriter, BinaryCountsOnlyValuesAboveThreshold) Parallel_Orbitals pv; init_serial_orbitals(pv); + UnitCell ucell; + init_unitcell(ucell); LCAO_HS_Arrays arrays; const Abfs::Vector3_Order r_vector(0, 0, 0); arrays.all_R_coor.insert(r_vector); @@ -92,7 +84,7 @@ TEST(DhsSparseWriter, BinaryCountsOnlyValuesAboveThreshold) arrays.dHRx_sparse[0][r_vector][1][0] = 0.0; arrays.dHRx_sparse[0][r_vector][1][1] = -2.0; - ModuleIO::save_dH_sparse(6, pv, arrays, 1e-10, true, "h", 8, "./", "scf", false, 1, 2, ofs_running); + ModuleIO::save_dH_sparse(6, pv, &ucell, arrays, 1e-10, true, "h", 8, "./", "scf", false, 1, 2, ofs_running); std::ifstream ifs("dhrxs1_nao.csr", std::ios::binary); ASSERT_TRUE(ifs.is_open()); @@ -122,6 +114,8 @@ TEST(DhsSparseWriter, SocWritesAllDirections) Parallel_Orbitals pv; init_serial_orbitals(pv); + UnitCell ucell; + init_unitcell(ucell); LCAO_HS_Arrays arrays; const Abfs::Vector3_Order r_vector(0, 0, 0); arrays.all_R_coor.insert(r_vector); @@ -129,14 +123,20 @@ TEST(DhsSparseWriter, SocWritesAllDirections) arrays.dHRy_soc_sparse[r_vector][0][1] = std::complex(2.0, -1.0); arrays.dHRz_soc_sparse[r_vector][1][1] = std::complex(-3.0, 0.5); - ModuleIO::save_dH_sparse(7, pv, arrays, 1e-10, false, "s", 8, "./", "scf", false, 4, 2, ofs_running); - - const std::string x_output = read_file("dsrxs1_nao.csr"); - const std::string y_output = read_file("dsrys1_nao.csr"); - const std::string z_output = read_file("dsrzs1_nao.csr"); - EXPECT_THAT(x_output, testing::HasSubstr("Matrix number of dHx(R): 1\n0 0 0 1\n")); - EXPECT_THAT(y_output, testing::HasSubstr("Matrix number of dHy(R): 1\n0 0 0 1\n")); - EXPECT_THAT(z_output, testing::HasSubstr("Matrix number of dHz(R): 1\n0 0 0 1\n")); + ModuleIO::save_dH_sparse(7, pv, &ucell, arrays, 1e-10, false, "s", 8, "./", "scf", false, 4, 2, ofs_running); + + const std::string x_output = read_file("dsrx_nao.csr"); + const std::string y_output = read_file("dsry_nao.csr"); + const std::string z_output = read_file("dsrz_nao.csr"); + EXPECT_THAT(x_output, testing::HasSubstr(" # print dS/dR matrix in real space dSx(R)\n")); + EXPECT_THAT(y_output, testing::HasSubstr(" # print dS/dR matrix in real space dSy(R)\n")); + EXPECT_THAT(z_output, testing::HasSubstr(" # print dS/dR matrix in real space dSz(R)\n")); + EXPECT_THAT(x_output, testing::HasSubstr(" 1 # number of Bravais lattice vector R\n")); + EXPECT_THAT(y_output, testing::HasSubstr(" 1 # number of Bravais lattice vector R\n")); + EXPECT_THAT(z_output, testing::HasSubstr(" 1 # number of Bravais lattice vector R\n")); + EXPECT_THAT(x_output, testing::HasSubstr("0 0 0 1\n # CSR values\n")); + EXPECT_THAT(y_output, testing::HasSubstr("0 0 0 1\n # CSR values\n")); + EXPECT_THAT(z_output, testing::HasSubstr("0 0 0 1\n # CSR values\n")); EXPECT_THAT(x_output, testing::HasSubstr("(1.00000000e+00,0.00000000e+00)")); EXPECT_THAT(y_output, testing::HasSubstr("(2.00000000e+00,-1.00000000e+00)")); EXPECT_THAT(z_output, testing::HasSubstr("(-3.00000000e+00,5.00000000e-01)")); @@ -144,6 +144,58 @@ TEST(DhsSparseWriter, SocWritesAllDirections) remove_derivative_files("s"); } +TEST(DhsSparseWriter, OverlapDerivativeWritesSingleSpinChannel) +{ + init_sparse_output_globals(); + + // Keep every artifact inside the per-test temporary directory instead of + // the working directory (AGENTS rule 17). + const std::string out_dir = testing::TempDir(); + const std::string x_file = out_dir + "dsrx_nao.csr"; + const std::string legacy_x_file = out_dir + "dsrxs1_nao.csr"; + const std::string h_spin2_file = out_dir + "dhrxs2_nao.csr"; + std::remove(x_file.c_str()); + std::remove(legacy_x_file.c_str()); + std::remove(h_spin2_file.c_str()); + + Parallel_Orbitals pv; + init_serial_orbitals(pv); + UnitCell ucell; + init_unitcell(ucell); + LCAO_HS_Arrays arrays; + const Abfs::Vector3_Order r_vector(0, 0, 0); + arrays.all_R_coor.insert(r_vector); + arrays.dHRx_sparse[0][r_vector][0][0] = 1.0; + + // dS/dR is spin-independent, so nspin = 2 must write a single file whose + // name carries no spin index. + ModuleIO::save_dH_sparse(4, pv, &ucell, arrays, 1e-10, false, "s", 8, out_dir, "scf", false, 2, 2, ofs_running); + + std::ifstream spin_file(x_file.c_str()); + EXPECT_TRUE(spin_file.is_open()); + spin_file.close(); + std::ifstream legacy_spin1_file(legacy_x_file.c_str()); + EXPECT_FALSE(legacy_spin1_file.is_open()); + legacy_spin1_file.close(); + + const std::string output = read_file(x_file); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 5 # ABACUS version:")); + // The header reports a single spin direction even though nspin = 2. + EXPECT_THAT(output, testing::HasSubstr(" 1 # number of spin directions\n")); + EXPECT_THAT(output, testing::HasSubstr("0 0 0 1\n # CSR values\n 1.00000000e+00")); + + // dH/dR stays spin-dependent and still writes both spin channels. + arrays.dHRx_sparse[1][r_vector][1][1] = -2.0; + ModuleIO::save_dH_sparse(4, pv, &ucell, arrays, 1e-10, false, "h", 8, out_dir, "scf", false, 2, 2, ofs_running); + std::ifstream h_spin2_stream(h_spin2_file.c_str()); + EXPECT_TRUE(h_spin2_stream.is_open()); + h_spin2_stream.close(); + + std::remove(x_file.c_str()); + std::remove(legacy_x_file.c_str()); + std::remove(h_spin2_file.c_str()); +} + TEST(DhsSparseWriter, AppendModeReusesFixedFilename) { remove_derivative_files("s"); @@ -151,6 +203,8 @@ TEST(DhsSparseWriter, AppendModeReusesFixedFilename) Parallel_Orbitals pv; init_serial_orbitals(pv); + UnitCell ucell; + init_unitcell(ucell); LCAO_HS_Arrays arrays; const Abfs::Vector3_Order r_vector(0, 0, 0); arrays.all_R_coor.insert(r_vector); @@ -158,25 +212,25 @@ TEST(DhsSparseWriter, AppendModeReusesFixedFilename) // out_app_flag = 1 reuses the fixed filename without a g{N} suffix; the // first written ionic step (istep == 0) truncates it. - ModuleIO::save_dH_sparse(0, pv, arrays, 1e-10, false, "s", 8, "./", "md", 1, 1, 2, ofs_running); - const std::string first_frame = read_file("dsrxs1_nao.csr"); + ModuleIO::save_dH_sparse(0, pv, &ucell, arrays, 1e-10, false, "s", 8, "./", "md", 1, 1, 2, ofs_running); + const std::string first_frame = read_file("dsrx_nao.csr"); ASSERT_FALSE(first_frame.empty()); - EXPECT_EQ(count_substr(first_frame, "STEP: "), 1); - EXPECT_EQ(count_substr(first_frame, "STEP: 1"), 1); + EXPECT_EQ(count_substr(first_frame, "Ionic_Step "), 1); + EXPECT_EQ(count_substr(first_frame, "Ionic_Step 1"), 1); // The next ionic step appends a second frame to the same file. - ModuleIO::save_dH_sparse(1, pv, arrays, 1e-10, false, "s", 8, "./", "md", 1, 1, 2, ofs_running); - const std::string two_frames = read_file("dsrxs1_nao.csr"); - EXPECT_EQ(count_substr(two_frames, "STEP: "), 2); - EXPECT_EQ(count_substr(two_frames, "STEP: 1"), 1); - EXPECT_EQ(count_substr(two_frames, "STEP: 2"), 1); + ModuleIO::save_dH_sparse(1, pv, &ucell, arrays, 1e-10, false, "s", 8, "./", "md", 1, 1, 2, ofs_running); + const std::string two_frames = read_file("dsrx_nao.csr"); + EXPECT_EQ(count_substr(two_frames, "Ionic_Step "), 2); + EXPECT_EQ(count_substr(two_frames, "Ionic_Step 1"), 1); + EXPECT_EQ(count_substr(two_frames, "Ionic_Step 2"), 1); // Mode 2 keeps one suffixed file per ionic step and never appends; mode 0 // overwrites the fixed filename instead. - ModuleIO::save_dH_sparse(0, pv, arrays, 1e-10, false, "s", 8, "./", "md", 2, 1, 2, ofs_running); - const std::vector mode2_lines = read_lines("dsrxs1g1_nao.csr"); + ModuleIO::save_dH_sparse(0, pv, &ucell, arrays, 1e-10, false, "s", 8, "./", "md", 2, 1, 2, ofs_running); + const std::vector mode2_lines = read_lines("dsrxg1_nao.csr"); ASSERT_FALSE(mode2_lines.empty()); - EXPECT_EQ(mode2_lines[0], "STEP: 1"); + EXPECT_EQ(mode2_lines[0].compare(0, 12, "Ionic_Step 1"), 0); remove_derivative_files("s"); remove_derivative_files("s", 0); diff --git a/source/source_io/module_hs/unittests/test_hs_dense_io.cpp b/source/source_io/module_hs/unittests/test_hs_dense_io.cpp index a859a9f208e..65b76392cef 100644 --- a/source/source_io/module_hs/unittests/test_hs_dense_io.cpp +++ b/source/source_io/module_hs/unittests/test_hs_dense_io.cpp @@ -17,8 +17,10 @@ #include "source_base/parallel_comm.h" #include "source_basis/module_ao/parallel_orbitals.h" +#include #include #include +#include #include #include #include @@ -162,6 +164,50 @@ void remove_test_file(const std::string& filename) MPI_Barrier(DIAG_WORLD); #endif } +/** + * @brief Read one text record written by save_mat with triangle=true. + * + * Returns the packed upper-triangle values in write order, or an empty vector + * when the record header is missing. + */ +std::vector read_text_record(const std::string& content, const size_t header_pos, const int dim) +{ + // Find the closing rule line of this frame's header. + const std::string rule = "#------------------------------------------------------------------------\n"; + size_t pos = content.find(rule, header_pos); + if (pos == std::string::npos) + { + return {}; + } + pos += rule.size(); + // Stop before the next frame header, if any. + const size_t frame_end = content.find("#------------------------------------------------------------------------", pos); + const size_t search_end = (frame_end == std::string::npos) ? content.size() : frame_end; + + std::vector values; + values.reserve(dim * (dim + 1) / 2); + std::istringstream iss(content.substr(pos, search_end - pos)); + std::string line; + while (std::getline(iss, line)) + { + if (line.find("Row ") != 0) + { + continue; + } + // Read the numbers on the following line. + if (!std::getline(iss, line)) + { + break; + } + std::istringstream num_iss(line); + double val; + while (num_iss >> val) + { + values.push_back(val); + } + } + return values; +} } // namespace // --------------------------------------------------------------------------- @@ -178,7 +224,7 @@ TEST(HsDenseIoSaveMat, TextHeaderContainsStepAndDimension) filename, pv, 0, "genelpa", false); const std::string content = read_text_file(filename); // MPI text path writes header lines starting with '#' - EXPECT_NE(content.find("ionic step"), std::string::npos); + EXPECT_NE(content.find("Ionic_Step"), std::string::npos); EXPECT_NE(content.find("1"), std::string::npos); // istep+1 = 1 EXPECT_NE(content.find("gamma only"), std::string::npos); EXPECT_NE(content.find("rows"), std::string::npos); @@ -195,8 +241,8 @@ TEST(HsDenseIoSaveMat, TextHeaderStepTwo) ModuleIO::save_mat(1, mat.data(), dim, false, 8, false, false, filename, pv, 0, "genelpa", false); const std::string content = read_text_file(filename); - // istep=1 -> "ionic step 2" - EXPECT_NE(content.find("ionic step 2"), std::string::npos); + // istep=1 -> "Ionic_Step 2" + EXPECT_NE(content.find("Ionic_Step 2"), std::string::npos); std::remove(filename.c_str()); } @@ -379,6 +425,64 @@ TEST(HsDenseIoSaveMat, BinaryAppendCompleteRecordsAndOverwrite) remove_test_file(filename); } +TEST(HsDenseIoSaveMat, TextAppendTwoStepsAndFirstStepTruncates) +{ + // The Vxc(MO) writer saves text triangle matrices with + // append = (out_app_flag == 1) && (istep > 0). Cover the same shape of + // call: a rerun's first step must truncate a stale frame left by a + // previous run, later steps must append, and only the new payloads remain. + const int dim = 2; + const std::string filename = testing::TempDir() + "/save_mat_vxcmo_append.txt"; + remove_test_file(filename); + + Parallel_Orbitals pv; + initialize_distribution(pv, dim); + const std::vector stale = {1.0, 2.0, 3.0, 4.0}; + const std::vector first = {5.0, 6.0, 7.0, 8.0}; + const std::vector second = {9.0, 10.0, 11.0, 12.0}; + const std::vector stale_local = distribute_matrix(pv, stale, dim); + const std::vector first_local = distribute_matrix(pv, first, dim); + const std::vector second_local = distribute_matrix(pv, second, dim); + + // A previous run left a stale frame in the file. + ModuleIO::save_mat(0, stale_local.data(), dim, false, 8, true, true, + filename, pv.para_2d(), test_rank, "cg"); +#ifdef __MPI + MPI_Barrier(DIAG_WORLD); +#endif + // A fresh run starts at istep 0 and must truncate the stale frame. + ModuleIO::save_mat(0, first_local.data(), dim, false, 8, true, false, + filename, pv.para_2d(), test_rank, "cg"); + // Second ionic step appends a new record. + ModuleIO::save_mat(1, second_local.data(), dim, false, 8, true, true, + filename, pv.para_2d(), test_rank, "cg"); + + if (test_rank == 0) + { + const std::string content = read_text_file(filename); + // Exactly the two new frames remain; the stale frame was truncated. + const size_t first_step = content.find("Ionic_Step 1"); + const size_t second_step = content.find("Ionic_Step 2"); + ASSERT_NE(first_step, std::string::npos); + ASSERT_NE(second_step, std::string::npos); + EXPECT_LT(first_step, second_step); + EXPECT_EQ(content.find("Ionic_Step", second_step + 1), std::string::npos); + + // Payloads carry the values of the two new frames, not the stale one. + const std::vector first_values = read_text_record(content, first_step, dim); + const std::vector second_values = read_text_record(content, second_step, dim); + EXPECT_EQ(first_values, upper_triangle(first, dim)); + EXPECT_EQ(second_values, upper_triangle(second, dim)); + for (const double value : upper_triangle(stale, dim)) + { + EXPECT_EQ(std::find(first_values.begin(), first_values.end(), value), first_values.end()); + EXPECT_EQ(std::find(second_values.begin(), second_values.end(), value), second_values.end()); + } + } + + remove_test_file(filename); +} + TEST(HsDenseIoSaveMat, TextPrecisionFollowsArgument) { // The H(k) component writers forward the second INPUT value to this diff --git a/source/source_io/module_hs/unittests/test_hs_sparse_io.cpp b/source/source_io/module_hs/unittests/test_hs_sparse_io.cpp index 41544d286d2..b03a4d075fb 100644 --- a/source/source_io/module_hs/unittests/test_hs_sparse_io.cpp +++ b/source/source_io/module_hs/unittests/test_hs_sparse_io.cpp @@ -1,9 +1,10 @@ /** * @file test_hs_sparse_io.cpp - * @brief Unit tests for hs_sparse_io.cpp (ModuleIO::save_sparse). + * @brief Unit tests for hs_sparse_io.cpp (ModuleIO::save_sparse, both the + * compact layout and the csr_format text layout). * * The tests pin down the legacy CSR text/binary layout written by - * save_sparse: header style ("STEP: n"), dimension lines, threshold + * save_sparse: header style ("Ionic_Step n"), dimension lines, threshold * filtering of values, and the native binary field order. * hs_sparse_io.cpp only reads GlobalV::DRANK, so the fixture sets it * directly; no PARAM state is involved. @@ -42,7 +43,7 @@ TEST(HsSparseIo, SparseHeaderKeepsStepStyle) const std::string output = read_file(filename); // istep = 0 is the first ionic step, printed one-based as 1 - EXPECT_TRUE(starts_with(output, "STEP: 1\n")); + EXPECT_TRUE(starts_with(output, "Ionic_Step 1 # ABACUS version:")); EXPECT_THAT(output, testing::HasSubstr("Matrix Dimension of S(R): 2\n")); EXPECT_THAT(output, testing::HasSubstr("Matrix number of S(R): 1\n")); EXPECT_THAT(output, testing::HasSubstr("0 0 0 2\n")); @@ -79,7 +80,7 @@ TEST(HsSparseIo, SparseTextCountsOnlyValuesAboveThreshold) const std::vector lines = read_lines(filename); ASSERT_GE(lines.size(), 6); // istep = 2 is the third ionic step, printed one-based as 3 - EXPECT_EQ(lines[0], "STEP: 3"); + EXPECT_EQ(lines[0].compare(0, 12, "Ionic_Step 3"), 0); EXPECT_EQ(lines[1], "Matrix Dimension of S(R): 2"); EXPECT_EQ(lines[2], "Matrix number of S(R): 1"); EXPECT_EQ(lines[3], "0 0 0 2"); @@ -193,6 +194,198 @@ TEST(HsSparseIo, SparseBinaryCountsOnlyValuesAboveThreshold) std::remove(filename.c_str()); } +// A final-snapshot writer such as write_Vxc_R passes out_app_flag = 0 so a +// rerun truncates the previous output even when the only write happens at +// istep > 0. This test pins that behaviour: seeding a file with stale +// content and then calling save_sparse with out_app_flag = 0 and istep = 2 +// must leave a single frame, not an appended duplicate. +TEST(HsSparseIo, SparseTextOutAppFlagZeroTruncatesSeededFile) +{ + const std::string filename = testing::TempDir() + "write_hs_r_seeded_s.csr"; + // Seed a stale frame from a "previous run". + { + std::ofstream ofs(filename.c_str()); + ofs << "Ionic_Step 1\nstale content\n"; + } + + Parallel_Orbitals pv; + init_serial_orbitals(pv); + const Abfs::Vector3_Order r_vector(0, 0, 0); + std::set> all_R_coor; + all_R_coor.insert(r_vector); + std::map, std::map>> sparse_matrix; + sparse_matrix[r_vector][0][1] = 0.5; + sparse_matrix[r_vector][1][1] = 1.5; + + ModuleIO::SparseWriteOptions options; + options.filename = filename; + options.label = "S"; + options.threshold = 1e-10; + options.binary = false; + options.istep = 2; + options.out_app_flag = 0; // final-snapshot writer truncates + options.reduce = false; + ModuleIO::save_sparse(sparse_matrix, all_R_coor, pv, options); + + const std::string output = read_file(filename); + // istep = 2 is the third ionic step, printed one-based as 3 + EXPECT_TRUE(starts_with(output, "Ionic_Step 3 # ABACUS version:")); + EXPECT_EQ(output.find("stale content"), std::string::npos); + + std::remove(filename.c_str()); +} + +TEST(HsSparseIo, SparseCsrHeaderWritesCellAndBanner) +{ + const std::string filename = testing::TempDir() + "write_hs_r_csr_header_s.csr"; + std::remove(filename.c_str()); + + Parallel_Orbitals pv; + init_serial_orbitals(pv); + const Abfs::Vector3_Order r_vector(0, 0, 0); + std::set> all_R_coor; + all_R_coor.insert(r_vector); + std::map, std::map>> sparse_matrix; + sparse_matrix[r_vector][0][1] = 0.5; + sparse_matrix[r_vector][1][1] = 1.5; + + UnitCell ucell; + init_unitcell(ucell); + + ModuleIO::SparseWriteOptions options; + options.filename = filename; + options.label = "T"; + options.threshold = 1e-10; + options.binary = false; + options.istep = 0; + options.reduce = false; + options.csr_format = true; + options.ucell = &ucell; + ModuleIO::save_sparse(sparse_matrix, all_R_coor, pv, options); + + const std::vector lines = read_lines(filename); + ASSERT_GE(lines.size(), 12); + // istep = 0 is the first ionic step, printed one-based as 1 + EXPECT_EQ(lines[0].compare(0, 12, "Ionic_Step 1"), 0); + EXPECT_EQ(lines[1], " # print T matrix in real space T(R)"); + EXPECT_EQ(lines[2], " 1 # number of spin directions"); + EXPECT_EQ(lines[3], " 1 # spin index"); + EXPECT_EQ(lines[4], " 2 # number of localized basis"); + EXPECT_EQ(lines[5], " 1 # number of Bravais lattice vector R"); + EXPECT_EQ(lines[6], ""); + + const std::string output = read_file(filename); + EXPECT_THAT(output, testing::HasSubstr("user_defined_lattice")); + EXPECT_THAT(output, testing::HasSubstr("Direct\n 0 0.25 0.5\n")); + EXPECT_THAT(output, testing::HasSubstr("CSR Format")); + EXPECT_THAT(output, testing::HasSubstr("0 0 0 2\n")); + EXPECT_THAT(output, testing::HasSubstr(" # CSR values")); + EXPECT_THAT(output, testing::HasSubstr(" # CSR column indices")); + EXPECT_THAT(output, testing::HasSubstr(" # CSR row pointers")); + + std::remove(filename.c_str()); +} + +TEST(HsSparseIo, SparseCsrSkipsEmptyRBlocks) +{ + const std::string filename = testing::TempDir() + "write_hs_r_csr_empty_s.csr"; + std::remove(filename.c_str()); + + Parallel_Orbitals pv; + init_serial_orbitals(pv); + const Abfs::Vector3_Order filled_R(0, 0, 0); + const Abfs::Vector3_Order empty_R(1, 0, 0); + std::set> all_R_coor; + all_R_coor.insert(filled_R); + all_R_coor.insert(empty_R); + std::map, std::map>> sparse_matrix; + sparse_matrix[filled_R][0][1] = 0.5; + + UnitCell ucell; + init_unitcell(ucell); + + ModuleIO::SparseWriteOptions options; + options.filename = filename; + options.label = "T"; + options.threshold = 1e-10; + options.binary = false; + options.istep = 0; + options.reduce = false; + options.csr_format = true; + options.ucell = &ucell; + options.nspin = 2; + options.ispin = 1; + ModuleIO::save_sparse(sparse_matrix, all_R_coor, pv, options); + + const std::vector lines = read_lines(filename); + ASSERT_GE(lines.size(), 12); + EXPECT_EQ(lines[2], " 2 # number of spin directions"); + EXPECT_EQ(lines[3], " 2 # spin index"); + EXPECT_EQ(lines[4], " 2 # number of localized basis"); + // Only R vectors with at least one element above the threshold are listed, + // so the header count matches the written R blocks. + EXPECT_EQ(lines[5], " 1 # number of Bravais lattice vector R"); + + const std::string output = read_file(filename); + EXPECT_THAT(output, testing::HasSubstr(" 0 0 0 1\n # CSR values\n")); + // The empty R block must not be persisted: sparse output stores only the + // non-zero R set, regardless of how many candidate R vectors were passed. + EXPECT_EQ(output.find(" 1 0 0 0"), std::string::npos); + + std::remove(filename.c_str()); +} + +TEST(HsSparseIo, SparseCsrWritesComplexValues) +{ + const std::string filename = testing::TempDir() + "write_hs_r_csr_complex_lx.csr"; + std::remove(filename.c_str()); + + Parallel_Orbitals pv; + init_serial_orbitals(pv); + const Abfs::Vector3_Order r_vector(0, 0, 0); + std::set> all_R_coor; + all_R_coor.insert(r_vector); + std::map, + std::map>>> sparse_matrix; + sparse_matrix[r_vector][0][0] = std::complex(1.5, -2.5); + // below the threshold, must not appear in the CSR payload + sparse_matrix[r_vector][1][0] = std::complex(1e-12, 0.0); + + UnitCell ucell; + init_unitcell(ucell); + + ModuleIO::SparseWriteOptions options; + options.filename = filename; + options.label = "Lx"; + options.threshold = 1e-10; + options.binary = false; + options.precision = 8; + options.istep = 0; + options.reduce = false; + options.csr_format = true; + options.ucell = &ucell; + ModuleIO::save_sparse(sparse_matrix, all_R_coor, pv, options); + + const std::vector lines = read_lines(filename); + ASSERT_GE(lines.size(), 6); + // istep = 0 is the first ionic step, printed one-based as 1 + EXPECT_EQ(lines[0].compare(0, 12, "Ionic_Step 1"), 0); + EXPECT_EQ(lines[1], " # print Lx matrix in real space Lx(R)"); + EXPECT_EQ(lines[2], " 1 # number of spin directions"); + EXPECT_EQ(lines[3], " 1 # spin index"); + EXPECT_EQ(lines[4], " 2 # number of localized basis"); + EXPECT_EQ(lines[5], " 1 # number of Bravais lattice vector R"); + + const std::string output = read_file(filename); + EXPECT_THAT(output, testing::HasSubstr("0 0 0 1\n")); + EXPECT_THAT(output, testing::HasSubstr( + " # CSR values\n (1.50000000e+00,-2.50000000e+00)\n")); + EXPECT_THAT(output, testing::HasSubstr(" # CSR column indices\n 0\n")); + EXPECT_THAT(output, testing::HasSubstr(" # CSR row pointers\n 0 1 1\n")); + + std::remove(filename.c_str()); +} + int main(int argc, char** argv) { #ifdef __MPI diff --git a/source/source_io/module_hs/unittests/test_hsk_writer.cpp b/source/source_io/module_hs/unittests/test_hsk_writer.cpp index 39c55c4b088..50297795b8e 100644 --- a/source/source_io/module_hs/unittests/test_hsk_writer.cpp +++ b/source/source_io/module_hs/unittests/test_hsk_writer.cpp @@ -20,7 +20,9 @@ #include "source_base/module_parallel/para_mpi_func.h" #include "source_base/module_parallel/para_world.h" #include "source_base/parallel_comm.h" +#include "source_base/parallel_common.h" #include "source_basis/module_ao/parallel_orbitals.h" +#include "source_cell/klist.h" #include "source_hamilt/hamilt.h" #include "gtest/gtest.h" @@ -40,6 +42,9 @@ namespace /// Rank in DIAG_WORLD; 0 without MPI. int test_rank = 0; +/// Size of DIAG_WORLD; 1 without MPI. +int test_world_size = 1; + /// Collectively synchronize DIAG_WORLD through the guarded Parallel wrappers. /// Governance rule 9 forbids direct MPI calls in tests; no-op in serial builds. void diag_world_barrier() @@ -143,6 +148,35 @@ std::vector distribute_matrix(const Parallel_Orbitals& pv, return local; } +/** + * @brief Extract the block of a global square matrix owned by this rank, + * using the column-major local storage of genelpa/elpa/scalapack_gvx. + */ +template +std::vector distribute_matrix_column_major(const Parallel_Orbitals& pv, + const std::vector& global, + const int dim) +{ + std::vector local(pv.para_2d().size(), T()); + for (int i = 0; i < dim; ++i) + { + const int ir = pv.para_2d().irloc(i); + if (ir < 0) + { + continue; + } + for (int j = 0; j < dim; ++j) + { + const int ic = pv.para_2d().icloc(j); + if (ic >= 0) + { + local[ir + ic * pv.para_2d().nrloc()] = global[i * dim + j]; + } + } + } + return local; +} + /** * @brief Pack the upper triangle of a square matrix row by row. */ @@ -217,6 +251,17 @@ std::string expected_filename(const std::string& property, gamma_only, k_istep); } +/** + * @brief Construct a minimal K_Vectors in place that satisfies the write_hsk + * text path requirements. Binary path callers never read these fields. + */ +void fill_dummy_kv(const int nkstot, K_Vectors& kv) +{ + kv.kvec_c.resize(nkstot); + kv.kvec_d.resize(nkstot); + kv.wk.assign(nkstot, 1.0); +} + /** * @brief Open the running-log stream on a per-rank file. */ @@ -227,6 +272,66 @@ std::ofstream open_running_log() return std::ofstream(filename.c_str()); } +/** + * @brief Collect every "(real,imag)" pair written after the matrix-size line. + * + * The text writer stores the dense matrix in row-major order, so the returned + * sequence follows matrix rows and columns directly. + */ +std::vector> read_text_complex_values(const std::string& filename) +{ + std::ifstream ifs(filename.c_str()); + EXPECT_TRUE(ifs.is_open()) << filename; + std::vector> values; + std::string line; + bool in_body = false; + while (std::getline(ifs, line)) + { + if (!in_body) + { + if (line.find("# size of this matrix") != std::string::npos) + { + in_body = true; + } + continue; + } + std::size_t pos = 0; + while ((pos = line.find('(', pos)) != std::string::npos) + { + const std::size_t comma = line.find(',', pos); + const std::size_t close = line.find(')', comma); + if (comma == std::string::npos || close == std::string::npos) + { + break; + } + const double real_part = std::stod(line.substr(pos + 1, comma - pos - 1)); + const double imag_part = std::stod(line.substr(comma + 1, close - comma - 1)); + values.push_back(std::complex(real_part, imag_part)); + pos = close + 1; + } + } + return values; +} + +/** + * @brief Count the Ionic_Step record headers in a text output file. + */ +int count_text_records(const std::string& filename) +{ + std::ifstream ifs(filename.c_str()); + EXPECT_TRUE(ifs.is_open()) << filename; + int count = 0; + std::string line; + while (std::getline(ifs, line)) + { + if (line.find("Ionic_Step ") == 0) + { + ++count; + } + } + return count; +} + } // namespace // --------------------------------------------------------------------------- @@ -279,7 +384,11 @@ TEST(WriteHsk, WritesHkAndSkForEveryKPoint) } std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + const std::vector efs = {0.0}; ModuleIO::write_hsk("", nspin, nks, nkstot, ik2iktot, isk, &fake, pv, + kv, nullptr, efs, gamma_only, k_out_app, k_istep, k_out_type, 8, dim, "cg", test_rank, ofs); @@ -357,7 +466,11 @@ TEST(WriteHsk, SkipsOverlapForSpinDownChannel) } std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + const std::vector efs = {0.0, 0.0}; ModuleIO::write_hsk("", nspin, nks, nkstot, ik2iktot, isk, &fake, pv, + kv, nullptr, efs, gamma_only, k_out_app, k_istep, k_out_type, 8, dim, "cg", test_rank, ofs); @@ -417,8 +530,12 @@ TEST(WriteHsk, WritesComplexKMatrix) remove_test_file(s_fn); std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + const std::vector efs = {0.0}; ModuleIO::write_hsk>("", nspin, nks, nkstot, ik2iktot, isk, &fake, pv, + kv, nullptr, efs, gamma_only, k_out_app, k_istep, k_out_type, 8, dim, "cg", test_rank, ofs); @@ -496,7 +613,11 @@ TEST(WriteHsk, Mode2OverwritesSameIstep) remove_test_file(s_fn); std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + const std::vector efs = {0.0}; ModuleIO::write_hsk("", nspin, nks, nkstot, ik2iktot, isk, &fake, pv, + kv, nullptr, efs, gamma_only, out_app_flag, istep, out_type, precision, dim, "cg", test_rank, ofs); @@ -509,6 +630,7 @@ TEST(WriteHsk, Mode2OverwritesSameIstep) diag_world_barrier(); ModuleIO::write_hsk("", nspin, nks, nkstot, ik2iktot, isk, &fake, pv, + kv, nullptr, efs, gamma_only, out_app_flag, istep, out_type, precision, dim, "cg", test_rank, ofs); @@ -533,14 +655,224 @@ TEST(WriteHsk, Mode2OverwritesSameIstep) remove_test_file("write_hsk_running_" + std::to_string(test_rank) + ".log"); } +// --------------------------------------------------------------------------- +// Text output: the complete dense matrix is written in row-major order with +// signed imaginary parts, and out_app_flag = 1 appends one record per step +// after the first write truncates the file. +// --------------------------------------------------------------------------- + +TEST(WriteHsk, WritesDenseTextAndAppendsRecords) +{ + // The dense-matrix value checks below assume that rank 0 owns every + // element. Under MPI the 1x1 block distribution leaves the off-diagonal + // elements unowned, so those elements are legitimately zero in the gathered + // matrix. The parallel run keeps the other WriteHsk cases, which still + // exercise the collective gather path. + if (test_world_size > 1) + { + return; + } + + const int dim = 2; + const int nspin = 1; + const int nks = 1; + const int nkstot = 1; + const std::vector ik2iktot = {0}; + const std::vector isk = {0}; + const bool gamma_only = false; + const int out_type = 1; // text + const int out_app_flag = 1; // append after the first step + const int precision = 8; + + Parallel_Orbitals pv; + initialize_distribution(pv, dim); + + FakeHamilt> fake; + fake.dim = dim; + + std::vector> hk_first(dim * dim); + std::vector> sk_first(dim * dim); + for (int i = 0; i < dim * dim; ++i) + { + hk_first[i] = std::complex(100.0 + i + 0.5, -100.0 - i - 0.25); + sk_first[i] = std::complex(-100.0 - i - 0.5, 100.0 + i + 0.125); + } + fake.set_k_matrix(0, distribute_matrix(pv, hk_first, dim), + distribute_matrix(pv, sk_first, dim)); + + // Text mode drops the extra "k" and the .dat suffix: hk1_nao.txt/sk1_nao.txt. + const std::string out_dir = testing::TempDir(); + const std::string h_fn = out_dir + "hk1_nao.txt"; + const std::string s_fn = out_dir + "sk1_nao.txt"; + remove_test_file(h_fn); + remove_test_file(s_fn); + + std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + kv.set_nkstot(nkstot); + kv.set_nkstot_nospin(nkstot); + const std::vector efs = {0.0}; + + ModuleIO::write_hsk>(out_dir, nspin, nks, nkstot, + ik2iktot, isk, &fake, pv, + kv, nullptr, efs, + gamma_only, out_app_flag, 0, + out_type, precision, dim, "cg", + test_rank, ofs); + + diag_world_barrier(); + + std::vector> hk_second(dim * dim); + std::vector> sk_second(dim * dim); + for (int i = 0; i < dim * dim; ++i) + { + hk_second[i] = std::complex(200.0 + i + 0.5, -200.0 - i - 0.75); + sk_second[i] = std::complex(-200.0 - i - 0.5, 200.0 + i + 0.375); + } + fake.set_k_matrix(0, distribute_matrix(pv, hk_second, dim), + distribute_matrix(pv, sk_second, dim)); + + ModuleIO::write_hsk>(out_dir, nspin, nks, nkstot, + ik2iktot, isk, &fake, pv, + kv, nullptr, efs, + gamma_only, out_app_flag, 1, + out_type, precision, dim, "cg", + test_rank, ofs); + + if (test_rank == 0) + { + EXPECT_EQ(count_text_records(h_fn), 2); + EXPECT_EQ(count_text_records(s_fn), 2); + + const std::vector> h_values + = read_text_complex_values(h_fn); + ASSERT_EQ(h_values.size(), static_cast(2 * dim * dim)); + const std::vector> h_expected + = {hk_first[0], hk_first[1], hk_first[2], hk_first[3], + hk_second[0], hk_second[1], hk_second[2], hk_second[3]}; + for (size_t i = 0; i < h_values.size(); ++i) + { + EXPECT_NEAR(h_values[i].real(), h_expected[i].real(), 1e-6); + EXPECT_NEAR(h_values[i].imag(), h_expected[i].imag(), 1e-6); + } + + const std::vector> s_values + = read_text_complex_values(s_fn); + ASSERT_EQ(s_values.size(), static_cast(2 * dim * dim)); + const std::vector> s_expected + = {sk_first[0], sk_first[1], sk_first[2], sk_first[3], + sk_second[0], sk_second[1], sk_second[2], sk_second[3]}; + for (size_t i = 0; i < s_values.size(); ++i) + { + EXPECT_NEAR(s_values[i].real(), s_expected[i].real(), 1e-6); + EXPECT_NEAR(s_values[i].imag(), s_expected[i].imag(), 1e-6); + } + } + + remove_test_file(h_fn); + remove_test_file(s_fn); + ofs.close(); + remove_test_file("write_hsk_running_" + std::to_string(test_rank) + ".log"); +} + +// --------------------------------------------------------------------------- +// Text body order follows the documented row-major (i, j) traversal even when +// the solver stores its local block column-major (genelpa/elpa/scalapack_gvx). +// A non-Hermitian probe matrix makes an accidental transpose visible. +// --------------------------------------------------------------------------- + +TEST(WriteHsk, TextBodyKeepsRowMajorOrderForColumnMajorSolver) +{ + if (test_world_size > 1) + { + return; + } + + const int dim = 2; + const int nspin = 1; + const int nks = 1; + const int nkstot = 1; + const std::vector ik2iktot = {0}; + const std::vector isk = {0}; + const bool gamma_only = false; + const int out_type = 1; + const int out_app_flag = 0; + const int precision = 8; + + Parallel_Orbitals pv; + initialize_distribution(pv, dim); + + FakeHamilt> fake; + fake.dim = dim; + + const std::vector> hk_global + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + const std::vector> sk_global + = {std::complex(7.0, 0.0), std::complex(8.0, 1.0), + std::complex(9.0, 2.0), std::complex(10.0, 0.0)}; + fake.set_k_matrix(0, distribute_matrix_column_major(pv, hk_global, dim), + distribute_matrix_column_major(pv, sk_global, dim)); + + const std::string out_dir = testing::TempDir(); + const std::string h_fn = out_dir + "hk1_nao.txt"; + const std::string s_fn = out_dir + "sk1_nao.txt"; + remove_test_file(h_fn); + remove_test_file(s_fn); + + std::ofstream ofs = open_running_log(); + K_Vectors kv; + fill_dummy_kv(nkstot, kv); + kv.set_nkstot(nkstot); + kv.set_nkstot_nospin(nkstot); + const std::vector efs = {0.0}; + + ModuleIO::write_hsk>(out_dir, nspin, nks, nkstot, + ik2iktot, isk, &fake, pv, + kv, nullptr, efs, + gamma_only, out_app_flag, 0, + out_type, precision, dim, "genelpa", + test_rank, ofs); + diag_world_barrier(); + + if (test_rank == 0) + { + const std::vector> h_values + = read_text_complex_values(h_fn); + ASSERT_EQ(h_values.size(), hk_global.size()); + for (size_t i = 0; i < h_values.size(); ++i) + { + EXPECT_NEAR(h_values[i].real(), hk_global[i].real(), 1e-6); + EXPECT_NEAR(h_values[i].imag(), hk_global[i].imag(), 1e-6); + } + + const std::vector> s_values + = read_text_complex_values(s_fn); + ASSERT_EQ(s_values.size(), sk_global.size()); + for (size_t i = 0; i < s_values.size(); ++i) + { + EXPECT_NEAR(s_values[i].real(), sk_global[i].real(), 1e-6); + EXPECT_NEAR(s_values[i].imag(), sk_global[i].imag(), 1e-6); + } + } + + remove_test_file(h_fn); + remove_test_file(s_fn); + ofs.close(); + remove_test_file("write_hsk_running_" + std::to_string(test_rank) + ".log"); +} + int main(int argc, char** argv) { #ifdef __MPI MPI_Init(&argc, &argv); DIAG_WORLD = MPI_COMM_WORLD; MPI_Comm_rank(DIAG_WORLD, &test_rank); + test_world_size = Parallel_Common::comm_size(DIAG_WORLD); #else test_rank = 0; + test_world_size = 1; #endif testing::InitGoogleTest(&argc, argv); diff --git a/source/source_io/module_hs/unittests/test_hsr_writer.cpp b/source/source_io/module_hs/unittests/test_hsr_writer.cpp index 3675d48d2e5..c9ef7aedcd3 100644 --- a/source/source_io/module_hs/unittests/test_hsr_writer.cpp +++ b/source/source_io/module_hs/unittests/test_hsr_writer.cpp @@ -30,6 +30,14 @@ namespace { +/** + * @brief Rank of this process, captured in main() before GoogleTest runs. + * + * The file-I/O tests read and remove files shared by all ranks, so they only + * run the assertions on rank 0. + */ +int my_rank = 0; + /** * @brief Helper: compare two filenames with a clear failure message. */ @@ -144,12 +152,44 @@ TEST(HsrWriterFname, DhrNegativeStepSuppressesStep) expect_fname_eq("dHrs1_nao.csr", fname); } +// --------------------------------------------------------------------------- +// dhk_gen_fname: dH(k) filename, spin suffix only for nspin == 2 +// --------------------------------------------------------------------------- + +TEST(HsrWriterFname, DhkSingleSpinKeepsBareName) +{ + // nspin=1: no spin suffix, no step suffix in modes 0/1 + const std::string fname = ModuleIO::dhk_gen_fname("dhk1x_ia1", 0, 1, false, 3); + expect_fname_eq("dhk1x_ia1_nao.txt", fname); +} + +TEST(HsrWriterFname, DhkSpinPolarizedAddsSpinSuffix) +{ + // nspin=2: one file per spin channel + const std::string fname = ModuleIO::dhk_gen_fname("dhk1x_ia1", 1, 2, false, 3); + expect_fname_eq("dhk1x_ia1s2_nao.txt", fname); +} + +TEST(HsrWriterFname, DhkNumberedWithStep) +{ + // out_app_flag == 2: one file per ionic step + const std::string fname = ModuleIO::dhk_gen_fname("dhk3z_ia2", 1, 2, true, 4); + expect_fname_eq("dhk3z_ia2s2g5_nao.txt", fname); +} + // --------------------------------------------------------------------------- // write_hcontainer_csr: CSR text format layout // --------------------------------------------------------------------------- TEST(HsrWriterIo, HContainerCsrHeaderKeepsCurrentFormat) { + // File I/O is not MPI-collective; run it on rank 0 only to avoid two + // ranks racing on the same file when the test binary is launched with + // mpirun. + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_header_h.csr"; std::remove(filename.c_str()); @@ -163,10 +203,12 @@ TEST(HsrWriterIo, HContainerCsrHeaderKeepsCurrentFormat) // label "H": header carries the Fermi energy of this spin channel const double efermi_eV = 5.4321; - ModuleIO::write_hcontainer_csr(filename, &ucell, 5, &matrix, 0, false, 0, 1, "H", "", efermi_eV, true); + const bool written = ModuleIO::write_hcontainer_csr( + filename, &ucell, 5, &matrix, 0, false, 0, 1, "H", "", efermi_eV, true); + EXPECT_TRUE(written); const std::string output = read_file(filename); - EXPECT_THAT(output, testing::HasSubstr(" --- Ionic Step 1 ---\n")); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 1 # ABACUS version:")); EXPECT_THAT(output, testing::HasSubstr(" # print H matrix in real space H(R)\n")); EXPECT_THAT(output, testing::HasSubstr(" 1 # number of spin directions\n")); EXPECT_THAT(output, testing::HasSubstr(" 1 # spin index, E_Fermi = 5.4321 eV\n")); @@ -187,6 +229,10 @@ TEST(HsrWriterIo, HContainerCsrHeaderKeepsCurrentFormat) TEST(HsrWriterIo, GammaFoldedHeaderKeepsCsrReadable) { + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_gamma_folded.csr"; const std::string representation_note = "gamma-only folded matrix; stored R-space contributions are summed into R = (0, 0, 0)"; @@ -222,6 +268,10 @@ TEST(HsrWriterIo, GammaFoldedHeaderKeepsCsrReadable) TEST(HsrWriterIo, HContainerCsrAppendKeepsCurrentStepSections) { + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_append_s.csr"; std::remove(filename.c_str()); @@ -239,9 +289,9 @@ TEST(HsrWriterIo, HContainerCsrAppendKeepsCurrentStepSections) ModuleIO::write_hcontainer_csr(filename, &ucell, 4, &matrix, 1, true, 0, 1, "S", "", ignored_efermi, false); const std::string output = read_file(filename); - EXPECT_EQ(count_substr(output, " --- Ionic Step "), 2); - EXPECT_THAT(output, testing::HasSubstr(" --- Ionic Step 1 ---\n")); - EXPECT_THAT(output, testing::HasSubstr(" --- Ionic Step 2 ---\n")); + EXPECT_EQ(count_substr(output, "Ionic_Step "), 2); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 1 # ABACUS version:")); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 2 # ABACUS version:")); EXPECT_EQ(count_substr(output, " # print S matrix in real space S(R)\n"), 2); // S(R) files must not contain a Fermi energy annotation EXPECT_THAT(output, testing::Not(testing::HasSubstr("E_Fermi"))); @@ -251,6 +301,10 @@ TEST(HsrWriterIo, HContainerCsrAppendKeepsCurrentStepSections) TEST(HsrWriterIo, HContainerCsrHeaderCarriesPerChannelFermi) { + if (my_rank != 0) + { + return; + } UnitCell ucell; init_unitcell(ucell); Parallel_Orbitals pv; @@ -284,6 +338,10 @@ TEST(HsrWriterIo, HContainerCsrHeaderCarriesPerChannelFermi) TEST(HsrWriterIo, HContainerBinaryWritesSortedAndEmptyRBlocks) { + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_native_binary_real.dat"; std::remove(filename.c_str()); @@ -326,6 +384,10 @@ TEST(HsrWriterIo, HContainerBinaryWritesSortedAndEmptyRBlocks) TEST(HsrWriterIo, HContainerBinaryWritesComplexValuesAsDoublePairs) { + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_native_binary_complex.dat"; std::remove(filename.c_str()); @@ -371,6 +433,10 @@ TEST(HsrWriterIo, HContainerBinaryWritesComplexValuesAsDoublePairs) TEST(HsrWriterIo, HContainerBinaryAppendsAndCanOverwrite) { + if (my_rank != 0) + { + return; + } const std::string filename = "write_hs_r_native_binary_append.dat"; std::remove(filename.c_str()); @@ -550,24 +616,31 @@ TEST(HsrWriterIo, WriteHsrTextCsrCarriesPerSpinFermiFromEfermi) hr_vec.push_back(&hr_dw); std::ofstream ofs_running_null; // not opened; test does not inspect the running log + // write_hsr is MPI-collective (it calls gatherParallels), so every rank + // must enter it. Only rank 0 actually writes the files, so the subsequent + // read-back and assertions are guarded to rank 0 to avoid a race where a + // non-zero rank removes the file before rank 0 can inspect it. ModuleIO::write_hsr( hr_vec, &sr, &ucell, 1, 8, pv.para_2d(), true, true, iat2iwt_ptr, 1, 0, "./", eferm, ofs_running_null); - const std::string output_up = read_file(hr_up_filename); - const std::string output_dw = read_file(hr_dw_filename); - - // write_hsr multiplies each spin's Fermi by Ry_to_eV and passes has_efermi=true - std::ostringstream expected_up; - expected_up << " 1 # spin index, E_Fermi = " << std::setprecision(6) << ef_up_eV << " eV\n"; - std::ostringstream expected_dw; - expected_dw << " 2 # spin index, E_Fermi = " << std::setprecision(6) << ef_dw_eV << " eV\n"; - EXPECT_THAT(output_up, testing::HasSubstr(expected_up.str())); - EXPECT_THAT(output_dw, testing::HasSubstr(expected_dw.str())); - - std::remove(hr_up_filename.c_str()); - std::remove(hr_dw_filename.c_str()); - std::remove(sr_filename.c_str()); + if (my_rank == 0) + { + const std::string output_up = read_file(hr_up_filename); + const std::string output_dw = read_file(hr_dw_filename); + + // write_hsr multiplies each spin's Fermi by Ry_to_eV and passes has_efermi=true + std::ostringstream expected_up; + expected_up << " 1 # spin index, E_Fermi = " << std::setprecision(6) << ef_up_eV << " eV\n"; + std::ostringstream expected_dw; + expected_dw << " 2 # spin index, E_Fermi = " << std::setprecision(6) << ef_dw_eV << " eV\n"; + EXPECT_THAT(output_up, testing::HasSubstr(expected_up.str())); + EXPECT_THAT(output_dw, testing::HasSubstr(expected_dw.str())); + + std::remove(hr_up_filename.c_str()); + std::remove(hr_dw_filename.c_str()); + std::remove(sr_filename.c_str()); + } } int main(int argc, char** argv) @@ -575,7 +648,8 @@ int main(int argc, char** argv) #ifdef __MPI MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD, &GlobalV::NPROC); - MPI_Comm_rank(MPI_COMM_WORLD, &GlobalV::MY_RANK); + MPI_Comm_rank(MPI_COMM_WORLD, &my_rank); + GlobalV::MY_RANK = my_rank; #endif ::testing::InitGoogleTest(&argc, argv); diff --git a/source/source_io/module_hs/unittests/test_lat_r_csr.cpp b/source/source_io/module_hs/unittests/test_lat_r_csr.cpp index 7e3d4985482..b036a5aef5a 100644 --- a/source/source_io/module_hs/unittests/test_lat_r_csr.cpp +++ b/source/source_io/module_hs/unittests/test_lat_r_csr.cpp @@ -90,6 +90,50 @@ TEST(ModuleIOTest, SaveLatR) std::remove("test_save_lat_r_0.dat"); } +TEST(ModuleIOTest, SaveLatREmptyCsrMatchesZeroBlock) +{ + const std::string reference_name = testing::TempDir() + "test_lat_r_empty_reference.dat"; + const std::string direct_name = testing::TempDir() + "test_lat_r_empty_direct.dat"; + std::remove(reference_name.c_str()); + std::remove(direct_name.c_str()); + + GlobalV::DRANK = 0; + Parallel_Blkcyclic layout; + layout.set_serial(5, 5); + ModuleIO::SparseWriteOptions options; + options.threshold = 1e-8; + options.binary = false; + options.precision = 8; + options.reduce = false; + + const ModuleIO::SparseRBlock empty_block; + std::ofstream reference(reference_name); + ASSERT_TRUE(reference.is_open()); + ModuleIO::save_lat_r_csr(reference, empty_block, layout, options); + reference.close(); + + std::ofstream direct(direct_name); + ASSERT_TRUE(direct.is_open()); + ModuleIO::save_lat_r_empty_csr(direct, 5, options); + direct.close(); + + std::ifstream reference_in(reference_name); + std::ifstream direct_in(direct_name); + ASSERT_TRUE(reference_in.is_open()); + ASSERT_TRUE(direct_in.is_open()); + const std::string reference_output((std::istreambuf_iterator(reference_in)), + std::istreambuf_iterator()); + const std::string direct_output((std::istreambuf_iterator(direct_in)), + std::istreambuf_iterator()); + EXPECT_EQ(direct_output, reference_output); + EXPECT_THAT(direct_output, + testing::HasSubstr(" # CSR values\n # CSR column indices\n" + " # CSR row pointers\n 0 0 0 0 0 0\n")); + + std::remove(reference_name.c_str()); + std::remove(direct_name.c_str()); +} + TEST(ModuleIOTest, SaveLatRComplexKeepsHighPrecision) { const std::string filename = "test_save_lat_r_complex.dat"; diff --git a/source/source_io/module_hs/unittests/test_pos_op_csr.cpp b/source/source_io/module_hs/unittests/test_pos_op_csr.cpp index 4ece2398d5f..f5f35fffd56 100644 --- a/source/source_io/module_hs/unittests/test_pos_op_csr.cpp +++ b/source/source_io/module_hs/unittests/test_pos_op_csr.cpp @@ -1,35 +1,14 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "csr_test_helpers.h" + #include "source_io/module_hs/pos_op_csr.h" #include #include #include -namespace -{ -std::vector read_lines(const std::string& filename) -{ - std::ifstream ifs(filename.c_str()); - std::vector lines; - std::string line; - while (std::getline(ifs, line)) - { - lines.push_back(line); - } - return lines; -} - -template -T read_binary_value(std::ifstream& ifs) -{ - T value{}; - ifs.read(reinterpret_cast(&value), sizeof(T)); - return value; -} -} // namespace - TEST(PosOpCsr, LatRNonemptySkipsEmptyBlocks) { int empty_counts[3] = {0, 0, 0}; @@ -51,6 +30,9 @@ TEST(PosOpCsr, CsrAssembleTextAllowsZeroBlocks) std::ofstream payload(payload_filename.c_str()); payload.close(); + UnitCell ucell; + init_unitcell(ucell); + ModuleIO::detail::assemble_csr(output_filename, payload_filename, 9, @@ -58,13 +40,20 @@ TEST(PosOpCsr, CsrAssembleTextAllowsZeroBlocks) 0, false, false, + "x", + &ucell, "PosOpCsr"); - const std::vector lines = read_lines(output_filename); - ASSERT_EQ(lines.size(), 3); - EXPECT_EQ(lines[0], "STEP: 9"); - EXPECT_EQ(lines[1], "Matrix Dimension of r(R): 2"); - EXPECT_EQ(lines[2], "Matrix number of r(R): 0"); + const std::string output = read_file(output_filename); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 9 # ABACUS version:")); + EXPECT_THAT(output, testing::HasSubstr(" # print r matrix in real space r(R) x-component\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # number of spin directions\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # spin index\n")); + EXPECT_THAT(output, testing::HasSubstr(" 2 # number of localized basis\n")); + EXPECT_THAT(output, testing::HasSubstr(" 0 # number of Bravais lattice vector R\n")); + EXPECT_THAT(output, testing::HasSubstr("user_defined_lattice\n")); + EXPECT_THAT(output, testing::HasSubstr("Direct\n 0 0.25 0.5\n")); + EXPECT_THAT(output, testing::HasSubstr("CSR Format")); std::remove(payload_filename.c_str()); std::remove(output_filename.c_str()); @@ -87,6 +76,9 @@ TEST(PosOpCsr, CsrAssembleTextKeepsSingleDirectionPayload) payload << "0\n"; payload.close(); + UnitCell ucell; + init_unitcell(ucell); + ModuleIO::detail::assemble_csr(output_filename, payload_filename, 10, @@ -94,18 +86,16 @@ TEST(PosOpCsr, CsrAssembleTextKeepsSingleDirectionPayload) 1, false, false, + "y", + &ucell, "PosOpCsr"); - const std::vector lines = read_lines(output_filename); - ASSERT_EQ(lines.size(), 10); - EXPECT_EQ(lines[0], "STEP: 10"); - EXPECT_EQ(lines[1], "Matrix Dimension of r(R): 2"); - EXPECT_EQ(lines[2], "Matrix number of r(R): 1"); - EXPECT_EQ(lines[3], "1 0 -1"); - EXPECT_EQ(lines[4], "1"); - EXPECT_EQ(lines[5], " 4.00000000e+00"); - EXPECT_EQ(lines[8], "0"); - EXPECT_EQ(lines[9], "0"); + const std::string output = read_file(output_filename); + EXPECT_THAT(output, testing::HasSubstr("Ionic_Step 10 # ABACUS version:")); + EXPECT_THAT(output, testing::HasSubstr(" # print r matrix in real space r(R) y-component\n")); + EXPECT_THAT(output, testing::HasSubstr(" 1 # number of Bravais lattice vector R\n")); + EXPECT_THAT(output, testing::HasSubstr("1 0 -1\n")); + EXPECT_THAT(output, testing::HasSubstr(" 4.00000000e+00\n")); std::remove(payload_filename.c_str()); std::remove(output_filename.c_str()); @@ -148,6 +138,8 @@ TEST(PosOpCsr, CsrAssembleBinaryKeepsHeaderAndPayloadOrder) 1, true, false, + "x", + nullptr, "PosOpCsr"); std::ifstream ifs(output_filename, std::ios::binary); diff --git a/source/source_io/module_hs/vxc_op_lip.cpp b/source/source_io/module_hs/vxc_op_lip.cpp index bc82bede525..6bf834ab154 100644 --- a/source/source_io/module_hs/vxc_op_lip.cpp +++ b/source/source_io/module_hs/vxc_op_lip.cpp @@ -199,15 +199,14 @@ void write_Vxc_LIP(int nspin, #endif // add-up and write - const int istep_mat = -1; const int out_label = 1; // 1 means .txt while 2 means .dat const int out_app_flag = 0; std::string vxc_file = ModuleIO::filename_output( global_out_dir, "vxc", "nao", ik, kv.ik2iktot, nspin, kv.get_nkstot(), - out_label, out_app_flag, gamma_only, istep_mat); + out_label, out_app_flag, gamma_only, istep); - ModuleIO::save_mat(istep_mat, vxc_tot_k_mo.data(), nbands, + ModuleIO::save_mat(istep, vxc_tot_k_mo.data(), nbands, false, out_ndigits, true, out_app_flag, vxc_file, p2d_serial, drank, ks_solver, false); diff --git a/source/source_io/module_hs/vxc_op_mat.cpp b/source/source_io/module_hs/vxc_op_mat.cpp index dfbc6c76eba..b6a2c610c97 100644 --- a/source/source_io/module_hs/vxc_op_mat.cpp +++ b/source/source_io/module_hs/vxc_op_mat.cpp @@ -4,7 +4,9 @@ #include "source_base/module_out/filename.h" #include "source_base/parallel_reduce.h" #include "source_io/module_hs/hs_dense_io.h" +#include "source_io/module_output/frame_append.h" #include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" namespace ModuleIO { @@ -31,12 +33,14 @@ void write_Vxc(const int nspin, const bool dft_plus_u, const bool gamma_only, const bool out_mat, + const int out_app_flag, const std::string& mat_dir, const std::string& global_out_dir, const int out_ndigits, const std::string& ks_solver, bool cal_exx, - const Exx_Info& exx_info + const Exx_Info& exx_info, + std::ofstream& ofs_running #ifdef __EXX , std::vector>>>* Hexxd, @@ -121,13 +125,14 @@ void write_Vxc(const int nspin, // write the full MO-basis matrix only when requested if (out_mat) { - const int istep = -1; const int out_label = 1; // 1 means .txt while 2 means .dat - const int out_app_flag = 0; - const bool append_vxc = (out_app_flag == 1); + // Mode 1 appends the frames written after the first ionic step; + // mode 0 truncates to the latest snapshot and mode 2 writes a + // separate g{istep+1} file for each step. + const bool append_vxc = frame_appends(out_app_flag, istep); std::string vxc_file = ModuleIO::filename_output( mat_dir, - "vxc", "nao", ik, kv.ik2iktot, nspin, kv.get_nkstot(), + "vxcmo", "nao", ik, kv.ik2iktot, nspin, kv.get_nkstot(), out_label, out_app_flag, gamma_only, istep); ModuleIO::save_mat(istep, @@ -141,6 +146,11 @@ void write_Vxc(const int nspin, p2d, drank, ks_solver); + + if (GlobalV::MY_RANK == 0) + { + ModuleIO::write_notice(ofs_running, "Vxc(MO)", is, nspin, vxc_file); + } } } @@ -148,15 +158,30 @@ void write_Vxc(const int nspin, { const double etot_eV = etot * ModuleBase::Ry_to_eV; const std::string time_stamp = local_timestamp(); + // Mode 1 appends the frames written after the first ionic step; modes + // 0 and 2 truncate (mode 2 writes a separate g{step} file). + const bool append = frame_appends(out_app_flag, istep); const std::string header_tot = build_eband_header(istep, etot_eV, "V_xc", time_stamp); - write_orb_energy(kv, nspin0, nbands, e_orb_tot, "eband_vxc.txt", header_tot, global_out_dir); + const std::string name_tot = eband_filename("eband_vxc", istep, out_app_flag); + write_orb_energy(kv, nspin0, nbands, e_orb_tot, name_tot, header_tot, global_out_dir, append); + const std::string property_tot = "Band-decomposed V_xc energy"; + const std::string path_tot = global_out_dir + name_tot; + ModuleIO::write_notice(ofs_running, property_tot, path_tot); #ifdef __EXX if (cal_exx) { const std::string header_loc = build_eband_header(istep, etot_eV, "V_xc_local", time_stamp); const std::string header_exx = build_eband_header(istep, etot_eV, "V_EXX", time_stamp); - write_orb_energy(kv, nspin0, nbands, e_orb_locxc, "eband_vxc_local.txt", header_loc, global_out_dir); - write_orb_energy(kv, nspin0, nbands, e_orb_exx, "eband_vxc_exx.txt", header_exx, global_out_dir); + const std::string name_loc = eband_filename("eband_vxc_local", istep, out_app_flag); + const std::string name_exx = eband_filename("eband_vxc_exx", istep, out_app_flag); + write_orb_energy(kv, nspin0, nbands, e_orb_locxc, name_loc, header_loc, global_out_dir, append); + write_orb_energy(kv, nspin0, nbands, e_orb_exx, name_exx, header_exx, global_out_dir, append); + const std::string property_loc = "Band-decomposed V_xc_local energy"; + const std::string property_exx = "Band-decomposed V_EXX energy"; + const std::string path_loc = global_out_dir + name_loc; + const std::string path_exx = global_out_dir + name_exx; + ModuleIO::write_notice(ofs_running, property_loc, path_loc); + ModuleIO::write_notice(ofs_running, property_exx, path_exx); } #endif } @@ -167,8 +192,8 @@ template void write_Vxc( const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, - const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const std::string&, - const std::string&, const int, const std::string&, bool, const Exx_Info& + const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const int, const std::string&, + const std::string&, const int, const std::string&, bool, const Exx_Info&, std::ofstream& #ifdef __EXX , std::vector>>>*, std::vector>>>>* @@ -179,8 +204,8 @@ template void write_Vxc, double>( const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, - const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const std::string&, - const std::string&, const int, const std::string&, bool, const Exx_Info& + const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const int, const std::string&, + const std::string&, const int, const std::string&, bool, const Exx_Info&, std::ofstream& #ifdef __EXX , std::vector>>>*, std::vector>>>>* @@ -191,8 +216,8 @@ template void write_Vxc, std::complex>( const int, const int, const double, const int, const int, const Parallel_Orbitals*, const psi::Psi>&, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, - const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const std::string&, - const std::string&, const int, const std::string&, bool, const Exx_Info& + const ModuleBase::matrix&, Grid_Driver&, const bool, const bool, const bool, const int, const std::string&, + const std::string&, const int, const std::string&, bool, const Exx_Info&, std::ofstream& #ifdef __EXX , std::vector>>>*, std::vector>>>>* diff --git a/source/source_io/module_hs/vxc_op_mat.h b/source/source_io/module_hs/vxc_op_mat.h index 44860b52ca9..99d2d785e7a 100644 --- a/source/source_io/module_hs/vxc_op_mat.h +++ b/source/source_io/module_hs/vxc_op_mat.h @@ -11,6 +11,7 @@ #include "source_io/module_hs/vxc_op_tools.h" #include +#include #include #include #include @@ -32,9 +33,12 @@ namespace ModuleIO /// including terms: local/semi-local XC, EXX, DFTU. /// The band-decomposed diagonal energies (eband_vxc.txt and, with EXX, /// eband_vxc_local.txt and eband_vxc_exx.txt) are always written to -/// global_out_dir; the full MO-basis matrices (vxc_nao.txt / vxck*_nao.txt) -/// are written to mat_dir only when out_mat is true. +/// global_out_dir; the full MO-basis matrices (vxcmok*_nao.txt) are written to +/// mat_dir only when out_mat is true. The MO-basis name keeps the "vxcmo" +/// property so that it never collides with the NAO-basis "vxck*_nao.txt" +/// produced by out_mat_vxck. /// @param istep Zero-based ionic step index; written one-based in the header +/// @param out_app_flag Output mode: 0 overwrites, 1 appends, 2 adds g{step} /// @param etot Total energy of the current frame in Ry /// @tparam TK K-point data type (double or std::complex) /// @tparam TR Real-space data type (double or std::complex) @@ -60,12 +64,14 @@ void write_Vxc(const int nspin, const bool dft_plus_u, const bool gamma_only, const bool out_mat, + const int out_app_flag, const std::string& mat_dir, const std::string& global_out_dir, const int out_ndigits, const std::string& ks_solver, bool cal_exx, - const Exx_Info& exx_info + const Exx_Info& exx_info, + std::ofstream& ofs_running #ifdef __EXX , std::vector>>>* Hexxd, diff --git a/source/source_io/module_hs/vxc_op_r.cpp b/source/source_io/module_hs/vxc_op_r.cpp index c1ca15afc4a..cf8a04351bc 100644 --- a/source/source_io/module_hs/vxc_op_r.cpp +++ b/source/source_io/module_hs/vxc_op_r.cpp @@ -1,7 +1,9 @@ #include "vxc_op_r.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" #include "source_io/module_hs/hs_sparse_io.h" +#include "source_io/module_hs/hs_sparse_io_detail.h" #include "source_base/module_out/filename.h" namespace ModuleIO @@ -34,7 +36,8 @@ void write_Vxc_R(const int nspin, const std::string& global_out_dir, bool cal_exx, double hybrid_alpha, - bool real_number + bool real_number, + const int istep #ifdef __EXX , const std::vector>>>* Hexxd, @@ -42,6 +45,7 @@ void write_Vxc_R(const int nspin, #endif , const double sparse_thr, + const int precision, std::ofstream& ofs_running) { ModuleBase::TITLE("ModuleIO", "write_Vxc_R"); @@ -114,23 +118,36 @@ void write_Vxc_R(const int nspin, } // 4. write Vxc(R) in csr format + // This matrix is a final-step snapshot: it is computed once at the end of + // the calculation, so every out_app_flag mode keeps the fixed filename and + // truncates any previous content. The header still records the real + // one-based ionic step. for (int is = 0; is < nspin0; ++is) { std::set> all_R_coor = sparse_format::get_R_range(vxcs_R_ao[is]); - const std::string filename = "Vxc_R_spin" + std::to_string(is); + const std::string spin_suffix = "s" + std::to_string(is + 1); + const std::string filename + = ModuleIO::detail::make_sparse_R_filename("vxcr", spin_suffix, false, -1, ".csr"); ModuleIO::SparseWriteOptions options; - options.filename = global_out_dir + filename + ".csr"; - options.label = filename; + options.filename = global_out_dir + filename; + options.label = "Vxc"; options.threshold = sparse_thr; + options.precision = precision; options.binary = false; - options.istep = -1; + options.istep = istep; + options.out_app_flag = 0; options.reduce = true; + // Match the H(R)/S(R) CSR layout: self-describing header with the + // cell block and every R vector listed, including empty ones. + options.csr_format = true; + options.ucell = &ucell; + options.nspin = nspin; + options.ispin = is; ModuleIO::save_sparse(cal_HR_sparse(vxcs_R_ao[is], sparse_thr), all_R_coor, *pv, options); - const std::string spin_tag = ModuleIO::make_spin_tag(is, nspin); - ofs_running << " Write Vxc(R)" << spin_tag << " matrix in NAO basis to file: " << options.filename << std::endl; + ModuleIO::write_matrix_notice(ofs_running, "Vxc(R)", is, nspin, options.filename); } } @@ -139,33 +156,33 @@ template void write_Vxc_R( const int, const Parallel_Orbitals*, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, Grid_Driver&, - const std::string&, bool, double, bool + const std::string&, bool, double, bool, const int #ifdef __EXX , const std::vector>>>*, const std::vector>>>>* #endif - , const double, std::ofstream&); + , const double, const int, std::ofstream&); template void write_Vxc_R, double>( const int, const Parallel_Orbitals*, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, Grid_Driver&, - const std::string&, bool, double, bool + const std::string&, bool, double, bool, const int #ifdef __EXX , const std::vector>>>*, const std::vector>>>>* #endif - , const double, std::ofstream&); + , const double, const int, std::ofstream&); template void write_Vxc_R, std::complex>( const int, const Parallel_Orbitals*, const UnitCell&, Structure_Factor&, surchem&, const ModulePW::PW_Basis&, const ModulePW::PW_Basis&, const ModuleBase::matrix&, const Charge&, const K_Vectors&, const std::vector&, Grid_Driver&, - const std::string&, bool, double, bool + const std::string&, bool, double, bool, const int #ifdef __EXX , const std::vector>>>*, const std::vector>>>>* #endif - , const double, std::ofstream&); + , const double, const int, std::ofstream&); } // namespace ModuleIO diff --git a/source/source_io/module_hs/vxc_op_r.h b/source/source_io/module_hs/vxc_op_r.h index 85f42be1ae5..016e67a9595 100644 --- a/source/source_io/module_hs/vxc_op_r.h +++ b/source/source_io/module_hs/vxc_op_r.h @@ -26,6 +26,8 @@ namespace ModuleIO /// @brief Write the Vxc matrix in real space (R), useful for GW calculation /// including terms: local/semi-local XC, EXX, DFTU +/// The files are named vxcrs{spin}_nao.csr as a final-step snapshot; the +/// spin index is one-based. /// @tparam TK K-point data type (double or std::complex) /// @tparam TR Real-space data type (double or std::complex) template @@ -44,7 +46,8 @@ void write_Vxc_R(const int nspin, const std::string& global_out_dir, bool cal_exx, double hybrid_alpha, - bool real_number + bool real_number, + const int istep #ifdef __EXX , const std::vector>>>* Hexxd, @@ -52,6 +55,7 @@ void write_Vxc_R(const int nspin, #endif , const double sparse_thr, + const int precision, std::ofstream& ofs_running); } // namespace ModuleIO diff --git a/source/source_io/module_hs/vxc_op_tools.cpp b/source/source_io/module_hs/vxc_op_tools.cpp index 52b420bac3d..f3a902df9cd 100644 --- a/source/source_io/module_hs/vxc_op_tools.cpp +++ b/source/source_io/module_hs/vxc_op_tools.cpp @@ -133,6 +133,20 @@ void write_orb_energy(const K_Vectors& kv, } } +std::string eband_filename(const std::string& stem, + const int istep, + const int out_app_flag) +{ + std::string name = stem; + // Modes 0 and 1 reuse the fixed name; only mode 2 numbers the frames. + if (out_app_flag == 2) + { + name += "g" + std::to_string(istep + 1); + } + name += ".txt"; + return name; +} + std::string build_eband_header(const int istep, const double etot_eV, const std::string& term_symbol, @@ -140,7 +154,7 @@ std::string build_eband_header(const int istep, { const int istep_one_based = istep + 1; const std::string step_lines = FmtCore::format( - "# RELAX STEP %d, Energy: %.8f eV\n" + "# Ionic_Step %d, Energy: %.8f eV\n" "# e_{ikn} = in the KS orbital basis\n" "# units: columns are e/2 in Hartree and e in eV; data rows follow nk, nspin0, nbands\n", istep_one_based, diff --git a/source/source_io/module_hs/vxc_op_tools.h b/source/source_io/module_hs/vxc_op_tools.h index e2acf05ba42..e2fc71a3604 100644 --- a/source/source_io/module_hs/vxc_op_tools.h +++ b/source/source_io/module_hs/vxc_op_tools.h @@ -94,6 +94,15 @@ void write_orb_energy(const K_Vectors& kv, const std::string& global_out_dir, const bool app = false); +/// @brief Compose the name of a band-decomposed energy file. +/// @param stem Base name without extension, e.g. "eband_vxc" +/// @param istep Zero-based ionic step index; mode 2 prints it one-based +/// @param out_app_flag Output mode: 2 appends g{step} to the stem +/// @return File name such as "eband_vxc.txt" or "eband_vxcg5.txt" +std::string eband_filename(const std::string& stem, + const int istep, + const int out_app_flag); + /// @brief Build the five comment lines preceding band-decomposed energy data. /// @param istep Zero-based ionic step index, printed one-based. /// @param etot_eV Total energy of the written frame in eV. diff --git a/source/source_io/module_mulliken/cal_mag.h b/source/source_io/module_mulliken/cal_mag.h index c5477200a76..a57726e2135 100644 --- a/source/source_io/module_mulliken/cal_mag.h +++ b/source/source_io/module_mulliken/cal_mag.h @@ -32,6 +32,7 @@ void cal_mag(Parallel_Orbitals* pv, UnitCell& ucell, const Grid_Driver& gd, const int istep, + const int out_app_flag, const bool print) { if (PARAM.inp.out_mul) @@ -49,8 +50,7 @@ void cal_mag(Parallel_Orbitals* pv, ucell.atom_mulliken = mulp.get_atom_mulliken(atom_chg); if (print && GlobalV::MY_RANK == 0) { - cell_index.write_orb_info(PARAM.globalv.global_out_dir); - mulp.write(istep, PARAM.globalv.global_out_dir); + mulp.write(istep, out_app_flag, PARAM.globalv.global_out_dir, GlobalV::ofs_running); mulp.print_atom_mag(atom_chg, GlobalV::ofs_running); } } diff --git a/source/source_io/module_mulliken/output_mulliken.cpp b/source/source_io/module_mulliken/output_mulliken.cpp index afbf4b93392..7db7a004ccd 100644 --- a/source/source_io/module_mulliken/output_mulliken.cpp +++ b/source/source_io/module_mulliken/output_mulliken.cpp @@ -3,6 +3,8 @@ #include "source_io/module_mulliken/output_sk.h" #include "source_io/module_parameter/parameter.h" #include "source_base/formatter.h" +#include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #include "source_base/name_angular.h" #include "source_base/module_external/scalapack_connector.h" #include "source_base/tool_quit.h" @@ -91,21 +93,31 @@ Output_Mulliken::Output_Mulliken(Output_Sk* output_sk, } template -void Output_Mulliken::write(int istep, std::string out_dir) +void Output_Mulliken::write(int istep, int out_app_flag, std::string out_dir, std::ofstream& ofs_running) { std::vector tot_chg = this->get_tot_chg(); std::vector> atom_chg = this->get_atom_chg(); std::map, double> orb_chg = this->get_orb_chg(); std::stringstream as; - as << out_dir << "mulliken.txt"; - std::ofstream os; - if (istep == 0) + as << out_dir << "mulliken"; + // Modes 0 and 1 reuse the fixed filename (mode 0 overwrites, mode 1 appends + // each written step); only mode 2 embeds the one-based step number. + if (out_app_flag == 2) { - os.open(as.str(), std::ios::out); + as << "g" << istep + 1; } - else + as << ".txt"; + std::ios_base::openmode mode = std::ios::out; + const bool append_step = (out_app_flag == 1) && (istep > 0); + if (append_step) + { + mode |= std::ios::app; + } + std::ofstream os; + os.open(as.str(), mode); + if (!os.is_open()) { - os.open(as.str(), std::ios::app); + ModuleBase::WARNING_QUIT("Output_Mulliken::write", "Cannot open file: " + as.str()); } if (this->nspin_ == 1) { @@ -124,6 +136,8 @@ void Output_Mulliken::write(int istep, std::string out_dir) ModuleBase::WARNING_QUIT("Output_Mulliken::write", "nspin must be 1, 2 or 4"); } os.close(); + + ModuleIO::write_notice(ofs_running, "Mulliken population", as.str()); } template @@ -135,7 +149,9 @@ void Output_Mulliken::write_mulliken_nspin1(int istep, { os << std::setprecision(4); /// step info - os << " --- Ionic Step " << istep+1 << " ---" << std::endl; + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; + os << ModuleIO::prov_step(istep_one_based, time_stamp); os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%10.4f"); @@ -206,7 +222,9 @@ void Output_Mulliken::write_mulliken_nspin2(int istep, { os << std::setprecision(4); /// step info - os << " --- Ionic Step " << istep+1 << " ---" << std::endl; + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; + os << ModuleIO::prov_step(istep_one_based, time_stamp); os << " Total charge " << tot_chg[0] + tot_chg[1] << std::endl; os << " Total charge of spin1 " << tot_chg[0] << std::endl; os << " Total charge of spin2 " << tot_chg[1] << std::endl; @@ -299,7 +317,9 @@ void Output_Mulliken::write_mulliken_nspin4(int istep, { os << std::setprecision(4); /// step info - os << " --- Ionic Step " << istep+1 << " ---" << std::endl; + const std::string time_stamp = ModuleIO::local_timestamp(); + const int istep_one_based = istep + 1; + os << ModuleIO::prov_step(istep_one_based, time_stamp); os << " Total charge " << tot_chg[0] << std::endl; /// orbital decomposed mulliken populations FmtCore fmt_of_chg("%10.4f"); diff --git a/source/source_io/module_mulliken/output_mulliken.h b/source/source_io/module_mulliken/output_mulliken.h index 5a9d635d3b3..10c43c26f21 100644 --- a/source/source_io/module_mulliken/output_mulliken.h +++ b/source/source_io/module_mulliken/output_mulliken.h @@ -5,6 +5,7 @@ #include "source_basis/module_ao/parallel_orbitals.h" #include "source_cell/cell_index.h" +#include #include #include @@ -51,7 +52,13 @@ class Output_Mulliken const std::vector& isk, int nspin); /// the outer interface to write the Mulliken population charges - void write(int istep, std::string out_dir); + /// @param istep zero-based ionic step index; printed one-based and used for + /// the g{step} filename suffix in out_app_flag mode 2 + /// @param out_app_flag output mode: 0 overwrites, 1 appends, 2 writes one + /// numbered file per written step + /// @param out_dir directory that receives mulliken.txt + /// @param ofs_running running log stream, open on the writing rank only + void write(int istep, int out_app_flag, std::string out_dir, std::ofstream& ofs_running); /// print atom mag to running log file void print_atom_mag(const std::vector>& atom_chg, std::ostream& os); /// get total charge diff --git a/source/source_io/module_output/cube_io.h b/source/source_io/module_output/cube_io.h index 26496b8407c..49b9e6ae12c 100644 --- a/source/source_io/module_output/cube_io.h +++ b/source/source_io/module_output/cube_io.h @@ -108,6 +108,33 @@ void write_cube(const std::string& file, const bool append, const int ndata_line = 6); +/// write the two comment lines, the grid geometry and the atom list of a cube +/// file, and leave the stream configured for the following scientific data block +void write_cube_header(std::ofstream& ofs, + const std::vector& comment, + const int& natom, + const std::vector& origin, + const int& nx, + const int& ny, + const int& nz, + const std::vector& dx, + const std::vector& dy, + const std::vector& dz, + const std::vector& atom_type, + const std::vector& atom_charge, + const std::vector>& atom_pos, + const int precision); + +/// write a cube header for a volumetric field sampled on the ucell grid +/// (grid spacings, atom types and Cartesian positions are derived from ucell) +void write_cube_header_for_cell(std::ofstream& ofs, + const UnitCell& ucell, + const int nx, + const int ny, + const int nz, + const std::vector& comment, + const int precision); + /** * @brief The trilinear interpolation method * diff --git a/source/source_io/module_output/frame_append.h b/source/source_io/module_output/frame_append.h new file mode 100644 index 00000000000..186ca95a6a4 --- /dev/null +++ b/source/source_io/module_output/frame_append.h @@ -0,0 +1,38 @@ +#ifndef FRAME_APPEND_H +#define FRAME_APPEND_H + +#include +#include + +namespace ModuleIO +{ + +/// @brief Tell whether an output written for ionic step `istep` should append. +/// +/// Mode 1 appends every frame after the first ionic step, keeping one trajectory +/// file. Mode 0 truncates to the latest snapshot and mode 2 writes a separate +/// file per step, so neither of them appends. +/// +/// @param out_app_flag Output append mode, must be 0, 1 or 2. +/// @param istep Zero-based ionic step index, must be non-negative. +/// @return true when the frame must be appended to an existing file. +/// @throws std::invalid_argument if out_app_flag or istep is out of range. +inline bool frame_appends(const int out_app_flag, const int istep) +{ + if (out_app_flag < 0 || out_app_flag > 2) + { + throw std::invalid_argument("frame_appends: out_app_flag must be 0, 1 or 2, got " + + std::to_string(out_app_flag)); + } + if (istep < 0) + { + throw std::invalid_argument("frame_appends: istep must be non-negative, got " + + std::to_string(istep)); + } + + return out_app_flag == 1 && istep > 0; +} + +} // namespace ModuleIO + +#endif // FRAME_APPEND_H diff --git a/source/source_io/module_output/print_info.cpp b/source/source_io/module_output/print_info.cpp index 23a9d37c11c..c3701ec3e5e 100644 --- a/source/source_io/module_output/print_info.cpp +++ b/source/source_io/module_output/print_info.cpp @@ -363,15 +363,15 @@ void print_screen(const int& stress_step, const int& force_step, const int& iste { if (PARAM.inp.calculation == "relax") { - std::cout << " RELAX STEP: " << unsigned(istep) << std::endl; - GlobalV::ofs_running << " RELAX STEP: " << unsigned(istep) << std::endl; + std::cout << " Ionic_Step: " << unsigned(istep) << std::endl; + GlobalV::ofs_running << " Ionic_Step: " << unsigned(istep) << std::endl; } else if (PARAM.inp.calculation == "cell-relax") { - std::cout << " RELAX STEP: " << unsigned(istep); + std::cout << " Ionic_Step: " << unsigned(istep); std::cout << " (CELL# " << unsigned(stress_step); std::cout << " IONS# " << unsigned(force_step) << ")" << std::endl; - GlobalV::ofs_running << " RELAX STEP: " << unsigned(istep); + GlobalV::ofs_running << " Ionic_Step: " << unsigned(istep); GlobalV::ofs_running << " (CELL# " << unsigned(stress_step); GlobalV::ofs_running << " IONS# " << unsigned(force_step) << ")" << std::endl; } diff --git a/source/source_io/module_output/provenance_header.h b/source/source_io/module_output/provenance_header.h index 654cbe03860..656cc4e024d 100644 --- a/source/source_io/module_output/provenance_header.h +++ b/source/source_io/module_output/provenance_header.h @@ -34,6 +34,24 @@ inline std::string provenance_header(const std::string& time_stamp) time_stamp.c_str()); } +/// Two provenance lines followed by the unified "# Ionic_Step N" marker. +inline std::string prov_step(const int istep_one_based, const std::string& time_stamp) +{ + return FmtCore::format("# ABACUS version: %s\n# Written at %s\n# Ionic_Step %d\n", + VERSION, + time_stamp.c_str(), + istep_one_based); +} + +/// Inline provenance for formats such as Cube that reserve a fixed number of +/// header lines. Callers append this to an existing comment line. +inline std::string prov_inline(const std::string& time_stamp) +{ + return FmtCore::format(" # ABACUS version: %s # Written at %s", + VERSION, + time_stamp.c_str()); +} + } // namespace ModuleIO #endif // MODULEIO_PROVENANCE_HEADER_H diff --git a/source/source_io/module_output/write_cube.cpp b/source/source_io/module_output/write_cube.cpp index 6fc55dc7954..9f21d59de99 100644 --- a/source/source_io/module_output/write_cube.cpp +++ b/source/source_io/module_output/write_cube.cpp @@ -2,6 +2,8 @@ #include "source_base/parallel_comm.h" #include "source_base/parallel_grid.h" #include "source_io/module_output/cube_io.h" +#include "source_io/module_output/provenance_header.h" +#include "source_io/module_output/write_notice.h" #include @@ -44,6 +46,8 @@ void ModuleIO::write_vdata_palgrid(const Parallel_Grid& pgrid, start = time(nullptr); const bool is_primary_band_group = GlobalV::MY_BNDGROUP == 0; + const int istep_one_based = istep + 1; + const std::string time_stamp = ModuleIO::local_timestamp(); // reduce std::vector data_xyz_full(nxyz); // data to be written @@ -75,7 +79,9 @@ void ModuleIO::write_vdata_palgrid(const Parallel_Grid& pgrid, ss << std::fixed; ss << std::setprecision(6); - ss << "Ionic_Step " << istep + 1 << " Cubefile created from ABACUS. Inner loop is z, followed by y and x" << std::endl; + ss << "Ionic_Step " << istep_one_based + << " Cubefile created from ABACUS. Inner loop is z, followed by y and x" + << ModuleIO::prov_inline(time_stamp) << std::endl; ss << nspin << " # number of spin directions "; if (out_fermi == 1) @@ -177,7 +183,7 @@ void ModuleIO::write_vdata_palgrid(const Parallel_Grid& pgrid, precision, append); - ofs_running << " Write " << data_desc << " to file: " << fn << std::endl; + ModuleIO::write_notice(ofs_running, data_desc, fn); end = time(nullptr); ModuleBase::GlobalFunc::OUT_TIME("write_vdata_palgrid", start, end); @@ -203,6 +209,52 @@ void ModuleIO::write_cube(const std::string& file, const int precision, const bool append, const int ndata_line) +{ + assert(data.size() >= nx * ny * nz); + + // In append mode (out_app_flag == 1) each written ionic step contributes + // one complete cube frame; the previous frame always ends with a newline, + // so the appended frame starts on a fresh line. Otherwise the file is + // truncated and holds a single frame. + std::ios_base::openmode open_mode = std::ios::out | std::ios::trunc; + if (append) + { + open_mode = std::ios::out | std::ios::app; + } + std::ofstream ofs(file, open_mode); + write_cube_header(ofs, comment, natom, origin, nx, ny, nz, dx, dy, dz, + atom_type, atom_charge, atom_pos, precision); + + const int nxy = nx * ny; + for (int ixy = 0; ixy < nxy; ++ixy) + { + for (int iz = 0; iz < nz; ++iz) + { + ofs << " " << data[ixy * nz + iz]; + if ((iz + 1) % ndata_line == 0 && iz != nz - 1) + { + ofs << "\n"; + } + } + ofs << "\n"; + } + ofs.close(); +} + +void ModuleIO::write_cube_header(std::ofstream& ofs, + const std::vector& comment, + const int& natom, + const std::vector& origin, + const int& nx, + const int& ny, + const int& nz, + const std::vector& dx, + const std::vector& dy, + const std::vector& dz, + const std::vector& atom_type, + const std::vector& atom_charge, + const std::vector>& atom_pos, + const int precision) { assert(comment.size() >= 2); for (int i = 0; i < 2; ++i) @@ -223,19 +275,6 @@ void ModuleIO::write_cube(const std::string& file, assert(atom_pos[i].size() >= 3); } - assert(data.size() >= nx * ny * nz); - - // In append mode (out_app_flag == 1) each written ionic step contributes - // one complete cube frame; the previous frame always ends with a newline, - // so the appended frame starts on a fresh line. Otherwise the file is - // truncated and holds a single frame. - std::ios_base::openmode open_mode = std::ios::out | std::ios::trunc; - if (append) - { - open_mode = std::ios::out | std::ios::app; - } - std::ofstream ofs(file, open_mode); - for (int i = 0; i < 2; ++i) { ofs << comment[i] << "\n"; @@ -260,18 +299,68 @@ void ModuleIO::write_cube(const std::string& file, ofs.unsetf(std::ofstream::fixed); ofs << std::setprecision(precision); ofs << std::scientific; - const int nxy = nx * ny; - for (int ixy = 0; ixy < nxy; ++ixy) +} + +void ModuleIO::write_cube_header_for_cell(std::ofstream& ofs, + const UnitCell& ucell, + const int nx, + const int ny, + const int nz, + const std::vector& comment, + const int precision) +{ + const double fac = ucell.lat0; + std::vector dx = {fac * ucell.latvec.e11 / double(nx), + fac * ucell.latvec.e12 / double(nx), + fac * ucell.latvec.e13 / double(nx)}; + std::vector dy = {fac * ucell.latvec.e21 / double(ny), + fac * ucell.latvec.e22 / double(ny), + fac * ucell.latvec.e23 / double(ny)}; + std::vector dz = {fac * ucell.latvec.e31 / double(nz), + fac * ucell.latvec.e32 / double(nz), + fac * ucell.latvec.e33 / double(nz)}; + + std::vector atom_type; + std::vector atom_charge; + std::vector> atom_pos; + for (int it = 0; it < ucell.ntype; it++) { - for (int iz = 0; iz < nz; ++iz) + // erase the number in label, such as Fe1. + std::string element = ucell.atoms[it].label; + std::string::iterator temp = element.begin(); + while (temp != element.end()) { - ofs << " " << data[ixy * nz + iz]; - if ((iz + 1) % ndata_line == 0 && iz != nz - 1) + if ((*temp >= '1') && (*temp <= '9')) { - ofs << "\n"; + temp = element.erase(temp); + } + else + { + temp++; } } - ofs << "\n"; + + for (int ia = 0; ia < ucell.atoms[it].na; ia++) + { + // convert from label to atomic number + int z = 0; + for (int j = 0; j != ModuleBase::element_name.size(); j++) + { + if (element == ModuleBase::element_name[j]) + { + z = j + 1; + break; + } + } + atom_type.push_back(z); + atom_charge.push_back(ucell.atoms[it].ncpp.zv); + atom_pos.push_back({fac * ucell.atoms[it].tau[ia].x, + fac * ucell.atoms[it].tau[ia].y, + fac * ucell.atoms[it].tau[ia].z}); + } } - ofs.close(); + + std::vector origin(3, 0.0); + write_cube_header(ofs, comment, ucell.nat, origin, nx, ny, nz, dx, dy, dz, + atom_type, atom_charge, atom_pos, precision); } diff --git a/source/source_io/module_output/write_notice.h b/source/source_io/module_output/write_notice.h new file mode 100644 index 00000000000..b8d21a85f12 --- /dev/null +++ b/source/source_io/module_output/write_notice.h @@ -0,0 +1,75 @@ +#ifndef MODULEIO_WRITE_NOTICE_H +#define MODULEIO_WRITE_NOTICE_H + +#include +#include + +#include "spin_tag.h" + +namespace ModuleIO +{ + +/// @brief Announce a written output file in the running log. +/// +/// All file-written notices share this single template so that the verb, +/// the preposition and the spin label stay identical across writers: +/// " Write to file: ". +/// +/// @param ofs_running running log stream, open on the writing rank only. +/// @param property name of the written quantity, e.g. "Charge density". +/// @param file_name path of the written file. +inline void write_notice(std::ofstream& ofs_running, + const std::string& property, + const std::string& file_name) +{ + ofs_running << " Write " << property << " to file: " << file_name << std::endl; +} + +/// @brief Announce a spin-resolved output file in the running log. +/// +/// @param ofs_running running log stream, open on the writing rank only. +/// @param property name of the written quantity, e.g. "DOS". +/// @param is spin channel index. +/// @param nspin number of spin channels; the label is empty unless nspin == 2. +/// @param file_name path of the written file. +inline void write_notice(std::ofstream& ofs_running, + const std::string& property, + const int is, + const int nspin, + const std::string& file_name) +{ + ofs_running << " Write " << property << make_spin_tag(is, nspin) << " to file: " << file_name << std::endl; +} + +/// @brief Announce a written NAO-basis matrix file in the running log. +/// +/// @param ofs_running running log stream, open on the writing rank only. +/// @param property name of the matrix, e.g. "DM(k)" or "dS/dR (x component)". +/// @param file_name path of the written file. +inline void write_matrix_notice(std::ofstream& ofs_running, + const std::string& property, + const std::string& file_name) +{ + ofs_running << " Write " << property << " matrix in NAO basis to file: " << file_name << std::endl; +} + +/// @brief Announce a written spin-resolved NAO-basis matrix file in the log. +/// +/// @param ofs_running running log stream, open on the writing rank only. +/// @param property name of the matrix, e.g. "DM(R)". +/// @param is spin channel index. +/// @param nspin number of spin channels; the label is empty unless nspin == 2. +/// @param file_name path of the written file. +inline void write_matrix_notice(std::ofstream& ofs_running, + const std::string& property, + const int is, + const int nspin, + const std::string& file_name) +{ + ofs_running << " Write " << property << make_spin_tag(is, nspin) + << " matrix in NAO basis to file: " << file_name << std::endl; +} + +} // namespace ModuleIO + +#endif diff --git a/source/source_io/module_output/write_orb_info.cpp b/source/source_io/module_output/write_orb_info.cpp index 8f6117a6a9c..f3feea96683 100644 --- a/source/source_io/module_output/write_orb_info.cpp +++ b/source/source_io/module_output/write_orb_info.cpp @@ -1,10 +1,11 @@ #include "write_orb_info.h" #include "source_io/module_parameter/parameter.h" +#include "source_io/module_output/write_notice.h" #include "source_base/name_angular.h" #include "source_cell/atom_spec.h" -void ModuleIO::write_orb_info(const UnitCell* ucell) +void ModuleIO::write_orb_info(const UnitCell* ucell, std::ofstream& ofs_running) { std::stringstream os; os << PARAM.globalv.global_out_dir << "nao.txt"; @@ -39,5 +40,7 @@ void ModuleIO::write_orb_info(const UnitCell* ucell) out << std::setw(5) << "#sym" << std::setw(2) << "=" << std::setw(2) << "Symmetry name of real orbital" << std::endl; out.close(); + write_notice(ofs_running, "NAO orbital table", os.str()); + return; } diff --git a/source/source_io/module_output/write_orb_info.h b/source/source_io/module_output/write_orb_info.h index 3a035f5679a..463868bd7eb 100644 --- a/source/source_io/module_output/write_orb_info.h +++ b/source/source_io/module_output/write_orb_info.h @@ -2,9 +2,11 @@ #define WRITE_ORB_INFO #include "source_cell/unitcell.h" +#include + namespace ModuleIO { - void write_orb_info(const UnitCell* ucell); + void write_orb_info(const UnitCell* ucell, std::ofstream& ofs_running); } #endif diff --git a/source/source_io/module_parameter/input_parameter.h b/source/source_io/module_parameter/input_parameter.h index b837b985a85..d4d230b0d11 100644 --- a/source/source_io/module_parameter/input_parameter.h +++ b/source/source_io/module_parameter/input_parameter.h @@ -462,7 +462,7 @@ struct Input_para int out_freq_elec = 0; ///< the frequency of electronic iter to output charge and wavefunction int out_freq_ion = 0; ///< the frequency ( >= 0 ) of ionic step to output charge density; ///< 0: output only when ion steps are finished - int out_freq_td = 0; ///< output interval in RT-TDDFT + int out_freq_td_compat = 0; ///< legacy alias out_freq_td for out_freq_ion in RT-TDDFT std::vector out_chg = {0, 3}; ///< output charge density. 0: no; 1: yes bool out_occ_mat = true; ///< output DFT+U occupation matrices; ///< frequency controlled by out_freq_ion/out_freq_elec diff --git a/source/source_io/module_parameter/read_inp_out.cpp b/source/source_io/module_parameter/read_inp_out.cpp index 52e88104a6d..78ece09dc06 100644 --- a/source/source_io/module_parameter/read_inp_out.cpp +++ b/source/source_io/module_parameter/read_inp_out.cpp @@ -19,7 +19,7 @@ void ReadInput::item_output() "\n\nThis parameter only controls how often a write happens, not how many files are kept: with out_app_flag = 0 each write overwrites the same fixed filename, with out_app_flag = 1 records are appended to one fixed filename, and with out_app_flag = 2 each written step gets its own g{step} file." "\n\nIn molecular dynamics calculations, out_freq_ion controls the cadence of the structure frames written when out_stru is positive; when out_freq_ion is 0, md_restartfreq is used as the structure-output frequency. The MD restart file Restart_md.txt always follows md_restartfreq and is independent of out_freq_ion." "\n\nFor DFT+U calculations with out_occ_mat = 1, a separate occupation-matrix file occ_matg{geom_step}.txt is created for every output ionic step. The converged (or final, if not converged) electronic step is always recorded in that file; when out_freq_elec is set smaller than scf_nmax, additional electronic steps are appended as separate sections, each labelled only with the electronic-step number." - "\n\n[NOTE] In RT-TDDFT calculations, this parameter is inactive; output frequency is instead controlled by out_freq_td."; + "\n\nIn RT-TDDFT calculations, this parameter counts completed electronic evolution steps (`STEP OF ELECTRON EVOLVE`) instead, because one ionic step contains `estep_per_md` electronic steps. To write once per ionic step, set it to `estep_per_md`."; item.default_value = "0"; item.unit = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { @@ -33,20 +33,17 @@ void ReadInput::item_output() } { Input_Item item("out_freq_td"); - item.annotation = "print information every few completed electronic iterations in RT-TDDFT"; + item.annotation = "deprecated alias for out_freq_ion in RT-TDDFT"; item.category = "Real-Time TDDFT (Common)"; item.type = "Integer"; - item.description = "Controls the output interval in completed electronic evolution steps during RT-TDDFT calculations. When set to a positive integer `n`, detailed information (see `out_freq_ion`) is printed every `n` electron time-evolution steps (i.e., every `STEP OF ELECTRON EVOLVE`). For example, if you wish to output information once per ionic step, you should set `out_freq_td` equal to `estep_per_md`, since one ionic step corresponds to `estep_per_md` electronic evolution steps." - "\n\n[NOTE] This parameter is only active in RT-TDDFT mode (`esolver_type = tddft`). It has no effect in ground-state calculations."; + item.description = "Deprecated alias for out_freq_ion in RT-TDDFT calculations. It counted completed electronic evolution steps and is now mapped to out_freq_ion when out_freq_ion is not set explicitly. If both parameters are present, out_freq_ion takes precedence." + "\n\n[NOTE] This parameter is ignored outside RT-TDDFT mode (`esolver_type = tddft`)."; item.default_value = "0"; item.unit = ""; - item.reset_value = [](const Input_Item& item, Parameter& para) { - if (para.input.out_freq_td <= 0) - { - para.input.out_freq_td = 0; // 0 means no output of info - } + item.read_value = [](const Input_Item& item, Parameter& para) { + para.input.out_freq_td_compat = std::stoi(item.str_values[0]); }; - read_sync_int(input.out_freq_td); + add_int_bcast(input.out_freq_td_compat); this->add_item(item); } { @@ -248,6 +245,8 @@ The optional second integer controls the output precision. If not provided, the The file names are fixed for out_app_flag = 0 (overwritten at every write) and out_app_flag = 1 (records appended). Only out_app_flag = 2 inserts a one-based geometry-step suffix before _nao (for example dmk1g1_nao.txt). + The optional second integer specifies the text precision (must be a positive integer); it defaults to 8. + [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.)"; @@ -379,7 +378,7 @@ Also controled by out_freq_ion and out_app_flag. * 0: no output * 1: output the density of states (DOS) and projected density of states (PDOS, LCAO only) * With out_app_flag = 0: fixed-name files (`doss{s}.txt`, `pdoss{s}.txt`) are truncated and overwritten at every write. - * With out_app_flag = 1: the same fixed-name files are reused; the first written step truncates them and later steps append one record per step (prefixed with a `# ionic step N` header, one-based). + * With out_app_flag = 1: the same fixed-name files are reused; the first written step truncates them and later steps append one record per step (prefixed with a `# Ionic_Step N` header, one-based). * With out_app_flag = 2: per-step files are named `doss{s}g{geom}.txt` and `pdoss{s}g{geom}.txt` where `{geom}` is the one-based geometry index (e.g. `doss1g3.txt` for the third ionic step). * nspin=1 or 4: one spin channel (`s1`). nspin=2: two channels (`s1`, `s2`). PW and LCAO use the same naming. Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will raise an error.)"; @@ -417,7 +416,9 @@ Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will rai * 0: no output * 1: output the partial charge density for given bias (controlled by stm_bias) in cube file format, which can be used to plot scanning tunneling spectroscopys to mimick STM images using the Python script plot.py. * 2: output LDOS along a line in real space (controlled by ldos_line). Parameters used to control DOS output are also valid for LDOS. -* 3: output both two LDOS modes above.)"; +* 3: output both two LDOS modes above. + +The LDOS is evaluated once after all ionic steps finish; the cube header records the final one-based ionic step as "Ionic_Step N".)"; item.default_value = "0"; item.unit = ""; item.read_value = [](const Input_Item& item, Parameter& para) { @@ -444,8 +445,9 @@ Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will rai item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; item.description = R"(Whether to output the eigenvalues of the Hamiltonian matrix (in eV) into the running log during electronic iterations and into a file at the end of calculations. The former can be used with the 'out_freq_elec' parameter while the latter option allows the output precision to be set via a second parameter, with a default value of 8. The output file names are: - * nspin = 1 or 4: eig.txt; - * nspin = 2: eigs1.txt and eigs2.txt; + * nspin = 1 or 4: band.txt; + * nspin = 2: bands1.txt and bands2.txt; + * with out_app_flag = 2 the files are written to OUT.${suffix}/BANDS/ and carry a g{step} suffix (for example bands1g2.txt), while modes 0/1 reuse the fixed name (mode 0 truncates, mode 1 appends each written step); * For more information, refer to the band.md)"; item.default_value = "False"; item.unit = ""; @@ -472,7 +474,7 @@ Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will rai item.annotation = "output projected band structure"; item.category = "Output information"; item.type = "Boolean"; - item.description = "Whether to output the projected band structure. For more information, refer to the band.md"; + item.description = "Whether to output the projected band structure. For more information, refer to the band.md. The files pbands{spin}.xml (out_app_flag = 0 and 1) or pbands{spin}g{step}.xml (out_app_flag = 2) describe the final ionic step only, because the projection is evaluated once after all ionic steps have finished."; item.default_value = "False"; item.unit = ""; read_sync_bool(input.out_proj_band); @@ -497,7 +499,7 @@ Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will rai item.type = "Integer"; item.description = "Controls the output of structure files per ionic step. The files are written to the OUT.{suffix}/ directory (or the OUT.{suffix}/STRUC/ subdirectory when out_app_flag is 2). Each file corresponds to the structure at the current ionic step; in the relaxation path the header comment records the ABACUS version, timestamp, energy, and stress tensor, while MD frames written to a cumulative file are prefixed with a one-based \"# MD step N\" marker. When out_freq_ion is positive and out_app_flag is not 0, the numbered files STRU{istep} (or STRU{istep}.cif) are written every out_freq_ion steps; when out_freq_ion is 0 or out_app_flag is 0, no numbered files are output (with out_app_flag = 0 the latest structure is still kept in STRU_NOW / STRU_NOW.cif). This parameter is effective for scf/nscf/relax/cell-relax and md; for md only values 0 and 1 are supported, because MD structure frames are written in ABACUS STRU format and read back by the restart logic, so value 2 (CIF) is rejected. For scf/nscf only STRU_FINAL (or STRU_FINAL.cif) is written.\n" " - 0: No structure files are output.\n" - " - 1: ABACUS STRU format files are output. In scf/nscf/relax/cell-relax the latest structure is written to STRU_NOW (overwritten each step), the numbered file STRU{istep} (e.g., STRU1, STRU2) is written every out_freq_ion steps (when out_freq_ion is positive), and the final converged structure is written to STRU_FINAL. No CIF files are output. When out_app_flag is 1, the numbered STRU{istep} files are replaced by a single fixed-name STRU file that appends one structure block (with a one-based \"# Ionic Step N\" or \"# MD step N\" comment) per written step.\n" + " - 1: ABACUS STRU format files are output. In scf/nscf/relax/cell-relax the latest structure is written to STRU_NOW (overwritten each step), the numbered file STRU{istep} (e.g., STRU1, STRU2) is written every out_freq_ion steps (when out_freq_ion is positive), and the final converged structure is written to STRU_FINAL. No CIF files are output. When out_app_flag is 1, the numbered STRU{istep} files are replaced by a single fixed-name STRU file that appends one structure block (with a one-based \"# Ionic_Step N\" or \"# MD step N\" comment) per written step.\n" " - 2: CIF format files are output. The latest structure is written to STRU_NOW.cif (overwritten each step), the numbered file STRU{istep}.cif (e.g., STRU1.cif, STRU2.cif) is written every out_freq_ion steps (when out_freq_ion is positive), and the final converged structure is written to STRU_FINAL.cif. No non-CIF files are output. When out_app_flag is 1, the numbered files are replaced by a fixed-name STRU.cif overwritten each written step. Not supported for calculation = md, which always writes ABACUS STRU frames.\n" "[NOTE] MD structure output differs from the ionic-relaxation path: frames are written every out_freq_ion steps, falling back to md_restartfreq when out_freq_ion is 0; out_app_flag = 0 keeps the numbered STRU{istep} files (STRU1 is the initial geometry) and no STRU_NOW is written; out_app_flag = 2 writes the numbered files under STRUC/; out_app_flag = 1 writes one cumulative STRU file that is truncated on the first frame of a fresh run and appended with a \"# MD step N\" marker afterwards. MD never writes STRU_NOW or STRU_FINAL. When a legacy STRU/ directory exists in the output directory, MD falls back to numbered STRU{istep} files inside that directory even if out_app_flag = 1.\n" "[NOTE] For backward compatibility, true/false (case insensitive) are accepted and converted to 1/0."; @@ -588,23 +590,24 @@ Note: values 2 and 3 are no longer supported. Setting out_dos to 2 or 3 will rai item.annotation = "output H(k) and S(k) matrices in reciprocal space"; item.category = "Output information"; item.type = R"(Integer \[Integer\](optional))"; - 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: + item.description = R"(Output 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: * 0: disabled; -* 1: text output; the optional second integer controls precision and defaults to 8; +* 1: text output; the optional second integer controls precision (must be a positive integer) and defaults to 8; * 2: binary output in the native ABACUS .dat format; * 3: NPZ output, which is not implemented for H(k)/S(k). +Text output (format 1) writes one self-describing record per ionic step: an Ionic_Step header, the k-point and basis metadata, a user_defined_lattice block, and then the complete dense N x N matrix in row-major order (all rows and columns, including both triangles), with four complex values for multi-k/spinor or eight real values for gamma-only per line. Binary output (format 2) stores 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 by the binary format. + The output is also controlled by out_freq_ion and out_app_flag. For more information, refer to hs_matrix.md. -* Gamma-only, nspin = 1: hk_nao.txt for the Hamiltonian matrix and sk_nao.txt for the overlap matrix. -* Gamma-only, nspin = 2: hks1_nao.txt and hks2_nao.txt for the two spin channels of the Hamiltonian matrix, and sk_nao.txt for the overlap matrix. Only one overlap matrix is written because it is identical for both spin channels. +* Gamma-only, nspin = 1: text writes h_nao.txt and s_nao.txt; binary writes hk_nao.dat and sk_nao.dat. +* Gamma-only, nspin = 2: text writes hs1_nao.txt and hs2_nao.txt for the two spin channels of the Hamiltonian matrix and s_nao.txt for the overlap matrix; binary writes hks1_nao.dat, hks2_nao.dat and sk_nao.dat. Only one overlap matrix is written because it is identical for both spin channels. * Gamma-only, nspin = 4: not available with the gamma-only algorithm. -* Multi-k, nspin = 1: hk1_nao.txt for the Hamiltonian matrix and sk1_nao.txt for the overlap matrix at the first k-point. -* 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. -* 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. -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. +* Multi-k, nspin = 1: text writes hk1_nao.txt and sk1_nao.txt for the first k-point; binary writes hk1_nao.dat and sk1_nao.dat. +* Multi-k, nspin = 2: text writes hk1s1_nao.txt, hk1s2_nao.txt and sk1_nao.txt; binary writes the same names with the .dat suffix. Only one overlap matrix is written because it is identical for both spin channels. +* Multi-k, nspin = 4: text writes one complex spinor matrix hk1_nao.txt and sk1_nao.txt; binary writes hk1s4_nao.dat and sk1_nao.dat. When out_app_flag is 0, the fixed file is truncated and overwritten at every write. When out_app_flag is 1, the first ionic step truncates the file and later steps append complete records. -When out_app_flag is 2, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt. +When out_app_flag is 2, g followed by the one-based ionic-step index is inserted before _nao, for example hk1s1g1_nao.txt or hg1_nao.txt. [NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.)"; item.default_value = "0 8"; @@ -747,7 +750,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output kinetic matrix of electrons T(k)"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Whether to print the upper triangular part of the kinetic matrices for each k-point into OUT.${suffix}/tks1ki_nao.txt, where i is the index of k points. One may optionally provide a second parameter to specify the precision." + item.description = "Whether to print the kinetic-energy matrices T(k) for each k-point into OUT.${suffix}. Text output uses the same self-describing layout as out_hsk 1: an Ionic_Step header, the k-point and basis metadata, a user_defined_lattice block, and then the complete dense N x N matrix in row-major order, with four complex values for multi-k or eight real values for gamma-only per line. T(k) is spin-independent, so no spin suffix is used: gamma-only calculations write t_nao.txt, multi-k calculations write tk{k}_nao.txt, where {k} is the one-based k-point index, and out_app_flag = 2 inserts a g{step} index before _nao. The optional second parameter specifies the text precision (must be a positive integer)." "\n\n[NOTE] In the 3.10-LTS version, the file names are data-TR-sparse_SPIN0.csr, etc."; item.default_value = "False [8]"; item.unit = "Ry"; @@ -769,7 +772,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output r(R) matrix"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Whether to print the matrix representation of the position matrix into files named rxrs1_nao.csr, ryrs1_nao.csr, rzrs1_nao.csr in the directory OUT.${suffix}. The optional second parameter controls text output precision. If calculation is set to get_s, the position matrix can be obtained without scf iterations. For more information, please refer to position_matrix.md." + item.description = "Whether to print the matrix representation of the position matrix. The three Cartesian components are written to rrx_nao.csr, rry_nao.csr and rrz_nao.csr in the matrix output directory (OUT.${suffix}/ when out_app_flag is 0 or 1, MAT/ when it is 2); with out_app_flag = 2 a g{step} index is inserted before _nao.csr, where {step} is the one-based ionic-step index. With out_app_flag = 0 or 1 the fixed file names are used (mode 0 overwrites them at every write, mode 1 appends one record per written ionic step). Each file uses the same self-describing header and CSR layout as H(R)/S(R): an ionic-step record, the matrix label, the number of spin directions and the spin index, the basis size, the number of non-empty Bravais lattice vectors actually written, the user_defined_lattice cell block, and one CSR block per non-empty Bravais lattice vector (an R vector is kept when at least one of its three Cartesian components has an element above the sparse threshold). The optional second parameter controls text output precision. If calculation is set to get_s, the position matrix can be obtained without scf iterations. For more information, please refer to position_matrix.md." "\n\n[NOTE] In the 3.10-LTS version, the file name is data-rR-sparse.csr."; item.default_value = "False 8"; item.unit = "Bohr"; @@ -808,7 +811,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output T(R) matrix"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Generate files containing the kinetic energy matrix. The optional second parameter controls text output precision. The format will be the same as the Hamiltonian matrix and overlap matrix as mentioned in out_hsr. The name of the files will be tr_nao.csr and so on. Also controled by out_freq_ion and out_app_flag." + item.description = "Generate files containing the kinetic energy matrix. The optional second parameter controls text output precision. A single file tr_nao.csr is written per ionic step: its header records the ionic step, the spin count (1, since T(R) is spin independent), the basis size, the number of non-empty Bravais lattice vectors actually written, and the unit cell, followed by one CSR block per non-empty R vector (values, column indices, row pointers). R vectors whose elements all fall below the sparse threshold are omitted. The name is trg{step}_nao.csr when out_app_flag = 2. Also controlled by out_freq_ion and out_app_flag." "\n\n[NOTE] In the 3.10-LTS version, the file name is data-TR-sparse_SPIN0.csr."; item.default_value = "False 8"; item.unit = "Ry"; @@ -836,7 +839,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output Hamiltonian derivatives dH/dR matrices"; item.category = "Output information"; item.type = "Integer"; - item.description = "Whether to print files containing the derivatives of the Hamiltonian matrix. The format will be the same as the Hamiltonian matrix and overlap matrix as mentioned in out_hsr. The name of the files will be dhrxs1_nao.csr, dhrys1_nao.csr, dhrzs1_nao.csr and so on. Also controled by out_freq_ion and out_app_flag." + item.description = "Whether to print files containing the Hamiltonian derivatives dH/dR. Only the k-space matrices are currently written, to MAT/ as dhk[xyz]_iat{I}[s{spin}][g{step}]_nao.txt: one file per differentiated atom I and Cartesian direction (multi-k runs add an _ik{ki} suffix), with the s{spin} suffix when nspin = 2 and the g{step} suffix only when out_app_flag = 2. Also controlled by out_freq_ion and out_app_flag." "\n\nFormat: [precision] [iat1 iat2 ...]. The first value (0/1) enables/disables output. The second optional value sets the output precision (default: 8). Starting from the third value, 1-based atom indices can be listed to restrict output to derivatives with respect to those specific atoms only; if no atom indices are given, all atoms are written." "\n\n[NOTE] In the 3.10-LTS version, the file name is data-dHRx-sparse_SPIN0.csr and so on."; item.default_value = "0 8"; @@ -1329,10 +1332,10 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output of derivative of S(R) matrix"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Whether to print files containing the derivatives of the overlap matrix. The optional second parameter controls text output precision. The format will be the same as the overlap matrix as mentioned in out_mat_dh. The name of the files will be dsxrs1_nao.csr and so on. Also controled by out_freq_ion and out_app_flag. This feature can be used with calculation get_s." + item.description = "Whether to print files containing the derivatives of the overlap matrix. The optional second parameter controls text output precision. The format will be the same as the overlap matrix as mentioned in out_mat_dh. The name of the files will be dsrx_nao.csr, dsry_nao.csr and dsrz_nao.csr (a g{step} index is inserted when out_app_flag = 2); the output is spin-independent. Also controlled by out_freq_ion and out_app_flag. This feature can be used with calculation get_s." "\n\n[NOTE] In the 3.10-LTS version, the file name is data-dSRx-sparse_SPIN0.csr and so on."; item.default_value = "False 8"; - item.unit = "Ry/Bohr"; + item.unit = "1/Bohr"; item.set_availability("basis_type==lcao and gamma_only==0"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); @@ -1363,7 +1366,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output exchange-correlation matrix in KS-orbital representation"; item.category = "Output information"; item.type = "Boolean"; - item.description = "Write exchange-correlation matrices in the Kohn-Sham orbital basis and their diagonal expectation values. The diagonal energies are saved in OUT.${suffix}/eband_vxc.txt. When EXX is calculated, its local and EXX contributions are also saved as eband_vxc_local.txt and eband_vxc_exx.txt in the same directory. Each energy file begins with nk, nspin, and nbands, followed by nk*nspin*nbands rows of energies in Hartree and eV." + item.description = "Write exchange-correlation matrices in the Kohn-Sham orbital basis and their diagonal expectation values. The diagonal energies are saved in OUT.${suffix}/eband_vxc.txt. When out_app_flag = 2 the energy files carry a g{step} suffix (for example eband_vxcg2.txt) and the full matrices are written to OUT.${suffix}/MAT/, while modes 0/1 reuse the fixed names (mode 0 truncates, mode 1 appends one frame per written step). When EXX is calculated, its local and EXX contributions are also saved as eband_vxc_local.txt and eband_vxc_exx.txt in the same directory. The full MO-basis matrices are named vxcmok{ik}s{spin}_nao.txt, where ik is the one-based k-point index and spin is omitted for nspin = 1; with gamma_only the k-point index is dropped (vxcmo_nao.txt). With basis_type = lcao_in_pw the matrices and eband_vxc*.txt files are written once to the MAT directory (OUT.${suffix}/MAT/ when out_app_flag = 2, else OUT.${suffix}/), as fixed names without a g{step} suffix: vxc_nao.txt for Gamma-only, vxck{ik}_nao.txt for multi-k (spin-resolved as vxck{ik}s{spin}_nao.txt for nspin = 2). Each energy file begins with nk, nspin, and nbands, followed by nk*nspin*nbands rows of energies in Hartree and eV." "\n\n[NOTE] In the 3.10-LTS version, the file name is k-$k-Vxc and so on."; item.default_value = "False"; item.unit = "Ry"; @@ -1376,7 +1379,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output exchange-correlation matrix in NAO representation"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Whether to print the exchange-correlation matrices in numerical orbital representation: in CSR format in the directory OUT.${suffix}. The name of the files will be vxcrs1_nao.csr and so on." + item.description = "Whether to print the exchange-correlation matrices in numerical orbital representation: in CSR format in the directory OUT.${suffix}. The name of the files will be vxcrs1_nao.csr and so on, with a one-based spin index. The matrix is a final-step snapshot, so no g{step} suffix is added." "\n\n[NOTE] In the 3.10-LTS version, the file name is Vxc_R_spin$s and so on."; item.default_value = "False 8"; item.unit = "Ry"; @@ -1404,7 +1407,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "output the expectation values of angular momentum operators"; item.category = "Output information"; item.type = R"(Boolean \[Integer\](optional))"; - item.description = "Whether to print the expectation value of the angular momentum operator , , and in the basis of the localized atomic orbitals. The files are named lx_nao.txt, ly_nao.txt, and lz_nao.txt (or lxg{step+1}_nao.txt etc. when out_app_flag = 2). The second integer controls the precision of the output."; + item.description = "Whether to print the expectation value of the angular momentum operators Lx, Ly and Lz in the basis of the localized atomic orbitals. The three components are written as sparse matrices into lx_nao.csr, ly_nao.csr and lz_nao.csr (or lxg{step+1}_nao.csr etc. when out_app_flag = 2), using the same self-describing header and CSR layout as the H(R)/S(R) output, so the values are indexed by the global NAO orbital indices. Because the NAO basis functions are real, every matrix element is purely imaginary: the files store only the imaginary part of the matrix element, and its real part is identically zero. This output is not supported for nspin = 4; an INPUT file that enables out_mat_l with nspin = 4 is rejected during parameter parsing. The second integer controls the precision of the output."; item.default_value = "False 8"; item.unit = ""; item.set_availability("basis_type==lcao"); @@ -1425,13 +1428,19 @@ For binary output, each file uses the same basename as text output with a .dat s item.annotation = "if >=0, output the derivatives of exchange correlation in realspace, second parameter controls the precision"; item.category = "Output information"; item.type = R"(Integer \[Integer\](optional))"; - item.description = R"(The first integer controls whether to output the exchange-correlation (in Bohr^-3) on real space grids using Libxc to folder OUT.${suffix}: + item.description = R"(The first integer controls whether to output the exchange-correlation (in Bohr^-3) on real space grids using Libxc: * 0: rho, amag, sigma, exc * 1: vrho, vsigma * 2: v2rho2, v2rhosigma, v2sigma2 * 3: v3rho3, v3rho2sigma, v3rhosigma2, v3sigma3 * 4: v4rho4, v4rho3sigma, v4rho2sigma2, v4rhosigma3, v4sigma4 The meaning of the files is presented in Libxc +The files are written to OUT.${suffix}/CHG/ when out_app_flag = 2 and to OUT.${suffix}/ otherwise, as xc_[][g{step}].cube, where depends on the quantity: +* scalar quantities (exc, amag) carry no channel suffix, for example xc_exc.cube; +* spin-resolved rho and vrho carry _s{spin} with the one-based spin index, for example xc_rho_s1.cube; +* density-gradient channels carry their Libxc component tuple joined by "_": _00/_01/_11 for sigma, vsigma and v2rho2, _0_00 for v2rhosigma, _00_00 for v2sigma2, and the analogous multi-segment tuples for the mixed v3* and v4* quantities, for example xc_v2rhosigma_0_00.cube and xc_v3rhosigma2_0_00_01.cube. +Each file is a standard Gaussian cube file whose header carries the one-based ionic step as "Ionic_Step N"; with out_app_flag = 2 the g{step} suffix selects one file per written step, and with out_app_flag = 1 every written step appends one complete cube frame while the first written step truncates the file. + The second integer controls the precision of the charge density output, if not given, will use 3 as default. The circle order of the charge density on real space grids is: x is the outer loop, then y and finally z (z is moving fastest).)"; @@ -1465,7 +1474,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.annotation = "output the band energy terms separately"; item.category = "Output information"; item.type = "Boolean"; - item.description = "Whether to print the band-decomposed energy of each Hamiltonian term in the files eband_kin.txt, eband_vl.txt, eband_vnl.txt, eband_hart.txt and eband_vxc.txt under the output directory. Each file starts with comment lines giving the ABACUS version, the timestamp, the ionic step and total energy, the expectation-value formula, and the units. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated)."; + item.description = "Whether to print the band-decomposed energy of each Hamiltonian term in the files eband_kin.txt, eband_vl.txt, eband_vnl.txt, eband_hart.txt and eband_vxc.txt under the output directory. With out_app_flag = 2 each written step gets its own file with a g{step} suffix (for example eband_king2.txt), while modes 0/1 reuse the fixed names (mode 0 truncates, mode 1 appends one frame per written step). Each file starts with comment lines giving the ABACUS version, the timestamp, the ionic step and total energy, the expectation-value formula, and the units. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated)."; item.default_value = "False"; item.unit = ""; item.set_availability("basis_type==lcao"); @@ -1583,7 +1592,7 @@ The circle order of the charge density on real space grids is: x is the outer lo * 0: Write directly to the OUT directory under a fixed filename. Every write truncates the previous content, so only the most recently written step is kept on disk. out_freq_ion only controls how often a write happens; it does not change the number of fixed-name files (default, disk-friendly). Exception: MD structure frames are still written as numbered STRU{istep} files, so their count follows out_freq_ion. * 1: Reuse fixed filenames across steps: text outputs append new records, cube outputs accumulate one frame per written step In mode 1 the first output step of a fresh (non-restart) run truncates the fixed-name file so a rerun does not keep stale records from a previous run; later steps and restarted runs keep appending. -* 2: Write to subdirectory (STRUC/ for structure files, PSI/, CHG/, POT/, ELF/, DOS/, DIP/, MAT/), output data files carry a g{step} suffix (structures use STRU{istep}) +* 2: Write to subdirectory (STRUC/ for structure files, PSI/, CHG/, POT/, ELF/, DOS/, DIP/, MAT/, BANDS/), output data files carry a g{step} suffix (structures use STRU{istep}) For MD structure frames specifically, mode 0 keeps the numbered STRU{istep} files (STRU1 is the initial geometry) and writes no STRU_NOW, mode 1 writes one cumulative STRU file, and mode 2 writes the numbered files under STRUC/; see out_stru. The legacy Boolean spellings (true/false, yes/no, on/off, t/f, y/n, and the dotted forms) are still accepted: true maps to mode 1 and preserves the old append behavior; false maps to mode 0, which now overwrites a fixed file instead of the old g{step} per-step files, so use mode 2 to reproduce that old behavior. For more information, refer to the documentation of out_mat_r, out_hsr, out_mat_t, out_mat_dh, out_hsk, out_wfc_lcao, out_chg, out_pot, out_elf, out_dos, out_dipole, out_stru.)"; diff --git a/source/source_io/module_parameter/read_inp_sys.cpp b/source/source_io/module_parameter/read_inp_sys.cpp index 7a8d450f93f..56484c1c3b7 100644 --- a/source/source_io/module_parameter/read_inp_sys.cpp +++ b/source/source_io/module_parameter/read_inp_sys.cpp @@ -780,7 +780,7 @@ For `basis_type=lcao_in_pw`, `init_wfc` is automatically set to `nao`. * atomic: the density is starting from the summation of the atomic density of single atoms. * file: the density will be read in from a binary file charge-density.dat first. If it does not exist, the charge density will be read in from cube files. * wfc: the density will be calculated by wavefunctions and occupations. -* dm: the density will be calculated by real space density matrix(DMR) of LCAO base. +* dm: the density will be calculated from the LCAO real-space density matrix (DMR) CSR files. If no DMR file exists, the dense k-space density matrix (DM(k)) files written by out_dmk are read instead and transformed to DMR. * dm_no_renormalize: same as dm, but the charge density is not renormalized to the number of electrons. * hr: the real space Hamiltonian matrix(HR) will be read in from file hrs1_nao.csr in directory read_file_dir. * auto: Abacus first attempts to read the density from a file; if not found, it defaults to using atomic density.)"; diff --git a/source/source_io/module_parameter/read_input.cpp b/source/source_io/module_parameter/read_input.cpp index 2f87852aa05..24cacd9631b 100644 --- a/source/source_io/module_parameter/read_input.cpp +++ b/source/source_io/module_parameter/read_input.cpp @@ -485,6 +485,7 @@ std::string ReadInput::prepare_input(Parameter& param) this->normalize_hs_output_options(param); this->normalize_occ_mat_options(param); this->normalize_out_eband_alias(param); + this->normalize_td_output_frequency(param); // The MD driver writes ABACUS STRU frames only, and the restart logic reads // them back, so CIF output (out_stru = 2) is not available for MD. Reject it @@ -493,6 +494,33 @@ std::string ReadInput::prepare_input(Parameter& param) { errors += "Invalid INPUT parameter 'out_stru': value 2 (CIF) is not supported for calculation = md; use 0 or 1.\n"; } + // The CSR angular-momentum writer indexes the scalar real-harmonic basis. + // In nspin = 4 the spinor basis doubles nlocal and uses a different + // magnetic-quantum-number ordering, so only the spin-up block could be + // filled; reject the request before the calculation starts. + if (param.input.nspin == 4 && param.input.out_mat_l[0] != 0) + { + errors += "Invalid INPUT parameter 'out_mat_l': nspin = 4 is not supported because only the scalar " + "(npol = 1) angular-momentum block can be written; set out_mat_l to 0.\n"; + } + + // The dense text body writer asserts a positive precision. These checks run + // on rank 0 inside prepare_input and the accumulated errors are broadcast + // to every rank before aborting, so the message must be returned here + // rather than raised with WARNING_QUIT (which would leave the other ranks + // blocked in the broadcast). + if (param.input.out_dmk[1] <= 0) + { + errors += "Invalid INPUT parameter 'out_dmk': precision must be a positive integer.\n"; + } + if (param.input.out_hsk[1] <= 0) + { + errors += "Invalid INPUT parameter 'out_hsk': precision must be a positive integer.\n"; + } + if (param.input.out_mat_tk[1] <= 0) + { + errors += "Invalid INPUT parameter 'out_mat_tk': precision must be a positive integer.\n"; + } // Snapshot typed effective values once for shared domain and dependency checks. InputValues values; @@ -665,6 +693,40 @@ void ReadInput::normalize_out_eband_alias(Parameter& param) } } +void ReadInput::normalize_td_output_frequency(Parameter& param) +{ + const auto item_is_read = [this](const std::string& label) { + const auto item = std::find_if( + this->input_lists.begin(), + this->input_lists.end(), + [&label](const std::pair& entry) { return entry.first == label; }); + return item != this->input_lists.end() && item->second.is_read(); + }; + + // out_freq_td is the legacy RT-TDDFT spelling of out_freq_ion. Both counted + // completed electronic evolution steps, so the value can be forwarded + // unchanged. The canonical out_freq_ion wins when both are present. + if (!item_is_read("out_freq_td")) + { + return; + } + if (param.input.esolver_type != "tddft") + { + ModuleBase::WARNING("ReadInput", "out_freq_td is only available in RT-TDDFT and is ignored"); + return; + } + ModuleBase::WARNING("ReadInput", "out_freq_td is deprecated; use out_freq_ion instead"); + if (item_is_read("out_freq_ion")) + { + ModuleBase::WARNING("ReadInput", "both out_freq_ion and out_freq_td are set; out_freq_ion takes precedence"); + return; + } + if (param.input.out_freq_td_compat > 0) + { + param.input.out_freq_ion = param.input.out_freq_td_compat; + } +} + void ReadInput::write_txt_input(const Parameter& param, const std::string& filename) { ModuleBase::TITLE("ReadInput", "write_txt_input"); diff --git a/source/source_io/module_parameter/read_input.h b/source/source_io/module_parameter/read_input.h index 1f3f19965b0..8b05252f4f1 100644 --- a/source/source_io/module_parameter/read_input.h +++ b/source/source_io/module_parameter/read_input.h @@ -94,6 +94,15 @@ class ReadInput * does not depend on the order of keywords in the INPUT file. */ void normalize_out_eband_alias(Parameter& param); + /** + * @brief Resolve out_freq_td, the legacy RT-TDDFT alias of out_freq_ion. + * + * This is called after all INPUT values have been read so that the result + * does not depend on the order of keywords in the INPUT file. + * + * @param param parameters of ABACUS + */ + void normalize_td_output_frequency(Parameter& param); /** * @brief write INPUT file of txt format * diff --git a/source/source_io/module_parameter/read_set_globalv.cpp b/source/source_io/module_parameter/read_set_globalv.cpp index 09d844b0505..2ab5e45269c 100644 --- a/source/source_io/module_parameter/read_set_globalv.cpp +++ b/source/source_io/module_parameter/read_set_globalv.cpp @@ -159,6 +159,7 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) sys.global_dos_dir = sys.global_out_dir + "DOS/"; sys.global_dip_dir = sys.global_out_dir + "DIP/"; sys.global_mat_dir = sys.global_out_dir + "MAT/"; + sys.global_band_dir = sys.global_out_dir + "BANDS/"; } else { @@ -170,6 +171,7 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) sys.global_dos_dir = sys.global_out_dir; sys.global_dip_dir = sys.global_out_dir; sys.global_mat_dir = sys.global_out_dir; + sys.global_band_dir = sys.global_out_dir; } /// Map legacy directory names to new unified names @@ -271,6 +273,7 @@ void ReadInput::set_global_dir(const Input_para& inp, System_para& sys) Parallel_Common::bcast_string(sys.global_dos_dir); Parallel_Common::bcast_string(sys.global_dip_dir); Parallel_Common::bcast_string(sys.global_mat_dir); + Parallel_Common::bcast_string(sys.global_band_dir); Parallel_Common::bcast_string(sys.global_in_stru); #endif } diff --git a/source/source_io/module_parameter/system_parameter.h b/source/source_io/module_parameter/system_parameter.h index 4705c33f4ea..1b06ec884b5 100644 --- a/source/source_io/module_parameter/system_parameter.h +++ b/source/source_io/module_parameter/system_parameter.h @@ -61,6 +61,7 @@ struct System_para std::string global_dos_dir = ""; ///< DOS directory (DOS/) std::string global_dip_dir = ""; ///< dipole directory (DIP/) std::string global_mat_dir = ""; ///< matrix directory (MAT/) + std::string global_band_dir = ""; ///< band structure directory (BANDS/) std::string global_mlkedf_descriptor_dir = ""; ///< global ML KEDF descriptor directory std::string global_deepks_label_elec_dir = ""; ///< global directory for DeePKS labels during electronic steps std::string log_file = "log"; ///< log file name diff --git a/source/source_io/module_wf/get_wf_lcao.cpp b/source/source_io/module_wf/get_wf_lcao.cpp index f982738b54b..db48db6f3df 100644 --- a/source/source_io/module_wf/get_wf_lcao.cpp +++ b/source/source_io/module_wf/get_wf_lcao.cpp @@ -308,7 +308,7 @@ void Get_wf_lcao::prepare_get_wf(std::ofstream& ofs_running) ofs_running << " | The |psi(i,r)|, Re[psi(i,r)], Im[psi(i,r)] are printed out using |" << std::endl; ofs_running << " | numerical atomic orbitals as basis set. |" << std::endl; ofs_running << " | |" << std::endl; - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" << std::endl; + ofs_running << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl; ofs_running << "\n\n"; diff --git a/source/source_io/module_wf/read_wf2rho_pw.cpp b/source/source_io/module_wf/read_wf2rho_pw.cpp index 26120027492..d364663b013 100644 --- a/source/source_io/module_wf/read_wf2rho_pw.cpp +++ b/source/source_io/module_wf/read_wf2rho_pw.cpp @@ -43,8 +43,8 @@ void ModuleIO::read_wf2rho_pw_impl(const ModulePW::PW_Basis_K* pw_wfc, ofs_running << " | " " |" << std::endl; - ofs_running << " >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" - ">>>>>>>>>>>>>>>>>>>>>>>>>" + ofs_running << " <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" + "<<<<<<<<<<<<<<<<<<<<<<<<<" << std::endl; assert(kpar >= 1); diff --git a/source/source_io/module_wf/write_wfc_nao.cpp b/source/source_io/module_wf/write_wfc_nao.cpp index 446f2cc36ad..91db0b7b827 100644 --- a/source/source_io/module_wf/write_wfc_nao.cpp +++ b/source/source_io/module_wf/write_wfc_nao.cpp @@ -14,6 +14,7 @@ #include "source_base/formatter.h" #include "source_io/module_output/provenance_header.h" #include "source_io/module_output/spin_tag.h" +#include "source_io/module_output/write_notice.h" namespace { @@ -61,7 +62,7 @@ std::string build_wfc_nao_header(const int istep, const std::string& spin_tag) return header; } const int istep_one_based = istep + 1; - const std::string step_line = FmtCore::format("# IONIC STEP %d%s\n", istep_one_based, spin_tag.c_str()); + const std::string step_line = FmtCore::format("# Ionic_Step %d%s\n", istep_one_based, spin_tag.c_str()); return header + step_line; } @@ -281,6 +282,7 @@ void write_wfc_nao(const int out_type, const int nkstot, const Parallel_Orbitals& pv, const int nspin, + std::ofstream& ofs_running, const int istep) { if (!out_type) @@ -386,6 +388,7 @@ void write_wfc_nao(const int out_type, append_flag, header); } + ModuleIO::write_notice(ofs_running, "LCAO wavefunction coefficients", fn); } } ModuleBase::timer::end("ModuleIO", "write_wfc_nao"); @@ -401,6 +404,7 @@ template void write_wfc_nao(const int out_type, const int nkstot, const Parallel_Orbitals& pv, const int nspin, + std::ofstream& ofs_running, const int istep); template void write_wfc_nao>(const int out_type, @@ -413,6 +417,7 @@ template void write_wfc_nao>(const int out_type, const int nkstot, const Parallel_Orbitals& pv, const int nspin, + std::ofstream& ofs_running, const int istep); } // namespace ModuleIO diff --git a/source/source_io/module_wf/write_wfc_nao.h b/source/source_io/module_wf/write_wfc_nao.h index a1421404b6d..c10591b0668 100644 --- a/source/source_io/module_wf/write_wfc_nao.h +++ b/source/source_io/module_wf/write_wfc_nao.h @@ -4,6 +4,7 @@ #include "source_basis/module_ao/parallel_orbitals.h" #include "source_psi/psi.h" #include "source_base/vector3.h" +#include #include #include @@ -35,6 +36,7 @@ void write_wfc_nao(const int out_type, const int nkstot, const Parallel_Orbitals& pv, const int nspin, + std::ofstream& ofs_running, const int istep=-1) ; /** diff --git a/source/source_io/module_wf/write_wfc_pw.cpp b/source/source_io/module_wf/write_wfc_pw.cpp index 50cfcb117a7..2371013917a 100644 --- a/source/source_io/module_wf/write_wfc_pw.cpp +++ b/source/source_io/module_wf/write_wfc_pw.cpp @@ -10,6 +10,7 @@ #include "source_base/tool_title.h" #include "source_io/module_parameter/parameter.h" #include "source_base/module_out/filename.h" +#include "source_io/module_output/write_notice.h" void ModuleIO::write_wfc_pw( const int istep, @@ -59,8 +60,7 @@ void ModuleIO::write_wfc_pw( ik_local,kv.ik2iktot,nspin,nkstot, out_wfc_pw,out_app_flag,gamma_only,istep,iter); - ofs_running << " Write G-space wave functions to file: " - << fn << std::endl; + ModuleIO::write_notice(ofs_running, "G-space wave functions", fn); wfilename[ik_local] = fn; diff --git a/source/source_io/test_serial/io_sys_var_test.cpp b/source/source_io/test_serial/io_sys_var_test.cpp index e8401b4d238..fd7dcb62248 100644 --- a/source/source_io/test_serial/io_sys_var_test.cpp +++ b/source/source_io/test_serial/io_sys_var_test.cpp @@ -80,6 +80,7 @@ TEST_F(InputTest, Item_test) EXPECT_EQ(sys.global_dos_dir, "OUT.test/"); EXPECT_EQ(sys.global_dip_dir, "OUT.test/"); EXPECT_EQ(sys.global_mat_dir, "OUT.test/"); + EXPECT_EQ(sys.global_band_dir, "OUT.test/"); TestParameters::set_globalv(readinput, input, sys); @@ -236,6 +237,7 @@ TEST_F(InputTest, SetGlobalDirMode2) EXPECT_EQ(sys.global_dos_dir, "OUT.modetwo/DOS/"); EXPECT_EQ(sys.global_dip_dir, "OUT.modetwo/DIP/"); EXPECT_EQ(sys.global_mat_dir, "OUT.modetwo/MAT/"); + EXPECT_EQ(sys.global_band_dir, "OUT.modetwo/BANDS/"); // legacy aliases follow the unified directories EXPECT_EQ(sys.global_wfc_dir, sys.global_psi_dir); EXPECT_EQ(sys.global_matrix_dir, sys.global_mat_dir); diff --git a/source/source_io/test_serial/read_input_item_test.cpp b/source/source_io/test_serial/read_input_item_test.cpp index 807543db27a..62051fc3652 100644 --- a/source/source_io/test_serial/read_input_item_test.cpp +++ b/source/source_io/test_serial/read_input_item_test.cpp @@ -1511,6 +1511,49 @@ TEST_F(InputTest, OutEbandLegacyAlias) } } +TEST_F(InputTest, TdOutputFrequencyLegacyAlias) +{ + { + // In RT-TDDFT the legacy key is forwarded to out_freq_ion unchanged. + ModuleIO::ReadInput readinput(0); + Parameter param; + TestParameters::input(param).esolver_type = "tddft"; + auto legacy = find_label("out_freq_td", readinput.input_lists); + legacy->second.str_values = {"5"}; + legacy->second.read_value(legacy->second, param); + + readinput.normalize_td_output_frequency(param); + EXPECT_EQ(TestParameters::input(param).out_freq_ion, 5); + } + { + // The canonical key wins when both are present. + ModuleIO::ReadInput readinput(0); + Parameter param; + TestParameters::input(param).esolver_type = "tddft"; + auto primary = find_label("out_freq_ion", readinput.input_lists); + auto legacy = find_label("out_freq_td", readinput.input_lists); + primary->second.str_values = {"2"}; + legacy->second.str_values = {"5"}; + primary->second.read_value(primary->second, param); + legacy->second.read_value(legacy->second, param); + + readinput.normalize_td_output_frequency(param); + EXPECT_EQ(TestParameters::input(param).out_freq_ion, 2); + } + { + // Outside RT-TDDFT the legacy key has no effect. + ModuleIO::ReadInput readinput(0); + Parameter param; + TestParameters::input(param).esolver_type = "ksdft"; + auto legacy = find_label("out_freq_td", readinput.input_lists); + legacy->second.str_values = {"5"}; + legacy->second.read_value(legacy->second, param); + + readinput.normalize_td_output_frequency(param); + EXPECT_EQ(TestParameters::input(param).out_freq_ion, 0); + } +} + TEST_F(InputTest, HsOutputAliases) { { diff --git a/source/source_io/test_serial/rho_io_test.cpp b/source/source_io/test_serial/rho_io_test.cpp index 5a63f4fd485..247590969f0 100644 --- a/source/source_io/test_serial/rho_io_test.cpp +++ b/source/source_io/test_serial/rho_io_test.cpp @@ -102,11 +102,35 @@ TEST_F(RhoIOTest, Write) Parallel_Grid pgrid(nx, ny, nz, nz, nrxx, nz, 1); ModuleIO::read_vdata_palgrid(pgrid, my_rank, ofs_running, "support/chg.cube", rho[0], ucell->nat); ModuleIO::write_vdata_palgrid(pgrid, rho[0], 0, nspin, 0, "test_write_vdata_palgrid.cube", 0.461002, ucell, 11, 1, false, false, false, ofs_running, "charge density"); - std::ifstream ifs1("test_write_vdata_palgrid.cube", std::ifstream::binary | std::ifstream::ate); - std::ifstream ifs2("support/chg.cube", std::ifstream::binary | std::ifstream::ate); - EXPECT_EQ(ifs1.tellg(), ifs2.tellg()); - ifs1.close(); - ifs2.close(); + // The first comment line now carries inline provenance, so compare the + // parsed header and data instead of the raw file size. + std::vector comment; + int natom = 0; + std::vector origin; + int nx_read = 0; + int ny_read = 0; + int nz_read = 0; + std::vector dx; + std::vector dy; + std::vector dz; + std::vector atom_type; + std::vector atom_charge; + std::vector> atom_pos; + std::vector data_read; + ModuleIO::read_cube("test_write_vdata_palgrid.cube", comment, natom, origin, + nx_read, ny_read, nz_read, dx, dy, dz, + atom_type, atom_charge, atom_pos, data_read); + const std::string step_prefix = "Ionic_Step 1 Cubefile created from ABACUS. Inner loop is z, followed by y and x"; + EXPECT_EQ(comment[0].compare(0, step_prefix.size(), step_prefix), 0); + EXPECT_NE(comment[0].find("# ABACUS version:"), std::string::npos); + EXPECT_NE(comment[0].find("# Written at "), std::string::npos); + EXPECT_EQ(comment[1], "1 # number of spin directions 0.461002 # Fermi energy, in Ry"); + EXPECT_EQ(natom, 2); + EXPECT_EQ(nx_read, nx); + EXPECT_EQ(ny_read, ny); + EXPECT_EQ(nz_read, nz); + ASSERT_EQ(data_read.size(), static_cast(nx * ny * nz)); + EXPECT_DOUBLE_EQ(data_read[0], rho[0][0]); } TEST_F(RhoIOTest, TrilinearInterpolate) diff --git a/source/source_io/test_serial/test_read_input.cpp b/source/source_io/test_serial/test_read_input.cpp index 801baa2b99d..fe5e4bda0fd 100644 --- a/source/source_io/test_serial/test_read_input.cpp +++ b/source/source_io/test_serial/test_read_input.cpp @@ -26,16 +26,21 @@ class InputDomainReaderTest : public testing::Test std::remove(written.c_str()); } - void write_input(const std::string& values) + void write_input(const std::string& values, const std::string& basis) { std::ofstream out(filename); - out << "INPUT_PARAMETERS\nbasis_type pw\nntype 1\necutwfc 20\n" << values; + out << "INPUT_PARAMETERS\nbasis_type " << basis << "\nntype 1\necutwfc 20\n" << values; ASSERT_TRUE(out.good()); } - std::string reject_input(const std::string& values) + void write_input(const std::string& values) { - write_input(values); + write_input(values, "pw"); + } + + std::string reject_input(const std::string& values, const std::string& basis) + { + write_input(values, basis); ModuleIO::ReadInput reader(0); reader.check_ntype_flag = false; Parameter input; @@ -43,6 +48,11 @@ class InputDomainReaderTest : public testing::Test EXPECT_EXIT(reader.read_parameters(input, filename), testing::ExitedWithCode(1), ""); return testing::internal::GetCapturedStdout(); } + + std::string reject_input(const std::string& values) + { + return reject_input(values, "pw"); + } }; TEST_F(InputDomainReaderTest, KeepsExplicitValuesAndContextualDefaults) @@ -96,6 +106,13 @@ TEST_F(InputDomainReaderTest, ReportsIndependentErrorsTogether) EXPECT_NE(output.find("Invalid INPUT parameter 'gga_grad'"), std::string::npos); } +TEST_F(InputDomainReaderTest, RejectsAngularMomentumOutputWithSpinorBasis) +{ + const std::string output = reject_input("nspin 4\nout_mat_l 1\n", "lcao"); + EXPECT_NE(output.find("Invalid INPUT parameter 'out_mat_l'"), std::string::npos); + EXPECT_NE(output.find("nspin = 4"), std::string::npos); +} + TEST_F(InputDomainReaderTest, RejectsMissingValuesIncludingLastLineWithoutNewline) { for (const std::string values : {"nspin\n", "nspin", "gga_grad # missing value\n"}) diff --git a/source/source_io/unittests/CMakeLists.txt b/source/source_io/unittests/CMakeLists.txt index 056aef469b7..4578adc5278 100644 --- a/source/source_io/unittests/CMakeLists.txt +++ b/source/source_io/unittests/CMakeLists.txt @@ -20,6 +20,13 @@ addTest( addtest(TARGET MODULE_IO_spin_tag SOURCES test_spin_tag.cpp) +addtest( + TARGET MODULE_IO_libxc_r_suffix + SOURCES test_libxc_r_suffix.cpp + ../module_chgpot/libxc_r_suffix.cpp) + +addtest(TARGET MODULE_IO_frame_append SOURCES test_frame_append.cpp) + addtest(TARGET MODULE_IO_provenance_header SOURCES test_provenance_header.cpp) if(NOT ENABLE_MPI) @@ -45,6 +52,9 @@ foreach( duplicate_string_eof invalid_value invalid_dependency + out_dmk_zero_precision + out_hsk_zero_precision + out_mat_tk_zero_precision valid) add_test( NAME MODULE_IO_input_error_mpi_${input_case} @@ -283,8 +293,9 @@ add_test( addtest( TARGET MODULE_IO_write_dmk LIBS parameter base device cell_info symmetry - SOURCES ../module_dm/test/write_dmk_test.cpp + SOURCES test_write_dmk.cpp ../module_dm/write_dmk.cpp + ../module_hs/dense_text_body.cpp ../../source_cell/ucell_io.cpp ../../source_cell/klist.cpp ../../source_cell/klist_io.cpp @@ -325,6 +336,7 @@ if(ENABLE_LIBRI) LIBS parameter base device SOURCES test_restart_exx_csr.cpp ../module_restart/restart_exx_csr.cpp ../module_hs/hs_sparse_io.cpp ../module_hs/lat_r_csr.cpp + ../../source_cell/ucell_io.cpp ../../source_basis/module_ao/parallel_orbitals.cpp tmp_mocks.cpp) endif() diff --git a/source/source_io/unittests/test_frame_append.cpp b/source/source_io/unittests/test_frame_append.cpp new file mode 100644 index 00000000000..1901366d9a8 --- /dev/null +++ b/source/source_io/unittests/test_frame_append.cpp @@ -0,0 +1,27 @@ +#include "gtest/gtest.h" +#include "source_io/module_output/frame_append.h" + +#include + +TEST(FrameAppend, ModeOneAppendsAfterTheFirstStep) +{ + // Step 0 defines the fresh run: the file is truncated, never appended. + EXPECT_FALSE(ModuleIO::frame_appends(1, 0)); + EXPECT_TRUE(ModuleIO::frame_appends(1, 1)); + EXPECT_TRUE(ModuleIO::frame_appends(1, 5)); +} + +TEST(FrameAppend, ModesZeroAndTwoNeverAppend) +{ + EXPECT_FALSE(ModuleIO::frame_appends(0, 0)); + EXPECT_FALSE(ModuleIO::frame_appends(0, 3)); + EXPECT_FALSE(ModuleIO::frame_appends(2, 0)); + EXPECT_FALSE(ModuleIO::frame_appends(2, 3)); +} + +TEST(FrameAppend, RejectsInvalidArguments) +{ + EXPECT_THROW(ModuleIO::frame_appends(-1, 0), std::invalid_argument); + EXPECT_THROW(ModuleIO::frame_appends(3, 1), std::invalid_argument); + EXPECT_THROW(ModuleIO::frame_appends(1, -1), std::invalid_argument); +} diff --git a/source/source_io/unittests/test_libxc_r_suffix.cpp b/source/source_io/unittests/test_libxc_r_suffix.cpp new file mode 100644 index 00000000000..7ce8e156212 --- /dev/null +++ b/source/source_io/unittests/test_libxc_r_suffix.cpp @@ -0,0 +1,112 @@ +#include "gtest/gtest.h" +#include "source_io/module_chgpot/libxc_r_suffix.h" + +#include +#include +#include + +namespace +{ + +std::vector suffixes(const std::string& data_name, const int nspin) +{ + return ModuleIO::libxc_r_channel_suffixes(data_name, nspin); +} + +} // namespace + +TEST(LibxcRSuffix, SpinQuantities) +{ + EXPECT_EQ(suffixes("rho", 1), (std::vector{"s1"})); + EXPECT_EQ(suffixes("rho", 2), (std::vector{"s1", "s2"})); + EXPECT_EQ(suffixes("vrho", 2), (std::vector{"s1", "s2"})); +} + +TEST(LibxcRSuffix, ScalarQuantities) +{ + EXPECT_EQ(suffixes("exc", 1), (std::vector{""})); + EXPECT_EQ(suffixes("amag", 2), (std::vector{""})); +} + +TEST(LibxcRSuffix, Tensor3Quantities) +{ + const std::vector polarized = {"00", "01", "11"}; + EXPECT_EQ(suffixes("sigma", 1), (std::vector{"00"})); + EXPECT_EQ(suffixes("sigma", 2), polarized); + EXPECT_EQ(suffixes("vsigma", 2), polarized); + EXPECT_EQ(suffixes("v2rho2", 2), polarized); +} + +TEST(LibxcRSuffix, SecondOrderQuantities) +{ + EXPECT_EQ(suffixes("v2rhosigma", 1), (std::vector{"0_00"})); + EXPECT_EQ(suffixes("v2rhosigma", 2), + (std::vector{"0_00", "0_01", "0_11", "1_00", "1_01", "1_11"})); + EXPECT_EQ(suffixes("v2sigma2", 1), (std::vector{"00_00"})); + EXPECT_EQ(suffixes("v2sigma2", 2), + (std::vector{"00_00", "00_01", "00_11", "01_01", "01_11", "11_11"})); +} + +TEST(LibxcRSuffix, ThirdOrderQuantities) +{ + EXPECT_EQ(suffixes("v3rho3", 1), (std::vector{"0_0_0"})); + EXPECT_EQ(suffixes("v3rho3", 2), + (std::vector{"0_0_0", "0_0_1", "0_1_1", "1_1_1"})); + + const std::vector rho2sigma = suffixes("v3rho2sigma", 2); + ASSERT_EQ(rho2sigma.size(), 9); + EXPECT_EQ(rho2sigma.front(), "00_00"); + EXPECT_EQ(rho2sigma.back(), "11_11"); + + const std::vector rhosigma2 = suffixes("v3rhosigma2", 2); + ASSERT_EQ(rhosigma2.size(), 12); + EXPECT_EQ(rhosigma2.front(), "0_00_00"); + EXPECT_EQ(rhosigma2.back(), "1_11_11"); + + const std::vector sigma3 = suffixes("v3sigma3", 2); + ASSERT_EQ(sigma3.size(), 10); + EXPECT_EQ(sigma3.front(), "00_00_00"); + EXPECT_EQ(sigma3.back(), "11_11_11"); + + EXPECT_EQ(suffixes("v3rho2sigma", 1), (std::vector{"00_00"})); + EXPECT_EQ(suffixes("v3rhosigma2", 1), (std::vector{"0_00_00"})); + EXPECT_EQ(suffixes("v3sigma3", 1), (std::vector{"00_00_00"})); +} + +TEST(LibxcRSuffix, FourthOrderQuantities) +{ + EXPECT_EQ(suffixes("v4rho4", 1), (std::vector{"0_0_0_0"})); + EXPECT_EQ(suffixes("v4rho4", 2).size(), 5); + + const std::vector rho3sigma = suffixes("v4rho3sigma", 2); + ASSERT_EQ(rho3sigma.size(), 12); + EXPECT_EQ(rho3sigma.front(), "000_00"); + EXPECT_EQ(rho3sigma.back(), "111_11"); + + const std::vector rho2sigma2 = suffixes("v4rho2sigma2", 2); + ASSERT_EQ(rho2sigma2.size(), 18); + EXPECT_EQ(rho2sigma2.front(), "00_00_00"); + EXPECT_EQ(rho2sigma2.back(), "11_11_11"); + + const std::vector rhosigma3 = suffixes("v4rhosigma3", 2); + ASSERT_EQ(rhosigma3.size(), 20); + EXPECT_EQ(rhosigma3.front(), "0_00_00_00"); + EXPECT_EQ(rhosigma3.back(), "1_11_11_11"); + + const std::vector sigma4 = suffixes("v4sigma4", 2); + ASSERT_EQ(sigma4.size(), 15); + EXPECT_EQ(sigma4.front(), "00_00_00_00"); + EXPECT_EQ(sigma4.back(), "11_11_11_11"); + + EXPECT_EQ(suffixes("v4rho3sigma", 1), (std::vector{"000_00"})); + EXPECT_EQ(suffixes("v4rho2sigma2", 1), (std::vector{"00_00_00"})); + EXPECT_EQ(suffixes("v4rhosigma3", 1), (std::vector{"0_00_00_00"})); + EXPECT_EQ(suffixes("v4sigma4", 1), (std::vector{"00_00_00_00"})); +} + +TEST(LibxcRSuffix, RejectsInvalidArguments) +{ + EXPECT_THROW(ModuleIO::libxc_r_channel_suffixes("rho", 0), std::invalid_argument); + EXPECT_THROW(ModuleIO::libxc_r_channel_suffixes("rho", 3), std::invalid_argument); + EXPECT_THROW(ModuleIO::libxc_r_channel_suffixes("unknown", 1), std::invalid_argument); +} diff --git a/source/source_io/unittests/test_output_mulliken.cpp b/source/source_io/unittests/test_output_mulliken.cpp index f87f5125f3a..c0c202dc1d8 100644 --- a/source/source_io/unittests/test_output_mulliken.cpp +++ b/source/source_io/unittests/test_output_mulliken.cpp @@ -22,22 +22,12 @@ class OutputMullikenTest : public testing::Test Parallel_Orbitals paraV; int nrow; int ncol; + std::ofstream ofs_running; }; using MyTypes = ::testing::Types>; TYPED_TEST_SUITE(OutputMullikenTest, MyTypes); -TYPED_TEST(OutputMullikenTest, OrbInfo) -{ - CellIndex cell_index = CellIndex(this->atomLabels, this->atomCounts, this->lnchiCounts, 1); - cell_index.write_orb_info("./"); - std::ifstream ifs("./nao.txt"); - std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); - EXPECT_THAT(str, testing::HasSubstr("#io spec l m z sym")); - EXPECT_THAT(str, testing::HasSubstr("0 Si 2 3 1 dx^2-y^2")); - remove("./nao.txt"); -} - #ifdef __MPI TYPED_TEST(OutputMullikenTest, nspin1) { @@ -48,7 +38,7 @@ TYPED_TEST(OutputMullikenTest, nspin1) auto out_s_k = ModuleIO::Output_Sk(nullptr, &this->paraV, 1, 1); auto out_dm_k = ModuleIO::Output_DMK(nullptr, &this->paraV, 1, 1); auto mulp = ModuleIO::Output_Mulliken(&(out_s_k), &(out_dm_k), &(this->paraV), &(cell_index), {0}, 1); - mulp.write(0, "./"); + mulp.write(0, 0, "./", this->ofs_running); std::vector tot_chg = mulp.get_tot_chg(); EXPECT_NEAR(tot_chg[0], 4.0, 1e-5); std::ifstream ifs("./mulliken.txt"); @@ -58,6 +48,49 @@ TYPED_TEST(OutputMullikenTest, nspin1) remove("./mulliken.txt"); } +TYPED_TEST(OutputMullikenTest, AppendModes) +{ + this->nrow = 13; + this->ncol = 13; + this->paraV.para_2d().init(this->nrow, this->ncol, 1, MPI_COMM_WORLD, 0); + auto cell_index = CellIndex(this->atomLabels, this->atomCounts, this->lnchiCounts, 1); + auto out_s_k = ModuleIO::Output_Sk(nullptr, &this->paraV, 1, 1); + auto out_dm_k = ModuleIO::Output_DMK(nullptr, &this->paraV, 1, 1); + auto mulp = ModuleIO::Output_Mulliken(&(out_s_k), &(out_dm_k), &(this->paraV), &(cell_index), {0}, 1); + + const std::string dir = testing::TempDir(); + const std::string fixed = dir + "mulliken.txt"; + + // Mode 0: every write truncates the fixed file, so only the last frame remains. + mulp.write(0, 0, dir, this->ofs_running); + mulp.write(2, 0, dir, this->ofs_running); + std::ifstream ifs0(fixed); + std::string text0((std::istreambuf_iterator(ifs0)), std::istreambuf_iterator()); + EXPECT_THAT(text0, testing::HasSubstr("# Ionic_Step 3")); + EXPECT_THAT(text0, testing::Not(testing::HasSubstr("# Ionic_Step 1"))); + remove(fixed.c_str()); + + // Mode 1: the first frame truncates and the later frame appends. + mulp.write(0, 1, dir, this->ofs_running); + mulp.write(2, 1, dir, this->ofs_running); + std::ifstream ifs1(fixed); + std::string text1((std::istreambuf_iterator(ifs1)), std::istreambuf_iterator()); + EXPECT_THAT(text1, testing::HasSubstr("# Ionic_Step 1")); + EXPECT_THAT(text1, testing::HasSubstr("# Ionic_Step 3")); + remove(fixed.c_str()); + + // Mode 2: one g{step} file per written step, no fixed-name file. + mulp.write(2, 2, dir, this->ofs_running); + const std::string numbered = dir + "mullikeng3.txt"; + std::ifstream ifs2(numbered); + ASSERT_TRUE(ifs2.is_open()) << "missing " << numbered; + std::string text2((std::istreambuf_iterator(ifs2)), std::istreambuf_iterator()); + EXPECT_THAT(text2, testing::HasSubstr("# Ionic_Step 3")); + std::ifstream ifs_fixed(fixed); + EXPECT_FALSE(ifs_fixed.is_open()); + remove(numbered.c_str()); +} + TYPED_TEST(OutputMullikenTest, nspin2) { this->nrow = 13; @@ -67,7 +100,7 @@ TYPED_TEST(OutputMullikenTest, nspin2) auto out_s_k = ModuleIO::Output_Sk(nullptr, &this->paraV, 2, 1); auto out_dm_k = ModuleIO::Output_DMK(nullptr, &this->paraV, 2, 1); auto mulp = ModuleIO::Output_Mulliken(&(out_s_k), &(out_dm_k), &(this->paraV), &(cell_index), {0, 1}, 2); - mulp.write(0, "./"); + mulp.write(0, 0, "./", this->ofs_running); std::vector tot_chg = mulp.get_tot_chg(); EXPECT_NEAR(tot_chg[0], 3.0, 1e-5); EXPECT_NEAR(tot_chg[1], 1.0, 1e-5); @@ -91,7 +124,7 @@ TYPED_TEST(OutputMullikenTest, nspin4) auto out_dm_k = ModuleIO::Output_DMK>(nullptr, &this->paraV, 4, 1); auto mulp = ModuleIO::Output_Mulliken>(&(out_s_k), &(out_dm_k), &(this->paraV), &(cell_index), {0}, 4); - mulp.write(0, "./"); + mulp.write(0, 0, "./", this->ofs_running); std::vector tot_chg = mulp.get_tot_chg(); EXPECT_NEAR(tot_chg[0], 4.0, 1e-5); EXPECT_NEAR(tot_chg[1], 0.0, 1e-5); diff --git a/source/source_io/unittests/test_print_info.cpp b/source/source_io/unittests/test_print_info.cpp index 2416516401d..dafd43d303d 100644 --- a/source/source_io/unittests/test_print_info.cpp +++ b/source/source_io/unittests/test_print_info.cpp @@ -187,14 +187,14 @@ TEST_F(PrintInfoTest, PrintScreen) testing::internal::CaptureStdout(); ModuleIO::print_screen(stress_step, force_step, istep); output = testing::internal::GetCapturedStdout(); - EXPECT_THAT(output,testing::HasSubstr("RELAX STEP")); + EXPECT_THAT(output,testing::HasSubstr("Ionic_Step")); } else if(TestParameters::input().calculation=="cell-relax") { testing::internal::CaptureStdout(); ModuleIO::print_screen(stress_step, force_step, istep); output = testing::internal::GetCapturedStdout(); - EXPECT_THAT(output,testing::HasSubstr("RELAX STEP")); + EXPECT_THAT(output,testing::HasSubstr("Ionic_Step")); EXPECT_THAT(output,testing::HasSubstr("CELL#")); EXPECT_THAT(output,testing::HasSubstr("IONS#")); } diff --git a/source/source_io/unittests/test_read_input.cmake b/source/source_io/unittests/test_read_input.cmake index 07812fb89c8..02a37febc7d 100644 --- a/source/source_io/unittests/test_read_input.cmake +++ b/source/source_io/unittests/test_read_input.cmake @@ -31,6 +31,18 @@ elseif(INPUT_CASE STREQUAL "invalid_dependency") string(APPEND contents "nspin 2\nnoncolin true\n") set(expected "Requires nspin==4") set(expected_manual "input-main.html#nspin") +elseif(INPUT_CASE STREQUAL "out_dmk_zero_precision") + string(APPEND contents "out_dmk 1 0\n") + set(expected "Invalid INPUT parameter 'out_dmk': precision must be a positive integer.") + set(expected_manual "") +elseif(INPUT_CASE STREQUAL "out_hsk_zero_precision") + string(APPEND contents "out_hsk 1 0\n") + set(expected "Invalid INPUT parameter 'out_hsk': precision must be a positive integer.") + set(expected_manual "") +elseif(INPUT_CASE STREQUAL "out_mat_tk_zero_precision") + string(APPEND contents "out_mat_tk 1 0\n") + set(expected "Invalid INPUT parameter 'out_mat_tk': precision must be a positive integer.") + set(expected_manual "") elseif(INPUT_CASE STREQUAL "valid") string(APPEND contents "nspin 2\n") set(expected_exit 0) diff --git a/source/source_io/unittests/test_read_input_parallel.cpp b/source/source_io/unittests/test_read_input_parallel.cpp index a0d83c31c1f..252df3cc8fa 100644 --- a/source/source_io/unittests/test_read_input_parallel.cpp +++ b/source/source_io/unittests/test_read_input_parallel.cpp @@ -187,7 +187,7 @@ TEST_F(InputParaTest, ParaRead) EXPECT_EQ(param.inp.chg_extrap, "atomic"); EXPECT_EQ(param.inp.out_freq_elec, 50); EXPECT_EQ(param.inp.out_freq_ion, 0); - EXPECT_EQ(param.inp.out_freq_td, 0); + EXPECT_EQ(param.inp.out_freq_td_compat, 0); EXPECT_EQ(param.inp.out_chg[0], 0); EXPECT_EQ(param.inp.out_chg[1], 3); EXPECT_EQ(param.inp.out_elf[0], 0); diff --git a/source/source_io/unittests/test_read_wfc_nao.cpp b/source/source_io/unittests/test_read_wfc_nao.cpp index b4669e31ad8..2600be661f3 100644 --- a/source/source_io/unittests/test_read_wfc_nao.cpp +++ b/source/source_io/unittests/test_read_wfc_nao.cpp @@ -242,7 +242,7 @@ TEST_F(ReadWfcNaoTest, ReadTextWithCommentHeader) { const std::string header = "# ABACUS version: test\n" "# Written at 2026-01-01 00:00:00\n" - "# IONIC STEP 1 (spin up)\n"; + "# Ionic_Step 1 (spin up)\n"; ModuleIO::wfc_nao_write2file(binary_test_dir + "wf_nao.txt", coefficients.data(), nlocal, diff --git a/source/source_io/unittests/test_write_bands.cpp b/source/source_io/unittests/test_write_bands.cpp index 79990fc0118..0ce1a1f25c5 100644 --- a/source/source_io/unittests/test_write_bands.cpp +++ b/source/source_io/unittests/test_write_bands.cpp @@ -35,17 +35,21 @@ class TestParameters { append_ = parameter_.input.out_app_flag; directory_ = parameter_.sys.global_out_dir; + band_directory_ = parameter_.sys.global_band_dir; } ~TestParameters() { parameter_.input.out_app_flag = append_; parameter_.sys.global_out_dir = directory_; + parameter_.sys.global_band_dir = band_directory_; } - void set_output(const std::string& directory, bool append) + void set_output(const std::string& directory, bool append, + const std::string& band_directory) { parameter_.sys.global_out_dir = directory; + parameter_.sys.global_band_dir = band_directory; parameter_.input.out_app_flag = append; } @@ -53,6 +57,7 @@ class TestParameters Parameter& parameter_; bool append_ = false; std::string directory_; + std::string band_directory_; }; namespace @@ -138,7 +143,7 @@ class BandOutputTest : public testing::TestWithParam Parallel::bcast_bool(ready, *world_, 0); ASSERT_TRUE(ready); parameters_.reset(new TestParameters(PARAM)); - parameters_->set_output(directory_, false); + parameters_->set_output(directory_, false, directory_); } void TearDown() override @@ -178,6 +183,23 @@ class BandOutputTest : public testing::TestWithParam { std::remove((directory_ + name).c_str()); } + // Mode-2 snapshots live in the lazily created BANDS/ subdirectory. + // GLOBAL_BANDS/ is only touched if the writer falls back to the global + // band directory instead of the one passed in. + for (const std::string& subdirectory : {"BANDS/", "GLOBAL_BANDS/"}) + { + for (const std::string& name : {"bandg1.txt", "bandg2.txt", "bands1g1.txt", "bands1g2.txt", + "bands2g1.txt", "bands2g2.txt"}) + { + std::remove((directory_ + subdirectory + name).c_str()); + } + const std::string sub_path = directory_ + subdirectory.substr(0, subdirectory.size() - 1); +#ifdef _WIN32 + _rmdir(sub_path.c_str()); +#else + rmdir(sub_path.c_str()); +#endif + } } static double eigenvalue(int spin, int global_k, int global_band) @@ -280,7 +302,25 @@ class BandOutputTest : public testing::TestWithParam EXPECT_EQ(comments[3 * block + 1].compare(0, written.size(), written), 0) << comments[3 * block + 1]; const std::string tag = (channels == 2) ? (spin == 0 ? " (spin up)" : " (spin down)") : ""; - EXPECT_EQ(comments[3 * block + 2], "# IONIC STEP " + std::to_string(block + 1) + tag); + EXPECT_EQ(comments[3 * block + 2], "# Ionic_Step " + std::to_string(block + 1) + tag); + } + + /// Check the header of a mode-2 file, which holds exactly one k-point block + /// and therefore prints the ionic step independently of the block index. + void expect_single_block_header(const std::string& name, int step, int spin, int channels) const + { + if (world_->rank() != 0) + { + return; + } + SCOPED_TRACE(name); + const std::vector comments = comment_lines(name); + ASSERT_EQ(comments.size(), static_cast(3)); + const std::string written = "# Written at "; + EXPECT_EQ(comments[0], "# ABACUS version: " + std::string(VERSION)); + EXPECT_EQ(comments[1].compare(0, written.size(), written), 0) << comments[1]; + const std::string tag = (channels == 2) ? (spin == 0 ? " (spin up)" : " (spin down)") : ""; + EXPECT_EQ(comments[2], "# Ionic_Step " + std::to_string(step) + tag); } void expect_output(const std::string& name, int spin, int nbands, @@ -336,6 +376,55 @@ class BandOutputTest : public testing::TestWithParam return std::string(std::istreambuf_iterator(file), std::istreambuf_iterator()); } + /// Check that every numeric entry of `second` equals the matching entry of + /// `first` plus `shift_eV`, so an unchanged header cannot hide a wrong body. + void expect_shifted_values(const std::string& first, const std::string& second, + const double shift_eV) const + { + if (world_->rank() != 0) + { + return; + } + SCOPED_TRACE(second); + std::ifstream first_file(directory_ + first); + std::ifstream second_file(directory_ + second); + ASSERT_TRUE(first_file.is_open()); + ASSERT_TRUE(second_file.is_open()); + std::string first_line; + std::string second_line; + int row = 0; + while (read_data_line(first_file, first_line)) + { + ASSERT_TRUE(read_data_line(second_file, second_line)) << "Missing row " << row; + std::istringstream first_row(first_line); + std::istringstream second_row(second_line); + int first_index = 0; + int second_index = 0; + ASSERT_TRUE(static_cast(first_row >> first_index)) << first_line; + ASSERT_TRUE(static_cast(second_row >> second_index)) << second_line; + EXPECT_EQ(first_index, second_index); + // The first numeric column is the k-path distance, which does not + // depend on the eigenvalues; only the band energies shift. + double first_distance = 0.0; + double second_distance = 0.0; + ASSERT_TRUE(static_cast(first_row >> first_distance)) << first_line; + ASSERT_TRUE(static_cast(second_row >> second_distance)) << second_line; + EXPECT_NEAR(second_distance, first_distance, 1e-6) << "row " << row; + double first_value = 0.0; + double second_value = 0.0; + while (static_cast(first_row >> first_value)) + { + ASSERT_TRUE(static_cast(second_row >> second_value)) << second_line; + EXPECT_NEAR(second_value - first_value, shift_eV, 1e-6) << "row " << row; + } + std::string extra; + EXPECT_FALSE(static_cast(second_row >> extra)) << second_line; + ++row; + } + EXPECT_GT(row, 0); + EXPECT_FALSE(read_data_line(second_file, second_line)) << second_line; + } + void seed_file(const std::string& name, const std::string& content) const { if (world_->rank() == 0) @@ -360,7 +449,7 @@ class BandOutputTest : public testing::TestWithParam { SCOPED_TRACE(distributed ? "distributed" : "replicated"); prepare(nspin, 3, distributed); - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 0); + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 0); if (nspin == 2) { expect_output("bands1.txt", 0, 3, 0.0, 8, 1); @@ -385,7 +474,7 @@ class BandOutputTest : public testing::TestWithParam TEST_P(BandOutputTest, DirectSingleSpin) { prepare(1, 3, false); - ModuleIO::nscf_bands(0, directory_ + "direct.txt", 3, 0.0, 8, ekb_, kv_, ""); + ModuleIO::nscf_bands(0, directory_ + "direct.txt", 3, 0.0, 8, ekb_, kv_, "", 0); expect_output("direct.txt", 0, 3, 0.0, 8, 1); if (world_->rank() == 0) { @@ -398,8 +487,8 @@ TEST_P(BandOutputTest, DirectSingleSpin) TEST_P(BandOutputTest, DirectBothSpins) { prepare(2, 3, false); - ModuleIO::nscf_bands(0, directory_ + "up.txt", 3, 0.0, 8, ekb_, kv_, ""); - ModuleIO::nscf_bands(1, directory_ + "down.txt", 3, 0.0, 8, ekb_, kv_, ""); + ModuleIO::nscf_bands(0, directory_ + "up.txt", 3, 0.0, 8, ekb_, kv_, "", 0); + ModuleIO::nscf_bands(1, directory_ + "down.txt", 3, 0.0, 8, ekb_, kv_, "", 0); expect_output("up.txt", 0, 3, 0.0, 8, 1); expect_output("down.txt", 1, 3, 0.0, 8, 1); } @@ -409,7 +498,7 @@ TEST_P(BandOutputTest, PrecisionAndFermiShift) prepare(1, 3, false); for (const int precision : {4, 8}) { - ModuleIO::nscf_bands(0, directory_ + "direct.txt", 3, 0.25, precision, ekb_, kv_, ""); + ModuleIO::nscf_bands(0, directory_ + "direct.txt", 3, 0.25, precision, ekb_, kv_, "", 0); expect_output("direct.txt", 0, 3, 0.25, precision, 1); if (world_->rank() == 0 && precision == 4) { @@ -425,25 +514,70 @@ TEST_P(BandOutputTest, OverwriteAndAppend) prepare(1, 3, true); seed_file("band.txt", "stale output\n"); Parallel::barrier(*world_); - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 0); + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 0); expect_output("band.txt", 0, 3, 0.0, 8, 1); expect_header("band.txt", 0, 0, 1); Parallel::barrier(*world_); - parameters_->set_output(directory_, true); - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 1); + parameters_->set_output(directory_, true, directory_); + input_.out_app_flag = 1; + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 1); expect_output("band.txt", 0, 3, 0.0, 8, 2); expect_header("band.txt", 1, 0, 1); } +TEST_P(BandOutputTest, ModeTwoBandsDirectoryKeepsDistinctSnapshots) +{ + prepare(2, 3, true); + // The supplied band directory must differ from PARAM.globalv.global_band_dir, + // otherwise a regression to the global lookup would still pass. + const std::string band_dir = directory_ + "BANDS/"; + parameters_->set_output(directory_, false, directory_ + "GLOBAL_BANDS/"); + input_.out_app_flag = 2; + + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, band_dir, 0); + expect_output("BANDS/bands1g1.txt", 0, 3, 0.0, 8, 1); + expect_output("BANDS/bands2g1.txt", 1, 3, 0.0, 8, 1); + expect_single_block_header("BANDS/bands1g1.txt", 1, 0, 2); + expect_single_block_header("BANDS/bands2g1.txt", 1, 1, 2); + // Paths resolve below directory_, so the fixed-name layout must stay empty. + expect_missing("bands1g1.txt"); + expect_missing("BANDS/bands1.txt"); + Parallel::barrier(*world_); + + const std::string first_step_up = read_text("BANDS/bands1g1.txt"); + // Change the spectrum so the second snapshot is distinguishable. + for (int irow = 0; irow < ekb_.nr; ++irow) + { + for (int icol = 0; icol < ekb_.nc; ++icol) + { + ekb_(irow, icol) += 5.0; + } + } + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, band_dir, 1); + expect_single_block_header("BANDS/bands1g2.txt", 2, 0, 2); + expect_single_block_header("BANDS/bands2g2.txt", 2, 1, 2); + Parallel::barrier(*world_); + if (world_->rank() == 0) + { + // Step 1 keeps its own payload; step 2 is written to a separate file. + EXPECT_EQ(read_text("BANDS/bands1g1.txt"), first_step_up); + EXPECT_NE(read_text("BANDS/bands1g2.txt"), first_step_up); + } + // The second snapshot must carry the shifted spectrum, not just a new header. + const double shift_eV = 5.0 * 13.605698; + expect_shifted_values("BANDS/bands1g1.txt", "BANDS/bands1g2.txt", shift_eV); + expect_shifted_values("BANDS/bands2g1.txt", "BANDS/bands2g2.txt", shift_eV); +} + TEST_P(BandOutputTest, OutputDisabled) { prepare(1, 3, true); input_.out_band[0] = 0; - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 0); + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 0); expect_missing("band.txt"); seed_file("band.txt", "keep this content\n"); Parallel::barrier(*world_); - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 0); + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 0); if (world_->rank() == 0) { EXPECT_EQ(read_text("band.txt"), "keep this content\n"); @@ -474,7 +608,7 @@ TEST_P(BandOutputTest, EmptyBandShard) { EXPECT_EQ(ekb_.nc, 0); } - ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, 0); + ModuleIO::write_bands(input_, ekb_, kv_, ofs_running, directory_, 0); expect_output("bands1.txt", 0, 1, 0.0, 8, 1); expect_output("bands2.txt", 1, 1, 0.0, 8, 1); expect_header("bands1.txt", 0, 0, 2); @@ -488,7 +622,7 @@ TEST_P(BandOutputTest, RunningLogNamesSpinChannels) + std::to_string(world_->rank()) + ".log"; std::ofstream log(log_name); EXPECT_TRUE(log.is_open()); - ModuleIO::write_bands(input_, ekb_, kv_, log, 0); + ModuleIO::write_bands(input_, ekb_, kv_, log, directory_, 0); log.close(); std::ifstream in(log_name); @@ -496,8 +630,8 @@ TEST_P(BandOutputTest, RunningLogNamesSpinChannels) in.close(); std::remove(log_name.c_str()); - const std::string up_line = " Write eigenvalues (spin up ) to file: " + directory_ + "bands1.txt"; - const std::string down_line = " Write eigenvalues (spin down) to file: " + directory_ + "bands2.txt"; + const std::string up_line = " Write Eigenvalues (spin up ) to file: " + directory_ + "bands1.txt"; + const std::string down_line = " Write Eigenvalues (spin down) to file: " + directory_ + "bands2.txt"; EXPECT_NE(text.find(up_line), std::string::npos) << text; EXPECT_NE(text.find(down_line), std::string::npos) << text; } diff --git a/source/source_io/unittests/test_write_dmk.cpp b/source/source_io/unittests/test_write_dmk.cpp new file mode 100644 index 00000000000..e2d1b72c4b3 --- /dev/null +++ b/source/source_io/unittests/test_write_dmk.cpp @@ -0,0 +1,1765 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "source_io/module_dm/write_dmk.h" +#include "source_io/module_hs/dense_text_body.h" +#include "source_base/global_variable.h" +#include "prepare_unitcell.h" + +#include "gmock/gmock.h" +#include "gtest/gtest.h" +#include "source_base/module_external/scalapack_connector.h" + +#ifdef __MPI +#include "mpi.h" +#endif + +Magnetism::Magnetism() { + this->tot_mag = 0.0; + this->abs_mag = 0.0; +} +Magnetism::~Magnetism() { } + +/************************************************ + * unit test of read_dmk and write_dmk + ***********************************************/ + +/** + * - Tested Functions: + * - read_dmk() + * - the function to read density matrix K from file + * - the serial version without MPI + * - write_dmk() + * - the function to write density matrix K to file + * - the serial version without MPI + */ + +void init_pv(int nlocal, Parallel_Blkcyclic& pv) +{ +#ifdef __MPI + pv.init(nlocal, nlocal, 1, MPI_COMM_WORLD, false); +#else + pv.set_serial(nlocal, nlocal); +#endif +} + +template +void gen_dmk(std::vector>& dmk, std::vector& efs, int nspin, int nk, int nlocal, Parallel_Blkcyclic& pv) +{ + int myrank = 0; +#ifdef __MPI + MPI_Comm_rank(MPI_COMM_WORLD, &myrank); +#endif + std::vector> dmk_global(nspin * nk, std::vector(nlocal * nlocal, T(0.0))); + if (myrank == 0) + { + for (int i = 0; i < nspin * nk; i++) + { + for (int j = 0; j < nlocal * nlocal; j++) + { + std::complex value = std::complex(1.0 * i + 0.1 * j, 0.1 * i + 1.0 * j); + dmk_global[i][j] = reinterpret_cast(&value)[0]; + } + } + } +#ifdef __MPI + Parallel_Blkcyclic pv_global; + pv_global.init(nlocal, nlocal, nlocal, MPI_COMM_WORLD, false); + dmk.resize(nspin * nk, std::vector(pv.size(), 0.0)); + for (int i = 0; i < nspin * nk; i++) + { + Cpxgemr2d(nlocal, + nlocal, + dmk_global[i].data(), + 1, + 1, + const_cast(pv_global.desc()), + dmk[i].data(), + 1, + 1, + const_cast(pv.desc()), + pv.ictxt()); + } +#else + dmk = dmk_global; +#endif + + efs.resize(nspin, 0.0); + for (int i = 0; i < nspin; i++) + { + efs[i] = 0.1 * i; + } +} + +/// @brief Fill the single-k-point K_Vectors metadata used by the writers. +void init_kv(K_Vectors& kv, const double weight) +{ + kv.set_nkstot(1); + kv.set_nkstot_nospin(1); + kv.set_nks(1); + kv.set_spin_mult(2); + kv.kvec_c.resize(1); + kv.kvec_c[0].x = 0.0; + kv.kvec_c[0].y = 0.0; + kv.kvec_c[0].z = 0.0; + kv.kvec_d.resize(1); + kv.kvec_d[0].x = 0.0; + kv.kvec_d[0].y = 0.0; + kv.kvec_d[0].z = 0.0; + kv.wk.resize(1); + kv.wk[0] = weight; + kv.isk.resize(1); + kv.isk[0] = 0; + kv.kc_done = true; + kv.kd_done = true; +} + +/// @brief Tokenize the numbers of the matrix body written at the end of a DMK +/// file. +/// @details The body is the trailing run of lines carrying complex pairs, so it +/// is collected from the end of the file; taking the first "(" instead +/// would hit the UnitCell header, and parsing the whole file would +/// trip over the non-numeric metadata. Parentheses and commas become +/// whitespace, so the value order (real, imaginary, real, ...) is +/// preserved. +std::vector read_numbers(const std::string& fname) +{ + std::ifstream ifs(fname.c_str()); + std::vector lines; + std::string line; + while (std::getline(ifs, line)) + { + lines.push_back(line); + } + std::size_t first_body_line = lines.size(); + while (first_body_line > 0) + { + const std::string& candidate = lines[first_body_line - 1]; + if (candidate.find('(') == std::string::npos || candidate.find(')') == std::string::npos) + { + break; + } + --first_body_line; + } + std::string text; + for (std::size_t i = first_body_line; i < lines.size(); ++i) + { + text += lines[i]; + text += " "; + } + for (std::size_t i = 0; i < text.size(); ++i) + { + const char c = text[i]; + if (c == '(' || c == ')' || c == ',') + { + text[i] = ' '; + } + } + std::istringstream iss(text); + std::vector values; + double value = 0.0; + while (iss >> value) + { + values.push_back(value); + } + return values; +} + +/// @brief Fill the local blocks of a single-k-point DM with a row-major probe, +/// stored column-major as a column-major eigensolver would leave it. +template +void fill_local_dmk(const std::vector& probe, const int nlocal, + const Parallel_Blkcyclic& pv, std::vector>& dmk) +{ + dmk.assign(1, std::vector(pv.size(), T(0))); + for (int i = 0; i < nlocal; ++i) + { + const int ir = pv.irloc(i); + if (ir < 0) + { + continue; + } + for (int j = 0; j < nlocal; ++j) + { + const int ic = pv.icloc(j); + if (ic >= 0) + { + dmk[0][ir + ic * pv.nrloc()] = probe[i * nlocal + j]; + } + } + } +} + +/// @brief Fill the K_Vectors metadata for nspin spin channels and nk k-points. +/// @details write_dmk reads one k-point coordinate, weight and index per file, +/// so a multi-k round trip needs real k-point arrays instead of the +/// single-point metadata set up by init_kv. +void init_kv_multi(K_Vectors& kv, const int nspin, const int nk) +{ + kv.set_nkstot(nspin * nk); + kv.set_nkstot_nospin(nk); + kv.set_nks(nspin * nk); + kv.set_spin_mult(2); + kv.kvec_c.resize(nk); + kv.kvec_d.resize(nk); + kv.wk.resize(nk); + kv.isk.resize(nk); + for (int ik = 0; ik < nk; ++ik) + { + kv.kvec_c[ik].x = 0.1 * ik; + kv.kvec_c[ik].y = 0.0; + kv.kvec_c[ik].z = 0.0; + kv.kvec_d[ik].x = 0.1 * ik; + kv.kvec_d[ik].y = 0.0; + kv.kvec_d[ik].z = 0.0; + kv.wk[ik] = 1.0 / nk; + kv.isk[ik] = 0; + } + kv.kc_done = true; + kv.kd_done = true; +} + +/// @brief Copy a file inside the scratch directory. +/// @details Used to build a file whose header contradicts the name the reader +/// looks for, which cannot be produced through write_dmk itself. +bool copy_file(const std::string& src, const std::string& dst) +{ + std::ifstream ifs(src.c_str()); + if (!ifs.good()) + { + return false; + } + std::ofstream ofs(dst.c_str()); + if (!ofs.good()) + { + return false; + } + ofs << ifs.rdbuf(); + return ofs.good(); +} + +/// @brief Drop the final line of a text file to simulate a truncated write. +bool drop_last_line(const std::string& fname) +{ + std::ifstream ifs(fname.c_str()); + std::vector lines; + std::string line; + while (std::getline(ifs, line)) + { + lines.push_back(line); + } + ifs.close(); + if (lines.empty()) + { + return false; + } + std::ofstream ofs(fname.c_str()); + for (std::size_t i = 0; i + 1 < lines.size(); ++i) + { + ofs << lines[i] << "\n"; + } + ofs.close(); + return true; +} + +TEST(DMKTest, GenFileName) { + bool gamma_only = true; + int ispin = 0; + int nspin = 2; + int ik = 0; + int istep = 0; + std::string fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); + EXPECT_EQ(fname, "dms1g1_nao.txt"); + + ispin = 1; + + fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); + EXPECT_EQ(fname, "dms2g1_nao.txt"); + + ispin = 0; + gamma_only = false; + + fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); + EXPECT_EQ(fname, "dmk1s1g1_nao.txt"); + + ispin = 1; + ik = 1; + + fname = ModuleIO::dmk_gen_fname(gamma_only, ispin, nspin, ik, istep); + EXPECT_EQ(fname, "dmk2s2g1_nao.txt"); +}; + + +TEST(DMKTest,WriteDMK) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + int nspin = 2; + int nk = 1; + int nk_multik = 2; + int nlocal = 20; + std::vector> dmk; + std::vector>> dmk_multik; + Parallel_Blkcyclic pv; + std::vector efs; + init_pv(nlocal, pv); + + gen_dmk(dmk, efs, nspin, nk, nlocal, pv); + gen_dmk(dmk_multik, efs, nspin, nk_multik, nlocal, pv); + const std::string out_dir = "./"; + + const int istep = -1; + K_Vectors kv; + init_kv(kv, 1.0); + + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, 3, efs, ucell, pv, /*column_major=*/true, + out_dir, istep, 0, ofs_log); + ModuleIO::write_dmk(dmk_multik, kv, 3, efs, ucell, pv, /*column_major=*/true, + out_dir, istep, 0, ofs_log); + + std::ifstream ifs; + + int pass = 0; + if (GlobalV::MY_RANK == 0) + { + std::string fn = "dms1_nao.txt"; + ifs.open(fn); + std::string str((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + ifs.close(); + + fn = "dms2_nao.txt"; + ifs.open(fn); + str = std::string((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + ifs.close(); + + fn = "dmk1s1_nao.txt"; + ifs.open(fn); + str = std::string((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + // the matrix body must end with a newline so appended records are not glued + EXPECT_EQ(str.back(), '\n'); + ifs.close(); + + fn = "dmk2s1_nao.txt"; + ifs.open(fn); + str = std::string((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + ifs.close(); + + fn = "dmk1s2_nao.txt"; + ifs.open(fn); + str = std::string((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + ifs.close(); + + fn = "dmk2s2_nao.txt"; + ifs.open(fn); + str = std::string((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + EXPECT_THAT(str, testing::HasSubstr("0.1 # Fermi energy in Ry")); + EXPECT_THAT(str, testing::HasSubstr("20 # number of localized basis")); + ifs.close(); + remove("dms1_nao.txt"); + remove("dms2_nao.txt"); + remove("dmk1s1_nao.txt"); + remove("dmk2s1_nao.txt"); + remove("dmk1s2_nao.txt"); + remove("dmk2s2_nao.txt"); + } + + delete ucell; + // remove the generated files + +}; + +// --------------------------------------------------------------------------- +// The DM(k) text body is row-major even when the local blocks are stored +// column-major, which is what genelpa/elpa/scalapack_gvx and the other +// column-major solvers leave behind. A non-symmetric complex probe makes an +// accidental transpose (the complex conjugate of a Hermitian matrix) visible. +// --------------------------------------------------------------------------- +TEST(DMKTest, BodyIsRowMajorForColumnMajorStorage) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + // Row-major probe: (0,0)=1, (0,1)=2+3i, (1,0)=4+5i, (1,1)=6. + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + + // Column-major storage of the same matrix: local[ir + ic * nrloc]. + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, 8, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + // nk = 1 with a multi-k (complex) DM -> dmk1_nao.txt. + const std::string fn = out_dir + "dmk1_nao.txt"; + const std::vector values = read_numbers(fn); + ASSERT_EQ(values.size(), 8u); + EXPECT_NEAR(values[0], 1.0, 1e-8); + EXPECT_NEAR(values[1], 0.0, 1e-8); + EXPECT_NEAR(values[2], 2.0, 1e-8); + EXPECT_NEAR(values[3], 3.0, 1e-8); + EXPECT_NEAR(values[4], 4.0, 1e-8); + EXPECT_NEAR(values[5], 5.0, 1e-8); + EXPECT_NEAR(values[6], 6.0, 1e-8); + EXPECT_NEAR(values[7], 0.0, 1e-8); + remove(fn.c_str()); + } + + delete ucell; +} + +// --------------------------------------------------------------------------- +// out_app_flag = 0: one fixed filename, truncated and overwritten each call. +// --------------------------------------------------------------------------- +TEST(DMKTest, Mode0FixedNameOverwrite) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + int nspin = 2; + int nk = 1; + int nlocal = 20; + std::vector> dmk; + std::vector efs; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + gen_dmk(dmk, efs, nspin, nk, nlocal, pv); + + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = "./"; + const int out_app_flag = 0; + std::ofstream ofs_log; + + // Two different isteps -> the same fixed filename, overwritten each call. + ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, out_app_flag, ofs_log); + ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/1, out_app_flag, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + std::ifstream ifs("dms1_nao.txt"); + std::string str((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + ifs.close(); + // The second write replaced the first record: only step 2 remains. + EXPECT_THAT(str, testing::HasSubstr("Ionic_Step 2")); + EXPECT_THAT(str, testing::Not(testing::HasSubstr("Ionic_Step 1"))); + // g-suffixed files must NOT exist. + ifs.open("dms1g1_nao.txt"); + EXPECT_FALSE(ifs.good()); + ifs.open("dms1g2_nao.txt"); + EXPECT_FALSE(ifs.good()); + remove("dms1_nao.txt"); + remove("dms2_nao.txt"); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// out_app_flag = 1: fixed filename, multiple calls append successive records. +// --------------------------------------------------------------------------- +TEST(DMKTest, Mode1FixedNameAppend) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + int nspin = 2; + int nk = 1; + int nlocal = 20; + std::vector> dmk; + std::vector efs; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + gen_dmk(dmk, efs, nspin, nk, nlocal, pv); + + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = "./"; + const int out_app_flag = 1; + std::ofstream ofs_log; + + // Two ionic steps -> both write to dms1_nao.txt. + ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, out_app_flag, ofs_log); + ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/1, out_app_flag, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + std::ifstream ifs("dms1_nao.txt"); + std::string str((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + ifs.close(); + // Two "Ionic_Step" headers present -> two appended records. + EXPECT_THAT(str, testing::HasSubstr("Ionic_Step 1")); + EXPECT_THAT(str, testing::HasSubstr("Ionic_Step 2")); + // g-suffixed file must NOT exist. + ifs.open("dms1g1_nao.txt"); + EXPECT_FALSE(ifs.good()); + remove("dms1_nao.txt"); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// out_app_flag = 2: per-step g{step} filename; directory routing is handled by +// set_global_dir and is covered by io_sys_var_test. +// --------------------------------------------------------------------------- +TEST(DMKTest, Mode2PerStepFile) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + int nspin = 2; + int nk = 1; + int nlocal = 20; + std::vector> dmk; + std::vector efs; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + gen_dmk(dmk, efs, nspin, nk, nlocal, pv); + + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = "./"; + const int out_app_flag = 2; + std::ofstream ofs_log; + + ModuleIO::write_dmk(dmk, kv, /*precision=*/3, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/2, out_app_flag, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + std::ifstream ifs("dms1g3_nao.txt"); + EXPECT_TRUE(ifs.good()); + ifs.close(); + remove("dms1g3_nao.txt"); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// Round trip: write a column-major DM(k) and read it back with the same +// storage order. A transposed read would return the complex conjugate of the +// Hermitian probe, i.e. the imaginary off-diagonal elements would flip sign. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRoundTripComplex) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + // Row-major probe: (0,0)=1, (0,1)=2+3i, (1,0)=4+5i, (1,1)=6. + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + ASSERT_EQ(dmk_read[0].size(), dmk[0].size()); + for (std::size_t idx = 0; idx < dmk[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk[0][idx].imag(), 1e-8); + } + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +TEST(DMKTest, ReadDMKRoundTripGamma) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + // Row-major probe: 1, 2 / 3, 4. + const std::vector probe = {1.0, 2.0, 3.0, 4.0}; + std::vector> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + std::vector> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + ASSERT_EQ(dmk_read[0].size(), dmk[0].size()); + for (std::size_t idx = 0; idx < dmk[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx], dmk[0][idx], 1e-8); + } + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dm_nao.txt").c_str()); + } + delete ucell; +} + +TEST(DMKTest, ReadDMKRoundTripMultipleMatrices) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 2; + const int nk = 2; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv(kv, 0.5); + kv.set_nkstot(nspin * nk); + kv.set_nkstot_nospin(nk); + kv.set_nks(nspin * nk); + kv.kvec_c.resize(nk); + kv.kvec_d.resize(nk); + kv.wk.resize(nk); + kv.isk.resize(nk); + for (int ik = 0; ik < nk; ++ik) + { + kv.kvec_c[ik].x = 0.1 * ik; + kv.kvec_d[ik].x = 0.1 * ik; + kv.wk[ik] = 0.5; + kv.isk[ik] = 0; + } + + std::vector>> dmk(nspin * nk); + for (int index = 0; index < nspin * nk; ++index) + { + std::vector> probe(nlocal * nlocal); + for (int element = 0; element < nlocal * nlocal; ++element) + { + probe[element] = std::complex(0.25 * (index + 1) * (element + 1), + 0.1 * index - 0.2 * element); + } + std::vector>> one_dmk; + fill_local_dmk(probe, nlocal, pv, one_dmk); + dmk[index] = one_dmk[0]; + } + + const std::string out_dir = testing::TempDir(); + const std::vector efs(nspin, 0.0); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), dmk.size()); + for (int index = 0; index < nspin * nk; ++index) + { + ASSERT_EQ(dmk_read[index].size(), dmk[index].size()); + for (std::size_t element = 0; element < dmk[index].size(); ++element) + { + EXPECT_NEAR(dmk_read[index][element].real(), dmk[index][element].real(), 1e-8); + EXPECT_NEAR(dmk_read[index][element].imag(), dmk[index][element].imag(), 1e-8); + } + } + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dmk1s1_nao.txt").c_str()); + remove((out_dir + "dmk2s1_nao.txt").c_str()); + remove((out_dir + "dmk1s2_nao.txt").c_str()); + remove((out_dir + "dmk2s2_nao.txt").c_str()); + } + delete ucell; +} + +// A missing file must be reported cooperatively instead of aborting a single +// rank, so the caller can decide how to continue. +TEST(DMKTest, ReadDMKMissingFileReturnsFalse) { + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv(kv, 1.0); + + std::vector> dmk(1, std::vector(nlocal * nlocal, 7.0)); + const std::vector> original = dmk; + std::ofstream ofs_log; + const std::string missing_dir = testing::TempDir() + "dmk_no_such_dir/"; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, missing_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk, ofs_log)); + EXPECT_EQ(dmk, original); +} + +#ifdef __MPI +/// @brief Verify that split descriptor communicators keep their read status independent. +TEST(DMKTest, ReadDMKSplitCommunicatorStatus) +{ + int world_rank = 0; + int world_size = 0; + MPI_Comm_rank(MPI_COMM_WORLD, &world_rank); + MPI_Comm_size(MPI_COMM_WORLD, &world_size); + if (world_size < 2) + { + GTEST_SKIP() << "This test requires at least two MPI ranks"; + } + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + Parallel_Blkcyclic pv_world; + init_pv(nlocal, pv_world); + const std::vector probe = {1.0, 2.0, 3.0, 4.0}; + std::vector> dmk; + fill_local_dmk(probe, nlocal, pv_world, dmk); + + K_Vectors kv; + init_kv(kv, 1.0); + const std::vector efs(nspin, 0.0); + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv_world, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + MPI_Barrier(MPI_COMM_WORLD); + + const int color = world_rank % 2; + MPI_Comm split_comm = MPI_COMM_NULL; + MPI_Comm_split(MPI_COMM_WORLD, color, world_rank, &split_comm); + + int local_pass = 1; + { + Parallel_Blkcyclic pv_split; + pv_split.init(nlocal, nlocal, 1, split_comm, false); + const std::vector sentinel(pv_split.size(), 7.0); + std::vector> dmk_read(1, sentinel); + const bool expect_success = (color == 0); + const std::string read_dir = expect_success ? out_dir : out_dir + "dmk_split_missing_dir/"; + const bool read_success = ModuleIO::read_dmk(nspin, nk, kv, pv_split, /*column_major=*/true, + read_dir, /*istep=*/0, /*out_app_flag=*/0, + dmk_read, ofs_log); + if (read_success != expect_success) + { + local_pass = 0; + } + + if (expect_success) + { + std::vector> expected; + fill_local_dmk(probe, nlocal, pv_split, expected); + if (dmk_read != expected) + { + local_pass = 0; + } + } + else if (dmk_read.size() != 1 || dmk_read[0] != sentinel) + { + local_pass = 0; + } + } + MPI_Comm_free(&split_comm); + + int global_pass = 0; + MPI_Allreduce(&local_pass, &global_pass, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD); + EXPECT_EQ(global_pass, 1) << "Split communicators exchanged read status or returned incorrect data"; + + if (world_rank == 0) + { + std::remove((out_dir + "dm_nao.txt").c_str()); + } + MPI_Barrier(MPI_COMM_WORLD); + delete ucell; +} +#endif + +// --------------------------------------------------------------------------- +// out_app_flag = 2: the ionic step is part of the filename, so the reader has +// to request the matching g{istep+1} file and reject a frame whose marker +// contradicts the name. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKMode2PerStepFile) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/2, /*out_app_flag=*/2, ofs_log); + + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/2, /*out_app_flag=*/2, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + ASSERT_EQ(dmk_read[0].size(), dmk[0].size()); + for (std::size_t idx = 0; idx < dmk[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk[0][idx].imag(), 1e-8); + } + + // A different step maps to another file name, which does not exist. + std::vector>> dmk_other_step; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/2, dmk_other_step, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dmk1g3_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// out_app_flag = 1: a fixed-name file accumulates one record per ionic step, +// so the reader has to select the requested frame instead of always taking the +// first one. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKMode1FrameSelection) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + const std::vector> probe_first + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + const std::vector> probe_second + = {std::complex(7.0, 0.0), std::complex(8.0, 1.0), + std::complex(9.0, 2.0), std::complex(10.0, 0.0)}; + std::vector>> dmk_first; + std::vector>> dmk_second; + fill_local_dmk(probe_first, nlocal, pv, dmk_first); + fill_local_dmk(probe_second, nlocal, pv, dmk_second); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + // Step 0 truncates the file and step 1 appends the second record. + ModuleIO::write_dmk(dmk_first, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/1, ofs_log); + ModuleIO::write_dmk(dmk_second, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/1, /*out_app_flag=*/1, ofs_log); + + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/1, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + for (std::size_t idx = 0; idx < dmk_first[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk_first[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk_first[0][idx].imag(), 1e-8); + } + + dmk_read.clear(); + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/1, /*out_app_flag=*/1, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + for (std::size_t idx = 0; idx < dmk_second[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk_second[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk_second[0][idx].imag(), 1e-8); + } + + // A frame that was never appended must be reported, not silently replaced + // by the last available record. + std::vector>> dmk_missing_frame; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/5, /*out_app_flag=*/1, dmk_missing_frame, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +/// @brief Check that every block of a DM(k) buffer still holds the sentinel. +bool all_equal_to(const std::vector>>& dmk, + const std::complex& sentinel) +{ + for (std::size_t ib = 0; ib < dmk.size(); ++ib) + { + for (std::size_t ie = 0; ie < dmk[ib].size(); ++ie) + { + if (dmk[ib][ie] != sentinel) + { + return false; + } + } + } + return true; +} + +// --------------------------------------------------------------------------- +// A failure on a later (spin, k) point must discard the matrices that were +// already read; otherwise the caller would keep a half-updated DM(k) and run +// the next SCF from a mixture of two restarts. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKPartialFailureKeepsCallerData) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 2; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + std::vector>> dmk; + for (int ik = 0; ik < nk; ++ik) + { + std::vector> probe(nlocal * nlocal, + std::complex(ik + 1.0, 0.5 * ik)); + std::vector>> one_dmk; + fill_local_dmk(probe, nlocal, pv, one_dmk); + dmk.push_back(one_dmk[0]); + } + + const std::vector efs(nspin, 0.0); + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // Removing the last matrix makes the first one read successfully and the + // second one fail, so the failure happens after partial progress. + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk2_nao.txt").c_str()); + } + + const std::complex sentinel(7.0, 7.0); + std::vector>> dmk_read( + nspin * nk, std::vector>(pv.nrloc() * pv.ncloc(), sentinel)); + + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + EXPECT_TRUE(all_equal_to(dmk_read, sentinel)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// A spin-down file whose header claims spin 1 must be rejected instead of being +// loaded as the down channel. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsSpinMismatch) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 2; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + const std::vector> probe_up + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + const std::vector> probe_down + = {std::complex(7.0, 0.0), std::complex(8.0, 1.0), + std::complex(9.0, 2.0), std::complex(10.0, 0.0)}; + std::vector>> dmk; + std::vector>> probe_block; + fill_local_dmk(probe_up, nlocal, pv, probe_block); + dmk.push_back(probe_block[0]); + fill_local_dmk(probe_down, nlocal, pv, probe_block); + dmk.push_back(probe_block[0]); + + std::vector efs(nspin, 0.0); + efs[1] = 0.1; + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // Overwrite the spin-down file with the spin-up one: the content now + // contradicts both the name and the requested spin channel. + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(copy_file(out_dir + "dmk1s1_nao.txt", out_dir + "dmk1s2_nao.txt")); + } + + const std::complex sentinel(7.0, 7.0); + std::vector>> dmk_read( + nspin * nk, std::vector>(pv.nrloc() * pv.ncloc(), sentinel)); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + EXPECT_TRUE(all_equal_to(dmk_read, sentinel)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1s1_nao.txt").c_str()); + std::remove((out_dir + "dmk1s2_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// k-point metadata: a different k-mesh and a file holding the wrong k-point +// must both be rejected instead of being used for the requested index. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsKPointMismatch) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 2; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + std::vector>> dmk; + for (int ik = 0; ik < nk; ++ik) + { + std::vector> probe(nlocal * nlocal, + std::complex(ik + 1.0, 0.5 * ik)); + std::vector>> one_dmk; + fill_local_dmk(probe, nlocal, pv, one_dmk); + dmk.push_back(one_dmk[0]); + } + + const std::vector efs(nspin, 0.0); + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // A restart with a different total number of k-points must not reuse these + // files even though the per-k filename happens to match. + K_Vectors kv_other_mesh; + init_kv_multi(kv_other_mesh, nspin, nk); + kv_other_mesh.set_nkstot(nspin * nk + 1); + std::vector>> dmk_read; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv_other_mesh, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + // The second k-point's record copied over the first name: the header index + // no longer matches the requested k-point. + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(copy_file(out_dir + "dmk2_nao.txt", out_dir + "dmk1_nao.txt")); + } + dmk_read.clear(); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + std::remove((out_dir + "dmk2_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// k-point coordinates: a mesh of the same size but with reordered or shifted +// k-vectors must be rejected, because cal_dmr pairs the read DM(k) with the +// current KPT phases and would silently build a wrong density. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsKVecMismatch) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 2; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + std::vector>> dmk; + for (int ik = 0; ik < nk; ++ik) + { + std::vector> probe(nlocal * nlocal, + std::complex(ik + 1.0, 0.5 * ik)); + std::vector>> one_dmk; + fill_local_dmk(probe, nlocal, pv, one_dmk); + dmk.push_back(one_dmk[0]); + } + + const std::vector efs(nspin, 0.0); + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // Same nkstot and same indices, but the k-vectors are swapped between the + // two files: the stored coordinate no longer matches the requested ik. + K_Vectors kv_swapped; + init_kv_multi(kv_swapped, nspin, nk); + kv_swapped.kvec_d[0].x = 0.1; + kv_swapped.kvec_d[1].x = 0.0; + std::vector>> dmk_read; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv_swapped, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + // A mesh shifted by a fractional amount with the same count and indices + // must also be rejected. + K_Vectors kv_shifted; + init_kv_multi(kv_shifted, nspin, nk); + kv_shifted.kvec_d[0].x += 0.05; + kv_shifted.kvec_d[1].x += 0.05; + dmk_read.clear(); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv_shifted, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + // A shift by an integer reciprocal-lattice vector leaves e^{ik·R} + // unchanged, so the same DM(k) is still valid and must be accepted. + K_Vectors kv_wrapped; + init_kv_multi(kv_wrapped, nspin, nk); + kv_wrapped.kvec_d[0].x += 1.0; + kv_wrapped.kvec_d[1].x -= 2.0; + dmk_read.clear(); + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv_wrapped, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + std::remove((out_dir + "dmk2_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// A basis size that differs from the current calculation must be rejected, not +// silently truncated or over-read. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsBasisMismatch) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + const std::vector efs(nspin, 0.0); + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // Read the 2x2 record with a 3-orbital distribution. + Parallel_Blkcyclic pv_wide; + init_pv(nlocal + 1, pv_wide); + std::vector>> dmk_read( + nspin * nk, std::vector>(pv_wide.nrloc() * pv_wide.ncloc(), + std::complex(7.0, 7.0))); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv_wide, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// Truncated input: a file cut inside the header and a complete file whose last +// body line was lost must both fail instead of yielding a partial matrix. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsTruncatedFile) { + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + K_Vectors kv; + init_kv_multi(kv, nspin, nk); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + + // Cut inside the header: only the spin count survives. + if (GlobalV::MY_RANK == 0) + { + std::ofstream ofs((out_dir + "dm_nao.txt").c_str()); + ofs << "1\n"; + ofs.close(); + } + std::vector> dmk_read; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + // A complete record whose final line was lost: the body is short. + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const std::vector probe = {1.0, 2.0, 3.0, 4.0}; + std::vector> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + const std::vector efs(nspin, 0.0); + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(drop_last_line(out_dir + "dm_nao.txt")); + } + dmk_read.clear(); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dm_nao.txt").c_str()); + } + delete ucell; +} + +/// @brief Replace a specific line of a text file with new content. +/// @param fname Path of the file to rewrite (must exist). +/// @param target Zero-based line index to replace; out-of-range returns false. +/// @param new_content The replacement text, written with a trailing newline. +bool rewrite_line(const std::string& fname, std::size_t target, const std::string& new_content) +{ + std::ifstream ifs(fname.c_str()); + if (!ifs.good()) + { + return false; + } + std::vector lines; + std::string line; + while (std::getline(ifs, line)) + { + lines.push_back(line); + } + if (target >= lines.size()) + { + return false; + } + lines[target] = new_content; + std::ofstream ofs(fname.c_str()); + if (!ofs.good()) + { + return false; + } + for (std::size_t i = 0; i < lines.size(); ++i) + { + ofs << lines[i] << "\n"; + } + return ofs.good(); +} + +// --------------------------------------------------------------------------- +// UnitCell block integrity: a file whose per-type atom-count line cannot be +// parsed as integers used to leave the void skipper at the subsequent +// coordinate rows. A small (e.g. nlocal = 2) matrix read would then consume +// those coordinates and the reader would hand back a bogus density matrix. +// The skipper must fail fast instead, so read_dmk reports parse failure. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRejectsMalformedAtomCount) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + // Row-major probe: 1, 2 / 3, 4. + const std::vector probe = {1.0, 2.0, 3.0, 4.0}; + std::vector> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + const std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + // write_dmk emits a 14-line header (Ionic_Step through the trailing + // blank separator) followed by the UnitCell block written by write_ucell. + // For a canonical Si single cell (ntype = 1, na = 2) the per-type atom + // counts sit at global line index 20: + // 14: latName, 15: lat0, 16-18: latvec rows, 19: atom labels, + // 20: per-type counts " 2", 21: "Direct", 22-23: coordinates. + // Replace the counts with a non-numeric token so read_ucell has to + // bail out with total_natom == 0. With the old void skipper that + // would leave the stream at the coordinate rows, whose six doubles + // are enough to satisfy a 2x2 gamma matrix read. + const std::string fn = out_dir + "dm_nao.txt"; + ASSERT_TRUE(rewrite_line(fn, /*target=*/20, "X # malformed count\n")); + } + + const std::vector> sentinel( + 1, std::vector(pv.nrloc() * pv.ncloc(), 7.0)); + std::vector> dmk_read = sentinel; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + // The caller buffer must not be touched on failure. + EXPECT_EQ(dmk_read, sentinel); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dm_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// The flat index shared by the readers and the writers: a row-major buffer +// stores (i, j) at i * nlocal + j, a column-major one at j * nlocal + i. All +// LCAO ks_solver choices are column-major, so this mapping is what keeps the +// file row-major for every supported solver. +// --------------------------------------------------------------------------- +TEST(DMKTest, DenseBufferIndexSelectsLayout) { + EXPECT_EQ(ModuleIO::dense_buffer_index(0, 0, 3, /*column_major=*/false), 0u); + EXPECT_EQ(ModuleIO::dense_buffer_index(0, 1, 3, /*column_major=*/false), 1u); + EXPECT_EQ(ModuleIO::dense_buffer_index(1, 0, 3, /*column_major=*/false), 3u); + EXPECT_EQ(ModuleIO::dense_buffer_index(2, 1, 3, /*column_major=*/false), 7u); + EXPECT_EQ(ModuleIO::dense_buffer_index(0, 1, 3, /*column_major=*/true), 3u); + EXPECT_EQ(ModuleIO::dense_buffer_index(1, 0, 3, /*column_major=*/true), 1u); + EXPECT_EQ(ModuleIO::dense_buffer_index(1, 2, 3, /*column_major=*/true), 7u); +} + +// --------------------------------------------------------------------------- +// The header must state the conj-first element convention, and read_dmk must +// transparently skip that comment line when the file is read back. +// --------------------------------------------------------------------------- +TEST(DMKTest, HeaderStatesConjFirstConvention) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + // Non-symmetric complex probe: a conj-last (i.e. transposed) read of the + // Hermitian-interpreted body would flip the off-diagonal imaginary signs. + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + if (GlobalV::MY_RANK == 0) + { + const std::string fn = out_dir + "dmk1_nao.txt"; + std::ifstream ifs(fn.c_str()); + const std::string str((std::istreambuf_iterator(ifs)), + std::istreambuf_iterator()); + ifs.close(); + EXPECT_THAT(str, testing::HasSubstr( + "# matrix element (i,j) = sum_n w_n * conj(c_n,i) * c_n,j")); + } + + // The '#' comment line inside the header must not disturb the round trip. + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + ASSERT_EQ(dmk_read[0].size(), dmk[0].size()); + for (std::size_t idx = 0; idx < dmk[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk[0][idx].imag(), 1e-8); + } + + if (GlobalV::MY_RANK == 0) + { + remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// With column_major = false the reader and the writer must still agree on the +// same layout, otherwise a restart would read a transposed matrix. No current +// LCAO solver takes this branch, so this only pins their mutual consistency. +// --------------------------------------------------------------------------- +TEST(DMKTest, ReadDMKRoundTripRowMajorFlag) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + const std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/false, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + std::vector>> dmk_read; + EXPECT_TRUE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/false, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + ASSERT_EQ(dmk_read.size(), 1u); + ASSERT_EQ(dmk_read[0].size(), dmk[0].size()); + for (std::size_t idx = 0; idx < dmk[0].size(); ++idx) + { + EXPECT_NEAR(dmk_read[0][idx].real(), dmk[0][idx].real(), 1e-8); + EXPECT_NEAR(dmk_read[0][idx].imag(), dmk[0][idx].imag(), 1e-8); + } + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +// --------------------------------------------------------------------------- +// The reader must reject non-finite matrix components: strtod reports an +// overflowing literal such as "1e999" only through errno while consuming the +// full token, and both strtod and the stream extractor accept the literal +// spellings "inf"/"nan" without flagging a failure. Such a component would +// otherwise be installed as the restart density. +// --------------------------------------------------------------------------- + +/// @brief Overwrite the first matrix-body token of a written DM(k) file. +/// @details The complex body is the only section whose tokens contain '('; +/// for the real body of a 2x2 matrix the whole body is the final +/// line (8 values per line). Both fixtures used below keep the body +/// free of comment markers, which the header and the UnitCell block +/// never are on their numeric lines. +bool patch_first_body_token(const std::string& fname, + const std::string& token, + const bool complex_body) +{ + std::ifstream ifs(fname.c_str()); + std::vector lines; + std::string line; + while (std::getline(ifs, line)) + { + lines.push_back(line); + } + ifs.close(); + if (lines.empty()) + { + return false; + } + + std::size_t target = lines.size(); + if (complex_body) + { + for (std::size_t i = 0; i < lines.size(); ++i) + { + if (lines[i].find('(') != std::string::npos) + { + target = i; + break; + } + } + } + else + { + target = lines.size() - 1; + } + if (target == lines.size()) + { + return false; + } + + std::string& current = lines[target]; + const std::size_t first = current.find_first_not_of(" \t"); + if (first == std::string::npos) + { + return false; + } + const std::size_t end = current.find_first_of(" \t", first); + current.replace(first, end == std::string::npos ? std::string::npos : end - first, token); + + std::ofstream ofs(fname.c_str()); + for (const std::string& out_line : lines) + { + ofs << out_line << "\n"; + } + return true; +} + +TEST(DMKTest, ReadDMKRejectsOverflowingComplexComponent) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + const std::vector> probe + = {std::complex(1.0, 0.0), std::complex(2.0, 3.0), + std::complex(4.0, 5.0), std::complex(6.0, 0.0)}; + std::vector>> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + const std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // strtod consumes "1e999" fully and only reports the overflow via ERANGE. + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(patch_first_body_token(out_dir + "dmk1_nao.txt", "(1e999,0)", true)); + } + std::vector>> dmk_read; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + // The literal "nan" parses without any errno flag and must be rejected too. + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(patch_first_body_token(out_dir + "dmk1_nao.txt", "(nan,0)", true)); + } + dmk_read.clear(); + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dmk1_nao.txt").c_str()); + } + delete ucell; +} + +TEST(DMKTest, ReadDMKRejectsNonFiniteRealComponent) { + UnitCell* ucell; + UcellTestPrepare utp = UcellTestLib["Si"]; + ucell = utp.SetUcellInfo(); + + const int nspin = 1; + const int nk = 1; + const int nlocal = 2; + Parallel_Blkcyclic pv; + init_pv(nlocal, pv); + + const std::vector probe = {1.0, 2.0, 3.0, 4.0}; + std::vector> dmk; + fill_local_dmk(probe, nlocal, pv, dmk); + + const std::vector efs(nspin, 0.0); + K_Vectors kv; + init_kv(kv, 1.0); + + const std::string out_dir = testing::TempDir(); + std::ofstream ofs_log; + ModuleIO::write_dmk(dmk, kv, /*precision=*/12, efs, ucell, pv, /*column_major=*/true, + out_dir, /*istep=*/0, /*out_app_flag=*/0, ofs_log); + + // The stream extractor accepts the literal "inf" without setting failbit. + if (GlobalV::MY_RANK == 0) + { + EXPECT_TRUE(patch_first_body_token(out_dir + "dm_nao.txt", "inf", false)); + } + std::vector> dmk_read; + EXPECT_FALSE(ModuleIO::read_dmk(nspin, nk, kv, pv, /*column_major=*/true, out_dir, + /*istep=*/0, /*out_app_flag=*/0, dmk_read, ofs_log)); + + if (GlobalV::MY_RANK == 0) + { + std::remove((out_dir + "dm_nao.txt").c_str()); + } + delete ucell; +} + + +#ifdef __MPI +int main(int argc, char** argv) +{ + GlobalV::MY_RANK = 0; + + MPI_Init(&argc, &argv); + MPI_Comm_size(MPI_COMM_WORLD, &GlobalV::NPROC); + MPI_Comm_rank(MPI_COMM_WORLD, &GlobalV::MY_RANK); + + testing::InitGoogleTest(&argc, argv); + ::testing::TestEventListeners& listeners = ::testing::UnitTest::GetInstance()->listeners(); + + if (GlobalV::MY_RANK != 0) { + delete listeners.Release(listeners.default_result_printer()); + } + + int result = RUN_ALL_TESTS(); + MPI_Bcast(&result, 1, MPI_INT, 0, MPI_COMM_WORLD); + + if (GlobalV::MY_RANK == 0 && result != 0) + { + std::cout << "ERROR:some tests are not passed" << std::endl; + } + + MPI_Finalize(); + return result; +} +#endif diff --git a/source/source_io/unittests/test_write_eig_occ.cpp b/source/source_io/unittests/test_write_eig_occ.cpp index a96b5a6a88b..35b90b45d1a 100644 --- a/source/source_io/unittests/test_write_eig_occ.cpp +++ b/source/source_io/unittests/test_write_eig_occ.cpp @@ -44,7 +44,9 @@ TEST_F(IstateInfoTest, OutIstateInfoS1) GlobalV::KPAR = 1; const int nbands = 4; const int nspin = 1; - const std::string out_dir = "./"; + const std::string out_dir = testing::TempDir(); + const std::string fixed_file = out_dir + "eig_occ.txt"; + const std::string step2_file = out_dir + "eig_occg2.txt"; // Mirrors the Input_para default (bndpar = 1) so the test does not depend on it. const int bndpar = 1; @@ -96,27 +98,48 @@ TEST_F(IstateInfoTest, OutIstateInfoS1) } { - std::ofstream stale_file("eig_occ.txt"); + std::ofstream stale_file(fixed_file); stale_file << "stale calculation" << std::endl; } // A new calculation truncates stale output, then later ionic steps append. - ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 0); - ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 1); + ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 0, 1); + ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 1, 1); // check the output files std::ifstream ifs; - ifs.open("eig_occ.txt"); + ifs.open(fixed_file); std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); EXPECT_THAT(str, testing::HasSubstr("Electronic state energy (eV) and occupations")); EXPECT_THAT(str, testing::HasSubstr("spin=1 k-point=1/10 Cartesian=0.0000000 0.0000000 0.0000000 (299 plane wave)")); EXPECT_THAT(str, testing::HasSubstr("1 2.040854700000000 0.000000000000000")); EXPECT_THAT(str, testing::Not(testing::HasSubstr("stale calculation"))); - EXPECT_THAT(str, testing::HasSubstr("1 # ionic step")); - EXPECT_THAT(str, testing::HasSubstr("2 # ionic step")); + EXPECT_THAT(str, testing::HasSubstr("# ABACUS version:")); + EXPECT_THAT(str, testing::HasSubstr("# Written at ")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 1")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 2")); ifs.close(); - remove("eig_occ.txt"); + remove(fixed_file.c_str()); + + // Mode 0: every write truncates the fixed file, so only the last frame remains. + ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 0, 0); + ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 1, 0); + ifs.open(fixed_file); + std::string mode0((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); + EXPECT_THAT(mode0, testing::HasSubstr("# Ionic_Step 2")); + EXPECT_THAT(mode0, testing::Not(testing::HasSubstr("# Ionic_Step 1"))); + ifs.close(); + remove(fixed_file.c_str()); + + // Mode 2: one g{step} file per written step. + ModuleIO::write_eig_file(ekb, wg, *kv, nbands, nspin, out_dir, 1, 2); + ifs.open(step2_file); + ASSERT_TRUE(ifs.is_open()); + std::string mode2((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); + EXPECT_THAT(mode2, testing::HasSubstr("# Ionic_Step 2")); + ifs.close(); + remove(step2_file.c_str()); } #ifdef __MPI diff --git a/source/source_io/unittests/test_write_orb_info.cpp b/source/source_io/unittests/test_write_orb_info.cpp index 2f8d4876dc6..691214adcac 100644 --- a/source/source_io/unittests/test_write_orb_info.cpp +++ b/source/source_io/unittests/test_write_orb_info.cpp @@ -48,7 +48,7 @@ TEST(OrbInfo,WriteOrbInfo) const int nbands = 6; unitcell::read_cell_pseudopots(pp_dir, ofs, *ucell, global_out_dir, dft_functional, lspinorb, pseudo_rcut, soc_lambda); unitcell::cal_nwfc(ofs,*ucell,ucell->atoms, nspin, nlocal, npol, basis_type, esolver_type, init_wfc, nbands); - ModuleIO::write_orb_info(ucell); + ModuleIO::write_orb_info(ucell, ofs); ofs.close(); std::ifstream ifs("nao.txt"); std::string str((std::istreambuf_iterator(ifs)),std::istreambuf_iterator()); diff --git a/source/source_io/unittests/test_write_wfc_nao.cpp b/source/source_io/unittests/test_write_wfc_nao.cpp index 2b2d7a76c37..49c4caf84cf 100644 --- a/source/source_io/unittests/test_write_wfc_nao.cpp +++ b/source/source_io/unittests/test_write_wfc_nao.cpp @@ -180,6 +180,7 @@ class WriteWfcLcaoTest : public testing::Test std::vector ik2iktot = {0,1}; int nkstot = 2; int out_app_flag = 1; + std::ofstream ofs_running; void SetUp() override { @@ -253,7 +254,7 @@ TEST_F(WriteWfcLcaoTest, WriteWfcLcao) psi::Psi my_psi(psi_local_double.data(), nk, nbands_local, nbasis_local, nbasis_local, true); ModuleIO::write_wfc_nao(out_type, out_app_flag, my_psi, ekb, wg, kvec_c, - ik2iktot, nkstot, pv, nspin, istep); + ik2iktot, nkstot, pv, nspin, ofs_running, istep); // check the output file if (GlobalV::MY_RANK == 0) @@ -296,7 +297,7 @@ TEST_F(WriteWfcLcaoTest, WriteWfcLcaoComplex) psi::Psi> my_psi(psi_local_complex.data(), nk, nbands_local, nbasis_local, true); ModuleIO::write_wfc_nao(out_type, out_app_flag, my_psi, ekb, wg, kvec_c, - ik2iktot, nkstot, pv, nspin, istep); + ik2iktot, nkstot, pv, nspin, ofs_running, istep); // check the output file if (GlobalV::MY_RANK == 0) @@ -340,7 +341,7 @@ TEST_F(WriteWfcLcaoTest, WriteWfcLcaoTextHeader) psi::Psi my_psi(psi_local_double.data(), nk, nbands_local, nbasis_local, nbasis_local, true); ModuleIO::write_wfc_nao(out_type, out_app_flag, my_psi, ekb, wg, kvec_c, - ik2iktot, nkstot, pv, nspin, istep); + ik2iktot, nkstot, pv, nspin, ofs_running, istep); if (GlobalV::MY_RANK == 0) { @@ -356,7 +357,7 @@ TEST_F(WriteWfcLcaoTest, WriteWfcLcaoTextHeader) std::getline(file1, first_line); EXPECT_THAT(first_line, testing::HasSubstr("# ABACUS version:")); std::string rest((std::istreambuf_iterator(file1)), std::istreambuf_iterator()); - EXPECT_THAT(rest, testing::HasSubstr("# IONIC STEP 1 (spin up)")); + EXPECT_THAT(rest, testing::HasSubstr("# Ionic_Step 1 (spin up)")); EXPECT_THAT(rest, testing::HasSubstr("(number of bands)")); file1.close(); @@ -439,7 +440,7 @@ TEST(ModuleIOTest, WriteWfcNaoHeader) const std::string header = "# ABACUS version: test\n" "# Written at 2026-01-01 00:00:00\n" - "# IONIC STEP 1 (spin up)\n"; + "# Ionic_Step 1 (spin up)\n"; // Call the function to be tested ModuleIO::wfc_nao_write2file(filename, ctot.data(), TestParameters::sys().nlocal, 0, ekb, wg, false, false, header); @@ -449,7 +450,7 @@ TEST(ModuleIOTest, WriteWfcNaoHeader) std::string str((std::istreambuf_iterator(ifs)), std::istreambuf_iterator()); EXPECT_THAT(str, testing::HasSubstr("# ABACUS version: test\n")); EXPECT_THAT(str, testing::HasSubstr("# Written at 2026-01-01 00:00:00\n")); - EXPECT_THAT(str, testing::HasSubstr("# IONIC STEP 1 (spin up)\n")); + EXPECT_THAT(str, testing::HasSubstr("# Ionic_Step 1 (spin up)\n")); EXPECT_THAT(str, testing::HasSubstr("2 (number of bands)")); EXPECT_THAT(str, testing::HasSubstr("1.00000000e-01 2.00000000e-01")); ifs.close(); diff --git a/source/source_lcao/lcao_set.cpp b/source/source_lcao/lcao_set.cpp index ff3b4eb5d14..b9df9c54c73 100644 --- a/source/source_lcao/lcao_set.cpp +++ b/source/source_lcao/lcao_set.cpp @@ -1,4 +1,7 @@ #include "source_lcao/lcao_set.h" +#include "source_base/global_function.h" +#include "source_base/parallel_common.h" +#include "source_io/module_dm/write_dmk.h" #include "source_io/module_parameter/parameter.h" #include "source_psi/setup_psi.h" // use Setup_Psi #include "source_io/module_wf/read_wfc_nao.h" // use read_wfc_nao @@ -72,6 +75,12 @@ void LCAO_domain::set_pot( //! 1) init local pseudopotentials locpp.init_vloc(ucell, &pw_rho); locpp.print_vloc(ucell, &pw_rho, inp.out_element_info, PARAM.globalv.global_out_dir); + if (inp.out_element_info && GlobalV::MY_RANK == 0) + { + GlobalV::ofs_running << " Write element information to directory: " + << PARAM.globalv.global_out_dir + << " (" << ucell.ntype << " element type(s))" << std::endl; + } //! 2) init potentials if (pelec->pot == nullptr) @@ -163,15 +172,69 @@ void LCAO_domain::init_chg_dm( module_dm::Setup_DM& dmat, const UnitCell& ucell, const Parallel_Orbitals* pv, - Charge* chr) + Charge* chr, + const K_Vectors& kv, + const int istep, + const int out_app_flag, + const std::string& ks_solver) { ModuleBase::TITLE("LCAO_domain", "init_chg_dm"); - // Step 1: Read density matrix from file - LCAO_domain::init_dm_from_file(readin_dir, nspin, dmat, ucell, pv); + const int nspin_dm = (nspin == 2) ? 2 : 1; + bool dmr_found = false; + // Rank 0 probes the DMR files and broadcasts the decision so every rank + // takes the same communication path (DMR distribution vs DM(k) broadcast); + // a rank-local decision could deadlock the two mismatched collectives. + if (GlobalV::MY_RANK == 0) + { + for (int is = 0; is < nspin_dm; ++is) + { + const std::string dmfile = readin_dir + "dmrs" + std::to_string(is + 1) + "_nao.csr"; + std::ifstream ifs(dmfile.c_str()); + if (ifs.good()) + { + dmr_found = true; + break; + } + } + } + Parallel_Common::bcast_bool(dmr_found); + + // Preserve the established DMR restart path. Only when no DMR file exists + // do we interpret init_chg=dm as a request to restart from dense DM(k). + // An incomplete DMR set is not silently replaced by a different format. + if (dmr_found) + { + LCAO_domain::init_dm_from_file(readin_dir, nspin, dmat, ucell, pv); + } + else + { + const int nk = kv.get_nks() / nspin_dm; + const bool column_major = ModuleBase::GlobalFunc::IS_COLUMN_MAJOR_KS_SOLVER(ks_solver); + const std::string dmk_dir = (out_app_flag == 2) ? readin_dir + "MAT/" : readin_dir; + std::vector>& dmk = dmat.dm->get_dmk_vec(); + const bool read_success = ModuleIO::read_dmk(nspin_dm, + nk, + kv, + pv->para_2d(), + column_major, + dmk_dir, + istep, + out_app_flag, + dmk, + GlobalV::ofs_running); + if (!read_success) + { + ModuleBase::WARNING_QUIT( + "LCAO_domain::init_chg_dm", + "Failed to initialize the density: no usable DMR CSR or DM(k) files were found in " + + readin_dir); + } + dmat.dm->cal_dmr(-1); + } - // Step 2: Convert density matrix to charge density - // skip_normalize=true here (loaded DM is already normalized), so omega is unused. + // Convert density matrix to charge density. The loaded DM is already + // normalized, so omega is unused when skip_normalize is true. LCAO_domain::dm2rho(dmat.dm->get_dmr_vec(), nspin, chr, PARAM.inp.nelec, ucell.omega, true); return; @@ -341,14 +404,22 @@ template void LCAO_domain::init_chg_dm( module_dm::Setup_DM& dmat, const UnitCell& ucell, const Parallel_Orbitals* pv, - Charge* chr); + Charge* chr, + const K_Vectors& kv, + const int istep, + const int out_app_flag, + const std::string& ks_solver); template void LCAO_domain::init_chg_dm>( const std::string& readin_dir, const int nspin, module_dm::Setup_DM>& dmat, const UnitCell& ucell, const Parallel_Orbitals* pv, - Charge* chr); + Charge* chr, + const K_Vectors& kv, + const int istep, + const int out_app_flag, + const std::string& ks_solver); template void LCAO_domain::init_hr_from_file( const std::string hrfile, diff --git a/source/source_lcao/lcao_set.h b/source/source_lcao/lcao_set.h index 8707156f1d1..0982d76f93b 100644 --- a/source/source_lcao/lcao_set.h +++ b/source/source_lcao/lcao_set.h @@ -79,6 +79,10 @@ void init_dm_from_file( * @param ucell unit cell * @param pv parallel orbitals * @param chr charge density object + * @param kv k-point metadata used to locate and validate DM(k) files + * @param istep ionic step of the DM(k) record to read + * @param out_app_flag output mode used by the run that wrote DM(k) + * @param ks_solver solver that determines the destination DM(k) storage order */ template void init_chg_dm( @@ -87,7 +91,11 @@ void init_chg_dm( module_dm::Setup_DM& dmat, const UnitCell& ucell, const Parallel_Orbitals* pv, - Charge* chr); + Charge* chr, + const K_Vectors& kv, + const int istep, + const int out_app_flag, + const std::string& ks_solver); /** * @brief read in HR from file, and save it into hmat diff --git a/source/source_lcao/module_deepks/test/CMakeLists.txt b/source/source_lcao/module_deepks/test/CMakeLists.txt index dc2d545c4db..7cc166c5bb3 100644 --- a/source/source_lcao/module_deepks/test/CMakeLists.txt +++ b/source/source_lcao/module_deepks/test/CMakeLists.txt @@ -38,6 +38,7 @@ set(DEEPKS_UNIT_COMMON_SOURCES ../../../source_cell/sep_cell.cpp ../../../source_cell/soc.cpp ../../../source_cell/read_pp_ucell.cpp + ../../../source_cell/ucell_io.cpp ../../../source_estate/param_update.cpp ../../../source_cell/cal_wfc.cpp ../../../source_cell/read_orb.cpp diff --git a/source/source_lcao/module_lr/test/CMakeLists.txt b/source/source_lcao/module_lr/test/CMakeLists.txt index c6180ff87ed..9bcc49191ca 100644 --- a/source/source_lcao/module_lr/test/CMakeLists.txt +++ b/source/source_lcao/module_lr/test/CMakeLists.txt @@ -112,6 +112,7 @@ set(lr_dm_test_sources ../../spar_hsr.cpp ../../../source_io/module_hs/hs_sparse_io.cpp ../../../source_io/module_hs/lat_r_csr.cpp + ../../../source_cell/ucell_io.cpp ../../../source_estate/module_dm/density_matrix.cpp ../../../source_estate/module_dm/dmr_gamma.cpp ../../../source_estate/module_dm/dmr_init.cpp diff --git a/source/source_lcao/module_lr/test/test_lr_util.cpp b/source/source_lcao/module_lr/test/test_lr_util.cpp index 7814d15c451..074f804ea61 100644 --- a/source/source_lcao/module_lr/test/test_lr_util.cpp +++ b/source/source_lcao/module_lr/test/test_lr_util.cpp @@ -238,7 +238,7 @@ TEST_F(LRDMTest, SparseWriterKeepsSpinFilesAndDisjointRankKeys) std::string line; std::getline(input, line); // Header step is one-based per governance rule 22 (writer receives istep = 0). - EXPECT_EQ(line, "STEP: 1"); + EXPECT_EQ(line.compare(0, 12, "Ionic_Step 1"), 0); std::getline(input, line); EXPECT_EQ(line, "Matrix Dimension of EDM(R): " + std::to_string(dimension)); std::getline(input, line); diff --git a/source/source_lcao/module_operator_lcao/overlap.cpp b/source/source_lcao/module_operator_lcao/overlap.cpp index 54a4c04d5b9..07bcf9f859f 100644 --- a/source/source_lcao/module_operator_lcao/overlap.cpp +++ b/source/source_lcao/module_operator_lcao/overlap.cpp @@ -424,7 +424,7 @@ void Overlap>::output_SR_async_csr(const int istep, } // Write header information - ofs << "IONIC_STEP: " << istep + 1 << std::endl; + ofs << "Ionic_Step " << istep + 1 << std::endl; ofs << "Matrix Dimension of S_async(R): " << SR_async_serial.get_nbasis() << std::endl; ofs << "Matrix number of S_async(R): " << SR_async_serial.size_R_loop() << std::endl; diff --git a/source/source_lcao/module_rt/test/CMakeLists.txt b/source/source_lcao/module_rt/test/CMakeLists.txt index fc4221ca0eb..27c7fac1d4e 100644 --- a/source/source_lcao/module_rt/test/CMakeLists.txt +++ b/source/source_lcao/module_rt/test/CMakeLists.txt @@ -94,6 +94,7 @@ addtest( ../../../source_cell/read_pp_upf100.cpp ../../../source_cell/read_pp_vwr.cpp ../../../source_cell/read_pp_blps.cpp + ../../../source_cell/ucell_io.cpp ../../../source_io/module_hs/pos_op_mat.cpp ../../../source_io/module_hs/pos_op_basis.cpp ../../../source_io/module_hs/pos_op_calc.cpp diff --git a/source/source_main/driver.cpp b/source/source_main/driver.cpp index 37bd67189b4..036d70abe9f 100644 --- a/source/source_main/driver.cpp +++ b/source/source_main/driver.cpp @@ -7,6 +7,7 @@ #include "source_io/module_json/para_json.h" #include "source_io/module_output/cal_test.h" #include "source_io/module_output/print_info.h" +#include "source_io/module_output/write_notice.h" #include "source_io/module_parameter/input_conv.h" #include "source_io/module_parameter/parameter.h" #include "source_io/module_parameter/read_input.h" @@ -147,6 +148,10 @@ void Driver::reading(const ModuleIO::CommandLineArgs& cli) const std::string input_name = cli.input_file.substr(cli.input_file.find_last_of("/\\") + 1); ss1 << PARAM.globalv.global_out_dir << input_name << ".info"; input.write_parameters(PARAM, ss1.str()); + if (GlobalV::MY_RANK == 0) + { + ModuleIO::write_notice(GlobalV::ofs_running, "Input parameters", ss1.str()); + } // (*temp*) copy the variables from INPUT to each class Input_Conv::Convert(); diff --git a/source/source_md/md_base.cpp b/source/source_md/md_base.cpp index 36791d7c39f..2abe85fce3d 100644 --- a/source/source_md/md_base.cpp +++ b/source/source_md/md_base.cpp @@ -1,5 +1,6 @@ #include "md_base.h" #include "md_func.h" +#include "run_md.h" #include "source_base/parallel_cell.h" #include "source_cell/unitcell.h" #include "source_io/module_output/print_info.h" @@ -72,6 +73,15 @@ void MD_base::setup(ModuleESolver::ESolver* p_esolver, const std::string& global // must not advance the charge-extrapolation history -- even on restart // (step_rst_ > 0), where the extrapolation state starts degenerate. const bool positions_updated = false; + // step_rst_ is only known after restart(), so re-evaluate the final-step + // flag here: the initial (restarted) force evaluation can itself be the + // last ionic step of the run. + const int global_step = step_ + step_rst_; + const bool is_final_step = Run_MD::is_last_step(global_step, mdp.md_nstep); + if (mdcell.has_backing_unitcell()) + { + mdcell.backing_unitcell().last_ion_step = is_final_step; + } MD_func::force_virial(p_esolver, step_, positions_updated, mdcell, decomp, potential, cal_stress, virial); MD_func::compute_stress(mdcell, cal_stress, virial, stress); if (mdcell.has_backing_unitcell()) diff --git a/source/source_md/run_md.cpp b/source/source_md/run_md.cpp index a68bb8fa6f8..b43aae65158 100644 --- a/source/source_md/run_md.cpp +++ b/source/source_md/run_md.cpp @@ -34,24 +34,6 @@ namespace Run_MD { -bool is_cadence_step(const int current_step, const int freq) -{ - return freq > 0 && current_step % freq == 0; -} - -bool is_frame_write_step(const int current_step, - const int out_freq_ion, - const int md_restartfreq, - const bool out_stru) -{ - const int eff_output_freq = (out_freq_ion > 0) ? out_freq_ion : md_restartfreq; - const bool do_output_step = is_cadence_step(current_step, eff_output_freq); - const bool do_restart_step = is_cadence_step(current_step, md_restartfreq); - const bool want_output_frame = do_output_step && out_stru; - const bool want_checkpoint_frame = do_restart_step; - return want_output_frame || want_checkpoint_frame; -} - void prepare_mdcell(MDCell& mdcell, const Parameter& param_in, DomainDecomposition& decomp) { const Input_para& input = param_in.inp; @@ -208,10 +190,57 @@ void md_line(MDCell& mdcell, } } + /// Write one STRU frame for `current_step`. Cadence frames and the final + /// frame share the same naming/append rules, so both call sites use this + /// lambda. `current_step == 0` marks the first frame of a fresh run, which + /// truncates the fixed-name file instead of appending to it. + auto write_stru_frame = [&](const int current_step) { + if (mdcell.has_backing_unitcell()) + { + const bool positions_updated = false; + mdcell.sync_backing_unitcell(positions_updated); + } + // Mode-2 STRUC/ subdirectory is created lazily at write time. + ModuleBase::ensure_directory(stru_out_dir); + const int stru_step = current_step + 1; + // File-name selection and append/truncate are two independent + // decisions. The file name is fixed to "STRU" whenever mode 1 + // accumulation is allowed (and no legacy STRU/ directory is in + // the way); modes 0/2 keep the numbered STRU{stru_step} files. + // Whether to append depends on whether this is the very first + // step of a fresh (non-restart) run: a fresh first frame + // truncates the fixed-name file so it does not keep frames + // from a previous run, while later steps and restarted runs + // append one frame each, introduced by a one-based + // "# MD step N" comment line. + const bool use_fixed_name = append_stru_allowed && !has_legacy_stru_dir; + const bool is_first_step_of_fresh_run = (current_step == 0); + const bool append_stru = use_fixed_name && !is_first_step_of_fresh_run; + const std::string frame_comment = use_fixed_name + ? "# MD step " + std::to_string(stru_step) + "\n\n" + : ""; + std::stringstream file; + file << stru_out_dir << "STRU"; + if (!use_fixed_name) + { + file << stru_step; + } + mdcell::print_stru_file(mdcell, mdcell.stru_meta(), file.str(), frame_comment, append_stru); + }; + /// md cycle, mohan update 2026-01-04, change '<=' to '<' + int last_processed_step = -1; while ((mdrun->step_ + mdrun->step_rst_) < param_in.mdp.md_nstep && !mdrun->stop) { const int md_step = mdrun->step_ + mdrun->step_rst_; + /// Mark the final ionic step on the cell passed to the solver. The + /// output module then writes the final snapshot even when this step is + /// off the out_freq_ion cadence or its SCF did not converge. + const bool is_final_step = is_last_step(md_step, param_in.mdp.md_nstep); + if (mdcell.has_backing_unitcell()) + { + mdcell.backing_unitcell().last_ion_step = is_final_step; + } bool print_thermo = param_in.mdp.md_thermo_freq > 0 && md_step % param_in.mdp.md_thermo_freq == 0; #ifdef __JSON @@ -343,38 +372,9 @@ void md_line(MDCell& mdcell, /// formal predicate behind write_any_frame. if (write_any_frame) { - if (mdcell.has_backing_unitcell()) - { - const bool positions_updated = false; - mdcell.sync_backing_unitcell(positions_updated); - } - // Mode-2 STRUC/ subdirectory is created lazily at write time. - ModuleBase::ensure_directory(stru_out_dir); - const int stru_step = current_step + 1; - // File-name selection and append/truncate are two independent - // decisions. The file name is fixed to "STRU" whenever mode 1 - // accumulation is allowed (and no legacy STRU/ directory is in - // the way); modes 0/2 keep the numbered STRU{stru_step} files. - // Whether to append depends on whether this is the very first - // step of a fresh (non-restart) run: a fresh first frame - // truncates the fixed-name file so it does not keep frames - // from a previous run, while later steps and restarted runs - // append one frame each, introduced by a one-based - // "# MD step N" comment line. - const bool use_fixed_name = append_stru_allowed && !has_legacy_stru_dir; - const bool is_first_step_of_fresh_run = (mdrun->step_ == 0) && (mdrun->step_rst_ == 0); - const bool append_stru = use_fixed_name && !is_first_step_of_fresh_run; - const std::string frame_comment = use_fixed_name - ? "# MD step " + std::to_string(stru_step) + "\n\n" - : ""; - std::stringstream file; - file << stru_out_dir << "STRU"; - if (!use_fixed_name) - { - file << stru_step; - } - mdcell::print_stru_file(mdcell, mdcell.stru_meta(), file.str(), frame_comment, append_stru); + write_stru_frame(current_step); } + last_processed_step = current_step; /// Restart files follow md_restartfreq independently of the output /// cadence, so setting out_freq_ion does not suppress or re-aim @@ -388,6 +388,21 @@ void md_line(MDCell& mdcell, mdrun->step_++; } + /// Supplementary final frame. When the last step is off both the output + /// and the restart cadences the loop above never writes its STRU, so write + /// it here to guarantee the final geometry is persisted. Steps already + /// covered by a cadence are not written twice. out_stru=0 keeps the + /// existing contract of silencing regular per-step geometry output, so the + /// final frame is skipped as well. + if (last_processed_step >= 0 && param_in.inp.out_stru > 0 + && !is_frame_write_step(last_processed_step, + param_in.inp.out_freq_ion, + restart_freq, + true)) + { + write_stru_frame(last_processed_step); + } + /// flush the COLVAR and other PLUMED output files plumed.finalize(); diff --git a/source/source_md/run_md.h b/source/source_md/run_md.h index 07257dff2f4..07b2856a346 100644 --- a/source/source_md/run_md.h +++ b/source/source_md/run_md.h @@ -21,7 +21,10 @@ namespace Run_MD /// fire at `current_step`. A frequency <= 0 disables the action (never /// fires). Keeping output and restart cadences behind this predicate makes /// their independence directly unit-testable. -bool is_cadence_step(int current_step, int freq); +inline bool is_cadence_step(const int current_step, const int freq) +{ + return freq > 0 && current_step % freq == 0; +} /// Returns true when the MD loop should write a STRU frame at /// `current_step`. A frame is produced on every md_restartfreq step (so @@ -30,7 +33,27 @@ bool is_cadence_step(int current_step, int freq); /// frequency follows out_freq_ion with md_restartfreq fallback, matching /// md_line(). This predicate exists so the "checkpoint frame tracks /// Restart_md.txt" invariant stays unit-testable. -bool is_frame_write_step(int current_step, int out_freq_ion, int md_restartfreq, bool out_stru); +inline bool is_frame_write_step(const int current_step, + const int out_freq_ion, + const int md_restartfreq, + const bool out_stru) +{ + const int eff_output_freq = (out_freq_ion > 0) ? out_freq_ion : md_restartfreq; + const bool do_output_step = is_cadence_step(current_step, eff_output_freq); + const bool do_restart_step = is_cadence_step(current_step, md_restartfreq); + const bool want_output_frame = do_output_step && out_stru; + const bool want_checkpoint_frame = do_restart_step; + return want_output_frame || want_checkpoint_frame; +} + +/// Returns true when `current_step` is the final ionic step of the run. +/// current_step is the global step (local step + restart offset); md_nstep is +/// the global step count, so the last processed step is md_nstep - 1. The +/// final step is always written even if it does not sit on the output cadence. +inline bool is_last_step(const int current_step, const int md_nstep) +{ + return md_nstep > 0 && current_step == md_nstep - 1; +} void prepare_mdcell(MDCell& mdcell, const Parameter& param_in, DomainDecomposition& decomp); diff --git a/source/source_md/unittests/CMakeLists.txt b/source/source_md/unittests/CMakeLists.txt index 1b2682da608..9f9e3f962b8 100644 --- a/source/source_md/unittests/CMakeLists.txt +++ b/source/source_md/unittests/CMakeLists.txt @@ -207,6 +207,11 @@ addtest( LIBS parameter psi device SOURCES test_langevin.cpp ../md_base.cpp ../langevin.cpp ${depend_files}) +# Header-only MD loop predicates (is_last_step / is_frame_write_step). +addtest( + TARGET MODULE_MD_final_step + SOURCES test_run_md.cpp) + if(ENABLE_MPI) addtest( TARGET MODULE_MD_lj_forcefield_mpi diff --git a/source/source_md/unittests/test_run_md.cpp b/source/source_md/unittests/test_run_md.cpp index db4c13f5cad..6bc52faac9b 100644 --- a/source/source_md/unittests/test_run_md.cpp +++ b/source/source_md/unittests/test_run_md.cpp @@ -220,3 +220,47 @@ TEST(RunMDCadenceTest, no_frame_when_all_frequencies_disabled) // output frame, no checkpoint frame either EXPECT_FALSE(Run_MD::is_frame_write_step(3, 3, 0, false)); } + +// --- Final step predicate tests (local additions to upstream's consolidate) --- + +namespace +{ + +/** + * @brief The global step (local step + restart offset) md_nstep - 1 is the + * only ionic step that counts as final, so the output layer can always + * persist the final snapshot. + */ +TEST(RunMdFinalStepTest, IdentifiesTheFinalIonicStep) +{ + EXPECT_FALSE(Run_MD::is_last_step(0, 4)); + EXPECT_FALSE(Run_MD::is_last_step(2, 4)); + EXPECT_TRUE(Run_MD::is_last_step(3, 4)); + // Restart: continue from step 5 up to md_nstep=6; local step 1 is final. + EXPECT_TRUE(Run_MD::is_last_step(5, 6)); + // Single-step run. + EXPECT_TRUE(Run_MD::is_last_step(0, 1)); + // Invalid input never yields a final step. + EXPECT_FALSE(Run_MD::is_last_step(0, 0)); +} + +/** + * @brief The supplementary final frame must not duplicate a frame that the + * MD loop already wrote on the output or restart cadence. + */ +TEST(RunMdFinalStepTest, SupplementaryFinalFrameSkipsStepsAlreadyOnCadence) +{ + // Final step off the output cadence: the loop skips it, a frame is needed. + EXPECT_FALSE(Run_MD::is_frame_write_step(3, 2, 0, true)); + // Final step on the output cadence: already written by the loop. + EXPECT_TRUE(Run_MD::is_frame_write_step(4, 2, 0, true)); + // Final step on the restart cadence: already written by the loop. + EXPECT_TRUE(Run_MD::is_frame_write_step(4, 2, 4, true)); + // md_nstep=1: step 0 is final and is inherently a cadence step. + EXPECT_TRUE(Run_MD::is_last_step(0, 1)); + EXPECT_TRUE(Run_MD::is_frame_write_step(0, 2, 0, true)); + // Both frequencies disabled: the loop writes nothing, a final frame is needed. + EXPECT_FALSE(Run_MD::is_frame_write_step(0, 0, 0, true)); +} + +} // namespace diff --git a/source/source_pw/module_pwdft/dftu_base_io.cpp b/source/source_pw/module_pwdft/dftu_base_io.cpp index 3b44e83820b..c0d44feb7f9 100644 --- a/source/source_pw/module_pwdft/dftu_base_io.cpp +++ b/source/source_pw/module_pwdft/dftu_base_io.cpp @@ -35,7 +35,7 @@ static void write_provenance_header(std::ostream& os, const int istep) std::strftime(time_buf, sizeof(time_buf), "%Y-%m-%d %H:%M:%S", &tm_local); os << "# ABACUS version: " << VERSION << "\n"; os << "# Written at " << time_buf << "\n"; - os << "# RELAX STEP " << istep + 1 << "\n\n"; + os << "# Ionic_Step " << istep + 1 << "\n\n"; } static void validate_output_configuration(const char* context, diff --git a/source/source_pw/module_pwdft/pw_hybrid_nscf.cpp b/source/source_pw/module_pwdft/pw_hybrid_nscf.cpp index 3969f78d579..24f7fdf7ce1 100644 --- a/source/source_pw/module_pwdft/pw_hybrid_nscf.cpp +++ b/source/source_pw/module_pwdft/pw_hybrid_nscf.cpp @@ -226,12 +226,22 @@ void prepare_exx_nscf(const Input_para& inp, warn_source_configuration(inp, readin_dir); const int spin_mult = inp.nspin == 2 ? 2 : 1; const std::vector first_index(1, 0); - const std::string first_filename = ModuleIO::filename_output(readin_dir, "wf", "pw", 0, - first_index, inp.nspin, spin_mult, 2, false, false, -1); + // Mode-2 output splits the source across the flat directory (eig_occ) and + // PSI/ (wavefunctions), and appends g{step}/e{iter}. Resolve the latest + // written step so SCF outputs can feed the hybrid NSCF without renaming. + const std::vector wfc_directories = {readin_dir, readin_dir + "PSI/"}; + const std::vector eig_occ_directories(1, readin_dir); + const auto resolve_wfc = [&](const int iq, const std::vector& ik2iktot, const int nkstot) + { + const std::string fixed_name = ModuleIO::filename_output("", "wf", "pw", iq, + ik2iktot, inp.nspin, nkstot, 2, false, false, -1); + return resolve_source_file(wfc_directories, fixed_name, "_pw.dat", true); + }; std::vector headers; try { - std::ifstream first(first_filename, std::ios::binary); + const std::string first_filename = resolve_wfc(0, first_index, spin_mult); + std::ifstream first(first_filename.c_str(), std::ios::binary); const auto header = read_exx_source_header(first); const int nks = header.nks; if (nks % spin_mult != 0) @@ -256,8 +266,7 @@ void prepare_exx_nscf(const Input_para& inp, const ModuleBase::Matrix3 inverse_reciprocal = ucell.G.Inverse(); for (int iq = 0; iq < nks; ++iq) { - const std::string filename = ModuleIO::filename_output(readin_dir, "wf", "pw", iq, - source_points->ik2iktot, inp.nspin, nks, 2, false, false, -1); + const std::string filename = resolve_wfc(iq, source_points->ik2iktot, nks); std::ifstream in(filename, std::ios::binary); const auto metadata = read_exx_source_header(in); if (metadata.ecutwfc != inp.ecutwfc) @@ -273,7 +282,9 @@ void prepare_exx_nscf(const Input_para& inp, source_points->wk[iq] = metadata.weight; source_points->isk[iq] = iq / nq; } - std::ifstream occupations(readin_dir + "eig_occ.txt"); + const std::string occupations_filename = resolve_source_file( + eig_occ_directories, "eig_occ.txt", ".txt", false); + std::ifstream occupations(occupations_filename.c_str()); read_exx_source_occupations(occupations, headers, inp.nspin, source_weights); } catch (const std::exception& error) @@ -309,8 +320,7 @@ void prepare_exx_nscf(const Input_para& inp, new psi::Psi(nqs, nbands, nbasis, source_points->ngk, true)); for (int iq = 0; iq < nqs; ++iq) { - const std::string wfc_filename = ModuleIO::filename_output(readin_dir, "wf", "pw", iq, - source_points->ik2iktot, inp.nspin, nqs, 2, false, false, -1); + const std::string wfc_filename = resolve_wfc(iq, source_points->ik2iktot, nqs); try { validate_source_grid(wfc_filename, *source_basis, iq); diff --git a/source/source_pw/module_pwdft/pw_hybrid_source.cpp b/source/source_pw/module_pwdft/pw_hybrid_source.cpp index 138c87392f9..37ae5a6f667 100644 --- a/source/source_pw/module_pwdft/pw_hybrid_source.cpp +++ b/source/source_pw/module_pwdft/pw_hybrid_source.cpp @@ -3,11 +3,15 @@ #include "source_base/matrix.h" #include +#include #include #include +#include +#include #include #include #include +#include namespace { @@ -86,11 +90,23 @@ void pw::read_exx_source_occupations(std::istream& in, throw std::runtime_error("Invalid EXX source occupation dimensions"); } std::string line; - std::getline(in, line); - std::getline(in, line); - std::getline(in, line); int saved_spin = 0; - if (std::sscanf(line.c_str(), " Spin number %d", &saved_spin) != 1 || saved_spin != nspin) + bool spin_found = false; + // The header may carry provenance comments and the ionic-step marker before + // the "Spin number" line, so scan until the spin line is located. + while (std::getline(in, line)) + { + if (std::sscanf(line.c_str(), " Spin number %d", &saved_spin) == 1) + { + spin_found = true; + break; + } + if (line.find(" spin=") != std::string::npos) + { + break; + } + } + if (!spin_found || saved_spin != nspin) { throw std::runtime_error("Missing or incompatible EXX source eig_occ.txt"); } @@ -166,3 +182,167 @@ void pw::read_exx_source_occupations(std::istream& in, throw std::runtime_error("Unexpected trailing EXX source eig_occ.txt data; use a single SCF snapshot"); } } + +namespace +{ +/** + * @brief Parse the optional "g{step}" and "e{iter}" tokens between the file + * stem and the fixed suffix. + * @param tokens Candidate token string, e.g. "g2" or "g2e17". + * @param ionic_step Parsed one-based ionic step, or -1. + * @param electronic_step Parsed one-based electronic iteration, or -1. + * @return True when the token string is a valid g/e combination. + */ +bool parse_step_tokens(const std::string& tokens, int& ionic_step, int& electronic_step) +{ + ionic_step = -1; + electronic_step = -1; + if (tokens.empty() || tokens[0] != 'g') + { + return false; + } + size_t position = 1; + const size_t ionic_begin = position; + while (position < tokens.size() + && std::isdigit(static_cast(tokens[position])) != 0) + { + ++position; + } + if (position == ionic_begin) + { + return false; + } + ionic_step = std::stoi(tokens.substr(ionic_begin, position - ionic_begin)); + if (position == tokens.size()) + { + return true; + } + if (tokens[position] != 'e') + { + return false; + } + ++position; + const size_t electronic_begin = position; + while (position < tokens.size() + && std::isdigit(static_cast(tokens[position])) != 0) + { + ++position; + } + if (position == electronic_begin || position != tokens.size()) + { + return false; + } + electronic_step = std::stoi(tokens.substr(electronic_begin, position - electronic_begin)); + return true; +} + +/** + * @brief Find one source file inside a single directory. + * @return Full path, or an empty string when no candidate exists. + */ +std::string find_in_directory(const std::string& directory, + const std::string& fixed_name, + const std::string& tail, + const bool allow_electronic_suffix) +{ + const std::string fixed_path = directory + fixed_name; + std::ifstream fixed_stream(fixed_path.c_str(), std::ios::binary); + if (fixed_stream.is_open()) + { + return fixed_path; + } + + const std::string stem = fixed_name.substr(0, fixed_name.size() - tail.size()); + DIR* directory_stream = opendir(directory.c_str()); + if (directory_stream == nullptr) + { + return std::string(); + } + + std::string best_name; + int best_ionic_step = -1; + int best_electronic_step = -1; + while (const dirent* entry = readdir(directory_stream)) + { + const std::string name(entry->d_name); + const size_t minimum_size = stem.size() + tail.size() + 2; // at least "g1" + if (name.size() < minimum_size) + { + continue; + } + if (name.compare(0, stem.size(), stem) != 0) + { + continue; + } + if (name.compare(name.size() - tail.size(), tail.size(), tail) != 0) + { + continue; + } + const std::string tokens = name.substr(stem.size(), + name.size() - stem.size() - tail.size()); + int ionic_step = -1; + int electronic_step = -1; + if (!parse_step_tokens(tokens, ionic_step, electronic_step)) + { + continue; + } + if (ionic_step < 1) + { + continue; + } + if (!allow_electronic_suffix && electronic_step >= 0) + { + continue; + } + if (ionic_step > best_ionic_step + || (ionic_step == best_ionic_step && electronic_step > best_electronic_step)) + { + best_ionic_step = ionic_step; + best_electronic_step = electronic_step; + best_name = name; + } + } + closedir(directory_stream); + + if (best_name.empty()) + { + return std::string(); + } + return directory + best_name; +} +} // namespace + +std::string pw::resolve_source_file(const std::vector& directories, + const std::string& fixed_name, + const std::string& tail, + const bool allow_electronic_suffix) +{ + if (directories.empty() || fixed_name.empty() || tail.empty()) + { + throw std::runtime_error("Invalid EXX source file request"); + } + if (fixed_name.size() <= tail.size() + || fixed_name.compare(fixed_name.size() - tail.size(), tail.size(), tail) != 0) + { + throw std::runtime_error("EXX source fixed name does not end with the expected suffix"); + } + + for (const auto& directory : directories) + { + if (directory.empty()) + { + continue; + } + const std::string found = find_in_directory(directory, + fixed_name, + tail, + allow_electronic_suffix); + if (!found.empty()) + { + return found; + } + } + + throw std::runtime_error("Missing or incompatible EXX source file: " + fixed_name + + " (expected the fixed name or a g{step} variant)"); +} diff --git a/source/source_pw/module_pwdft/pw_hybrid_source.h b/source/source_pw/module_pwdft/pw_hybrid_source.h index 786730d7de3..82ac20f5006 100644 --- a/source/source_pw/module_pwdft/pw_hybrid_source.h +++ b/source/source_pw/module_pwdft/pw_hybrid_source.h @@ -2,6 +2,7 @@ #define PW_HYBRID_SOURCE_H #include +#include #include namespace ModuleBase @@ -33,5 +34,25 @@ void read_exx_source_occupations(std::istream& in, int nspin, ModuleBase::matrix& weights); +/** + * @brief Locate the EXX source file written by the latest output step. + * @details The fixed file name is preferred (modes 0 and 1). When it does not + * exist, the highest g{ionic step} variant is selected, and within + * that step the highest e{electronic iteration} variant. This is the + * rule used for mode-2 output directories, where every ionic step + * gets its own file. + * @param directories Candidate directories, tried in order. + * @param fixed_name File name without the directory, e.g. "wfk1s1_pw.dat". + * @param tail Fixed suffix that follows the optional step tokens, e.g. + * "_pw.dat" or ".txt". + * @param allow_electronic_suffix Whether g{step}e{iter} names are accepted. + * @return Full path of the selected file. + * @throws std::runtime_error When no candidate exists. + */ +std::string resolve_source_file(const std::vector& directories, + const std::string& fixed_name, + const std::string& tail, + const bool allow_electronic_suffix); + } #endif diff --git a/source/source_pw/module_pwdft/unittests/test_pw_hybrid_source.cpp b/source/source_pw/module_pwdft/unittests/test_pw_hybrid_source.cpp index 3e92154f820..11910de5d84 100644 --- a/source/source_pw/module_pwdft/unittests/test_pw_hybrid_source.cpp +++ b/source/source_pw/module_pwdft/unittests/test_pw_hybrid_source.cpp @@ -3,6 +3,8 @@ #include "gtest/gtest.h" +#include +#include #include #include #include @@ -31,7 +33,8 @@ std::string eig_occ(int nspin) { const auto headers = source_headers(nspin); std::ostringstream out; - out << "1 # ionic step\n Electronic state energy (eV) and occupations\n Spin number " << nspin << '\n'; + out << "# ABACUS version: test\n# Written at 2026-01-01 00:00:00\n# Ionic_Step 1\n" + << " Electronic state energy (eV) and occupations\n Spin number " << nspin << '\n'; for (int iq = 0; iq < headers.size(); ++iq) { const auto& header = headers[iq]; @@ -145,3 +148,83 @@ TEST(PWHybridSource, ReadsExistingBinaryWavefunctionHeader) std::istringstream invalid(saved, std::ios::binary); EXPECT_THROW(pw::read_exx_source_header(invalid), std::runtime_error); } + +namespace +{ +/** + * @brief Create an empty placeholder file for a resolver test. + */ +void touch(const std::string& path) +{ + std::ofstream out(path.c_str(), std::ios::binary); + out << "source"; +} + +/** + * @brief Resolve a name inside the gtest temporary directory. + */ +std::string temp_path(const std::string& name) +{ + return testing::TempDir() + name; +} +} // namespace + +TEST(PWHybridSource, ResolverPrefersFixedName) +{ + const std::string fixed = temp_path("resolver_fixed.txt"); + const std::string numbered = temp_path("resolver_fixedg2.txt"); + touch(fixed); + touch(numbered); + const std::vector directories(1, testing::TempDir()); + EXPECT_EQ(pw::resolve_source_file(directories, "resolver_fixed.txt", ".txt", false), fixed); + std::remove(fixed.c_str()); + std::remove(numbered.c_str()); +} + +TEST(PWHybridSource, ResolverSelectsLatestIonicStep) +{ + const std::vector directories(1, testing::TempDir()); + const std::string g1 = temp_path("resolver_stepg1.txt"); + const std::string g3 = temp_path("resolver_stepg3.txt"); + touch(g3); + touch(g1); + EXPECT_EQ(pw::resolve_source_file(directories, "resolver_step.txt", ".txt", false), g3); + std::remove(g1.c_str()); + std::remove(g3.c_str()); +} + +TEST(PWHybridSource, ResolverSelectsLatestElectronicStepWithinLatestIonicStep) +{ + const std::vector directories(1, testing::TempDir()); + const std::string g1e7 = temp_path("resolver_wfg1e7_pw.dat"); + const std::string g2e3 = temp_path("resolver_wfg2e3_pw.dat"); + const std::string g2e5 = temp_path("resolver_wfg2e5_pw.dat"); + touch(g1e7); + touch(g2e3); + touch(g2e5); + EXPECT_EQ(pw::resolve_source_file(directories, "resolver_wf_pw.dat", "_pw.dat", true), g2e5); + std::remove(g1e7.c_str()); + std::remove(g2e3.c_str()); + std::remove(g2e5.c_str()); +} + +TEST(PWHybridSource, ResolverFallsBackToTheSecondDirectory) +{ + const std::vector directories = {temp_path("resolver_absent/"), testing::TempDir()}; + const std::string g1 = temp_path("resolver_psig1.txt"); + touch(g1); + EXPECT_EQ(pw::resolve_source_file(directories, "resolver_psi.txt", ".txt", false), g1); + std::remove(g1.c_str()); +} + +TEST(PWHybridSource, ResolverRejectsMissingAndElectronicSuffixWhenDisallowed) +{ + const std::vector directories(1, testing::TempDir()); + EXPECT_THROW(pw::resolve_source_file(directories, "resolver_missing.txt", ".txt", false), + std::runtime_error); + const std::string electronic = temp_path("resolver_occeig_occg1e2.txt"); + touch(electronic); + EXPECT_THROW(pw::resolve_source_file(directories, "resolver_occeig_occ.txt", ".txt", false), + std::runtime_error); + std::remove(electronic.c_str()); +} diff --git a/source/source_relax/relax_driver.cpp b/source/source_relax/relax_driver.cpp index a8f13286875..173621a58e8 100644 --- a/source/source_relax/relax_driver.cpp +++ b/source/source_relax/relax_driver.cpp @@ -10,6 +10,7 @@ #include "source_io/module_json/output_info.h" #include "source_io/module_output/output_log.h" #include "source_io/module_output/print_info.h" +#include "source_io/module_output/write_notice.h" #include "source_io/module_parameter/parameter.h" void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver, @@ -66,7 +67,7 @@ void Relax_Driver::relax_driver(ModuleESolver::ESolver* p_esolver, this->iter_info(steps, inp); this->esolve(steps[0], p_esolver, ucell, inp, force, stress, etot); geometry_evaluated = true; - this->stru_out(steps[0], ucell, inp, etot, stress, force); + this->stru_out(steps[0], ucell, inp, etot, stress, force, ofs_running); this->json_out(p_esolver, ucell, inp, force, stress); if (ModuleIO::read_exit_file(my_rank_, "EXIT", ofs_running)) @@ -225,7 +226,8 @@ void Relax_Driver::stru_out(const int istep, const Input_para& inp, const double etot, const ModuleBase::matrix& stress, - const ModuleBase::matrix& force) + const ModuleBase::matrix& force, + std::ofstream& ofs_running) { // out_stru is effective for scf/nscf/relax/cell-relax; md handles STRU output in run_md.cpp if (inp.calculation != "relax" && inp.calculation != "cell-relax" && inp.calculation != "scf" @@ -268,6 +270,10 @@ void Relax_Driver::stru_out(const int istep, my_rank_, inp.cal_force, false); + if (my_rank_ == 0) + { + ModuleIO::write_notice(ofs_running, "Structure at current step", now_file); + } } // Numbered files per out_freq_ion: only meaningful for relaxation calculations @@ -291,6 +297,10 @@ void Relax_Driver::stru_out(const int istep, my_rank_, inp.cal_force, append_stru); + if (my_rank_ == 0) + { + ModuleIO::write_notice(ofs_running, "Structure at current step", step_file); + } } } @@ -352,6 +362,10 @@ void Relax_Driver::final_out(const int istep, my_rank_, write_force, false); + if (my_rank_ == 0) + { + ModuleIO::write_notice(ofs_running, "Final structure", final_file); + } } if (stop_reason == RelaxStopReason::MaxSteps) diff --git a/source/source_relax/relax_driver.h b/source/source_relax/relax_driver.h index 34540f00b7f..5dde0d8b6b1 100644 --- a/source/source_relax/relax_driver.h +++ b/source/source_relax/relax_driver.h @@ -130,13 +130,15 @@ class Relax_Driver * @param inp Input parameters for the calculation. * @param etot Total energy in Ry corresponding to this structure. * @param stress Stress matrix (3x3) in Ry/Bohr^3 corresponding to this structure. + * @param ofs_running Running log shared with the relaxation driver. */ void stru_out(const int istep, UnitCell& ucell, const Input_para& inp, const double etot, const ModuleBase::matrix& stress, - const ModuleBase::matrix& force); + const ModuleBase::matrix& force, + std::ofstream& ofs_running); /** * @brief Output JSON format results. diff --git a/source/source_relax/relax_stru_io.cpp b/source/source_relax/relax_stru_io.cpp index 21883283cd2..433b9dbbc44 100644 --- a/source/source_relax/relax_stru_io.cpp +++ b/source/source_relax/relax_stru_io.cpp @@ -30,7 +30,7 @@ std::string build_stru_header(const int istep, std::string header; if (geometry_evaluated) { - header = FmtCore::format("# ABACUS version: %s\n# Written at %s\n# RELAX STEP %d%s, Energy: %.8f eV\n", + header = FmtCore::format("# ABACUS version: %s\n# Written at %s\n# Ionic_Step %d%s, Energy: %.8f eV\n", VERSION, time_buf, istep + 1, @@ -39,7 +39,7 @@ std::string build_stru_header(const int istep, } else { - header = FmtCore::format("# ABACUS version: %s\n# Written at %s\n# RELAX STEP %d%s, Energy: N/A\n", + header = FmtCore::format("# ABACUS version: %s\n# Written at %s\n# Ionic_Step %d%s, Energy: N/A\n", VERSION, time_buf, istep + 1, diff --git a/source/source_relax/unittests/test_relax_stru_io.cpp b/source/source_relax/unittests/test_relax_stru_io.cpp index 1c553cadfe8..a798f661083 100644 --- a/source/source_relax/unittests/test_relax_stru_io.cpp +++ b/source/source_relax/unittests/test_relax_stru_io.cpp @@ -40,7 +40,7 @@ TEST(RelaxStruIO, HeaderContainsVersionAndStep) const Input_para inp = fully_evaluated_inp(); const std::string header = relax_stru_io::build_stru_header(0, 1.0, identity_stress(), inp, false, true); EXPECT_THAT(header, HasSubstr("# ABACUS version:")); - EXPECT_THAT(header, HasSubstr("# RELAX STEP 1,")); + EXPECT_THAT(header, HasSubstr("# Ionic_Step 1,")); EXPECT_THAT(header, Not(HasSubstr("(FINAL)"))); } @@ -48,7 +48,7 @@ TEST(RelaxStruIO, HeaderFinalStepLabel) { const Input_para inp = fully_evaluated_inp(); const std::string header = relax_stru_io::build_stru_header(4, 1.0, identity_stress(), inp, true, true); - EXPECT_THAT(header, HasSubstr("# RELAX STEP 5 (FINAL),")); + EXPECT_THAT(header, HasSubstr("# Ionic_Step 5 (FINAL),")); } TEST(RelaxStruIO, HeaderConvertsEnergyToEv) @@ -150,7 +150,7 @@ TEST_F(HeaderBehaviorTest, CalForceStressTrue) ASSERT_EQ(lines.size(), 7u); EXPECT_THAT(lines[0], testing::HasSubstr("# ABACUS version:")); EXPECT_THAT(lines[1], testing::HasSubstr("# Written at")); - EXPECT_THAT(lines[2], testing::HasSubstr("# RELAX STEP 1, Energy:")); + EXPECT_THAT(lines[2], testing::HasSubstr("# Ionic_Step 1, Energy:")); EXPECT_THAT(lines[3], testing::HasSubstr("# Stress (kbar): ")); EXPECT_THAT(lines[4], testing::HasSubstr("# Stress (kbar): ")); EXPECT_THAT(lines[5], testing::HasSubstr("# Stress (kbar): ")); @@ -211,7 +211,7 @@ TEST_F(HeaderBehaviorTest, FinalStep) const auto lines = split_lines(header); ASSERT_EQ(lines.size(), 7u); - EXPECT_THAT(lines[2], testing::HasSubstr("# RELAX STEP 5 (FINAL), Energy:")); + EXPECT_THAT(lines[2], testing::HasSubstr("# Ionic_Step 5 (FINAL), Energy:")); } TEST_F(HeaderBehaviorTest, GeometryNotEvaluated) diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/hks1_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/hks1_nao.txt.ref deleted file mode 100644 index 27d9ae82fdf..00000000000 --- a/tests/02_NAO_Gamma/md_out_hk_spin2/hks1_nao.txt.ref +++ /dev/null @@ -1,178 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks1_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31965e-01 -7.79032e-01 2.77556e-17 8.32667e-17 -8.88178e-16 -9.99201e-16 1.66533e-16 -7.21645e-16 - -2.38034e-15 -3.19189e-16 4.85723e-16 8.06695e-15 6.52256e-16 -5.55603e-01 -4.17916e-01 3.40006e-16 - 2.70617e-16 -4.57967e-16 -6.34909e-16 4.08527e-16 -7.89299e-16 1.80195e-15 3.33067e-16 -4.44089e-16 - -4.86298e-15 -5.55112e-17 -Row 2 - 8.97099e-01 1.80411e-16 3.33067e-16 -6.38378e-16 -4.99600e-16 4.44089e-16 -3.05311e-16 -1.96019e-15 - 2.35922e-16 7.35523e-16 7.01563e-15 4.99600e-16 -4.17916e-01 9.78287e-02 -9.60169e-16 1.83013e-16 - -1.30928e-15 3.81639e-16 -1.07553e-16 -1.18308e-15 3.25741e-15 -1.80411e-16 -1.88044e-15 -1.00622e-14 - -2.22045e-16 -Row 3 - 3.88002e-01 2.70617e-16 -3.67761e-16 4.20473e-01 6.93889e-18 -5.34295e-16 1.52656e-15 -6.10623e-16 - -1.66533e-16 -2.03047e-16 6.39675e-02 3.88578e-16 -1.08247e-15 -4.12885e-02 -4.68375e-17 5.03070e-17 - -1.32848e-02 -6.93889e-18 9.88792e-17 -7.28584e-17 1.99493e-16 -3.81639e-17 1.34481e-16 -1.77608e-01 -Row 4 - 3.88002e-01 -6.93889e-18 2.15106e-16 4.20473e-01 0.00000e+00 4.02456e-16 -5.27356e-16 6.39675e-02 - -3.33067e-16 3.60822e-16 5.68989e-16 1.83187e-15 -1.73472e-17 -4.12885e-02 -1.35308e-16 4.68375e-17 - -1.32848e-02 -2.05565e-16 -1.61329e-16 1.56125e-17 -1.77608e-01 7.97973e-17 -2.93168e-16 -Row 5 - 3.88002e-01 -1.73472e-16 -9.71445e-17 4.20473e-01 -8.32667e-17 6.39675e-02 2.49800e-16 3.88578e-16 - -6.66134e-16 -2.77556e-16 -5.27356e-16 -6.59195e-17 2.06432e-16 -4.12885e-02 -3.38271e-17 2.34188e-17 - -1.32848e-02 4.68375e-17 -1.77608e-01 1.73472e-18 9.36751e-17 1.73472e-16 -Row 6 - 7.68029e-01 -1.66533e-16 -3.40006e-16 7.21645e-16 0.00000e00 7.77156e-16 -2.25028e-16 3.92223e-02 - 9.71445e-17 -1.11022e-15 -1.32848e-02 -5.55112e-17 -3.46945e-18 1.33548e-01 -8.67362e-17 1.43982e-16 - -1.24900e-16 2.56739e-16 1.17961e-16 1.20655e-16 -3.73237e-02 -Row 7 - 7.68029e-01 -5.20417e-16 2.49800e-16 -3.60822e-16 3.92223e-02 -1.66533e-16 5.82867e-16 1.38778e-17 - 6.10623e-16 -1.04083e-17 -1.32848e-02 -1.38778e-17 3.12250e-17 1.33548e-01 -1.60462e-16 -1.52656e-16 - 8.67362e-17 -3.73237e-02 1.17961e-16 1.56125e-16 -Row 8 - 7.68029e-01 -3.33067e-16 3.92223e-02 4.44089e-16 -1.88738e-15 -6.93889e-16 -4.30211e-16 -1.38778e-15 - -4.51028e-17 2.25514e-16 -1.32848e-02 3.12250e-17 -2.08167e-17 1.33548e-01 1.04083e-17 -3.73237e-02 - 2.22045e-16 1.04083e-17 1.56125e-16 -Row 9 - 1.45535e+00 -5.55112e-17 -3.33067e-16 2.96916e-15 1.38778e-16 -1.40492e-15 -3.13449e-15 -3.81639e-17 - -1.40513e-16 5.20417e-17 -7.97973e-17 -2.14238e-16 -1.82146e-17 -2.96562e-01 2.42861e-16 -3.81639e-16 - -8.93806e-17 -3.74700e-16 -Row 10 - 1.40881e+00 -1.68268e-16 -9.71445e-17 -2.89699e-16 -1.35308e-16 -5.13478e-16 2.49800e-16 7.28584e-17 - 1.77608e-01 2.08167e-16 2.86229e-17 3.73237e-02 -8.76035e-17 1.12412e-01 4.99600e-16 -4.08527e-16 - -3.12250e-16 -Row 11 - 1.40881e+00 3.60822e-16 4.30211e-16 5.68989e-16 1.16573e-15 1.24900e-16 1.77608e-01 2.77556e-17 - 2.16840e-17 3.73237e-02 1.25767e-16 8.10983e-17 -9.71445e-17 1.12412e-01 -1.24900e-16 1.66533e-16 -Row 12 - 1.45535e+00 9.46923e-17 5.57203e-15 1.19761e-14 1.53139e-16 5.89806e-17 9.71445e-17 1.77677e-16 - 1.07553e-16 3.81639e-17 -7.57123e-17 3.05311e-16 4.85723e-16 -2.96562e-01 1.15458e-16 -Row 13 - 1.40881e+00 7.63278e-16 5.41234e-16 1.77608e-01 1.31839e-16 2.39392e-16 3.73237e-02 -1.24900e-16 - 9.28077e-17 -5.09141e-16 -1.94289e-16 -3.88578e-16 -8.70915e-17 1.12412e-01 -Row 14 - -3.31965e-01 -7.79032e-01 4.46041e-16 -2.03993e-16 -8.84058e-16 -5.65520e-16 -2.75821e-16 -9.62772e-16 - 2.79732e-15 5.75928e-16 -2.42861e-16 -7.40401e-15 -7.77156e-16 -Row 15 - 8.97099e-01 -5.55112e-17 6.69603e-16 -1.63064e-16 3.00107e-16 7.80626e-18 -5.94143e-16 2.24999e-15 - 9.71445e-16 -8.18789e-16 -6.35444e-15 -8.32667e-17 -Row 16 - 3.88002e-01 -9.88792e-17 4.73580e-16 4.20473e-01 -5.89806e-17 6.15827e-16 -1.16226e-16 -2.58474e-16 - 7.07767e-16 -1.67282e-16 -6.39675e-02 -Row 17 - 3.88002e-01 1.21431e-17 1.37043e-16 4.20473e-01 2.39392e-16 -1.00180e-16 -9.71445e-17 -6.39675e-02 - 4.74447e-16 -8.15320e-17 -Row 18 - 3.88002e-01 7.92769e-16 3.29597e-16 4.20473e-01 -1.70437e-16 -6.39675e-02 1.99493e-16 -4.49293e-16 - -9.07260e-16 -Row 19 - 7.68029e-01 -3.19189e-16 4.42354e-16 -1.77809e-16 -7.58074e-16 1.64799e-16 -1.79415e-16 -3.92223e-02 -Row 20 - 7.68029e-01 3.92048e-16 -1.32229e-15 3.12250e-16 -3.92223e-02 1.07163e-15 5.62050e-16 -Row 21 - 7.68029e-01 -9.78384e-16 -3.92223e-02 1.07900e-15 -9.57567e-16 -8.30933e-16 -Row 22 - 1.45535e+00 -3.64292e-17 2.75821e-16 -3.12514e-15 -5.79398e-16 -Row 23 - 1.40881e+00 -5.55112e-17 -8.67362e-17 3.36536e-16 -Row 24 - 1.40881e+00 -9.47159e-16 1.24900e-16 -Row 25 - 1.45535e+00 -1.33569e-16 -Row 26 - 1.40881e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hks1_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 - 1.29057e-06 -4.54077e-04 -2.04377e-03 -6.65931e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 - -4.55962e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03270e-07 -1.41355e-04 -6.41200e-04 - -1.56398e-06 -3.87188e-04 -Row 2 - 8.97123e-01 4.13307e-04 6.86256e-04 1.47125e-04 7.09644e-04 1.17520e-03 2.58861e-04 1.77153e-06 - -6.22558e-04 -2.76649e-03 -9.13819e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06322e-04 -1.33809e-03 - -2.88399e-04 -9.84176e-04 -1.63254e-03 -3.52931e-04 2.06951e-06 -1.13641e-03 -5.12939e-03 -1.06779e-05 - -3.09870e-03 -Row 3 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 -3.25348e-04 -1.17981e-03 - -2.58009e-04 -5.95537e-09 6.39657e-02 2.74471e-04 8.06322e-04 -4.12847e-02 8.85830e-05 3.86774e-04 - -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76787e-05 -1.63820e-06 1.37450e-08 -1.77600e-01 -Row 4 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 2.70768e-04 -7.11915e-04 6.39648e-02 - -4.68991e-04 -2.58007e-04 4.55962e-04 1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 - -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 -1.08231e-03 -1.63536e-06 -Row 5 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 5.63203e-05 6.39662e-02 -7.11924e-04 9.75468e-05 - -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 - -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 2.41913e-04 -2.76817e-05 -Row 6 - 7.68024e-01 1.19265e-04 5.38450e-04 -3.73138e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 - 3.70128e-04 9.84176e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 - -2.46734e-04 1.23775e-03 2.77049e-04 -6.77316e-08 -3.73208e-02 -Row 7 - 7.68027e-01 3.25291e-04 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 - 1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 - 7.48438e-04 -3.73229e-02 -3.53044e-04 2.77042e-04 -Row 8 - 7.68023e-01 6.53006e-05 3.92225e-02 -5.38758e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 - -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 - 7.48456e-04 7.96386e-05 1.23776e-03 -Row 9 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63973e-06 -8.39996e-04 3.03270e-07 2.06951e-06 7.55635e-04 - -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05264e-05 -2.09649e-04 - -1.31157e-05 2.55314e-04 -Row 10 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76787e-05 1.56033e-05 - 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05264e-05 1.12402e-01 8.72792e-04 -8.74755e-05 - 1.44211e-03 -Row 11 - 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63820e-06 1.77599e-01 1.56095e-05 - -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09649e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -Row 12 - 1.45534e+00 -1.07582e-08 -1.56398e-06 -1.06779e-05 -1.37450e-08 1.08231e-03 -2.41913e-04 6.77316e-08 - 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74755e-05 3.63217e-04 -2.96546e-01 8.50124e-08 -Row 13 - 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 1.63536e-06 2.76817e-05 3.73208e-02 -2.77042e-04 - -1.23776e-03 2.55314e-04 1.44211e-03 3.26121e-04 8.50124e-08 1.12406e-01 -Row 14 - -3.31973e-01 -7.79028e-01 -7.14820e-04 -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 - 1.29057e-06 -4.54077e-04 -2.04377e-03 -6.65931e-06 -1.23499e-03 -Row 15 - 8.97123e-01 -4.13307e-04 -6.86256e-04 -1.47125e-04 -7.09644e-04 -1.17520e-03 -2.58861e-04 1.77153e-06 - -6.22558e-04 -2.76649e-03 -9.13819e-06 -1.67365e-03 -Row 16 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 - 2.58009e-04 5.95537e-09 -6.39657e-02 -Row 17 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 - 4.68991e-04 2.58007e-04 -Row 18 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63203e-05 -6.39662e-02 7.11924e-04 -9.75468e-05 - 1.17981e-03 -Row 19 - 7.68024e-01 1.19265e-04 5.38450e-04 3.73138e-04 8.94447e-04 1.92124e-04 1.06387e-07 -3.92231e-02 -Row 20 - 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 5.37336e-04 1.92190e-04 -Row 21 - 7.68023e-01 -6.53006e-05 -3.92225e-02 5.38758e-04 -1.13051e-04 8.94299e-04 -Row 22 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63973e-06 -8.39996e-04 -Row 23 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -Row 24 - 1.40880e+00 -1.20485e-03 1.65475e-04 -Row 25 - 1.45534e+00 -1.07582e-08 -Row 26 - 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/hks2_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/hks2_nao.txt.ref deleted file mode 100644 index 29cfa26b74b..00000000000 --- a/tests/02_NAO_Gamma/md_out_hk_spin2/hks2_nao.txt.ref +++ /dev/null @@ -1,178 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks2_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31965e-01 -7.79032e-01 1.38778e-16 -3.33067e-16 6.93889e-16 8.88178e-16 1.11022e-16 1.66533e-15 - 2.30497e-15 -9.15934e-16 -8.18789e-16 -5.56649e-15 4.85723e-16 -5.55603e-01 -4.17916e-01 3.81639e-17 - 4.16334e-17 1.52656e-16 6.51389e-16 3.55618e-17 1.22298e-16 -1.72465e-15 -2.77556e-17 6.80012e-16 - 4.34511e-15 -4.71845e-16 -Row 2 - 8.97099e-01 9.71445e-17 -3.19189e-16 0.00000e00 3.88578e-16 -3.33067e-16 2.22045e-16 2.83184e-15 - 6.93889e-17 5.55112e-17 -4.81286e-15 -4.85723e-17 -4.17916e-01 9.78287e-02 7.23380e-16 -1.78893e-15 - -1.71824e-15 2.26902e-15 4.92661e-16 9.88792e-16 -3.76668e-15 -5.55112e-16 6.80012e-16 9.02470e-15 - 4.85723e-16 -Row 3 - 3.88002e-01 4.85723e-17 3.92048e-16 4.20473e-01 5.55112e-17 5.27356e-16 5.27356e-16 8.32667e-17 - 2.77556e-16 3.45027e-16 6.39675e-02 -2.22045e-16 -4.71845e-16 -4.12885e-02 -3.98986e-17 -9.71445e-17 - -1.32848e-02 3.12250e-17 -1.47451e-17 3.81639e-17 -1.94289e-16 1.87350e-16 -1.76546e-16 -1.77608e-01 -Row 4 - 3.88002e-01 1.00614e-16 2.77556e-17 4.20473e-01 -1.66533e-16 3.05311e-16 2.77556e-16 6.39675e-02 - 1.66533e-16 -7.49401e-16 -3.19189e-16 -1.11022e-16 -9.71445e-17 -4.12885e-02 1.19696e-16 1.21431e-17 - -1.32848e-02 2.35922e-16 4.33681e-17 8.84709e-17 -1.77608e-01 -7.97973e-17 -2.04697e-16 -Row 5 - 3.88002e-01 4.78784e-16 -4.85723e-17 4.20473e-01 4.02456e-16 6.39675e-02 -7.49401e-16 2.22045e-16 - 3.33067e-16 2.77556e-16 1.58207e-15 3.81639e-17 -2.42861e-17 -4.12885e-02 3.90313e-17 8.67362e-17 - -1.32848e-02 -1.42247e-16 -1.77608e-01 3.81639e-17 2.42861e-17 -1.83881e-16 -Row 6 - 7.68029e-01 -2.84495e-16 6.66134e-16 -1.44329e-15 1.94289e-16 -4.71845e-16 4.48712e-16 3.92223e-02 - 5.55112e-16 4.44089e-16 -1.32848e-02 -1.70003e-16 -4.85723e-17 1.33548e-01 2.34188e-17 -8.76035e-17 - -1.04083e-16 -1.21431e-16 8.32667e-17 -1.07461e-16 -3.73237e-02 -Row 7 - 7.68029e-01 -4.02456e-16 3.05311e-16 1.11022e-16 3.92223e-02 4.44089e-16 -8.32667e-16 -1.80411e-16 - -8.88178e-16 -4.51028e-17 -1.32848e-02 3.81639e-17 -1.56125e-17 1.33548e-01 6.76542e-17 4.51028e-17 - -1.38778e-17 -3.73237e-02 1.70003e-16 1.35308e-16 -Row 8 - 7.68029e-01 5.82867e-16 3.92223e-02 -7.49401e-16 1.11022e-16 -1.11022e-16 -2.08167e-16 -1.66533e-16 - 1.38778e-17 -5.55112e-17 -1.32848e-02 -1.14492e-16 -1.57860e-16 1.33548e-01 -6.93889e-18 -3.73237e-02 - 1.14492e-16 -1.38778e-16 -1.28370e-16 -Row 9 - 1.45535e+00 1.87350e-16 1.80411e-16 -2.74614e-15 -7.77156e-16 2.09986e-15 4.56136e-15 2.77556e-17 - 7.80626e-17 8.67362e-18 -2.08167e-17 2.55872e-17 -1.14492e-16 -2.96562e-01 -3.05311e-16 -1.80411e-16 - -3.62128e-17 8.32667e-17 -Row 10 - 1.40881e+00 -1.05818e-16 4.71845e-16 6.76542e-17 3.29597e-16 1.94289e-16 -7.97973e-17 -1.28370e-16 - 1.77608e-01 -2.51535e-17 -2.06432e-16 3.73237e-02 -9.45424e-17 1.12412e-01 -8.32667e-17 1.37911e-16 - -4.16334e-17 -Row 11 - 1.40881e+00 -4.30211e-16 -2.87964e-16 -6.27970e-16 -9.71445e-16 -1.21431e-16 1.77608e-01 4.16334e-17 - -7.11237e-17 3.73237e-02 -2.94036e-16 3.72966e-17 2.70617e-16 1.12412e-01 -2.52402e-16 -2.56739e-16 -Row 12 - 1.45535e+00 -3.30186e-17 -3.71137e-15 -8.31895e-15 -1.42554e-16 1.42247e-16 -5.89806e-17 -1.19933e-16 - -9.80119e-17 1.89952e-16 -2.41710e-17 -2.63678e-16 1.94289e-16 -2.96562e-01 -1.29552e-16 -Row 13 - 1.40881e+00 2.87964e-16 2.63678e-16 1.77608e-01 7.63278e-17 -2.11636e-16 3.73237e-02 6.85216e-17 - -7.11237e-17 -1.48319e-16 -4.16334e-16 -8.39606e-16 1.28323e-16 1.12412e-01 -Row 14 - -3.31965e-01 -7.79032e-01 2.30718e-16 1.83555e-16 7.38342e-16 8.06646e-16 -9.88792e-17 1.00094e-15 - -3.01395e-15 -1.13798e-15 2.01228e-16 6.15979e-15 -6.93889e-17 -Row 15 - 8.97099e-01 4.47559e-16 -3.12250e-16 1.90820e-16 -5.55979e-16 -5.20417e-18 4.32814e-16 -2.42032e-15 - -8.46545e-16 2.08167e-16 5.46811e-15 -4.85723e-16 -Row 16 - 3.88002e-01 6.24500e-17 -3.34802e-16 4.20473e-01 1.59595e-16 -3.26128e-16 1.35308e-16 3.98119e-16 - -2.21177e-16 2.79804e-16 -6.39675e-02 -Row 17 - 3.88002e-01 -1.12757e-16 1.38778e-17 4.20473e-01 -2.27249e-16 2.91434e-16 -3.51282e-16 -6.39675e-02 - -8.89046e-16 1.04083e-17 -Row 18 - 3.88002e-01 -3.27863e-16 8.15320e-17 4.20473e-01 2.52836e-16 -6.39675e-02 -1.14665e-15 5.09141e-16 - 6.24500e-17 -Row 19 - 7.68029e-01 -3.46945e-17 -5.75928e-16 -2.07213e-15 1.31839e-16 -7.94503e-16 3.80588e-16 -3.92223e-02 -Row 20 - 7.68029e-01 9.88792e-17 -4.53197e-16 2.91434e-16 -3.92223e-02 -9.94430e-16 -5.89806e-16 -Row 21 - 7.68029e-01 -4.63605e-16 -3.92223e-02 4.16334e-17 7.92335e-16 3.29597e-17 -Row 22 - 1.45535e+00 1.12757e-16 -1.17961e-16 2.56748e-15 -1.00614e-16 -Row 23 - 1.40881e+00 -5.20417e-17 3.46945e-17 -3.33067e-16 -Row 24 - 1.40881e+00 3.05311e-16 2.84495e-16 -Row 25 - 1.45535e+00 3.06929e-17 -Row 26 - 1.40881e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hks2_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 - 1.29060e-06 -4.54077e-04 -2.04377e-03 -6.65949e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 - -4.55962e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03279e-07 -1.41355e-04 -6.41200e-04 - -1.56402e-06 -3.87188e-04 -Row 2 - 8.97123e-01 4.13307e-04 6.86256e-04 1.47125e-04 7.09644e-04 1.17520e-03 2.58861e-04 1.77154e-06 - -6.22558e-04 -2.76649e-03 -9.13822e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06321e-04 -1.33809e-03 - -2.88399e-04 -9.84176e-04 -1.63254e-03 -3.52931e-04 2.06956e-06 -1.13641e-03 -5.12939e-03 -1.06781e-05 - -3.09870e-03 -Row 3 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 -3.25348e-04 -1.17981e-03 - -2.58009e-04 -5.95575e-09 6.39657e-02 2.74471e-04 8.06321e-04 -4.12847e-02 8.85830e-05 3.86774e-04 - -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76787e-05 -1.63821e-06 1.37450e-08 -1.77600e-01 -Row 4 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 2.70768e-04 -7.11915e-04 6.39648e-02 - -4.68991e-04 -2.58007e-04 4.55962e-04 1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 - -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 -1.08231e-03 -1.63538e-06 -Row 5 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 5.63204e-05 6.39662e-02 -7.11924e-04 9.75469e-05 - -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 - -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 2.41913e-04 -2.76818e-05 -Row 6 - 7.68024e-01 1.19265e-04 5.38450e-04 -3.73139e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 - 3.70128e-04 9.84176e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 - -2.46734e-04 1.23775e-03 2.77049e-04 -6.77316e-08 -3.73208e-02 -Row 7 - 7.68027e-01 3.25291e-04 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 - 1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 - 7.48438e-04 -3.73229e-02 -3.53044e-04 2.77042e-04 -Row 8 - 7.68023e-01 6.53007e-05 3.92225e-02 -5.38757e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 - -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 - 7.48456e-04 7.96386e-05 1.23776e-03 -Row 9 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63981e-06 -8.39996e-04 3.03279e-07 2.06956e-06 7.55635e-04 - -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05264e-05 -2.09649e-04 - -1.31157e-05 2.55314e-04 -Row 10 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76787e-05 1.56033e-05 - 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05264e-05 1.12402e-01 8.72792e-04 -8.74755e-05 - 1.44211e-03 -Row 11 - 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63821e-06 1.77599e-01 1.56095e-05 - -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09649e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -Row 12 - 1.45534e+00 -1.07580e-08 -1.56402e-06 -1.06781e-05 -1.37450e-08 1.08231e-03 -2.41913e-04 6.77316e-08 - 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74755e-05 3.63217e-04 -2.96546e-01 8.50121e-08 -Row 13 - 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 1.63538e-06 2.76818e-05 3.73208e-02 -2.77042e-04 - -1.23776e-03 2.55314e-04 1.44211e-03 3.26121e-04 8.50121e-08 1.12406e-01 -Row 14 - -3.31973e-01 -7.79028e-01 -7.14820e-04 -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 - 1.29060e-06 -4.54077e-04 -2.04377e-03 -6.65949e-06 -1.23499e-03 -Row 15 - 8.97123e-01 -4.13307e-04 -6.86256e-04 -1.47125e-04 -7.09644e-04 -1.17520e-03 -2.58861e-04 1.77154e-06 - -6.22558e-04 -2.76649e-03 -9.13822e-06 -1.67365e-03 -Row 16 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 - 2.58009e-04 5.95575e-09 -6.39657e-02 -Row 17 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 - 4.68991e-04 2.58007e-04 -Row 18 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63204e-05 -6.39662e-02 7.11924e-04 -9.75469e-05 - 1.17981e-03 -Row 19 - 7.68024e-01 1.19265e-04 5.38450e-04 3.73139e-04 8.94447e-04 1.92124e-04 1.06387e-07 -3.92231e-02 -Row 20 - 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 5.37336e-04 1.92190e-04 -Row 21 - 7.68023e-01 -6.53007e-05 -3.92225e-02 5.38757e-04 -1.13051e-04 8.94299e-04 -Row 22 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63981e-06 -8.39996e-04 -Row 23 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -Row 24 - 1.40880e+00 -1.20485e-03 1.65475e-04 -Row 25 - 1.45534e+00 -1.07580e-08 -Row 26 - 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/hs1_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/hs1_nao.txt.ref new file mode 100644 index 00000000000..b280b8e1110 --- /dev/null +++ b/tests/02_NAO_Gamma/md_out_hk_spin2/hs1_nao.txt.ref @@ -0,0 +1,258 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.673898 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -3.31965e-01 -7.79032e-01 5.33711e-16 -2.43402e-17 1.17590e-16 5.96565e-16 -6.43216e-16 -9.11807e-16 + -3.99671e-15 3.72444e-16 1.11661e-15 -1.79445e-15 -4.05182e-16 -5.55603e-01 -4.17916e-01 2.84201e-16 + -4.05516e-17 -3.30009e-16 1.46108e-16 -7.49986e-17 1.38398e-16 3.08983e-15 6.66660e-17 -5.05992e-17 + 2.00454e-15 -2.51401e-16 + -7.79032e-01 8.97099e-01 -2.78265e-16 4.05380e-16 5.20371e-16 -6.25700e-16 -1.69682e-18 7.65826e-16 + -3.41460e-15 -1.59996e-16 2.75164e-16 -1.99653e-15 8.81720e-17 -4.17916e-01 9.78287e-02 2.00912e-16 + -2.20579e-16 -3.94018e-16 1.85616e-16 -1.06385e-16 -3.49827e-16 6.28850e-15 -1.22594e-16 -6.10309e-16 + 3.81749e-15 6.49495e-16 + 3.57213e-16 -4.34141e-16 3.88002e-01 -5.30723e-17 -2.97486e-16 4.20473e-01 1.39815e-16 -1.68526e-16 + -9.66919e-16 3.54839e-16 6.39892e-16 1.76595e-16 6.39675e-02 -3.70418e-17 -3.10641e-16 -4.12885e-02 + 1.07759e-16 1.42869e-16 -1.32848e-02 2.27941e-16 -2.32664e-17 8.18552e-17 -3.86808e-17 -1.29727e-16 + -1.04046e-16 -1.77608e-01 + 1.22714e-16 4.55486e-16 -1.41136e-17 3.88002e-01 3.30143e-16 2.98587e-17 4.20473e-01 3.65496e-16 + 4.99241e-17 4.38297e-16 6.39675e-02 2.77616e-16 -8.94568e-16 -3.24850e-17 1.10304e-16 -4.69180e-16 + -4.12885e-02 7.52190e-17 -2.68270e-16 -1.32848e-02 1.32366e-16 -4.65631e-17 -2.02781e-16 -1.77608e-01 + 1.02323e-16 1.13786e-16 + 4.13376e-17 3.31348e-16 -3.77903e-16 4.23991e-16 3.88002e-01 -2.66424e-16 2.61489e-16 4.20473e-01 + 9.05048e-17 6.39675e-02 -3.70339e-16 -3.07461e-16 -2.23316e-16 -2.00660e-16 -3.45292e-16 -2.18847e-16 + 1.65443e-17 -4.12885e-02 -1.39049e-16 -8.53666e-17 -1.32848e-02 -3.34527e-16 -1.77608e-01 -1.67783e-16 + 3.58765e-17 9.61096e-17 + -1.04101e-16 -1.42312e-16 4.20473e-01 2.28915e-16 -2.28124e-16 7.68029e-01 7.91388e-17 -6.51178e-16 + -7.32947e-16 1.06725e-16 6.97434e-16 2.56726e-16 3.92223e-02 -5.37776e-17 -3.08164e-16 -1.32848e-02 + 1.83337e-16 5.53682e-17 1.33548e-01 1.02441e-16 -9.81351e-17 -1.13534e-16 1.93702e-16 -7.37136e-17 + -9.83599e-17 -3.73237e-02 + -8.24430e-16 3.81454e-17 1.51925e-16 4.20473e-01 2.65130e-16 8.19588e-17 7.68029e-01 3.64193e-16 + 1.73045e-16 5.98859e-16 3.92223e-02 7.29627e-18 -7.07586e-16 2.49843e-16 -2.08215e-16 -1.70102e-16 + -1.32848e-02 -9.26414e-17 -2.33528e-16 1.33548e-01 -7.81784e-18 -1.22158e-16 -1.99091e-16 -3.73237e-02 + -1.12655e-16 5.88144e-18 + -3.69818e-16 3.06447e-16 -3.31239e-16 2.17384e-16 4.20473e-01 -8.91272e-16 4.90400e-16 7.68029e-01 + 1.50099e-15 3.92223e-02 -8.77380e-16 -8.43555e-16 -5.43110e-16 1.10550e-16 -9.82274e-17 -1.22521e-16 + -1.94557e-17 -1.32848e-02 -2.31409e-16 -7.14304e-17 1.33548e-01 -3.65123e-16 -3.73237e-02 -1.45327e-16 + 1.28421e-16 3.82681e-17 + -3.62906e-15 -3.41710e-15 -7.33777e-16 5.95121e-17 1.57630e-16 -1.20767e-15 2.73739e-16 1.48488e-15 + 1.45535e+00 3.48886e-18 -2.37447e-16 -1.04027e-15 -3.02274e-16 -2.70655e-15 -5.34594e-15 2.25568e-16 + -1.37571e-16 -2.38237e-16 2.66356e-16 -6.55749e-17 -2.26743e-16 -2.96562e-01 -1.96001e-16 -9.43145e-17 + 1.88969e-17 1.96022e-16 + 5.56839e-16 -1.09931e-16 -2.66786e-16 6.11218e-16 6.39675e-02 2.19110e-16 4.32723e-16 3.92223e-02 + -6.31001e-17 1.40881e+00 1.60540e-16 -2.08019e-17 -5.97688e-17 -3.54001e-16 -3.84050e-17 1.74083e-16 + -2.23665e-17 1.77608e-01 2.07790e-16 -1.30209e-16 3.73237e-02 1.06805e-16 1.12412e-01 -3.02686e-16 + 2.67191e-18 -3.22730e-17 + 1.08132e-15 1.38548e-16 7.13406e-16 6.39675e-02 1.35106e-17 8.36084e-16 3.92223e-02 -9.18660e-16 + -1.92172e-16 3.09283e-17 1.40881e+00 3.23574e-16 8.83525e-17 3.06070e-16 1.35068e-15 7.45131e-17 + 1.77608e-01 1.40320e-17 1.91929e-16 3.73237e-02 -1.69429e-16 1.81797e-16 -2.13585e-16 1.12412e-01 + 7.84011e-17 -6.71855e-16 + -1.89020e-15 -2.04183e-15 1.74121e-16 3.39877e-16 -1.95148e-16 2.36622e-16 5.72308e-17 -9.06295e-16 + -9.48546e-16 -1.05097e-16 2.67933e-16 1.45535e+00 -1.52374e-18 -1.27902e-15 -3.12620e-15 -7.40031e-17 + -5.70749e-19 1.96671e-16 -3.41005e-17 -4.12396e-17 1.56818e-16 -5.37355e-18 -2.75827e-16 2.35893e-16 + -2.96562e-01 -6.97428e-17 + -5.91572e-16 -6.51607e-16 6.39675e-02 -8.06216e-16 -6.30147e-16 3.92223e-02 -6.71294e-16 -6.96600e-16 + -2.82381e-16 -5.03788e-17 7.49193e-17 -2.67491e-18 1.40881e+00 -3.12366e-16 -1.04399e-15 1.77608e-01 + 1.79345e-16 2.38919e-16 3.73237e-02 3.04986e-17 1.85055e-16 1.12746e-16 4.68090e-16 7.65895e-16 + 4.94598e-17 1.12412e-01 + -5.55603e-01 -4.17916e-01 -1.38355e-16 -3.53526e-17 -2.91901e-16 6.87844e-17 2.99546e-16 4.17646e-17 + -2.70677e-15 -2.05317e-16 2.76431e-16 -1.28049e-15 -3.02323e-16 -3.31965e-01 -7.79032e-01 4.80498e-16 + -5.61838e-16 -5.47717e-16 1.36611e-15 1.16310e-15 -1.43583e-15 5.43870e-15 1.38211e-16 -4.62456e-16 + 2.67536e-15 -3.69394e-16 + -4.17916e-01 9.78287e-02 -2.87722e-16 1.17232e-16 -2.55970e-16 -2.39341e-16 -2.65376e-16 1.06503e-17 + -5.34215e-15 -2.31956e-17 1.36434e-15 -3.12472e-15 -1.05128e-15 -7.79032e-01 8.97099e-01 8.12618e-17 + -3.46251e-16 1.58211e-16 8.34774e-16 -2.39912e-16 -2.93417e-16 3.90697e-15 -2.39602e-16 -4.85814e-16 + 2.64725e-15 -7.07618e-16 + 5.58182e-16 2.79024e-16 -4.12885e-02 -4.45681e-16 -2.37575e-16 -1.32848e-02 -1.62114e-16 -1.21836e-16 + 2.51971e-16 1.63409e-16 8.72470e-17 -7.38242e-17 1.77608e-01 5.83410e-16 -9.77848e-17 3.88002e-01 + 4.17134e-17 2.24064e-16 4.20473e-01 -1.71910e-17 3.42598e-16 -4.47721e-16 5.80004e-16 5.14809e-16 + 8.57865e-17 -6.39675e-02 + -1.16471e-18 -2.86882e-16 1.00033e-16 -4.12885e-02 8.18148e-17 2.23852e-16 -1.32848e-02 -3.39002e-19 + -1.36678e-16 -1.97319e-17 1.77608e-01 2.80532e-18 1.79997e-16 -4.20186e-16 1.61137e-17 1.85421e-16 + 3.88002e-01 -1.31731e-16 1.93303e-16 4.20473e-01 -6.43344e-16 2.35896e-16 -1.55740e-16 -6.39675e-02 + -3.18884e-17 -4.32413e-16 + -2.74420e-16 -3.20992e-16 1.44957e-16 9.91543e-17 -4.12885e-02 6.68954e-17 -7.07058e-17 -1.32848e-02 + -2.35714e-16 1.77608e-01 -9.73370e-18 1.95291e-16 2.42583e-16 -5.56817e-16 7.04831e-17 2.35663e-16 + -1.25490e-16 3.88002e-01 2.76852e-16 -5.20488e-16 4.20473e-01 6.93614e-16 -6.39675e-02 5.97829e-16 + -2.64650e-16 -1.00710e-16 + 2.36483e-18 2.80753e-16 -1.32848e-02 -2.56178e-16 -1.41600e-16 1.33548e-01 -2.41376e-16 -2.65195e-16 + 2.70582e-16 1.94094e-16 2.16901e-16 -2.93188e-17 3.73237e-02 1.11778e-15 5.42520e-16 4.20473e-01 + 6.66278e-17 3.10311e-16 7.68029e-01 3.22960e-16 4.59603e-16 2.91639e-17 7.49691e-16 1.13789e-15 + 7.11744e-17 -3.92223e-02 + -8.32537e-18 -2.08140e-16 2.36997e-16 -1.32848e-02 -7.96777e-17 1.05002e-16 1.33548e-01 -7.13890e-17 + -5.13707e-17 -1.51603e-16 3.73237e-02 -4.59499e-17 2.97885e-17 1.16505e-15 -1.91990e-16 1.87972e-16 + 4.20473e-01 -5.97220e-16 7.10356e-17 7.68029e-01 -7.77907e-17 -1.11872e-16 4.51173e-16 -3.92223e-02 + -1.43633e-17 -2.57715e-16 + 6.89871e-17 -2.89272e-16 -2.63595e-17 1.17347e-16 -1.32848e-02 -1.56943e-17 1.49918e-17 1.33548e-01 + -2.28099e-16 3.73237e-02 -1.70521e-16 1.35310e-16 1.72091e-16 -8.40768e-16 -3.39779e-16 5.31349e-16 + -3.84244e-16 4.20473e-01 2.48801e-16 -2.17541e-16 7.68029e-01 1.12419e-16 -3.92223e-02 3.39137e-16 + 3.96898e-17 -2.44496e-16 + 3.09232e-15 6.27215e-15 4.85186e-17 -3.13651e-17 -3.52645e-16 -1.29035e-16 -1.26273e-16 -3.73375e-16 + -2.96562e-01 1.18641e-16 1.77892e-16 -4.00697e-18 8.35970e-17 5.05275e-15 3.81227e-15 -1.61946e-16 + 2.74391e-16 6.64225e-16 -8.37480e-17 -1.00072e-16 2.68638e-16 1.45535e+00 9.13461e-17 -4.91383e-17 + 9.12385e-16 6.38421e-16 + 1.70835e-16 -1.13159e-16 -3.05495e-17 -1.91397e-16 -1.77608e-01 1.71623e-16 -2.13187e-16 -3.73237e-02 + -1.84537e-16 1.12412e-01 -1.75519e-16 -2.75628e-16 4.53580e-16 3.51135e-16 -3.50303e-16 2.98907e-16 + -4.70333e-16 -6.39675e-02 7.70095e-16 1.00000e-16 -3.92223e-02 6.55100e-17 1.40881e+00 7.08682e-17 + 2.97942e-16 1.27473e-16 + -1.60374e-17 -6.03153e-16 -1.31029e-16 -1.77608e-01 -1.33234e-16 -8.36811e-17 -3.73237e-02 -2.03061e-16 + -9.76741e-17 -2.64563e-16 1.12412e-01 2.23284e-16 7.71796e-16 -3.84159e-16 -4.64199e-16 4.30534e-16 + -6.39675e-02 1.58697e-16 1.21766e-15 -3.92223e-02 -2.53326e-18 -6.90589e-17 -6.35998e-17 1.40881e+00 + -6.94220e-16 -2.07627e-16 + 2.00727e-15 3.81946e-15 -1.04072e-16 1.00380e-16 3.96326e-17 -1.03725e-16 -1.01219e-16 1.38032e-16 + 2.02678e-17 2.03150e-18 6.51367e-17 -2.96562e-01 4.99158e-17 2.81389e-15 2.60223e-15 1.06850e-16 + 6.22446e-17 -3.12612e-16 7.81675e-17 2.15473e-16 -1.68714e-16 8.34481e-16 3.62669e-16 -7.15407e-16 + 1.45535e+00 7.29489e-17 + -2.82438e-16 5.84890e-16 -1.77608e-01 1.25861e-16 8.80178e-17 -3.73237e-02 1.55998e-17 4.54833e-17 + 1.68890e-16 -4.94113e-17 -6.66944e-16 -6.84421e-17 1.12412e-01 -2.63771e-16 -5.77860e-16 -6.39675e-02 + -2.84552e-16 -3.26642e-16 -3.92223e-02 -3.37871e-16 -3.85464e-16 6.85600e-16 1.93690e-16 -1.79597e-16 + 6.77161e-17 1.40881e+00 +Ionic_Step 2 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.673893 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.999239976680832 9.51223761414047e-05 0.00100497682545176 + 0.250760023319168 0.249904877623859 0.248995023174548 + + + -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 + 1.29057e-06 -4.54077e-04 -2.04377e-03 -6.65931e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 + -4.55962e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03270e-07 -1.41355e-04 -6.41200e-04 + -1.56398e-06 -3.87188e-04 + -7.79028e-01 8.97123e-01 4.13307e-04 6.86256e-04 1.47125e-04 7.09644e-04 1.17520e-03 2.58861e-04 + 1.77153e-06 -6.22558e-04 -2.76649e-03 -9.13819e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06322e-04 + -1.33809e-03 -2.88399e-04 -9.84176e-04 -1.63254e-03 -3.52931e-04 2.06951e-06 -1.13641e-03 -5.12939e-03 + -1.06779e-05 -3.09870e-03 + 7.14820e-04 4.13307e-04 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 + -3.25348e-04 -1.17981e-03 -2.58009e-04 -5.95537e-09 6.39657e-02 2.74471e-04 8.06322e-04 -4.12847e-02 + 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76787e-05 -1.63820e-06 + 1.37450e-08 -1.77600e-01 + 1.18605e-03 6.86256e-04 1.40071e-04 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 + 2.70768e-04 -7.11915e-04 6.39648e-02 -4.68991e-04 -2.58007e-04 4.55962e-04 1.33809e-03 8.85830e-05 + -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 + -1.08231e-03 -1.63536e-06 + 2.55953e-04 1.47125e-04 6.34090e-04 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 + 5.63203e-05 6.39662e-02 -7.11924e-04 9.75468e-05 -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 + 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 + 2.41913e-04 -2.76817e-05 + 6.52114e-04 7.09644e-04 4.20466e-01 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 + -3.73138e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 3.70128e-04 9.84176e-04 -1.32862e-02 + -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 -2.46734e-04 1.23775e-03 2.77049e-04 + -6.77316e-08 -3.73208e-02 + 1.08200e-03 1.17520e-03 1.25460e-04 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 + 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 1.63254e-03 -1.30073e-05 + -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 7.48438e-04 -3.73229e-02 + -3.53044e-04 2.77042e-04 + 2.33122e-04 2.58861e-04 5.71676e-04 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 + 6.53006e-05 3.92225e-02 -5.38758e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 -5.42821e-05 + -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 7.48456e-04 + 7.96386e-05 1.23776e-03 + 1.29057e-06 1.77153e-06 -3.25348e-04 2.70768e-04 5.63203e-05 -3.73138e-04 3.10164e-04 6.53006e-05 + 1.45533e+00 1.53175e-04 6.95612e-04 -3.63973e-06 -8.39996e-04 3.03270e-07 2.06951e-06 7.55635e-04 + -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05264e-05 -2.09649e-04 + -1.31157e-05 2.55314e-04 + -4.54077e-04 -6.22558e-04 -1.17981e-03 -7.11915e-04 6.39662e-02 -8.94447e-04 -5.39028e-04 3.92225e-02 + 1.53175e-04 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76787e-05 + 1.56033e-05 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05264e-05 1.12402e-01 8.72792e-04 + -8.74755e-05 1.44211e-03 + -2.04377e-03 -2.76649e-03 -2.58009e-04 6.39648e-02 -7.11924e-04 -1.92124e-04 3.92242e-02 -5.38758e-04 + 6.95612e-04 4.37699e-04 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63820e-06 + 1.77599e-01 1.56095e-05 -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09649e-04 8.72792e-04 1.12414e-01 + 3.63217e-04 3.26121e-04 + -6.65931e-06 -9.13819e-06 -5.95537e-09 -4.68991e-04 9.75468e-05 -1.06387e-07 -5.37336e-04 1.13051e-04 + -3.63973e-06 2.65302e-04 -1.20485e-03 1.45534e+00 -1.07582e-08 -1.56398e-06 -1.06779e-05 -1.37450e-08 + 1.08231e-03 -2.41913e-04 6.77316e-08 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74755e-05 3.63217e-04 + -2.96546e-01 8.50124e-08 + -1.23499e-03 -1.67365e-03 6.39657e-02 -2.58007e-04 -1.17981e-03 3.92231e-02 -1.92190e-04 -8.94299e-04 + -8.39996e-04 7.22291e-04 1.65475e-04 -1.07582e-08 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 + 1.63536e-06 2.76817e-05 3.73208e-02 -2.77042e-04 -1.23776e-03 2.55314e-04 1.44211e-03 3.26121e-04 + 8.50124e-08 1.12406e-01 + -5.55607e-01 -4.17915e-01 2.74471e-04 4.55962e-04 9.71044e-05 3.70128e-04 6.13802e-04 1.32976e-04 + 3.03270e-07 -1.41355e-04 -6.41200e-04 -1.56398e-06 -3.87188e-04 -3.31973e-01 -7.79028e-01 -7.14820e-04 + -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 1.29057e-06 -4.54077e-04 -2.04377e-03 + -6.65931e-06 -1.23499e-03 + -4.17915e-01 9.78578e-02 8.06322e-04 1.33809e-03 2.88399e-04 9.84176e-04 1.63254e-03 3.52931e-04 + 2.06951e-06 -1.13641e-03 -5.12939e-03 -1.06779e-05 -3.09870e-03 -7.79028e-01 8.97123e-01 -4.13307e-04 + -6.86256e-04 -1.47125e-04 -7.09644e-04 -1.17520e-03 -2.58861e-04 1.77153e-06 -6.22558e-04 -2.76649e-03 + -9.13819e-06 -1.67365e-03 + -2.74471e-04 -8.06322e-04 -4.12847e-02 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 + 7.55635e-04 2.76787e-05 1.63820e-06 -1.37450e-08 1.77600e-01 -7.14820e-04 -4.13307e-04 3.87997e-01 + 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 2.58009e-04 + 5.95537e-09 -6.39657e-02 + -4.55962e-04 -1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 + -6.24881e-04 1.56033e-05 1.77599e-01 1.08231e-03 1.63536e-06 -1.18605e-03 -6.86256e-04 1.40071e-04 + 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 + 4.68991e-04 2.58007e-04 + -9.71044e-05 -2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 -1.32861e-02 + -1.39665e-04 1.77601e-01 1.56095e-05 -2.41913e-04 2.76817e-05 -2.55953e-04 -1.47125e-04 6.34090e-04 + 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63203e-05 -6.39662e-02 7.11924e-04 + -9.75468e-05 1.17981e-03 + -3.70128e-04 -9.84176e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 + 2.46734e-04 -1.23775e-03 -2.77049e-04 6.77316e-08 3.73208e-02 -6.52114e-04 -7.09644e-04 4.20466e-01 + 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 3.73138e-04 8.94447e-04 1.92124e-04 + 1.06387e-07 -3.92231e-02 + -6.13802e-04 -1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 + -2.03789e-04 -7.48438e-04 3.73229e-02 3.53044e-04 -2.77042e-04 -1.08200e-03 -1.17520e-03 1.25460e-04 + 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 + 5.37336e-04 1.92190e-04 + -1.32976e-04 -3.52931e-04 -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 + -4.60000e-05 3.73197e-02 -7.48456e-04 -7.96386e-05 -1.23776e-03 -2.33122e-04 -2.58861e-04 5.71676e-04 + 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 -6.53006e-05 -3.92225e-02 5.38758e-04 + -1.13051e-04 8.94299e-04 + 3.03270e-07 2.06951e-06 -7.55635e-04 6.24881e-04 1.39665e-04 -2.46734e-04 2.03789e-04 4.60000e-05 + -2.96551e-01 -5.05264e-05 -2.09649e-04 -1.31157e-05 2.55314e-04 1.29057e-06 1.77153e-06 3.25348e-04 + -2.70768e-04 -5.63203e-05 3.73138e-04 -3.10164e-04 -6.53006e-05 1.45533e+00 1.53175e-04 6.95612e-04 + -3.63973e-06 -8.39996e-04 + -1.41355e-04 -1.13641e-03 -2.76787e-05 -1.56033e-05 -1.77601e-01 1.23775e-03 7.48438e-04 -3.73197e-02 + -5.05264e-05 1.12402e-01 8.72792e-04 -8.74755e-05 1.44211e-03 -4.54077e-04 -6.22558e-04 1.17981e-03 + 7.11915e-04 -6.39662e-02 8.94447e-04 5.39028e-04 -3.92225e-02 1.53175e-04 1.40881e+00 4.37699e-04 + 2.65302e-04 7.22291e-04 + -6.41200e-04 -5.12939e-03 -1.63820e-06 -1.77599e-01 -1.56095e-05 2.77049e-04 -3.73229e-02 7.48456e-04 + -2.09649e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -2.04377e-03 -2.76649e-03 2.58009e-04 + -6.39648e-02 7.11924e-04 1.92124e-04 -3.92242e-02 5.38758e-04 6.95612e-04 4.37699e-04 1.40880e+00 + -1.20485e-03 1.65475e-04 + -1.56398e-06 -1.06779e-05 1.37450e-08 -1.08231e-03 2.41913e-04 -6.77316e-08 -3.53044e-04 7.96386e-05 + -1.31157e-05 -8.74755e-05 3.63217e-04 -2.96546e-01 8.50124e-08 -6.65931e-06 -9.13819e-06 5.95537e-09 + 4.68991e-04 -9.75468e-05 1.06387e-07 5.37336e-04 -1.13051e-04 -3.63973e-06 2.65302e-04 -1.20485e-03 + 1.45534e+00 -1.07582e-08 + -3.87188e-04 -3.09870e-03 -1.77600e-01 -1.63536e-06 -2.76817e-05 -3.73208e-02 2.77042e-04 1.23776e-03 + 2.55314e-04 1.44211e-03 3.26121e-04 8.50124e-08 1.12406e-01 -1.23499e-03 -1.67365e-03 -6.39657e-02 + 2.58007e-04 1.17981e-03 -3.92231e-02 1.92190e-04 8.94299e-04 -8.39996e-04 7.22291e-04 1.65475e-04 + -1.07582e-08 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/hs2_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/hs2_nao.txt.ref new file mode 100644 index 00000000000..cdf58d0fd91 --- /dev/null +++ b/tests/02_NAO_Gamma/md_out_hk_spin2/hs2_nao.txt.ref @@ -0,0 +1,258 @@ +Ionic_Step 1 + 2 # number of spin directions + 2 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.673898 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -3.31965e-01 -7.79032e-01 6.87357e-16 -1.97881e-16 -2.75255e-17 -6.43935e-16 1.99377e-16 4.17500e-16 + 3.47104e-15 -3.15674e-16 -8.58688e-16 2.35267e-15 6.63331e-16 -5.55603e-01 -4.17916e-01 -2.89620e-16 + -5.75531e-16 2.60754e-16 8.85408e-17 -6.80977e-17 7.03369e-17 -1.94054e-15 -3.21497e-16 8.89427e-17 + -8.11771e-16 2.42901e-16 + -7.79032e-01 8.97099e-01 7.82666e-16 1.24394e-17 -1.29623e-16 -1.10139e-15 9.07405e-18 3.44988e-16 + 3.06494e-15 -9.32133e-16 -9.11832e-16 2.19707e-15 3.43799e-16 -4.17916e-01 9.78287e-02 6.87567e-16 + 6.19677e-17 -1.94443e-16 -9.41977e-17 -3.00181e-17 7.48234e-16 -5.25903e-15 2.96762e-16 6.34207e-16 + -2.11461e-15 -1.19818e-15 + 8.31296e-16 9.99556e-16 3.88002e-01 -7.69761e-18 2.94738e-16 4.20473e-01 1.36473e-16 -4.82494e-17 + 5.93038e-16 -2.88280e-16 -7.23538e-16 -1.05443e-16 6.39675e-02 2.68901e-16 6.23111e-16 -4.12885e-02 + -2.59626e-16 -3.19088e-16 -1.32848e-02 -3.05944e-16 -7.39266e-17 -2.04155e-17 -1.78845e-17 6.40240e-17 + -5.46549e-18 -1.77608e-01 + -6.11979e-16 -5.34203e-17 4.96276e-17 3.88002e-01 -5.33432e-16 -1.76278e-16 4.20473e-01 -4.13151e-16 + -1.23030e-16 -1.96443e-16 6.39675e-02 -3.78185e-16 3.48852e-16 -3.57949e-16 -6.17974e-16 1.21107e-16 + -4.12885e-02 2.50656e-16 7.29852e-17 -1.32848e-02 1.16342e-16 1.82983e-16 9.87887e-17 -1.77608e-01 + 1.11774e-16 -2.05546e-16 + 6.88056e-17 -1.24896e-16 3.65627e-16 -5.28844e-16 3.88002e-01 1.95917e-16 -4.90236e-16 4.20473e-01 + -4.70883e-16 6.39675e-02 -2.46134e-16 1.02528e-15 5.63100e-16 3.47079e-16 -3.09676e-16 1.31353e-16 + -7.79374e-18 -4.12885e-02 1.07951e-17 2.89636e-17 -1.32848e-02 2.41912e-16 -1.77608e-01 3.72100e-18 + -1.79393e-16 -2.54665e-16 + -7.28042e-16 -3.56506e-16 4.20473e-01 -1.71726e-16 2.33740e-16 7.68029e-01 -4.93120e-17 2.57118e-16 + 3.99155e-16 -6.96602e-16 -8.33870e-16 -1.52613e-16 3.92223e-02 4.38737e-16 -1.31643e-15 -1.32848e-02 + -3.72116e-16 -3.59644e-16 1.33548e-01 -3.27797e-16 -1.40973e-16 -3.10275e-17 -1.35584e-16 -1.79983e-16 + 1.87790e-16 -3.73237e-02 + 3.50099e-17 5.02283e-16 4.89659e-17 4.20473e-01 -6.42431e-16 6.53570e-17 7.68029e-01 -4.77859e-16 + 7.44514e-17 -6.02710e-16 3.92223e-02 -2.06418e-16 5.22268e-16 1.17274e-16 -2.98389e-16 2.55229e-16 + -1.32848e-02 2.11141e-16 2.34662e-16 1.33548e-01 -4.24386e-17 8.33655e-17 1.77048e-16 -3.73237e-02 + 1.16255e-16 -1.75959e-16 + -2.45739e-16 5.15394e-16 1.23921e-16 -6.19012e-16 4.20473e-01 3.13748e-16 -4.21932e-16 7.68029e-01 + -7.52018e-16 3.92223e-02 5.77426e-16 1.80699e-16 3.27012e-16 -1.27673e-16 2.88227e-15 2.78740e-18 + 1.46663e-16 -1.32848e-02 1.71206e-16 -2.33418e-16 1.33548e-01 3.18598e-16 -3.73237e-02 3.16377e-16 + -2.87937e-16 -1.35018e-16 + 3.36091e-15 3.03382e-15 8.60500e-16 -1.35223e-16 -5.01342e-16 1.53417e-16 -1.09504e-16 -6.64572e-16 + 1.45535e+00 8.23451e-17 2.44825e-16 7.57905e-16 2.75717e-16 2.27368e-15 5.72819e-15 7.36268e-17 + 1.41034e-16 3.33928e-16 3.15408e-16 1.70809e-16 2.11572e-16 -2.96562e-01 1.34799e-16 1.51040e-16 + -4.71002e-17 -2.83556e-16 + -4.48370e-16 -4.92060e-16 -3.19375e-16 -1.44363e-16 6.39675e-02 -6.85729e-16 -7.51162e-16 3.92223e-02 + 1.03721e-16 1.40881e+00 -1.80621e-16 5.57744e-16 2.84537e-17 -2.26363e-16 -6.69415e-16 -3.36192e-17 + 5.98201e-17 1.77608e-01 1.89256e-18 1.32914e-16 3.73237e-02 -1.77160e-16 1.12412e-01 -1.01632e-17 + 1.24611e-16 3.84353e-16 + -1.02584e-15 -9.67900e-16 -7.46015e-16 6.39675e-02 -2.69794e-16 -8.76237e-16 3.92223e-02 5.57020e-16 + 2.39311e-16 -3.00202e-16 1.40881e+00 -4.08780e-16 -5.31947e-17 -1.47118e-16 -7.82400e-16 1.04326e-16 + 1.77608e-01 -4.61412e-17 3.28283e-17 3.73237e-02 1.08926e-16 -2.10236e-16 -4.17238e-16 1.12412e-01 + -8.14535e-17 6.40156e-16 + 2.39150e-15 2.15053e-15 -1.14916e-16 -2.92750e-16 1.25540e-15 -1.87782e-16 1.57992e-17 3.65495e-16 + 6.40516e-16 4.71640e-16 -4.41066e-16 1.45535e+00 -5.69792e-17 1.66508e-15 3.19870e-15 5.38395e-18 + -1.46965e-17 -1.23196e-16 7.48997e-18 1.58075e-16 -1.60324e-16 -3.75181e-17 -2.82461e-16 3.40662e-17 + -2.96562e-01 5.91987e-17 + 7.56858e-16 5.82164e-16 6.39675e-02 6.26908e-16 3.98255e-16 3.92223e-02 5.73038e-16 4.36352e-17 + 2.70211e-16 1.56317e-16 -1.01862e-16 -4.72096e-17 1.40881e+00 7.22132e-16 1.74785e-15 1.77608e-01 + -2.62450e-17 -9.86635e-17 3.73237e-02 1.15771e-17 -1.06795e-16 -1.35978e-16 -2.83979e-16 -7.57670e-16 + 1.16235e-17 1.12412e-01 + -5.55603e-01 -4.17916e-01 1.67587e-16 -3.60817e-16 2.55837e-16 5.61299e-16 1.66977e-16 -1.96458e-16 + 2.27347e-15 -7.76790e-17 -1.76757e-16 1.66361e-15 7.32176e-16 -3.31965e-01 -7.79032e-01 -4.77921e-16 + 3.59861e-16 -3.06597e-16 6.15892e-16 5.65821e-16 6.67677e-16 -3.23957e-15 4.47655e-16 3.16726e-16 + -1.18618e-15 -4.02679e-16 + -4.17916e-01 9.78287e-02 6.46030e-16 -6.11047e-16 -2.20354e-16 -1.24761e-15 -3.55551e-16 2.99115e-15 + 5.73199e-15 -6.54206e-16 -7.68742e-16 3.20018e-15 1.74057e-15 -7.79032e-01 8.97099e-01 1.10105e-16 + 1.99844e-16 -1.28137e-17 8.03089e-16 2.33239e-17 -3.99414e-16 -2.51380e-15 6.40146e-17 1.35059e-16 + -1.48169e-15 -1.62123e-16 + -1.56387e-17 7.65679e-16 -4.12885e-02 1.44606e-16 1.12625e-16 -1.32848e-02 2.63217e-16 3.47248e-18 + 1.00030e-16 -4.42931e-17 1.17060e-16 5.56282e-18 1.77608e-01 -3.22821e-16 -2.68577e-16 3.88002e-01 + -5.81474e-17 -3.45990e-16 4.20473e-01 -1.13683e-16 -4.06780e-16 -2.73023e-16 -1.68510e-16 -9.66326e-16 + 1.32908e-17 -6.39675e-02 + -5.36144e-16 -4.33551e-18 -2.67352e-16 -4.12885e-02 5.74768e-17 -3.31601e-16 -1.32848e-02 1.65780e-16 + 1.41927e-16 6.24547e-17 1.77608e-01 -1.13204e-17 -2.55932e-17 -3.90554e-17 9.95259e-17 1.76547e-17 + 3.88002e-01 2.13913e-16 -1.58760e-16 4.20473e-01 6.29096e-16 -2.41819e-16 -5.25455e-18 -6.39675e-02 + -5.30959e-16 8.89397e-16 + 3.16343e-16 -1.21418e-16 -3.17000e-16 2.74591e-16 -4.12885e-02 -3.48117e-16 2.33076e-16 -1.32848e-02 + 3.36450e-16 1.77608e-01 -6.99069e-17 -1.24577e-16 -9.49988e-17 -1.21755e-16 4.23036e-17 -3.42437e-16 + 9.31621e-17 3.88002e-01 -5.31187e-16 5.23704e-16 4.20473e-01 -2.49968e-16 -6.39675e-02 8.97634e-17 + 4.00747e-16 4.52145e-16 + -5.52025e-17 9.38777e-19 -1.32848e-02 8.50772e-17 8.24412e-18 1.33548e-01 2.26814e-16 1.37420e-16 + 3.19634e-16 -1.18037e-17 5.78002e-17 1.22717e-17 3.73237e-02 1.37324e-15 4.63672e-16 4.20473e-01 + -5.38150e-17 -3.62577e-16 7.68029e-01 -2.87970e-16 -3.29129e-16 1.30233e-16 -2.17522e-16 -6.91994e-16 + 6.01608e-17 -3.92223e-02 + -1.42448e-18 -1.31773e-16 -2.96887e-16 -1.32848e-02 3.46525e-17 -3.25236e-16 1.33548e-01 -2.33376e-16 + 1.85013e-16 1.11520e-16 3.73237e-02 1.53364e-16 1.08670e-17 5.43688e-16 6.79846e-17 -2.54957e-18 + 4.20473e-01 4.75781e-16 -2.38415e-16 7.68029e-01 6.83567e-16 -1.59436e-16 3.81818e-16 -3.92223e-02 + 1.28003e-16 5.68177e-17 + 9.26010e-19 8.08790e-16 -7.70197e-17 1.01323e-16 -1.32848e-02 -5.85322e-17 -1.96290e-17 1.33548e-01 + 2.10215e-16 3.73237e-02 1.07834e-16 -1.81833e-16 -1.19760e-16 -1.35096e-17 -5.20650e-16 -2.80368e-16 + 6.81434e-16 4.20473e-01 -5.46551e-16 6.88089e-16 7.68029e-01 -9.08291e-16 -3.92223e-02 1.53151e-16 + 6.77509e-16 9.04593e-16 + -1.93806e-15 -5.27537e-15 -5.37521e-17 1.98181e-16 2.23794e-16 -4.65284e-17 7.92505e-17 3.10346e-16 + -2.96562e-01 -1.65323e-16 -2.14140e-16 -3.61515e-17 -1.65128e-16 -3.06491e-15 -2.42537e-15 3.14864e-17 + -2.84939e-16 -2.40571e-16 1.99365e-16 -3.04204e-16 -7.55615e-16 1.45535e+00 -5.34133e-17 -1.73786e-16 + -9.19799e-16 -4.31431e-16 + -2.17328e-16 3.06197e-16 -9.75320e-18 1.10172e-16 -1.77608e-01 -1.57662e-16 1.62952e-16 -3.73237e-02 + 1.46263e-16 1.12412e-01 -3.79172e-16 -2.82263e-16 -2.98489e-16 5.05300e-16 1.29738e-16 -1.89581e-16 + -2.87869e-16 -6.39675e-02 -4.15669e-17 4.24825e-16 -3.92223e-02 -6.80027e-17 1.40881e+00 -1.10806e-16 + -4.60141e-16 -2.98548e-17 + 1.23504e-16 6.41363e-16 6.27223e-17 -1.77608e-01 3.82707e-17 -1.89951e-16 -3.73237e-02 2.58643e-16 + 1.47680e-16 2.79594e-17 1.12412e-01 2.14570e-17 -7.51769e-16 3.96957e-16 1.95768e-16 -7.97987e-16 + -6.39675e-02 -3.20598e-16 -9.53527e-16 -3.92223e-02 2.22926e-16 -1.71157e-16 6.56718e-18 1.40881e+00 + 3.16089e-16 1.47268e-16 + -8.09044e-16 -2.11264e-15 -5.49124e-18 1.09830e-16 -1.75637e-16 1.82426e-16 1.27692e-16 -2.78326e-16 + -4.57293e-17 1.23970e-16 -9.47179e-17 -2.96562e-01 1.20795e-17 -1.18875e-15 -1.46325e-15 1.21099e-17 + -4.32077e-16 5.76512e-16 1.00370e-16 1.15539e-16 5.47778e-16 -8.01997e-16 -4.33696e-16 3.91886e-16 + 1.45535e+00 2.26346e-17 + 2.11864e-16 -1.26278e-15 -1.77608e-01 -1.93471e-16 -2.62757e-16 -3.73237e-02 -1.66241e-16 -1.27803e-16 + -3.10689e-16 3.67214e-16 6.45067e-16 6.04994e-17 1.12412e-01 -3.26660e-16 -7.12638e-16 -6.39675e-02 + 1.15657e-15 5.47625e-16 -3.92223e-02 1.62937e-16 9.49250e-16 -2.84534e-16 -2.00704e-16 1.40754e-16 + 2.77536e-17 1.40881e+00 +Ionic_Step 2 + 2 # number of spin directions + 2 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.673893 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.999239976680832 9.51223761414047e-05 0.00100497682545176 + 0.250760023319168 0.249904877623859 0.248995023174548 + + + -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 + 1.29060e-06 -4.54077e-04 -2.04377e-03 -6.65949e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 + -4.55962e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03279e-07 -1.41355e-04 -6.41200e-04 + -1.56402e-06 -3.87188e-04 + -7.79028e-01 8.97123e-01 4.13307e-04 6.86256e-04 1.47125e-04 7.09644e-04 1.17520e-03 2.58861e-04 + 1.77154e-06 -6.22558e-04 -2.76649e-03 -9.13822e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06321e-04 + -1.33809e-03 -2.88399e-04 -9.84176e-04 -1.63254e-03 -3.52931e-04 2.06956e-06 -1.13641e-03 -5.12939e-03 + -1.06781e-05 -3.09870e-03 + 7.14820e-04 4.13307e-04 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 + -3.25348e-04 -1.17981e-03 -2.58009e-04 -5.95575e-09 6.39657e-02 2.74471e-04 8.06321e-04 -4.12847e-02 + 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76787e-05 -1.63821e-06 + 1.37450e-08 -1.77600e-01 + 1.18605e-03 6.86256e-04 1.40071e-04 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 + 2.70768e-04 -7.11915e-04 6.39648e-02 -4.68991e-04 -2.58007e-04 4.55962e-04 1.33809e-03 8.85830e-05 + -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 + -1.08231e-03 -1.63538e-06 + 2.55953e-04 1.47125e-04 6.34090e-04 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 + 5.63204e-05 6.39662e-02 -7.11924e-04 9.75469e-05 -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 + 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 + 2.41913e-04 -2.76818e-05 + 6.52114e-04 7.09644e-04 4.20466e-01 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 + -3.73139e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 3.70128e-04 9.84176e-04 -1.32862e-02 + -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 -2.46734e-04 1.23775e-03 2.77049e-04 + -6.77316e-08 -3.73208e-02 + 1.08200e-03 1.17520e-03 1.25460e-04 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 + 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 1.63254e-03 -1.30073e-05 + -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 7.48438e-04 -3.73229e-02 + -3.53044e-04 2.77042e-04 + 2.33122e-04 2.58861e-04 5.71676e-04 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 + 6.53007e-05 3.92225e-02 -5.38757e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 -5.42821e-05 + -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 7.48456e-04 + 7.96386e-05 1.23776e-03 + 1.29060e-06 1.77154e-06 -3.25348e-04 2.70768e-04 5.63204e-05 -3.73139e-04 3.10164e-04 6.53007e-05 + 1.45533e+00 1.53175e-04 6.95612e-04 -3.63981e-06 -8.39996e-04 3.03279e-07 2.06956e-06 7.55635e-04 + -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05264e-05 -2.09649e-04 + -1.31157e-05 2.55314e-04 + -4.54077e-04 -6.22558e-04 -1.17981e-03 -7.11915e-04 6.39662e-02 -8.94447e-04 -5.39028e-04 3.92225e-02 + 1.53175e-04 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76787e-05 + 1.56033e-05 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05264e-05 1.12402e-01 8.72792e-04 + -8.74755e-05 1.44211e-03 + -2.04377e-03 -2.76649e-03 -2.58009e-04 6.39648e-02 -7.11924e-04 -1.92124e-04 3.92242e-02 -5.38757e-04 + 6.95612e-04 4.37699e-04 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63821e-06 + 1.77599e-01 1.56095e-05 -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09649e-04 8.72792e-04 1.12414e-01 + 3.63217e-04 3.26121e-04 + -6.65949e-06 -9.13822e-06 -5.95575e-09 -4.68991e-04 9.75469e-05 -1.06387e-07 -5.37336e-04 1.13051e-04 + -3.63981e-06 2.65302e-04 -1.20485e-03 1.45534e+00 -1.07580e-08 -1.56402e-06 -1.06781e-05 -1.37450e-08 + 1.08231e-03 -2.41913e-04 6.77316e-08 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74755e-05 3.63217e-04 + -2.96546e-01 8.50121e-08 + -1.23499e-03 -1.67365e-03 6.39657e-02 -2.58007e-04 -1.17981e-03 3.92231e-02 -1.92190e-04 -8.94299e-04 + -8.39996e-04 7.22291e-04 1.65475e-04 -1.07580e-08 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 + 1.63538e-06 2.76818e-05 3.73208e-02 -2.77042e-04 -1.23776e-03 2.55314e-04 1.44211e-03 3.26121e-04 + 8.50121e-08 1.12406e-01 + -5.55607e-01 -4.17915e-01 2.74471e-04 4.55962e-04 9.71044e-05 3.70128e-04 6.13802e-04 1.32976e-04 + 3.03279e-07 -1.41355e-04 -6.41200e-04 -1.56402e-06 -3.87188e-04 -3.31973e-01 -7.79028e-01 -7.14820e-04 + -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 1.29060e-06 -4.54077e-04 -2.04377e-03 + -6.65949e-06 -1.23499e-03 + -4.17915e-01 9.78578e-02 8.06321e-04 1.33809e-03 2.88399e-04 9.84176e-04 1.63254e-03 3.52931e-04 + 2.06956e-06 -1.13641e-03 -5.12939e-03 -1.06781e-05 -3.09870e-03 -7.79028e-01 8.97123e-01 -4.13307e-04 + -6.86256e-04 -1.47125e-04 -7.09644e-04 -1.17520e-03 -2.58861e-04 1.77154e-06 -6.22558e-04 -2.76649e-03 + -9.13822e-06 -1.67365e-03 + -2.74471e-04 -8.06321e-04 -4.12847e-02 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 + 7.55635e-04 2.76787e-05 1.63821e-06 -1.37450e-08 1.77600e-01 -7.14820e-04 -4.13307e-04 3.87997e-01 + 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 2.58009e-04 + 5.95575e-09 -6.39657e-02 + -4.55962e-04 -1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 + -6.24881e-04 1.56033e-05 1.77599e-01 1.08231e-03 1.63538e-06 -1.18605e-03 -6.86256e-04 1.40071e-04 + 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 + 4.68991e-04 2.58007e-04 + -9.71044e-05 -2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30854e-05 -1.32861e-02 + -1.39665e-04 1.77601e-01 1.56095e-05 -2.41913e-04 2.76818e-05 -2.55953e-04 -1.47125e-04 6.34090e-04 + 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63204e-05 -6.39662e-02 7.11924e-04 + -9.75469e-05 1.17981e-03 + -3.70128e-04 -9.84176e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 + 2.46734e-04 -1.23775e-03 -2.77049e-04 6.77316e-08 3.73208e-02 -6.52114e-04 -7.09644e-04 4.20466e-01 + 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 3.73139e-04 8.94447e-04 1.92124e-04 + 1.06387e-07 -3.92231e-02 + -6.13802e-04 -1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30854e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 + -2.03789e-04 -7.48438e-04 3.73229e-02 3.53044e-04 -2.77042e-04 -1.08200e-03 -1.17520e-03 1.25460e-04 + 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 + 5.37336e-04 1.92190e-04 + -1.32976e-04 -3.52931e-04 -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 + -4.60000e-05 3.73197e-02 -7.48456e-04 -7.96386e-05 -1.23776e-03 -2.33122e-04 -2.58861e-04 5.71676e-04 + 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 -6.53007e-05 -3.92225e-02 5.38757e-04 + -1.13051e-04 8.94299e-04 + 3.03279e-07 2.06956e-06 -7.55635e-04 6.24881e-04 1.39665e-04 -2.46734e-04 2.03789e-04 4.60000e-05 + -2.96551e-01 -5.05264e-05 -2.09649e-04 -1.31157e-05 2.55314e-04 1.29060e-06 1.77154e-06 3.25348e-04 + -2.70768e-04 -5.63204e-05 3.73139e-04 -3.10164e-04 -6.53007e-05 1.45533e+00 1.53175e-04 6.95612e-04 + -3.63981e-06 -8.39996e-04 + -1.41355e-04 -1.13641e-03 -2.76787e-05 -1.56033e-05 -1.77601e-01 1.23775e-03 7.48438e-04 -3.73197e-02 + -5.05264e-05 1.12402e-01 8.72792e-04 -8.74755e-05 1.44211e-03 -4.54077e-04 -6.22558e-04 1.17981e-03 + 7.11915e-04 -6.39662e-02 8.94447e-04 5.39028e-04 -3.92225e-02 1.53175e-04 1.40881e+00 4.37699e-04 + 2.65302e-04 7.22291e-04 + -6.41200e-04 -5.12939e-03 -1.63821e-06 -1.77599e-01 -1.56095e-05 2.77049e-04 -3.73229e-02 7.48456e-04 + -2.09649e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -2.04377e-03 -2.76649e-03 2.58009e-04 + -6.39648e-02 7.11924e-04 1.92124e-04 -3.92242e-02 5.38757e-04 6.95612e-04 4.37699e-04 1.40880e+00 + -1.20485e-03 1.65475e-04 + -1.56402e-06 -1.06781e-05 1.37450e-08 -1.08231e-03 2.41913e-04 -6.77316e-08 -3.53044e-04 7.96386e-05 + -1.31157e-05 -8.74755e-05 3.63217e-04 -2.96546e-01 8.50121e-08 -6.65949e-06 -9.13822e-06 5.95575e-09 + 4.68991e-04 -9.75469e-05 1.06387e-07 5.37336e-04 -1.13051e-04 -3.63981e-06 2.65302e-04 -1.20485e-03 + 1.45534e+00 -1.07580e-08 + -3.87188e-04 -3.09870e-03 -1.77600e-01 -1.63538e-06 -2.76818e-05 -3.73208e-02 2.77042e-04 1.23776e-03 + 2.55314e-04 1.44211e-03 3.26121e-04 8.50121e-08 1.12406e-01 -1.23499e-03 -1.67365e-03 -6.39657e-02 + 2.58007e-04 1.17981e-03 -3.92231e-02 1.92190e-04 8.94299e-04 -8.39996e-04 7.22291e-04 1.65475e-04 + -1.07580e-08 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/s_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/s_nao.txt.ref new file mode 100644 index 00000000000..8408746bf30 --- /dev/null +++ b/tests/02_NAO_Gamma/md_out_hk_spin2/s_nao.txt.ref @@ -0,0 +1,258 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + 1.48885e+00 1.85694e+00 8.79559e-18 -8.67362e-19 6.76271e-18 -6.86707e-17 4.98733e-18 -6.78982e-18 + 9.54267e-18 5.20417e-18 -5.71917e-18 -2.96140e-17 -9.62229e-19 1.23629e+00 2.25011e+00 8.17971e-17 + 9.06241e-18 -1.25081e-17 -5.22789e-18 4.28573e-17 -1.33018e-16 5.56403e-17 -9.79869e-18 1.22566e-18 + 4.95550e-17 -2.83767e-17 + 1.85694e+00 4.31653e+00 5.50233e-17 2.21177e-17 -2.85687e-17 2.53703e-17 -7.45931e-17 4.11997e-18 + 4.21348e-17 3.68629e-18 1.35525e-18 -8.13152e-17 1.09504e-17 2.25011e+00 3.67664e+00 -1.41895e-17 + 2.79267e-17 1.89735e-19 -3.31657e-16 1.19845e-16 2.49800e-16 -7.89977e-17 -4.11861e-17 2.12300e-17 + -1.47435e-16 -1.02034e-17 + -8.79559e-18 -5.50233e-17 5.44536e-01 2.47198e-17 -1.72659e-17 5.83149e-01 6.15827e-17 -7.64363e-17 + -2.20229e-19 -3.46945e-18 1.51788e-18 5.96311e-19 -5.42101e-20 -8.17971e-17 1.41895e-17 -1.24841e-01 + -7.45389e-20 2.34662e-17 -1.17065e-01 5.40204e-17 -6.45507e-17 -2.23447e-17 5.92923e-21 -2.25988e-18 + -4.57398e-19 -4.82752e-01 + 8.67362e-19 -2.21177e-17 2.47198e-17 5.44536e-01 0.00000e+00 6.15827e-17 5.83149e-01 -5.63785e-18 + 1.05710e-18 8.93112e-18 5.42101e-20 -2.20906e-18 -3.38136e-18 -9.06241e-18 -2.79267e-17 -7.45389e-20 + -1.24841e-01 2.74777e-17 5.40204e-17 -1.17065e-01 8.89215e-18 -1.43928e-17 1.61699e-18 -4.82752e-01 + 9.48889e-19 2.65968e-19 + -6.76271e-18 2.85687e-17 -1.72659e-17 0.00000e+00 5.44536e-01 -7.64363e-17 -5.63785e-18 5.83149e-01 + 5.65818e-19 5.42101e-20 -2.66985e-18 -5.02799e-18 2.08709e-18 1.25081e-17 -1.89735e-19 2.34662e-17 + 2.74777e-17 -1.24841e-01 -6.45507e-17 8.89215e-18 -1.17065e-01 9.34955e-18 -4.82752e-01 -8.71766e-18 + 1.44860e-17 3.67697e-18 + 6.86707e-17 -2.53703e-17 5.83149e-01 6.15827e-17 -7.64363e-17 6.96122e-01 -2.94903e-17 3.81639e-17 + -4.94667e-18 3.90313e-18 -6.72205e-18 -5.69206e-19 0.00000e+00 5.22789e-18 3.31657e-16 -1.17065e-01 + 5.40204e-17 -6.45507e-17 -6.46175e-02 1.24277e-17 -1.21431e-17 -6.24772e-18 1.68153e-17 1.99222e-18 + 1.02322e-18 -4.19177e-01 + -4.98733e-18 7.45931e-17 6.15827e-17 5.83149e-01 -5.63785e-18 -2.94903e-17 6.96122e-01 5.29091e-17 + 1.62630e-18 4.30970e-18 0.00000e+00 -2.65630e-18 -7.18284e-19 -4.28573e-17 -1.19845e-16 5.40204e-17 + -1.17065e-01 8.89215e-18 1.24277e-17 -6.46175e-02 2.30800e-17 4.54179e-18 4.22500e-18 -4.19177e-01 + -3.81927e-18 4.40457e-20 + 6.78982e-18 -4.11997e-18 -7.64363e-17 -5.63785e-18 5.83149e-01 3.81639e-17 5.29091e-17 6.96122e-01 + 3.29326e-18 0.00000e+00 -9.75782e-19 1.35525e-18 7.35902e-18 1.33018e-16 -2.49800e-16 -6.45507e-17 + 8.89215e-18 -1.17065e-01 -1.21431e-17 2.30800e-17 -6.46175e-02 1.08081e-17 -4.19177e-01 2.66714e-17 + -1.25513e-17 2.77945e-17 + 9.54267e-18 4.21348e-17 2.20229e-19 -1.05710e-18 -5.65818e-19 4.94667e-18 -1.62630e-18 -3.29326e-18 + 9.91168e-01 2.71051e-18 -3.28988e-18 2.75252e-17 -7.01343e-19 5.56403e-17 -7.89977e-17 2.23447e-17 + 1.43928e-17 -9.34955e-18 6.24772e-18 -4.54179e-18 -1.08081e-17 -5.10937e-01 -3.59735e-18 5.68020e-18 + -6.22557e-17 -1.80863e-17 + 5.20417e-18 3.68629e-18 3.46945e-18 -8.93112e-18 -5.42101e-20 -3.90313e-18 -4.30970e-18 0.00000e+00 + 2.71051e-18 1.13701e+00 3.11708e-19 -7.48777e-19 1.83806e-18 -9.79869e-18 -4.11861e-17 -5.92923e-21 + -1.61699e-18 4.82752e-01 -1.68153e-17 -4.22500e-18 4.19177e-01 -3.59735e-18 1.32237e-01 1.16772e-17 + 1.50878e-17 -1.23222e-17 + -5.71917e-18 1.35525e-18 -1.51788e-18 -5.42101e-20 2.66985e-18 6.72205e-18 0.00000e+00 9.75782e-19 + -3.28988e-18 3.11708e-19 1.13701e+00 -1.41624e-18 -2.61564e-18 1.22566e-18 2.12300e-17 2.25988e-18 + 4.82752e-01 8.71766e-18 -1.99222e-18 4.19177e-01 -2.66714e-17 5.68020e-18 1.16772e-17 1.32237e-01 + 2.82155e-17 9.20301e-18 + -2.96140e-17 -8.13152e-17 -5.96311e-19 2.20906e-18 5.02799e-18 5.69206e-19 2.65630e-18 -1.35525e-18 + 2.75252e-17 -7.48777e-19 -1.41624e-18 9.91168e-01 2.16091e-20 4.95550e-17 -1.47435e-16 4.57398e-19 + -9.48889e-19 -1.44860e-17 -1.02322e-18 3.81927e-18 1.25513e-17 -6.22557e-17 1.50878e-17 2.82155e-17 + -5.10937e-01 -7.46448e-20 + -9.62229e-19 1.09504e-17 5.42101e-20 3.38136e-18 -2.08709e-18 0.00000e+00 7.18284e-19 -7.35902e-18 + -7.01343e-19 1.83806e-18 -2.61564e-18 2.16091e-20 1.13701e+00 -2.83767e-17 -1.02034e-17 4.82752e-01 + -2.65968e-19 -3.67697e-18 4.19177e-01 -4.40457e-20 -2.77945e-17 -1.80863e-17 -1.23222e-17 9.20301e-18 + -7.46448e-20 1.32237e-01 + 1.23629e+00 2.25011e+00 -9.87420e-17 7.25823e-18 -1.18288e-17 8.68920e-17 -1.38582e-16 1.35132e-16 + 5.52435e-17 -8.73185e-18 5.10761e-18 4.93297e-17 -2.35710e-17 1.48885e+00 1.85694e+00 8.79559e-18 + -8.67362e-19 6.76271e-18 -6.86707e-17 4.98733e-18 -6.78982e-18 9.54267e-18 5.20417e-18 -5.71917e-18 + -2.96140e-17 -9.62229e-19 + 2.25011e+00 3.67664e+00 -2.50993e-17 1.20279e-19 -3.93362e-17 3.87060e-16 -5.51588e-18 -3.72044e-16 + -8.80101e-17 -4.73932e-17 1.10318e-17 -1.42674e-16 -1.59954e-17 1.85694e+00 4.31653e+00 5.50233e-17 + 2.21177e-17 -2.85687e-17 2.53703e-17 -7.45931e-17 4.11997e-18 4.21348e-17 3.68629e-18 1.35525e-18 + -8.13152e-17 1.09504e-17 + 9.87420e-17 2.50993e-17 -1.24841e-01 -1.14858e-17 2.02610e-18 -1.17065e-01 3.41930e-17 -5.66496e-17 + -6.96600e-18 1.37982e-18 2.14469e-18 5.68359e-19 4.82752e-01 -8.79559e-18 -5.50233e-17 5.44536e-01 + 2.47198e-17 -1.72659e-17 5.83149e-01 6.15827e-17 -7.64363e-17 -2.20229e-19 -3.46945e-18 1.51788e-18 + 5.96311e-19 -5.42101e-20 + -7.25823e-18 -1.20279e-19 -1.14858e-17 -1.24841e-01 2.28970e-17 3.41930e-17 -1.17065e-01 -6.75593e-18 + 1.54109e-17 -9.61806e-18 4.82752e-01 -5.37548e-18 2.91888e-18 8.67362e-19 -2.21177e-17 2.47198e-17 + 5.44536e-01 0.00000e+00 6.15827e-17 5.83149e-01 -5.63785e-18 1.05710e-18 8.93112e-18 5.42101e-20 + -2.20906e-18 -3.38136e-18 + 1.18288e-17 3.93362e-17 2.02610e-18 2.28970e-17 -1.24841e-01 -5.66496e-17 -6.75593e-18 -1.17065e-01 + -8.86674e-18 4.82752e-01 -4.63835e-18 -1.30591e-17 -1.09737e-17 -6.76271e-18 2.85687e-17 -1.72659e-17 + 0.00000e+00 5.44536e-01 -7.64363e-17 -5.63785e-18 5.83149e-01 5.65818e-19 5.42101e-20 -2.66985e-18 + -5.02799e-18 2.08709e-18 + -8.68920e-17 -3.87060e-16 -1.17065e-01 3.41930e-17 -5.66496e-17 -6.46175e-02 2.45436e-17 1.32815e-17 + 2.05727e-17 -1.10284e-17 2.69695e-18 -7.65718e-19 4.19177e-01 6.86707e-17 -2.53703e-17 5.83149e-01 + 6.15827e-17 -7.64363e-17 6.96122e-01 -2.94903e-17 3.81639e-17 -4.94667e-18 3.90313e-18 -6.72205e-18 + -5.69206e-19 0.00000e+00 + 1.38582e-16 5.51588e-18 3.41930e-17 -1.17065e-01 -6.75593e-18 2.45436e-17 -6.46175e-02 1.83095e-17 + 3.85400e-18 -7.36919e-18 4.19177e-01 1.43022e-17 2.14638e-17 -4.98733e-18 7.45931e-17 6.15827e-17 + 5.83149e-01 -5.63785e-18 -2.94903e-17 6.96122e-01 5.29091e-17 1.62630e-18 4.30970e-18 0.00000e+00 + -2.65630e-18 -7.18284e-19 + -1.35132e-16 3.72044e-16 -5.66496e-17 -6.75593e-18 -1.17065e-01 1.32815e-17 1.83095e-17 -6.46175e-02 + -6.62041e-18 4.19177e-01 -1.60597e-17 1.25547e-17 -2.47469e-17 6.78982e-18 -4.11997e-18 -7.64363e-17 + -5.63785e-18 5.83149e-01 3.81639e-17 5.29091e-17 6.96122e-01 3.29326e-18 0.00000e+00 -9.75782e-19 + 1.35525e-18 7.35902e-18 + 5.52435e-17 -8.80101e-17 6.96600e-18 -1.54109e-17 8.86674e-18 -2.05727e-17 -3.85400e-18 6.62041e-18 + -5.10937e-01 2.63512e-18 6.28329e-18 -6.24700e-17 -2.61538e-17 9.54267e-18 4.21348e-17 2.20229e-19 + -1.05710e-18 -5.65818e-19 4.94667e-18 -1.62630e-18 -3.29326e-18 9.91168e-01 2.71051e-18 -3.28988e-18 + 2.75252e-17 -7.01343e-19 + -8.73185e-18 -4.73932e-17 -1.37982e-18 9.61806e-18 -4.82752e-01 1.10284e-17 7.36919e-18 -4.19177e-01 + 2.63512e-18 1.32237e-01 1.48807e-17 1.41488e-17 -1.45990e-17 5.20417e-18 3.68629e-18 3.46945e-18 + -8.93112e-18 -5.42101e-20 -3.90313e-18 -4.30970e-18 0.00000e+00 2.71051e-18 1.13701e+00 3.11708e-19 + -7.48777e-19 1.83806e-18 + 5.10761e-18 1.10318e-17 -2.14469e-18 -4.82752e-01 4.63835e-18 -2.69695e-18 -4.19177e-01 1.60597e-17 + 6.28329e-18 1.48807e-17 1.32237e-01 2.20229e-17 5.83648e-18 -5.71917e-18 1.35525e-18 -1.51788e-18 + -5.42101e-20 2.66985e-18 6.72205e-18 0.00000e+00 9.75782e-19 -3.28988e-18 3.11708e-19 1.13701e+00 + -1.41624e-18 -2.61564e-18 + 4.93297e-17 -1.42674e-16 -5.68359e-19 5.37548e-18 1.30591e-17 7.65718e-19 -1.43022e-17 -1.25547e-17 + -6.24700e-17 1.41488e-17 2.20229e-17 -5.10937e-01 4.15046e-20 -2.96140e-17 -8.13152e-17 -5.96311e-19 + 2.20906e-18 5.02799e-18 5.69206e-19 2.65630e-18 -1.35525e-18 2.75252e-17 -7.48777e-19 -1.41624e-18 + 9.91168e-01 2.16091e-20 + -2.35710e-17 -1.59954e-17 -4.82752e-01 -2.91888e-18 1.09737e-17 -4.19177e-01 -2.14638e-17 2.47469e-17 + -2.61538e-17 -1.45990e-17 5.83648e-18 4.15046e-20 1.32237e-01 -9.62229e-19 1.09504e-17 5.42101e-20 + 3.38136e-18 -2.08709e-18 0.00000e+00 7.18284e-19 -7.35902e-18 -7.01343e-19 1.83806e-18 -2.61564e-18 + 2.16091e-20 1.13701e+00 +Ionic_Step 2 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.999239976680832 9.51223761414047e-05 0.00100497682545176 + 0.250760023319168 0.249904877623859 0.248995023174548 + + + 1.48885e+00 1.85694e+00 8.79559e-18 -1.30104e-18 6.76271e-18 -6.86707e-17 6.72205e-18 -6.78982e-18 + 9.56978e-18 8.61941e-18 -5.71917e-18 -2.95869e-17 2.39880e-18 1.23629e+00 2.25011e+00 3.55178e-04 + 5.90487e-04 1.24492e-04 4.28563e-04 7.11768e-04 1.51827e-04 -1.15453e-06 5.48551e-04 2.46587e-03 + 5.95842e-06 1.49023e-03 + 1.85694e+00 4.31653e+00 5.50233e-17 -3.51282e-17 -2.85687e-17 2.53703e-17 -6.76542e-17 4.11997e-18 + 4.21348e-17 1.14925e-17 1.35525e-18 -8.10983e-17 1.74557e-17 2.25011e+00 3.67665e+00 -4.79392e-04 + -7.97562e-04 -1.66751e-04 -5.39661e-04 -8.97294e-04 -1.88913e-04 1.57125e-06 -8.79829e-04 -3.96682e-03 + -8.10910e-06 -2.39668e-03 + -8.79559e-18 -5.50233e-17 5.44536e-01 4.07660e-17 -1.72659e-17 5.83149e-01 5.63785e-17 -7.64363e-17 + -2.20229e-19 -1.08420e-17 1.51788e-18 5.14996e-19 -5.04154e-18 -3.55178e-04 4.79392e-04 -1.24838e-01 + 5.48802e-04 2.46888e-03 -1.17064e-01 4.87005e-04 2.19831e-03 -1.79153e-03 4.75245e-04 1.17592e-04 + -1.72936e-08 -4.82737e-01 + 1.30104e-18 3.51282e-17 4.07660e-17 5.44536e-01 1.38778e-17 5.63785e-17 5.83149e-01 -3.33934e-17 + -2.68340e-18 8.93112e-18 -4.82470e-18 1.20617e-18 -3.38136e-18 -5.90487e-04 7.97562e-04 5.48802e-04 + -1.24830e-01 1.49195e-03 4.87005e-04 -1.17055e-01 1.32804e-03 1.48203e-03 2.90121e-04 -4.82737e-01 + -2.56697e-03 1.17583e-04 + -6.76271e-18 2.85687e-17 -1.72659e-17 1.38778e-17 5.44536e-01 -7.64363e-17 -3.33934e-17 5.83149e-01 + 5.11608e-19 -4.82470e-18 -2.45301e-18 -5.02799e-18 -4.74338e-18 -1.24492e-04 1.66751e-04 2.46888e-03 + 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 -1.17068e-01 3.30013e-04 -4.82737e-01 2.90156e-04 + 5.71591e-04 4.75264e-04 + 6.86707e-17 -2.53703e-17 5.83149e-01 5.63785e-17 -7.64363e-17 6.96122e-01 -1.56125e-17 3.81639e-17 + -4.94667e-18 6.07153e-18 -6.28837e-18 -2.98156e-19 6.93889e-18 -4.28563e-04 5.39661e-04 -1.17064e-01 + 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 -1.79747e-03 1.26928e-03 2.91200e-04 + -4.08999e-08 -4.19167e-01 + -6.72205e-18 6.76542e-17 5.63785e-17 5.83149e-01 -3.33934e-17 -1.56125e-17 6.96122e-01 8.06646e-17 + 9.86624e-18 4.30970e-18 7.37257e-18 -9.48677e-18 -7.18284e-19 -7.11768e-04 8.97294e-04 4.87005e-04 + -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 1.48692e-03 7.69230e-04 -4.19167e-01 + -2.57547e-03 2.91180e-04 + 6.78982e-18 -4.11997e-18 -7.64363e-17 -3.33934e-17 5.83149e-01 3.81639e-17 8.06646e-17 6.96122e-01 + 3.51010e-18 7.37257e-18 -1.40946e-18 1.35525e-18 6.92534e-18 -1.51827e-04 1.88913e-04 2.19831e-03 + 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 3.31113e-04 -4.19167e-01 7.69312e-04 + 5.73485e-04 1.26932e-03 + 9.56978e-18 4.21348e-17 2.20229e-19 2.68340e-18 -5.11608e-19 4.94667e-18 -9.86624e-18 -3.51010e-18 + 9.91168e-01 1.38236e-18 -3.31698e-18 2.75116e-17 -4.19790e-18 -1.15453e-06 1.57125e-06 1.79153e-03 + -1.48203e-03 -3.30013e-04 1.79747e-03 -1.48692e-03 -3.31113e-04 -5.10922e-01 -6.05774e-06 -1.33026e-06 + -1.76263e-05 4.43587e-06 + 8.61941e-18 1.14925e-17 1.08420e-17 -8.93112e-18 4.82470e-18 -6.07153e-18 -4.30970e-18 -7.37257e-18 + 1.38236e-18 1.13701e+00 -4.86536e-18 2.62580e-18 1.86517e-18 5.48551e-04 -8.79829e-04 -4.75245e-04 + -2.90121e-04 4.82737e-01 -1.26928e-03 -7.69230e-04 4.19167e-01 -6.05774e-06 1.32221e-01 2.17786e-03 + -1.04671e-05 3.60087e-03 + -5.71917e-18 1.35525e-18 -1.51788e-18 4.82470e-18 2.45301e-18 6.28837e-18 -7.37257e-18 1.40946e-18 + -3.31698e-18 -4.86536e-18 1.13701e+00 -1.41624e-18 -7.81981e-18 2.46587e-03 -3.96682e-03 -1.17592e-04 + 4.82737e-01 -2.90156e-04 -2.91200e-04 4.19167e-01 -7.69312e-04 -1.33026e-06 2.17786e-03 1.32237e-01 + 2.36050e-06 8.08017e-04 + -2.95869e-17 -8.10983e-17 -5.14996e-19 -1.20617e-18 5.02799e-18 2.98156e-19 9.48677e-18 -1.35525e-18 + 2.75116e-17 2.62580e-18 -1.41624e-18 9.91168e-01 3.15224e-18 5.95842e-06 -8.10910e-06 1.72936e-08 + 2.56697e-03 -5.71591e-04 4.08999e-08 2.57547e-03 -5.73485e-04 -1.76263e-05 -1.04671e-05 2.36050e-06 + -5.10916e-01 5.13066e-08 + 2.39880e-18 1.74557e-17 5.04154e-18 3.38136e-18 4.74338e-18 -6.93889e-18 7.18284e-19 -6.92534e-18 + -4.19790e-18 1.86517e-18 -7.81981e-18 3.15224e-18 1.13701e+00 1.49023e-03 -2.39668e-03 4.82737e-01 + -1.17583e-04 -4.75264e-04 4.19167e-01 -2.91180e-04 -1.26932e-03 4.43587e-06 3.60087e-03 8.08017e-04 + 5.13066e-08 1.32226e-01 + 1.23629e+00 2.25011e+00 -3.55178e-04 -5.90487e-04 -1.24492e-04 -4.28563e-04 -7.11768e-04 -1.51827e-04 + -1.15453e-06 5.48551e-04 2.46587e-03 5.95842e-06 1.49023e-03 1.48885e+00 1.85694e+00 1.15129e-17 + -1.11998e-16 -1.18314e-17 3.28107e-17 3.36753e-16 6.19215e-17 9.43425e-18 1.70762e-18 -6.10541e-18 + -4.71899e-17 -6.70172e-18 + 2.25011e+00 3.67665e+00 4.79392e-04 7.97562e-04 1.66751e-04 5.39661e-04 8.97294e-04 1.88913e-04 + 1.57125e-06 -8.79829e-04 -3.96682e-03 -8.10910e-06 -2.39668e-03 1.85694e+00 4.31653e+00 -4.85723e-17 + -1.45717e-16 -8.61941e-18 -2.42861e-17 -6.24500e-17 2.14889e-16 2.75116e-18 -4.11997e-18 1.30104e-18 + -2.86771e-17 -1.13841e-18 + 3.55178e-04 -4.79392e-04 -1.24838e-01 5.48802e-04 2.46888e-03 -1.17064e-01 4.87005e-04 2.19831e-03 + 1.79153e-03 -4.75245e-04 -1.17592e-04 1.72936e-08 4.82737e-01 -1.15129e-17 4.85723e-17 5.44536e-01 + 9.97466e-18 -2.24159e-17 5.83149e-01 8.93383e-17 -7.89841e-17 -4.70950e-19 -6.54316e-17 8.42967e-18 + 6.77626e-19 1.35525e-19 + 5.90487e-04 -7.97562e-04 5.48802e-04 -1.24830e-01 1.49195e-03 4.87005e-04 -1.17055e-01 1.32804e-03 + -1.48203e-03 -2.90121e-04 4.82737e-01 2.56697e-03 -1.17583e-04 1.11998e-16 1.45717e-16 9.97466e-18 + 5.44536e-01 -2.41777e-17 8.93383e-17 5.83149e-01 1.86483e-17 -4.00613e-17 2.07354e-18 -5.42101e-20 + 4.64852e-18 -3.51857e-18 + 1.24492e-04 -1.66751e-04 2.46888e-03 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 -1.17068e-01 + -3.30013e-04 4.82737e-01 -2.90156e-04 -5.71591e-04 -4.75264e-04 1.18314e-17 8.61941e-18 -2.24159e-17 + -2.41777e-17 5.44536e-01 -7.89841e-17 1.86483e-17 5.83149e-01 4.27582e-18 -5.42101e-20 -2.76472e-18 + 9.12763e-18 2.61564e-17 + 4.28563e-04 -5.39661e-04 -1.17064e-01 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 + 1.79747e-03 -1.26928e-03 -2.91200e-04 4.08999e-08 4.19167e-01 -3.28107e-17 2.42861e-17 5.83149e-01 + 8.93383e-17 -7.89841e-17 6.96122e-01 -9.02056e-17 8.02310e-18 -3.98444e-18 1.40946e-18 1.95156e-18 + 6.96600e-18 7.58942e-19 + 7.11768e-04 -8.97294e-04 4.87005e-04 -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 + -1.48692e-03 -7.69230e-04 4.19167e-01 2.57547e-03 -2.91180e-04 -3.36753e-16 6.24500e-17 8.93383e-17 + 5.83149e-01 1.86483e-17 -9.02056e-17 6.96122e-01 -8.15320e-17 7.54605e-17 3.60497e-18 1.08420e-19 + -6.49979e-17 -6.26804e-18 + 1.51827e-04 -1.88913e-04 2.19831e-03 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 + -3.31113e-04 4.19167e-01 -7.69312e-04 -5.73485e-04 -1.26932e-03 -6.19215e-17 -2.14889e-16 -7.89841e-17 + 1.86483e-17 5.83149e-01 8.02310e-18 -8.15320e-17 6.96122e-01 -1.17636e-17 1.08420e-19 -1.01915e-17 + -3.84892e-17 -1.08705e-16 + -1.15453e-06 1.57125e-06 -1.79153e-03 1.48203e-03 3.30013e-04 -1.79747e-03 1.48692e-03 3.31113e-04 + -5.10922e-01 -6.05774e-06 -1.33026e-06 -1.76263e-05 4.43587e-06 9.43425e-18 2.75116e-18 4.70950e-19 + 4.00613e-17 -4.27582e-18 3.98444e-18 -7.54605e-17 1.17636e-17 9.91168e-01 3.83537e-18 -1.99561e-18 + 8.43255e-17 1.47384e-18 + 5.48551e-04 -8.79829e-04 4.75245e-04 2.90121e-04 -4.82737e-01 1.26928e-03 7.69230e-04 -4.19167e-01 + -6.05774e-06 1.32221e-01 2.17786e-03 -1.04671e-05 3.60087e-03 1.70762e-18 -4.11997e-18 6.54316e-17 + -2.07354e-18 5.42101e-20 -1.40946e-18 -3.60497e-18 -1.08420e-19 3.83537e-18 1.13701e+00 5.62430e-18 + -4.35714e-18 2.43861e-18 + 2.46587e-03 -3.96682e-03 1.17592e-04 -4.82737e-01 2.90156e-04 2.91200e-04 -4.19167e-01 7.69312e-04 + -1.33026e-06 2.17786e-03 1.32237e-01 2.36050e-06 8.08017e-04 -6.10541e-18 1.30104e-18 -8.42967e-18 + 5.42101e-20 2.76472e-18 -1.95156e-18 -1.08420e-19 1.01915e-17 -1.99561e-18 5.62430e-18 1.13701e+00 + 1.15535e-18 6.57298e-18 + 5.95842e-06 -8.10910e-06 -1.72936e-08 -2.56697e-03 5.71591e-04 -4.08999e-08 -2.57547e-03 5.73485e-04 + -1.76263e-05 -1.04671e-05 2.36050e-06 -5.10916e-01 5.13066e-08 -4.71899e-17 -2.86771e-17 -6.77626e-19 + -4.64852e-18 -9.12763e-18 -6.96600e-18 6.49979e-17 3.84892e-17 8.43255e-17 -4.35714e-18 1.15535e-18 + 9.91168e-01 -2.37431e-18 + 1.49023e-03 -2.39668e-03 -4.82737e-01 1.17583e-04 4.75264e-04 -4.19167e-01 2.91180e-04 1.26932e-03 + 4.43587e-06 3.60087e-03 8.08017e-04 5.13066e-08 1.32226e-01 -6.70172e-18 -1.13841e-18 -1.35525e-19 + 3.51857e-18 -2.61564e-17 -7.58942e-19 6.26804e-18 1.08705e-16 1.47384e-18 2.43861e-18 6.57298e-18 + -2.37431e-18 1.13701e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_spin2/sk_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_spin2/sk_nao.txt.ref deleted file mode 100644 index fe46bb7516e..00000000000 --- a/tests/02_NAO_Gamma/md_out_hk_spin2/sk_nao.txt.ref +++ /dev/null @@ -1,178 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - 1.48885e+00 1.85694e+00 1.50298e-17 6.88468e-18 -2.36492e-17 1.00384e-16 4.09828e-17 -4.11861e-17 - 1.20440e-17 -2.12775e-18 9.48677e-20 -3.03848e-17 -6.11897e-18 1.23629e+00 2.25011e+00 1.25400e-16 - 3.90696e-17 -4.36222e-18 -1.23450e-16 -6.48649e-17 6.48861e-17 5.65987e-17 7.06637e-19 8.47965e-18 - 4.95197e-17 2.35825e-17 -Row 2 - 4.31653e+00 7.86589e-17 1.08420e-17 -3.96276e-17 -3.55618e-17 -5.20417e-17 -8.58688e-17 3.03983e-17 - -3.57787e-18 -4.77049e-18 -8.45678e-17 1.40946e-18 2.25011e+00 3.67664e+00 -5.28278e-17 -1.00353e-16 - 1.02837e-16 -2.69262e-16 3.84011e-17 1.30917e-17 -7.82523e-17 1.54296e-17 -3.71339e-18 -1.51241e-16 - -1.15264e-17 -Row 3 - 5.44536e-01 1.10589e-17 -1.03812e-17 5.83149e-01 -2.42861e-17 2.85145e-17 4.43845e-19 7.04731e-19 - -2.53432e-18 5.42101e-19 -5.42101e-20 -1.25400e-16 5.28278e-17 -1.24841e-01 -5.58517e-17 1.37660e-17 - -1.17065e-01 -2.78979e-17 -4.05898e-17 -3.03102e-17 -2.33866e-18 5.04832e-19 -7.17437e-19 -4.82752e-01 -Row 4 - 5.44536e-01 -6.50521e-18 -2.42861e-17 5.83149e-01 8.67362e-19 4.87891e-19 6.48488e-18 -5.42101e-20 - -4.60786e-19 5.83606e-18 -3.90696e-17 1.00353e-16 -5.58517e-17 -1.24841e-01 6.18385e-17 -2.78979e-17 - -1.17065e-01 4.95379e-17 2.29461e-18 1.69457e-17 -4.82752e-01 -1.11861e-17 -1.63689e-18 -Row 5 - 5.44536e-01 2.85145e-17 8.67362e-19 5.83149e-01 -4.84503e-19 -5.42101e-20 1.80249e-18 -1.35525e-18 - -2.48011e-18 4.36222e-18 -1.02837e-16 1.37660e-17 6.18385e-17 -1.24841e-01 -4.05898e-17 4.95379e-17 - -1.17065e-01 4.80776e-18 -4.82752e-01 -8.40765e-18 -1.76522e-17 -8.61433e-19 -Row 6 - 6.96122e-01 4.68375e-17 -5.29091e-17 8.34836e-18 3.14419e-18 -9.05309e-18 2.62919e-18 0.00000e+00 - 1.23450e-16 2.69262e-16 -1.17065e-01 -2.78979e-17 -4.05898e-17 -6.46175e-02 2.56414e-17 1.96241e-17 - 1.85941e-17 -1.39252e-17 -1.35796e-17 1.20617e-18 -4.19177e-01 -Row 7 - 6.96122e-01 -7.80626e-18 1.30104e-18 3.19840e-18 0.00000e+00 -2.57498e-18 5.48877e-18 6.48649e-17 - -3.84011e-17 -2.78979e-17 -1.17065e-01 4.95379e-17 2.56414e-17 -6.46175e-02 -1.10318e-17 6.36969e-19 - -1.88685e-17 -4.19177e-01 7.40053e-18 1.81858e-17 -Row 8 - 6.96122e-01 -3.21195e-18 0.00000e+00 -1.62630e-18 -4.44523e-18 -2.91379e-18 -6.48861e-17 -1.30917e-17 - -4.05898e-17 4.95379e-17 -1.17065e-01 1.96241e-17 -1.10318e-17 -6.46175e-02 3.91668e-18 -4.19177e-01 - -1.15332e-17 2.62648e-17 -1.16467e-17 -Row 9 - 9.91168e-01 -2.23617e-18 2.94429e-18 4.32444e-17 1.48739e-18 5.65987e-17 -7.82523e-17 3.03102e-17 - -2.29461e-18 -4.80776e-18 -1.85941e-17 -6.36969e-19 -3.91668e-18 -5.10937e-01 -7.31921e-18 6.99310e-18 - -6.37714e-17 -1.47968e-17 -Row 10 - 1.13701e+00 -2.29038e-18 -2.98156e-19 -3.06626e-19 7.06637e-19 1.54296e-17 2.33866e-18 -1.69457e-17 - 4.82752e-01 1.39252e-17 1.88685e-17 4.19177e-01 -7.31921e-18 1.32237e-01 1.45266e-17 1.31640e-17 - -5.73399e-18 -Row 11 - 1.13701e+00 -9.04631e-19 -2.79182e-18 8.47965e-18 -3.71339e-18 -5.04832e-19 4.82752e-01 8.40765e-18 - 1.35796e-17 4.19177e-01 1.15332e-17 6.99310e-18 1.45266e-17 1.32237e-01 1.70262e-17 -6.55604e-19 -Row 12 - 9.91168e-01 2.16091e-20 4.95197e-17 -1.51241e-16 7.17437e-19 1.11861e-17 1.76522e-17 -1.20617e-18 - -7.40053e-18 -2.62648e-17 -6.37714e-17 1.31640e-17 1.70262e-17 -5.10937e-01 -2.84074e-19 -Row 13 - 1.13701e+00 2.35825e-17 -1.15264e-17 4.82752e-01 1.63689e-18 8.61433e-19 4.19177e-01 -1.81858e-17 - 1.16467e-17 -1.47968e-17 -5.73399e-18 -6.55604e-19 -2.84074e-19 1.32237e-01 -Row 14 - 1.48885e+00 1.85694e+00 1.50298e-17 6.88468e-18 -2.36492e-17 1.00384e-16 4.09828e-17 -4.11861e-17 - 1.20440e-17 -2.12775e-18 9.48677e-20 -3.03848e-17 -6.11897e-18 -Row 15 - 4.31653e+00 7.86589e-17 1.08420e-17 -3.96276e-17 -3.55618e-17 -5.20417e-17 -8.58688e-17 3.03983e-17 - -3.57787e-18 -4.77049e-18 -8.45678e-17 1.40946e-18 -Row 16 - 5.44536e-01 1.10589e-17 -1.03812e-17 5.83149e-01 -2.42861e-17 2.85145e-17 4.43845e-19 7.04731e-19 - -2.53432e-18 5.42101e-19 -5.42101e-20 -Row 17 - 5.44536e-01 -6.50521e-18 -2.42861e-17 5.83149e-01 8.67362e-19 4.87891e-19 6.48488e-18 -5.42101e-20 - -4.60786e-19 5.83606e-18 -Row 18 - 5.44536e-01 2.85145e-17 8.67362e-19 5.83149e-01 -4.84503e-19 -5.42101e-20 1.80249e-18 -1.35525e-18 - -2.48011e-18 -Row 19 - 6.96122e-01 4.68375e-17 -5.29091e-17 8.34836e-18 3.14419e-18 -9.05309e-18 2.62919e-18 0.00000e+00 -Row 20 - 6.96122e-01 -7.80626e-18 1.30104e-18 3.19840e-18 0.00000e+00 -2.57498e-18 5.48877e-18 -Row 21 - 6.96122e-01 -3.21195e-18 0.00000e+00 -1.62630e-18 -4.44523e-18 -2.91379e-18 -Row 22 - 9.91168e-01 -2.23617e-18 2.94429e-18 4.32444e-17 1.48739e-18 -Row 23 - 1.13701e+00 -2.29038e-18 -2.98156e-19 -3.06626e-19 -Row 24 - 1.13701e+00 -9.04631e-19 -2.79182e-18 -Row 25 - 9.91168e-01 2.16091e-20 -Row 26 - 1.13701e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - 1.48885e+00 1.85694e+00 -1.34848e-17 6.07695e-17 4.77456e-17 -6.35478e-17 -2.30501e-16 -1.85385e-16 - -3.56855e-18 -5.48877e-18 3.51010e-18 -3.21059e-17 2.27208e-17 1.23629e+00 2.25011e+00 3.55178e-04 - 5.90487e-04 1.24492e-04 4.28563e-04 7.11768e-04 1.51827e-04 -1.15453e-06 5.48551e-04 2.46587e-03 - 5.95842e-06 1.49023e-03 -Row 2 - 4.31653e+00 -3.84350e-17 5.24754e-17 1.42952e-16 -1.47451e-17 9.71445e-17 -6.67869e-17 2.36763e-17 - -4.55365e-18 1.10589e-17 -7.47015e-17 4.55365e-18 2.25011e+00 3.67665e+00 -4.79392e-04 -7.97562e-04 - -1.66751e-04 -5.39661e-04 -8.97294e-04 -1.88913e-04 1.57125e-06 -8.79829e-04 -3.96682e-03 -8.10910e-06 - -2.39668e-03 -Row 3 - 5.44536e-01 -8.45678e-18 2.21448e-17 5.83149e-01 -3.81639e-17 -1.65883e-17 1.12147e-18 9.05309e-17 - 2.60344e-17 5.96311e-19 6.72205e-18 -3.55178e-04 4.79392e-04 -1.24838e-01 5.48802e-04 2.46888e-03 - -1.17064e-01 4.87005e-04 2.19831e-03 -1.79153e-03 4.75245e-04 1.17592e-04 -1.72936e-08 -4.82737e-01 -Row 4 - 5.44536e-01 9.12898e-17 -3.81639e-17 5.83149e-01 -7.37257e-17 6.27753e-17 1.33154e-17 6.83047e-18 - -7.58942e-18 -4.59685e-17 -5.90487e-04 7.97562e-04 5.48802e-04 -1.24830e-01 1.49195e-03 4.87005e-04 - -1.17055e-01 1.32804e-03 1.48203e-03 2.90121e-04 -4.82737e-01 -2.56697e-03 1.17583e-04 -Row 5 - 5.44536e-01 -1.65883e-17 -7.37257e-17 5.83149e-01 1.37999e-17 6.83047e-18 1.85670e-18 -3.42676e-17 - -4.06440e-17 -1.24492e-04 1.66751e-04 2.46888e-03 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 - -1.17068e-01 3.30013e-04 -4.82737e-01 2.90156e-04 5.71591e-04 4.75264e-04 -Row 6 - 6.96122e-01 3.29597e-17 4.07660e-17 1.84314e-18 -1.48536e-17 -4.14707e-17 2.79182e-18 -9.54098e-18 - -4.28563e-04 5.39661e-04 -1.17064e-01 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 - -1.79747e-03 1.26928e-03 2.91200e-04 -4.08999e-08 -4.19167e-01 -Row 7 - 6.96122e-01 3.46945e-17 -1.02240e-16 -2.76472e-18 -9.54098e-18 4.69731e-17 -2.11419e-18 -7.11768e-04 - 8.97294e-04 4.87005e-04 -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 1.48692e-03 - 7.69230e-04 -4.19167e-01 -2.57547e-03 2.91180e-04 -Row 8 - 6.96122e-01 -1.24277e-17 -9.54098e-18 -1.19262e-18 4.21484e-17 1.01820e-16 -1.51827e-04 1.88913e-04 - 2.19831e-03 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 3.31113e-04 -4.19167e-01 - 7.69312e-04 5.73485e-04 1.26932e-03 -Row 9 - 9.91168e-01 -7.45389e-19 3.76083e-19 8.49591e-17 3.33155e-17 -1.15453e-06 1.57125e-06 1.79153e-03 - -1.48203e-03 -3.30013e-04 1.79747e-03 -1.48692e-03 -3.31113e-04 -5.10922e-01 -6.05774e-06 -1.33026e-06 - -1.76263e-05 4.43587e-06 -Row 10 - 1.13701e+00 1.31053e-17 -7.51826e-18 -8.62110e-18 5.48551e-04 -8.79829e-04 -4.75245e-04 -2.90121e-04 - 4.82737e-01 -1.26928e-03 -7.69230e-04 4.19167e-01 -6.05774e-06 1.32221e-01 2.17786e-03 -1.04671e-05 - 3.60087e-03 -Row 11 - 1.13701e+00 -1.09979e-17 5.71917e-18 2.46587e-03 -3.96682e-03 -1.17592e-04 4.82737e-01 -2.90156e-04 - -2.91200e-04 4.19167e-01 -7.69312e-04 -1.33026e-06 2.17786e-03 1.32237e-01 2.36050e-06 8.08017e-04 -Row 12 - 9.91168e-01 -6.89463e-19 5.95842e-06 -8.10910e-06 1.72936e-08 2.56697e-03 -5.71591e-04 4.08999e-08 - 2.57547e-03 -5.73485e-04 -1.76263e-05 -1.04671e-05 2.36050e-06 -5.10916e-01 5.13066e-08 -Row 13 - 1.13701e+00 1.49023e-03 -2.39668e-03 4.82737e-01 -1.17583e-04 -4.75264e-04 4.19167e-01 -2.91180e-04 - -1.26932e-03 4.43587e-06 3.60087e-03 8.08017e-04 5.13066e-08 1.32226e-01 -Row 14 - 1.48885e+00 1.85694e+00 -1.51504e-16 8.97177e-17 1.28464e-16 2.93805e-16 -1.79327e-16 -2.05334e-16 - -1.91540e-17 -9.01243e-18 -1.37152e-17 -4.08151e-17 -5.02799e-18 -Row 15 - 4.31653e+00 -1.13028e-16 7.37257e-18 3.97360e-17 -1.74340e-16 6.59195e-17 -2.16840e-17 -2.51128e-17 - -4.77049e-18 -2.64545e-17 -1.05628e-16 -4.39102e-18 -Row 16 - 5.44536e-01 3.64292e-17 -1.34170e-17 5.83149e-01 3.46945e-17 1.46476e-16 2.57600e-17 4.88433e-17 - 4.56585e-17 -2.01458e-17 -1.87838e-17 -Row 17 - 5.44536e-01 -1.85399e-17 3.46945e-17 5.83149e-01 -4.77049e-18 2.44488e-17 -3.18417e-17 -1.87296e-17 - -4.21822e-17 3.01425e-17 -Row 18 - 5.44536e-01 1.46476e-16 -4.77049e-18 5.83149e-01 2.34764e-17 -1.87296e-17 -1.25361e-17 4.38018e-17 - 2.53907e-17 -Row 19 - 6.96122e-01 8.84709e-17 -1.01481e-16 -7.54605e-17 6.78711e-17 6.26127e-17 2.30664e-17 2.74303e-17 -Row 20 - 6.96122e-01 -5.03070e-17 -5.96311e-17 -3.73779e-17 2.72135e-17 8.47846e-17 2.59124e-17 -Row 21 - 6.96122e-01 -5.05916e-17 2.72135e-17 -8.40257e-17 -9.99363e-17 5.90755e-17 -Row 22 - 9.91168e-01 4.06305e-17 3.54907e-17 3.79539e-17 1.84585e-17 -Row 23 - 1.13701e+00 1.26987e-17 1.01881e-17 1.52991e-17 -Row 24 - 1.13701e+00 1.98782e-17 -3.22279e-17 -Row 25 - 9.91168e-01 3.71455e-20 -Row 26 - 1.13701e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_syns/h_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_syns/h_nao.txt.ref new file mode 100644 index 00000000000..6786662d015 --- /dev/null +++ b/tests/02_NAO_Gamma/md_out_hk_syns/h_nao.txt.ref @@ -0,0 +1,258 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.673898 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -3.31965e-01 -7.79032e-01 -4.63591e-16 1.82796e-16 3.65975e-16 1.57295e-15 1.40546e-15 -8.88354e-16 + 1.22892e-15 -4.06134e-16 3.44826e-16 1.76943e-17 3.30603e-16 -5.55603e-01 -4.17916e-01 2.17351e-16 + 1.89522e-16 -7.44281e-17 5.73399e-16 -2.44478e-16 -2.46244e-16 1.77180e-16 -2.49768e-17 2.80063e-16 + 7.66504e-16 3.38717e-16 + -7.79032e-01 8.97099e-01 -3.09775e-17 2.55023e-16 3.79522e-18 -7.44407e-17 2.95640e-16 3.00983e-16 + 3.04695e-16 -2.53342e-16 2.76600e-16 7.91773e-17 8.03179e-16 -4.17916e-01 9.78287e-02 3.00982e-16 + -2.74055e-18 -4.95883e-16 7.71473e-16 -4.64971e-16 -1.20332e-15 7.25045e-16 1.70542e-16 1.39614e-16 + 8.12715e-16 5.05543e-16 + -7.24557e-16 -1.19102e-16 3.88002e-01 -1.42290e-17 1.48279e-16 4.20473e-01 -6.89331e-17 8.99183e-18 + 5.69755e-17 -8.00936e-17 -7.73825e-17 3.13110e-17 6.39676e-02 -1.28934e-16 6.37530e-17 -4.12885e-02 + -1.09667e-16 1.48593e-16 -1.32847e-02 -1.37843e-16 -5.83660e-18 4.53224e-17 -1.32564e-16 -3.54783e-17 + -4.97513e-17 -1.77608e-01 + 2.16298e-17 3.78785e-16 4.95615e-17 3.88002e-01 -6.09923e-17 6.51050e-17 4.20473e-01 -1.06400e-16 + 1.20137e-16 -2.21699e-16 6.39676e-02 -2.00302e-16 3.79242e-16 1.49376e-16 2.85882e-16 -9.22001e-17 + -4.12885e-02 1.67678e-16 -1.45092e-16 -1.32847e-02 2.27612e-16 2.29245e-17 -7.08027e-17 -1.77608e-01 + 9.45557e-17 -3.93650e-17 + 2.64686e-16 -6.71281e-17 1.06916e-16 -1.10286e-16 3.88002e-01 -9.27291e-17 4.38655e-17 4.20473e-01 + -4.05035e-16 6.39676e-02 1.23797e-16 -2.92755e-16 -3.03344e-16 2.60928e-16 4.47135e-17 1.05982e-16 + -6.21739e-17 -4.12885e-02 -5.35556e-17 1.83970e-16 -1.32847e-02 -7.61821e-18 -1.77608e-01 1.89326e-16 + 2.01866e-17 -6.20177e-17 + 1.79048e-15 -2.65399e-16 4.20473e-01 6.21858e-17 -1.40402e-16 7.68029e-01 -1.08621e-16 1.81793e-16 + 5.18134e-17 7.03852e-17 5.09701e-16 2.71488e-17 3.92223e-02 -3.78126e-16 6.22783e-16 -1.32847e-02 + -1.67063e-17 -1.77675e-16 1.33548e-01 -3.24775e-16 -6.38421e-17 4.96448e-18 9.04836e-17 -2.17276e-16 + 8.78029e-18 -3.73237e-02 + 1.45442e-15 6.76104e-16 -1.84118e-17 4.20473e-01 -1.11523e-16 -3.11886e-18 7.68029e-01 -1.76574e-16 + -4.43551e-16 -8.36574e-16 3.92223e-02 6.16361e-16 5.54897e-16 2.49850e-16 7.94925e-16 -2.96273e-17 + -1.32847e-02 -8.60486e-17 -1.30168e-17 1.33548e-01 4.05579e-17 -1.63036e-16 1.68242e-16 -3.73237e-02 + -4.53805e-17 -6.33347e-17 + -5.92903e-16 8.79545e-17 -1.31147e-16 2.42235e-17 4.20473e-01 1.10676e-17 -2.87976e-16 7.68029e-01 + 1.33185e-17 3.92223e-02 -5.28500e-16 -6.61865e-16 5.14682e-17 3.81591e-16 -1.00091e-15 7.56901e-18 + -6.69485e-17 -1.32847e-02 -1.43279e-16 -8.40614e-17 1.33548e-01 -5.12803e-18 -3.73237e-02 2.37184e-16 + 5.89369e-17 1.30816e-16 + 1.18338e-15 2.63938e-16 1.28162e-16 1.45311e-16 -3.10311e-16 1.94770e-16 -3.78935e-16 -1.20068e-16 + 1.45535e+00 1.50354e-16 -2.42294e-17 -2.35598e-16 -3.93281e-17 1.14903e-16 7.15347e-16 5.65929e-17 + -5.09086e-17 -4.60088e-18 1.83775e-16 -2.24686e-17 6.99179e-17 -2.96562e-01 -1.93720e-17 1.10771e-16 + -3.77833e-17 3.28182e-16 + -3.70196e-16 -6.92894e-17 -8.76525e-17 -3.89956e-16 6.39676e-02 1.56646e-16 -7.35506e-16 3.92223e-02 + 1.52963e-16 1.40881e+00 3.53408e-17 4.13395e-16 -2.28778e-17 -2.77511e-16 4.76765e-17 8.24620e-17 + -8.21988e-17 1.77608e-01 -5.29695e-18 -2.14900e-16 3.73237e-02 -6.15194e-17 1.12412e-01 -2.10540e-16 + -1.65734e-16 6.10777e-17 + 4.01690e-16 2.29751e-18 9.73896e-17 6.39676e-02 -1.65091e-17 4.64963e-16 3.92223e-02 -2.60887e-16 + -4.09449e-17 1.62774e-17 1.40881e+00 -1.17071e-16 -8.49047e-18 -2.97244e-16 4.25305e-16 1.01696e-16 + 1.77608e-01 -3.37699e-16 -6.28432e-18 3.73237e-02 1.60179e-17 6.34377e-17 -3.11372e-16 1.12412e-01 + -6.97114e-17 7.84658e-17 + 2.05688e-17 1.12418e-16 2.77021e-17 -1.64188e-16 -4.16114e-16 7.87491e-17 2.58876e-16 -2.35462e-16 + -1.92897e-16 3.93919e-16 -1.58888e-16 1.45535e+00 4.37576e-17 4.80856e-17 1.32985e-17 -2.33950e-17 + 3.52373e-18 9.67011e-17 1.75213e-17 -2.41992e-17 6.04807e-17 -5.36923e-17 4.13083e-16 1.17410e-16 + -2.96562e-01 1.92686e-17 + 2.07221e-16 4.43706e-16 6.39676e-02 3.35930e-16 -2.32659e-16 3.92223e-02 4.92643e-16 -2.23180e-16 + 6.92134e-17 -4.27478e-17 -3.67601e-17 5.03119e-17 1.40881e+00 3.74142e-16 -4.49262e-17 1.77608e-01 + 3.62650e-17 -2.79166e-18 3.73237e-02 9.05640e-17 4.81278e-17 2.46902e-16 9.34762e-17 2.18986e-16 + 3.13185e-17 1.12412e-01 + -5.55603e-01 -4.17916e-01 -2.30247e-16 1.46508e-16 1.69687e-16 -2.55564e-16 2.99554e-16 3.12806e-16 + 1.14686e-16 -1.28827e-16 -3.26883e-16 4.66166e-17 3.84185e-16 -3.31965e-01 -7.79032e-01 -1.17474e-16 + 8.15126e-18 -3.11341e-17 4.74589e-16 1.45965e-16 -6.17742e-16 2.71115e-16 2.77613e-16 1.35175e-16 + 1.04867e-15 3.59554e-16 + -4.17916e-01 9.78287e-02 8.66726e-17 2.92809e-16 1.34036e-16 6.91606e-16 7.37764e-16 -8.92033e-16 + 7.19142e-16 6.28859e-17 4.38963e-16 1.47732e-17 -5.22141e-17 -7.79032e-01 8.97099e-01 -2.35163e-16 + -1.11520e-16 2.86213e-16 3.18273e-16 3.63074e-16 -2.89736e-17 8.55519e-17 -6.74476e-17 -1.39464e-16 + 7.70955e-16 -5.76928e-16 + 4.91332e-16 3.79094e-16 -4.12885e-02 -6.87015e-17 8.72540e-17 -1.32847e-02 -2.16389e-17 8.25408e-18 + 8.29962e-17 7.17880e-17 1.14429e-16 -2.32161e-17 1.77608e-01 -2.45478e-16 -1.71848e-16 3.88002e-01 + 2.55612e-17 1.40236e-16 4.20473e-01 -3.37943e-17 6.78802e-17 -3.24872e-16 8.34326e-17 2.57910e-16 + 7.40108e-17 -6.39676e-02 + 2.28909e-16 -6.90437e-17 -1.17394e-16 -4.12885e-02 3.09658e-18 2.38083e-17 -1.32847e-02 -4.78318e-17 + -5.00156e-17 -7.95641e-17 1.77608e-01 6.89980e-18 3.69168e-17 5.81479e-17 7.11711e-17 -2.37806e-17 + 3.88002e-01 8.76624e-17 7.02169e-18 4.20473e-01 2.01729e-16 -1.21485e-16 -8.99418e-16 -6.39676e-02 + -1.99565e-17 2.67495e-16 + -1.88389e-17 -4.22858e-16 1.50682e-16 1.91613e-16 -4.12885e-02 -1.66148e-16 -6.41131e-17 -1.32847e-02 + -2.07863e-18 1.77608e-01 -3.61465e-16 9.53202e-17 8.72995e-19 -7.02066e-17 2.18038e-16 1.09710e-16 + 1.05223e-16 3.88002e-01 -7.01788e-18 6.62592e-17 4.20473e-01 -1.44489e-16 -6.39676e-02 -7.73636e-17 + 1.97933e-16 -5.55702e-16 + 4.29656e-16 8.66610e-16 -1.32847e-02 -1.33000e-16 -5.61066e-17 1.33548e-01 -2.08645e-17 -1.77065e-16 + 1.88001e-16 -1.89932e-17 1.86876e-17 2.23030e-17 3.73237e-02 1.49408e-16 -6.51010e-17 4.20473e-01 + 2.73681e-17 1.42773e-16 7.68029e-01 -1.43321e-16 7.21240e-17 -6.33406e-16 3.94511e-16 4.82601e-16 + 6.99838e-17 -3.92223e-02 + -1.77805e-16 -5.66726e-16 -1.28786e-16 -1.32847e-02 1.89659e-16 -3.22214e-16 1.33548e-01 -8.40199e-17 + -8.26436e-18 -2.36294e-16 3.73237e-02 -2.89095e-17 8.98539e-17 4.06148e-16 2.20869e-16 -7.70631e-18 + 4.20473e-01 1.45565e-16 -8.70182e-17 7.68029e-01 2.42645e-16 -8.46823e-17 -7.31474e-16 -3.92223e-02 + -8.35052e-16 4.37024e-16 + -3.15655e-16 -1.14276e-15 -8.92966e-18 2.12593e-16 -1.32847e-02 1.85986e-17 6.33675e-17 1.33548e-01 + 6.85615e-17 3.73237e-02 1.49256e-17 3.89721e-17 3.51634e-17 -1.86112e-16 -1.72009e-16 1.58793e-16 + 1.71461e-16 4.20473e-01 1.40046e-16 1.47629e-16 7.68029e-01 8.60423e-17 -3.92223e-02 -8.66500e-16 + 2.96049e-17 2.01994e-16 + 1.79663e-16 7.08697e-16 1.19859e-17 3.81225e-17 -2.57361e-17 -1.05364e-17 -1.67152e-16 -1.33799e-17 + -2.96562e-01 -4.96829e-17 5.95329e-17 -5.23258e-17 2.17752e-16 3.18352e-16 9.49231e-17 -3.51401e-16 + -7.92487e-17 -8.62308e-17 -4.81154e-16 -8.88513e-17 2.86288e-17 1.45535e+00 -1.81693e-16 1.69234e-16 + 4.82631e-17 -2.71846e-17 + 7.91922e-17 1.79976e-16 -1.24432e-16 -5.94191e-17 -1.77608e-01 6.84050e-17 1.54146e-16 -3.73237e-02 + -7.90782e-18 1.12412e-01 -2.73306e-16 4.13282e-16 7.89658e-17 1.99785e-16 1.27948e-16 8.03524e-17 + -5.39459e-16 -6.39676e-02 3.83661e-16 -1.02835e-15 -3.92223e-02 -1.86095e-16 1.40881e+00 9.82628e-17 + -7.66544e-17 -1.28894e-16 + 3.14625e-16 1.46770e-16 -3.67801e-17 -1.77608e-01 2.23875e-16 -2.27244e-16 -3.73237e-02 1.79451e-16 + 1.07411e-16 -1.72417e-16 1.12412e-01 1.04801e-16 2.24887e-16 4.21509e-16 -1.24025e-16 3.67824e-16 + -6.39676e-02 -2.41991e-17 4.93682e-16 -3.92223e-02 -7.12694e-16 1.75022e-16 1.03197e-16 1.40881e+00 + -2.07645e-16 -5.71219e-17 + 7.69231e-16 8.14686e-16 -4.97770e-17 9.26118e-17 2.39428e-17 3.41539e-18 -3.39440e-17 6.85480e-17 + -3.64124e-17 -1.66374e-16 -8.29758e-17 -2.96562e-01 3.17745e-17 1.09123e-15 6.73852e-16 8.07586e-17 + -2.62186e-18 9.23771e-17 6.81253e-17 -5.88284e-16 7.21897e-17 2.94684e-17 -1.11883e-16 -1.73754e-16 + 1.45535e+00 -4.87964e-17 + 3.07680e-16 4.40939e-16 -1.77608e-01 -2.72899e-17 -7.01095e-17 -3.73237e-02 -5.36163e-17 1.38031e-16 + 3.01050e-16 4.39393e-17 8.33764e-17 2.05693e-17 1.12412e-01 6.71284e-16 -8.44166e-16 -6.39676e-02 + 2.14895e-16 -3.36313e-16 -3.92223e-02 4.18657e-16 6.02353e-17 1.15137e-16 -1.72008e-16 -1.21537e-16 + -3.67974e-17 1.40881e+00 +Ionic_Step 2 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.673893 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.999239976680832 9.51223761413776e-05 0.00100497682545169 + 0.250760023319168 0.249904877623859 0.248995023174548 + + + -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 + 1.29058e-06 -4.54077e-04 -2.04377e-03 -6.65939e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 + -4.55961e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03274e-07 -1.41355e-04 -6.41200e-04 + -1.56400e-06 -3.87188e-04 + -7.79028e-01 8.97123e-01 4.13306e-04 6.86255e-04 1.47125e-04 7.09643e-04 1.17520e-03 2.58861e-04 + 1.77153e-06 -6.22558e-04 -2.76649e-03 -9.13820e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06321e-04 + -1.33809e-03 -2.88399e-04 -9.84175e-04 -1.63254e-03 -3.52931e-04 2.06953e-06 -1.13641e-03 -5.12939e-03 + -1.06780e-05 -3.09870e-03 + 7.14820e-04 4.13306e-04 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 + -3.25348e-04 -1.17981e-03 -2.58009e-04 -5.95554e-09 6.39658e-02 2.74471e-04 8.06321e-04 -4.12847e-02 + 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76786e-05 -1.63821e-06 + 1.37449e-08 -1.77600e-01 + 1.18605e-03 6.86255e-04 1.40071e-04 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 + 2.70768e-04 -7.11915e-04 6.39648e-02 -4.68991e-04 -2.58007e-04 4.55961e-04 1.33809e-03 8.85830e-05 + -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 + -1.08231e-03 -1.63537e-06 + 2.55953e-04 1.47125e-04 6.34090e-04 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 + 5.63203e-05 6.39662e-02 -7.11924e-04 9.75468e-05 -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 + 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30855e-05 -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 + 2.41913e-04 -2.76817e-05 + 6.52114e-04 7.09643e-04 4.20466e-01 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 + -3.73138e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 3.70128e-04 9.84175e-04 -1.32862e-02 + -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 -2.46734e-04 1.23775e-03 2.77049e-04 + -6.77317e-08 -3.73208e-02 + 1.08200e-03 1.17520e-03 1.25460e-04 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 + 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 1.63254e-03 -1.30073e-05 + -1.32864e-02 -3.30855e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 7.48438e-04 -3.73229e-02 + -3.53044e-04 2.77042e-04 + 2.33122e-04 2.58861e-04 5.71676e-04 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 + 6.53006e-05 3.92226e-02 -5.38757e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 -5.42821e-05 + -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 7.48456e-04 + 7.96386e-05 1.23776e-03 + 1.29058e-06 1.77153e-06 -3.25348e-04 2.70768e-04 5.63203e-05 -3.73138e-04 3.10164e-04 6.53006e-05 + 1.45533e+00 1.53175e-04 6.95612e-04 -3.63977e-06 -8.39996e-04 3.03274e-07 2.06953e-06 7.55635e-04 + -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05263e-05 -2.09648e-04 + -1.31157e-05 2.55313e-04 + -4.54077e-04 -6.22558e-04 -1.17981e-03 -7.11915e-04 6.39662e-02 -8.94447e-04 -5.39028e-04 3.92226e-02 + 1.53175e-04 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76786e-05 + 1.56033e-05 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05263e-05 1.12402e-01 8.72792e-04 + -8.74754e-05 1.44211e-03 + -2.04377e-03 -2.76649e-03 -2.58009e-04 6.39648e-02 -7.11924e-04 -1.92124e-04 3.92242e-02 -5.38757e-04 + 6.95612e-04 4.37699e-04 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63821e-06 + 1.77599e-01 1.56095e-05 -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09648e-04 8.72792e-04 1.12414e-01 + 3.63217e-04 3.26121e-04 + -6.65939e-06 -9.13820e-06 -5.95554e-09 -4.68991e-04 9.75468e-05 -1.06387e-07 -5.37336e-04 1.13051e-04 + -3.63977e-06 2.65302e-04 -1.20485e-03 1.45534e+00 -1.07581e-08 -1.56400e-06 -1.06780e-05 -1.37449e-08 + 1.08231e-03 -2.41913e-04 6.77317e-08 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74754e-05 3.63217e-04 + -2.96546e-01 8.50124e-08 + -1.23499e-03 -1.67365e-03 6.39658e-02 -2.58007e-04 -1.17981e-03 3.92231e-02 -1.92190e-04 -8.94299e-04 + -8.39996e-04 7.22291e-04 1.65475e-04 -1.07581e-08 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 + 1.63537e-06 2.76817e-05 3.73208e-02 -2.77042e-04 -1.23776e-03 2.55313e-04 1.44211e-03 3.26121e-04 + 8.50124e-08 1.12406e-01 + -5.55607e-01 -4.17915e-01 2.74471e-04 4.55961e-04 9.71044e-05 3.70128e-04 6.13802e-04 1.32976e-04 + 3.03274e-07 -1.41355e-04 -6.41200e-04 -1.56400e-06 -3.87188e-04 -3.31973e-01 -7.79028e-01 -7.14820e-04 + -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 1.29058e-06 -4.54077e-04 -2.04377e-03 + -6.65939e-06 -1.23499e-03 + -4.17915e-01 9.78578e-02 8.06321e-04 1.33809e-03 2.88399e-04 9.84175e-04 1.63254e-03 3.52931e-04 + 2.06953e-06 -1.13641e-03 -5.12939e-03 -1.06780e-05 -3.09870e-03 -7.79028e-01 8.97123e-01 -4.13306e-04 + -6.86255e-04 -1.47125e-04 -7.09643e-04 -1.17520e-03 -2.58861e-04 1.77153e-06 -6.22558e-04 -2.76649e-03 + -9.13820e-06 -1.67365e-03 + -2.74471e-04 -8.06321e-04 -4.12847e-02 8.85830e-05 3.86774e-04 -1.32862e-02 -1.30073e-05 -5.42821e-05 + 7.55635e-04 2.76786e-05 1.63821e-06 -1.37449e-08 1.77600e-01 -7.14820e-04 -4.13306e-04 3.87997e-01 + 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 2.58009e-04 + 5.95554e-09 -6.39658e-02 + -4.55961e-04 -1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 -1.32864e-02 -3.30261e-05 + -6.24881e-04 1.56033e-05 1.77599e-01 1.08231e-03 1.63537e-06 -1.18605e-03 -6.86255e-04 1.40071e-04 + 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 + 4.68991e-04 2.58007e-04 + -9.71044e-05 -2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30855e-05 -1.32861e-02 + -1.39665e-04 1.77601e-01 1.56095e-05 -2.41913e-04 2.76817e-05 -2.55953e-04 -1.47125e-04 6.34090e-04 + 3.82960e-04 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63203e-05 -6.39662e-02 7.11924e-04 + -9.75468e-05 1.17981e-03 + -3.70128e-04 -9.84175e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 + 2.46734e-04 -1.23775e-03 -2.77049e-04 6.77317e-08 3.73208e-02 -6.52114e-04 -7.09643e-04 4.20466e-01 + 1.25456e-04 5.71686e-04 7.68024e-01 1.19265e-04 5.38450e-04 3.73138e-04 8.94447e-04 1.92124e-04 + 1.06387e-07 -3.92231e-02 + -6.13802e-04 -1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30855e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 + -2.03789e-04 -7.48438e-04 3.73229e-02 3.53044e-04 -2.77042e-04 -1.08200e-03 -1.17520e-03 1.25460e-04 + 4.20468e-01 3.45081e-04 1.19265e-04 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 + 5.37336e-04 1.92190e-04 + -1.32976e-04 -3.52931e-04 -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 + -4.60000e-05 3.73197e-02 -7.48456e-04 -7.96386e-05 -1.23776e-03 -2.33122e-04 -2.58861e-04 5.71676e-04 + 3.45064e-04 4.20465e-01 5.38450e-04 3.25291e-04 7.68023e-01 -6.53006e-05 -3.92226e-02 5.38757e-04 + -1.13051e-04 8.94299e-04 + 3.03274e-07 2.06953e-06 -7.55635e-04 6.24881e-04 1.39665e-04 -2.46734e-04 2.03789e-04 4.60000e-05 + -2.96551e-01 -5.05263e-05 -2.09648e-04 -1.31157e-05 2.55313e-04 1.29058e-06 1.77153e-06 3.25348e-04 + -2.70768e-04 -5.63203e-05 3.73138e-04 -3.10164e-04 -6.53006e-05 1.45533e+00 1.53175e-04 6.95612e-04 + -3.63977e-06 -8.39996e-04 + -1.41355e-04 -1.13641e-03 -2.76786e-05 -1.56033e-05 -1.77601e-01 1.23775e-03 7.48438e-04 -3.73197e-02 + -5.05263e-05 1.12402e-01 8.72792e-04 -8.74754e-05 1.44211e-03 -4.54077e-04 -6.22558e-04 1.17981e-03 + 7.11915e-04 -6.39662e-02 8.94447e-04 5.39028e-04 -3.92226e-02 1.53175e-04 1.40881e+00 4.37699e-04 + 2.65302e-04 7.22291e-04 + -6.41200e-04 -5.12939e-03 -1.63821e-06 -1.77599e-01 -1.56095e-05 2.77049e-04 -3.73229e-02 7.48456e-04 + -2.09648e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -2.04377e-03 -2.76649e-03 2.58009e-04 + -6.39648e-02 7.11924e-04 1.92124e-04 -3.92242e-02 5.38757e-04 6.95612e-04 4.37699e-04 1.40880e+00 + -1.20485e-03 1.65475e-04 + -1.56400e-06 -1.06780e-05 1.37449e-08 -1.08231e-03 2.41913e-04 -6.77317e-08 -3.53044e-04 7.96386e-05 + -1.31157e-05 -8.74754e-05 3.63217e-04 -2.96546e-01 8.50124e-08 -6.65939e-06 -9.13820e-06 5.95554e-09 + 4.68991e-04 -9.75468e-05 1.06387e-07 5.37336e-04 -1.13051e-04 -3.63977e-06 2.65302e-04 -1.20485e-03 + 1.45534e+00 -1.07581e-08 + -3.87188e-04 -3.09870e-03 -1.77600e-01 -1.63537e-06 -2.76817e-05 -3.73208e-02 2.77042e-04 1.23776e-03 + 2.55313e-04 1.44211e-03 3.26121e-04 8.50124e-08 1.12406e-01 -1.23499e-03 -1.67365e-03 -6.39658e-02 + 2.58007e-04 1.17981e-03 -3.92231e-02 1.92190e-04 8.94299e-04 -8.39996e-04 7.22291e-04 1.65475e-04 + -1.07581e-08 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_syns/hk_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_syns/hk_nao.txt.ref deleted file mode 100644 index 06df277ab76..00000000000 --- a/tests/02_NAO_Gamma/md_out_hk_syns/hk_nao.txt.ref +++ /dev/null @@ -1,178 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31965e-01 -7.79032e-01 8.88178e-16 -6.66134e-16 6.93889e-16 -4.44089e-16 3.33067e-16 4.99600e-16 - -2.09274e-16 2.77556e-17 0.00000e00 1.24766e-15 8.32667e-16 -5.55603e-01 -4.17916e-01 3.50414e-16 - -5.72459e-16 -3.53884e-16 -2.44596e-16 -2.21177e-16 -2.86229e-17 1.00271e-15 -1.80411e-16 -9.71445e-17 - -2.33843e-16 -5.13478e-16 -Row 2 - 8.97099e-01 9.71445e-17 1.38778e-17 6.93889e-16 0.00000e00 -2.22045e-16 4.44089e-16 -7.72954e-16 - -1.38778e-17 -3.46945e-16 1.14965e-15 1.36696e-15 -4.17916e-01 9.78287e-02 1.42421e-15 -1.52656e-16 - -2.08167e-16 1.39125e-15 -2.29330e-15 -1.38778e-15 9.84842e-16 -6.52256e-16 -4.30211e-16 -3.70046e-16 - -9.64506e-16 -Row 3 - 3.88002e-01 -2.98372e-16 1.21431e-16 4.20473e-01 -1.38778e-16 -3.46945e-17 -6.38378e-16 4.71845e-16 - -2.49800e-16 8.66627e-17 6.39676e-02 4.71845e-16 1.49880e-15 -4.12885e-02 -8.15320e-17 -1.35308e-16 - -1.32847e-02 6.07153e-18 7.45931e-17 3.36536e-16 1.73472e-17 5.55112e-17 -2.39025e-17 -1.77608e-01 -Row 4 - 3.88002e-01 -4.05925e-16 -6.03684e-16 4.20473e-01 2.08167e-17 0.00000e00 1.11022e-16 6.39676e-02 - 1.94289e-16 8.32667e-17 -9.71445e-17 -2.49800e-16 -3.98986e-17 -4.12885e-02 3.12250e-17 6.50521e-17 - -1.32847e-02 8.50015e-17 2.25514e-17 2.61943e-16 -1.77608e-01 3.81639e-17 -2.06432e-16 -Row 5 - 3.88002e-01 -6.93889e-17 -4.16334e-17 4.20473e-01 1.38778e-16 6.39676e-02 2.49800e-16 5.55112e-17 - 1.94289e-16 5.82867e-16 2.77556e-17 -7.97973e-17 2.08167e-17 -4.12885e-02 -5.46438e-17 9.97466e-17 - -1.32847e-02 -3.64292e-17 -1.77608e-01 1.66533e-16 -1.14492e-16 4.16334e-17 -Row 6 - 7.68029e-01 7.07767e-16 1.87350e-16 -3.83027e-15 -3.60822e-16 -1.13798e-15 1.74472e-16 3.92223e-02 - 0.00000e00 4.99600e-16 -1.32847e-02 8.32667e-17 -5.55112e-17 1.33548e-01 9.28077e-17 -2.51535e-17 - 2.56739e-16 -4.51028e-17 -6.59195e-17 3.62838e-17 -3.73237e-02 -Row 7 - 7.68029e-01 -5.55112e-16 -2.22045e-16 5.55112e-17 3.92223e-02 4.99600e-16 -9.99201e-16 3.60822e-16 - -1.66533e-16 -2.08167e-17 -1.32847e-02 6.59195e-17 6.67869e-17 1.33548e-01 -1.04951e-16 -3.12250e-17 - -4.16334e-17 -3.73237e-02 1.45717e-16 5.89806e-17 -Row 8 - 7.68029e-01 5.55112e-16 3.92223e-02 -1.94289e-16 -3.33067e-16 -1.94289e-16 9.71445e-17 0.00000e00 - -8.32667e-17 1.04083e-17 -1.32847e-02 -6.85216e-17 5.11743e-17 1.33548e-01 -1.00614e-16 -3.73237e-02 - 1.07553e-16 -1.42247e-16 -1.49186e-16 -Row 9 - 1.45535e+00 -3.95517e-16 -3.12250e-16 4.40251e-16 -5.55112e-17 -4.54079e-16 -1.02562e-15 9.02056e-17 - 1.21431e-17 -9.54098e-17 -8.67362e-18 5.59448e-17 -2.51535e-17 -2.96562e-01 -1.17961e-16 -1.45717e-16 - -7.50115e-17 -1.38778e-16 -Row 10 - 1.40881e+00 -5.55112e-17 -1.66533e-16 6.24500e-17 1.52656e-16 7.21645e-16 -1.07553e-16 1.14492e-16 - 1.77608e-01 5.89806e-17 4.42354e-17 3.73237e-02 6.28837e-17 1.12412e-01 -3.19189e-16 2.52402e-16 - 2.91434e-16 -Row 11 - 1.40881e+00 -1.38778e-16 1.63064e-16 7.63278e-17 6.52256e-16 6.93889e-18 1.77608e-01 1.49186e-16 - 7.11237e-17 3.73237e-02 2.25514e-17 -1.51788e-17 -1.45717e-16 1.12412e-01 -1.56125e-17 -1.45717e-16 -Row 12 - 1.45535e+00 3.66804e-17 9.68102e-16 1.74798e-15 1.57097e-17 1.49186e-16 -2.42861e-16 2.97226e-17 - 8.67362e-18 -9.80119e-17 -5.20558e-17 -2.63678e-16 2.22045e-16 -2.96562e-01 -2.17065e-17 -Row 13 - 1.40881e+00 1.70003e-16 4.16334e-16 1.77608e-01 1.04083e-17 2.77556e-17 3.73237e-02 -2.42861e-17 - 1.64799e-17 -1.17094e-16 -1.38778e-16 -5.55112e-16 -3.89194e-17 1.12412e-01 -Row 14 - -3.31965e-01 -7.79032e-01 1.07325e-15 1.05656e-16 4.15249e-16 2.27249e-16 1.17614e-15 9.99201e-16 - 1.12721e-15 -1.04083e-16 -4.64906e-16 -1.32218e-16 -2.42861e-16 -Row 15 - 8.97099e-01 1.35308e-16 4.96131e-16 3.50414e-16 6.41848e-16 2.23779e-16 -4.86590e-16 1.02756e-15 - -1.24900e-16 -1.38778e-16 -4.75609e-16 -7.91034e-16 -Row 16 - 3.88002e-01 7.28584e-17 1.83881e-16 4.20473e-01 1.35308e-16 1.37043e-16 3.23526e-16 3.13985e-16 - -9.10730e-17 2.67738e-17 -6.39676e-02 -Row 17 - 3.88002e-01 8.67362e-17 1.90820e-16 4.20473e-01 -1.21431e-17 1.56559e-16 -4.75314e-16 -6.39676e-02 - 1.64799e-16 -5.76796e-16 -Row 18 - 3.88002e-01 -3.29597e-17 -1.83881e-16 4.20473e-01 1.42681e-16 -6.39676e-02 -2.09902e-16 -1.96024e-16 - 1.32706e-16 -Row 19 - 7.68029e-01 6.76542e-17 1.97758e-16 -8.98587e-16 -4.66641e-16 -3.24393e-16 6.60470e-17 -3.92223e-02 -Row 20 - 7.68029e-01 -3.55618e-16 -1.06339e-15 -8.58688e-16 -3.92223e-02 1.95156e-17 1.04083e-16 -Row 21 - 7.68029e-01 -5.89372e-16 -3.92223e-02 -1.24206e-15 -6.58761e-16 2.60209e-17 -Row 22 - 1.45535e+00 1.33574e-16 1.90820e-17 -2.26060e-16 -3.40006e-16 -Row 23 - 1.40881e+00 2.46331e-16 9.36751e-17 -5.20417e-17 -Row 24 - 1.40881e+00 3.46945e-18 1.28370e-16 -Row 25 - 1.45535e+00 -8.18244e-17 -Row 26 - 1.40881e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -3.31973e-01 -7.79028e-01 7.14820e-04 1.18605e-03 2.55953e-04 6.52114e-04 1.08200e-03 2.33122e-04 - 1.29058e-06 -4.54077e-04 -2.04377e-03 -6.65939e-06 -1.23499e-03 -5.55607e-01 -4.17915e-01 -2.74471e-04 - -4.55961e-04 -9.71044e-05 -3.70128e-04 -6.13802e-04 -1.32976e-04 3.03274e-07 -1.41355e-04 -6.41200e-04 - -1.56400e-06 -3.87188e-04 -Row 2 - 8.97123e-01 4.13306e-04 6.86255e-04 1.47125e-04 7.09643e-04 1.17520e-03 2.58861e-04 1.77153e-06 - -6.22558e-04 -2.76649e-03 -9.13820e-06 -1.67365e-03 -4.17915e-01 9.78578e-02 -8.06321e-04 -1.33809e-03 - -2.88399e-04 -9.84175e-04 -1.63254e-03 -3.52931e-04 2.06953e-06 -1.13641e-03 -5.12939e-03 -1.06780e-05 - -3.09870e-03 -Row 3 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 -3.25348e-04 -1.17981e-03 - -2.58009e-04 -5.95554e-09 6.39658e-02 2.74471e-04 8.06321e-04 -4.12847e-02 8.85830e-05 3.86774e-04 - -1.32862e-02 -1.30073e-05 -5.42821e-05 -7.55635e-04 -2.76786e-05 -1.63821e-06 1.37449e-08 -1.77600e-01 -Row 4 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 2.70768e-04 -7.11915e-04 6.39648e-02 - -4.68991e-04 -2.58007e-04 4.55961e-04 1.33809e-03 8.85830e-05 -4.12828e-02 2.34388e-04 -1.29967e-05 - -1.32864e-02 -3.30261e-05 6.24881e-04 -1.56033e-05 -1.77599e-01 -1.08231e-03 -1.63537e-06 -Row 5 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 5.63203e-05 6.39662e-02 -7.11924e-04 9.75468e-05 - -1.17981e-03 9.71044e-05 2.88399e-04 3.86774e-04 2.34388e-04 -4.12857e-02 -5.43149e-05 -3.30855e-05 - -1.32861e-02 1.39665e-04 -1.77601e-01 -1.56095e-05 2.41913e-04 -2.76817e-05 -Row 6 - 7.68024e-01 1.19265e-04 5.38450e-04 -3.73138e-04 -8.94447e-04 -1.92124e-04 -1.06387e-07 3.92231e-02 - 3.70128e-04 9.84175e-04 -1.32862e-02 -1.29967e-05 -5.43149e-05 1.33535e-01 -1.55597e-04 -6.60447e-04 - -2.46734e-04 1.23775e-03 2.77049e-04 -6.77317e-08 -3.73208e-02 -Row 7 - 7.68027e-01 3.25291e-04 3.10164e-04 -5.39028e-04 3.92242e-02 -5.37336e-04 -1.92190e-04 6.13802e-04 - 1.63254e-03 -1.30073e-05 -1.32864e-02 -3.30855e-05 -1.55597e-04 1.33532e-01 -4.01322e-04 2.03789e-04 - 7.48438e-04 -3.73229e-02 -3.53044e-04 2.77042e-04 -Row 8 - 7.68023e-01 6.53006e-05 3.92226e-02 -5.38757e-04 1.13051e-04 -8.94299e-04 1.32976e-04 3.52931e-04 - -5.42821e-05 -3.30261e-05 -1.32861e-02 -6.60447e-04 -4.01322e-04 1.33537e-01 4.60000e-05 -3.73197e-02 - 7.48456e-04 7.96386e-05 1.23776e-03 -Row 9 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63977e-06 -8.39996e-04 3.03274e-07 2.06953e-06 7.55635e-04 - -6.24881e-04 -1.39665e-04 2.46734e-04 -2.03789e-04 -4.60000e-05 -2.96551e-01 -5.05263e-05 -2.09648e-04 - -1.31157e-05 2.55313e-04 -Row 10 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -1.41355e-04 -1.13641e-03 2.76786e-05 1.56033e-05 - 1.77601e-01 -1.23775e-03 -7.48438e-04 3.73197e-02 -5.05263e-05 1.12402e-01 8.72792e-04 -8.74754e-05 - 1.44211e-03 -Row 11 - 1.40880e+00 -1.20485e-03 1.65475e-04 -6.41200e-04 -5.12939e-03 1.63821e-06 1.77599e-01 1.56095e-05 - -2.77049e-04 3.73229e-02 -7.48456e-04 -2.09648e-04 8.72792e-04 1.12414e-01 3.63217e-04 3.26121e-04 -Row 12 - 1.45534e+00 -1.07581e-08 -1.56400e-06 -1.06780e-05 -1.37449e-08 1.08231e-03 -2.41913e-04 6.77317e-08 - 3.53044e-04 -7.96386e-05 -1.31157e-05 -8.74754e-05 3.63217e-04 -2.96546e-01 8.50124e-08 -Row 13 - 1.40881e+00 -3.87188e-04 -3.09870e-03 1.77600e-01 1.63537e-06 2.76817e-05 3.73208e-02 -2.77042e-04 - -1.23776e-03 2.55313e-04 1.44211e-03 3.26121e-04 8.50124e-08 1.12406e-01 -Row 14 - -3.31973e-01 -7.79028e-01 -7.14820e-04 -1.18605e-03 -2.55953e-04 -6.52114e-04 -1.08200e-03 -2.33122e-04 - 1.29058e-06 -4.54077e-04 -2.04377e-03 -6.65939e-06 -1.23499e-03 -Row 15 - 8.97123e-01 -4.13306e-04 -6.86255e-04 -1.47125e-04 -7.09643e-04 -1.17520e-03 -2.58861e-04 1.77153e-06 - -6.22558e-04 -2.76649e-03 -9.13820e-06 -1.67365e-03 -Row 16 - 3.87997e-01 1.40071e-04 6.34090e-04 4.20466e-01 1.25460e-04 5.71676e-04 3.25348e-04 1.17981e-03 - 2.58009e-04 5.95554e-09 -6.39658e-02 -Row 17 - 3.88000e-01 3.82960e-04 1.25456e-04 4.20468e-01 3.45064e-04 -2.70768e-04 7.11915e-04 -6.39648e-02 - 4.68991e-04 2.58007e-04 -Row 18 - 3.87995e-01 5.71686e-04 3.45081e-04 4.20465e-01 -5.63203e-05 -6.39662e-02 7.11924e-04 -9.75468e-05 - 1.17981e-03 -Row 19 - 7.68024e-01 1.19265e-04 5.38450e-04 3.73138e-04 8.94447e-04 1.92124e-04 1.06387e-07 -3.92231e-02 -Row 20 - 7.68027e-01 3.25291e-04 -3.10164e-04 5.39028e-04 -3.92242e-02 5.37336e-04 1.92190e-04 -Row 21 - 7.68023e-01 -6.53006e-05 -3.92226e-02 5.38757e-04 -1.13051e-04 8.94299e-04 -Row 22 - 1.45533e+00 1.53175e-04 6.95612e-04 -3.63977e-06 -8.39996e-04 -Row 23 - 1.40881e+00 4.37699e-04 2.65302e-04 7.22291e-04 -Row 24 - 1.40880e+00 -1.20485e-03 1.65475e-04 -Row 25 - 1.45534e+00 -1.07581e-08 -Row 26 - 1.40881e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_syns/s_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_syns/s_nao.txt.ref new file mode 100644 index 00000000000..c443f8fe565 --- /dev/null +++ b/tests/02_NAO_Gamma/md_out_hk_syns/s_nao.txt.ref @@ -0,0 +1,258 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + 1.48885e+00 1.85694e+00 8.79559e-18 -8.67362e-19 6.76271e-18 -6.86707e-17 4.98733e-18 -6.78982e-18 + 9.54267e-18 5.20417e-18 -5.71917e-18 -2.96140e-17 -9.62229e-19 1.23629e+00 2.25011e+00 8.17971e-17 + 9.06241e-18 -1.25081e-17 -5.22789e-18 4.28573e-17 -1.33018e-16 5.56403e-17 -9.79869e-18 1.22566e-18 + 4.95550e-17 -2.83767e-17 + 1.85694e+00 4.31653e+00 5.50233e-17 2.21177e-17 -2.85687e-17 2.53703e-17 -7.45931e-17 4.11997e-18 + 4.21348e-17 3.68629e-18 1.35525e-18 -8.13152e-17 1.09504e-17 2.25011e+00 3.67664e+00 -1.41895e-17 + 2.79267e-17 1.89735e-19 -3.31657e-16 1.19845e-16 2.49800e-16 -7.89977e-17 -4.11861e-17 2.12300e-17 + -1.47435e-16 -1.02034e-17 + -8.79559e-18 -5.50233e-17 5.44536e-01 2.47198e-17 -1.72659e-17 5.83149e-01 6.15827e-17 -7.64363e-17 + -2.20229e-19 -3.46945e-18 1.51788e-18 5.96311e-19 -5.42101e-20 -8.17971e-17 1.41895e-17 -1.24841e-01 + -7.45389e-20 2.34662e-17 -1.17065e-01 5.40204e-17 -6.45507e-17 -2.23447e-17 5.92923e-21 -2.25988e-18 + -4.57398e-19 -4.82752e-01 + 8.67362e-19 -2.21177e-17 2.47198e-17 5.44536e-01 0.00000e+00 6.15827e-17 5.83149e-01 -5.63785e-18 + 1.05710e-18 8.93112e-18 5.42101e-20 -2.20906e-18 -3.38136e-18 -9.06241e-18 -2.79267e-17 -7.45389e-20 + -1.24841e-01 2.74777e-17 5.40204e-17 -1.17065e-01 8.89215e-18 -1.43928e-17 1.61699e-18 -4.82752e-01 + 9.48889e-19 2.65968e-19 + -6.76271e-18 2.85687e-17 -1.72659e-17 0.00000e+00 5.44536e-01 -7.64363e-17 -5.63785e-18 5.83149e-01 + 5.65818e-19 5.42101e-20 -2.66985e-18 -5.02799e-18 2.08709e-18 1.25081e-17 -1.89735e-19 2.34662e-17 + 2.74777e-17 -1.24841e-01 -6.45507e-17 8.89215e-18 -1.17065e-01 9.34955e-18 -4.82752e-01 -8.71766e-18 + 1.44860e-17 3.67697e-18 + 6.86707e-17 -2.53703e-17 5.83149e-01 6.15827e-17 -7.64363e-17 6.96122e-01 -2.94903e-17 3.81639e-17 + -4.94667e-18 3.90313e-18 -6.72205e-18 -5.69206e-19 0.00000e+00 5.22789e-18 3.31657e-16 -1.17065e-01 + 5.40204e-17 -6.45507e-17 -6.46175e-02 1.24277e-17 -1.21431e-17 -6.24772e-18 1.68153e-17 1.99222e-18 + 1.02322e-18 -4.19177e-01 + -4.98733e-18 7.45931e-17 6.15827e-17 5.83149e-01 -5.63785e-18 -2.94903e-17 6.96122e-01 5.29091e-17 + 1.62630e-18 4.30970e-18 0.00000e+00 -2.65630e-18 -7.18284e-19 -4.28573e-17 -1.19845e-16 5.40204e-17 + -1.17065e-01 8.89215e-18 1.24277e-17 -6.46175e-02 2.30800e-17 4.54179e-18 4.22500e-18 -4.19177e-01 + -3.81927e-18 4.40457e-20 + 6.78982e-18 -4.11997e-18 -7.64363e-17 -5.63785e-18 5.83149e-01 3.81639e-17 5.29091e-17 6.96122e-01 + 3.29326e-18 0.00000e+00 -9.75782e-19 1.35525e-18 7.35902e-18 1.33018e-16 -2.49800e-16 -6.45507e-17 + 8.89215e-18 -1.17065e-01 -1.21431e-17 2.30800e-17 -6.46175e-02 1.08081e-17 -4.19177e-01 2.66714e-17 + -1.25513e-17 2.77945e-17 + 9.54267e-18 4.21348e-17 2.20229e-19 -1.05710e-18 -5.65818e-19 4.94667e-18 -1.62630e-18 -3.29326e-18 + 9.91168e-01 2.71051e-18 -3.28988e-18 2.75252e-17 -7.01343e-19 5.56403e-17 -7.89977e-17 2.23447e-17 + 1.43928e-17 -9.34955e-18 6.24772e-18 -4.54179e-18 -1.08081e-17 -5.10937e-01 -3.59735e-18 5.68020e-18 + -6.22557e-17 -1.80863e-17 + 5.20417e-18 3.68629e-18 3.46945e-18 -8.93112e-18 -5.42101e-20 -3.90313e-18 -4.30970e-18 0.00000e+00 + 2.71051e-18 1.13701e+00 3.11708e-19 -7.48777e-19 1.83806e-18 -9.79869e-18 -4.11861e-17 -5.92923e-21 + -1.61699e-18 4.82752e-01 -1.68153e-17 -4.22500e-18 4.19177e-01 -3.59735e-18 1.32237e-01 1.16772e-17 + 1.50878e-17 -1.23222e-17 + -5.71917e-18 1.35525e-18 -1.51788e-18 -5.42101e-20 2.66985e-18 6.72205e-18 0.00000e+00 9.75782e-19 + -3.28988e-18 3.11708e-19 1.13701e+00 -1.41624e-18 -2.61564e-18 1.22566e-18 2.12300e-17 2.25988e-18 + 4.82752e-01 8.71766e-18 -1.99222e-18 4.19177e-01 -2.66714e-17 5.68020e-18 1.16772e-17 1.32237e-01 + 2.82155e-17 9.20301e-18 + -2.96140e-17 -8.13152e-17 -5.96311e-19 2.20906e-18 5.02799e-18 5.69206e-19 2.65630e-18 -1.35525e-18 + 2.75252e-17 -7.48777e-19 -1.41624e-18 9.91168e-01 2.16091e-20 4.95550e-17 -1.47435e-16 4.57398e-19 + -9.48889e-19 -1.44860e-17 -1.02322e-18 3.81927e-18 1.25513e-17 -6.22557e-17 1.50878e-17 2.82155e-17 + -5.10937e-01 -7.46448e-20 + -9.62229e-19 1.09504e-17 5.42101e-20 3.38136e-18 -2.08709e-18 0.00000e+00 7.18284e-19 -7.35902e-18 + -7.01343e-19 1.83806e-18 -2.61564e-18 2.16091e-20 1.13701e+00 -2.83767e-17 -1.02034e-17 4.82752e-01 + -2.65968e-19 -3.67697e-18 4.19177e-01 -4.40457e-20 -2.77945e-17 -1.80863e-17 -1.23222e-17 9.20301e-18 + -7.46448e-20 1.32237e-01 + 1.23629e+00 2.25011e+00 -9.87420e-17 7.25823e-18 -1.18288e-17 8.68920e-17 -1.38582e-16 1.35132e-16 + 5.52435e-17 -8.73185e-18 5.10761e-18 4.93297e-17 -2.35710e-17 1.48885e+00 1.85694e+00 8.79559e-18 + -8.67362e-19 6.76271e-18 -6.86707e-17 4.98733e-18 -6.78982e-18 9.54267e-18 5.20417e-18 -5.71917e-18 + -2.96140e-17 -9.62229e-19 + 2.25011e+00 3.67664e+00 -2.50993e-17 1.20279e-19 -3.93362e-17 3.87060e-16 -5.51588e-18 -3.72044e-16 + -8.80101e-17 -4.73932e-17 1.10318e-17 -1.42674e-16 -1.59954e-17 1.85694e+00 4.31653e+00 5.50233e-17 + 2.21177e-17 -2.85687e-17 2.53703e-17 -7.45931e-17 4.11997e-18 4.21348e-17 3.68629e-18 1.35525e-18 + -8.13152e-17 1.09504e-17 + 9.87420e-17 2.50993e-17 -1.24841e-01 -1.14858e-17 2.02610e-18 -1.17065e-01 3.41930e-17 -5.66496e-17 + -6.96600e-18 1.37982e-18 2.14469e-18 5.68359e-19 4.82752e-01 -8.79559e-18 -5.50233e-17 5.44536e-01 + 2.47198e-17 -1.72659e-17 5.83149e-01 6.15827e-17 -7.64363e-17 -2.20229e-19 -3.46945e-18 1.51788e-18 + 5.96311e-19 -5.42101e-20 + -7.25823e-18 -1.20279e-19 -1.14858e-17 -1.24841e-01 2.28970e-17 3.41930e-17 -1.17065e-01 -6.75593e-18 + 1.54109e-17 -9.61806e-18 4.82752e-01 -5.37548e-18 2.91888e-18 8.67362e-19 -2.21177e-17 2.47198e-17 + 5.44536e-01 0.00000e+00 6.15827e-17 5.83149e-01 -5.63785e-18 1.05710e-18 8.93112e-18 5.42101e-20 + -2.20906e-18 -3.38136e-18 + 1.18288e-17 3.93362e-17 2.02610e-18 2.28970e-17 -1.24841e-01 -5.66496e-17 -6.75593e-18 -1.17065e-01 + -8.86674e-18 4.82752e-01 -4.63835e-18 -1.30591e-17 -1.09737e-17 -6.76271e-18 2.85687e-17 -1.72659e-17 + 0.00000e+00 5.44536e-01 -7.64363e-17 -5.63785e-18 5.83149e-01 5.65818e-19 5.42101e-20 -2.66985e-18 + -5.02799e-18 2.08709e-18 + -8.68920e-17 -3.87060e-16 -1.17065e-01 3.41930e-17 -5.66496e-17 -6.46175e-02 2.45436e-17 1.32815e-17 + 2.05727e-17 -1.10284e-17 2.69695e-18 -7.65718e-19 4.19177e-01 6.86707e-17 -2.53703e-17 5.83149e-01 + 6.15827e-17 -7.64363e-17 6.96122e-01 -2.94903e-17 3.81639e-17 -4.94667e-18 3.90313e-18 -6.72205e-18 + -5.69206e-19 0.00000e+00 + 1.38582e-16 5.51588e-18 3.41930e-17 -1.17065e-01 -6.75593e-18 2.45436e-17 -6.46175e-02 1.83095e-17 + 3.85400e-18 -7.36919e-18 4.19177e-01 1.43022e-17 2.14638e-17 -4.98733e-18 7.45931e-17 6.15827e-17 + 5.83149e-01 -5.63785e-18 -2.94903e-17 6.96122e-01 5.29091e-17 1.62630e-18 4.30970e-18 0.00000e+00 + -2.65630e-18 -7.18284e-19 + -1.35132e-16 3.72044e-16 -5.66496e-17 -6.75593e-18 -1.17065e-01 1.32815e-17 1.83095e-17 -6.46175e-02 + -6.62041e-18 4.19177e-01 -1.60597e-17 1.25547e-17 -2.47469e-17 6.78982e-18 -4.11997e-18 -7.64363e-17 + -5.63785e-18 5.83149e-01 3.81639e-17 5.29091e-17 6.96122e-01 3.29326e-18 0.00000e+00 -9.75782e-19 + 1.35525e-18 7.35902e-18 + 5.52435e-17 -8.80101e-17 6.96600e-18 -1.54109e-17 8.86674e-18 -2.05727e-17 -3.85400e-18 6.62041e-18 + -5.10937e-01 2.63512e-18 6.28329e-18 -6.24700e-17 -2.61538e-17 9.54267e-18 4.21348e-17 2.20229e-19 + -1.05710e-18 -5.65818e-19 4.94667e-18 -1.62630e-18 -3.29326e-18 9.91168e-01 2.71051e-18 -3.28988e-18 + 2.75252e-17 -7.01343e-19 + -8.73185e-18 -4.73932e-17 -1.37982e-18 9.61806e-18 -4.82752e-01 1.10284e-17 7.36919e-18 -4.19177e-01 + 2.63512e-18 1.32237e-01 1.48807e-17 1.41488e-17 -1.45990e-17 5.20417e-18 3.68629e-18 3.46945e-18 + -8.93112e-18 -5.42101e-20 -3.90313e-18 -4.30970e-18 0.00000e+00 2.71051e-18 1.13701e+00 3.11708e-19 + -7.48777e-19 1.83806e-18 + 5.10761e-18 1.10318e-17 -2.14469e-18 -4.82752e-01 4.63835e-18 -2.69695e-18 -4.19177e-01 1.60597e-17 + 6.28329e-18 1.48807e-17 1.32237e-01 2.20229e-17 5.83648e-18 -5.71917e-18 1.35525e-18 -1.51788e-18 + -5.42101e-20 2.66985e-18 6.72205e-18 0.00000e+00 9.75782e-19 -3.28988e-18 3.11708e-19 1.13701e+00 + -1.41624e-18 -2.61564e-18 + 4.93297e-17 -1.42674e-16 -5.68359e-19 5.37548e-18 1.30591e-17 7.65718e-19 -1.43022e-17 -1.25547e-17 + -6.24700e-17 1.41488e-17 2.20229e-17 -5.10937e-01 4.15046e-20 -2.96140e-17 -8.13152e-17 -5.96311e-19 + 2.20906e-18 5.02799e-18 5.69206e-19 2.65630e-18 -1.35525e-18 2.75252e-17 -7.48777e-19 -1.41624e-18 + 9.91168e-01 2.16091e-20 + -2.35710e-17 -1.59954e-17 -4.82752e-01 -2.91888e-18 1.09737e-17 -4.19177e-01 -2.14638e-17 2.47469e-17 + -2.61538e-17 -1.45990e-17 5.83648e-18 4.15046e-20 1.32237e-01 -9.62229e-19 1.09504e-17 5.42101e-20 + 3.38136e-18 -2.08709e-18 0.00000e+00 7.18284e-19 -7.35902e-18 -7.01343e-19 1.83806e-18 -2.61564e-18 + 2.16091e-20 1.13701e+00 +Ionic_Step 2 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.999239976680832 9.51223761413776e-05 0.00100497682545169 + 0.250760023319168 0.249904877623859 0.248995023174548 + + + 1.48885e+00 1.85694e+00 8.79559e-18 -6.50521e-19 -8.47033e-18 -6.86707e-17 6.04985e-17 1.35241e-16 + 9.54267e-18 1.73472e-18 1.15196e-18 -1.74845e-17 3.66596e-18 1.23629e+00 2.25011e+00 3.55178e-04 + 5.90487e-04 1.24492e-04 4.28563e-04 7.11768e-04 1.51827e-04 -1.15453e-06 5.48551e-04 2.46587e-03 + 5.95842e-06 1.49023e-03 + 1.85694e+00 4.31653e+00 5.50233e-17 -3.33934e-17 -1.49132e-16 2.53703e-17 1.47451e-16 1.61980e-16 + 5.59042e-17 -3.68629e-18 2.42319e-17 -7.43763e-17 2.14672e-17 2.25011e+00 3.67665e+00 -4.79392e-04 + -7.97562e-04 -1.66751e-04 -5.39661e-04 -8.97294e-04 -1.88913e-04 1.57125e-06 -8.79829e-04 -3.96682e-03 + -8.10910e-06 -2.39668e-03 + -8.79559e-18 -5.50233e-17 5.44536e-01 1.04083e-17 2.78369e-17 5.83149e-01 6.33174e-17 -1.42356e-16 + -5.37019e-18 -3.36103e-18 -1.31731e-17 5.42101e-19 -1.54499e-17 -3.55178e-04 4.79392e-04 -1.24838e-01 + 5.48802e-04 2.46888e-03 -1.17064e-01 4.87005e-04 2.19831e-03 -1.79153e-03 4.75245e-04 1.17592e-04 + -1.72936e-08 -4.82737e-01 + 6.50521e-19 3.33934e-17 1.04083e-17 5.44536e-01 2.60209e-17 6.33174e-17 5.83149e-01 -1.90820e-17 + 8.05020e-18 8.98533e-18 -1.52330e-17 -1.59513e-17 5.29904e-18 -5.90487e-04 7.97562e-04 5.48802e-04 + -1.24830e-01 1.49195e-03 4.87005e-04 -1.17055e-01 1.32804e-03 1.48203e-03 2.90121e-04 -4.82737e-01 + -2.56697e-03 1.17583e-04 + 8.47033e-18 1.49132e-16 2.78369e-17 2.60209e-17 5.44536e-01 -1.42356e-16 -1.90820e-17 5.83149e-01 + -1.38270e-17 -1.52330e-17 -2.61564e-18 1.40133e-17 1.92446e-18 -1.24492e-04 1.66751e-04 2.46888e-03 + 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 -1.17068e-01 3.30013e-04 -4.82737e-01 2.90156e-04 + 5.71591e-04 4.75264e-04 + 6.86707e-17 -2.53703e-17 5.83149e-01 6.33174e-17 -1.42356e-16 6.96122e-01 -6.41848e-17 1.23165e-16 + 1.88380e-18 -3.46945e-18 2.58040e-17 6.53232e-18 2.12504e-17 -4.28563e-04 5.39661e-04 -1.17064e-01 + 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 -1.79747e-03 1.26928e-03 2.91200e-04 + -4.08999e-08 -4.19167e-01 + -6.04985e-17 -1.47451e-16 6.33174e-17 5.83149e-01 -1.90820e-17 -6.41848e-17 6.96122e-01 1.16226e-16 + -3.35018e-17 -2.73761e-18 2.23346e-17 5.33970e-17 -2.85687e-17 -7.11768e-04 8.97294e-04 4.87005e-04 + -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 1.48692e-03 7.69230e-04 -4.19167e-01 + -2.57547e-03 2.91180e-04 + -1.35241e-16 -1.61980e-16 -1.42356e-16 -1.90820e-17 5.83149e-01 1.23165e-16 1.16226e-16 6.96122e-01 + 6.22061e-18 2.23346e-17 -8.13152e-18 -4.16334e-17 -6.41035e-18 -1.51827e-04 1.88913e-04 2.19831e-03 + 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 3.31113e-04 -4.19167e-01 7.69312e-04 + 5.73485e-04 1.26932e-03 + 9.54267e-18 5.59042e-17 5.37019e-18 -8.05020e-18 1.38270e-17 -1.88380e-18 3.35018e-17 -6.22061e-18 + 9.91168e-01 -2.65630e-18 -5.79371e-19 2.57498e-17 -6.94906e-18 -1.15453e-06 1.57125e-06 1.79153e-03 + -1.48203e-03 -3.30013e-04 1.79747e-03 -1.48692e-03 -3.31113e-04 -5.10922e-01 -6.05774e-06 -1.33026e-06 + -1.76263e-05 4.43587e-06 + 1.73472e-18 -3.68629e-18 3.36103e-18 -8.98533e-18 1.52330e-17 3.46945e-18 2.73761e-18 -2.23346e-17 + -2.65630e-18 1.13701e+00 -1.23057e-17 -7.35225e-19 -1.56989e-17 5.48551e-04 -8.79829e-04 -4.75245e-04 + -2.90121e-04 4.82737e-01 -1.26928e-03 -7.69230e-04 4.19167e-01 -6.05774e-06 1.32221e-01 2.17786e-03 + -1.04671e-05 3.60087e-03 + 1.15196e-18 2.42319e-17 1.31731e-17 1.52330e-17 2.61564e-18 -2.58040e-17 -2.23346e-17 8.13152e-18 + -5.79371e-19 -1.23057e-17 1.13701e+00 -1.17094e-17 4.35036e-18 2.46587e-03 -3.96682e-03 -1.17592e-04 + 4.82737e-01 -2.90156e-04 -2.91200e-04 4.19167e-01 -7.69312e-04 -1.33026e-06 2.17786e-03 1.32237e-01 + 2.36050e-06 8.08017e-04 + -1.74845e-17 -7.43763e-17 -5.42101e-19 1.59513e-17 -1.40133e-17 -6.53232e-18 -5.33970e-17 4.16334e-17 + 2.57498e-17 -7.35225e-19 -1.17094e-17 9.91168e-01 -6.34087e-18 5.95842e-06 -8.10910e-06 1.72936e-08 + 2.56697e-03 -5.71591e-04 4.08999e-08 2.57547e-03 -5.73485e-04 -1.76263e-05 -1.04671e-05 2.36050e-06 + -5.10916e-01 5.13066e-08 + 3.66596e-18 2.14672e-17 1.54499e-17 -5.29904e-18 -1.92446e-18 -2.12504e-17 2.85687e-17 6.41035e-18 + -6.94906e-18 -1.56989e-17 4.35036e-18 -6.34087e-18 1.13701e+00 1.49023e-03 -2.39668e-03 4.82737e-01 + -1.17583e-04 -4.75264e-04 4.19167e-01 -2.91180e-04 -1.26932e-03 4.43587e-06 3.60087e-03 8.08017e-04 + 5.13066e-08 1.32226e-01 + 1.23629e+00 2.25011e+00 -3.55178e-04 -5.90487e-04 -1.24492e-04 -4.28563e-04 -7.11768e-04 -1.51827e-04 + -1.15453e-06 5.48551e-04 2.46587e-03 5.95842e-06 1.49023e-03 1.48885e+00 1.85694e+00 1.19818e-16 + -1.56125e-17 -2.23481e-17 -4.56381e-16 6.72205e-18 5.11066e-17 -2.00832e-17 8.59230e-18 -9.28348e-18 + -4.02120e-17 -2.08031e-18 + 2.25011e+00 3.67665e+00 4.79392e-04 7.97562e-04 1.66751e-04 5.39661e-04 8.97294e-04 1.88913e-04 + 1.57125e-06 -8.79829e-04 -3.96682e-03 -8.10910e-06 -2.39668e-03 1.85694e+00 4.31653e+00 1.10534e-16 + 1.51788e-17 -3.98444e-17 2.53703e-17 2.25514e-17 1.75858e-16 4.88569e-17 1.08420e-17 -6.01732e-18 + -7.83878e-17 7.64363e-18 + 3.55178e-04 -4.79392e-04 -1.24838e-01 5.48802e-04 2.46888e-03 -1.17064e-01 4.87005e-04 2.19831e-03 + 1.79153e-03 -4.75245e-04 -1.17592e-04 1.72936e-08 4.82737e-01 -1.19818e-16 -1.10534e-16 5.44536e-01 + 3.98986e-17 -3.04932e-17 5.83149e-01 2.68882e-17 -2.69966e-17 5.06526e-18 -3.52366e-18 8.61941e-18 + 2.85145e-17 1.23599e-17 + 5.90487e-04 -7.97562e-04 5.48802e-04 -1.24830e-01 1.49195e-03 4.87005e-04 -1.17055e-01 1.32804e-03 + -1.48203e-03 -2.90121e-04 4.82737e-01 2.56697e-03 -1.17583e-04 1.56125e-17 -1.51788e-17 3.98986e-17 + 5.44536e-01 -8.67362e-18 2.68882e-17 5.83149e-01 -4.33681e-17 1.13841e-18 3.85298e-17 1.24141e-17 + -3.93023e-19 1.66696e-18 + 1.24492e-04 -1.66751e-04 2.46888e-03 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 -1.17068e-01 + -3.30013e-04 4.82737e-01 -2.90156e-04 -5.71591e-04 -4.75264e-04 2.23481e-17 3.98444e-17 -3.04932e-17 + -8.67362e-18 5.44536e-01 -2.69966e-17 -4.33681e-17 5.83149e-01 4.19790e-18 1.24141e-17 -4.44658e-17 + 1.75370e-17 2.43945e-19 + 4.28563e-04 -5.39661e-04 -1.17064e-01 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 + 1.79747e-03 -1.26928e-03 -2.91200e-04 4.08999e-08 4.19167e-01 4.56381e-16 -2.53703e-17 5.83149e-01 + 2.68882e-17 -2.69966e-17 6.96122e-01 1.04083e-17 -1.73472e-17 3.65783e-17 3.68629e-18 -2.12504e-17 + -6.31819e-17 -1.88651e-17 + 7.11768e-04 -8.97294e-04 4.87005e-04 -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 + -1.48692e-03 -7.69230e-04 4.19167e-01 2.57547e-03 -2.91180e-04 -6.72205e-18 -2.25514e-17 2.68882e-17 + 5.83149e-01 -4.33681e-17 1.04083e-17 6.96122e-01 7.45931e-17 1.08420e-18 5.26651e-17 -1.89735e-17 + -3.30682e-18 1.49078e-19 + 1.51827e-04 -1.88913e-04 2.19831e-03 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 + -3.31113e-04 4.19167e-01 -7.69312e-04 -5.73485e-04 -1.26932e-03 -5.11066e-17 -1.75858e-16 -2.69966e-17 + -4.33681e-17 5.83149e-01 -1.73472e-17 7.45931e-17 6.96122e-01 -3.23770e-17 -1.89735e-17 1.37368e-16 + -4.88975e-17 1.82959e-18 + -1.15453e-06 1.57125e-06 -1.79153e-03 1.48203e-03 3.30013e-04 -1.79747e-03 1.48692e-03 3.31113e-04 + -5.10922e-01 -6.05774e-06 -1.33026e-06 -1.76263e-05 4.43587e-06 -2.00832e-17 4.88569e-17 -5.06526e-18 + -1.13841e-18 -4.19790e-18 -3.65783e-17 -1.08420e-18 3.23770e-17 9.91168e-01 7.79270e-18 -8.96838e-18 + 4.29683e-17 -2.49028e-18 + 5.48551e-04 -8.79829e-04 4.75245e-04 2.90121e-04 -4.82737e-01 1.26928e-03 7.69230e-04 -4.19167e-01 + -6.05774e-06 1.32221e-01 2.17786e-03 -1.04671e-05 3.60087e-03 8.59230e-18 1.08420e-17 3.52366e-18 + -3.85298e-17 -1.24141e-17 -3.68629e-18 -5.26651e-17 1.89735e-17 7.79270e-18 1.13701e+00 -2.16840e-19 + -9.14796e-19 8.95314e-18 + 2.46587e-03 -3.96682e-03 1.17592e-04 -4.82737e-01 2.90156e-04 2.91200e-04 -4.19167e-01 7.69312e-04 + -1.33026e-06 2.17786e-03 1.32237e-01 2.36050e-06 8.08017e-04 -9.28348e-18 -6.01732e-18 -8.61941e-18 + -1.24141e-17 4.44658e-17 2.12504e-17 1.89735e-17 -1.37368e-16 -8.96838e-18 -2.16840e-19 1.13701e+00 + -1.78216e-18 -7.38613e-18 + 5.95842e-06 -8.10910e-06 -1.72936e-08 -2.56697e-03 5.71591e-04 -4.08999e-08 -2.57547e-03 5.73485e-04 + -1.76263e-05 -1.04671e-05 2.36050e-06 -5.10916e-01 5.13066e-08 -4.02120e-17 -7.83878e-17 -2.85145e-17 + 3.93023e-19 -1.75370e-17 6.31819e-17 3.30682e-18 4.88975e-17 4.29683e-17 -9.14796e-19 -1.78216e-18 + 9.91168e-01 -3.80438e-20 + 1.49023e-03 -2.39668e-03 -4.82737e-01 1.17583e-04 4.75264e-04 -4.19167e-01 2.91180e-04 1.26932e-03 + 4.43587e-06 3.60087e-03 8.08017e-04 5.13066e-08 1.32226e-01 -2.08031e-18 7.64363e-18 -1.23599e-17 + -1.66696e-18 -2.43945e-19 1.88651e-17 -1.49078e-19 -1.82959e-18 -2.49028e-18 8.95314e-18 -7.38613e-18 + -3.80438e-20 1.13701e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_syns/sk_nao.txt.ref b/tests/02_NAO_Gamma/md_out_hk_syns/sk_nao.txt.ref deleted file mode 100644 index 8d0685c8541..00000000000 --- a/tests/02_NAO_Gamma/md_out_hk_syns/sk_nao.txt.ref +++ /dev/null @@ -1,178 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - 1.48885e+00 1.85694e+00 1.50298e-17 6.88468e-18 -2.36492e-17 1.00384e-16 4.09828e-17 -4.11861e-17 - 1.20440e-17 -2.12775e-18 9.48677e-20 -3.03848e-17 -6.11897e-18 1.23629e+00 2.25011e+00 1.25400e-16 - 3.90696e-17 -4.36222e-18 -1.23450e-16 -6.48649e-17 6.48861e-17 5.65987e-17 7.06637e-19 8.47965e-18 - 4.95197e-17 2.35825e-17 -Row 2 - 4.31653e+00 7.86589e-17 1.08420e-17 -3.96276e-17 -3.55618e-17 -5.20417e-17 -8.58688e-17 3.03983e-17 - -3.57787e-18 -4.77049e-18 -8.45678e-17 1.40946e-18 2.25011e+00 3.67664e+00 -5.28278e-17 -1.00353e-16 - 1.02837e-16 -2.69262e-16 3.84011e-17 1.30917e-17 -7.82523e-17 1.54296e-17 -3.71339e-18 -1.51241e-16 - -1.15264e-17 -Row 3 - 5.44536e-01 1.10589e-17 -1.03812e-17 5.83149e-01 -2.42861e-17 2.85145e-17 4.43845e-19 7.04731e-19 - -2.53432e-18 5.42101e-19 -5.42101e-20 -1.25400e-16 5.28278e-17 -1.24841e-01 -5.58517e-17 1.37660e-17 - -1.17065e-01 -2.78979e-17 -4.05898e-17 -3.03102e-17 -2.33866e-18 5.04832e-19 -7.17437e-19 -4.82752e-01 -Row 4 - 5.44536e-01 -6.50521e-18 -2.42861e-17 5.83149e-01 8.67362e-19 4.87891e-19 6.48488e-18 -5.42101e-20 - -4.60786e-19 5.83606e-18 -3.90696e-17 1.00353e-16 -5.58517e-17 -1.24841e-01 6.18385e-17 -2.78979e-17 - -1.17065e-01 4.95379e-17 2.29461e-18 1.69457e-17 -4.82752e-01 -1.11861e-17 -1.63689e-18 -Row 5 - 5.44536e-01 2.85145e-17 8.67362e-19 5.83149e-01 -4.84503e-19 -5.42101e-20 1.80249e-18 -1.35525e-18 - -2.48011e-18 4.36222e-18 -1.02837e-16 1.37660e-17 6.18385e-17 -1.24841e-01 -4.05898e-17 4.95379e-17 - -1.17065e-01 4.80776e-18 -4.82752e-01 -8.40765e-18 -1.76522e-17 -8.61433e-19 -Row 6 - 6.96122e-01 4.68375e-17 -5.29091e-17 8.34836e-18 3.14419e-18 -9.05309e-18 2.62919e-18 0.00000e+00 - 1.23450e-16 2.69262e-16 -1.17065e-01 -2.78979e-17 -4.05898e-17 -6.46175e-02 2.56414e-17 1.96241e-17 - 1.85941e-17 -1.39252e-17 -1.35796e-17 1.20617e-18 -4.19177e-01 -Row 7 - 6.96122e-01 -7.80626e-18 1.30104e-18 3.19840e-18 0.00000e+00 -2.57498e-18 5.48877e-18 6.48649e-17 - -3.84011e-17 -2.78979e-17 -1.17065e-01 4.95379e-17 2.56414e-17 -6.46175e-02 -1.10318e-17 6.36969e-19 - -1.88685e-17 -4.19177e-01 7.40053e-18 1.81858e-17 -Row 8 - 6.96122e-01 -3.21195e-18 0.00000e+00 -1.62630e-18 -4.44523e-18 -2.91379e-18 -6.48861e-17 -1.30917e-17 - -4.05898e-17 4.95379e-17 -1.17065e-01 1.96241e-17 -1.10318e-17 -6.46175e-02 3.91668e-18 -4.19177e-01 - -1.15332e-17 2.62648e-17 -1.16467e-17 -Row 9 - 9.91168e-01 -2.23617e-18 2.94429e-18 4.32444e-17 1.48739e-18 5.65987e-17 -7.82523e-17 3.03102e-17 - -2.29461e-18 -4.80776e-18 -1.85941e-17 -6.36969e-19 -3.91668e-18 -5.10937e-01 -7.31921e-18 6.99310e-18 - -6.37714e-17 -1.47968e-17 -Row 10 - 1.13701e+00 -2.29038e-18 -2.98156e-19 -3.06626e-19 7.06637e-19 1.54296e-17 2.33866e-18 -1.69457e-17 - 4.82752e-01 1.39252e-17 1.88685e-17 4.19177e-01 -7.31921e-18 1.32237e-01 1.45266e-17 1.31640e-17 - -5.73399e-18 -Row 11 - 1.13701e+00 -9.04631e-19 -2.79182e-18 8.47965e-18 -3.71339e-18 -5.04832e-19 4.82752e-01 8.40765e-18 - 1.35796e-17 4.19177e-01 1.15332e-17 6.99310e-18 1.45266e-17 1.32237e-01 1.70262e-17 -6.55604e-19 -Row 12 - 9.91168e-01 2.16091e-20 4.95197e-17 -1.51241e-16 7.17437e-19 1.11861e-17 1.76522e-17 -1.20617e-18 - -7.40053e-18 -2.62648e-17 -6.37714e-17 1.31640e-17 1.70262e-17 -5.10937e-01 -2.84074e-19 -Row 13 - 1.13701e+00 2.35825e-17 -1.15264e-17 4.82752e-01 1.63689e-18 8.61433e-19 4.19177e-01 -1.81858e-17 - 1.16467e-17 -1.47968e-17 -5.73399e-18 -6.55604e-19 -2.84074e-19 1.32237e-01 -Row 14 - 1.48885e+00 1.85694e+00 1.50298e-17 6.88468e-18 -2.36492e-17 1.00384e-16 4.09828e-17 -4.11861e-17 - 1.20440e-17 -2.12775e-18 9.48677e-20 -3.03848e-17 -6.11897e-18 -Row 15 - 4.31653e+00 7.86589e-17 1.08420e-17 -3.96276e-17 -3.55618e-17 -5.20417e-17 -8.58688e-17 3.03983e-17 - -3.57787e-18 -4.77049e-18 -8.45678e-17 1.40946e-18 -Row 16 - 5.44536e-01 1.10589e-17 -1.03812e-17 5.83149e-01 -2.42861e-17 2.85145e-17 4.43845e-19 7.04731e-19 - -2.53432e-18 5.42101e-19 -5.42101e-20 -Row 17 - 5.44536e-01 -6.50521e-18 -2.42861e-17 5.83149e-01 8.67362e-19 4.87891e-19 6.48488e-18 -5.42101e-20 - -4.60786e-19 5.83606e-18 -Row 18 - 5.44536e-01 2.85145e-17 8.67362e-19 5.83149e-01 -4.84503e-19 -5.42101e-20 1.80249e-18 -1.35525e-18 - -2.48011e-18 -Row 19 - 6.96122e-01 4.68375e-17 -5.29091e-17 8.34836e-18 3.14419e-18 -9.05309e-18 2.62919e-18 0.00000e+00 -Row 20 - 6.96122e-01 -7.80626e-18 1.30104e-18 3.19840e-18 0.00000e+00 -2.57498e-18 5.48877e-18 -Row 21 - 6.96122e-01 -3.21195e-18 0.00000e+00 -1.62630e-18 -4.44523e-18 -2.91379e-18 -Row 22 - 9.91168e-01 -2.23617e-18 2.94429e-18 4.32444e-17 1.48739e-18 -Row 23 - 1.13701e+00 -2.29038e-18 -2.98156e-19 -3.06626e-19 -Row 24 - 1.13701e+00 -9.04631e-19 -2.79182e-18 -Row 25 - 9.91168e-01 2.16091e-20 -Row 26 - 1.13701e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - 1.48885e+00 1.85694e+00 -1.34848e-17 1.16281e-16 3.25125e-17 -6.35478e-17 -2.30501e-16 1.21566e-17 - 5.10507e-18 -5.48877e-18 4.06576e-20 -4.59837e-17 -9.75104e-18 1.23629e+00 2.25011e+00 3.55178e-04 - 5.90487e-04 1.24492e-04 4.28563e-04 7.11768e-04 1.51827e-04 -1.15453e-06 5.48551e-04 2.46587e-03 - 5.95842e-06 1.49023e-03 -Row 2 - 4.31653e+00 -3.84350e-17 5.42101e-17 2.28225e-17 -1.47451e-17 9.71445e-17 7.80626e-18 9.90690e-18 - -4.55365e-18 -4.87891e-18 -1.05927e-16 -5.74627e-18 2.25011e+00 3.67665e+00 -4.79392e-04 -7.97562e-04 - -1.66751e-04 -5.39661e-04 -8.97294e-04 -1.88913e-04 1.57125e-06 -8.79829e-04 -3.96682e-03 -8.10910e-06 - -2.39668e-03 -Row 3 - 5.44536e-01 -8.45678e-18 -9.08019e-18 5.83149e-01 -3.81639e-17 2.24430e-17 -5.04832e-19 7.66531e-17 - -2.58853e-18 5.96311e-19 -4.98733e-18 -3.55178e-04 4.79392e-04 -1.24838e-01 5.48802e-04 2.46888e-03 - -1.17064e-01 4.87005e-04 2.19831e-03 -1.79153e-03 4.75245e-04 1.17592e-04 -1.72936e-08 -4.82737e-01 -Row 4 - 5.44536e-01 -1.77809e-17 -3.81639e-17 5.83149e-01 7.63278e-17 4.54823e-17 6.48488e-18 -4.87891e-18 - -2.16840e-17 -8.00107e-18 -5.90487e-04 7.97562e-04 5.48802e-04 -1.24830e-01 1.49195e-03 4.87005e-04 - -1.17055e-01 1.32804e-03 1.48203e-03 2.90121e-04 -4.82737e-01 -2.56697e-03 1.17583e-04 -Row 5 - 5.44536e-01 2.24430e-17 7.63278e-17 5.83149e-01 -6.20028e-19 -4.87891e-18 1.74828e-18 -1.32815e-18 - -1.26716e-17 -1.24492e-04 1.66751e-04 2.46888e-03 1.49195e-03 -1.24842e-01 2.19831e-03 1.32804e-03 - -1.17068e-01 3.30013e-04 -4.82737e-01 2.90156e-04 5.71591e-04 4.75264e-04 -Row 6 - 6.96122e-01 3.29597e-17 -1.12757e-17 -5.42101e-18 1.96241e-17 4.82470e-18 2.79182e-18 7.37257e-18 - -4.28563e-04 5.39661e-04 -1.17064e-01 4.87005e-04 2.19831e-03 -6.46215e-02 4.09418e-04 1.86883e-03 - -1.79747e-03 1.26928e-03 2.91200e-04 -4.08999e-08 -4.19167e-01 -Row 7 - 6.96122e-01 -6.33174e-17 -1.09288e-16 -2.98156e-18 7.37257e-18 6.13929e-17 4.43168e-18 -7.11768e-04 - 8.97294e-04 4.87005e-04 -1.17055e-01 1.32804e-03 4.09418e-04 -6.46140e-02 1.12787e-03 1.48692e-03 - 7.69230e-04 -4.19167e-01 -2.57547e-03 2.91180e-04 -Row 8 - 6.96122e-01 4.16063e-18 7.37257e-18 -1.19262e-18 -4.49944e-18 1.00953e-16 -1.51827e-04 1.88913e-04 - 2.19831e-03 1.32804e-03 -1.17068e-01 1.86883e-03 1.12787e-03 -6.46252e-02 3.31113e-04 -4.19167e-01 - 7.69312e-04 5.73485e-04 1.26932e-03 -Row 9 - 9.91168e-01 -6.77626e-19 2.86975e-18 9.53674e-17 4.83486e-18 -1.15453e-06 1.57125e-06 1.79153e-03 - -1.48203e-03 -3.30013e-04 1.79747e-03 -1.48692e-03 -3.31113e-04 -5.10922e-01 -6.05774e-06 -1.33026e-06 - -1.76263e-05 4.43587e-06 -Row 10 - 1.13701e+00 4.91957e-18 -7.44373e-18 3.62361e-18 5.48551e-04 -8.79829e-04 -4.75245e-04 -2.90121e-04 - 4.82737e-01 -1.26928e-03 -7.69230e-04 4.19167e-01 -6.05774e-06 1.32221e-01 2.17786e-03 -1.04671e-05 - 3.60087e-03 -Row 11 - 1.13701e+00 -6.94567e-19 5.61075e-18 2.46587e-03 -3.96682e-03 -1.17592e-04 4.82737e-01 -2.90156e-04 - -2.91200e-04 4.19167e-01 -7.69312e-04 -1.33026e-06 2.17786e-03 1.32237e-01 2.36050e-06 8.08017e-04 -Row 12 - 9.91168e-01 -3.10902e-18 5.95842e-06 -8.10910e-06 1.72936e-08 2.56697e-03 -5.71591e-04 4.08999e-08 - 2.57547e-03 -5.73485e-04 -1.76263e-05 -1.04671e-05 2.36050e-06 -5.10916e-01 5.13066e-08 -Row 13 - 1.13701e+00 1.49023e-03 -2.39668e-03 4.82737e-01 -1.17583e-04 -4.75264e-04 4.19167e-01 -2.91180e-04 - -1.26932e-03 4.43587e-06 3.60087e-03 8.08017e-04 5.13066e-08 1.32226e-01 -Row 14 - 1.48885e+00 1.85694e+00 -7.76763e-17 7.57315e-17 1.30158e-16 1.06442e-16 -2.34621e-16 -1.83013e-16 - -1.86686e-18 -5.54298e-18 -3.57787e-18 -3.55652e-17 -4.91957e-18 -Row 15 - 4.31653e+00 -8.65735e-17 6.07153e-17 8.14236e-17 3.36753e-16 1.28370e-16 -9.10730e-18 -8.60314e-17 - -4.33681e-18 -1.30104e-17 -9.74156e-17 -4.28260e-18 -Row 16 - 5.44536e-01 -5.20417e-18 -2.11962e-17 5.83149e-01 -1.99493e-17 7.28042e-17 -1.60564e-17 6.97142e-17 - 6.62041e-17 -2.16840e-19 -1.23057e-17 -Row 17 - 5.44536e-01 -2.14672e-17 -1.99493e-17 5.83149e-01 3.03577e-18 4.19044e-17 8.00277e-18 -1.22515e-17 - -3.68968e-17 3.90889e-17 -Row 18 - 5.44536e-01 7.28042e-17 3.03577e-18 5.83149e-01 4.06677e-17 -1.22515e-17 4.78404e-18 6.81014e-17 - 8.09763e-18 -Row 19 - 6.96122e-01 6.07153e-17 -8.17488e-17 6.91721e-17 1.14925e-17 1.34441e-17 7.15573e-18 1.85399e-17 -Row 20 - 6.96122e-01 -7.89299e-17 -1.08529e-16 -4.14707e-18 1.83230e-17 7.34276e-17 2.51467e-17 -Row 21 - 6.96122e-01 -9.89199e-17 1.83230e-17 -1.82688e-17 -1.26039e-16 1.00899e-16 -Row 22 - 9.91168e-01 7.99599e-19 3.28310e-18 3.65647e-17 1.79300e-17 -Row 23 - 1.13701e+00 1.34034e-17 -7.09475e-18 7.10999e-18 -Row 24 - 1.13701e+00 2.66307e-18 4.17418e-18 -Row 25 - 9.91168e-01 1.79660e-21 -Row 26 - 1.13701e+00 diff --git a/tests/02_NAO_Gamma/md_out_hk_syns/syns_nao.csr.ref b/tests/02_NAO_Gamma/md_out_hk_syns/syns_nao.csr.ref index 166a7807547..1ea84a5a2a4 100644 --- a/tests/02_NAO_Gamma/md_out_hk_syns/syns_nao.csr.ref +++ b/tests/02_NAO_Gamma/md_out_hk_syns/syns_nao.csr.ref @@ -1,4 +1,4 @@ -IONIC_STEP: 1 +Ionic_Step 1 Matrix Dimension of S_async(R): 26 Matrix number of S_async(R): 1 #----------------------------------------------------------------------# @@ -171,7 +171,7 @@ Matrix number of S_async(R): 1 0 26 52 78 104 130 156 182 208 234 260 286 311 336 362 388 414 440 466 492 518 544 570 596 622 647 672 -IONIC_STEP: 2 +Ionic_Step 2 Matrix Dimension of S_async(R): 26 Matrix number of S_async(R): 1 #----------------------------------------------------------------------# diff --git a/tests/02_NAO_Gamma/relax_out_hk/h_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk/h_nao.txt.ref new file mode 100644 index 00000000000..583e84ef3ad --- /dev/null +++ b/tests/02_NAO_Gamma/relax_out_hk/h_nao.txt.ref @@ -0,0 +1,66 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.944032 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.251000000000204 0.251000000000204 0.251000000000204 + + + -1.59432e-01 9.24279e-04 -9.24279e-04 -9.24279e-04 -4.72133e-01 -4.06696e-04 4.06696e-04 4.06696e-04 + 9.24279e-04 1.32251e+00 -9.21858e-04 -9.21858e-04 1.98481e-04 -7.16261e-02 -7.43661e-05 -7.43661e-05 + -9.24279e-04 -9.21858e-04 1.32251e+00 9.21858e-04 -1.98481e-04 -7.43661e-05 -7.16261e-02 7.43661e-05 + -9.24279e-04 -9.21858e-04 9.21858e-04 1.32251e+00 -1.98481e-04 -7.43661e-05 7.43661e-05 -7.16261e-02 + -4.72133e-01 1.98481e-04 -1.98481e-04 -1.98481e-04 -1.59427e-01 -1.31462e-03 1.31462e-03 1.31462e-03 + -4.06696e-04 -7.16261e-02 -7.43661e-05 -7.43661e-05 -1.31462e-03 1.32243e+00 -9.13966e-04 -9.13966e-04 + 4.06696e-04 -7.43661e-05 -7.16261e-02 7.43661e-05 1.31462e-03 -9.13966e-04 1.32243e+00 9.13966e-04 + 4.06696e-04 -7.43661e-05 7.43661e-05 -7.16261e-02 1.31462e-03 -9.13966e-04 9.13966e-04 1.32243e+00 +Ionic_Step 2 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.978234 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.0080048684404679 0.0080048684404679 0.0080048684404679 + 0.242995131559736 0.242995131559736 0.242995131559736 + + + -1.46817e-01 -2.23048e-03 2.23048e-03 2.23048e-03 -4.61859e-01 -7.94511e-03 7.94511e-03 7.94511e-03 + -2.23048e-03 1.33207e+00 3.84298e-03 3.84298e-03 7.80126e-03 -7.60614e-02 1.44866e-02 1.44866e-02 + 2.23048e-03 3.84298e-03 1.33207e+00 -3.84298e-03 -7.80126e-03 1.44866e-02 -7.60614e-02 -1.44866e-02 + 2.23048e-03 3.84298e-03 -3.84298e-03 1.33207e+00 -7.80126e-03 1.44866e-02 -1.44866e-02 -7.60614e-02 + -4.61859e-01 7.80126e-03 -7.80126e-03 -7.80126e-03 -1.46819e-01 2.16331e-03 -2.16331e-03 -2.16331e-03 + -7.94511e-03 -7.60614e-02 1.44866e-02 1.44866e-02 2.16331e-03 1.33292e+00 3.21585e-03 3.21585e-03 + 7.94511e-03 1.44866e-02 -7.60614e-02 -1.44866e-02 -2.16331e-03 3.21585e-03 1.33292e+00 -3.21585e-03 + 7.94511e-03 1.44866e-02 -1.44866e-02 -7.60614e-02 -2.16331e-03 3.21585e-03 -3.21585e-03 1.33292e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk/hk_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk/hk_nao.txt.ref deleted file mode 100644 index fc93c840e65..00000000000 --- a/tests/02_NAO_Gamma/relax_out_hk/hk_nao.txt.ref +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.59432e-01 9.24250e-04 -9.24250e-04 -9.24250e-04 -4.72133e-01 -4.06675e-04 4.06675e-04 4.06675e-04 -Row 2 - 1.32251e+00 -9.21838e-04 -9.21838e-04 1.98460e-04 -7.16261e-02 -7.43900e-05 -7.43900e-05 -Row 3 - 1.32251e+00 9.21838e-04 -1.98460e-04 -7.43900e-05 -7.16261e-02 7.43900e-05 -Row 4 - 1.32251e+00 -1.98460e-04 -7.43900e-05 7.43900e-05 -7.16261e-02 -Row 5 - -1.59427e-01 -1.31465e-03 1.31465e-03 1.31465e-03 -Row 6 - 1.32243e+00 -9.14026e-04 -9.14026e-04 -Row 7 - 1.32243e+00 9.14026e-04 -Row 8 - 1.32243e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.46817e-01 -2.23052e-03 2.23052e-03 2.23052e-03 -4.61859e-01 -7.94508e-03 7.94508e-03 7.94508e-03 -Row 2 - 1.33207e+00 3.84287e-03 3.84287e-03 7.80125e-03 -7.60615e-02 1.44866e-02 1.44866e-02 -Row 3 - 1.33207e+00 -3.84287e-03 -7.80125e-03 1.44866e-02 -7.60615e-02 -1.44866e-02 -Row 4 - 1.33207e+00 -7.80125e-03 1.44866e-02 -1.44866e-02 -7.60615e-02 -Row 5 - -1.46819e-01 2.16332e-03 -2.16332e-03 -2.16332e-03 -Row 6 - 1.33292e+00 3.21595e-03 3.21595e-03 -Row 7 - 1.33292e+00 -3.21595e-03 -Row 8 - 1.33292e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk/s_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk/s_nao.txt.ref new file mode 100644 index 00000000000..07b61e35780 --- /dev/null +++ b/tests/02_NAO_Gamma/relax_out_hk/s_nao.txt.ref @@ -0,0 +1,66 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.251000000000204 0.251000000000204 0.251000000000204 + + + 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 8.22869e-01 9.81584e-04 -9.81584e-04 -9.81584e-04 + 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 -9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 + 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 + 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 + 8.22869e-01 -9.81584e-04 9.81584e-04 9.81584e-04 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 + 9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 + -9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 + -9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 +Ionic_Step 2 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.0080048684404679 0.0080048684404679 0.0080048684404679 + 0.242995131559736 0.242995131559736 0.242995131559736 + + + 1.15061e+00 -1.31188e-17 -1.39379e-20 -1.39379e-20 8.23962e-01 -1.82457e-02 1.82457e-02 1.82457e-02 + 1.31188e-17 1.16565e+00 -1.26565e-19 -1.26565e-19 1.82457e-02 -3.15301e-01 5.22531e-02 5.22531e-02 + 1.39379e-20 -1.26565e-19 1.16565e+00 8.05970e-19 -1.82457e-02 5.22531e-02 -3.15301e-01 -5.22531e-02 + 1.39379e-20 -1.26565e-19 8.05970e-19 1.16565e+00 -1.82457e-02 5.22531e-02 -5.22531e-02 -3.15301e-01 + 8.23962e-01 1.82457e-02 -1.82457e-02 -1.82457e-02 1.15061e+00 -1.31188e-17 2.02733e-20 2.02733e-20 + -1.82457e-02 -3.15301e-01 5.22531e-02 5.22531e-02 1.31188e-17 1.16565e+00 1.84095e-19 1.84095e-19 + 1.82457e-02 5.22531e-02 -3.15301e-01 -5.22531e-02 -2.02733e-20 1.84095e-19 1.16565e+00 -1.17232e-18 + 1.82457e-02 5.22531e-02 -5.22531e-02 -3.15301e-01 -2.02733e-20 1.84095e-19 -1.17232e-18 1.16565e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk/sk_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk/sk_nao.txt.ref deleted file mode 100644 index 59f326ca1ad..00000000000 --- a/tests/02_NAO_Gamma/relax_out_hk/sk_nao.txt.ref +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - 1.15061e+00 -6.50521e-19 0.00000e+00 0.00000e+00 8.22869e-01 9.81584e-04 -9.81584e-04 -9.81584e-04 -Row 2 - 1.16565e+00 0.00000e+00 0.00000e+00 -9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 -Row 3 - 1.16565e+00 0.00000e+00 9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 -Row 4 - 1.16565e+00 9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 -Row 5 - 1.15061e+00 -6.50521e-19 0.00000e+00 0.00000e+00 -Row 6 - 1.16565e+00 0.00000e+00 0.00000e+00 -Row 7 - 1.16565e+00 0.00000e+00 -Row 8 - 1.16565e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - 1.15061e+00 -6.50521e-19 1.39379e-20 1.39379e-20 8.23962e-01 -1.82457e-02 1.82457e-02 1.82457e-02 -Row 2 - 1.16565e+00 -1.26565e-19 -1.26565e-19 1.82457e-02 -3.15301e-01 5.22531e-02 5.22531e-02 -Row 3 - 1.16565e+00 8.05970e-19 -1.82457e-02 5.22531e-02 -3.15301e-01 -5.22531e-02 -Row 4 - 1.16565e+00 -1.82457e-02 5.22531e-02 -5.22531e-02 -3.15301e-01 -Row 5 - 1.15061e+00 -6.50521e-19 -2.02733e-20 -2.02733e-20 -Row 6 - 1.16565e+00 1.84095e-19 1.84095e-19 -Row 7 - 1.16565e+00 -1.17232e-18 -Row 8 - 1.16565e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/hks1_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/hks1_nao.txt.ref deleted file mode 100644 index dd2999c3d5d..00000000000 --- a/tests/02_NAO_Gamma/relax_out_hk_spin2/hks1_nao.txt.ref +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks1_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.46465e-01 -5.54985e-02 5.54985e-02 5.54985e-02 -4.63965e-01 2.87498e-03 -2.87498e-03 -2.87498e-03 -Row 2 - 1.33713e+00 5.62000e-03 5.62000e-03 -1.82286e-02 -7.47451e-02 -7.87877e-03 -7.87877e-03 -Row 3 - 1.33713e+00 -5.62000e-03 1.82286e-02 -7.87877e-03 -7.47451e-02 7.87877e-03 -Row 4 - 1.33713e+00 1.82286e-02 -7.87877e-03 7.87877e-03 -7.47451e-02 -Row 5 - -1.45396e-01 -2.16755e-02 2.16755e-02 2.16755e-02 -Row 6 - 1.33895e+00 7.95026e-03 7.95026e-03 -Row 7 - 1.33895e+00 -7.95026e-03 -Row 8 - 1.33895e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hks1_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.28578e-01 4.12177e-03 -4.12177e-03 -4.12177e-03 -4.44719e-01 6.36358e-03 -6.36358e-03 -6.36358e-03 -Row 2 - 1.34664e+00 7.56486e-04 7.56486e-04 -6.23873e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 -Row 3 - 1.34664e+00 -7.56486e-04 6.23873e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 -Row 4 - 1.34664e+00 6.23873e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 -Row 5 - -1.28227e-01 -4.00282e-03 4.00282e-03 4.00282e-03 -Row 6 - 1.34698e+00 -1.55856e-04 -1.55856e-04 -Row 7 - 1.34698e+00 1.55856e-04 -Row 8 - 1.34698e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/hks2_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/hks2_nao.txt.ref deleted file mode 100644 index 81a9217e882..00000000000 --- a/tests/02_NAO_Gamma/relax_out_hk_spin2/hks2_nao.txt.ref +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks2_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.45415e-01 2.13857e-02 -2.13857e-02 -2.13857e-02 -4.63929e-01 1.80193e-02 -1.80193e-02 -1.80193e-02 -Row 2 - 1.33904e+00 7.87863e-03 7.87863e-03 -3.03837e-03 -7.47346e-02 -7.89124e-03 -7.89124e-03 -Row 3 - 1.33904e+00 -7.87863e-03 3.03837e-03 -7.89124e-03 -7.47346e-02 7.89124e-03 -Row 4 - 1.33904e+00 3.03837e-03 -7.89124e-03 7.89124e-03 -7.47346e-02 -Row 5 - -1.46410e-01 5.51596e-02 -5.51596e-02 -5.51596e-02 -Row 6 - 1.33712e+00 5.59183e-03 5.59183e-03 -Row 7 - 1.33712e+00 -5.59183e-03 -Row 8 - 1.33712e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/hks2_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -1.28578e-01 4.12176e-03 -4.12176e-03 -4.12176e-03 -4.44719e-01 6.36357e-03 -6.36357e-03 -6.36357e-03 -Row 2 - 1.34664e+00 7.56487e-04 7.56487e-04 -6.23873e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 -Row 3 - 1.34664e+00 -7.56487e-04 6.23873e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 -Row 4 - 1.34664e+00 6.23873e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 -Row 5 - -1.28227e-01 -4.00283e-03 4.00283e-03 4.00283e-03 -Row 6 - 1.34698e+00 -1.55856e-04 -1.55856e-04 -Row 7 - 1.34698e+00 1.55856e-04 -Row 8 - 1.34698e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/hs1_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/hs1_nao.txt.ref new file mode 100644 index 00000000000..c59a1a6e893 --- /dev/null +++ b/tests/02_NAO_Gamma/relax_out_hk_spin2/hs1_nao.txt.ref @@ -0,0 +1,66 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.958828 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.251000000000204 0.251000000000204 0.251000000000204 + + + -1.46465e-01 -5.54985e-02 5.54985e-02 5.54985e-02 -4.63965e-01 2.87498e-03 -2.87498e-03 -2.87498e-03 + -5.54985e-02 1.33713e+00 5.62000e-03 5.62000e-03 -1.82286e-02 -7.47451e-02 -7.87877e-03 -7.87877e-03 + 5.54985e-02 5.62000e-03 1.33713e+00 -5.62000e-03 1.82286e-02 -7.87877e-03 -7.47451e-02 7.87877e-03 + 5.54985e-02 5.62000e-03 -5.62000e-03 1.33713e+00 1.82286e-02 -7.87877e-03 7.87877e-03 -7.47451e-02 + -4.63965e-01 -1.82286e-02 1.82286e-02 1.82286e-02 -1.45396e-01 -2.16755e-02 2.16755e-02 2.16755e-02 + 2.87498e-03 -7.47451e-02 -7.87877e-03 -7.87877e-03 -2.16755e-02 1.33895e+00 7.95026e-03 7.95026e-03 + -2.87498e-03 -7.87877e-03 -7.47451e-02 7.87877e-03 2.16755e-02 7.95026e-03 1.33895e+00 -7.95026e-03 + -2.87498e-03 -7.87877e-03 7.87877e-03 -7.47451e-02 2.16755e-02 7.95026e-03 -7.95026e-03 1.33895e+00 +Ionic_Step 2 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.972922 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.97998782889829 0.979987828899127 0.979987828899074 + 0.271012171101914 0.271012171101077 0.27101217110113 + + + -1.28578e-01 4.12177e-03 -4.12177e-03 -4.12177e-03 -4.44719e-01 6.36358e-03 -6.36358e-03 -6.36358e-03 + 4.12177e-03 1.34664e+00 7.56486e-04 7.56486e-04 -6.23873e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 + -4.12177e-03 7.56486e-04 1.34664e+00 -7.56486e-04 6.23873e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 + -4.12177e-03 7.56486e-04 -7.56486e-04 1.34664e+00 6.23873e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 + -4.44719e-01 -6.23873e-03 6.23873e-03 6.23873e-03 -1.28227e-01 -4.00282e-03 4.00282e-03 4.00282e-03 + 6.36358e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 -4.00282e-03 1.34698e+00 -1.55856e-04 -1.55856e-04 + -6.36358e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 4.00282e-03 -1.55856e-04 1.34698e+00 1.55856e-04 + -6.36358e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 4.00282e-03 -1.55856e-04 1.55856e-04 1.34698e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/hs2_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/hs2_nao.txt.ref new file mode 100644 index 00000000000..18e3f4d5b57 --- /dev/null +++ b/tests/02_NAO_Gamma/relax_out_hk_spin2/hs2_nao.txt.ref @@ -0,0 +1,66 @@ +Ionic_Step 1 + 2 # number of spin directions + 2 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.958828 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.251000000000204 0.251000000000204 0.251000000000204 + + + -1.45415e-01 2.13857e-02 -2.13857e-02 -2.13857e-02 -4.63929e-01 1.80193e-02 -1.80193e-02 -1.80193e-02 + 2.13857e-02 1.33904e+00 7.87863e-03 7.87863e-03 -3.03837e-03 -7.47346e-02 -7.89124e-03 -7.89124e-03 + -2.13857e-02 7.87863e-03 1.33904e+00 -7.87863e-03 3.03837e-03 -7.89124e-03 -7.47346e-02 7.89124e-03 + -2.13857e-02 7.87863e-03 -7.87863e-03 1.33904e+00 3.03837e-03 -7.89124e-03 7.89124e-03 -7.47346e-02 + -4.63929e-01 -3.03837e-03 3.03837e-03 3.03837e-03 -1.46410e-01 5.51596e-02 -5.51596e-02 -5.51596e-02 + 1.80193e-02 -7.47346e-02 -7.89124e-03 -7.89124e-03 5.51596e-02 1.33712e+00 5.59183e-03 5.59183e-03 + -1.80193e-02 -7.89124e-03 -7.47346e-02 7.89124e-03 -5.51596e-02 5.59183e-03 1.33712e+00 -5.59183e-03 + -1.80193e-02 -7.89124e-03 7.89124e-03 -7.47346e-02 -5.51596e-02 5.59183e-03 -5.59183e-03 1.33712e+00 +Ionic_Step 2 + 2 # number of spin directions + 2 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.972922 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.97998782889829 0.979987828899127 0.979987828899074 + 0.271012171101914 0.271012171101077 0.27101217110113 + + + -1.28578e-01 4.12176e-03 -4.12176e-03 -4.12176e-03 -4.44719e-01 6.36357e-03 -6.36357e-03 -6.36357e-03 + 4.12176e-03 1.34664e+00 7.56487e-04 7.56487e-04 -6.23873e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 + -4.12176e-03 7.56487e-04 1.34664e+00 -7.56487e-04 6.23873e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 + -4.12176e-03 7.56487e-04 -7.56487e-04 1.34664e+00 6.23873e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 + -4.44719e-01 -6.23873e-03 6.23873e-03 6.23873e-03 -1.28227e-01 -4.00283e-03 4.00283e-03 4.00283e-03 + 6.36357e-03 -1.06299e-01 -3.22719e-04 -3.22719e-04 -4.00283e-03 1.34698e+00 -1.55856e-04 -1.55856e-04 + -6.36357e-03 -3.22719e-04 -1.06299e-01 3.22719e-04 4.00283e-03 -1.55856e-04 1.34698e+00 1.55856e-04 + -6.36357e-03 -3.22719e-04 3.22719e-04 -1.06299e-01 4.00283e-03 -1.55856e-04 1.55856e-04 1.34698e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/s_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/s_nao.txt.ref new file mode 100644 index 00000000000..e0a58aef7a1 --- /dev/null +++ b/tests/02_NAO_Gamma/relax_out_hk_spin2/s_nao.txt.ref @@ -0,0 +1,66 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.251000000000204 0.251000000000204 0.251000000000204 + + + 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 8.22869e-01 9.81584e-04 -9.81584e-04 -9.81584e-04 + 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 -9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 + 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 + 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 + 8.22869e-01 -9.81584e-04 9.81584e-04 9.81584e-04 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 + 9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 + -9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 + -9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 +Ionic_Step 2 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0.97998782889829 0.979987828899127 0.979987828899074 + 0.271012171101914 0.271012171101077 0.27101217110113 + + + 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 8.26037e-01 1.61416e-02 -1.61416e-02 -1.61416e-02 + 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 -1.61416e-02 -2.96923e-01 -1.19879e-01 -1.19879e-01 + 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 1.61416e-02 -1.19879e-01 -2.96923e-01 1.19879e-01 + 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 1.61416e-02 -1.19879e-01 1.19879e-01 -2.96923e-01 + 8.26037e-01 -1.61416e-02 1.61416e-02 1.61416e-02 1.15061e+00 -1.31188e-17 0.00000e+00 0.00000e+00 + 1.61416e-02 -2.96923e-01 -1.19879e-01 -1.19879e-01 1.31188e-17 1.16565e+00 0.00000e+00 0.00000e+00 + -1.61416e-02 -1.19879e-01 -2.96923e-01 1.19879e-01 0.00000e+00 0.00000e+00 1.16565e+00 0.00000e+00 + -1.61416e-02 -1.19879e-01 1.19879e-01 -2.96923e-01 0.00000e+00 0.00000e+00 0.00000e+00 1.16565e+00 diff --git a/tests/02_NAO_Gamma/relax_out_hk_spin2/sk_nao.txt.ref b/tests/02_NAO_Gamma/relax_out_hk_spin2/sk_nao.txt.ref deleted file mode 100644 index 2030d7d0ce7..00000000000 --- a/tests/02_NAO_Gamma/relax_out_hk_spin2/sk_nao.txt.ref +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - 1.15061e+00 1.31188e-17 0.00000e+00 0.00000e+00 8.22869e-01 9.81584e-04 -9.81584e-04 -9.81584e-04 -Row 2 - 1.16565e+00 0.00000e+00 0.00000e+00 -9.81584e-04 -3.19683e-01 -3.40116e-03 -3.40116e-03 -Row 3 - 1.16565e+00 0.00000e+00 9.81584e-04 -3.40116e-03 -3.19683e-01 3.40116e-03 -Row 4 - 1.16565e+00 9.81584e-04 -3.40116e-03 3.40116e-03 -3.19683e-01 -Row 5 - 1.15061e+00 1.31188e-17 0.00000e+00 0.00000e+00 -Row 6 - 1.16565e+00 0.00000e+00 0.00000e+00 -Row 7 - 1.16565e+00 0.00000e+00 -Row 8 - 1.16565e+00 -#------------------------------------------------------------------------ -# ionic step 2 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - 1.15061e+00 1.31188e-17 0.00000e+00 0.00000e+00 8.26037e-01 1.61416e-02 -1.61416e-02 -1.61416e-02 -Row 2 - 1.16565e+00 0.00000e+00 0.00000e+00 -1.61416e-02 -2.96923e-01 -1.19879e-01 -1.19879e-01 -Row 3 - 1.16565e+00 0.00000e+00 1.61416e-02 -1.19879e-01 -2.96923e-01 1.19879e-01 -Row 4 - 1.16565e+00 1.61416e-02 -1.19879e-01 1.19879e-01 -2.96923e-01 -Row 5 - 1.15061e+00 1.31188e-17 -6.97944e-18 -3.50999e-18 -Row 6 - 1.16565e+00 3.68189e-19 -6.57070e-18 -Row 7 - 1.16565e+00 -5.44590e-18 -Row 8 - 1.16565e+00 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhkz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhk1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhkz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhk1z_ia2_nao.txt index e0d1efcfd36..8c193bb32d8 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhkz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dhk1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhkz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dhk1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtkz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtk1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtkz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtk1z_ia2_nao.txt index 17c349cbc21..4695b899d51 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtkz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dtk1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dtkz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dtk1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhkz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhk1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhkz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhk1z_ia2_nao.txt index de69884dfee..0b091d109a6 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhkz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvhk1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dvhkz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dvhk1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlkz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlk1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlkz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlk1z_ia2_nao.txt index 395497b494f..0705c293e35 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlkz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvlk1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dvlkz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dvlk1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlkz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlk1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlkz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlk1z_ia2_nao.txt index cb09923c1fe..dc1fc78b2a0 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlkz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvnlk1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dvnlkz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dvnlk1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxckz_iat2_nao.txt b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxck1z_ia2_nao.txt similarity index 98% rename from tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxckz_iat2_nao.txt rename to tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxck1z_ia2_nao.txt index 6962a3588f6..18ccdb80a12 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxckz_iat2_nao.txt +++ b/tests/02_NAO_Gamma/scf_out_dh/dhk_ref/dvxck1z_ia2_nao.txt @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dvxckz_iat2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/dvxck1z_ia2_nao.txt # gamma only 0 # rows 10 # columns 10 diff --git a/tests/02_NAO_Gamma/scf_out_dh/result.ref b/tests/02_NAO_Gamma/scf_out_dh/result.ref index de19b0f2c76..effb49a58ae 100644 --- a/tests/02_NAO_Gamma/scf_out_dh/result.ref +++ b/tests/02_NAO_Gamma/scf_out_dh/result.ref @@ -1,8 +1,8 @@ etotref -31.60025016751435 etotperatomref -15.8001251669 -Compare_dhkz_iat2_nao_pass 0 -Compare_dtkz_iat2_nao_pass 0 -Compare_dvhkz_iat2_nao_pass 0 -Compare_dvlkz_iat2_nao_pass 0 -Compare_dvnlkz_iat2_nao_pass 0 -Compare_dvxckz_iat2_nao_pass 0 +Compare_dhk1z_ia2_nao_pass 0 +Compare_dtk1z_ia2_nao_pass 0 +Compare_dvhk1z_ia2_nao_pass 0 +Compare_dvlk1z_ia2_nao_pass 0 +Compare_dvnlk1z_ia2_nao_pass 0 +Compare_dvxck1z_ia2_nao_pass 0 diff --git a/tests/02_NAO_Gamma/scf_out_hk/h_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk/h_nao.txt.ref new file mode 100644 index 00000000000..06a000eb880 --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hk/h_nao.txt.ref @@ -0,0 +1,129 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + -0.173156 # Fermi energy in Ry + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -6.56277e-01 -5.05473e-03 2.41297e-15 -5.80092e-15 -2.35575e-15 2.58994e-15 -1.10849e-15 -3.05485e-15 + -7.67554e-16 -5.53377e-16 -5.03070e-17 4.74728e-16 3.08781e-16 -4.64911e-02 -1.64084e-01 -4.17282e-17 + 6.20164e-17 2.99511e-18 -1.67496e-16 2.85348e-17 9.95501e-17 7.86047e-19 -1.47418e-17 -1.17975e-17 + 2.13019e-18 4.35883e-18 + -5.05473e-03 4.60976e-01 -1.00182e-16 -1.89952e-16 -2.68882e-17 7.32955e-16 -8.30492e-16 -4.80512e-16 + -3.73496e-16 3.57353e-16 1.43980e-16 -1.17679e-16 -2.67146e-16 -1.64665e-01 1.35775e-02 2.74845e-17 + -6.58331e-17 -6.23603e-17 2.12910e-17 -3.74050e-18 -5.79913e-17 -1.65171e-19 -9.16642e-17 7.58755e-17 + 2.44605e-17 7.88190e-17 + 2.44078e-15 -8.71715e-17 -1.51652e-01 -2.46331e-16 -2.94902e-16 1.42215e-02 7.37257e-17 9.11597e-16 + 2.79551e-15 -6.59195e-16 -5.20417e-16 -1.47674e-17 9.97934e-04 2.00099e-17 -1.52191e-16 3.57734e-02 + -1.21753e-17 1.05252e-17 -2.51578e-02 2.33591e-16 9.51760e-17 6.89612e-18 7.89943e-18 1.53008e-17 + 6.17817e-19 2.39861e-02 + -5.86163e-15 -1.96889e-16 -2.44596e-16 -1.51652e-01 2.03829e-16 1.74338e-16 1.42215e-02 -1.03216e-16 + -5.52076e-16 -1.45890e-15 9.97934e-04 1.96197e-15 7.78891e-16 3.51561e-17 1.36338e-16 6.27245e-17 + 3.57734e-02 -6.91382e-17 1.05859e-16 -2.51578e-02 -2.07997e-16 5.41593e-18 -3.01950e-17 2.39861e-02 + 1.15835e-17 1.58971e-17 + -2.24473e-15 -6.15827e-17 -2.81026e-16 2.03831e-16 -1.51652e-01 8.47412e-16 -1.44851e-16 1.42215e-02 + 1.08550e-15 9.97934e-04 3.97252e-16 -3.21813e-15 1.83881e-16 -1.97520e-17 4.86536e-17 -7.80287e-18 + 1.09572e-17 3.57734e-02 9.61281e-17 -2.26591e-16 -2.51578e-02 -3.79725e-18 2.39861e-02 -1.48942e-17 + 6.26492e-18 9.44950e-18 + 2.58994e-15 7.59375e-16 1.42215e-02 1.70869e-16 8.58690e-16 6.77097e-01 6.07153e-17 7.45931e-17 + 4.16767e-18 -5.34293e-16 -1.53696e-15 8.88279e-18 -1.33953e-03 -8.09340e-18 3.76692e-17 -2.59125e-02 + -5.43787e-17 1.37761e-17 -8.86435e-02 3.16756e-17 -5.81742e-18 -1.87605e-17 -2.56439e-17 -2.40811e-18 + -1.37086e-18 -2.24211e-02 + -1.11543e-15 -8.26603e-16 8.23994e-17 1.42215e-02 -1.58726e-16 2.94903e-17 6.77097e-01 7.92769e-16 + 9.37455e-16 5.55100e-16 -1.33953e-03 1.80818e-15 -5.42968e-16 -4.95650e-17 1.90955e-17 -1.95258e-17 + -2.59125e-02 3.65122e-17 2.57498e-17 -8.86435e-02 5.70019e-17 -2.58769e-18 6.52893e-18 -2.24211e-02 + 1.71188e-17 -5.83470e-17 + -3.05138e-15 -4.70977e-16 9.08995e-16 -6.15827e-17 1.42215e-02 6.07085e-17 7.92769e-16 6.77097e-01 + 1.32126e-15 -1.33953e-03 2.06779e-15 2.04318e-16 -5.42968e-16 7.81168e-17 1.87770e-17 6.58416e-17 + 2.47859e-17 -2.59125e-02 7.77915e-18 6.01732e-18 -8.86435e-02 -1.20194e-18 -2.24211e-02 2.40473e-17 + -2.33961e-17 -9.66634e-18 + -7.95331e-16 -3.74968e-16 2.71251e-15 -6.11598e-16 1.08496e-15 -1.34217e-16 9.39163e-16 1.24176e-15 + 7.51161e-01 -4.27664e-16 -3.37458e-16 -5.41367e-17 9.95081e-16 1.28537e-18 1.84992e-17 -1.19940e-17 + 1.56871e-18 -9.22927e-18 -4.93854e-17 -3.80148e-18 -2.04711e-17 1.13528e-02 -1.46537e-17 -1.58463e-17 + -1.83412e-18 8.75154e-18 + -5.18682e-16 3.57353e-16 -6.69604e-16 -1.51442e-15 9.97934e-04 -5.34295e-16 5.30837e-16 -1.33953e-03 + -4.21375e-16 7.50429e-01 2.81025e-16 1.94181e-16 1.21430e-16 -8.61433e-18 3.83740e-17 3.00121e-17 + 6.46964e-18 -2.35685e-02 4.02375e-17 -3.08320e-17 2.18115e-02 2.85450e-19 -2.05656e-02 -9.80017e-18 + 1.10121e-17 -1.19466e-17 + -2.25514e-17 1.85614e-16 -5.10009e-16 9.97934e-04 3.83373e-16 -1.50227e-15 -1.33953e-03 2.01228e-15 + -3.07100e-16 2.81025e-16 7.50429e-01 -3.92481e-16 -3.05311e-16 -1.02381e-17 1.42918e-16 -9.82558e-19 + -2.35685e-02 -7.20486e-18 -9.34989e-17 2.18115e-02 4.93990e-17 7.56993e-18 5.53960e-19 -2.05656e-02 + 2.59870e-19 -1.32137e-18 + 4.57535e-16 -1.27671e-16 -4.34896e-18 2.02426e-15 -3.27348e-15 3.99541e-18 1.86504e-15 3.15015e-16 + -7.07775e-17 1.94506e-16 -3.78712e-16 7.51161e-01 -4.77061e-17 2.51918e-18 2.58602e-17 -6.75586e-19 + 1.54242e-17 -3.68719e-17 2.02059e-18 -4.06276e-17 3.55935e-17 -1.99293e-18 -6.02338e-18 -4.83256e-18 + 1.13528e-02 2.15548e-19 + 1.97758e-16 -2.67149e-16 9.97934e-04 8.39606e-16 1.37043e-16 -1.33953e-03 -5.15213e-16 -5.56846e-16 + 9.95081e-16 1.21431e-16 -2.81025e-16 -4.40254e-17 7.50429e-01 1.08183e-17 -1.02240e-16 -2.35685e-02 + -1.27055e-17 2.39812e-17 2.18115e-02 7.43763e-17 3.71068e-17 -4.02510e-18 -1.70457e-17 1.17467e-17 + 4.41939e-19 -2.05656e-02 + -4.64911e-02 -1.64665e-01 2.00099e-17 3.51561e-17 -1.97520e-17 -8.09340e-18 -4.95650e-17 7.81168e-17 + 1.28537e-18 -8.61433e-18 -1.02381e-17 2.51918e-18 1.08183e-17 -6.56278e-01 -5.05719e-03 -8.91329e-16 + -1.65804e-15 1.20826e-15 7.02929e-16 -4.11651e-16 -2.09566e-16 1.78732e-16 2.43546e-16 3.52982e-16 + 4.78834e-16 -6.42455e-16 + -1.64084e-01 1.35775e-02 -1.52191e-16 1.36338e-16 4.86536e-17 3.76692e-17 1.90955e-17 1.87770e-17 + 1.84992e-17 3.83740e-17 1.42918e-16 2.58602e-17 -1.02240e-16 -5.05719e-03 4.60963e-01 1.79605e-16 + -6.52770e-17 2.33424e-16 -6.95694e-16 1.03605e-15 3.43221e-16 -7.80613e-17 -2.75427e-16 1.79764e-16 + -1.44627e-16 7.65753e-17 + -4.17282e-17 2.74845e-17 3.57734e-02 6.27245e-17 -7.80287e-18 -2.59125e-02 -1.95258e-17 6.58416e-17 + -1.19940e-17 3.00121e-17 -9.82558e-19 -6.75586e-19 -2.35685e-02 -8.35770e-16 1.82262e-16 -1.51655e-01 + -4.86058e-16 -6.84360e-16 1.42256e-02 2.22143e-16 -6.56006e-18 2.58535e-16 1.81772e-15 -5.07752e-16 + -2.44256e-17 -9.97149e-04 + 6.20164e-17 -6.58331e-17 -1.21753e-17 3.57734e-02 1.09572e-17 -5.43787e-17 -2.59125e-02 2.47859e-17 + 1.56871e-18 6.46964e-18 -2.35685e-02 1.54242e-17 -1.27055e-17 -1.66500e-15 -4.16452e-17 -4.44424e-16 + -1.51655e-01 1.88544e-16 2.95058e-16 1.42256e-02 -8.02433e-17 -3.95571e-16 -1.90785e-16 -9.97149e-04 + 2.71324e-16 6.79244e-16 + 2.99511e-18 -6.23603e-17 1.05252e-17 -6.91382e-17 3.57734e-02 1.37761e-17 3.65122e-17 -2.59125e-02 + -9.22927e-18 -2.35685e-02 -7.20486e-18 -3.68719e-17 2.39812e-17 1.24122e-15 2.49877e-16 -6.72246e-16 + 1.98518e-16 -1.51655e-01 6.13527e-18 -2.21899e-16 1.42256e-02 -1.02713e-16 -9.97149e-04 5.94968e-16 + 4.58900e-16 2.99430e-17 + -1.67496e-16 2.12910e-17 -2.51578e-02 1.05859e-16 9.61281e-17 -8.86435e-02 2.57498e-17 7.77915e-18 + -4.93854e-17 4.02375e-17 -9.34989e-17 2.02059e-18 2.18115e-02 7.02069e-16 -6.14190e-16 1.42256e-02 + 2.92461e-16 4.66320e-17 6.77076e-01 -2.24104e-16 1.86283e-16 -1.37823e-15 4.03459e-16 3.54727e-16 + -1.92831e-17 1.33804e-03 + 2.85348e-17 -3.74050e-18 2.33591e-16 -2.51578e-02 -2.26591e-16 3.16756e-17 -8.86435e-02 6.01732e-18 + -3.80148e-18 -3.08320e-17 2.18115e-02 -4.06276e-17 7.43763e-17 -3.56788e-16 1.03521e-15 1.90158e-16 + 1.42256e-02 -1.96910e-16 -1.95793e-16 6.77076e-01 1.88892e-16 -6.91602e-16 -5.84067e-16 1.33804e-03 + 3.39709e-16 7.93340e-16 + 9.95501e-17 -5.79913e-17 9.51760e-17 -2.07997e-16 -2.51578e-02 -5.81742e-18 5.70019e-17 -8.86435e-02 + -2.04711e-17 2.18115e-02 4.93990e-17 3.55935e-17 3.71068e-17 -2.07833e-16 3.29377e-16 -4.64587e-17 + -8.65859e-17 1.42256e-02 2.15130e-16 2.02770e-16 6.77076e-01 -7.33059e-16 1.33804e-03 -4.17228e-16 + -5.50028e-16 5.43330e-16 + 7.86047e-19 -1.65171e-19 6.89612e-18 5.41593e-18 -3.79725e-18 -1.87605e-17 -2.58769e-18 -1.20194e-18 + 1.13528e-02 2.85450e-19 7.56993e-18 -1.99293e-18 -4.02510e-18 2.21888e-16 -1.01697e-16 1.95238e-16 + -4.00775e-16 -1.31675e-16 -1.35795e-15 -7.20171e-16 -7.33822e-16 7.51153e-01 2.80271e-16 5.34338e-17 + -1.11238e-16 8.45924e-16 + -1.47418e-17 -9.16642e-17 7.89943e-18 -3.01950e-17 2.39861e-02 -2.56439e-17 6.52893e-18 -2.24211e-02 + -1.46537e-17 -2.05656e-02 5.53960e-19 -6.02338e-18 -1.70457e-17 2.14065e-16 -3.02477e-16 1.75992e-15 + -1.91243e-16 -9.97149e-04 4.03679e-16 -5.29393e-16 1.33804e-03 2.73336e-16 7.50428e-01 2.91854e-17 + 2.76180e-17 -1.52425e-16 + -1.17975e-17 7.58755e-17 1.53008e-17 2.39861e-02 -1.48942e-17 -2.40811e-18 -2.24211e-02 2.40473e-17 + -1.58463e-17 -9.80017e-18 -2.05656e-02 -4.83256e-18 1.17467e-17 3.52980e-16 1.58083e-16 -5.07752e-16 + -9.97149e-04 5.38424e-16 3.26971e-16 1.33804e-03 -4.17227e-16 5.77588e-17 2.91655e-17 7.50428e-01 + -3.92441e-16 6.23370e-17 + 2.13019e-18 2.44605e-17 6.17817e-19 1.15835e-17 6.26492e-18 -1.37086e-18 1.71188e-17 -2.33961e-17 + -1.83412e-18 1.10121e-17 2.59870e-19 1.13528e-02 4.41939e-19 4.86707e-16 -1.46233e-16 -2.41409e-17 + 2.23189e-16 4.58665e-16 -2.82794e-17 3.38835e-16 -5.36008e-16 -1.37821e-16 2.76185e-17 -3.93434e-16 + 7.51153e-01 -2.73397e-18 + 4.35883e-18 7.88190e-17 2.39861e-02 1.58971e-17 9.44950e-18 -2.24211e-02 -5.83470e-17 -9.66634e-18 + 8.75154e-18 -1.19466e-17 -1.32137e-18 2.15548e-19 -2.05656e-02 -6.00852e-16 7.65772e-17 -9.97149e-04 + 6.79001e-16 -3.24503e-17 1.33804e-03 8.21001e-16 5.52654e-16 8.77258e-16 -1.91890e-16 6.23918e-17 + -7.57900e-18 7.50428e-01 diff --git a/tests/02_NAO_Gamma/scf_out_hk/hk_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk/hk_nao.txt.ref deleted file mode 100644 index 137aa45c0c5..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hk/hk_nao.txt.ref +++ /dev/null @@ -1,89 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - -6.56277e-01 -5.05476e-03 -1.33227e-15 1.55431e-15 1.11022e-16 -6.10623e-16 1.77636e-15 8.88178e-16 - -1.62299e-16 -1.02002e-15 -2.84495e-16 1.17545e-15 4.30211e-16 -4.64911e-02 -1.64084e-01 1.56125e-17 - 4.33681e-18 4.68375e-17 -2.60209e-17 -9.02056e-17 1.56125e-17 6.75277e-19 1.04083e-17 1.64799e-17 - 5.57536e-18 -2.03830e-17 -Row 2 - 4.60976e-01 3.05311e-16 -1.94289e-16 -3.05311e-16 -5.55112e-16 -4.99600e-16 -4.99600e-16 9.59202e-18 - -4.64906e-16 4.51028e-17 -1.67832e-16 -2.15106e-16 -1.64665e-01 1.35775e-02 -7.45931e-17 1.82146e-17 - 8.06646e-17 5.55112e-17 -5.20417e-18 -3.98986e-17 3.00313e-18 -6.31006e-17 -3.55618e-17 3.42436e-17 - -5.78964e-17 -Row 3 - -1.51652e-01 7.84095e-16 5.20417e-17 1.42215e-02 -6.52256e-16 -1.38778e-17 1.27676e-15 2.77556e-16 - -7.77156e-16 7.33767e-17 9.97934e-04 -1.77809e-17 7.97973e-17 3.57734e-02 -1.30104e-17 -7.80626e-18 - -2.51578e-02 -1.12757e-16 -7.97973e-17 -1.19262e-18 -7.15573e-18 2.84061e-17 -1.45213e-18 2.39861e-02 -Row 4 - -1.51652e-01 1.38778e-16 -9.64506e-16 1.42215e-02 -2.35922e-16 -5.55112e-17 8.32667e-17 9.97934e-04 - -1.66533e-16 5.55112e-16 2.51535e-17 -1.21431e-16 -8.23994e-18 3.57734e-02 -3.03577e-18 -5.20417e-18 - -2.51578e-02 -8.67362e-18 6.12574e-18 1.73472e-18 2.39861e-02 -1.84314e-18 -2.27682e-17 -Row 5 - -1.51652e-01 -3.46945e-17 -1.52656e-16 1.42215e-02 -2.77556e-17 9.97934e-04 5.82867e-16 9.99201e-16 - -1.66533e-16 4.98733e-17 7.97973e-17 -3.90313e-18 -2.03830e-17 3.57734e-02 3.29597e-17 -1.73472e-18 - -2.51578e-02 1.16552e-17 2.39861e-02 -5.20417e-18 -1.26852e-17 -6.50521e-18 -Row 6 - 6.77097e-01 -2.28983e-16 7.63278e-17 2.05391e-15 -8.32667e-16 1.22125e-15 -5.73015e-17 -1.33953e-03 - 6.03901e-17 1.73472e-18 -2.59125e-02 2.42861e-17 2.94903e-17 -8.86435e-02 3.46945e-18 -5.03070e-17 - 8.02310e-18 6.53774e-17 4.97649e-17 3.04771e-18 -2.24211e-02 -Row 7 - 6.77097e-01 -1.14492e-16 6.38378e-16 8.32667e-17 -1.33953e-03 3.88578e-16 1.38778e-16 -1.01915e-17 - 2.68882e-17 -8.32667e-17 -2.59125e-02 -7.41594e-17 -1.21431e-17 -8.86435e-02 7.45931e-17 -3.11166e-17 - -2.82977e-17 -2.24211e-02 -1.08420e-18 -5.72459e-17 -Row 8 - 6.77097e-01 2.49800e-16 -1.33953e-03 -1.38778e-16 1.33227e-15 -6.38378e-16 5.52943e-17 1.73472e-17 - 2.25514e-17 5.20417e-18 -2.59125e-02 -2.77556e-17 8.67362e-17 -8.86435e-02 2.86229e-17 -2.24211e-02 - -1.12757e-17 1.86483e-17 -4.01155e-18 -Row 9 - 7.51161e-01 -2.08167e-16 1.94289e-16 1.34361e-16 6.52256e-16 2.41146e-19 -2.15455e-17 -7.80626e-18 - -6.07153e-18 -3.46945e-18 5.55112e-17 -8.67362e-18 2.60209e-18 1.13528e-02 1.51788e-18 2.16840e-18 - -1.72670e-18 4.33681e-18 -Row 10 - 7.50429e-01 1.50921e-16 -1.04083e-16 -1.01481e-16 -5.63785e-18 1.21431e-17 -1.47451e-17 -2.08167e-17 - -2.35685e-02 -5.55112e-17 1.38778e-17 2.18116e-02 6.05798e-18 -2.05655e-02 9.75782e-18 1.23735e-17 - 1.25767e-17 -Row 11 - 7.50429e-01 7.63278e-17 1.02522e-15 -1.01915e-17 1.73472e-18 1.04083e-17 -2.35685e-02 -3.46945e-17 - -2.60209e-17 2.18116e-02 1.90820e-17 2.97478e-18 2.16840e-17 -2.05655e-02 -1.15603e-17 2.19009e-17 -Row 12 - 7.51161e-01 9.54624e-18 6.69062e-19 2.99309e-18 3.31382e-18 -7.80626e-18 1.51788e-17 -6.51442e-18 - -4.16334e-17 7.28584e-17 -1.40118e-18 -8.67362e-19 -2.60209e-18 1.13528e-02 1.97400e-19 -Row 13 - 7.50429e-01 -2.49366e-18 4.59702e-17 -2.35685e-02 4.33681e-18 9.54098e-18 2.18116e-02 6.07153e-17 - -2.25514e-17 -6.17995e-18 3.90313e-18 9.32414e-18 -4.52633e-19 -2.05655e-02 -Row 14 - -6.56278e-01 -5.05718e-03 1.30234e-15 -3.20967e-15 -1.35655e-15 4.35416e-16 -4.33681e-19 -1.85182e-16 - 1.74350e-16 9.40654e-16 5.16080e-16 -2.56515e-16 -8.67362e-17 -Row 15 - 4.60963e-01 2.92301e-16 -3.22659e-16 -3.50414e-16 2.09902e-16 -6.90420e-16 -1.09288e-16 1.98577e-17 - -2.04264e-16 -9.84456e-17 -1.94494e-16 8.19657e-17 -Row 16 - -1.51655e-01 -4.03323e-16 -1.84748e-16 1.42256e-02 -2.67147e-16 4.77049e-17 1.48536e-16 3.68629e-17 - 1.18482e-15 -5.77429e-17 -9.97149e-04 -Row 17 - -1.51655e-01 3.20924e-17 -1.87350e-16 1.42256e-02 -4.68375e-17 -1.07228e-15 -7.14706e-16 -9.97149e-04 - -2.08167e-17 9.49761e-17 -Row 18 - -1.51655e-01 8.06646e-17 3.72966e-17 1.42256e-02 -9.34691e-16 -9.97149e-04 -8.75602e-16 -4.27284e-16 - 2.20527e-15 -Row 19 - 6.77076e-01 -4.85723e-17 -1.28370e-16 2.68665e-16 1.52135e-15 1.01568e-15 -1.78500e-17 1.33804e-03 -Row 20 - 6.77076e-01 -1.90820e-16 -5.74085e-16 3.15286e-16 1.33804e-03 -1.89931e-15 5.42101e-16 -Row 21 - 6.77076e-01 -6.62990e-16 1.33804e-03 -6.43149e-16 7.92769e-16 1.70870e-15 -Row 22 - 7.51153e-01 7.86047e-18 -2.49150e-16 5.11870e-16 2.03071e-16 -Row 23 - 7.50428e-01 2.36356e-17 1.62305e-16 -2.94903e-16 -Row 24 - 7.50428e-01 -1.48536e-17 -3.10732e-16 -Row 25 - 7.51153e-01 3.68701e-17 -Row 26 - 7.50428e-01 diff --git a/tests/02_NAO_Gamma/scf_out_hk/s_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk/s_nao.txt.ref new file mode 100644 index 00000000000..da1641bde42 --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hk/s_nao.txt.ref @@ -0,0 +1,129 @@ +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 1 # total k points + 1 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 2 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 26 # number of localized basis + 26 26 # size of this matrix + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + 1.00017e+00 1.88614e-03 1.35525e-20 0.00000e+00 0.00000e+00 5.42101e-20 0.00000e+00 0.00000e+00 + -2.71051e-20 0.00000e+00 0.00000e+00 3.04932e-20 0.00000e+00 4.67829e-02 2.35350e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + -1.20753e-18 0.00000e+00 + 1.88614e-03 1.02054e+00 -2.16840e-19 0.00000e+00 0.00000e+00 8.67362e-19 0.00000e+00 0.00000e+00 + -2.16840e-19 0.00000e+00 0.00000e+00 4.33681e-19 0.00000e+00 2.35350e-01 6.08580e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + -1.51754e-17 0.00000e+00 + -1.35525e-20 2.16840e-19 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 + 0.00000e+00 -2.71051e-20 2.71051e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 + 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -4.17224e-02 + 0.00000e+00 0.00000e+00 0.00000e+00 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -3.38813e-21 0.00000e+00 0.00000e+00 0.00000e+00 + -8.35117e-02 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 0.00000e+00 -4.17224e-02 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -1.01644e-20 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 -4.17224e-02 0.00000e+00 + 0.00000e+00 0.00000e+00 + -5.42101e-20 -8.67362e-19 5.69658e-03 0.00000e+00 0.00000e+00 9.80005e-01 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.49288e-01 + 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 1.39401e-01 + 0.00000e+00 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 9.80005e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -1.35525e-20 0.00000e+00 0.00000e+00 0.00000e+00 + 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 0.00000e+00 0.00000e+00 1.39401e-01 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 9.80005e-01 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -1.35525e-20 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 1.39401e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 + -2.71051e-20 -2.16840e-19 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 1.00007e+00 0.00000e+00 0.00000e+00 -3.72694e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 6.29942e-03 0.00000e+00 0.00000e+00 + -6.16963e-19 0.00000e+00 + 0.00000e+00 0.00000e+00 2.71051e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 1.00025e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 4.17224e-02 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 7.89480e-03 0.00000e+00 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 -2.71051e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 1.00025e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 4.17224e-02 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 0.00000e+00 0.00000e+00 7.89480e-03 + 0.00000e+00 0.00000e+00 + 3.04932e-20 4.33681e-19 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + -3.72694e-20 0.00000e+00 0.00000e+00 1.00007e+00 0.00000e+00 -1.20753e-18 -1.51754e-17 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -6.16963e-19 0.00000e+00 0.00000e+00 + 6.29942e-03 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 3.38813e-21 1.01644e-20 0.00000e+00 1.35525e-20 1.35525e-20 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00025e+00 0.00000e+00 0.00000e+00 4.17224e-02 + 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 7.89480e-03 + 4.67829e-02 2.35350e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 -1.20753e-18 0.00000e+00 1.00017e+00 1.88614e-03 1.35525e-20 + 0.00000e+00 0.00000e+00 5.42101e-20 0.00000e+00 0.00000e+00 -2.71051e-20 0.00000e+00 0.00000e+00 + 3.04932e-20 0.00000e+00 + 2.35350e-01 6.08580e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 -1.51754e-17 0.00000e+00 1.88614e-03 1.02054e+00 -2.16840e-19 + 0.00000e+00 0.00000e+00 8.67362e-19 0.00000e+00 0.00000e+00 -2.16840e-19 0.00000e+00 0.00000e+00 + 4.33681e-19 0.00000e+00 + 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 4.17224e-02 -1.35525e-20 2.16840e-19 9.98375e-01 + 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 0.00000e+00 -2.71051e-20 2.71051e-20 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 4.17224e-02 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -3.38813e-21 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 1.49288e-01 + 0.00000e+00 4.17224e-02 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -1.01644e-20 + 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -1.39401e-01 -5.42101e-20 -8.67362e-19 5.69658e-03 + 0.00000e+00 0.00000e+00 9.80005e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 5.69658e-03 0.00000e+00 0.00000e+00 9.80005e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -1.35525e-20 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 + 0.00000e+00 -1.39401e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 9.80005e-01 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 -1.35525e-20 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + 6.29942e-03 0.00000e+00 0.00000e+00 -6.16963e-19 0.00000e+00 -2.71051e-20 -2.16840e-19 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00007e+00 0.00000e+00 0.00000e+00 + -3.72694e-20 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -4.17224e-02 0.00000e+00 0.00000e+00 1.39401e-01 + 0.00000e+00 7.89480e-03 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 2.71051e-20 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00025e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 -4.17224e-02 0.00000e+00 0.00000e+00 1.39401e-01 0.00000e+00 + 0.00000e+00 0.00000e+00 7.89480e-03 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -2.71051e-20 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.00025e+00 + 0.00000e+00 0.00000e+00 + -1.20753e-18 -1.51754e-17 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 + -6.16963e-19 0.00000e+00 0.00000e+00 6.29942e-03 0.00000e+00 3.04932e-20 4.33681e-19 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -3.72694e-20 0.00000e+00 0.00000e+00 + 1.00007e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 -4.17224e-02 0.00000e+00 0.00000e+00 1.39401e-01 0.00000e+00 0.00000e+00 + 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 7.89480e-03 0.00000e+00 0.00000e+00 0.00000e+00 + 3.38813e-21 1.01644e-20 0.00000e+00 1.35525e-20 1.35525e-20 0.00000e+00 0.00000e+00 0.00000e+00 + 0.00000e+00 1.00025e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk/sk_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk/sk_nao.txt.ref deleted file mode 100644 index 4ac100c852f..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hk/sk_nao.txt.ref +++ /dev/null @@ -1,89 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 26 -# columns 26 -#------------------------------------------------------------------------ -Row 1 - 1.00017e+00 1.88614e-03 -1.35525e-20 0.00000e+00 0.00000e+00 -5.42101e-20 0.00000e+00 0.00000e+00 - -2.71051e-20 0.00000e+00 0.00000e+00 3.04932e-20 0.00000e+00 4.67829e-02 2.35350e-01 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - -1.20753e-18 0.00000e+00 -Row 2 - 1.02054e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.67362e-19 0.00000e+00 0.00000e+00 -2.16840e-19 - 0.00000e+00 0.00000e+00 4.33681e-19 0.00000e+00 2.35350e-01 6.08580e-01 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -1.51754e-17 - 0.00000e+00 -Row 3 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 6.77626e-21 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 - 1.49288e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -4.17224e-02 -Row 4 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 1.35525e-20 0.00000e+00 - 0.00000e+00 6.77626e-21 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 - 1.49288e-01 0.00000e+00 0.00000e+00 0.00000e+00 -4.17224e-02 0.00000e+00 0.00000e+00 -Row 5 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 6.77626e-21 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.35117e-02 0.00000e+00 0.00000e+00 - 1.49288e-01 0.00000e+00 -4.17224e-02 0.00000e+00 0.00000e+00 0.00000e+00 -Row 6 - 9.80005e-01 0.00000e+00 0.00000e+00 2.71051e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.39401e-01 -Row 7 - 9.80005e-01 0.00000e+00 0.00000e+00 -5.42101e-20 0.00000e+00 0.00000e+00 -1.35525e-20 0.00000e+00 - 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 0.00000e+00 - 0.00000e+00 1.39401e-01 0.00000e+00 0.00000e+00 -Row 8 - 9.80005e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.35525e-20 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 1.49288e-01 0.00000e+00 0.00000e+00 -1.30508e-01 0.00000e+00 1.39401e-01 - 0.00000e+00 0.00000e+00 0.00000e+00 -Row 9 - 1.00007e+00 0.00000e+00 0.00000e+00 -2.37169e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 6.29942e-03 0.00000e+00 0.00000e+00 - -6.16963e-19 0.00000e+00 -Row 10 - 1.00025e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 4.17224e-02 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 7.89480e-03 0.00000e+00 0.00000e+00 - 0.00000e+00 -Row 11 - 1.00025e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 4.17224e-02 0.00000e+00 - 0.00000e+00 -1.39401e-01 0.00000e+00 0.00000e+00 0.00000e+00 7.89480e-03 0.00000e+00 0.00000e+00 -Row 12 - 1.00007e+00 0.00000e+00 -1.20753e-18 -1.51754e-17 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 0.00000e+00 0.00000e+00 -6.16963e-19 0.00000e+00 0.00000e+00 6.29942e-03 0.00000e+00 -Row 13 - 1.00025e+00 0.00000e+00 0.00000e+00 4.17224e-02 0.00000e+00 0.00000e+00 -1.39401e-01 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 7.89480e-03 -Row 14 - 1.00017e+00 1.88614e-03 -1.35525e-20 0.00000e+00 0.00000e+00 -5.42101e-20 0.00000e+00 0.00000e+00 - -2.71051e-20 0.00000e+00 0.00000e+00 3.04932e-20 0.00000e+00 -Row 15 - 1.02054e+00 0.00000e+00 0.00000e+00 0.00000e+00 -8.67362e-19 0.00000e+00 0.00000e+00 -2.16840e-19 - 0.00000e+00 0.00000e+00 4.33681e-19 0.00000e+00 -Row 16 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 6.77626e-21 0.00000e+00 - 0.00000e+00 0.00000e+00 0.00000e+00 -Row 17 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 1.35525e-20 0.00000e+00 - 0.00000e+00 6.77626e-21 -Row 18 - 9.98375e-01 0.00000e+00 0.00000e+00 5.69658e-03 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 - 6.77626e-21 -Row 19 - 9.80005e-01 0.00000e+00 0.00000e+00 2.71051e-20 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 -Row 20 - 9.80005e-01 0.00000e+00 0.00000e+00 -5.42101e-20 0.00000e+00 0.00000e+00 -1.35525e-20 -Row 21 - 9.80005e-01 0.00000e+00 0.00000e+00 0.00000e+00 0.00000e+00 1.35525e-20 -Row 22 - 1.00007e+00 0.00000e+00 0.00000e+00 -2.37169e-20 0.00000e+00 -Row 23 - 1.00025e+00 0.00000e+00 0.00000e+00 0.00000e+00 -Row 24 - 1.00025e+00 0.00000e+00 0.00000e+00 -Row 25 - 1.00007e+00 0.00000e+00 -Row 26 - 1.00025e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hks1_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hks1_nao.txt.ref deleted file mode 100644 index 00b1f8ae9bf..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/hks1_nao.txt.ref +++ /dev/null @@ -1,23 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks1_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -4.41e-01 1.44e-15 -1.83e-15 1.55e-15 -1.34e-02 1.18e-16 3.80e-17 -1.90e-16 -Row 2 - 9.28e-01 -2.33e-15 -1.71e-15 -6.37e-17 -3.35e-02 -6.99e-17 -2.17e-16 -Row 3 - 9.28e-01 -8.05e-16 -1.29e-16 8.38e-17 -3.35e-02 1.23e-16 -Row 4 - 9.28e-01 3.30e-16 -4.16e-17 -2.03e-16 -3.35e-02 -Row 5 - -4.41e-01 1.54e-15 3.61e-16 2.12e-15 -Row 6 - 9.28e-01 1.00e-15 6.24e-16 -Row 7 - 9.28e-01 -4.42e-16 -Row 8 - 9.28e-01 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hks2_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hks2_nao.txt.ref deleted file mode 100644 index 645d43e5338..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/hks2_nao.txt.ref +++ /dev/null @@ -1,23 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hks2_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - -2.59e-01 -2.50e-15 3.61e-15 -2.16e-15 -1.31e-02 -9.33e-16 5.97e-17 5.03e-16 -Row 2 - 1.12e+00 9.21e-15 2.39e-15 1.10e-15 -3.45e-02 -4.14e-15 -1.24e-16 -Row 3 - 1.12e+00 3.23e-15 4.39e-16 2.31e-15 -3.45e-02 1.86e-15 -Row 4 - 1.12e+00 1.16e-15 1.94e-15 5.00e-15 -3.45e-02 -Row 5 - -2.59e-01 -7.13e-16 -9.52e-16 -2.94e-15 -Row 6 - 1.12e+00 -2.08e-15 -2.20e-15 -Row 7 - 1.12e+00 -2.01e-15 -Row 8 - 1.12e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs1_nao.csr.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs1_nao.csr.ref index 894e364eafc..243d5a06656 100644 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs1_nao.csr.ref +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 1 # spin index, E_Fermi = 14.2079 eV diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs2_nao.csr.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs2_nao.csr.ref index aab7b5c97ca..c9a3f165e68 100644 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs2_nao.csr.ref +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/hrs2_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 2 # spin index, E_Fermi = 14.2079 eV diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hs1_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hs1_nao.txt.ref new file mode 100644 index 00000000000..0824534a8c0 --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/hs1_nao.txt.ref @@ -0,0 +1,33 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 1.04426 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -4.41e-01 2.92e-15 -9.96e-16 -1.77e-15 -1.34e-02 2.67e-16 2.67e-16 -9.77e-17 + 2.92e-15 9.28e-01 -4.27e-16 -1.89e-15 2.97e-17 -3.35e-02 1.93e-16 -1.68e-16 + -9.96e-16 -4.27e-16 9.28e-01 -1.18e-16 -2.16e-18 4.78e-16 -3.35e-02 3.92e-16 + -1.78e-15 -1.89e-15 -1.32e-16 9.28e-01 9.69e-17 1.52e-17 5.55e-16 -3.35e-02 + -1.34e-02 2.97e-17 -2.16e-18 9.69e-17 -4.41e-01 2.65e-16 -6.19e-16 -1.90e-15 + 2.67e-16 -3.35e-02 4.78e-16 1.52e-17 2.63e-16 9.28e-01 1.11e-16 1.39e-15 + 2.67e-16 1.93e-16 -3.35e-02 5.55e-16 -6.42e-16 8.20e-17 9.28e-01 3.06e-15 + -9.77e-17 -1.68e-16 3.92e-16 -3.35e-02 -1.90e-15 1.39e-15 3.06e-15 9.28e-01 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/hs2_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/hs2_nao.txt.ref new file mode 100644 index 00000000000..7450407d91d --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/hs2_nao.txt.ref @@ -0,0 +1,33 @@ +Ionic_Step 1 + 2 # number of spin directions + 2 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 1.04426 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + -2.59e-01 -3.00e-15 -1.44e-15 1.25e-15 -1.31e-02 -2.43e-15 -5.33e-16 2.29e-15 + -3.00e-15 1.12e+00 5.26e-15 2.96e-15 8.12e-16 -3.45e-02 3.36e-16 1.90e-15 + -1.38e-15 5.27e-15 1.12e+00 -8.51e-15 6.56e-17 -5.34e-15 -3.45e-02 1.17e-14 + 1.25e-15 2.96e-15 -8.46e-15 1.12e+00 9.66e-16 2.73e-15 2.26e-15 -3.45e-02 + -1.31e-02 8.12e-16 6.56e-17 9.66e-16 -2.59e-01 -4.12e-15 -8.37e-17 5.84e-16 + -2.43e-15 -3.45e-02 -5.34e-15 2.73e-15 -4.12e-15 1.12e+00 -1.05e-15 -5.83e-15 + -5.33e-16 3.36e-16 -3.45e-02 2.26e-15 -6.96e-17 -1.04e-15 1.12e+00 -8.98e-15 + 2.29e-15 1.90e-15 1.17e-14 -3.45e-02 5.86e-16 -5.84e-15 -8.95e-15 1.12e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/s_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/s_nao.txt.ref new file mode 100644 index 00000000000..d55c2d23fec --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/s_nao.txt.ref @@ -0,0 +1,33 @@ +Ionic_Step 1 + 2 # number of spin directions + 1 # spin index + 1 # total k points + 2 # total k points after symmetrized (if open) + 1 # k-point index + 0 0 0 # k point coordinate (Cartesian) + 0 0 0 # k point coordinate (direct) + 1 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + 1.00e+00 0.00e+00 0.00e+00 0.00e+00 6.14e-03 0.00e+00 0.00e+00 0.00e+00 + 0.00e+00 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 0.00e+00 + 0.00e+00 0.00e+00 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 + 0.00e+00 0.00e+00 0.00e+00 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 + 6.14e-03 0.00e+00 0.00e+00 0.00e+00 1.00e+00 0.00e+00 0.00e+00 0.00e+00 + 0.00e+00 -1.54e-02 0.00e+00 0.00e+00 0.00e+00 1.00e+00 0.00e+00 0.00e+00 + 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 0.00e+00 0.00e+00 1.00e+00 0.00e+00 + 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 0.00e+00 0.00e+00 1.00e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/sk_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/sk_nao.txt.ref deleted file mode 100644 index b48d97c3fbf..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/sk_nao.txt.ref +++ /dev/null @@ -1,23 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk_nao.txt -# gamma only 1 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - 1.00e+00 0.00e+00 0.00e+00 0.00e+00 6.14e-03 0.00e+00 0.00e+00 0.00e+00 -Row 2 - 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 0.00e+00 -Row 3 - 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 0.00e+00 -Row 4 - 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -1.54e-02 -Row 5 - 1.00e+00 0.00e+00 0.00e+00 0.00e+00 -Row 6 - 1.00e+00 0.00e+00 0.00e+00 -Row 7 - 1.00e+00 0.00e+00 -Row 8 - 1.00e+00 diff --git a/tests/02_NAO_Gamma/scf_out_hk_spin2/sr_nao.csr.ref b/tests/02_NAO_Gamma/scf_out_hk_spin2/sr_nao.csr.ref index 3e24621ba72..3500c877c4e 100644 --- a/tests/02_NAO_Gamma/scf_out_hk_spin2/sr_nao.csr.ref +++ b/tests/02_NAO_Gamma/scf_out_hk_spin2/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/02_NAO_Gamma/scf_out_hxc/Vxc_R_spin0.ref b/tests/02_NAO_Gamma/scf_out_hxc/Vxc_R_spin0.ref deleted file mode 100644 index e359703fc9e..00000000000 --- a/tests/02_NAO_Gamma/scf_out_hxc/Vxc_R_spin0.ref +++ /dev/null @@ -1,7 +0,0 @@ -STEP: 1 -Matrix Dimension of Vxc_R_spin0(R): 26 -Matrix number of Vxc_R_spin0(R): 1 -0 0 0 132 - -6.99425506e-01 1.54630632e-01 -2.02590614e-02 -9.98372514e-02 1.54630632e-01 -3.63859533e-01 -9.98178218e-02 -1.36032672e-01 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 -6.54685694e-02 1.71711621e-02 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 -6.54685694e-02 1.71711621e-02 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 -6.54685694e-02 1.71711621e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 2.36444399e-02 -6.86923712e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 2.36444399e-02 -6.86923712e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 2.36444399e-02 -6.86923712e-02 -6.98160572e-01 -4.48366384e-03 4.84073409e-03 -1.04968258e-03 -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 4.84073409e-03 -1.04968258e-03 -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 -6.98160572e-01 -4.48366384e-03 4.84073409e-03 -1.04968258e-03 -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 -2.02590614e-02 -9.98178218e-02 -6.99426852e-01 1.54629051e-01 -9.98372514e-02 -1.36032672e-01 1.54629051e-01 -3.63863990e-01 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 -2.05219162e-01 -4.84033691e-03 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 -2.05219162e-01 -4.84033691e-03 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 -2.05219162e-01 -4.84033691e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 -4.39128096e-01 1.04971333e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 -4.39128096e-01 1.04971333e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 -4.39128096e-01 1.04971333e-03 -4.48366384e-03 -6.98168165e-01 1.71711621e-02 -6.86923712e-02 -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 1.71711621e-02 -6.86923712e-02 -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 -4.48366384e-03 -6.98168165e-01 1.71711621e-02 -6.86923712e-02 -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 - 0 1 13 14 0 1 13 14 2 5 12 15 18 25 3 6 10 16 19 23 4 7 9 17 20 22 2 5 12 15 18 25 3 6 10 16 19 23 4 7 9 17 20 22 8 21 4 7 9 17 20 22 3 6 10 16 19 23 11 24 2 5 12 15 18 25 0 1 13 14 0 1 13 14 2 5 12 15 18 25 3 6 10 16 19 23 4 7 9 17 20 22 2 5 12 15 18 25 3 6 10 16 19 23 4 7 9 17 20 22 8 21 4 7 9 17 20 22 3 6 10 16 19 23 11 24 2 5 12 15 18 25 - 0 4 8 14 20 26 32 38 44 46 52 58 60 66 70 74 80 86 92 98 104 110 112 118 124 126 132 diff --git a/tests/02_NAO_Gamma/scf_out_hxc/vxc_nao.txt.ref b/tests/02_NAO_Gamma/scf_out_hxc/vxcmo_nao.txt.ref similarity index 91% rename from tests/02_NAO_Gamma/scf_out_hxc/vxc_nao.txt.ref rename to tests/02_NAO_Gamma/scf_out_hxc/vxcmo_nao.txt.ref index 928cc55fdaf..8a6c18d9b8e 100644 --- a/tests/02_NAO_Gamma/scf_out_hxc/vxc_nao.txt.ref +++ b/tests/02_NAO_Gamma/scf_out_hxc/vxcmo_nao.txt.ref @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 0 -# filename OUT.autotest/vxc_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/vxcmo_nao.txt # gamma only 1 # rows 6 # columns 6 diff --git a/tests/02_NAO_Gamma/scf_out_hxc/vxcrs1_nao.csr.ref b/tests/02_NAO_Gamma/scf_out_hxc/vxcrs1_nao.csr.ref new file mode 100644 index 00000000000..cab504a81ee --- /dev/null +++ b/tests/02_NAO_Gamma/scf_out_hxc/vxcrs1_nao.csr.ref @@ -0,0 +1,65 @@ +Ionic_Step 1 + # print Vxc matrix in real space Vxc(R) + 1 # number of spin directions + 1 # spin index + 26 # number of localized basis + 1 # number of Bravais lattice vector R + + user_defined_lattice + 10.5835 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + + 0 0 0 132 + # CSR values + -6.99425506e-01 1.54630632e-01 -2.02590614e-02 -9.98372514e-02 1.54630632e-01 -3.63859533e-01 + -9.98178218e-02 -1.36032672e-01 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 + -6.54685694e-02 1.71711621e-02 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 + -6.54685694e-02 1.71711621e-02 -6.10221094e-01 -2.05221541e-01 4.84073409e-03 3.86425463e-02 + -6.54685694e-02 1.71711621e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 + 2.36444399e-02 -6.86923712e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 + 2.36444399e-02 -6.86923712e-02 -2.05221541e-01 -4.39113946e-01 -1.04968258e-03 -6.55024530e-02 + 2.36444399e-02 -6.86923712e-02 -6.98160572e-01 -4.48366384e-03 4.84073409e-03 -1.04968258e-03 + -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 4.84073409e-03 -1.04968258e-03 + -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 -6.98160572e-01 -4.48366384e-03 + 4.84073409e-03 -1.04968258e-03 -6.99822166e-01 -1.71459471e-02 6.86343014e-02 -3.03797205e-04 + -2.02590614e-02 -9.98178218e-02 -6.99426852e-01 1.54629051e-01 -9.98372514e-02 -1.36032672e-01 + 1.54629051e-01 -3.63863990e-01 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 + -2.05219162e-01 -4.84033691e-03 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 + -2.05219162e-01 -4.84033691e-03 3.86425463e-02 -6.55024530e-02 -1.71459471e-02 -6.10223510e-01 + -2.05219162e-01 -4.84033691e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 + -4.39128096e-01 1.04971333e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 + -4.39128096e-01 1.04971333e-03 -6.54685694e-02 2.36444399e-02 6.86343014e-02 -2.05219162e-01 + -4.39128096e-01 1.04971333e-03 -4.48366384e-03 -6.98168165e-01 1.71711621e-02 -6.86923712e-02 + -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 1.71711621e-02 -6.86923712e-02 + -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 -4.48366384e-03 -6.98168165e-01 + 1.71711621e-02 -6.86923712e-02 -3.03797205e-04 -4.84033691e-03 1.04971333e-03 -6.99823296e-01 + # CSR column indices + 0 1 13 14 0 1 13 14 2 5 12 15 18 25 3 6 + 10 16 19 23 4 7 9 17 20 22 2 5 12 15 18 25 + 3 6 10 16 19 23 4 7 9 17 20 22 8 21 4 7 + 9 17 20 22 3 6 10 16 19 23 11 24 2 5 12 15 + 18 25 0 1 13 14 0 1 13 14 2 5 12 15 18 25 + 3 6 10 16 19 23 4 7 9 17 20 22 2 5 12 15 + 18 25 3 6 10 16 19 23 4 7 9 17 20 22 8 21 + 4 7 9 17 20 22 3 6 10 16 19 23 11 24 2 5 + 12 15 18 25 + # CSR row pointers + 0 4 8 14 20 26 32 38 44 46 52 58 60 66 70 74 + 80 86 92 98 104 110 112 118 124 126 132 + diff --git a/tests/02_NAO_Gamma/scf_out_mul/mulliken.txt.ref b/tests/02_NAO_Gamma/scf_out_mul/mulliken.txt.ref index 2b675eaa171..a9fa194a0c5 100644 --- a/tests/02_NAO_Gamma/scf_out_mul/mulliken.txt.ref +++ b/tests/02_NAO_Gamma/scf_out_mul/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 2 Decomposed Mulliken population analysis for each atom l and m from Ylm, z stands for zeta orbital diff --git a/tests/02_NAO_Gamma/scf_out_mul_spin2/mulliken.txt.ref b/tests/02_NAO_Gamma/scf_out_mul_spin2/mulliken.txt.ref index a2c31534af9..13205d43e3b 100644 --- a/tests/02_NAO_Gamma/scf_out_mul_spin2/mulliken.txt.ref +++ b/tests/02_NAO_Gamma/scf_out_mul_spin2/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 32 Total charge of spin1 16 Total charge of spin2 16 diff --git a/tests/03_NAO_multik/get_s/dsrxs1.csr.ref b/tests/03_NAO_multik/get_s/dsrxs1_nao.csr.ref similarity index 99% rename from tests/03_NAO_multik/get_s/dsrxs1.csr.ref rename to tests/03_NAO_multik/get_s/dsrxs1_nao.csr.ref index aaec88d6f49..43dac397816 100644 --- a/tests/03_NAO_multik/get_s/dsrxs1.csr.ref +++ b/tests/03_NAO_multik/get_s/dsrxs1_nao.csr.ref @@ -1,4 +1,4 @@ -STEP: 1 +Ionic_Step 1 Matrix Dimension of dHx(R): 112 Matrix number of dHx(R): 3 -1 0 0 268 diff --git a/tests/03_NAO_multik/get_s/dsrys1.csr.ref b/tests/03_NAO_multik/get_s/dsrys1_nao.csr.ref similarity index 99% rename from tests/03_NAO_multik/get_s/dsrys1.csr.ref rename to tests/03_NAO_multik/get_s/dsrys1_nao.csr.ref index dfdfb209dce..0a2d08eae3e 100644 --- a/tests/03_NAO_multik/get_s/dsrys1.csr.ref +++ b/tests/03_NAO_multik/get_s/dsrys1_nao.csr.ref @@ -1,4 +1,4 @@ -STEP: 1 +Ionic_Step 1 Matrix Dimension of dHy(R): 112 Matrix number of dHy(R): 3 -1 0 0 192 diff --git a/tests/03_NAO_multik/get_s/dsrzs1.csr.ref b/tests/03_NAO_multik/get_s/dsrzs1_nao.csr.ref similarity index 99% rename from tests/03_NAO_multik/get_s/dsrzs1.csr.ref rename to tests/03_NAO_multik/get_s/dsrzs1_nao.csr.ref index 16c5b952134..4f84b35e4f0 100644 --- a/tests/03_NAO_multik/get_s/dsrzs1.csr.ref +++ b/tests/03_NAO_multik/get_s/dsrzs1_nao.csr.ref @@ -1,4 +1,4 @@ -STEP: 1 +Ionic_Step 1 Matrix Dimension of dHz(R): 112 Matrix number of dHz(R): 3 -1 0 0 192 diff --git a/tests/03_NAO_multik/get_s/sr_nao.csr.ref b/tests/03_NAO_multik/get_s/sr_nao.csr.ref index 3c6902b76a6..883ec815149 100644 --- a/tests/03_NAO_multik/get_s/sr_nao.csr.ref +++ b/tests/03_NAO_multik/get_s/sr_nao.csr.ref @@ -1,15 +1,345 @@ -STEP: 1 -Matrix Dimension of S(R): 112 -Matrix number of S(R): 3 --1 0 0 268 - -2.24608413e-05 -4.73624218e-04 6.37415057e-05 8.11362058e-04 -3.14469031e-04 5.44676339e-04 8.54484818e-06 1.80786625e-04 -2.44405710e-05 -3.10701576e-04 1.19427362e-04 -2.06854258e-04 7.79196219e-05 1.63553675e-03 -2.17106428e-04 -2.77758903e-03 1.09489118e-03 -1.89640715e-03 -1.56973284e-04 -3.59495418e-03 5.08746045e-04 6.39642043e-03 -2.21036457e-03 3.82846374e-03 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.15208332e-07 2.86519988e-06 -4.17293752e-07 -5.24398120e-06 1.67936460e-06 -2.90874481e-06 2.13324838e-08 2.74061128e-07 3.67069682e-07 2.65059239e-06 3.38541041e-05 4.83032630e-05 2.17154078e-05 4.64529051e-04 -6.39358182e-05 -8.08254920e-04 3.04003684e-04 -5.26549826e-04 2.65059239e-06 3.38541041e-05 4.83032630e-05 4.25755671e-05 9.88002045e-04 -1.40953144e-04 -1.77156094e-03 6.27685814e-04 -1.05922181e-03 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 1.61438192e-05 -7.37430454e-05 -1.71126974e-03 2.44138007e-04 3.06843356e-03 -1.05922181e-03 1.85076980e-03 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 -2.24608413e-05 -4.73624218e-04 6.37415057e-05 8.11362058e-04 -3.14469031e-04 5.44676339e-04 8.54484818e-06 1.80786625e-04 -2.44405710e-05 -3.10701576e-04 1.19427362e-04 -2.06854258e-04 7.79196219e-05 1.63553675e-03 -2.17106428e-04 -2.77758903e-03 1.09489118e-03 -1.89640715e-03 -1.56973284e-04 -3.59495418e-03 5.08746045e-04 6.39642043e-03 -2.21036457e-03 3.82846374e-03 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.15208332e-07 2.86519988e-06 -4.17293752e-07 -5.24398120e-06 1.67936460e-06 -2.90874481e-06 2.13324838e-08 2.74061128e-07 3.67069682e-07 2.65059239e-06 3.38541041e-05 4.83032630e-05 2.17154078e-05 4.64529051e-04 -6.39358182e-05 -8.08254920e-04 3.04003684e-04 -5.26549826e-04 2.65059239e-06 3.38541041e-05 4.83032630e-05 4.25755671e-05 9.88002045e-04 -1.40953144e-04 -1.77156094e-03 6.27685814e-04 -1.05922181e-03 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 1.61438192e-05 -7.37430454e-05 -1.71126974e-03 2.44138007e-04 3.06843356e-03 -1.05922181e-03 1.85076980e-03 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 -1.15208332e-07 -2.17154078e-05 4.25755671e-05 -7.37430454e-05 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 -2.86519988e-06 -4.64529051e-04 9.88002045e-04 -1.71126974e-03 2.13324838e-08 2.65059239e-06 2.28520600e-05 -6.37415057e-05 2.44405710e-05 2.17106428e-04 -5.08746045e-04 -4.17293752e-07 -6.39358182e-05 1.40953144e-04 -2.44138007e-04 2.13324838e-08 2.65059239e-06 2.28520600e-05 2.74061128e-07 3.38541041e-05 2.92970263e-04 -8.11362058e-04 3.10701576e-04 2.77758903e-03 -6.39642043e-03 -5.24398120e-06 -8.08254920e-04 1.77156094e-03 -3.06843356e-03 2.74061128e-07 3.38541041e-05 2.92970263e-04 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 -1.67936460e-06 -3.04003684e-04 6.27685814e-04 -1.05922181e-03 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.61438192e-05 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 2.90874481e-06 5.26549826e-04 -1.05922181e-03 1.85076980e-03 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 -1.15208332e-07 -2.17154078e-05 4.25755671e-05 -7.37430454e-05 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 -2.86519988e-06 -4.64529051e-04 9.88002045e-04 -1.71126974e-03 2.13324838e-08 2.65059239e-06 2.28520600e-05 -6.37415057e-05 2.44405710e-05 2.17106428e-04 -5.08746045e-04 -4.17293752e-07 -6.39358182e-05 1.40953144e-04 -2.44138007e-04 2.13324838e-08 2.65059239e-06 2.28520600e-05 2.74061128e-07 3.38541041e-05 2.92970263e-04 -8.11362058e-04 3.10701576e-04 2.77758903e-03 -6.39642043e-03 -5.24398120e-06 -8.08254920e-04 1.77156094e-03 -3.06843356e-03 2.74061128e-07 3.38541041e-05 2.92970263e-04 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 -1.67936460e-06 -3.04003684e-04 6.27685814e-04 -1.05922181e-03 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.61438192e-05 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 2.90874481e-06 5.26549826e-04 -1.05922181e-03 1.85076980e-03 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 - 60 61 63 66 68 71 60 61 63 66 68 71 60 61 63 66 68 71 60 61 63 66 68 71 62 65 69 60 61 63 66 68 71 64 67 72 62 65 69 60 61 63 66 68 71 64 67 72 60 61 63 66 68 71 62 65 69 70 60 61 63 66 68 71 64 67 72 73 74 76 79 81 84 73 74 76 79 81 84 73 74 76 79 81 84 73 74 76 79 81 84 75 78 82 73 74 76 79 81 84 77 80 85 75 78 82 73 74 76 79 81 84 77 80 85 73 74 76 79 81 84 75 78 82 83 73 74 76 79 81 84 77 80 85 30 31 32 33 35 38 40 43 30 31 32 33 35 38 40 43 34 37 41 30 31 32 33 35 38 40 43 36 39 44 34 37 41 30 31 32 33 35 38 40 43 36 39 44 30 31 32 33 35 38 40 43 34 37 41 42 30 31 32 33 35 38 40 43 36 39 44 45 46 47 48 50 53 55 58 45 46 47 48 50 53 55 58 49 52 56 45 46 47 48 50 53 55 58 51 54 59 49 52 56 45 46 47 48 50 53 55 58 51 54 59 45 46 47 48 50 53 55 58 49 52 56 57 45 46 47 48 50 53 55 58 51 54 59 - 0 6 12 18 24 27 33 36 39 45 48 54 57 58 64 67 73 79 85 91 94 100 103 106 112 115 121 124 125 131 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 142 150 153 161 164 167 175 178 186 189 190 198 201 209 217 220 228 231 234 242 245 253 256 257 265 268 -0 0 0 648 - 1.00000000e+00 -2.24608413e-05 -4.73624218e-04 -6.37415057e-05 -8.11362058e-04 -3.14469031e-04 5.44676339e-04 1.00000000e+00 8.54484818e-06 1.80786625e-04 2.44405710e-05 3.10701576e-04 1.19427362e-04 -2.06854258e-04 1.00000000e+00 7.79196219e-05 1.63553675e-03 2.17106428e-04 2.77758903e-03 1.09489118e-03 -1.89640715e-03 1.00000000e+00 -1.56973284e-04 -3.59495418e-03 -5.08746045e-04 -6.39642043e-03 -2.21036457e-03 3.82846374e-03 1.00000000e+00 2.13324838e-08 2.74061128e-07 -3.67069682e-07 1.00000000e+00 -1.15208332e-07 -2.86519988e-06 -4.17293752e-07 -5.24398120e-06 -1.67936460e-06 2.90874481e-06 1.00000000e+00 2.13324838e-08 2.74061128e-07 -3.67069682e-07 1.00000000e+00 2.65059239e-06 3.38541041e-05 -4.83032630e-05 1.00000000e+00 -2.17154078e-05 -4.64529051e-04 -6.39358182e-05 -8.08254920e-04 -3.04003684e-04 5.26549826e-04 1.00000000e+00 2.65059239e-06 3.38541041e-05 -4.83032630e-05 1.00000000e+00 4.25755671e-05 9.88002045e-04 1.40953144e-04 1.77156094e-03 6.27685814e-04 -1.05922181e-03 1.00000000e+00 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 -7.37430454e-05 -1.71126974e-03 -2.44138007e-04 -3.06843356e-03 -1.05922181e-03 1.85076980e-03 1.00000000e+00 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 -4.73624218e-04 -6.37415057e-05 -8.11362058e-04 -3.14469031e-04 5.44676339e-04 1.00000000e+00 8.54484818e-06 1.80786625e-04 2.44405710e-05 3.10701576e-04 1.19427362e-04 -2.06854258e-04 1.00000000e+00 7.79196219e-05 1.63553675e-03 2.17106428e-04 2.77758903e-03 1.09489118e-03 -1.89640715e-03 1.00000000e+00 -1.56973284e-04 -3.59495418e-03 -5.08746045e-04 -6.39642043e-03 -2.21036457e-03 3.82846374e-03 1.00000000e+00 2.13324838e-08 2.74061128e-07 -3.67069682e-07 1.00000000e+00 -1.15208332e-07 -2.86519988e-06 -4.17293752e-07 -5.24398120e-06 -1.67936460e-06 2.90874481e-06 1.00000000e+00 2.13324838e-08 2.74061128e-07 -3.67069682e-07 1.00000000e+00 2.65059239e-06 3.38541041e-05 -4.83032630e-05 1.00000000e+00 -2.17154078e-05 -4.64529051e-04 -6.39358182e-05 -8.08254920e-04 -3.04003684e-04 5.26549826e-04 1.00000000e+00 2.65059239e-06 3.38541041e-05 -4.83032630e-05 1.00000000e+00 4.25755671e-05 9.88002045e-04 1.40953144e-04 1.77156094e-03 6.27685814e-04 -1.05922181e-03 1.00000000e+00 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 -7.37430454e-05 -1.71126974e-03 -2.44138007e-04 -3.06843356e-03 -1.05922181e-03 1.85076980e-03 1.00000000e+00 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 -4.73624218e-04 6.37415057e-05 8.11362058e-04 -3.14469031e-04 5.44676339e-04 1.00000000e+00 8.54484818e-06 1.80786625e-04 -2.44405710e-05 -3.10701576e-04 1.19427362e-04 -2.06854258e-04 1.00000000e+00 7.79196219e-05 1.63553675e-03 -2.17106428e-04 -2.77758903e-03 1.09489118e-03 -1.89640715e-03 1.00000000e+00 -1.56973284e-04 -3.59495418e-03 5.08746045e-04 6.39642043e-03 -2.21036457e-03 3.82846374e-03 1.00000000e+00 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.00000000e+00 1.15208332e-07 2.86519988e-06 -4.17293752e-07 -5.24398120e-06 1.67936460e-06 -2.90874481e-06 1.00000000e+00 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.00000000e+00 2.65059239e-06 3.38541041e-05 4.83032630e-05 1.00000000e+00 2.17154078e-05 4.64529051e-04 -6.39358182e-05 -8.08254920e-04 3.04003684e-04 -5.26549826e-04 1.00000000e+00 2.65059239e-06 3.38541041e-05 4.83032630e-05 1.00000000e+00 4.25755671e-05 9.88002045e-04 -1.40953144e-04 -1.77156094e-03 6.27685814e-04 -1.05922181e-03 1.00000000e+00 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 -7.37430454e-05 -1.71126974e-03 2.44138007e-04 3.06843356e-03 -1.05922181e-03 1.85076980e-03 1.00000000e+00 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 -4.73624218e-04 6.37415057e-05 8.11362058e-04 -3.14469031e-04 5.44676339e-04 1.00000000e+00 8.54484818e-06 1.80786625e-04 -2.44405710e-05 -3.10701576e-04 1.19427362e-04 -2.06854258e-04 1.00000000e+00 7.79196219e-05 1.63553675e-03 -2.17106428e-04 -2.77758903e-03 1.09489118e-03 -1.89640715e-03 1.00000000e+00 -1.56973284e-04 -3.59495418e-03 5.08746045e-04 6.39642043e-03 -2.21036457e-03 3.82846374e-03 1.00000000e+00 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.00000000e+00 1.15208332e-07 2.86519988e-06 -4.17293752e-07 -5.24398120e-06 1.67936460e-06 -2.90874481e-06 1.00000000e+00 2.13324838e-08 2.74061128e-07 3.67069682e-07 1.00000000e+00 2.65059239e-06 3.38541041e-05 4.83032630e-05 1.00000000e+00 2.17154078e-05 4.64529051e-04 -6.39358182e-05 -8.08254920e-04 3.04003684e-04 -5.26549826e-04 1.00000000e+00 2.65059239e-06 3.38541041e-05 4.83032630e-05 1.00000000e+00 4.25755671e-05 9.88002045e-04 -1.40953144e-04 -1.77156094e-03 6.27685814e-04 -1.05922181e-03 1.00000000e+00 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 -7.37430454e-05 -1.71126974e-03 2.44138007e-04 3.06843356e-03 -1.05922181e-03 1.85076980e-03 1.00000000e+00 -2.28520600e-05 -2.92970263e-04 -4.02921227e-04 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 -1.15208332e-07 -2.17154078e-05 4.25755671e-05 -7.37430454e-05 1.00000000e+00 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 -2.86519988e-06 -4.64529051e-04 9.88002045e-04 -1.71126974e-03 1.00000000e+00 2.13324838e-08 2.65059239e-06 2.28520600e-05 1.00000000e+00 -6.37415057e-05 2.44405710e-05 2.17106428e-04 -5.08746045e-04 -4.17293752e-07 -6.39358182e-05 1.40953144e-04 -2.44138007e-04 1.00000000e+00 2.13324838e-08 2.65059239e-06 2.28520600e-05 1.00000000e+00 2.74061128e-07 3.38541041e-05 2.92970263e-04 1.00000000e+00 -8.11362058e-04 3.10701576e-04 2.77758903e-03 -6.39642043e-03 -5.24398120e-06 -8.08254920e-04 1.77156094e-03 -3.06843356e-03 1.00000000e+00 2.74061128e-07 3.38541041e-05 2.92970263e-04 1.00000000e+00 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 -1.67936460e-06 -3.04003684e-04 6.27685814e-04 -1.05922181e-03 1.00000000e+00 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 2.90874481e-06 5.26549826e-04 -1.05922181e-03 1.85076980e-03 1.00000000e+00 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 -1.15208332e-07 -2.17154078e-05 4.25755671e-05 -7.37430454e-05 1.00000000e+00 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 -2.86519988e-06 -4.64529051e-04 9.88002045e-04 -1.71126974e-03 1.00000000e+00 2.13324838e-08 2.65059239e-06 2.28520600e-05 1.00000000e+00 -6.37415057e-05 2.44405710e-05 2.17106428e-04 -5.08746045e-04 -4.17293752e-07 -6.39358182e-05 1.40953144e-04 -2.44138007e-04 1.00000000e+00 2.13324838e-08 2.65059239e-06 2.28520600e-05 1.00000000e+00 2.74061128e-07 3.38541041e-05 2.92970263e-04 1.00000000e+00 -8.11362058e-04 3.10701576e-04 2.77758903e-03 -6.39642043e-03 -5.24398120e-06 -8.08254920e-04 1.77156094e-03 -3.06843356e-03 1.00000000e+00 2.74061128e-07 3.38541041e-05 2.92970263e-04 1.00000000e+00 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 -1.67936460e-06 -3.04003684e-04 6.27685814e-04 -1.05922181e-03 1.00000000e+00 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 2.90874481e-06 5.26549826e-04 -1.05922181e-03 1.85076980e-03 1.00000000e+00 -3.67069682e-07 -4.83032630e-05 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 1.15208332e-07 2.17154078e-05 4.25755671e-05 -7.37430454e-05 1.00000000e+00 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 2.86519988e-06 4.64529051e-04 9.88002045e-04 -1.71126974e-03 1.00000000e+00 2.13324838e-08 2.65059239e-06 -2.28520600e-05 1.00000000e+00 6.37415057e-05 -2.44405710e-05 -2.17106428e-04 5.08746045e-04 -4.17293752e-07 -6.39358182e-05 -1.40953144e-04 2.44138007e-04 1.00000000e+00 2.13324838e-08 2.65059239e-06 -2.28520600e-05 1.00000000e+00 2.74061128e-07 3.38541041e-05 -2.92970263e-04 1.00000000e+00 8.11362058e-04 -3.10701576e-04 -2.77758903e-03 6.39642043e-03 -5.24398120e-06 -8.08254920e-04 -1.77156094e-03 3.06843356e-03 1.00000000e+00 2.74061128e-07 3.38541041e-05 -2.92970263e-04 1.00000000e+00 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 1.67936460e-06 3.04003684e-04 6.27685814e-04 -1.05922181e-03 1.00000000e+00 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 -2.90874481e-06 -5.26549826e-04 -1.05922181e-03 1.85076980e-03 1.00000000e+00 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.00000000e+00 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 1.15208332e-07 2.17154078e-05 4.25755671e-05 -7.37430454e-05 1.00000000e+00 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 2.86519988e-06 4.64529051e-04 9.88002045e-04 -1.71126974e-03 1.00000000e+00 2.13324838e-08 2.65059239e-06 -2.28520600e-05 1.00000000e+00 6.37415057e-05 -2.44405710e-05 -2.17106428e-04 5.08746045e-04 -4.17293752e-07 -6.39358182e-05 -1.40953144e-04 2.44138007e-04 1.00000000e+00 2.13324838e-08 2.65059239e-06 -2.28520600e-05 1.00000000e+00 2.74061128e-07 3.38541041e-05 -2.92970263e-04 1.00000000e+00 8.11362058e-04 -3.10701576e-04 -2.77758903e-03 6.39642043e-03 -5.24398120e-06 -8.08254920e-04 -1.77156094e-03 3.06843356e-03 1.00000000e+00 2.74061128e-07 3.38541041e-05 -2.92970263e-04 1.00000000e+00 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 1.67936460e-06 3.04003684e-04 6.27685814e-04 -1.05922181e-03 1.00000000e+00 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.00000000e+00 1.61438192e-05 1.00000000e+00 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 -2.90874481e-06 -5.26549826e-04 -1.05922181e-03 1.85076980e-03 1.00000000e+00 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.00000000e+00 - 0 60 61 63 66 68 71 1 60 61 63 66 68 71 2 60 61 63 66 68 71 3 60 61 63 66 68 71 4 62 65 69 5 60 61 63 66 68 71 6 64 67 72 7 62 65 69 8 60 61 63 66 68 71 9 64 67 72 10 60 61 63 66 68 71 11 62 65 69 12 70 13 60 61 63 66 68 71 14 64 67 72 15 73 74 76 79 81 84 16 73 74 76 79 81 84 17 73 74 76 79 81 84 18 73 74 76 79 81 84 19 75 78 82 20 73 74 76 79 81 84 21 77 80 85 22 75 78 82 23 73 74 76 79 81 84 24 77 80 85 25 73 74 76 79 81 84 26 75 78 82 27 83 28 73 74 76 79 81 84 29 77 80 85 30 86 87 89 92 94 97 31 86 87 89 92 94 97 32 86 87 89 92 94 97 33 86 87 89 92 94 97 34 88 91 95 35 86 87 89 92 94 97 36 90 93 98 37 88 91 95 38 86 87 89 92 94 97 39 90 93 98 40 86 87 89 92 94 97 41 88 91 95 42 96 43 86 87 89 92 94 97 44 90 93 98 45 99 100 102 105 107 110 46 99 100 102 105 107 110 47 99 100 102 105 107 110 48 99 100 102 105 107 110 49 101 104 108 50 99 100 102 105 107 110 51 103 106 111 52 101 104 108 53 99 100 102 105 107 110 54 103 106 111 55 99 100 102 105 107 110 56 101 104 108 57 109 58 99 100 102 105 107 110 59 103 106 111 0 1 2 3 5 8 10 13 60 0 1 2 3 5 8 10 13 61 4 7 11 62 0 1 2 3 5 8 10 13 63 6 9 14 64 4 7 11 65 0 1 2 3 5 8 10 13 66 6 9 14 67 0 1 2 3 5 8 10 13 68 4 7 11 69 12 70 0 1 2 3 5 8 10 13 71 6 9 14 72 15 16 17 18 20 23 25 28 73 15 16 17 18 20 23 25 28 74 19 22 26 75 15 16 17 18 20 23 25 28 76 21 24 29 77 19 22 26 78 15 16 17 18 20 23 25 28 79 21 24 29 80 15 16 17 18 20 23 25 28 81 19 22 26 82 27 83 15 16 17 18 20 23 25 28 84 21 24 29 85 30 31 32 33 35 38 40 43 86 30 31 32 33 35 38 40 43 87 34 37 41 88 30 31 32 33 35 38 40 43 89 36 39 44 90 34 37 41 91 30 31 32 33 35 38 40 43 92 36 39 44 93 30 31 32 33 35 38 40 43 94 34 37 41 95 42 96 30 31 32 33 35 38 40 43 97 36 39 44 98 45 46 47 48 50 53 55 58 99 45 46 47 48 50 53 55 58 100 49 52 56 101 45 46 47 48 50 53 55 58 102 51 54 59 103 49 52 56 104 45 46 47 48 50 53 55 58 105 51 54 59 106 45 46 47 48 50 53 55 58 107 49 52 56 108 57 109 45 46 47 48 50 53 55 58 110 51 54 59 111 - 0 7 14 21 28 32 39 43 47 54 58 65 69 71 78 82 89 96 103 110 114 121 125 129 136 140 147 151 153 160 164 171 178 185 192 196 203 207 211 218 222 229 233 235 242 246 253 260 267 274 278 285 289 293 300 304 311 315 317 324 328 337 346 350 359 363 367 376 380 389 393 395 404 408 417 426 430 439 443 447 456 460 469 473 475 484 488 497 506 510 519 523 527 536 540 549 553 555 564 568 577 586 590 599 603 607 616 620 629 633 635 644 648 -1 0 0 268 - -2.24608413e-05 -4.73624218e-04 -6.37415057e-05 -8.11362058e-04 -3.14469031e-04 5.44676339e-04 8.54484818e-06 1.80786625e-04 2.44405710e-05 3.10701576e-04 1.19427362e-04 -2.06854258e-04 7.79196219e-05 1.63553675e-03 2.17106428e-04 2.77758903e-03 1.09489118e-03 -1.89640715e-03 -1.56973284e-04 -3.59495418e-03 -5.08746045e-04 -6.39642043e-03 -2.21036457e-03 3.82846374e-03 2.13324838e-08 2.74061128e-07 -3.67069682e-07 -1.15208332e-07 -2.86519988e-06 -4.17293752e-07 -5.24398120e-06 -1.67936460e-06 2.90874481e-06 2.13324838e-08 2.74061128e-07 -3.67069682e-07 2.65059239e-06 3.38541041e-05 -4.83032630e-05 -2.17154078e-05 -4.64529051e-04 -6.39358182e-05 -8.08254920e-04 -3.04003684e-04 5.26549826e-04 2.65059239e-06 3.38541041e-05 -4.83032630e-05 4.25755671e-05 9.88002045e-04 1.40953144e-04 1.77156094e-03 6.27685814e-04 -1.05922181e-03 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.61438192e-05 -7.37430454e-05 -1.71126974e-03 -2.44138007e-04 -3.06843356e-03 -1.05922181e-03 1.85076980e-03 2.28520600e-05 2.92970263e-04 -4.02921227e-04 -2.24608413e-05 -4.73624218e-04 -6.37415057e-05 -8.11362058e-04 -3.14469031e-04 5.44676339e-04 8.54484818e-06 1.80786625e-04 2.44405710e-05 3.10701576e-04 1.19427362e-04 -2.06854258e-04 7.79196219e-05 1.63553675e-03 2.17106428e-04 2.77758903e-03 1.09489118e-03 -1.89640715e-03 -1.56973284e-04 -3.59495418e-03 -5.08746045e-04 -6.39642043e-03 -2.21036457e-03 3.82846374e-03 2.13324838e-08 2.74061128e-07 -3.67069682e-07 -1.15208332e-07 -2.86519988e-06 -4.17293752e-07 -5.24398120e-06 -1.67936460e-06 2.90874481e-06 2.13324838e-08 2.74061128e-07 -3.67069682e-07 2.65059239e-06 3.38541041e-05 -4.83032630e-05 -2.17154078e-05 -4.64529051e-04 -6.39358182e-05 -8.08254920e-04 -3.04003684e-04 5.26549826e-04 2.65059239e-06 3.38541041e-05 -4.83032630e-05 4.25755671e-05 9.88002045e-04 1.40953144e-04 1.77156094e-03 6.27685814e-04 -1.05922181e-03 2.28520600e-05 2.92970263e-04 -4.02921227e-04 1.61438192e-05 -7.37430454e-05 -1.71126974e-03 -2.44138007e-04 -3.06843356e-03 -1.05922181e-03 1.85076980e-03 2.28520600e-05 2.92970263e-04 -4.02921227e-04 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 1.15208332e-07 2.17154078e-05 4.25755671e-05 -7.37430454e-05 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 2.86519988e-06 4.64529051e-04 9.88002045e-04 -1.71126974e-03 2.13324838e-08 2.65059239e-06 -2.28520600e-05 6.37415057e-05 -2.44405710e-05 -2.17106428e-04 5.08746045e-04 -4.17293752e-07 -6.39358182e-05 -1.40953144e-04 2.44138007e-04 2.13324838e-08 2.65059239e-06 -2.28520600e-05 2.74061128e-07 3.38541041e-05 -2.92970263e-04 8.11362058e-04 -3.10701576e-04 -2.77758903e-03 6.39642043e-03 -5.24398120e-06 -8.08254920e-04 -1.77156094e-03 3.06843356e-03 2.74061128e-07 3.38541041e-05 -2.92970263e-04 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 1.67936460e-06 3.04003684e-04 6.27685814e-04 -1.05922181e-03 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.61438192e-05 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 -2.90874481e-06 -5.26549826e-04 -1.05922181e-03 1.85076980e-03 3.67069682e-07 4.83032630e-05 -4.02921227e-04 -2.24608413e-05 8.54484818e-06 7.79196219e-05 -1.56973284e-04 1.15208332e-07 2.17154078e-05 4.25755671e-05 -7.37430454e-05 -4.73624218e-04 1.80786625e-04 1.63553675e-03 -3.59495418e-03 2.86519988e-06 4.64529051e-04 9.88002045e-04 -1.71126974e-03 2.13324838e-08 2.65059239e-06 -2.28520600e-05 6.37415057e-05 -2.44405710e-05 -2.17106428e-04 5.08746045e-04 -4.17293752e-07 -6.39358182e-05 -1.40953144e-04 2.44138007e-04 2.13324838e-08 2.65059239e-06 -2.28520600e-05 2.74061128e-07 3.38541041e-05 -2.92970263e-04 8.11362058e-04 -3.10701576e-04 -2.77758903e-03 6.39642043e-03 -5.24398120e-06 -8.08254920e-04 -1.77156094e-03 3.06843356e-03 2.74061128e-07 3.38541041e-05 -2.92970263e-04 -3.14469031e-04 1.19427362e-04 1.09489118e-03 -2.21036457e-03 1.67936460e-06 3.04003684e-04 6.27685814e-04 -1.05922181e-03 3.67069682e-07 4.83032630e-05 -4.02921227e-04 1.61438192e-05 5.44676339e-04 -2.06854258e-04 -1.89640715e-03 3.82846374e-03 -2.90874481e-06 -5.26549826e-04 -1.05922181e-03 1.85076980e-03 3.67069682e-07 4.83032630e-05 -4.02921227e-04 - 86 87 89 92 94 97 86 87 89 92 94 97 86 87 89 92 94 97 86 87 89 92 94 97 88 91 95 86 87 89 92 94 97 90 93 98 88 91 95 86 87 89 92 94 97 90 93 98 86 87 89 92 94 97 88 91 95 96 86 87 89 92 94 97 90 93 98 99 100 102 105 107 110 99 100 102 105 107 110 99 100 102 105 107 110 99 100 102 105 107 110 101 104 108 99 100 102 105 107 110 103 106 111 101 104 108 99 100 102 105 107 110 103 106 111 99 100 102 105 107 110 101 104 108 109 99 100 102 105 107 110 103 106 111 0 1 2 3 5 8 10 13 0 1 2 3 5 8 10 13 4 7 11 0 1 2 3 5 8 10 13 6 9 14 4 7 11 0 1 2 3 5 8 10 13 6 9 14 0 1 2 3 5 8 10 13 4 7 11 12 0 1 2 3 5 8 10 13 6 9 14 15 16 17 18 20 23 25 28 15 16 17 18 20 23 25 28 19 22 26 15 16 17 18 20 23 25 28 21 24 29 19 22 26 15 16 17 18 20 23 25 28 21 24 29 15 16 17 18 20 23 25 28 19 22 26 27 15 16 17 18 20 23 25 28 21 24 29 - 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 12 18 24 27 33 36 39 45 48 54 57 58 64 67 73 79 85 91 94 100 103 106 112 115 121 124 125 131 134 142 150 153 161 164 167 175 178 186 189 190 198 201 209 217 220 228 231 234 242 245 253 256 257 265 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 +Ionic_Step 1 + # print S matrix in real space S(R) + 1 # number of spin directions + 1 # spin index + 112 # number of localized basis + 3 # number of Bravais lattice vector R + + user_defined_lattice + 1 + 14.2796 0 0 + 0 24.2796 0 + 0 0 24.2796 + Mg O + 4 4 + Direct + 0 0 0 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + 0.5 0 0 + 0.5 0.5 0.5 + 0 0 0.5 + 0 0.5 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + + -1 0 0 268 + # CSR values + -2.2460841302088702e-05 -4.7362421780844523e-04 6.3741505691163069e-05 8.1136205810217047e-04 -3.1446903101666596e-04 5.4467633912781861e-04 + 8.5448481792755698e-06 1.8078662546217335e-04 -2.4440570995631175e-05 -3.1070157609534789e-04 1.1942736153340638e-04 -2.0685425798975678e-04 + 7.7919621935008184e-05 1.6355367462904196e-03 -2.1710642755322837e-04 -2.7775890319078531e-03 1.0948911809814791e-03 -1.8964071542190127e-03 + -1.5697328379591090e-04 -3.5949541786793140e-03 5.0874604495665518e-04 6.3964204273636504e-03 -2.2103645726107590e-03 3.8284637430121013e-03 + 2.1332483805898328e-08 2.7406112821062117e-07 3.6706968215316873e-07 1.1520833227398834e-07 2.8651998758388368e-06 -4.1729375212622274e-07 + -5.2439812005618663e-06 1.6793645993803805e-06 -2.9087448105593724e-06 2.1332483805898301e-08 2.7406112821062117e-07 3.6706968215316916e-07 + 2.6505923946994974e-06 3.3854104063170344e-05 4.8303262969576617e-05 2.1715407787562440e-05 4.6452905084814496e-04 -6.3935818197024662e-05 + -8.0825492040994575e-04 3.0400368372972774e-04 -5.2654982590798855e-04 2.6505923946995008e-06 3.3854104063170398e-05 4.8303262969576617e-05 + 4.2575567100665728e-05 9.8800204535450572e-04 -1.4095314397314163e-04 -1.7715609421561978e-03 6.2768581445658649e-04 -1.0592218066644676e-03 + -2.2852059990080006e-05 -2.9297026341215475e-04 -4.0292122696672491e-04 1.6143819247334398e-05 -7.3743045379410992e-05 -1.7112697405359742e-03 + 2.4413800684805221e-04 3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 -2.2852059990079992e-05 -2.9297026341215497e-04 + -4.0292122696672546e-04 -2.2460841302088702e-05 -4.7362421780844523e-04 6.3741505691163069e-05 8.1136205810217047e-04 -3.1446903101666596e-04 + 5.4467633912781861e-04 8.5448481792755698e-06 1.8078662546217335e-04 -2.4440570995631175e-05 -3.1070157609534789e-04 1.1942736153340638e-04 + -2.0685425798975678e-04 7.7919621935008184e-05 1.6355367462904196e-03 -2.1710642755322837e-04 -2.7775890319078531e-03 1.0948911809814791e-03 + -1.8964071542190127e-03 -1.5697328379591090e-04 -3.5949541786793140e-03 5.0874604495665518e-04 6.3964204273636504e-03 -2.2103645726107590e-03 + 3.8284637430121013e-03 2.1332483805898328e-08 2.7406112821062117e-07 3.6706968215316873e-07 1.1520833227398834e-07 2.8651998758388368e-06 + -4.1729375212622274e-07 -5.2439812005618663e-06 1.6793645993803805e-06 -2.9087448105593724e-06 2.1332483805898301e-08 2.7406112821062117e-07 + 3.6706968215316916e-07 2.6505923946994974e-06 3.3854104063170344e-05 4.8303262969576617e-05 2.1715407787562440e-05 4.6452905084814496e-04 + -6.3935818197024662e-05 -8.0825492040994575e-04 3.0400368372972774e-04 -5.2654982590798855e-04 2.6505923946995008e-06 3.3854104063170398e-05 + 4.8303262969576617e-05 4.2575567100665728e-05 9.8800204535450572e-04 -1.4095314397314163e-04 -1.7715609421561978e-03 6.2768581445658649e-04 + -1.0592218066644676e-03 -2.2852059990080006e-05 -2.9297026341215475e-04 -4.0292122696672491e-04 1.6143819247334398e-05 -7.3743045379410992e-05 + -1.7112697405359742e-03 2.4413800684805221e-04 3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 -2.2852059990079992e-05 + -2.9297026341215497e-04 -4.0292122696672546e-04 -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 -1.5697328379591090e-04 + -1.1520833227398834e-07 -2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 -4.7362421780844523e-04 1.8078662546217335e-04 + 1.6355367462904196e-03 -3.5949541786793140e-03 -2.8651998758388368e-06 -4.6452905084814496e-04 9.8800204535450572e-04 -1.7112697405359742e-03 + 2.1332483805898328e-08 2.6505923946994974e-06 2.2852059990080006e-05 -6.3741505691163069e-05 2.4440570995631175e-05 2.1710642755322837e-04 + -5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 1.4095314397314163e-04 -2.4413800684805221e-04 2.1332483805898301e-08 + 2.6505923946995008e-06 2.2852059990079992e-05 2.7406112821062117e-07 3.3854104063170344e-05 2.9297026341215475e-04 -8.1136205810217047e-04 + 3.1070157609534789e-04 2.7775890319078531e-03 -6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 1.7715609421561978e-03 + -3.0684335605191235e-03 2.7406112821062117e-07 3.3854104063170398e-05 2.9297026341215497e-04 -3.1446903101666596e-04 1.1942736153340638e-04 + 1.0948911809814791e-03 -2.2103645726107590e-03 -1.6793645993803805e-06 -3.0400368372972774e-04 6.2768581445658649e-04 -1.0592218066644676e-03 + -3.6706968215316873e-07 -4.8303262969576617e-05 -4.0292122696672491e-04 1.6143819247334398e-05 5.4467633912781861e-04 -2.0685425798975678e-04 + -1.8964071542190127e-03 3.8284637430121013e-03 2.9087448105593724e-06 5.2654982590798855e-04 -1.0592218066644676e-03 1.8507698048750914e-03 + -3.6706968215316916e-07 -4.8303262969576617e-05 -4.0292122696672546e-04 -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 + -1.5697328379591090e-04 -1.1520833227398834e-07 -2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 -4.7362421780844523e-04 + 1.8078662546217335e-04 1.6355367462904196e-03 -3.5949541786793140e-03 -2.8651998758388368e-06 -4.6452905084814496e-04 9.8800204535450572e-04 + -1.7112697405359742e-03 2.1332483805898328e-08 2.6505923946994974e-06 2.2852059990080006e-05 -6.3741505691163069e-05 2.4440570995631175e-05 + 2.1710642755322837e-04 -5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 1.4095314397314163e-04 -2.4413800684805221e-04 + 2.1332483805898301e-08 2.6505923946995008e-06 2.2852059990079992e-05 2.7406112821062117e-07 3.3854104063170344e-05 2.9297026341215475e-04 + -8.1136205810217047e-04 3.1070157609534789e-04 2.7775890319078531e-03 -6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 + 1.7715609421561978e-03 -3.0684335605191235e-03 2.7406112821062117e-07 3.3854104063170398e-05 2.9297026341215497e-04 -3.1446903101666596e-04 + 1.1942736153340638e-04 1.0948911809814791e-03 -2.2103645726107590e-03 -1.6793645993803805e-06 -3.0400368372972774e-04 6.2768581445658649e-04 + -1.0592218066644676e-03 -3.6706968215316873e-07 -4.8303262969576617e-05 -4.0292122696672491e-04 1.6143819247334398e-05 5.4467633912781861e-04 + -2.0685425798975678e-04 -1.8964071542190127e-03 3.8284637430121013e-03 2.9087448105593724e-06 5.2654982590798855e-04 -1.0592218066644676e-03 + 1.8507698048750914e-03 -3.6706968215316916e-07 -4.8303262969576617e-05 -4.0292122696672546e-04 + # CSR column indices + 60 61 63 66 68 71 60 61 63 66 68 71 60 61 63 66 + 68 71 60 61 63 66 68 71 62 65 69 60 61 63 66 68 + 71 64 67 72 62 65 69 60 61 63 66 68 71 64 67 72 + 60 61 63 66 68 71 62 65 69 70 60 61 63 66 68 71 + 64 67 72 73 74 76 79 81 84 73 74 76 79 81 84 73 + 74 76 79 81 84 73 74 76 79 81 84 75 78 82 73 74 + 76 79 81 84 77 80 85 75 78 82 73 74 76 79 81 84 + 77 80 85 73 74 76 79 81 84 75 78 82 83 73 74 76 + 79 81 84 77 80 85 30 31 32 33 35 38 40 43 30 31 + 32 33 35 38 40 43 34 37 41 30 31 32 33 35 38 40 + 43 36 39 44 34 37 41 30 31 32 33 35 38 40 43 36 + 39 44 30 31 32 33 35 38 40 43 34 37 41 42 30 31 + 32 33 35 38 40 43 36 39 44 45 46 47 48 50 53 55 + 58 45 46 47 48 50 53 55 58 49 52 56 45 46 47 48 + 50 53 55 58 51 54 59 49 52 56 45 46 47 48 50 53 + 55 58 51 54 59 45 46 47 48 50 53 55 58 49 52 56 + 57 45 46 47 48 50 53 55 58 51 54 59 + # CSR row pointers + 0 6 12 18 24 27 33 36 39 45 48 54 57 58 64 67 + 73 79 85 91 94 100 103 106 112 115 121 124 125 131 134 134 + 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 + 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 + 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 134 + 134 134 134 134 134 134 134 142 150 153 161 164 167 175 178 186 + 189 190 198 201 209 217 220 228 231 234 242 245 253 256 257 265 + 268 + + 0 0 0 648 + # CSR values + 1.0000000000000202e+00 -2.2460841302088702e-05 -4.7362421780844523e-04 -6.3741505691163069e-05 -8.1136205810217047e-04 -3.1446903101666596e-04 + 5.4467633912781861e-04 1.0000000000000331e+00 8.5448481792755698e-06 1.8078662546217335e-04 2.4440570995631175e-05 3.1070157609534789e-04 + 1.1942736153340638e-04 -2.0685425798975678e-04 1.0000000000000224e+00 7.7919621935008184e-05 1.6355367462904196e-03 2.1710642755322837e-04 + 2.7775890319078531e-03 1.0948911809814791e-03 -1.8964071542190127e-03 1.0000000000000293e+00 -1.5697328379591090e-04 -3.5949541786793140e-03 + -5.0874604495665518e-04 -6.3964204273636504e-03 -2.2103645726107590e-03 3.8284637430121013e-03 9.9999999999995282e-01 2.1332483805898328e-08 + 2.7406112821062117e-07 -3.6706968215316873e-07 9.9999999999995282e-01 -1.1520833227398834e-07 -2.8651998758388368e-06 -4.1729375212622274e-07 + -5.2439812005618663e-06 -1.6793645993803805e-06 2.9087448105593724e-06 9.9999999999995282e-01 2.1332483805898301e-08 2.7406112821062117e-07 + -3.6706968215316916e-07 1.0000000000000002e+00 2.6505923946994974e-06 3.3854104063170344e-05 -4.8303262969576617e-05 1.0000000000000002e+00 + -2.1715407787562440e-05 -4.6452905084814496e-04 -6.3935818197024662e-05 -8.0825492040994575e-04 -3.0400368372972774e-04 5.2654982590798855e-04 + 1.0000000000000002e+00 2.6505923946995008e-06 3.3854104063170398e-05 -4.8303262969576617e-05 9.9999999999999034e-01 4.2575567100665728e-05 + 9.8800204535450572e-04 1.4095314397314163e-04 1.7715609421561978e-03 6.2768581445658649e-04 -1.0592218066644676e-03 9.9999999999999034e-01 + 2.2852059990080006e-05 2.9297026341215475e-04 -4.0292122696672491e-04 9.9999999999999034e-01 1.6143819247334398e-05 9.9999999999999034e-01 + -7.3743045379410992e-05 -1.7112697405359742e-03 -2.4413800684805221e-04 -3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 + 9.9999999999999034e-01 2.2852059990079992e-05 2.9297026341215497e-04 -4.0292122696672546e-04 1.0000000000000202e+00 -2.2460841302088702e-05 + -4.7362421780844523e-04 -6.3741505691163069e-05 -8.1136205810217047e-04 -3.1446903101666596e-04 5.4467633912781861e-04 1.0000000000000331e+00 + 8.5448481792755698e-06 1.8078662546217335e-04 2.4440570995631175e-05 3.1070157609534789e-04 1.1942736153340638e-04 -2.0685425798975678e-04 + 1.0000000000000224e+00 7.7919621935008184e-05 1.6355367462904196e-03 2.1710642755322837e-04 2.7775890319078531e-03 1.0948911809814791e-03 + -1.8964071542190127e-03 1.0000000000000293e+00 -1.5697328379591090e-04 -3.5949541786793140e-03 -5.0874604495665518e-04 -6.3964204273636504e-03 + -2.2103645726107590e-03 3.8284637430121013e-03 9.9999999999995282e-01 2.1332483805898328e-08 2.7406112821062117e-07 -3.6706968215316873e-07 + 9.9999999999995282e-01 -1.1520833227398834e-07 -2.8651998758388368e-06 -4.1729375212622274e-07 -5.2439812005618663e-06 -1.6793645993803805e-06 + 2.9087448105593724e-06 9.9999999999995282e-01 2.1332483805898301e-08 2.7406112821062117e-07 -3.6706968215316916e-07 1.0000000000000002e+00 + 2.6505923946994974e-06 3.3854104063170344e-05 -4.8303262969576617e-05 1.0000000000000002e+00 -2.1715407787562440e-05 -4.6452905084814496e-04 + -6.3935818197024662e-05 -8.0825492040994575e-04 -3.0400368372972774e-04 5.2654982590798855e-04 1.0000000000000002e+00 2.6505923946995008e-06 + 3.3854104063170398e-05 -4.8303262969576617e-05 9.9999999999999034e-01 4.2575567100665728e-05 9.8800204535450572e-04 1.4095314397314163e-04 + 1.7715609421561978e-03 6.2768581445658649e-04 -1.0592218066644676e-03 9.9999999999999034e-01 2.2852059990080006e-05 2.9297026341215475e-04 + -4.0292122696672491e-04 9.9999999999999034e-01 1.6143819247334398e-05 9.9999999999999034e-01 -7.3743045379410992e-05 -1.7112697405359742e-03 + -2.4413800684805221e-04 -3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 9.9999999999999034e-01 2.2852059990079992e-05 + 2.9297026341215497e-04 -4.0292122696672546e-04 1.0000000000000202e+00 -2.2460841302088702e-05 -4.7362421780844523e-04 6.3741505691163069e-05 + 8.1136205810217047e-04 -3.1446903101666596e-04 5.4467633912781861e-04 1.0000000000000331e+00 8.5448481792755698e-06 1.8078662546217335e-04 + -2.4440570995631175e-05 -3.1070157609534789e-04 1.1942736153340638e-04 -2.0685425798975678e-04 1.0000000000000224e+00 7.7919621935008184e-05 + 1.6355367462904196e-03 -2.1710642755322837e-04 -2.7775890319078531e-03 1.0948911809814791e-03 -1.8964071542190127e-03 1.0000000000000293e+00 + -1.5697328379591090e-04 -3.5949541786793140e-03 5.0874604495665518e-04 6.3964204273636504e-03 -2.2103645726107590e-03 3.8284637430121013e-03 + 9.9999999999995282e-01 2.1332483805898328e-08 2.7406112821062117e-07 3.6706968215316873e-07 9.9999999999995282e-01 1.1520833227398834e-07 + 2.8651998758388368e-06 -4.1729375212622274e-07 -5.2439812005618663e-06 1.6793645993803805e-06 -2.9087448105593724e-06 9.9999999999995282e-01 + 2.1332483805898301e-08 2.7406112821062117e-07 3.6706968215316916e-07 1.0000000000000002e+00 2.6505923946994974e-06 3.3854104063170344e-05 + 4.8303262969576617e-05 1.0000000000000002e+00 2.1715407787562440e-05 4.6452905084814496e-04 -6.3935818197024662e-05 -8.0825492040994575e-04 + 3.0400368372972774e-04 -5.2654982590798855e-04 1.0000000000000002e+00 2.6505923946995008e-06 3.3854104063170398e-05 4.8303262969576617e-05 + 9.9999999999999034e-01 4.2575567100665728e-05 9.8800204535450572e-04 -1.4095314397314163e-04 -1.7715609421561978e-03 6.2768581445658649e-04 + -1.0592218066644676e-03 9.9999999999999034e-01 -2.2852059990080006e-05 -2.9297026341215475e-04 -4.0292122696672491e-04 9.9999999999999034e-01 + 1.6143819247334398e-05 9.9999999999999034e-01 -7.3743045379410992e-05 -1.7112697405359742e-03 2.4413800684805221e-04 3.0684335605191235e-03 + -1.0592218066644676e-03 1.8507698048750914e-03 9.9999999999999034e-01 -2.2852059990079992e-05 -2.9297026341215497e-04 -4.0292122696672546e-04 + 1.0000000000000202e+00 -2.2460841302088702e-05 -4.7362421780844523e-04 6.3741505691163069e-05 8.1136205810217047e-04 -3.1446903101666596e-04 + 5.4467633912781861e-04 1.0000000000000331e+00 8.5448481792755698e-06 1.8078662546217335e-04 -2.4440570995631175e-05 -3.1070157609534789e-04 + 1.1942736153340638e-04 -2.0685425798975678e-04 1.0000000000000224e+00 7.7919621935008184e-05 1.6355367462904196e-03 -2.1710642755322837e-04 + -2.7775890319078531e-03 1.0948911809814791e-03 -1.8964071542190127e-03 1.0000000000000293e+00 -1.5697328379591090e-04 -3.5949541786793140e-03 + 5.0874604495665518e-04 6.3964204273636504e-03 -2.2103645726107590e-03 3.8284637430121013e-03 9.9999999999995282e-01 2.1332483805898328e-08 + 2.7406112821062117e-07 3.6706968215316873e-07 9.9999999999995282e-01 1.1520833227398834e-07 2.8651998758388368e-06 -4.1729375212622274e-07 + -5.2439812005618663e-06 1.6793645993803805e-06 -2.9087448105593724e-06 9.9999999999995282e-01 2.1332483805898301e-08 2.7406112821062117e-07 + 3.6706968215316916e-07 1.0000000000000002e+00 2.6505923946994974e-06 3.3854104063170344e-05 4.8303262969576617e-05 1.0000000000000002e+00 + 2.1715407787562440e-05 4.6452905084814496e-04 -6.3935818197024662e-05 -8.0825492040994575e-04 3.0400368372972774e-04 -5.2654982590798855e-04 + 1.0000000000000002e+00 2.6505923946995008e-06 3.3854104063170398e-05 4.8303262969576617e-05 9.9999999999999034e-01 4.2575567100665728e-05 + 9.8800204535450572e-04 -1.4095314397314163e-04 -1.7715609421561978e-03 6.2768581445658649e-04 -1.0592218066644676e-03 9.9999999999999034e-01 + -2.2852059990080006e-05 -2.9297026341215475e-04 -4.0292122696672491e-04 9.9999999999999034e-01 1.6143819247334398e-05 9.9999999999999034e-01 + -7.3743045379410992e-05 -1.7112697405359742e-03 2.4413800684805221e-04 3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 + 9.9999999999999034e-01 -2.2852059990079992e-05 -2.9297026341215497e-04 -4.0292122696672546e-04 -2.2460841302088702e-05 8.5448481792755698e-06 + 7.7919621935008184e-05 -1.5697328379591090e-04 -1.1520833227398834e-07 -2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 + 9.9999999999999356e-01 -4.7362421780844523e-04 1.8078662546217335e-04 1.6355367462904196e-03 -3.5949541786793140e-03 -2.8651998758388368e-06 + -4.6452905084814496e-04 9.8800204535450572e-04 -1.7112697405359742e-03 1.0000000000000042e+00 2.1332483805898328e-08 2.6505923946994974e-06 + 2.2852059990080006e-05 1.0000000000000298e+00 -6.3741505691163069e-05 2.4440570995631175e-05 2.1710642755322837e-04 -5.0874604495665518e-04 + -4.1729375212622274e-07 -6.3935818197024662e-05 1.4095314397314163e-04 -2.4413800684805221e-04 1.0000000000000298e+00 2.1332483805898301e-08 + 2.6505923946995008e-06 2.2852059990079992e-05 1.0000000000000298e+00 2.7406112821062117e-07 3.3854104063170344e-05 2.9297026341215475e-04 + 1.0000000000000093e+00 -8.1136205810217047e-04 3.1070157609534789e-04 2.7775890319078531e-03 -6.3964204273636504e-03 -5.2439812005618663e-06 + -8.0825492040994575e-04 1.7715609421561978e-03 -3.0684335605191235e-03 1.0000000000000093e+00 2.7406112821062117e-07 3.3854104063170398e-05 + 2.9297026341215497e-04 1.0000000000000093e+00 -3.1446903101666596e-04 1.1942736153340638e-04 1.0948911809814791e-03 -2.2103645726107590e-03 + -1.6793645993803805e-06 -3.0400368372972774e-04 6.2768581445658649e-04 -1.0592218066644676e-03 1.0000000000000009e+00 -3.6706968215316873e-07 + -4.8303262969576617e-05 -4.0292122696672491e-04 1.0000000000000009e+00 1.6143819247334398e-05 1.0000000000000009e+00 5.4467633912781861e-04 + -2.0685425798975678e-04 -1.8964071542190127e-03 3.8284637430121013e-03 2.9087448105593724e-06 5.2654982590798855e-04 -1.0592218066644676e-03 + 1.8507698048750914e-03 1.0000000000000009e+00 -3.6706968215316916e-07 -4.8303262969576617e-05 -4.0292122696672546e-04 1.0000000000000009e+00 + -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 -1.5697328379591090e-04 -1.1520833227398834e-07 -2.1715407787562440e-05 + 4.2575567100665728e-05 -7.3743045379410992e-05 9.9999999999999356e-01 -4.7362421780844523e-04 1.8078662546217335e-04 1.6355367462904196e-03 + -3.5949541786793140e-03 -2.8651998758388368e-06 -4.6452905084814496e-04 9.8800204535450572e-04 -1.7112697405359742e-03 1.0000000000000042e+00 + 2.1332483805898328e-08 2.6505923946994974e-06 2.2852059990080006e-05 1.0000000000000298e+00 -6.3741505691163069e-05 2.4440570995631175e-05 + 2.1710642755322837e-04 -5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 1.4095314397314163e-04 -2.4413800684805221e-04 + 1.0000000000000298e+00 2.1332483805898301e-08 2.6505923946995008e-06 2.2852059990079992e-05 1.0000000000000298e+00 2.7406112821062117e-07 + 3.3854104063170344e-05 2.9297026341215475e-04 1.0000000000000093e+00 -8.1136205810217047e-04 3.1070157609534789e-04 2.7775890319078531e-03 + -6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 1.7715609421561978e-03 -3.0684335605191235e-03 1.0000000000000093e+00 + 2.7406112821062117e-07 3.3854104063170398e-05 2.9297026341215497e-04 1.0000000000000093e+00 -3.1446903101666596e-04 1.1942736153340638e-04 + 1.0948911809814791e-03 -2.2103645726107590e-03 -1.6793645993803805e-06 -3.0400368372972774e-04 6.2768581445658649e-04 -1.0592218066644676e-03 + 1.0000000000000009e+00 -3.6706968215316873e-07 -4.8303262969576617e-05 -4.0292122696672491e-04 1.0000000000000009e+00 1.6143819247334398e-05 + 1.0000000000000009e+00 5.4467633912781861e-04 -2.0685425798975678e-04 -1.8964071542190127e-03 3.8284637430121013e-03 2.9087448105593724e-06 + 5.2654982590798855e-04 -1.0592218066644676e-03 1.8507698048750914e-03 1.0000000000000009e+00 -3.6706968215316916e-07 -4.8303262969576617e-05 + -4.0292122696672546e-04 1.0000000000000009e+00 -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 -1.5697328379591090e-04 + 1.1520833227398834e-07 2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 9.9999999999999356e-01 -4.7362421780844523e-04 + 1.8078662546217335e-04 1.6355367462904196e-03 -3.5949541786793140e-03 2.8651998758388368e-06 4.6452905084814496e-04 9.8800204535450572e-04 + -1.7112697405359742e-03 1.0000000000000042e+00 2.1332483805898328e-08 2.6505923946994974e-06 -2.2852059990080006e-05 1.0000000000000298e+00 + 6.3741505691163069e-05 -2.4440570995631175e-05 -2.1710642755322837e-04 5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 + -1.4095314397314163e-04 2.4413800684805221e-04 1.0000000000000298e+00 2.1332483805898301e-08 2.6505923946995008e-06 -2.2852059990079992e-05 + 1.0000000000000298e+00 2.7406112821062117e-07 3.3854104063170344e-05 -2.9297026341215475e-04 1.0000000000000093e+00 8.1136205810217047e-04 + -3.1070157609534789e-04 -2.7775890319078531e-03 6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 -1.7715609421561978e-03 + 3.0684335605191235e-03 1.0000000000000093e+00 2.7406112821062117e-07 3.3854104063170398e-05 -2.9297026341215497e-04 1.0000000000000093e+00 + -3.1446903101666596e-04 1.1942736153340638e-04 1.0948911809814791e-03 -2.2103645726107590e-03 1.6793645993803805e-06 3.0400368372972774e-04 + 6.2768581445658649e-04 -1.0592218066644676e-03 1.0000000000000009e+00 3.6706968215316873e-07 4.8303262969576617e-05 -4.0292122696672491e-04 + 1.0000000000000009e+00 1.6143819247334398e-05 1.0000000000000009e+00 5.4467633912781861e-04 -2.0685425798975678e-04 -1.8964071542190127e-03 + 3.8284637430121013e-03 -2.9087448105593724e-06 -5.2654982590798855e-04 -1.0592218066644676e-03 1.8507698048750914e-03 1.0000000000000009e+00 + 3.6706968215316916e-07 4.8303262969576617e-05 -4.0292122696672546e-04 1.0000000000000009e+00 -2.2460841302088702e-05 8.5448481792755698e-06 + 7.7919621935008184e-05 -1.5697328379591090e-04 1.1520833227398834e-07 2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 + 9.9999999999999356e-01 -4.7362421780844523e-04 1.8078662546217335e-04 1.6355367462904196e-03 -3.5949541786793140e-03 2.8651998758388368e-06 + 4.6452905084814496e-04 9.8800204535450572e-04 -1.7112697405359742e-03 1.0000000000000042e+00 2.1332483805898328e-08 2.6505923946994974e-06 + -2.2852059990080006e-05 1.0000000000000298e+00 6.3741505691163069e-05 -2.4440570995631175e-05 -2.1710642755322837e-04 5.0874604495665518e-04 + -4.1729375212622274e-07 -6.3935818197024662e-05 -1.4095314397314163e-04 2.4413800684805221e-04 1.0000000000000298e+00 2.1332483805898301e-08 + 2.6505923946995008e-06 -2.2852059990079992e-05 1.0000000000000298e+00 2.7406112821062117e-07 3.3854104063170344e-05 -2.9297026341215475e-04 + 1.0000000000000093e+00 8.1136205810217047e-04 -3.1070157609534789e-04 -2.7775890319078531e-03 6.3964204273636504e-03 -5.2439812005618663e-06 + -8.0825492040994575e-04 -1.7715609421561978e-03 3.0684335605191235e-03 1.0000000000000093e+00 2.7406112821062117e-07 3.3854104063170398e-05 + -2.9297026341215497e-04 1.0000000000000093e+00 -3.1446903101666596e-04 1.1942736153340638e-04 1.0948911809814791e-03 -2.2103645726107590e-03 + 1.6793645993803805e-06 3.0400368372972774e-04 6.2768581445658649e-04 -1.0592218066644676e-03 1.0000000000000009e+00 3.6706968215316873e-07 + 4.8303262969576617e-05 -4.0292122696672491e-04 1.0000000000000009e+00 1.6143819247334398e-05 1.0000000000000009e+00 5.4467633912781861e-04 + -2.0685425798975678e-04 -1.8964071542190127e-03 3.8284637430121013e-03 -2.9087448105593724e-06 -5.2654982590798855e-04 -1.0592218066644676e-03 + 1.8507698048750914e-03 1.0000000000000009e+00 3.6706968215316916e-07 4.8303262969576617e-05 -4.0292122696672546e-04 1.0000000000000009e+00 + # CSR column indices + 0 60 61 63 66 68 71 1 60 61 63 66 68 71 2 60 + 61 63 66 68 71 3 60 61 63 66 68 71 4 62 65 69 + 5 60 61 63 66 68 71 6 64 67 72 7 62 65 69 8 + 60 61 63 66 68 71 9 64 67 72 10 60 61 63 66 68 + 71 11 62 65 69 12 70 13 60 61 63 66 68 71 14 64 + 67 72 15 73 74 76 79 81 84 16 73 74 76 79 81 84 + 17 73 74 76 79 81 84 18 73 74 76 79 81 84 19 75 + 78 82 20 73 74 76 79 81 84 21 77 80 85 22 75 78 + 82 23 73 74 76 79 81 84 24 77 80 85 25 73 74 76 + 79 81 84 26 75 78 82 27 83 28 73 74 76 79 81 84 + 29 77 80 85 30 86 87 89 92 94 97 31 86 87 89 92 + 94 97 32 86 87 89 92 94 97 33 86 87 89 92 94 97 + 34 88 91 95 35 86 87 89 92 94 97 36 90 93 98 37 + 88 91 95 38 86 87 89 92 94 97 39 90 93 98 40 86 + 87 89 92 94 97 41 88 91 95 42 96 43 86 87 89 92 + 94 97 44 90 93 98 45 99 100 102 105 107 110 46 99 100 + 102 105 107 110 47 99 100 102 105 107 110 48 99 100 102 105 + 107 110 49 101 104 108 50 99 100 102 105 107 110 51 103 106 + 111 52 101 104 108 53 99 100 102 105 107 110 54 103 106 111 + 55 99 100 102 105 107 110 56 101 104 108 57 109 58 99 100 + 102 105 107 110 59 103 106 111 0 1 2 3 5 8 10 13 + 60 0 1 2 3 5 8 10 13 61 4 7 11 62 0 1 + 2 3 5 8 10 13 63 6 9 14 64 4 7 11 65 0 + 1 2 3 5 8 10 13 66 6 9 14 67 0 1 2 3 + 5 8 10 13 68 4 7 11 69 12 70 0 1 2 3 5 + 8 10 13 71 6 9 14 72 15 16 17 18 20 23 25 28 + 73 15 16 17 18 20 23 25 28 74 19 22 26 75 15 16 + 17 18 20 23 25 28 76 21 24 29 77 19 22 26 78 15 + 16 17 18 20 23 25 28 79 21 24 29 80 15 16 17 18 + 20 23 25 28 81 19 22 26 82 27 83 15 16 17 18 20 + 23 25 28 84 21 24 29 85 30 31 32 33 35 38 40 43 + 86 30 31 32 33 35 38 40 43 87 34 37 41 88 30 31 + 32 33 35 38 40 43 89 36 39 44 90 34 37 41 91 30 + 31 32 33 35 38 40 43 92 36 39 44 93 30 31 32 33 + 35 38 40 43 94 34 37 41 95 42 96 30 31 32 33 35 + 38 40 43 97 36 39 44 98 45 46 47 48 50 53 55 58 + 99 45 46 47 48 50 53 55 58 100 49 52 56 101 45 46 + 47 48 50 53 55 58 102 51 54 59 103 49 52 56 104 45 + 46 47 48 50 53 55 58 105 51 54 59 106 45 46 47 48 + 50 53 55 58 107 49 52 56 108 57 109 45 46 47 48 50 + 53 55 58 110 51 54 59 111 + # CSR row pointers + 0 7 14 21 28 32 39 43 47 54 58 65 69 71 78 82 + 89 96 103 110 114 121 125 129 136 140 147 151 153 160 164 171 + 178 185 192 196 203 207 211 218 222 229 233 235 242 246 253 260 + 267 274 278 285 289 293 300 304 311 315 317 324 328 337 346 350 + 359 363 367 376 380 389 393 395 404 408 417 426 430 439 443 447 + 456 460 469 473 475 484 488 497 506 510 519 523 527 536 540 549 + 553 555 564 568 577 586 590 599 603 607 616 620 629 633 635 644 + 648 + + 1 0 0 268 + # CSR values + -2.2460841302088702e-05 -4.7362421780844523e-04 -6.3741505691163069e-05 -8.1136205810217047e-04 -3.1446903101666596e-04 5.4467633912781861e-04 + 8.5448481792755698e-06 1.8078662546217335e-04 2.4440570995631175e-05 3.1070157609534789e-04 1.1942736153340638e-04 -2.0685425798975678e-04 + 7.7919621935008184e-05 1.6355367462904196e-03 2.1710642755322837e-04 2.7775890319078531e-03 1.0948911809814791e-03 -1.8964071542190127e-03 + -1.5697328379591090e-04 -3.5949541786793140e-03 -5.0874604495665518e-04 -6.3964204273636504e-03 -2.2103645726107590e-03 3.8284637430121013e-03 + 2.1332483805898328e-08 2.7406112821062117e-07 -3.6706968215316873e-07 -1.1520833227398834e-07 -2.8651998758388368e-06 -4.1729375212622274e-07 + -5.2439812005618663e-06 -1.6793645993803805e-06 2.9087448105593724e-06 2.1332483805898301e-08 2.7406112821062117e-07 -3.6706968215316916e-07 + 2.6505923946994974e-06 3.3854104063170344e-05 -4.8303262969576617e-05 -2.1715407787562440e-05 -4.6452905084814496e-04 -6.3935818197024662e-05 + -8.0825492040994575e-04 -3.0400368372972774e-04 5.2654982590798855e-04 2.6505923946995008e-06 3.3854104063170398e-05 -4.8303262969576617e-05 + 4.2575567100665728e-05 9.8800204535450572e-04 1.4095314397314163e-04 1.7715609421561978e-03 6.2768581445658649e-04 -1.0592218066644676e-03 + 2.2852059990080006e-05 2.9297026341215475e-04 -4.0292122696672491e-04 1.6143819247334398e-05 -7.3743045379410992e-05 -1.7112697405359742e-03 + -2.4413800684805221e-04 -3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 2.2852059990079992e-05 2.9297026341215497e-04 + -4.0292122696672546e-04 -2.2460841302088702e-05 -4.7362421780844523e-04 -6.3741505691163069e-05 -8.1136205810217047e-04 -3.1446903101666596e-04 + 5.4467633912781861e-04 8.5448481792755698e-06 1.8078662546217335e-04 2.4440570995631175e-05 3.1070157609534789e-04 1.1942736153340638e-04 + -2.0685425798975678e-04 7.7919621935008184e-05 1.6355367462904196e-03 2.1710642755322837e-04 2.7775890319078531e-03 1.0948911809814791e-03 + -1.8964071542190127e-03 -1.5697328379591090e-04 -3.5949541786793140e-03 -5.0874604495665518e-04 -6.3964204273636504e-03 -2.2103645726107590e-03 + 3.8284637430121013e-03 2.1332483805898328e-08 2.7406112821062117e-07 -3.6706968215316873e-07 -1.1520833227398834e-07 -2.8651998758388368e-06 + -4.1729375212622274e-07 -5.2439812005618663e-06 -1.6793645993803805e-06 2.9087448105593724e-06 2.1332483805898301e-08 2.7406112821062117e-07 + -3.6706968215316916e-07 2.6505923946994974e-06 3.3854104063170344e-05 -4.8303262969576617e-05 -2.1715407787562440e-05 -4.6452905084814496e-04 + -6.3935818197024662e-05 -8.0825492040994575e-04 -3.0400368372972774e-04 5.2654982590798855e-04 2.6505923946995008e-06 3.3854104063170398e-05 + -4.8303262969576617e-05 4.2575567100665728e-05 9.8800204535450572e-04 1.4095314397314163e-04 1.7715609421561978e-03 6.2768581445658649e-04 + -1.0592218066644676e-03 2.2852059990080006e-05 2.9297026341215475e-04 -4.0292122696672491e-04 1.6143819247334398e-05 -7.3743045379410992e-05 + -1.7112697405359742e-03 -2.4413800684805221e-04 -3.0684335605191235e-03 -1.0592218066644676e-03 1.8507698048750914e-03 2.2852059990079992e-05 + 2.9297026341215497e-04 -4.0292122696672546e-04 -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 -1.5697328379591090e-04 + 1.1520833227398834e-07 2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 -4.7362421780844523e-04 1.8078662546217335e-04 + 1.6355367462904196e-03 -3.5949541786793140e-03 2.8651998758388368e-06 4.6452905084814496e-04 9.8800204535450572e-04 -1.7112697405359742e-03 + 2.1332483805898328e-08 2.6505923946994974e-06 -2.2852059990080006e-05 6.3741505691163069e-05 -2.4440570995631175e-05 -2.1710642755322837e-04 + 5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 -1.4095314397314163e-04 2.4413800684805221e-04 2.1332483805898301e-08 + 2.6505923946995008e-06 -2.2852059990079992e-05 2.7406112821062117e-07 3.3854104063170344e-05 -2.9297026341215475e-04 8.1136205810217047e-04 + -3.1070157609534789e-04 -2.7775890319078531e-03 6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 -1.7715609421561978e-03 + 3.0684335605191235e-03 2.7406112821062117e-07 3.3854104063170398e-05 -2.9297026341215497e-04 -3.1446903101666596e-04 1.1942736153340638e-04 + 1.0948911809814791e-03 -2.2103645726107590e-03 1.6793645993803805e-06 3.0400368372972774e-04 6.2768581445658649e-04 -1.0592218066644676e-03 + 3.6706968215316873e-07 4.8303262969576617e-05 -4.0292122696672491e-04 1.6143819247334398e-05 5.4467633912781861e-04 -2.0685425798975678e-04 + -1.8964071542190127e-03 3.8284637430121013e-03 -2.9087448105593724e-06 -5.2654982590798855e-04 -1.0592218066644676e-03 1.8507698048750914e-03 + 3.6706968215316916e-07 4.8303262969576617e-05 -4.0292122696672546e-04 -2.2460841302088702e-05 8.5448481792755698e-06 7.7919621935008184e-05 + -1.5697328379591090e-04 1.1520833227398834e-07 2.1715407787562440e-05 4.2575567100665728e-05 -7.3743045379410992e-05 -4.7362421780844523e-04 + 1.8078662546217335e-04 1.6355367462904196e-03 -3.5949541786793140e-03 2.8651998758388368e-06 4.6452905084814496e-04 9.8800204535450572e-04 + -1.7112697405359742e-03 2.1332483805898328e-08 2.6505923946994974e-06 -2.2852059990080006e-05 6.3741505691163069e-05 -2.4440570995631175e-05 + -2.1710642755322837e-04 5.0874604495665518e-04 -4.1729375212622274e-07 -6.3935818197024662e-05 -1.4095314397314163e-04 2.4413800684805221e-04 + 2.1332483805898301e-08 2.6505923946995008e-06 -2.2852059990079992e-05 2.7406112821062117e-07 3.3854104063170344e-05 -2.9297026341215475e-04 + 8.1136205810217047e-04 -3.1070157609534789e-04 -2.7775890319078531e-03 6.3964204273636504e-03 -5.2439812005618663e-06 -8.0825492040994575e-04 + -1.7715609421561978e-03 3.0684335605191235e-03 2.7406112821062117e-07 3.3854104063170398e-05 -2.9297026341215497e-04 -3.1446903101666596e-04 + 1.1942736153340638e-04 1.0948911809814791e-03 -2.2103645726107590e-03 1.6793645993803805e-06 3.0400368372972774e-04 6.2768581445658649e-04 + -1.0592218066644676e-03 3.6706968215316873e-07 4.8303262969576617e-05 -4.0292122696672491e-04 1.6143819247334398e-05 5.4467633912781861e-04 + -2.0685425798975678e-04 -1.8964071542190127e-03 3.8284637430121013e-03 -2.9087448105593724e-06 -5.2654982590798855e-04 -1.0592218066644676e-03 + 1.8507698048750914e-03 3.6706968215316916e-07 4.8303262969576617e-05 -4.0292122696672546e-04 + # CSR column indices + 86 87 89 92 94 97 86 87 89 92 94 97 86 87 89 92 + 94 97 86 87 89 92 94 97 88 91 95 86 87 89 92 94 + 97 90 93 98 88 91 95 86 87 89 92 94 97 90 93 98 + 86 87 89 92 94 97 88 91 95 96 86 87 89 92 94 97 + 90 93 98 99 100 102 105 107 110 99 100 102 105 107 110 99 + 100 102 105 107 110 99 100 102 105 107 110 101 104 108 99 100 + 102 105 107 110 103 106 111 101 104 108 99 100 102 105 107 110 + 103 106 111 99 100 102 105 107 110 101 104 108 109 99 100 102 + 105 107 110 103 106 111 0 1 2 3 5 8 10 13 0 1 + 2 3 5 8 10 13 4 7 11 0 1 2 3 5 8 10 + 13 6 9 14 4 7 11 0 1 2 3 5 8 10 13 6 + 9 14 0 1 2 3 5 8 10 13 4 7 11 12 0 1 + 2 3 5 8 10 13 6 9 14 15 16 17 18 20 23 25 + 28 15 16 17 18 20 23 25 28 19 22 26 15 16 17 18 + 20 23 25 28 21 24 29 19 22 26 15 16 17 18 20 23 + 25 28 21 24 29 15 16 17 18 20 23 25 28 19 22 26 + 27 15 16 17 18 20 23 25 28 21 24 29 + # CSR row pointers + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 + 12 18 24 27 33 36 39 45 48 54 57 58 64 67 73 79 + 85 91 94 100 103 106 112 115 121 124 125 131 134 142 150 153 + 161 164 167 175 178 186 189 190 198 201 209 217 220 228 231 234 + 242 245 253 256 257 265 268 268 268 268 268 268 268 268 268 268 + 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 268 + 268 + diff --git a/tests/03_NAO_multik/md_out_syns/syns_nao.csr.ref b/tests/03_NAO_multik/md_out_syns/syns_nao.csr.ref index 21883d3576b..9627e3288b4 100644 --- a/tests/03_NAO_multik/md_out_syns/syns_nao.csr.ref +++ b/tests/03_NAO_multik/md_out_syns/syns_nao.csr.ref @@ -1,4 +1,4 @@ -IONIC_STEP: 1 +Ionic_Step 1 Matrix Dimension of S_async(R): 6 Matrix number of S_async(R): 9 #----------------------------------------------------------------------# @@ -123,7 +123,7 @@ Matrix number of S_async(R): 9 # CSR row pointers 0 1 7 12 16 21 25 -IONIC_STEP: 2 +Ionic_Step 2 Matrix Dimension of S_async(R): 6 Matrix number of S_async(R): 9 #----------------------------------------------------------------------# diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/hrs1_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/hrs1_nao.csr.ref index 8d5c9482265..05b8661476f 100644 --- a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 1 # number of spin directions 1 # spin index, E_Fermi = -4.67919 eV diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rr_nao.txt.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rr_nao.txt.ref deleted file mode 100644 index 42b80ea265e..00000000000 --- a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rr_nao.txt.ref +++ /dev/null @@ -1,120 +0,0 @@ -STEP: 1 -Matrix Dimension of r(R): 6 -Matrix number of r(R): 9 --1 0 0 -11 - -5.43552341e-04 -2.14731701e-03 5.13334748e-03 2.36038253e-03 5.43552342e-04 2.14731702e-03 1.79616113e-07 5.13334747e-03 1.79560896e-07 1.45071058e-10 2.36038252e-03 - 0 2 4 5 1 1 4 1 2 4 1 - 0 4 5 7 7 10 11 -19 - 1.58884531e-03 4.93236124e-02 8.13880860e-03 -2.24476205e-02 -9.47166611e-03 5.01740623e-04 5.02323298e-03 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 3.09795889e-05 1.42682240e-02 1.85816916e-04 -7.04773064e-04 -3.09795853e-05 3.42849544e-03 -8.45188028e-06 3.09795924e-05 3.09795889e-05 - 0 1 2 4 5 1 1 2 4 5 3 1 2 4 5 1 2 4 5 - 0 5 6 10 11 15 19 -21 - 1.04529296e-03 4.93236124e-02 6.58102078e-03 1.58466432e-03 -1.83579222e-02 -6.45008077e-03 1.04529296e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 -1.85816916e-04 1.58466432e-03 8.45188028e-06 3.09795889e-05 -3.09795924e-05 1.83579222e-02 1.85816916e-04 3.09795853e-05 -7.04773064e-04 6.45008077e-03 3.09795889e-05 - 0 1 2 3 4 5 1 1 2 3 4 1 2 3 4 1 2 3 4 1 5 - 0 6 7 11 15 19 21 --1 1 0 -6 - -2.30929072e-05 5.66904761e-05 -6.89495935e-05 2.30929045e-05 5.66904904e-05 -6.89496082e-05 - 2 4 5 1 1 1 - 0 3 3 4 4 5 6 -7 - 1.35380198e-01 2.01086871e-04 -5.50285894e-04 5.38026777e-04 1.54901059e-04 4.12386692e-04 -4.24645810e-04 - 1 2 4 5 1 1 1 - 0 4 4 5 5 6 7 -9 - 6.76900992e-02 8.89969817e-05 1.22591174e-05 -2.40668150e-04 2.40668150e-04 8.89969817e-05 1.22591178e-05 2.40668150e-04 -2.40668150e-04 - 1 2 3 4 5 1 1 1 1 - 0 5 5 6 7 8 9 -0 -1 0 -19 - 5.01740623e-04 4.93236124e-02 1.58884531e-03 8.13880860e-03 -9.47166611e-03 -2.24476205e-02 5.02323298e-03 4.91684927e-05 -8.45188036e-06 -1.85816916e-04 3.09795889e-05 3.42849544e-03 -8.45188028e-06 3.09795889e-05 3.09795924e-05 1.42682240e-02 1.85816916e-04 -3.09795853e-05 -7.04773064e-04 - 0 0 1 2 4 5 0 2 4 5 3 0 2 4 5 0 2 4 5 - 0 1 6 10 11 15 19 -11 - 5.43552342e-04 -5.43552341e-04 -2.14731701e-03 2.36038253e-03 5.13334748e-03 2.14731702e-03 1.79616113e-07 2.36038252e-03 5.13334747e-03 1.79560896e-07 1.45071058e-10 - 0 1 2 4 5 0 5 0 0 2 5 - 0 1 5 7 7 8 11 -21 - 1.04529296e-03 4.93236124e-02 1.04529296e-03 6.58102078e-03 1.58466432e-03 -6.45008077e-03 -1.83579222e-02 6.58102078e-03 4.91684927e-05 8.45188036e-06 -1.85816916e-04 1.58466432e-03 8.45188028e-06 3.09795889e-05 -3.09795924e-05 6.45008077e-03 3.09795889e-05 1.83579222e-02 1.85816916e-04 3.09795853e-05 -7.04773064e-04 - 0 0 1 2 3 4 5 0 2 3 5 0 2 3 5 0 4 0 2 3 5 - 0 1 7 11 15 17 21 -0 0 -1 -28 - 5.01740623e-04 4.22018249e-05 1.53773647e-04 3.31275705e-05 -3.99811481e-05 1.58884531e-03 7.19459941e-05 2.57540405e-04 -7.38140829e-05 6.69605053e-05 4.22018258e-05 7.19459932e-05 4.91684927e-05 1.85816916e-04 -8.45188036e-06 -1.53773635e-04 -2.57540417e-04 -1.85816916e-04 -7.04773064e-04 3.09795853e-05 3.31275679e-05 -7.38140855e-05 -8.45188028e-06 -3.09795924e-05 3.09795889e-05 -3.99811451e-05 6.69605083e-05 3.09795889e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 5 - 0 5 10 15 20 25 28 -28 - 1.58884531e-03 7.19459941e-05 2.57540405e-04 6.69605053e-05 -7.38140829e-05 5.01740623e-04 4.22018249e-05 1.53773647e-04 -3.99811481e-05 3.31275705e-05 7.19459932e-05 4.22018258e-05 4.91684927e-05 1.85816916e-04 -8.45188036e-06 -2.57540417e-04 -1.53773635e-04 -1.85816916e-04 -7.04773064e-04 3.09795853e-05 6.69605083e-05 -3.99811451e-05 3.09795889e-05 -7.38140855e-05 3.31275679e-05 -8.45188028e-06 -3.09795924e-05 3.09795889e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 5 0 1 2 3 5 0 1 4 0 1 2 3 5 - 0 5 10 15 20 23 28 -19 - 1.26415805e-07 7.48010104e-07 -1.58744756e-06 1.58744756e-06 1.26415805e-07 7.48010104e-07 1.58744756e-06 -1.58744756e-06 -1.26412514e-07 -1.26412514e-07 -1.79616113e-07 7.48054497e-07 7.48054497e-07 -1.79560896e-07 1.45071058e-10 1.58743591e-06 -1.58743591e-06 -1.58743591e-06 1.58743591e-06 - 2 3 4 5 2 3 4 5 0 1 3 0 1 2 3 0 1 0 1 - 0 4 8 11 15 17 19 -0 0 0 -22 - 2.39999844e+00 3.61072918e-02 5.14825231e-01 3.16934655e-01 -4.39642574e-01 3.61072918e-02 7.59999506e+00 7.58083685e-01 -8.39927211e-01 7.17219292e-01 5.14825231e-01 7.58083685e-01 4.99999975e+00 -6.81742634e-01 4.99999930e+00 3.16934655e-01 -8.39927211e-01 -6.81742631e-01 4.99999930e+00 -4.39642574e-01 7.17219292e-01 4.99999930e+00 - 0 1 2 4 5 0 1 2 4 5 0 1 2 4 3 0 1 2 4 0 1 5 - 0 5 10 14 15 19 22 -22 - 7.59999506e+00 3.61072918e-02 7.58083685e-01 7.17219292e-01 -8.39927211e-01 3.61072918e-02 2.39999844e+00 5.14825231e-01 -4.39642574e-01 3.16934655e-01 7.58083685e-01 5.14825231e-01 4.99999975e+00 -6.81742634e-01 4.99999930e+00 7.17219292e-01 -4.39642574e-01 4.99999930e+00 -8.39927211e-01 3.16934655e-01 -6.81742631e-01 4.99999930e+00 - 0 1 2 4 5 0 1 2 4 5 0 1 2 5 3 0 1 4 0 1 2 5 - 0 5 10 14 15 18 22 -26 - 4.99999675e+00 3.61072918e-02 6.36454458e-01 1.22707920e-01 5.78430933e-01 -5.78430933e-01 3.61072918e-02 4.99999675e+00 6.36454458e-01 1.22707920e-01 -5.78430933e-01 5.78430933e-01 6.36454458e-01 6.36454458e-01 4.99999975e+00 6.81742634e-01 1.22707920e-01 1.22707920e-01 6.81742631e-01 4.99999930e+00 5.78430933e-01 -5.78430933e-01 4.99999930e+00 -5.78430933e-01 5.78430933e-01 4.99999930e+00 - 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 0 1 2 3 0 1 4 0 1 5 - 0 6 12 16 20 23 26 -0 0 1 -28 - 5.01740623e-04 4.22018249e-05 -1.53773647e-04 3.31275705e-05 -3.99811481e-05 1.58884531e-03 7.19459941e-05 -2.57540405e-04 -7.38140829e-05 6.69605053e-05 4.22018258e-05 7.19459932e-05 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 1.53773635e-04 2.57540417e-04 1.85816916e-04 -7.04773064e-04 -3.09795853e-05 3.31275679e-05 -7.38140855e-05 -8.45188028e-06 3.09795924e-05 3.09795889e-05 -3.99811451e-05 6.69605083e-05 3.09795889e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 4 0 1 2 3 4 0 1 2 3 4 0 1 5 - 0 5 10 15 20 25 28 -28 - 1.58884531e-03 7.19459941e-05 -2.57540405e-04 6.69605053e-05 -7.38140829e-05 5.01740623e-04 4.22018249e-05 -1.53773647e-04 -3.99811481e-05 3.31275705e-05 7.19459932e-05 4.22018258e-05 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 2.57540417e-04 1.53773635e-04 1.85816916e-04 -7.04773064e-04 -3.09795853e-05 6.69605083e-05 -3.99811451e-05 3.09795889e-05 -7.38140855e-05 3.31275679e-05 -8.45188028e-06 3.09795924e-05 3.09795889e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 5 0 1 2 3 5 0 1 4 0 1 2 3 5 - 0 5 10 15 20 23 28 -24 - 2.09058593e-03 1.14021403e-04 -4.10566041e-04 1.08529101e-04 -1.08529101e-04 2.09058593e-03 1.14021403e-04 -4.10566041e-04 -1.08529101e-04 1.08529101e-04 1.14274232e-04 1.14274232e-04 9.83369851e-05 -3.71813448e-04 4.12062106e-04 4.12062106e-04 3.71454271e-04 -1.40954627e-03 1.05354217e-04 -1.05354217e-04 6.19591742e-05 -1.05354217e-04 1.05354217e-04 6.19591742e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 2 3 0 1 4 0 1 5 - 0 5 10 14 18 21 24 -0 1 0 -19 - 5.01740623e-04 4.93236124e-02 5.02323297e-03 3.42849544e-03 1.42682240e-02 1.58884531e-03 8.13880859e-03 4.91684927e-05 -8.45188036e-06 1.85816916e-04 3.09795889e-05 -9.47166611e-03 -8.45188028e-06 3.09795889e-05 -3.09795924e-05 -2.24476205e-02 -1.85816916e-04 3.09795853e-05 -7.04773064e-04 - 0 1 2 4 5 1 1 2 4 5 3 1 2 4 5 1 2 4 5 - 0 5 6 10 11 15 19 -15 - 2.63413827e-03 9.86472249e-02 1.53093586e-02 1.52605441e-02 4.18491919e-02 1.54703359e-03 1.10147246e-02 9.83369851e-05 3.71813448e-04 6.19591742e-05 -1.05397790e-02 6.19591742e-05 -3.15824969e-02 -3.71454271e-04 -1.40954627e-03 - 0 1 2 4 5 1 1 2 5 3 1 4 1 2 5 - 0 5 6 9 10 12 15 -21 - 1.04529296e-03 4.93236124e-02 6.58102078e-03 1.58466432e-03 6.45008077e-03 1.83579222e-02 1.04529296e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 1.85816916e-04 1.58466432e-03 8.45188028e-06 3.09795889e-05 3.09795924e-05 -6.45008077e-03 3.09795889e-05 -1.83579222e-02 -1.85816916e-04 -3.09795853e-05 -7.04773064e-04 - 0 1 2 3 4 5 1 1 2 3 5 1 2 3 5 1 4 1 2 3 5 - 0 6 7 11 15 17 21 -1 -1 0 -7 - 1.35380198e-01 2.01086871e-04 5.38026777e-04 -5.50285894e-04 1.54901059e-04 -4.24645810e-04 4.12386692e-04 - 0 2 4 5 0 0 0 - 0 0 4 5 5 6 7 -6 - -2.30929072e-05 -6.89495935e-05 5.66904761e-05 2.30929045e-05 -6.89496082e-05 5.66904904e-05 - 2 4 5 0 0 0 - 0 0 3 4 4 5 6 -9 - 6.76900992e-02 8.89969817e-05 1.22591174e-05 2.40668150e-04 -2.40668150e-04 8.89969817e-05 1.22591178e-05 -2.40668150e-04 2.40668150e-04 - 0 2 3 4 5 0 0 0 0 - 0 0 5 6 7 8 9 -1 0 0 -15 - 1.54703359e-03 9.86472249e-02 2.63413827e-03 1.53093586e-02 4.18491919e-02 1.52605441e-02 1.10147246e-02 9.83369851e-05 3.71813448e-04 6.19591742e-05 -3.15824969e-02 -3.71454271e-04 -1.40954627e-03 -1.05397790e-02 6.19591742e-05 - 0 0 1 2 4 5 0 2 4 3 0 2 4 0 5 - 0 1 6 9 10 13 15 -19 - 1.58884531e-03 4.93236124e-02 5.01740623e-04 5.02323297e-03 1.42682240e-02 3.42849544e-03 8.13880859e-03 4.91684927e-05 1.85816916e-04 -8.45188036e-06 3.09795889e-05 -2.24476205e-02 -1.85816916e-04 -7.04773064e-04 3.09795853e-05 -9.47166611e-03 -8.45188028e-06 -3.09795924e-05 3.09795889e-05 - 0 0 1 2 4 5 0 2 4 5 3 0 2 4 5 0 2 4 5 - 0 1 6 10 11 15 19 -21 - 1.04529296e-03 4.93236124e-02 1.04529296e-03 6.58102078e-03 1.58466432e-03 1.83579222e-02 6.45008077e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 1.85816916e-04 1.58466432e-03 8.45188028e-06 3.09795889e-05 3.09795924e-05 -1.83579222e-02 -1.85816916e-04 -3.09795853e-05 -7.04773064e-04 -6.45008077e-03 3.09795889e-05 - 0 0 1 2 3 4 5 0 2 3 4 0 2 3 4 0 2 3 4 0 5 - 0 1 7 11 15 19 21 diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrx_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrx_nao.csr.ref new file mode 100644 index 00000000000..87ecbfa7f8b --- /dev/null +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrx_nao.csr.ref @@ -0,0 +1,126 @@ +Ionic_Step 1 + # print r matrix in real space r(R) x-component + 1 # number of spin directions + 1 # spin index + 6 # number of localized basis + 9 # number of Bravais lattice vector R + + user_defined_lattice + 5.29177 + 1 0 0 + 0 1 0 + 0 0 1 + H O + 2 1 + Direct + 0.239999999999782 0.760000000000218 0.5 + 0.760000000000218 0.239999999999782 0.5 + 0.5 0.5 0.5 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 11 + # CSR values + -5.43552341e-04 -2.14731701e-03 5.13334748e-03 2.36038253e-03 5.43552342e-04 2.14731702e-03 + 1.79616113e-07 5.13334747e-03 1.79560896e-07 1.45071058e-10 2.36038252e-03 + # CSR column indices + 0 2 4 5 1 1 4 1 2 4 1 + # CSR row pointers + 0 4 5 7 7 10 11 + +-1 1 0 6 + # CSR values + -2.30929072e-05 5.66904761e-05 -6.89495935e-05 2.30929045e-05 5.66904904e-05 -6.89496082e-05 + # CSR column indices + 2 4 5 1 1 1 + # CSR row pointers + 0 3 3 4 4 5 6 + +0 -1 0 19 + # CSR values + 5.01740623e-04 4.93236124e-02 1.58884531e-03 8.13880860e-03 -9.47166611e-03 -2.24476205e-02 + 5.02323298e-03 4.91684927e-05 -8.45188036e-06 -1.85816916e-04 3.09795889e-05 3.42849544e-03 + -8.45188028e-06 3.09795889e-05 3.09795924e-05 1.42682240e-02 1.85816916e-04 -3.09795853e-05 + -7.04773064e-04 + # CSR column indices + 0 0 1 2 4 5 0 2 4 5 3 0 2 4 5 0 + 2 4 5 + # CSR row pointers + 0 1 6 10 11 15 19 + +0 0 -1 28 + # CSR values + 5.01740623e-04 4.22018249e-05 1.53773647e-04 3.31275705e-05 -3.99811481e-05 1.58884531e-03 + 7.19459941e-05 2.57540405e-04 -7.38140829e-05 6.69605053e-05 4.22018258e-05 7.19459932e-05 + 4.91684927e-05 1.85816916e-04 -8.45188036e-06 -1.53773635e-04 -2.57540417e-04 -1.85816916e-04 + -7.04773064e-04 3.09795853e-05 3.31275679e-05 -7.38140855e-05 -8.45188028e-06 -3.09795924e-05 + 3.09795889e-05 -3.99811451e-05 6.69605083e-05 3.09795889e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 4 0 + 1 2 3 4 0 1 2 3 4 0 1 5 + # CSR row pointers + 0 5 10 15 20 25 28 + +0 0 0 22 + # CSR values + 2.39999844e+00 3.61072918e-02 5.14825231e-01 3.16934655e-01 -4.39642574e-01 3.61072918e-02 + 7.59999506e+00 7.58083685e-01 -8.39927211e-01 7.17219292e-01 5.14825231e-01 7.58083685e-01 + 4.99999975e+00 -6.81742634e-01 4.99999930e+00 3.16934655e-01 -8.39927211e-01 -6.81742631e-01 + 4.99999930e+00 -4.39642574e-01 7.17219292e-01 4.99999930e+00 + # CSR column indices + 0 1 2 4 5 0 1 2 4 5 0 1 2 4 3 0 + 1 2 4 0 1 5 + # CSR row pointers + 0 5 10 14 15 19 22 + +0 0 1 28 + # CSR values + 5.01740623e-04 4.22018249e-05 -1.53773647e-04 3.31275705e-05 -3.99811481e-05 1.58884531e-03 + 7.19459941e-05 -2.57540405e-04 -7.38140829e-05 6.69605053e-05 4.22018258e-05 7.19459932e-05 + 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 1.53773635e-04 2.57540417e-04 1.85816916e-04 + -7.04773064e-04 -3.09795853e-05 3.31275679e-05 -7.38140855e-05 -8.45188028e-06 3.09795924e-05 + 3.09795889e-05 -3.99811451e-05 6.69605083e-05 3.09795889e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 4 0 + 1 2 3 4 0 1 2 3 4 0 1 5 + # CSR row pointers + 0 5 10 15 20 25 28 + +0 1 0 19 + # CSR values + 5.01740623e-04 4.93236124e-02 5.02323297e-03 3.42849544e-03 1.42682240e-02 1.58884531e-03 + 8.13880859e-03 4.91684927e-05 -8.45188036e-06 1.85816916e-04 3.09795889e-05 -9.47166611e-03 + -8.45188028e-06 3.09795889e-05 -3.09795924e-05 -2.24476205e-02 -1.85816916e-04 3.09795853e-05 + -7.04773064e-04 + # CSR column indices + 0 1 2 4 5 1 1 2 4 5 3 1 2 4 5 1 + 2 4 5 + # CSR row pointers + 0 5 6 10 11 15 19 + +1 -1 0 7 + # CSR values + 1.35380198e-01 2.01086871e-04 5.38026777e-04 -5.50285894e-04 1.54901059e-04 -4.24645810e-04 + 4.12386692e-04 + # CSR column indices + 0 2 4 5 0 0 0 + # CSR row pointers + 0 0 4 5 5 6 7 + +1 0 0 15 + # CSR values + 1.54703359e-03 9.86472249e-02 2.63413827e-03 1.53093586e-02 4.18491919e-02 1.52605441e-02 + 1.10147246e-02 9.83369851e-05 3.71813448e-04 6.19591742e-05 -3.15824969e-02 -3.71454271e-04 + -1.40954627e-03 -1.05397790e-02 6.19591742e-05 + # CSR column indices + 0 0 1 2 4 5 0 2 4 3 0 2 4 0 5 + # CSR row pointers + 0 1 6 9 10 13 15 + diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rry_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rry_nao.csr.ref new file mode 100644 index 00000000000..53827688b27 --- /dev/null +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rry_nao.csr.ref @@ -0,0 +1,126 @@ +Ionic_Step 1 + # print r matrix in real space r(R) y-component + 1 # number of spin directions + 1 # spin index + 6 # number of localized basis + 9 # number of Bravais lattice vector R + + user_defined_lattice + 5.29177 + 1 0 0 + 0 1 0 + 0 0 1 + H O + 2 1 + Direct + 0.239999999999782 0.760000000000218 0.5 + 0.760000000000218 0.239999999999782 0.5 + 0.5 0.5 0.5 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 19 + # CSR values + 1.58884531e-03 4.93236124e-02 8.13880860e-03 -2.24476205e-02 -9.47166611e-03 5.01740623e-04 + 5.02323298e-03 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 3.09795889e-05 1.42682240e-02 + 1.85816916e-04 -7.04773064e-04 -3.09795853e-05 3.42849544e-03 -8.45188028e-06 3.09795924e-05 + 3.09795889e-05 + # CSR column indices + 0 1 2 4 5 1 1 2 4 5 3 1 2 4 5 1 + 2 4 5 + # CSR row pointers + 0 5 6 10 11 15 19 + +-1 1 0 7 + # CSR values + 1.35380198e-01 2.01086871e-04 -5.50285894e-04 5.38026777e-04 1.54901059e-04 4.12386692e-04 + -4.24645810e-04 + # CSR column indices + 1 2 4 5 1 1 1 + # CSR row pointers + 0 4 4 5 5 6 7 + +0 -1 0 11 + # CSR values + 5.43552342e-04 -5.43552341e-04 -2.14731701e-03 2.36038253e-03 5.13334748e-03 2.14731702e-03 + 1.79616113e-07 2.36038252e-03 5.13334747e-03 1.79560896e-07 1.45071058e-10 + # CSR column indices + 0 1 2 4 5 0 5 0 0 2 5 + # CSR row pointers + 0 1 5 7 7 8 11 + +0 0 -1 28 + # CSR values + 1.58884531e-03 7.19459941e-05 2.57540405e-04 6.69605053e-05 -7.38140829e-05 5.01740623e-04 + 4.22018249e-05 1.53773647e-04 -3.99811481e-05 3.31275705e-05 7.19459932e-05 4.22018258e-05 + 4.91684927e-05 1.85816916e-04 -8.45188036e-06 -2.57540417e-04 -1.53773635e-04 -1.85816916e-04 + -7.04773064e-04 3.09795853e-05 6.69605083e-05 -3.99811451e-05 3.09795889e-05 -7.38140855e-05 + 3.31275679e-05 -8.45188028e-06 -3.09795924e-05 3.09795889e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 5 0 + 1 2 3 5 0 1 4 0 1 2 3 5 + # CSR row pointers + 0 5 10 15 20 23 28 + +0 0 0 22 + # CSR values + 7.59999506e+00 3.61072918e-02 7.58083685e-01 7.17219292e-01 -8.39927211e-01 3.61072918e-02 + 2.39999844e+00 5.14825231e-01 -4.39642574e-01 3.16934655e-01 7.58083685e-01 5.14825231e-01 + 4.99999975e+00 -6.81742634e-01 4.99999930e+00 7.17219292e-01 -4.39642574e-01 4.99999930e+00 + -8.39927211e-01 3.16934655e-01 -6.81742631e-01 4.99999930e+00 + # CSR column indices + 0 1 2 4 5 0 1 2 4 5 0 1 2 5 3 0 + 1 4 0 1 2 5 + # CSR row pointers + 0 5 10 14 15 18 22 + +0 0 1 28 + # CSR values + 1.58884531e-03 7.19459941e-05 -2.57540405e-04 6.69605053e-05 -7.38140829e-05 5.01740623e-04 + 4.22018249e-05 -1.53773647e-04 -3.99811481e-05 3.31275705e-05 7.19459932e-05 4.22018258e-05 + 4.91684927e-05 -1.85816916e-04 -8.45188036e-06 2.57540417e-04 1.53773635e-04 1.85816916e-04 + -7.04773064e-04 -3.09795853e-05 6.69605083e-05 -3.99811451e-05 3.09795889e-05 -7.38140855e-05 + 3.31275679e-05 -8.45188028e-06 3.09795924e-05 3.09795889e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 5 0 + 1 2 3 5 0 1 4 0 1 2 3 5 + # CSR row pointers + 0 5 10 15 20 23 28 + +0 1 0 15 + # CSR values + 2.63413827e-03 9.86472249e-02 1.53093586e-02 1.52605441e-02 4.18491919e-02 1.54703359e-03 + 1.10147246e-02 9.83369851e-05 3.71813448e-04 6.19591742e-05 -1.05397790e-02 6.19591742e-05 + -3.15824969e-02 -3.71454271e-04 -1.40954627e-03 + # CSR column indices + 0 1 2 4 5 1 1 2 5 3 1 4 1 2 5 + # CSR row pointers + 0 5 6 9 10 12 15 + +1 -1 0 6 + # CSR values + -2.30929072e-05 -6.89495935e-05 5.66904761e-05 2.30929045e-05 -6.89496082e-05 5.66904904e-05 + # CSR column indices + 2 4 5 0 0 0 + # CSR row pointers + 0 0 3 4 4 5 6 + +1 0 0 19 + # CSR values + 1.58884531e-03 4.93236124e-02 5.01740623e-04 5.02323297e-03 1.42682240e-02 3.42849544e-03 + 8.13880859e-03 4.91684927e-05 1.85816916e-04 -8.45188036e-06 3.09795889e-05 -2.24476205e-02 + -1.85816916e-04 -7.04773064e-04 3.09795853e-05 -9.47166611e-03 -8.45188028e-06 -3.09795924e-05 + 3.09795889e-05 + # CSR column indices + 0 0 1 2 4 5 0 2 4 5 3 0 2 4 5 0 + 2 4 5 + # CSR row pointers + 0 1 6 10 11 15 19 + diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrz_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrz_nao.csr.ref new file mode 100644 index 00000000000..46e6f804aa9 --- /dev/null +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/rrz_nao.csr.ref @@ -0,0 +1,131 @@ +Ionic_Step 1 + # print r matrix in real space r(R) z-component + 1 # number of spin directions + 1 # spin index + 6 # number of localized basis + 9 # number of Bravais lattice vector R + + user_defined_lattice + 5.29177 + 1 0 0 + 0 1 0 + 0 0 1 + H O + 2 1 + Direct + 0.239999999999782 0.760000000000218 0.5 + 0.760000000000218 0.239999999999782 0.5 + 0.5 0.5 0.5 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 21 + # CSR values + 1.04529296e-03 4.93236124e-02 6.58102078e-03 1.58466432e-03 -1.83579222e-02 -6.45008077e-03 + 1.04529296e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 -1.85816916e-04 1.58466432e-03 + 8.45188028e-06 3.09795889e-05 -3.09795924e-05 1.83579222e-02 1.85816916e-04 3.09795853e-05 + -7.04773064e-04 6.45008077e-03 3.09795889e-05 + # CSR column indices + 0 1 2 3 4 5 1 1 2 3 4 1 2 3 4 1 + 2 3 4 1 5 + # CSR row pointers + 0 6 7 11 15 19 21 + +-1 1 0 9 + # CSR values + 6.76900992e-02 8.89969817e-05 1.22591174e-05 -2.40668150e-04 2.40668150e-04 8.89969817e-05 + 1.22591178e-05 2.40668150e-04 -2.40668150e-04 + # CSR column indices + 1 2 3 4 5 1 1 1 1 + # CSR row pointers + 0 5 5 6 7 8 9 + +0 -1 0 21 + # CSR values + 1.04529296e-03 4.93236124e-02 1.04529296e-03 6.58102078e-03 1.58466432e-03 -6.45008077e-03 + -1.83579222e-02 6.58102078e-03 4.91684927e-05 8.45188036e-06 -1.85816916e-04 1.58466432e-03 + 8.45188028e-06 3.09795889e-05 -3.09795924e-05 6.45008077e-03 3.09795889e-05 1.83579222e-02 + 1.85816916e-04 3.09795853e-05 -7.04773064e-04 + # CSR column indices + 0 0 1 2 3 4 5 0 2 3 5 0 2 3 5 0 + 4 0 2 3 5 + # CSR row pointers + 0 1 7 11 15 17 21 + +0 0 -1 19 + # CSR values + 1.26415805e-07 7.48010104e-07 -1.58744756e-06 1.58744756e-06 1.26415805e-07 7.48010104e-07 + 1.58744756e-06 -1.58744756e-06 -1.26412514e-07 -1.26412514e-07 -1.79616113e-07 7.48054497e-07 + 7.48054497e-07 -1.79560896e-07 1.45071058e-10 1.58743591e-06 -1.58743591e-06 -1.58743591e-06 + 1.58743591e-06 + # CSR column indices + 2 3 4 5 2 3 4 5 0 1 3 0 1 2 3 0 + 1 0 1 + # CSR row pointers + 0 4 8 11 15 17 19 + +0 0 0 26 + # CSR values + 4.99999675e+00 3.61072918e-02 6.36454458e-01 1.22707920e-01 5.78430933e-01 -5.78430933e-01 + 3.61072918e-02 4.99999675e+00 6.36454458e-01 1.22707920e-01 -5.78430933e-01 5.78430933e-01 + 6.36454458e-01 6.36454458e-01 4.99999975e+00 6.81742634e-01 1.22707920e-01 1.22707920e-01 + 6.81742631e-01 4.99999930e+00 5.78430933e-01 -5.78430933e-01 4.99999930e+00 -5.78430933e-01 + 5.78430933e-01 4.99999930e+00 + # CSR column indices + 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 + 0 1 2 3 0 1 4 0 1 5 + # CSR row pointers + 0 6 12 16 20 23 26 + +0 0 1 24 + # CSR values + 2.09058593e-03 1.14021403e-04 -4.10566041e-04 1.08529101e-04 -1.08529101e-04 2.09058593e-03 + 1.14021403e-04 -4.10566041e-04 -1.08529101e-04 1.08529101e-04 1.14274232e-04 1.14274232e-04 + 9.83369851e-05 -3.71813448e-04 4.12062106e-04 4.12062106e-04 3.71454271e-04 -1.40954627e-03 + 1.05354217e-04 -1.05354217e-04 6.19591742e-05 -1.05354217e-04 1.05354217e-04 6.19591742e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 + 2 3 0 1 4 0 1 5 + # CSR row pointers + 0 5 10 14 18 21 24 + +0 1 0 21 + # CSR values + 1.04529296e-03 4.93236124e-02 6.58102078e-03 1.58466432e-03 6.45008077e-03 1.83579222e-02 + 1.04529296e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 1.85816916e-04 1.58466432e-03 + 8.45188028e-06 3.09795889e-05 3.09795924e-05 -6.45008077e-03 3.09795889e-05 -1.83579222e-02 + -1.85816916e-04 -3.09795853e-05 -7.04773064e-04 + # CSR column indices + 0 1 2 3 4 5 1 1 2 3 5 1 2 3 5 1 + 4 1 2 3 5 + # CSR row pointers + 0 6 7 11 15 17 21 + +1 -1 0 9 + # CSR values + 6.76900992e-02 8.89969817e-05 1.22591174e-05 2.40668150e-04 -2.40668150e-04 8.89969817e-05 + 1.22591178e-05 -2.40668150e-04 2.40668150e-04 + # CSR column indices + 0 2 3 4 5 0 0 0 0 + # CSR row pointers + 0 0 5 6 7 8 9 + +1 0 0 21 + # CSR values + 1.04529296e-03 4.93236124e-02 1.04529296e-03 6.58102078e-03 1.58466432e-03 1.83579222e-02 + 6.45008077e-03 6.58102078e-03 4.91684927e-05 8.45188036e-06 1.85816916e-04 1.58466432e-03 + 8.45188028e-06 3.09795889e-05 3.09795924e-05 -1.83579222e-02 -1.85816916e-04 -3.09795853e-05 + -7.04773064e-04 -6.45008077e-03 3.09795889e-05 + # CSR column indices + 0 0 1 2 3 4 5 0 2 3 4 0 2 3 4 0 + 2 3 4 0 5 + # CSR row pointers + 0 1 7 11 15 19 21 + diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/sr_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/sr_nao.csr.ref index e6e1ebdae1a..463a08e07f7 100644 --- a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/sr_nao.csr.ref +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/tr_nao.csr.ref b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/tr_nao.csr.ref index bb0639f3d07..8f084dce594 100644 --- a/tests/03_NAO_multik/nscf_out_hsr_tr_rr/tr_nao.csr.ref +++ b/tests/03_NAO_multik/nscf_out_hsr_tr_rr/tr_nao.csr.ref @@ -1,39 +1,122 @@ -STEP: 1 -Matrix Dimension of T(R): 6 -Matrix number of T(R): 9 --1 0 0 15 - -4.2261704810905864e-04 -8.1272083355548690e-03 -2.0844943920888962e-03 3.9488588113934121e-03 1.3874368796803404e-03 -4.2261704810905864e-04 -2.0844943920888962e-03 -3.0562313510081214e-05 1.0266204640125164e-04 -2.3174958641661121e-05 -3.9488588113934121e-03 -1.0266204640125164e-04 3.3907517307715389e-04 -1.3874368796803404e-03 -2.3174958641661162e-05 +Ionic_Step 1 + # print T matrix in real space T(R) + 1 # number of spin directions + 1 # spin index + 6 # number of localized basis + 9 # number of Bravais lattice vector R + + user_defined_lattice + 5.29177 + 1 0 0 + 0 1 0 + 0 0 1 + H O + 2 1 + Direct + 0.239999999999782 0.760000000000218 0.5 + 0.760000000000218 0.239999999999782 0.5 + 0.5 0.5 0.5 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + + -1 0 0 15 + # CSR values + -4.22617048e-04 -8.12720834e-03 -2.08449439e-03 3.94885881e-03 1.38743688e-03 -4.22617048e-04 + -2.08449439e-03 -3.05623135e-05 1.02662046e-04 -2.31749586e-05 -3.94885881e-03 -1.02662046e-04 + 3.39075173e-04 -1.38743688e-03 -2.31749586e-05 + # CSR column indices 0 1 2 4 5 1 1 2 4 3 1 2 4 1 5 + # CSR row pointers 0 5 6 9 10 13 15 --1 1 0 7 - -1.0019700533395098e-02 -5.9821328363692508e-05 1.6209352886278170e-04 -1.6209352886278170e-04 -5.9821328363692508e-05 -1.6209352886278170e-04 1.6209352886278170e-04 + + -1 1 0 7 + # CSR values + -1.00197005e-02 -5.98213284e-05 1.62093529e-04 -1.62093529e-04 -5.98213284e-05 -1.62093529e-04 + 1.62093529e-04 + # CSR column indices 1 2 4 5 1 1 1 + # CSR row pointers 0 4 4 5 5 6 7 -0 -1 0 15 - -4.2261704810905864e-04 -8.1272083355548690e-03 -4.2261704810905864e-04 -2.0844943920888962e-03 1.3874368796803404e-03 3.9488588113934121e-03 -2.0844943920888962e-03 -3.0562313510081214e-05 1.0266204640125164e-04 -2.3174958641661121e-05 -1.3874368796803404e-03 -2.3174958641661108e-05 -3.9488588113934121e-03 -1.0266204640125164e-04 3.3907517307715383e-04 + + 0 -1 0 15 + # CSR values + -4.22617048e-04 -8.12720834e-03 -4.22617048e-04 -2.08449439e-03 1.38743688e-03 3.94885881e-03 + -2.08449439e-03 -3.05623135e-05 1.02662046e-04 -2.31749586e-05 -1.38743688e-03 -2.31749586e-05 + -3.94885881e-03 -1.02662046e-04 3.39075173e-04 + # CSR column indices 0 0 1 2 4 5 0 2 5 3 0 4 0 2 5 + # CSR row pointers 0 1 6 9 10 12 15 -0 0 -1 24 - -4.2261704810905864e-04 -4.8650852753273001e-05 -1.6693038742288235e-04 -4.3401900729985844e-05 4.3401900729985844e-05 -4.2261704810905864e-04 -4.8650852753273001e-05 -1.6693038742288235e-04 4.3401900729985844e-05 -4.3401900729985844e-05 -4.8650852753273001e-05 -4.8650852753273001e-05 -3.0562313510081214e-05 -1.0266204640125164e-04 1.6693038742288235e-04 1.6693038742288235e-04 1.0266204640125164e-04 3.3907517307715383e-04 -4.3401900729985844e-05 4.3401900729985844e-05 -2.3174958641661084e-05 4.3401900729985844e-05 -4.3401900729985844e-05 -2.3174958641661131e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 2 3 0 1 4 0 1 5 + + 0 0 -1 24 + # CSR values + -4.22617048e-04 -4.86508528e-05 -1.66930387e-04 -4.34019007e-05 4.34019007e-05 -4.22617048e-04 + -4.86508528e-05 -1.66930387e-04 4.34019007e-05 -4.34019007e-05 -4.86508528e-05 -4.86508528e-05 + -3.05623135e-05 -1.02662046e-04 1.66930387e-04 1.66930387e-04 1.02662046e-04 3.39075173e-04 + -4.34019007e-05 4.34019007e-05 -2.31749586e-05 4.34019007e-05 -4.34019007e-05 -2.31749586e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 + 2 3 0 1 4 0 1 5 + # CSR row pointers 0 5 10 14 18 21 24 -0 0 0 20 - 1.2203020616464175e+00 -6.4431327519281099e-03 -2.3373454947718725e-02 1.7222012564086384e-02 -1.7222012564086384e-02 -6.4431327519281099e-03 1.2203020616464175e+00 -2.3373454947718725e-02 -1.7222012564086384e-02 1.7222012564086384e-02 -2.3373454947718725e-02 -2.3373454947718725e-02 1.5072806140614294e+00 4.5868924979072894e+00 1.7222012564086384e-02 -1.7222012564086384e-02 4.5868924979072894e+00 -1.7222012564086384e-02 1.7222012564086384e-02 4.5868924979072894e+00 - 0 1 2 4 5 0 1 2 4 5 0 1 2 3 0 1 4 0 1 5 + + 0 0 0 20 + # CSR values + 1.22030206e+00 -6.44313275e-03 -2.33734549e-02 1.72220126e-02 -1.72220126e-02 -6.44313275e-03 + 1.22030206e+00 -2.33734549e-02 -1.72220126e-02 1.72220126e-02 -2.33734549e-02 -2.33734549e-02 + 1.50728061e+00 4.58689250e+00 1.72220126e-02 -1.72220126e-02 4.58689250e+00 -1.72220126e-02 + 1.72220126e-02 4.58689250e+00 + # CSR column indices + 0 1 2 4 5 0 1 2 4 5 0 1 2 3 0 1 + 4 0 1 5 + # CSR row pointers 0 5 10 13 14 17 20 -0 0 1 24 - -4.2261704810905864e-04 -4.8650852753273001e-05 1.6693038742288235e-04 -4.3401900729985844e-05 4.3401900729985844e-05 -4.2261704810905864e-04 -4.8650852753273001e-05 1.6693038742288235e-04 4.3401900729985844e-05 -4.3401900729985844e-05 -4.8650852753273001e-05 -4.8650852753273001e-05 -3.0562313510081214e-05 1.0266204640125164e-04 -1.6693038742288235e-04 -1.6693038742288235e-04 -1.0266204640125164e-04 3.3907517307715383e-04 -4.3401900729985844e-05 4.3401900729985844e-05 -2.3174958641661084e-05 4.3401900729985844e-05 -4.3401900729985844e-05 -2.3174958641661131e-05 - 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 2 3 0 1 4 0 1 5 + + 0 0 1 24 + # CSR values + -4.22617048e-04 -4.86508528e-05 1.66930387e-04 -4.34019007e-05 4.34019007e-05 -4.22617048e-04 + -4.86508528e-05 1.66930387e-04 4.34019007e-05 -4.34019007e-05 -4.86508528e-05 -4.86508528e-05 + -3.05623135e-05 1.02662046e-04 -1.66930387e-04 -1.66930387e-04 -1.02662046e-04 3.39075173e-04 + -4.34019007e-05 4.34019007e-05 -2.31749586e-05 4.34019007e-05 -4.34019007e-05 -2.31749586e-05 + # CSR column indices + 0 2 3 4 5 1 2 3 4 5 0 1 2 3 0 1 + 2 3 0 1 4 0 1 5 + # CSR row pointers 0 5 10 14 18 21 24 -0 1 0 15 - -4.2261704810905864e-04 -8.1272083355548690e-03 -2.0844943920888962e-03 -1.3874368796803404e-03 -3.9488588113934121e-03 -4.2261704810905864e-04 -2.0844943920888962e-03 -3.0562313510081214e-05 -1.0266204640125164e-04 -2.3174958641661121e-05 1.3874368796803404e-03 -2.3174958641661108e-05 3.9488588113934121e-03 1.0266204640125164e-04 3.3907517307715383e-04 + + 0 1 0 15 + # CSR values + -4.22617048e-04 -8.12720834e-03 -2.08449439e-03 -1.38743688e-03 -3.94885881e-03 -4.22617048e-04 + -2.08449439e-03 -3.05623135e-05 -1.02662046e-04 -2.31749586e-05 1.38743688e-03 -2.31749586e-05 + 3.94885881e-03 1.02662046e-04 3.39075173e-04 + # CSR column indices 0 1 2 4 5 1 1 2 5 3 1 4 1 2 5 + # CSR row pointers 0 5 6 9 10 12 15 -1 -1 0 7 - -1.0019700533395098e-02 -5.9821328363692508e-05 -1.6209352886278170e-04 1.6209352886278170e-04 -5.9821328363692508e-05 1.6209352886278170e-04 -1.6209352886278170e-04 + + 1 -1 0 7 + # CSR values + -1.00197005e-02 -5.98213284e-05 -1.62093529e-04 1.62093529e-04 -5.98213284e-05 1.62093529e-04 + -1.62093529e-04 + # CSR column indices 0 2 4 5 0 0 0 + # CSR row pointers 0 0 4 5 5 6 7 -1 0 0 15 - -4.2261704810905864e-04 -8.1272083355548690e-03 -4.2261704810905864e-04 -2.0844943920888962e-03 -3.9488588113934121e-03 -1.3874368796803404e-03 -2.0844943920888962e-03 -3.0562313510081214e-05 -1.0266204640125164e-04 -2.3174958641661121e-05 3.9488588113934121e-03 1.0266204640125164e-04 3.3907517307715389e-04 1.3874368796803404e-03 -2.3174958641661162e-05 + + 1 0 0 15 + # CSR values + -4.22617048e-04 -8.12720834e-03 -4.22617048e-04 -2.08449439e-03 -3.94885881e-03 -1.38743688e-03 + -2.08449439e-03 -3.05623135e-05 -1.02662046e-04 -2.31749586e-05 3.94885881e-03 1.02662046e-04 + 3.39075173e-04 1.38743688e-03 -2.31749586e-05 + # CSR column indices 0 0 1 2 4 5 0 2 4 3 0 2 4 0 5 + # CSR row pointers 0 1 6 9 10 13 15 + diff --git a/tests/03_NAO_multik/nscf_out_mul/mulliken.txt.ref b/tests/03_NAO_multik/nscf_out_mul/mulliken.txt.ref index 63c759e0d57..8169a19f5c3 100644 --- a/tests/03_NAO_multik/nscf_out_mul/mulliken.txt.ref +++ b/tests/03_NAO_multik/nscf_out_mul/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 2 Decomposed Mulliken population analysis for each atom l and m from Ylm, z stands for zeta orbital diff --git a/tests/03_NAO_multik/scf_nspin4_nsoc_hr/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_nspin4_nsoc_hr/hrs1_nao.csr.ref index 91015c95b30..d537dc1cbce 100644 --- a/tests/03_NAO_multik/scf_nspin4_nsoc_hr/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_nspin4_nsoc_hr/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 1 # number of spin directions 1 # spin index, E_Fermi = -6.68506 eV diff --git a/tests/03_NAO_multik/scf_nspin4_nsoc_hr/sr_nao.csr.ref b/tests/03_NAO_multik/scf_nspin4_nsoc_hr/sr_nao.csr.ref index 0ce0e2fe378..bd4c8502fd4 100644 --- a/tests/03_NAO_multik/scf_nspin4_nsoc_hr/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_nspin4_nsoc_hr/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_nspin4_soc_hr/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_nspin4_soc_hr/hrs1_nao.csr.ref index edd4d50eb7a..2602aa63084 100644 --- a/tests/03_NAO_multik/scf_nspin4_soc_hr/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_nspin4_soc_hr/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 1 # number of spin directions 1 # spin index, E_Fermi = -6.68505 eV diff --git a/tests/03_NAO_multik/scf_nspin4_soc_hr/sr_nao.csr.ref b/tests/03_NAO_multik/scf_nspin4_soc_hr/sr_nao.csr.ref index 0ce0e2fe378..bd4c8502fd4 100644 --- a/tests/03_NAO_multik/scf_nspin4_soc_hr/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_nspin4_soc_hr/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1x_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1x_ia1_nao.txt new file mode 100644 index 00000000000..1f8da9a9768 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1x_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk1x_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014110e-05,0.00000000e+00) (6.78657513e-05,0.00000000e+00) (1.80753048e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (-7.14474869e-15,0.00000000e+00) (-2.22795808e-14,0.00000000e+00) (2.81949251e-03,0.00000000e+00) (-4.79010377e-14,0.00000000e+00) + (1.56201275e-05,0.00000000e+00) (-6.24326610e-14,0.00000000e+00) (-9.23465764e-15,0.00000000e+00) (-2.70548543e-05,0.00000000e+00) (4.01713262e-14,0.00000000e+00) +Row 2 + (6.78657513e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (-4.29151300e-15,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (-2.72297211e-14,0.00000000e+00) (3.67569346e-14,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (6.93251486e-15,0.00000000e+00) + (-7.86003624e-05,0.00000000e+00) (-2.93781722e-14,0.00000000e+00) (9.00090424e-16,0.00000000e+00) (1.36139821e-04,0.00000000e+00) (2.14808183e-14,0.00000000e+00) +Row 3 + (1.80718928e-14,0.00000000e+00) (-4.28181258e-15,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-6.16699406e-14,0.00000000e+00) (-2.36836355e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.60550516e-14,0.00000000e+00) (-2.51304316e-14,0.00000000e+00) + (1.82588183e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-8.90597490e-15,0.00000000e+00) (1.27116080e-14,0.00000000e+00) (-2.92237744e-14,0.00000000e+00) +Row 4 + (1.77202938e-03,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (-6.17254517e-14,0.00000000e+00) (-9.27165190e-05,0.00000000e+00) (5.12499105e-14,0.00000000e+00) (-4.86522719e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (4.67140906e-14,0.00000000e+00) + (-1.75477626e-03,0.00000000e+00) (5.16151781e-14,0.00000000e+00) (-3.04540848e-14,0.00000000e+00) (3.03936164e-03,0.00000000e+00) (-3.01358277e-14,0.00000000e+00) +Row 5 + (-7.13860938e-15,0.00000000e+00) (-2.72277873e-14,0.00000000e+00) (-2.36849109e-14,0.00000000e+00) (5.12481759e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-2.51496536e-14,0.00000000e+00) (4.69440066e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) + (-1.47465407e-14,0.00000000e+00) (-2.94047845e-14,0.00000000e+00) (1.85259756e-14,0.00000000e+00) (-4.69688407e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) +Row 6 + (-2.22783179e-14,0.00000000e+00) (3.67601101e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.86592108e-14,0.00000000e+00) (-2.51449476e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (-7.81450133e-14,0.00000000e+00) (-4.12170899e-14,0.00000000e+00) + (-4.17230727e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-4.56629178e-14,0.00000000e+00) (3.15157739e-15,0.00000000e+00) (-2.90373364e-14,0.00000000e+00) +Row 7 + (2.81949251e-03,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (-4.60671946e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (4.69366468e-14,0.00000000e+00) (-7.81415439e-14,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) (4.95778638e-14,0.00000000e+00) + (-2.95713240e-03,0.00000000e+00) (1.01671661e-14,0.00000000e+00) (-2.90830096e-14,0.00000000e+00) (5.12190356e-03,0.00000000e+00) (-2.37549701e-14,0.00000000e+00) +Row 8 + (-4.78917460e-14,0.00000000e+00) (6.93782751e-15,0.00000000e+00) (-2.51278180e-14,0.00000000e+00) (4.67123709e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.12175568e-14,0.00000000e+00) (4.95815599e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) + (2.97446411e-15,0.00000000e+00) (-2.90802279e-14,0.00000000e+00) (7.02301759e-15,0.00000000e+00) (2.83547609e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) +Row 9 + (1.56201275e-05,0.00000000e+00) (-7.86003624e-05,0.00000000e+00) (1.82711488e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-1.47545351e-14,0.00000000e+00) (-4.17212368e-14,0.00000000e+00) (-2.95713240e-03,0.00000000e+00) (2.97453909e-15,0.00000000e+00) + (-4.65236548e-05,0.00000000e+00) (-1.61863228e-14,0.00000000e+00) (-2.08072584e-14,0.00000000e+00) (3.68932011e-05,0.00000000e+00) (-3.69850598e-15,0.00000000e+00) +Row 10 + (-6.24326610e-14,0.00000000e+00) (-2.93532355e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (5.16389205e-14,0.00000000e+00) (-2.93974661e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (1.01602268e-14,0.00000000e+00) (-2.90762942e-14,0.00000000e+00) + (-1.61997669e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (3.56719121e-14,0.00000000e+00) (-3.52954844e-14,0.00000000e+00) (-2.72980595e-14,0.00000000e+00) +Row 11 + (-9.23416770e-15,0.00000000e+00) (8.99429514e-16,0.00000000e+00) (-8.90636028e-15,0.00000000e+00) (-3.04545726e-14,0.00000000e+00) (1.85168156e-14,0.00000000e+00) (-4.56589802e-14,0.00000000e+00) (-2.90790827e-14,0.00000000e+00) (7.02150744e-15,0.00000000e+00) + (-2.08034053e-14,0.00000000e+00) (3.56805837e-14,0.00000000e+00) (-3.88972626e-05,0.00000000e+00) (-3.34254959e-14,0.00000000e+00) (-1.75813761e-14,0.00000000e+00) +Row 12 + (-2.70548543e-05,0.00000000e+00) (1.36139821e-04,0.00000000e+00) (1.27095717e-14,0.00000000e+00) (3.03936164e-03,0.00000000e+00) (-4.69681618e-14,0.00000000e+00) (3.15201326e-15,0.00000000e+00) (5.12190356e-03,0.00000000e+00) (2.83539890e-14,0.00000000e+00) + (3.68932011e-05,0.00000000e+00) (-3.53509956e-14,0.00000000e+00) (-3.34212231e-14,0.00000000e+00) (-8.91242540e-05,0.00000000e+00) (-1.49825581e-14,0.00000000e+00) +Row 13 + (4.01778821e-14,0.00000000e+00) (2.14769144e-14,0.00000000e+00) (-2.92268648e-14,0.00000000e+00) (-3.01353942e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-2.90342969e-14,0.00000000e+00) (-2.37428199e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) + (-3.71130083e-15,0.00000000e+00) (-2.72963239e-14,0.00000000e+00) (-1.75813761e-14,0.00000000e+00) (-1.49663357e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1y_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1y_ia1_nao.txt new file mode 100644 index 00000000000..21ee6f4aea0 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1y_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk1y_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014110e-05,0.00000000e+00) (6.78657514e-05,0.00000000e+00) (9.95775985e-14,0.00000000e+00) (-3.57885869e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (5.53207090e-14,0.00000000e+00) (-6.73523572e-14,0.00000000e+00) (2.81949251e-03,0.00000000e+00) + (1.56201274e-05,0.00000000e+00) (-3.16196237e-16,0.00000000e+00) (2.22224435e-15,0.00000000e+00) (2.70548543e-05,0.00000000e+00) (3.21511388e-14,0.00000000e+00) +Row 2 + (6.78657514e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (4.69648982e-14,0.00000000e+00) (-3.67958251e-14,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (7.50464439e-14,0.00000000e+00) (-8.18986856e-15,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) + (-7.86003624e-05,0.00000000e+00) (1.35145831e-14,0.00000000e+00) (-1.49339491e-14,0.00000000e+00) (-1.36139821e-04,0.00000000e+00) (-1.04914623e-14,0.00000000e+00) +Row 3 + (9.95510929e-14,0.00000000e+00) (4.69643012e-14,0.00000000e+00) (-2.79248490e-05,0.00000000e+00) (4.60348408e-15,0.00000000e+00) (1.48644125e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (1.55112110e-14,0.00000000e+00) (8.81310074e-15,0.00000000e+00) + (4.25011828e-14,0.00000000e+00) (-4.42267068e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (1.62092452e-14,0.00000000e+00) (-2.20711067e-14,0.00000000e+00) +Row 4 + (-3.57864323e-14,0.00000000e+00) (-3.67956052e-14,0.00000000e+00) (4.60684655e-15,0.00000000e+00) (-2.79248490e-05,0.00000000e+00) (3.13008450e-14,0.00000000e+00) (1.55145791e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.88037429e-16,0.00000000e+00) + (-3.55757884e-14,0.00000000e+00) (1.08799493e-13,0.00000000e+00) (-2.21871916e-14,0.00000000e+00) (-2.42158459e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) +Row 5 + (1.77202938e-03,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (1.48644125e-14,0.00000000e+00) (3.13060499e-14,0.00000000e+00) (-9.27165189e-05,0.00000000e+00) (1.12828307e-15,0.00000000e+00) (-2.06198428e-15,0.00000000e+00) (3.01710867e-04,0.00000000e+00) + (-1.75477626e-03,0.00000000e+00) (-2.26278112e-14,0.00000000e+00) (7.60074420e-14,0.00000000e+00) (-3.03936164e-03,0.00000000e+00) (4.12122454e-14,0.00000000e+00) +Row 6 + (5.53194358e-14,0.00000000e+00) (7.50498938e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (1.55105703e-14,0.00000000e+00) (1.12828307e-15,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (2.19469998e-15,0.00000000e+00) (3.48646871e-15,0.00000000e+00) + (-4.95600839e-14,0.00000000e+00) (-2.89118778e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (6.72863097e-15,0.00000000e+00) (-2.80420758e-16,0.00000000e+00) +Row 7 + (-6.73343420e-14,0.00000000e+00) (-8.18336062e-15,0.00000000e+00) (1.55074241e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-2.04681190e-15,0.00000000e+00) (2.19511143e-15,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (3.99897850e-14,0.00000000e+00) + (1.94372268e-14,0.00000000e+00) (8.87379012e-14,0.00000000e+00) (-2.00225800e-16,0.00000000e+00) (-4.82800494e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) +Row 8 + (2.81949251e-03,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (8.82350908e-15,0.00000000e+00) (3.90639430e-16,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (3.48646871e-15,0.00000000e+00) (3.99811148e-14,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) + (-2.95713240e-03,0.00000000e+00) (-6.01477852e-15,0.00000000e+00) (7.65532958e-14,0.00000000e+00) (-5.12190356e-03,0.00000000e+00) (-1.35578742e-14,0.00000000e+00) +Row 9 + (1.56201274e-05,0.00000000e+00) (-7.86003624e-05,0.00000000e+00) (4.25031943e-14,0.00000000e+00) (-3.55697078e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-4.95563582e-14,0.00000000e+00) (1.94366264e-14,0.00000000e+00) (-2.95713240e-03,0.00000000e+00) + (-4.65236548e-05,0.00000000e+00) (1.16626602e-14,0.00000000e+00) (1.73085500e-14,0.00000000e+00) (-3.68932010e-05,0.00000000e+00) (-1.74201665e-14,0.00000000e+00) +Row 10 + (-3.16197577e-16,0.00000000e+00) (1.35147752e-14,0.00000000e+00) (-4.42397230e-14,0.00000000e+00) (1.08804715e-13,0.00000000e+00) (-2.26702853e-14,0.00000000e+00) (-2.89103908e-14,0.00000000e+00) (8.87385701e-14,0.00000000e+00) (-6.01670556e-15,0.00000000e+00) + (1.16662369e-14,0.00000000e+00) (-3.88972624e-05,0.00000000e+00) (2.14433035e-14,0.00000000e+00) (-3.48879586e-14,0.00000000e+00) (-1.48075176e-14,0.00000000e+00) +Row 11 + (2.23612213e-15,0.00000000e+00) (-1.49430564e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-2.22431059e-14,0.00000000e+00) (7.60217469e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-2.03885098e-16,0.00000000e+00) (7.65518084e-14,0.00000000e+00) + (1.73146215e-14,0.00000000e+00) (2.14571885e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (-8.23859748e-15,0.00000000e+00) (2.13972448e-14,0.00000000e+00) +Row 12 + (2.70548543e-05,0.00000000e+00) (-1.36139821e-04,0.00000000e+00) (1.62104327e-14,0.00000000e+00) (-2.42131771e-14,0.00000000e+00) (-3.03936164e-03,0.00000000e+00) (6.73546333e-15,0.00000000e+00) (-4.82802049e-14,0.00000000e+00) (-5.12190356e-03,0.00000000e+00) + (-3.68932010e-05,0.00000000e+00) (-3.48856592e-14,0.00000000e+00) (-8.23859748e-15,0.00000000e+00) (-8.91242540e-05,0.00000000e+00) (-2.06791129e-14,0.00000000e+00) +Row 13 + (3.20878225e-14,0.00000000e+00) (-1.04960364e-14,0.00000000e+00) (-2.20763028e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (4.12131131e-14,0.00000000e+00) (-2.75448785e-16,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-1.35706673e-14,0.00000000e+00) + (-1.74175958e-14,0.00000000e+00) (-1.48075176e-14,0.00000000e+00) (2.13911759e-14,0.00000000e+00) (-2.06781608e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1z_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1z_ia1_nao.txt new file mode 100644 index 00000000000..3a3612402d6 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk1z_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk1z_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014111e-05,0.00000000e+00) (6.78657513e-05,0.00000000e+00) (-1.77202938e-03,0.00000000e+00) (-8.08031640e-14,0.00000000e+00) (1.37940551e-14,0.00000000e+00) (-2.81949251e-03,0.00000000e+00) (-5.09778936e-14,0.00000000e+00) (-1.85108725e-14,0.00000000e+00) + (-3.12402549e-05,0.00000000e+00) (-2.84555513e-14,0.00000000e+00) (3.90774456e-14,0.00000000e+00) (1.11466204e-14,0.00000000e+00) (6.68587679e-14,0.00000000e+00) +Row 2 + (6.78657513e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (-3.23220671e-03,0.00000000e+00) (-4.03286281e-14,0.00000000e+00) (-2.91423101e-14,0.00000000e+00) (6.43490971e-03,0.00000000e+00) (-2.49655167e-14,0.00000000e+00) (1.44213311e-14,0.00000000e+00) + (1.57200725e-04,0.00000000e+00) (-2.26468739e-14,0.00000000e+00) (-2.29411722e-15,0.00000000e+00) (-1.40385486e-14,0.00000000e+00) (3.01499664e-14,0.00000000e+00) +Row 3 + (-1.77202938e-03,0.00000000e+00) (-3.23220671e-03,0.00000000e+00) (-9.27165190e-05,0.00000000e+00) (-1.57560586e-14,0.00000000e+00) (2.67207383e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (-1.19695038e-14,0.00000000e+00) (-1.67292344e-17,0.00000000e+00) + (-3.50955253e-03,0.00000000e+00) (-9.44418540e-14,0.00000000e+00) (5.82220528e-15,0.00000000e+00) (-3.61096288e-14,0.00000000e+00) (-7.75499481e-15,0.00000000e+00) +Row 4 + (-8.08183338e-14,0.00000000e+00) (-4.03252144e-14,0.00000000e+00) (-1.57543306e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (5.85750119e-14,0.00000000e+00) (-1.72175709e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.57355464e-14,0.00000000e+00) + (-5.41288775e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-7.87829176e-15,0.00000000e+00) (-3.86665416e-15,0.00000000e+00) (-2.12189831e-14,0.00000000e+00) +Row 5 + (1.37915141e-14,0.00000000e+00) (-2.91467013e-14,0.00000000e+00) (2.67185686e-14,0.00000000e+00) (5.85724086e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-1.25494589e-15,0.00000000e+00) (3.57730381e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) + (-1.38786279e-14,0.00000000e+00) (-7.80542367e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-4.97476984e-14,0.00000000e+00) (-7.64121737e-14,0.00000000e+00) +Row 6 + (-2.81949251e-03,0.00000000e+00) (6.43490971e-03,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (-1.72165585e-14,0.00000000e+00) (-1.25633494e-15,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) (-1.83894573e-14,0.00000000e+00) (9.52347937e-15,0.00000000e+00) + (-5.91426480e-03,0.00000000e+00) (-4.69291426e-14,0.00000000e+00) (-1.19484762e-14,0.00000000e+00) (-2.48194009e-14,0.00000000e+00) (-1.97031327e-14,0.00000000e+00) +Row 7 + (-5.09627251e-14,0.00000000e+00) (-2.49828704e-14,0.00000000e+00) (-1.19700066e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.57771535e-14,0.00000000e+00) (-1.83904254e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (2.90207277e-14,0.00000000e+00) + (-5.22871372e-15,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.94550224e-14,0.00000000e+00) (1.45536091e-14,0.00000000e+00) (-6.47167010e-14,0.00000000e+00) +Row 8 + (-1.85078202e-14,0.00000000e+00) (1.44211011e-14,0.00000000e+00) (-2.30538309e-17,0.00000000e+00) (3.57359781e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (9.51966921e-15,0.00000000e+00) (2.90211605e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) + (2.33289363e-14,0.00000000e+00) (-1.95270105e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.24652770e-14,0.00000000e+00) (-6.39655915e-14,0.00000000e+00) +Row 9 + (-3.12402549e-05,0.00000000e+00) (1.57200725e-04,0.00000000e+00) (-3.50955253e-03,0.00000000e+00) (-5.40930649e-15,0.00000000e+00) (-1.38807903e-14,0.00000000e+00) (-5.91426480e-03,0.00000000e+00) (-5.23001074e-15,0.00000000e+00) (2.33313191e-14,0.00000000e+00) + (-1.10424554e-04,0.00000000e+00) (-2.67032037e-14,0.00000000e+00) (3.44823311e-14,0.00000000e+00) (2.69991478e-14,0.00000000e+00) (-5.58165788e-14,0.00000000e+00) +Row 10 + (-2.84894350e-14,0.00000000e+00) (-2.26391820e-14,0.00000000e+00) (-9.44757073e-14,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-7.78810551e-15,0.00000000e+00) (-4.69258523e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.95296808e-14,0.00000000e+00) + (-2.66897214e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (8.01907040e-15,0.00000000e+00) (-9.65751124e-15,0.00000000e+00) (7.45000764e-15,0.00000000e+00) +Row 11 + (3.90804237e-14,0.00000000e+00) (-2.28476777e-15,0.00000000e+00) (5.82283209e-15,0.00000000e+00) (-7.87138247e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-1.19494603e-14,0.00000000e+00) (-1.94529202e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) + (3.44839990e-14,0.00000000e+00) (8.01560334e-15,0.00000000e+00) (-9.79258110e-05,0.00000000e+00) (-2.24621910e-14,0.00000000e+00) (-5.95474529e-15,0.00000000e+00) +Row 12 + (1.11476314e-14,0.00000000e+00) (-1.40378560e-14,0.00000000e+00) (-3.61089586e-14,0.00000000e+00) (-3.86190813e-15,0.00000000e+00) (-4.97399168e-14,0.00000000e+00) (-2.48246673e-14,0.00000000e+00) (1.45602271e-14,0.00000000e+00) (-1.24608279e-14,0.00000000e+00) + (2.70037655e-14,0.00000000e+00) (-9.65290714e-15,0.00000000e+00) (-2.24542151e-14,0.00000000e+00) (-2.52233552e-05,0.00000000e+00) (-1.09820215e-14,0.00000000e+00) +Row 13 + (6.68609398e-14,0.00000000e+00) (3.01564618e-14,0.00000000e+00) (-7.75846004e-15,0.00000000e+00) (-2.12185561e-14,0.00000000e+00) (-7.64362480e-14,0.00000000e+00) (-1.97047988e-14,0.00000000e+00) (-6.47190645e-14,0.00000000e+00) (-6.39670719e-14,0.00000000e+00) + (-5.58166771e-14,0.00000000e+00) (7.44566729e-15,0.00000000e+00) (-5.95213351e-15,0.00000000e+00) (-1.09796435e-14,0.00000000e+00) (-3.88972625e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2x_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2x_ia1_nao.txt new file mode 100644 index 00000000000..a6c4879505b --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2x_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk2x_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014110e-05,0.00000000e+00) (6.78657513e-05,0.00000000e+00) (1.80753048e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (-7.14474869e-15,0.00000000e+00) (-2.22795808e-14,0.00000000e+00) (2.81949251e-03,0.00000000e+00) (-4.79010377e-14,0.00000000e+00) + (1.56201275e-05,0.00000000e+00) (-6.24326610e-14,0.00000000e+00) (-9.23465764e-15,0.00000000e+00) (-2.70548543e-05,0.00000000e+00) (4.01713262e-14,0.00000000e+00) +Row 2 + (6.78657513e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (-4.29151300e-15,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (-2.72297211e-14,0.00000000e+00) (3.67569346e-14,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (6.93251486e-15,0.00000000e+00) + (-7.86003624e-05,0.00000000e+00) (-2.93781722e-14,0.00000000e+00) (9.00090424e-16,0.00000000e+00) (1.36139821e-04,0.00000000e+00) (2.14808183e-14,0.00000000e+00) +Row 3 + (1.80718928e-14,0.00000000e+00) (-4.28181258e-15,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-6.16699406e-14,0.00000000e+00) (-2.36836355e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.60550516e-14,0.00000000e+00) (-2.51304316e-14,0.00000000e+00) + (1.82588183e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-8.90597490e-15,0.00000000e+00) (1.27116080e-14,0.00000000e+00) (-2.92237744e-14,0.00000000e+00) +Row 4 + (1.77202938e-03,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (-6.17254517e-14,0.00000000e+00) (-9.27165190e-05,0.00000000e+00) (5.12499105e-14,0.00000000e+00) (-4.86522719e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (4.67140906e-14,0.00000000e+00) + (-1.75477626e-03,0.00000000e+00) (5.16151781e-14,0.00000000e+00) (-3.04540848e-14,0.00000000e+00) (3.03936164e-03,0.00000000e+00) (-3.01358277e-14,0.00000000e+00) +Row 5 + (-7.13860938e-15,0.00000000e+00) (-2.72277873e-14,0.00000000e+00) (-2.36849109e-14,0.00000000e+00) (5.12481759e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-2.51496536e-14,0.00000000e+00) (4.69440066e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) + (-1.47465407e-14,0.00000000e+00) (-2.94047845e-14,0.00000000e+00) (1.85259756e-14,0.00000000e+00) (-4.69688407e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) +Row 6 + (-2.22783179e-14,0.00000000e+00) (3.67601101e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.86592108e-14,0.00000000e+00) (-2.51449476e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (-7.81450133e-14,0.00000000e+00) (-4.12170899e-14,0.00000000e+00) + (-4.17230727e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-4.56629178e-14,0.00000000e+00) (3.15157739e-15,0.00000000e+00) (-2.90373364e-14,0.00000000e+00) +Row 7 + (2.81949251e-03,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (-4.60671946e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (4.69366468e-14,0.00000000e+00) (-7.81415439e-14,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) (4.95778638e-14,0.00000000e+00) + (-2.95713240e-03,0.00000000e+00) (1.01671661e-14,0.00000000e+00) (-2.90830096e-14,0.00000000e+00) (5.12190356e-03,0.00000000e+00) (-2.37549701e-14,0.00000000e+00) +Row 8 + (-4.78917460e-14,0.00000000e+00) (6.93782751e-15,0.00000000e+00) (-2.51278180e-14,0.00000000e+00) (4.67123709e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-4.12175568e-14,0.00000000e+00) (4.95815599e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) + (2.97446411e-15,0.00000000e+00) (-2.90802279e-14,0.00000000e+00) (7.02301759e-15,0.00000000e+00) (2.83547609e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) +Row 9 + (1.56201275e-05,0.00000000e+00) (-7.86003624e-05,0.00000000e+00) (1.82711488e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-1.47545351e-14,0.00000000e+00) (-4.17212368e-14,0.00000000e+00) (-2.95713240e-03,0.00000000e+00) (2.97453909e-15,0.00000000e+00) + (-4.65236548e-05,0.00000000e+00) (-1.61863228e-14,0.00000000e+00) (-2.08072584e-14,0.00000000e+00) (3.68932011e-05,0.00000000e+00) (-3.69850598e-15,0.00000000e+00) +Row 10 + (-6.24326610e-14,0.00000000e+00) (-2.93532355e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (5.16389205e-14,0.00000000e+00) (-2.93974661e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (1.01602268e-14,0.00000000e+00) (-2.90762942e-14,0.00000000e+00) + (-1.61997669e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (3.56719121e-14,0.00000000e+00) (-3.52954844e-14,0.00000000e+00) (-2.72980595e-14,0.00000000e+00) +Row 11 + (-9.23416770e-15,0.00000000e+00) (8.99429514e-16,0.00000000e+00) (-8.90636028e-15,0.00000000e+00) (-3.04545726e-14,0.00000000e+00) (1.85168156e-14,0.00000000e+00) (-4.56589802e-14,0.00000000e+00) (-2.90790827e-14,0.00000000e+00) (7.02150744e-15,0.00000000e+00) + (-2.08034053e-14,0.00000000e+00) (3.56805837e-14,0.00000000e+00) (-3.88972626e-05,0.00000000e+00) (-3.34254959e-14,0.00000000e+00) (-1.75813761e-14,0.00000000e+00) +Row 12 + (-2.70548543e-05,0.00000000e+00) (1.36139821e-04,0.00000000e+00) (1.27095717e-14,0.00000000e+00) (3.03936164e-03,0.00000000e+00) (-4.69681618e-14,0.00000000e+00) (3.15201326e-15,0.00000000e+00) (5.12190356e-03,0.00000000e+00) (2.83539890e-14,0.00000000e+00) + (3.68932011e-05,0.00000000e+00) (-3.53509956e-14,0.00000000e+00) (-3.34212231e-14,0.00000000e+00) (-8.91242540e-05,0.00000000e+00) (-1.49825581e-14,0.00000000e+00) +Row 13 + (4.01778821e-14,0.00000000e+00) (2.14769144e-14,0.00000000e+00) (-2.92268648e-14,0.00000000e+00) (-3.01353942e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-2.90342969e-14,0.00000000e+00) (-2.37428199e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) + (-3.71130083e-15,0.00000000e+00) (-2.72963239e-14,0.00000000e+00) (-1.75813761e-14,0.00000000e+00) (-1.49663357e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2y_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2y_ia1_nao.txt new file mode 100644 index 00000000000..0b9de927b49 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2y_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk2y_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014110e-05,0.00000000e+00) (6.78657514e-05,0.00000000e+00) (9.95775985e-14,0.00000000e+00) (-3.57885869e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (5.53207090e-14,0.00000000e+00) (-6.73523572e-14,0.00000000e+00) (2.81949251e-03,0.00000000e+00) + (1.56201274e-05,0.00000000e+00) (-3.16196237e-16,0.00000000e+00) (2.22224435e-15,0.00000000e+00) (2.70548543e-05,0.00000000e+00) (3.21511388e-14,0.00000000e+00) +Row 2 + (6.78657514e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (4.69648982e-14,0.00000000e+00) (-3.67958251e-14,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (7.50464439e-14,0.00000000e+00) (-8.18986856e-15,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) + (-7.86003624e-05,0.00000000e+00) (1.35145831e-14,0.00000000e+00) (-1.49339491e-14,0.00000000e+00) (-1.36139821e-04,0.00000000e+00) (-1.04914623e-14,0.00000000e+00) +Row 3 + (9.95510929e-14,0.00000000e+00) (4.69643012e-14,0.00000000e+00) (-2.79248490e-05,0.00000000e+00) (4.60348408e-15,0.00000000e+00) (1.48644125e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (1.55112110e-14,0.00000000e+00) (8.81310074e-15,0.00000000e+00) + (4.25011828e-14,0.00000000e+00) (-4.42267068e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (1.62092452e-14,0.00000000e+00) (-2.20711067e-14,0.00000000e+00) +Row 4 + (-3.57864323e-14,0.00000000e+00) (-3.67956052e-14,0.00000000e+00) (4.60684655e-15,0.00000000e+00) (-2.79248490e-05,0.00000000e+00) (3.13008450e-14,0.00000000e+00) (1.55145791e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.88037429e-16,0.00000000e+00) + (-3.55757884e-14,0.00000000e+00) (1.08799493e-13,0.00000000e+00) (-2.21871916e-14,0.00000000e+00) (-2.42158459e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) +Row 5 + (1.77202938e-03,0.00000000e+00) (3.23220671e-03,0.00000000e+00) (1.48644125e-14,0.00000000e+00) (3.13060499e-14,0.00000000e+00) (-9.27165189e-05,0.00000000e+00) (1.12828307e-15,0.00000000e+00) (-2.06198428e-15,0.00000000e+00) (3.01710867e-04,0.00000000e+00) + (-1.75477626e-03,0.00000000e+00) (-2.26278112e-14,0.00000000e+00) (7.60074420e-14,0.00000000e+00) (-3.03936164e-03,0.00000000e+00) (4.12122454e-14,0.00000000e+00) +Row 6 + (5.53194358e-14,0.00000000e+00) (7.50498938e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (1.55105703e-14,0.00000000e+00) (1.12828307e-15,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (2.19469998e-15,0.00000000e+00) (3.48646871e-15,0.00000000e+00) + (-4.95600839e-14,0.00000000e+00) (-2.89118778e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (6.72863097e-15,0.00000000e+00) (-2.80420758e-16,0.00000000e+00) +Row 7 + (-6.73343420e-14,0.00000000e+00) (-8.18336062e-15,0.00000000e+00) (1.55074241e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (-2.04681190e-15,0.00000000e+00) (2.19511143e-15,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (3.99897850e-14,0.00000000e+00) + (1.94372268e-14,0.00000000e+00) (8.87379012e-14,0.00000000e+00) (-2.00225800e-16,0.00000000e+00) (-4.82800494e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) +Row 8 + (2.81949251e-03,0.00000000e+00) (-6.43490971e-03,0.00000000e+00) (8.82350908e-15,0.00000000e+00) (3.90639430e-16,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (3.48646871e-15,0.00000000e+00) (3.99811148e-14,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) + (-2.95713240e-03,0.00000000e+00) (-6.01477852e-15,0.00000000e+00) (7.65532958e-14,0.00000000e+00) (-5.12190356e-03,0.00000000e+00) (-1.35578742e-14,0.00000000e+00) +Row 9 + (1.56201274e-05,0.00000000e+00) (-7.86003624e-05,0.00000000e+00) (4.25031943e-14,0.00000000e+00) (-3.55697078e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-4.95563582e-14,0.00000000e+00) (1.94366264e-14,0.00000000e+00) (-2.95713240e-03,0.00000000e+00) + (-4.65236548e-05,0.00000000e+00) (1.16626602e-14,0.00000000e+00) (1.73085500e-14,0.00000000e+00) (-3.68932010e-05,0.00000000e+00) (-1.74201665e-14,0.00000000e+00) +Row 10 + (-3.16197577e-16,0.00000000e+00) (1.35147752e-14,0.00000000e+00) (-4.42397230e-14,0.00000000e+00) (1.08804715e-13,0.00000000e+00) (-2.26702853e-14,0.00000000e+00) (-2.89103908e-14,0.00000000e+00) (8.87385701e-14,0.00000000e+00) (-6.01670556e-15,0.00000000e+00) + (1.16662369e-14,0.00000000e+00) (-3.88972624e-05,0.00000000e+00) (2.14433035e-14,0.00000000e+00) (-3.48879586e-14,0.00000000e+00) (-1.48075176e-14,0.00000000e+00) +Row 11 + (2.23612213e-15,0.00000000e+00) (-1.49430564e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (-2.22431059e-14,0.00000000e+00) (7.60217469e-14,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-2.03885098e-16,0.00000000e+00) (7.65518084e-14,0.00000000e+00) + (1.73146215e-14,0.00000000e+00) (2.14571885e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (-8.23859748e-15,0.00000000e+00) (2.13972448e-14,0.00000000e+00) +Row 12 + (2.70548543e-05,0.00000000e+00) (-1.36139821e-04,0.00000000e+00) (1.62104327e-14,0.00000000e+00) (-2.42131771e-14,0.00000000e+00) (-3.03936164e-03,0.00000000e+00) (6.73546333e-15,0.00000000e+00) (-4.82802049e-14,0.00000000e+00) (-5.12190356e-03,0.00000000e+00) + (-3.68932010e-05,0.00000000e+00) (-3.48856592e-14,0.00000000e+00) (-8.23859748e-15,0.00000000e+00) (-8.91242540e-05,0.00000000e+00) (-2.06791129e-14,0.00000000e+00) +Row 13 + (3.20878225e-14,0.00000000e+00) (-1.04960364e-14,0.00000000e+00) (-2.20763028e-14,0.00000000e+00) (-8.48932644e-04,0.00000000e+00) (4.12131131e-14,0.00000000e+00) (-2.75448785e-16,0.00000000e+00) (1.05531374e-03,0.00000000e+00) (-1.35706673e-14,0.00000000e+00) + (-1.74175958e-14,0.00000000e+00) (-1.48075176e-14,0.00000000e+00) (2.13911759e-14,0.00000000e+00) (-2.06781608e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2z_ia1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2z_ia1_nao.txt new file mode 100644 index 00000000000..d45b5f741f9 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhk2z_ia1_nao.txt @@ -0,0 +1,48 @@ +#------------------------------------------------------------------------ +# ABACUS version: v3.11.0-beta13 +# Written at 2026-11-19 09:51:43 +# Ionic_Step 1 +# filename OUT.autotest/dhk2z_ia1_nao.txt +# gamma only 0 +# rows 13 +# columns 13 +#------------------------------------------------------------------------ +Row 1 + (-2.12014111e-05,0.00000000e+00) (6.78657513e-05,0.00000000e+00) (-1.77202938e-03,0.00000000e+00) (-8.08031640e-14,0.00000000e+00) (1.37940551e-14,0.00000000e+00) (-2.81949251e-03,0.00000000e+00) (-5.09778936e-14,0.00000000e+00) (-1.85108725e-14,0.00000000e+00) + (-3.12402549e-05,0.00000000e+00) (-2.84555513e-14,0.00000000e+00) (3.90774456e-14,0.00000000e+00) (1.11466204e-14,0.00000000e+00) (6.68587679e-14,0.00000000e+00) +Row 2 + (6.78657513e-05,0.00000000e+00) (-5.58007993e-04,0.00000000e+00) (-3.23220671e-03,0.00000000e+00) (-4.03286281e-14,0.00000000e+00) (-2.91423101e-14,0.00000000e+00) (6.43490971e-03,0.00000000e+00) (-2.49655167e-14,0.00000000e+00) (1.44213311e-14,0.00000000e+00) + (1.57200725e-04,0.00000000e+00) (-2.26468739e-14,0.00000000e+00) (-2.29411722e-15,0.00000000e+00) (-1.40385486e-14,0.00000000e+00) (3.01499664e-14,0.00000000e+00) +Row 3 + (-1.77202938e-03,0.00000000e+00) (-3.23220671e-03,0.00000000e+00) (-9.27165190e-05,0.00000000e+00) (-1.57560586e-14,0.00000000e+00) (2.67207383e-14,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (-1.19695038e-14,0.00000000e+00) (-1.67292344e-17,0.00000000e+00) + (-3.50955253e-03,0.00000000e+00) (-9.44418540e-14,0.00000000e+00) (5.82220528e-15,0.00000000e+00) (-3.61096288e-14,0.00000000e+00) (-7.75499481e-15,0.00000000e+00) +Row 4 + (-8.08183338e-14,0.00000000e+00) (-4.03252144e-14,0.00000000e+00) (-1.57543306e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (5.85750119e-14,0.00000000e+00) (-1.72175709e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.57355464e-14,0.00000000e+00) + (-5.41288775e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-7.87829176e-15,0.00000000e+00) (-3.86665416e-15,0.00000000e+00) (-2.12189831e-14,0.00000000e+00) +Row 5 + (1.37915141e-14,0.00000000e+00) (-2.91467013e-14,0.00000000e+00) (2.67185686e-14,0.00000000e+00) (5.85724086e-14,0.00000000e+00) (-2.79248491e-05,0.00000000e+00) (-1.25494589e-15,0.00000000e+00) (3.57730381e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) + (-1.38786279e-14,0.00000000e+00) (-7.80542367e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-4.97476984e-14,0.00000000e+00) (-7.64121737e-14,0.00000000e+00) +Row 6 + (-2.81949251e-03,0.00000000e+00) (6.43490971e-03,0.00000000e+00) (3.01710867e-04,0.00000000e+00) (-1.72165585e-14,0.00000000e+00) (-1.25633494e-15,0.00000000e+00) (-1.08981590e-03,0.00000000e+00) (-1.83894573e-14,0.00000000e+00) (9.52347937e-15,0.00000000e+00) + (-5.91426480e-03,0.00000000e+00) (-4.69291426e-14,0.00000000e+00) (-1.19484762e-14,0.00000000e+00) (-2.48194009e-14,0.00000000e+00) (-1.97031327e-14,0.00000000e+00) +Row 7 + (-5.09627251e-14,0.00000000e+00) (-2.49828704e-14,0.00000000e+00) (-1.19700066e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (3.57771535e-14,0.00000000e+00) (-1.83904254e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) (2.90207277e-14,0.00000000e+00) + (-5.22871372e-15,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.94550224e-14,0.00000000e+00) (1.45536091e-14,0.00000000e+00) (-6.47167010e-14,0.00000000e+00) +Row 8 + (-1.85078202e-14,0.00000000e+00) (1.44211011e-14,0.00000000e+00) (-2.30538309e-17,0.00000000e+00) (3.57359781e-14,0.00000000e+00) (1.10985999e-04,0.00000000e+00) (9.51966921e-15,0.00000000e+00) (2.90211605e-14,0.00000000e+00) (-3.72110795e-04,0.00000000e+00) + (2.33289363e-14,0.00000000e+00) (-1.95270105e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.24652770e-14,0.00000000e+00) (-6.39655915e-14,0.00000000e+00) +Row 9 + (-3.12402549e-05,0.00000000e+00) (1.57200725e-04,0.00000000e+00) (-3.50955253e-03,0.00000000e+00) (-5.40930649e-15,0.00000000e+00) (-1.38807903e-14,0.00000000e+00) (-5.91426480e-03,0.00000000e+00) (-5.23001074e-15,0.00000000e+00) (2.33313191e-14,0.00000000e+00) + (-1.10424554e-04,0.00000000e+00) (-2.67032037e-14,0.00000000e+00) (3.44823311e-14,0.00000000e+00) (2.69991478e-14,0.00000000e+00) (-5.58165788e-14,0.00000000e+00) +Row 10 + (-2.84894350e-14,0.00000000e+00) (-2.26391820e-14,0.00000000e+00) (-9.44757073e-14,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-7.78810551e-15,0.00000000e+00) (-4.69258523e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) (-1.95296808e-14,0.00000000e+00) + (-2.66897214e-14,0.00000000e+00) (-9.79258109e-05,0.00000000e+00) (8.01907040e-15,0.00000000e+00) (-9.65751124e-15,0.00000000e+00) (7.45000764e-15,0.00000000e+00) +Row 11 + (3.90804237e-14,0.00000000e+00) (-2.28476777e-15,0.00000000e+00) (5.82283209e-15,0.00000000e+00) (-7.87138247e-15,0.00000000e+00) (8.48932644e-04,0.00000000e+00) (-1.19494603e-14,0.00000000e+00) (-1.94529202e-14,0.00000000e+00) (-1.05531374e-03,0.00000000e+00) + (3.44839990e-14,0.00000000e+00) (8.01560334e-15,0.00000000e+00) (-9.79258110e-05,0.00000000e+00) (-2.24621910e-14,0.00000000e+00) (-5.95474529e-15,0.00000000e+00) +Row 12 + (1.11476314e-14,0.00000000e+00) (-1.40378560e-14,0.00000000e+00) (-3.61089586e-14,0.00000000e+00) (-3.86190813e-15,0.00000000e+00) (-4.97399168e-14,0.00000000e+00) (-2.48246673e-14,0.00000000e+00) (1.45602271e-14,0.00000000e+00) (-1.24608279e-14,0.00000000e+00) + (2.70037655e-14,0.00000000e+00) (-9.65290714e-15,0.00000000e+00) (-2.24542151e-14,0.00000000e+00) (-2.52233552e-05,0.00000000e+00) (-1.09820215e-14,0.00000000e+00) +Row 13 + (6.68609398e-14,0.00000000e+00) (3.01564618e-14,0.00000000e+00) (-7.75846004e-15,0.00000000e+00) (-2.12185561e-14,0.00000000e+00) (-7.64362480e-14,0.00000000e+00) (-1.97047988e-14,0.00000000e+00) (-6.47190645e-14,0.00000000e+00) (-6.39670719e-14,0.00000000e+00) + (-5.58166771e-14,0.00000000e+00) (7.44566729e-15,0.00000000e+00) (-5.95213351e-15,0.00000000e+00) (-1.09796435e-14,0.00000000e+00) (-3.88972625e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik0_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik0_nao.txt deleted file mode 100644 index d129d25c25f..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik0_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhkx_iat1_ik0_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657495e-05,0.00000000e+00) (8.79654770e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (4.15620084e-14,0.00000000e+00) (-5.19886776e-14,0.00000000e+00) (2.81949250e-03,0.00000000e+00) (2.15445575e-14,0.00000000e+00) - (1.56201271e-05,0.00000000e+00) (-1.83405157e-14,0.00000000e+00) (1.95637089e-15,0.00000000e+00) (-2.70548538e-05,0.00000000e+00) (3.98920510e-14,0.00000000e+00) -Row 2 - (6.78657495e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-3.09705867e-16,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (2.32821739e-14,0.00000000e+00) (3.40736296e-14,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (2.29408421e-14,0.00000000e+00) - (-7.86003601e-05,0.00000000e+00) (-1.68086399e-14,0.00000000e+00) (-5.22180435e-15,0.00000000e+00) (1.36139817e-04,0.00000000e+00) (3.47519307e-14,0.00000000e+00) -Row 3 - (8.79732883e-14,0.00000000e+00) (-3.12953398e-16,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (6.82547444e-15,0.00000000e+00) (5.26282945e-15,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (1.57241056e-14,0.00000000e+00) (3.66822674e-15,0.00000000e+00) - (9.32250679e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (6.27703986e-14,0.00000000e+00) (6.49640463e-14,0.00000000e+00) (-9.91436793e-15,0.00000000e+00) -Row 4 - (1.77202938e-03,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (6.76996328e-15,0.00000000e+00) (-9.27165166e-05,0.00000000e+00) (4.23672970e-14,0.00000000e+00) (1.27628687e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (3.87471249e-14,0.00000000e+00) - (-1.75477626e-03,0.00000000e+00) (1.60386675e-13,0.00000000e+00) (-1.11564258e-14,0.00000000e+00) (3.03936165e-03,0.00000000e+00) (2.91123053e-14,0.00000000e+00) -Row 5 - (4.15756689e-14,0.00000000e+00) (2.32808977e-14,0.00000000e+00) (5.26413474e-15,0.00000000e+00) (4.23735856e-14,0.00000000e+00) (-2.79248484e-05,0.00000000e+00) (3.64350148e-15,0.00000000e+00) (3.82652719e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) - (1.18296807e-14,0.00000000e+00) (-9.91608116e-15,0.00000000e+00) (2.08025812e-14,0.00000000e+00) (-1.31341781e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) -Row 6 - (-5.20085115e-14,0.00000000e+00) (3.40727688e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (1.27507256e-14,0.00000000e+00) (3.64175945e-15,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (5.78570414e-14,0.00000000e+00) (-1.98433323e-15,0.00000000e+00) - (2.63350923e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (2.93804367e-14,0.00000000e+00) (4.54991625e-14,0.00000000e+00) (-9.95880085e-15,0.00000000e+00) -Row 7 - (2.81949250e-03,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (1.57084931e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (3.82641885e-14,0.00000000e+00) (5.78605108e-14,0.00000000e+00) (-1.08981586e-03,0.00000000e+00) (1.54452017e-14,0.00000000e+00) - (-2.95713239e-03,0.00000000e+00) (-1.88601150e-14,0.00000000e+00) (-9.97573301e-15,0.00000000e+00) (5.12190355e-03,0.00000000e+00) (5.92208811e-14,0.00000000e+00) -Row 8 - (2.15417097e-14,0.00000000e+00) (2.29389867e-14,0.00000000e+00) (3.66714563e-15,0.00000000e+00) (3.87553688e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-1.98477507e-15,0.00000000e+00) (1.54449776e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) - (-3.86237634e-16,0.00000000e+00) (-9.88008200e-15,0.00000000e+00) (-1.07054871e-13,0.00000000e+00) (3.02189316e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) -Row 9 - (1.56201271e-05,0.00000000e+00) (-7.86003601e-05,0.00000000e+00) (9.32141058e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (1.18278390e-14,0.00000000e+00) (2.63354912e-14,0.00000000e+00) (-2.95713239e-03,0.00000000e+00) (-3.85201923e-16,0.00000000e+00) - (-4.65236538e-05,0.00000000e+00) (2.21976437e-14,0.00000000e+00) (6.76954718e-15,0.00000000e+00) (3.68932002e-05,0.00000000e+00) (-2.80132707e-14,0.00000000e+00) -Row 10 - (-1.83405157e-14,0.00000000e+00) (-1.67883111e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (1.60426457e-13,0.00000000e+00) (-9.91326414e-15,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-1.88672912e-14,0.00000000e+00) (-9.87767108e-15,0.00000000e+00) - (2.21989447e-14,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (8.89757349e-15,0.00000000e+00) (1.99168825e-15,0.00000000e+00) (3.42093329e-14,0.00000000e+00) -Row 11 - (1.95506489e-15,0.00000000e+00) (-5.22156869e-15,0.00000000e+00) (6.27798890e-14,0.00000000e+00) (-1.11475367e-14,0.00000000e+00) (2.08017121e-14,0.00000000e+00) (2.93769772e-14,0.00000000e+00) (-9.97592568e-15,0.00000000e+00) (-1.07054624e-13,0.00000000e+00) - (6.76459268e-15,0.00000000e+00) (8.89497042e-15,0.00000000e+00) (-3.88972620e-05,0.00000000e+00) (2.84733783e-14,0.00000000e+00) (-3.83674205e-14,0.00000000e+00) -Row 12 - (-2.70548538e-05,0.00000000e+00) (1.36139817e-04,0.00000000e+00) (6.49649387e-14,0.00000000e+00) (3.03936165e-03,0.00000000e+00) (-1.31256144e-14,0.00000000e+00) (4.55005737e-14,0.00000000e+00) (5.12190355e-03,0.00000000e+00) (3.02195507e-14,0.00000000e+00) - (3.68932002e-05,0.00000000e+00) (2.03332162e-15,0.00000000e+00) (2.84788534e-14,0.00000000e+00) (-8.91242520e-05,0.00000000e+00) (-1.98324255e-15,0.00000000e+00) -Row 13 - (3.98780503e-14,0.00000000e+00) (3.47506112e-14,0.00000000e+00) (-9.91416699e-15,0.00000000e+00) (2.91395732e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-9.95748568e-15,0.00000000e+00) (5.92308557e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) - (-2.80053639e-14,0.00000000e+00) (3.41940026e-14,0.00000000e+00) (-3.83535427e-14,0.00000000e+00) (-1.97656097e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik1_nao.txt deleted file mode 100644 index 2c2b4c64d33..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkx_iat1_ik1_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhkx_iat1_ik1_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657495e-05,0.00000000e+00) (8.79654770e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (4.15620084e-14,0.00000000e+00) (-5.19886776e-14,0.00000000e+00) (2.81949250e-03,0.00000000e+00) (2.15445575e-14,0.00000000e+00) - (1.56201271e-05,0.00000000e+00) (-1.83405157e-14,0.00000000e+00) (1.95637089e-15,0.00000000e+00) (-2.70548538e-05,0.00000000e+00) (3.98920510e-14,0.00000000e+00) -Row 2 - (6.78657495e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-3.09705867e-16,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (2.32821739e-14,0.00000000e+00) (3.40736296e-14,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (2.29408421e-14,0.00000000e+00) - (-7.86003601e-05,0.00000000e+00) (-1.68086399e-14,0.00000000e+00) (-5.22180435e-15,0.00000000e+00) (1.36139817e-04,0.00000000e+00) (3.47519307e-14,0.00000000e+00) -Row 3 - (8.79732883e-14,0.00000000e+00) (-3.12953398e-16,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (6.82547444e-15,0.00000000e+00) (5.26282945e-15,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (1.57241056e-14,0.00000000e+00) (3.66822674e-15,0.00000000e+00) - (9.32250679e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (6.27703986e-14,0.00000000e+00) (6.49640463e-14,0.00000000e+00) (-9.91436793e-15,0.00000000e+00) -Row 4 - (1.77202938e-03,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (6.76996328e-15,0.00000000e+00) (-9.27165166e-05,0.00000000e+00) (4.23672970e-14,0.00000000e+00) (1.27628687e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (3.87471249e-14,0.00000000e+00) - (-1.75477626e-03,0.00000000e+00) (1.60386675e-13,0.00000000e+00) (-1.11564258e-14,0.00000000e+00) (3.03936165e-03,0.00000000e+00) (2.91123053e-14,0.00000000e+00) -Row 5 - (4.15756689e-14,0.00000000e+00) (2.32808977e-14,0.00000000e+00) (5.26413474e-15,0.00000000e+00) (4.23735856e-14,0.00000000e+00) (-2.79248484e-05,0.00000000e+00) (3.64350148e-15,0.00000000e+00) (3.82652719e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) - (1.18296807e-14,0.00000000e+00) (-9.91608116e-15,0.00000000e+00) (2.08025812e-14,0.00000000e+00) (-1.31341781e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) -Row 6 - (-5.20085115e-14,0.00000000e+00) (3.40727688e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (1.27507256e-14,0.00000000e+00) (3.64175945e-15,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (5.78570414e-14,0.00000000e+00) (-1.98433323e-15,0.00000000e+00) - (2.63350923e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (2.93804367e-14,0.00000000e+00) (4.54991625e-14,0.00000000e+00) (-9.95880085e-15,0.00000000e+00) -Row 7 - (2.81949250e-03,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (1.57084931e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (3.82641885e-14,0.00000000e+00) (5.78605108e-14,0.00000000e+00) (-1.08981586e-03,0.00000000e+00) (1.54452017e-14,0.00000000e+00) - (-2.95713239e-03,0.00000000e+00) (-1.88601150e-14,0.00000000e+00) (-9.97573301e-15,0.00000000e+00) (5.12190355e-03,0.00000000e+00) (5.92208811e-14,0.00000000e+00) -Row 8 - (2.15417097e-14,0.00000000e+00) (2.29389867e-14,0.00000000e+00) (3.66714563e-15,0.00000000e+00) (3.87553688e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-1.98477507e-15,0.00000000e+00) (1.54449776e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) - (-3.86237634e-16,0.00000000e+00) (-9.88008200e-15,0.00000000e+00) (-1.07054871e-13,0.00000000e+00) (3.02189316e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) -Row 9 - (1.56201271e-05,0.00000000e+00) (-7.86003601e-05,0.00000000e+00) (9.32141058e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (1.18278390e-14,0.00000000e+00) (2.63354912e-14,0.00000000e+00) (-2.95713239e-03,0.00000000e+00) (-3.85201923e-16,0.00000000e+00) - (-4.65236538e-05,0.00000000e+00) (2.21976437e-14,0.00000000e+00) (6.76954718e-15,0.00000000e+00) (3.68932002e-05,0.00000000e+00) (-2.80132707e-14,0.00000000e+00) -Row 10 - (-1.83405157e-14,0.00000000e+00) (-1.67883111e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (1.60426457e-13,0.00000000e+00) (-9.91326414e-15,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-1.88672912e-14,0.00000000e+00) (-9.87767108e-15,0.00000000e+00) - (2.21989447e-14,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (8.89757349e-15,0.00000000e+00) (1.99168825e-15,0.00000000e+00) (3.42093329e-14,0.00000000e+00) -Row 11 - (1.95506489e-15,0.00000000e+00) (-5.22156869e-15,0.00000000e+00) (6.27798890e-14,0.00000000e+00) (-1.11475367e-14,0.00000000e+00) (2.08017121e-14,0.00000000e+00) (2.93769772e-14,0.00000000e+00) (-9.97592568e-15,0.00000000e+00) (-1.07054624e-13,0.00000000e+00) - (6.76459268e-15,0.00000000e+00) (8.89497042e-15,0.00000000e+00) (-3.88972620e-05,0.00000000e+00) (2.84733783e-14,0.00000000e+00) (-3.83674205e-14,0.00000000e+00) -Row 12 - (-2.70548538e-05,0.00000000e+00) (1.36139817e-04,0.00000000e+00) (6.49649387e-14,0.00000000e+00) (3.03936165e-03,0.00000000e+00) (-1.31256144e-14,0.00000000e+00) (4.55005737e-14,0.00000000e+00) (5.12190355e-03,0.00000000e+00) (3.02195507e-14,0.00000000e+00) - (3.68932002e-05,0.00000000e+00) (2.03332162e-15,0.00000000e+00) (2.84788534e-14,0.00000000e+00) (-8.91242520e-05,0.00000000e+00) (-1.98324255e-15,0.00000000e+00) -Row 13 - (3.98780503e-14,0.00000000e+00) (3.47506112e-14,0.00000000e+00) (-9.91416699e-15,0.00000000e+00) (2.91395732e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-9.95748568e-15,0.00000000e+00) (5.92308557e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) - (-2.80053639e-14,0.00000000e+00) (3.41940026e-14,0.00000000e+00) (-3.83535427e-14,0.00000000e+00) (-1.97656097e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik0_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik0_nao.txt deleted file mode 100644 index e68c7377b13..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik0_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhky_iat1_ik0_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657494e-05,0.00000000e+00) (1.57869153e-14,0.00000000e+00) (4.78232795e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (8.29183237e-15,0.00000000e+00) (2.20545466e-14,0.00000000e+00) (2.81949250e-03,0.00000000e+00) - (1.56201271e-05,0.00000000e+00) (2.85067194e-14,0.00000000e+00) (3.63349882e-14,0.00000000e+00) (2.70548538e-05,0.00000000e+00) (6.80914500e-14,0.00000000e+00) -Row 2 - (6.78657494e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-1.36953965e-14,0.00000000e+00) (7.10687312e-15,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (3.27736418e-14,0.00000000e+00) (2.31128242e-14,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) - (-7.86003602e-05,0.00000000e+00) (1.96686760e-14,0.00000000e+00) (-1.37459921e-14,0.00000000e+00) (-1.36139817e-04,0.00000000e+00) (3.78960916e-14,0.00000000e+00) -Row 3 - (1.57660978e-14,0.00000000e+00) (-1.37003256e-14,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (2.74066543e-14,0.00000000e+00) (4.80671401e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (2.40387146e-14,0.00000000e+00) (1.51703866e-14,0.00000000e+00) - (-2.03849711e-14,0.00000000e+00) (9.60051902e-15,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-2.29572212e-14,0.00000000e+00) (-1.87951655e-14,0.00000000e+00) -Row 4 - (4.78332144e-14,0.00000000e+00) (7.10559370e-15,0.00000000e+00) (2.74032141e-14,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (8.08361166e-14,0.00000000e+00) (2.40126874e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (6.63190299e-14,0.00000000e+00) - (-3.41365455e-14,0.00000000e+00) (-7.69154599e-16,0.00000000e+00) (-1.87606140e-14,0.00000000e+00) (6.63184516e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) -Row 5 - (1.77202938e-03,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (4.80810179e-14,0.00000000e+00) (8.08083595e-14,0.00000000e+00) (-9.27165166e-05,0.00000000e+00) (8.21025930e-15,0.00000000e+00) (6.42421375e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) - (-1.75477626e-03,0.00000000e+00) (-1.83594646e-14,0.00000000e+00) (4.47754364e-14,0.00000000e+00) (-3.03936165e-03,0.00000000e+00) (1.54907931e-15,0.00000000e+00) -Row 6 - (8.29026842e-15,0.00000000e+00) (3.27724667e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (2.40150703e-14,0.00000000e+00) (8.21893292e-15,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (2.16135607e-14,0.00000000e+00) (7.56214101e-14,0.00000000e+00) - (-1.55386300e-14,0.00000000e+00) (-7.85670055e-15,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-2.69990298e-15,0.00000000e+00) (-1.04644244e-14,0.00000000e+00) -Row 7 - (2.20627883e-14,0.00000000e+00) (2.31155275e-14,0.00000000e+00) (2.40410776e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (6.42421415e-14,0.00000000e+00) (2.16122649e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (6.82864416e-14,0.00000000e+00) - (-1.47095302e-14,0.00000000e+00) (-9.65581502e-15,0.00000000e+00) (-1.07314225e-14,0.00000000e+00) (1.56353387e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) -Row 8 - (2.81949250e-03,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (1.51669171e-14,0.00000000e+00) (6.63162137e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (7.56179407e-14,0.00000000e+00) (6.82743161e-14,0.00000000e+00) (-1.08981586e-03,0.00000000e+00) - (-2.95713239e-03,0.00000000e+00) (-1.54210558e-14,0.00000000e+00) (-3.47195255e-15,0.00000000e+00) (-5.12190355e-03,0.00000000e+00) (2.73720832e-15,0.00000000e+00) -Row 9 - (1.56201271e-05,0.00000000e+00) (-7.86003602e-05,0.00000000e+00) (-2.03851195e-14,0.00000000e+00) (-3.41392753e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-1.55368326e-14,0.00000000e+00) (-1.47109558e-14,0.00000000e+00) (-2.95713239e-03,0.00000000e+00) - (-4.65236539e-05,0.00000000e+00) (-6.18797399e-16,0.00000000e+00) (4.14371211e-14,0.00000000e+00) (-3.68932002e-05,0.00000000e+00) (-4.27153087e-14,0.00000000e+00) -Row 10 - (2.85054040e-14,0.00000000e+00) (1.96667390e-14,0.00000000e+00) (9.59763895e-15,0.00000000e+00) (-7.61348211e-16,0.00000000e+00) (-1.83566469e-14,0.00000000e+00) (-7.85941504e-15,0.00000000e+00) (-9.65190987e-15,0.00000000e+00) (-1.54264797e-14,0.00000000e+00) - (-6.19266735e-16,0.00000000e+00) (-3.88972620e-05,0.00000000e+00) (1.85575729e-14,0.00000000e+00) (2.16499781e-14,0.00000000e+00) (1.72162187e-14,0.00000000e+00) -Row 11 - (3.63488660e-14,0.00000000e+00) (-1.37494615e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-1.87638672e-14,0.00000000e+00) (4.47535354e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-1.07357495e-14,0.00000000e+00) (-3.46566110e-15,0.00000000e+00) - (4.14410243e-14,0.00000000e+00) (1.85575733e-14,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (-1.03468302e-14,0.00000000e+00) (6.61519338e-15,0.00000000e+00) -Row 12 - (2.70548538e-05,0.00000000e+00) (-1.36139817e-04,0.00000000e+00) (-2.29539737e-14,0.00000000e+00) (6.63235413e-14,0.00000000e+00) (-3.03936165e-03,0.00000000e+00) (-2.69602221e-15,0.00000000e+00) (1.56350787e-14,0.00000000e+00) (-5.12190355e-03,0.00000000e+00) - (-3.68932002e-05,0.00000000e+00) (2.16538737e-14,0.00000000e+00) (-1.03745858e-14,0.00000000e+00) (-8.91242520e-05,0.00000000e+00) (5.30214959e-15,0.00000000e+00) -Row 13 - (6.80583959e-14,0.00000000e+00) (3.79173485e-14,0.00000000e+00) (-1.87913745e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (1.55258014e-15,0.00000000e+00) (-1.04544427e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (2.73308523e-15,0.00000000e+00) - (-4.27190172e-14,0.00000000e+00) (1.72023409e-14,0.00000000e+00) (6.63125378e-15,0.00000000e+00) (5.33267008e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik1_nao.txt deleted file mode 100644 index 04800ef27cd..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhky_iat1_ik1_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhky_iat1_ik1_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657494e-05,0.00000000e+00) (1.57869153e-14,0.00000000e+00) (4.78232795e-14,0.00000000e+00) (1.77202938e-03,0.00000000e+00) (8.29183237e-15,0.00000000e+00) (2.20545466e-14,0.00000000e+00) (2.81949250e-03,0.00000000e+00) - (1.56201271e-05,0.00000000e+00) (2.85067194e-14,0.00000000e+00) (3.63349882e-14,0.00000000e+00) (2.70548538e-05,0.00000000e+00) (6.80914500e-14,0.00000000e+00) -Row 2 - (6.78657494e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-1.36953965e-14,0.00000000e+00) (7.10687312e-15,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (3.27736418e-14,0.00000000e+00) (2.31128242e-14,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) - (-7.86003602e-05,0.00000000e+00) (1.96686760e-14,0.00000000e+00) (-1.37459921e-14,0.00000000e+00) (-1.36139817e-04,0.00000000e+00) (3.78960916e-14,0.00000000e+00) -Row 3 - (1.57660978e-14,0.00000000e+00) (-1.37003256e-14,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (2.74066543e-14,0.00000000e+00) (4.80671401e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (2.40387146e-14,0.00000000e+00) (1.51703866e-14,0.00000000e+00) - (-2.03849711e-14,0.00000000e+00) (9.60051902e-15,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-2.29572212e-14,0.00000000e+00) (-1.87951655e-14,0.00000000e+00) -Row 4 - (4.78332144e-14,0.00000000e+00) (7.10559370e-15,0.00000000e+00) (2.74032141e-14,0.00000000e+00) (-2.79248486e-05,0.00000000e+00) (8.08361166e-14,0.00000000e+00) (2.40126874e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (6.63190299e-14,0.00000000e+00) - (-3.41365455e-14,0.00000000e+00) (-7.69154599e-16,0.00000000e+00) (-1.87606140e-14,0.00000000e+00) (6.63184516e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) -Row 5 - (1.77202938e-03,0.00000000e+00) (3.23220670e-03,0.00000000e+00) (4.80810179e-14,0.00000000e+00) (8.08083595e-14,0.00000000e+00) (-9.27165166e-05,0.00000000e+00) (8.21025930e-15,0.00000000e+00) (6.42421375e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) - (-1.75477626e-03,0.00000000e+00) (-1.83594646e-14,0.00000000e+00) (4.47754364e-14,0.00000000e+00) (-3.03936165e-03,0.00000000e+00) (1.54907931e-15,0.00000000e+00) -Row 6 - (8.29026842e-15,0.00000000e+00) (3.27724667e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (2.40150703e-14,0.00000000e+00) (8.21893292e-15,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (2.16135607e-14,0.00000000e+00) (7.56214101e-14,0.00000000e+00) - (-1.55386300e-14,0.00000000e+00) (-7.85670055e-15,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-2.69990298e-15,0.00000000e+00) (-1.04644244e-14,0.00000000e+00) -Row 7 - (2.20627883e-14,0.00000000e+00) (2.31155275e-14,0.00000000e+00) (2.40410776e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (6.42421415e-14,0.00000000e+00) (2.16122649e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (6.82864416e-14,0.00000000e+00) - (-1.47095302e-14,0.00000000e+00) (-9.65581502e-15,0.00000000e+00) (-1.07314225e-14,0.00000000e+00) (1.56353387e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) -Row 8 - (2.81949250e-03,0.00000000e+00) (-6.43490967e-03,0.00000000e+00) (1.51669171e-14,0.00000000e+00) (6.63162137e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (7.56179407e-14,0.00000000e+00) (6.82743161e-14,0.00000000e+00) (-1.08981586e-03,0.00000000e+00) - (-2.95713239e-03,0.00000000e+00) (-1.54210558e-14,0.00000000e+00) (-3.47195255e-15,0.00000000e+00) (-5.12190355e-03,0.00000000e+00) (2.73720832e-15,0.00000000e+00) -Row 9 - (1.56201271e-05,0.00000000e+00) (-7.86003602e-05,0.00000000e+00) (-2.03851195e-14,0.00000000e+00) (-3.41392753e-14,0.00000000e+00) (-1.75477626e-03,0.00000000e+00) (-1.55368326e-14,0.00000000e+00) (-1.47109558e-14,0.00000000e+00) (-2.95713239e-03,0.00000000e+00) - (-4.65236539e-05,0.00000000e+00) (-6.18797399e-16,0.00000000e+00) (4.14371211e-14,0.00000000e+00) (-3.68932002e-05,0.00000000e+00) (-4.27153087e-14,0.00000000e+00) -Row 10 - (2.85054040e-14,0.00000000e+00) (1.96667390e-14,0.00000000e+00) (9.59763895e-15,0.00000000e+00) (-7.61348211e-16,0.00000000e+00) (-1.83566469e-14,0.00000000e+00) (-7.85941504e-15,0.00000000e+00) (-9.65190987e-15,0.00000000e+00) (-1.54264797e-14,0.00000000e+00) - (-6.19266735e-16,0.00000000e+00) (-3.88972620e-05,0.00000000e+00) (1.85575729e-14,0.00000000e+00) (2.16499781e-14,0.00000000e+00) (1.72162187e-14,0.00000000e+00) -Row 11 - (3.63488660e-14,0.00000000e+00) (-1.37494615e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (-1.87638672e-14,0.00000000e+00) (4.47535354e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (-1.07357495e-14,0.00000000e+00) (-3.46566110e-15,0.00000000e+00) - (4.14410243e-14,0.00000000e+00) (1.85575733e-14,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (-1.03468302e-14,0.00000000e+00) (6.61519338e-15,0.00000000e+00) -Row 12 - (2.70548538e-05,0.00000000e+00) (-1.36139817e-04,0.00000000e+00) (-2.29539737e-14,0.00000000e+00) (6.63235413e-14,0.00000000e+00) (-3.03936165e-03,0.00000000e+00) (-2.69602221e-15,0.00000000e+00) (1.56350787e-14,0.00000000e+00) (-5.12190355e-03,0.00000000e+00) - (-3.68932002e-05,0.00000000e+00) (2.16538737e-14,0.00000000e+00) (-1.03745858e-14,0.00000000e+00) (-8.91242520e-05,0.00000000e+00) (5.30214959e-15,0.00000000e+00) -Row 13 - (6.80583959e-14,0.00000000e+00) (3.79173485e-14,0.00000000e+00) (-1.87913745e-14,0.00000000e+00) (-8.48932642e-04,0.00000000e+00) (1.55258014e-15,0.00000000e+00) (-1.04544427e-14,0.00000000e+00) (1.05531373e-03,0.00000000e+00) (2.73308523e-15,0.00000000e+00) - (-4.27190172e-14,0.00000000e+00) (1.72023409e-14,0.00000000e+00) (6.63125378e-15,0.00000000e+00) (5.33267008e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik0_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik0_nao.txt deleted file mode 100644 index a46897ab5e5..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik0_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhkz_iat1_ik0_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657495e-05,0.00000000e+00) (-1.77202938e-03,0.00000000e+00) (-1.38235214e-13,0.00000000e+00) (5.84660998e-14,0.00000000e+00) (-2.81949250e-03,0.00000000e+00) (-4.39632119e-14,0.00000000e+00) (4.21157100e-14,0.00000000e+00) - (-3.12402544e-05,0.00000000e+00) (-3.41210200e-14,0.00000000e+00) (-1.91216362e-15,0.00000000e+00) (6.61929470e-15,0.00000000e+00) (2.41000807e-15,0.00000000e+00) -Row 2 - (6.78657495e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-3.23220670e-03,0.00000000e+00) (-5.17690656e-14,0.00000000e+00) (3.89683416e-14,0.00000000e+00) (6.43490967e-03,0.00000000e+00) (-7.81224441e-14,0.00000000e+00) (2.39568236e-14,0.00000000e+00) - (1.57200720e-04,0.00000000e+00) (-1.88859894e-14,0.00000000e+00) (8.42987928e-15,0.00000000e+00) (2.38084860e-14,0.00000000e+00) (1.22441364e-14,0.00000000e+00) -Row 3 - (-1.77202938e-03,0.00000000e+00) (-3.23220670e-03,0.00000000e+00) (-9.27165169e-05,0.00000000e+00) (5.20419725e-15,0.00000000e+00) (1.32908455e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (2.58381067e-14,0.00000000e+00) (3.15729434e-14,0.00000000e+00) - (-3.50955253e-03,0.00000000e+00) (-1.62740768e-13,0.00000000e+00) (8.62095381e-14,0.00000000e+00) (-4.37794660e-14,0.00000000e+00) (-1.39388282e-15,0.00000000e+00) -Row 4 - (-1.38235266e-13,0.00000000e+00) (-5.17748790e-14,0.00000000e+00) (5.20441044e-15,0.00000000e+00) (-2.79248483e-05,0.00000000e+00) (-1.84416834e-14,0.00000000e+00) (2.02908422e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-2.72176602e-14,0.00000000e+00) - (1.21717586e-14,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-1.20701456e-15,0.00000000e+00) (-1.10401155e-13,0.00000000e+00) (4.60350165e-14,0.00000000e+00) -Row 5 - (5.84521669e-14,0.00000000e+00) (3.89730566e-14,0.00000000e+00) (1.32927981e-14,0.00000000e+00) (-1.84416799e-14,0.00000000e+00) (-2.79248483e-05,0.00000000e+00) (2.94067025e-14,0.00000000e+00) (-2.72236756e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) - (1.88742423e-14,0.00000000e+00) (-1.22436428e-15,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-6.33415118e-15,0.00000000e+00) (-6.95777379e-14,0.00000000e+00) -Row 6 - (-2.81949250e-03,0.00000000e+00) (6.43490967e-03,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (2.02921933e-14,0.00000000e+00) (2.94208414e-14,0.00000000e+00) (-1.08981587e-03,0.00000000e+00) (3.66377855e-14,0.00000000e+00) (3.02731359e-14,0.00000000e+00) - (-5.91426479e-03,0.00000000e+00) (-6.55650833e-14,0.00000000e+00) (5.68611158e-14,0.00000000e+00) (-2.84127739e-14,0.00000000e+00) (1.20936520e-14,0.00000000e+00) -Row 7 - (-4.39688443e-14,0.00000000e+00) (-7.81215576e-14,0.00000000e+00) (2.58397310e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-2.72244219e-14,0.00000000e+00) (3.66326164e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (-4.27292179e-14,0.00000000e+00) - (-2.31294355e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.25053413e-14,0.00000000e+00) (-3.76629239e-14,0.00000000e+00) (5.83509879e-14,0.00000000e+00) -Row 8 - (4.21213211e-14,0.00000000e+00) (2.39575597e-14,0.00000000e+00) (3.15740136e-14,0.00000000e+00) (-2.72225363e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (3.02791759e-14,0.00000000e+00) (-4.27302968e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) - (8.30635045e-15,0.00000000e+00) (1.25335213e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.57357491e-14,0.00000000e+00) (2.46788849e-15,0.00000000e+00) -Row 9 - (-3.12402544e-05,0.00000000e+00) (1.57200720e-04,0.00000000e+00) (-3.50955253e-03,0.00000000e+00) (1.21876918e-14,0.00000000e+00) (1.88886348e-14,0.00000000e+00) (-5.91426479e-03,0.00000000e+00) (-2.31292795e-14,0.00000000e+00) (8.30713628e-15,0.00000000e+00) - (-1.10424551e-04,0.00000000e+00) (1.28404791e-15,0.00000000e+00) (2.86899195e-14,0.00000000e+00) (2.13490588e-14,0.00000000e+00) (2.18024425e-14,0.00000000e+00) -Row 10 - (-3.41080047e-14,0.00000000e+00) (-1.88728353e-14,0.00000000e+00) (-1.62711618e-13,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-1.22457389e-15,0.00000000e+00) (-6.55806808e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.25348227e-14,0.00000000e+00) - (1.25775246e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (2.99960024e-14,0.00000000e+00) (-1.88992134e-14,0.00000000e+00) (1.66626425e-14,0.00000000e+00) -Row 11 - (-1.91476280e-15,0.00000000e+00) (8.43114019e-15,0.00000000e+00) (8.62004290e-14,0.00000000e+00) (-1.21243390e-15,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (5.68653927e-14,0.00000000e+00) (1.25036040e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) - (2.86946300e-14,0.00000000e+00) (2.99960025e-14,0.00000000e+00) (-9.79258090e-05,0.00000000e+00) (3.77866689e-14,0.00000000e+00) (-2.73066435e-14,0.00000000e+00) -Row 12 - (6.60825742e-15,0.00000000e+00) (2.38133840e-14,0.00000000e+00) (-4.37722201e-14,0.00000000e+00) (-1.10390954e-13,0.00000000e+00) (-6.32902385e-15,0.00000000e+00) (-2.84110419e-14,0.00000000e+00) (-3.76615609e-14,0.00000000e+00) (1.57379179e-14,0.00000000e+00) - (2.13536729e-14,0.00000000e+00) (-1.88906038e-14,0.00000000e+00) (3.77893332e-14,0.00000000e+00) (-2.52233548e-05,0.00000000e+00) (9.49432437e-15,0.00000000e+00) -Row 13 - (2.40041166e-15,0.00000000e+00) (1.22441637e-14,0.00000000e+00) (-1.39148468e-15,0.00000000e+00) (4.60246738e-14,0.00000000e+00) (-6.96033152e-14,0.00000000e+00) (1.20952654e-14,0.00000000e+00) (5.83616033e-14,0.00000000e+00) (2.46310424e-15,0.00000000e+00) - (2.18034760e-14,0.00000000e+00) (1.66474590e-14,0.00000000e+00) (-2.73018569e-14,0.00000000e+00) (9.49328530e-15,0.00000000e+00) (-3.88972618e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik1_nao.txt b/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik1_nao.txt deleted file mode 100644 index 24fb0022cd5..00000000000 --- a/tests/03_NAO_multik/scf_out_dh_t/dhk_ref/dhkz_iat1_ik1_nao.txt +++ /dev/null @@ -1,46 +0,0 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/dhkz_iat1_ik1_nao.txt -# gamma only 0 -# rows 13 -# columns 13 -#------------------------------------------------------------------------ -Row 1 - (-2.12014109e-05,0.00000000e+00) (6.78657495e-05,0.00000000e+00) (-1.77202938e-03,0.00000000e+00) (-1.38235214e-13,0.00000000e+00) (5.84660998e-14,0.00000000e+00) (-2.81949250e-03,0.00000000e+00) (-4.39632119e-14,0.00000000e+00) (4.21157100e-14,0.00000000e+00) - (-3.12402544e-05,0.00000000e+00) (-3.41210200e-14,0.00000000e+00) (-1.91216362e-15,0.00000000e+00) (6.61929470e-15,0.00000000e+00) (2.41000807e-15,0.00000000e+00) -Row 2 - (6.78657495e-05,0.00000000e+00) (-5.58007978e-04,0.00000000e+00) (-3.23220670e-03,0.00000000e+00) (-5.17690656e-14,0.00000000e+00) (3.89683416e-14,0.00000000e+00) (6.43490967e-03,0.00000000e+00) (-7.81224441e-14,0.00000000e+00) (2.39568236e-14,0.00000000e+00) - (1.57200720e-04,0.00000000e+00) (-1.88859894e-14,0.00000000e+00) (8.42987928e-15,0.00000000e+00) (2.38084860e-14,0.00000000e+00) (1.22441364e-14,0.00000000e+00) -Row 3 - (-1.77202938e-03,0.00000000e+00) (-3.23220670e-03,0.00000000e+00) (-9.27165169e-05,0.00000000e+00) (5.20419725e-15,0.00000000e+00) (1.32908455e-14,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (2.58381067e-14,0.00000000e+00) (3.15729434e-14,0.00000000e+00) - (-3.50955253e-03,0.00000000e+00) (-1.62740768e-13,0.00000000e+00) (8.62095381e-14,0.00000000e+00) (-4.37794660e-14,0.00000000e+00) (-1.39388282e-15,0.00000000e+00) -Row 4 - (-1.38235266e-13,0.00000000e+00) (-5.17748790e-14,0.00000000e+00) (5.20441044e-15,0.00000000e+00) (-2.79248483e-05,0.00000000e+00) (-1.84416834e-14,0.00000000e+00) (2.02908422e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-2.72176602e-14,0.00000000e+00) - (1.21717586e-14,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-1.20701456e-15,0.00000000e+00) (-1.10401155e-13,0.00000000e+00) (4.60350165e-14,0.00000000e+00) -Row 5 - (5.84521669e-14,0.00000000e+00) (3.89730566e-14,0.00000000e+00) (1.32927981e-14,0.00000000e+00) (-1.84416799e-14,0.00000000e+00) (-2.79248483e-05,0.00000000e+00) (2.94067025e-14,0.00000000e+00) (-2.72236756e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) - (1.88742423e-14,0.00000000e+00) (-1.22436428e-15,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-6.33415118e-15,0.00000000e+00) (-6.95777379e-14,0.00000000e+00) -Row 6 - (-2.81949250e-03,0.00000000e+00) (6.43490967e-03,0.00000000e+00) (3.01710859e-04,0.00000000e+00) (2.02921933e-14,0.00000000e+00) (2.94208414e-14,0.00000000e+00) (-1.08981587e-03,0.00000000e+00) (3.66377855e-14,0.00000000e+00) (3.02731359e-14,0.00000000e+00) - (-5.91426479e-03,0.00000000e+00) (-6.55650833e-14,0.00000000e+00) (5.68611158e-14,0.00000000e+00) (-2.84127739e-14,0.00000000e+00) (1.20936520e-14,0.00000000e+00) -Row 7 - (-4.39688443e-14,0.00000000e+00) (-7.81215576e-14,0.00000000e+00) (2.58397310e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (-2.72244219e-14,0.00000000e+00) (3.66326164e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) (-4.27292179e-14,0.00000000e+00) - (-2.31294355e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.25053413e-14,0.00000000e+00) (-3.76629239e-14,0.00000000e+00) (5.83509879e-14,0.00000000e+00) -Row 8 - (4.21213211e-14,0.00000000e+00) (2.39575597e-14,0.00000000e+00) (3.15740136e-14,0.00000000e+00) (-2.72225363e-14,0.00000000e+00) (1.10985997e-04,0.00000000e+00) (3.02791759e-14,0.00000000e+00) (-4.27302968e-14,0.00000000e+00) (-3.72110785e-04,0.00000000e+00) - (8.30635045e-15,0.00000000e+00) (1.25335213e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.57357491e-14,0.00000000e+00) (2.46788849e-15,0.00000000e+00) -Row 9 - (-3.12402544e-05,0.00000000e+00) (1.57200720e-04,0.00000000e+00) (-3.50955253e-03,0.00000000e+00) (1.21876918e-14,0.00000000e+00) (1.88886348e-14,0.00000000e+00) (-5.91426479e-03,0.00000000e+00) (-2.31292795e-14,0.00000000e+00) (8.30713628e-15,0.00000000e+00) - (-1.10424551e-04,0.00000000e+00) (1.28404791e-15,0.00000000e+00) (2.86899195e-14,0.00000000e+00) (2.13490588e-14,0.00000000e+00) (2.18024425e-14,0.00000000e+00) -Row 10 - (-3.41080047e-14,0.00000000e+00) (-1.88728353e-14,0.00000000e+00) (-1.62711618e-13,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (-1.22457389e-15,0.00000000e+00) (-6.55806808e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) (1.25348227e-14,0.00000000e+00) - (1.25775246e-15,0.00000000e+00) (-9.79258089e-05,0.00000000e+00) (2.99960024e-14,0.00000000e+00) (-1.88992134e-14,0.00000000e+00) (1.66626425e-14,0.00000000e+00) -Row 11 - (-1.91476280e-15,0.00000000e+00) (8.43114019e-15,0.00000000e+00) (8.62004290e-14,0.00000000e+00) (-1.21243390e-15,0.00000000e+00) (8.48932642e-04,0.00000000e+00) (5.68653927e-14,0.00000000e+00) (1.25036040e-14,0.00000000e+00) (-1.05531373e-03,0.00000000e+00) - (2.86946300e-14,0.00000000e+00) (2.99960025e-14,0.00000000e+00) (-9.79258090e-05,0.00000000e+00) (3.77866689e-14,0.00000000e+00) (-2.73066435e-14,0.00000000e+00) -Row 12 - (6.60825742e-15,0.00000000e+00) (2.38133840e-14,0.00000000e+00) (-4.37722201e-14,0.00000000e+00) (-1.10390954e-13,0.00000000e+00) (-6.32902385e-15,0.00000000e+00) (-2.84110419e-14,0.00000000e+00) (-3.76615609e-14,0.00000000e+00) (1.57379179e-14,0.00000000e+00) - (2.13536729e-14,0.00000000e+00) (-1.88906038e-14,0.00000000e+00) (3.77893332e-14,0.00000000e+00) (-2.52233548e-05,0.00000000e+00) (9.49432437e-15,0.00000000e+00) -Row 13 - (2.40041166e-15,0.00000000e+00) (1.22441637e-14,0.00000000e+00) (-1.39148468e-15,0.00000000e+00) (4.60246738e-14,0.00000000e+00) (-6.96033152e-14,0.00000000e+00) (1.20952654e-14,0.00000000e+00) (5.83616033e-14,0.00000000e+00) (2.46310424e-15,0.00000000e+00) - (2.18034760e-14,0.00000000e+00) (1.66474590e-14,0.00000000e+00) (-2.73018569e-14,0.00000000e+00) (9.49328530e-15,0.00000000e+00) (-3.88972618e-05,0.00000000e+00) diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhrxs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_dh_t/dhrxs1_nao.csr.ref index 90eb4f45d82..3dbdf93b0b5 100644 --- a/tests/03_NAO_multik/scf_out_dh_t/dhrxs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_dh_t/dhrxs1_nao.csr.ref @@ -1,7 +1,38 @@ -STEP: 1 -Matrix Dimension of dHx(R): 13 -Matrix number of dHx(R): 1 +Ionic_Step 1 + # print dH/dR matrix in real space dHx(R) + 1 # number of spin directions + 1 # spin index + 13 # number of localized basis + 1 # number of Bravais lattice vector R + + user_defined_lattice + 1.00033 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + 0 0 0 24 - 2.82799207e-01 -6.00238827e-01 -1.35443791e-04 -1.12410170e+00 3.00536126e+00 -2.52005665e+00 -4.98955431e-01 -1.73514613e+00 3.00536126e+00 3.00536126e+00 3.66496850e+00 -1.91029004e+00 6.63825737e-01 -2.11597055e+00 3.66496850e+00 3.66496850e+00 1.52701862e+00 1.84783801e+00 -2.64487383e+00 -3.20054932e+00 -2.64487383e+00 -3.20054932e+00 -2.64487383e+00 -3.20054932e+00 - 3 6 3 6 9 0 1 8 11 12 9 0 1 8 11 12 3 6 2 5 3 6 4 7 + # CSR values + 2.82799207e-01 -6.00238827e-01 -1.35443791e-04 -1.12410170e+00 3.00536126e+00 -2.52005665e+00 + -4.98955431e-01 -1.73514613e+00 3.00536126e+00 3.00536126e+00 3.66496850e+00 -1.91029004e+00 + 6.63825737e-01 -2.11597055e+00 3.66496850e+00 3.66496850e+00 1.52701862e+00 1.84783801e+00 + -2.64487383e+00 -3.20054932e+00 -2.64487383e+00 -3.20054932e+00 -2.64487383e+00 -3.20054932e+00 + # CSR column indices + 3 6 3 6 9 0 1 8 11 12 9 0 1 8 11 12 + 3 6 2 5 3 6 4 7 + # CSR row pointers 0 2 4 5 9 10 11 15 16 18 20 20 22 24 + diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhrys1_nao.csr.ref b/tests/03_NAO_multik/scf_out_dh_t/dhrys1_nao.csr.ref index a5286bde5f3..48e119a5fd8 100644 --- a/tests/03_NAO_multik/scf_out_dh_t/dhrys1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_dh_t/dhrys1_nao.csr.ref @@ -1,7 +1,38 @@ -STEP: 1 -Matrix Dimension of dHy(R): 13 -Matrix number of dHy(R): 1 +Ionic_Step 1 + # print dH/dR matrix in real space dHy(R) + 1 # number of spin directions + 1 # spin index + 13 # number of localized basis + 1 # number of Bravais lattice vector R + + user_defined_lattice + 1.00033 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + 0 0 0 24 - 2.82799207e-01 -6.00238827e-01 -1.35443791e-04 -1.12410170e+00 3.00536126e+00 3.00536126e+00 -2.52005665e+00 -4.98955431e-01 -1.73514613e+00 -3.00536126e+00 3.66496850e+00 3.66496850e+00 -1.91029004e+00 6.63825737e-01 -2.11597055e+00 -3.66496850e+00 1.52701862e+00 1.84783801e+00 -2.64487383e+00 -3.20054932e+00 2.64487383e+00 3.20054932e+00 -2.64487383e+00 -3.20054932e+00 - 4 7 4 7 10 12 0 1 8 11 10 12 0 1 8 11 4 7 2 5 4 7 3 6 + # CSR values + 2.82799207e-01 -6.00238827e-01 -1.35443791e-04 -1.12410170e+00 3.00536126e+00 3.00536126e+00 + -2.52005665e+00 -4.98955431e-01 -1.73514613e+00 -3.00536126e+00 3.66496850e+00 3.66496850e+00 + -1.91029004e+00 6.63825737e-01 -2.11597055e+00 -3.66496850e+00 1.52701862e+00 1.84783801e+00 + -2.64487383e+00 -3.20054932e+00 2.64487383e+00 3.20054932e+00 -2.64487383e+00 -3.20054932e+00 + # CSR column indices + 4 7 4 7 10 12 0 1 8 11 10 12 0 1 8 11 + 4 7 2 5 4 7 3 6 + # CSR row pointers 0 2 4 5 6 10 11 12 16 18 18 20 22 24 + diff --git a/tests/03_NAO_multik/scf_out_dh_t/dhrzs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_dh_t/dhrzs1_nao.csr.ref index 8c1fa290e1e..3a747330999 100644 --- a/tests/03_NAO_multik/scf_out_dh_t/dhrzs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_dh_t/dhrzs1_nao.csr.ref @@ -1,7 +1,38 @@ -STEP: 1 -Matrix Dimension of dHz(R): 13 -Matrix number of dHz(R): 1 +Ionic_Step 1 + # print dH/dR matrix in real space dHz(R) + 1 # number of spin directions + 1 # spin index + 13 # number of localized basis + 1 # number of Bravais lattice vector R + + user_defined_lattice + 1.00033 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + 0 0 0 20 - -2.82799207e-01 6.00238827e-01 1.35443791e-04 1.12410170e+00 2.52005665e+00 4.98955431e-01 -3.47029226e+00 -3.00536126e+00 -3.00536126e+00 1.91029004e+00 -6.63825737e-01 -4.23194110e+00 -3.66496850e+00 -3.66496850e+00 3.05403724e+00 3.69567602e+00 2.64487383e+00 3.20054932e+00 2.64487383e+00 3.20054932e+00 - 2 5 2 5 0 1 8 9 10 0 1 8 9 10 2 5 3 6 4 7 + # CSR values + -2.82799207e-01 6.00238827e-01 1.35443791e-04 1.12410170e+00 2.52005665e+00 4.98955431e-01 + -3.47029226e+00 -3.00536126e+00 -3.00536126e+00 1.91029004e+00 -6.63825737e-01 -4.23194110e+00 + -3.66496850e+00 -3.66496850e+00 3.05403724e+00 3.69567602e+00 2.64487383e+00 3.20054932e+00 + 2.64487383e+00 3.20054932e+00 + # CSR column indices + 2 5 2 5 0 1 8 9 10 0 1 8 9 10 2 5 + 3 6 4 7 + # CSR row pointers 0 2 4 7 8 9 12 13 14 16 18 20 20 20 + diff --git a/tests/03_NAO_multik/scf_out_dh_t/result.ref b/tests/03_NAO_multik/scf_out_dh_t/result.ref index 86aafccd6be..933052287a4 100644 --- a/tests/03_NAO_multik/scf_out_dh_t/result.ref +++ b/tests/03_NAO_multik/scf_out_dh_t/result.ref @@ -4,10 +4,10 @@ ComparerTR_pass 0 ComparerdHRx_pass 0 ComparerdHRy_pass 0 ComparerdHRz_pass 0 -Compare_dhkx_iat1_ik0_nao_pass 0 -Compare_dhky_iat1_ik0_nao_pass 0 -Compare_dhkz_iat1_ik0_nao_pass 0 -Compare_dhkx_iat1_ik1_nao_pass 0 -Compare_dhky_iat1_ik1_nao_pass 0 -Compare_dhkz_iat1_ik1_nao_pass 0 +Compare_dhk1x_ia1_nao_pass 0 +Compare_dhk1y_ia1_nao_pass 0 +Compare_dhk1z_ia1_nao_pass 0 +Compare_dhk2x_ia1_nao_pass 0 +Compare_dhk2y_ia1_nao_pass 0 +Compare_dhk2z_ia1_nao_pass 0 totaltimeref 0.39079 diff --git a/tests/03_NAO_multik/scf_out_dh_t/tr_nao.csr.ref b/tests/03_NAO_multik/scf_out_dh_t/tr_nao.csr.ref index 52a639bfda5..8aaf214482a 100644 --- a/tests/03_NAO_multik/scf_out_dh_t/tr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_dh_t/tr_nao.csr.ref @@ -1,7 +1,38 @@ -STEP: 1 -Matrix Dimension of T(R): 13 -Matrix number of T(R): 1 -0 0 0 21 - 8.82323765e-01 7.93788723e-01 7.93788723e-01 1.40432016e+00 2.64658925e+00 2.38348275e+00 2.64658925e+00 2.38348275e+00 2.64658925e+00 2.38348275e+00 2.38348275e+00 3.82624607e+00 2.38348275e+00 3.82624607e+00 2.38348275e+00 3.82624607e+00 3.31118155e+00 3.31118155e+00 3.31118155e+00 3.31118155e+00 3.31118155e+00 - 0 1 0 1 2 5 3 6 4 7 2 5 3 6 4 7 8 9 10 11 12 +Ionic_Step 1 + # print T matrix in real space T(R) + 1 # number of spin directions + 1 # spin index + 13 # number of localized basis + 1 # number of Bravais lattice vector R + + user_defined_lattice + 1.00033 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + + 0 0 0 21 + # CSR values + 8.82323765e-01 7.93788723e-01 7.93788723e-01 1.40432016e+00 2.64658925e+00 2.38348275e+00 + 2.64658925e+00 2.38348275e+00 2.64658925e+00 2.38348275e+00 2.38348275e+00 3.82624607e+00 + 2.38348275e+00 3.82624607e+00 2.38348275e+00 3.82624607e+00 3.31118155e+00 3.31118155e+00 + 3.31118155e+00 3.31118155e+00 3.31118155e+00 + # CSR column indices + 0 1 0 1 2 5 3 6 4 7 2 5 3 6 4 7 + 8 9 10 11 12 + # CSR row pointers 0 2 4 6 8 10 12 14 16 17 18 19 20 21 + diff --git a/tests/03_NAO_multik/scf_out_dmr_dmk/dmrs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_dmr_dmk/dmrs1_nao.csr.ref index c19ee759492..e436bfe69f0 100644 --- a/tests/03_NAO_multik/scf_out_dmr_dmk/dmrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_dmr_dmk/dmrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print density matrix in real space DM(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsk/hk2_nao.txt.ref b/tests/03_NAO_multik/scf_out_hsk/hk2_nao.txt.ref index 2febe1208f5..b9fcd530429 100644 --- a/tests/03_NAO_multik/scf_out_hsk/hk2_nao.txt.ref +++ b/tests/03_NAO_multik/scf_out_hsk/hk2_nao.txt.ref @@ -1,23 +1,41 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/hk2_nao.txt -# gamma only 0 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - (5.166e-02,-3.852e-32) (6.663e-03,1.288e-16) (6.663e-03,1.288e-16) (-6.663e-03,-1.288e-16) (-1.844e-01,-8.423e-16) (9.209e-02,-2.027e-16) (9.209e-02,-2.027e-16) (-9.209e-02,2.027e-16) -Row 2 - (1.445e+00,-6.019e-36) (1.126e-01,2.138e-29) (-1.126e-01,-2.586e-29) (-9.209e-02,2.027e-16) (1.090e-01,-3.838e-16) (-3.637e-02,4.150e-16) (3.637e-02,-4.150e-16) -Row 3 - (1.445e+00,-5.381e-33) (-1.126e-01,-4.535e-30) (-9.209e-02,2.027e-16) (-3.637e-02,4.150e-16) (1.090e-01,-3.838e-16) (3.637e-02,-4.150e-16) -Row 4 - (1.445e+00,1.852e-32) (9.209e-02,-2.027e-16) (3.637e-02,-4.150e-16) (3.637e-02,-4.150e-16) (1.090e-01,-3.838e-16) -Row 5 - (5.166e-02,-1.233e-32) (-6.663e-03,1.288e-16) (-6.663e-03,1.288e-16) (6.663e-03,-1.288e-16) -Row 6 - (1.445e+00,-2.312e-32) (1.126e-01,-2.271e-29) (-1.126e-01,2.667e-29) -Row 7 - (1.445e+00,2.543e-32) (-1.126e-01,3.883e-30) -Row 8 - (1.445e+00,-5.621e-32) +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 8 # total k points + 8 # total k points after symmetrized (if open) + 2 # k-point index + -0.5 0.5 0.5 # k point coordinate (Cartesian) + 0.5 0 0 # k point coordinate (direct) + 0.25 # weight of this k point + 1.0495 # Fermi energy in Ry + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + (5.166e-02,0.000e+00) (6.663e-03,-1.288e-16) (6.663e-03,-1.288e-16) (-6.663e-03,1.288e-16) + (-1.844e-01,8.423e-16) (9.209e-02,2.027e-16) (9.209e-02,2.027e-16) (-9.209e-02,-2.027e-16) + (6.663e-03,1.288e-16) (1.445e+00,0.000e+00) (1.126e-01,0.000e+00) (-1.126e-01,0.000e+00) + (-9.209e-02,-2.027e-16) (1.090e-01,3.838e-16) (-3.637e-02,-4.150e-16) (3.637e-02,4.150e-16) + (6.663e-03,1.288e-16) (1.126e-01,0.000e+00) (1.445e+00,0.000e+00) (-1.126e-01,0.000e+00) + (-9.209e-02,-2.027e-16) (-3.637e-02,-4.150e-16) (1.090e-01,3.838e-16) (3.637e-02,4.150e-16) + (-6.663e-03,-1.288e-16) (-1.126e-01,0.000e+00) (-1.126e-01,0.000e+00) (1.445e+00,0.000e+00) + (9.209e-02,2.027e-16) (3.637e-02,4.150e-16) (3.637e-02,4.150e-16) (1.090e-01,3.838e-16) + (-1.844e-01,-8.423e-16) (-9.209e-02,2.027e-16) (-9.209e-02,2.027e-16) (9.209e-02,-2.027e-16) + (5.166e-02,0.000e+00) (-6.663e-03,-1.288e-16) (-6.663e-03,-1.288e-16) (6.663e-03,1.288e-16) + (9.209e-02,-2.027e-16) (1.090e-01,-3.838e-16) (-3.637e-02,4.150e-16) (3.637e-02,-4.150e-16) + (-6.663e-03,1.288e-16) (1.445e+00,0.000e+00) (1.126e-01,0.000e+00) (-1.126e-01,0.000e+00) + (9.209e-02,-2.027e-16) (-3.637e-02,4.150e-16) (1.090e-01,-3.838e-16) (3.637e-02,-4.150e-16) + (-6.663e-03,1.288e-16) (1.126e-01,0.000e+00) (1.445e+00,0.000e+00) (-1.126e-01,0.000e+00) + (-9.209e-02,2.027e-16) (3.637e-02,-4.150e-16) (3.637e-02,-4.150e-16) (1.090e-01,-3.838e-16) + (6.663e-03,-1.288e-16) (-1.126e-01,0.000e+00) (-1.126e-01,0.000e+00) (1.445e+00,0.000e+00) diff --git a/tests/03_NAO_multik/scf_out_hsk/sk2_nao.txt.ref b/tests/03_NAO_multik/scf_out_hsk/sk2_nao.txt.ref index 40dc7dd22ec..f4dee80b052 100644 --- a/tests/03_NAO_multik/scf_out_hsk/sk2_nao.txt.ref +++ b/tests/03_NAO_multik/scf_out_hsk/sk2_nao.txt.ref @@ -1,23 +1,41 @@ -#------------------------------------------------------------------------ -# ionic step 1 -# filename OUT.autotest/sk2_nao.txt -# gamma only 0 -# rows 8 -# columns 8 -#------------------------------------------------------------------------ -Row 1 - (9.996e-01,2.696e-32) (6.505e-19,-6.918e-16) (0.000e+00,-6.918e-16) (0.000e+00,6.918e-16) (3.859e-01,1.528e-15) (-1.288e-02,-1.723e-16) (-1.288e-02,-1.723e-16) (1.288e-02,1.723e-16) -Row 2 - (1.012e+00,0.000e+00) (-7.121e-02,0.000e+00) (7.121e-02,0.000e+00) (1.288e-02,1.723e-16) (-1.220e-01,-5.729e-16) (9.660e-02,-1.723e-16) (-9.660e-02,1.723e-16) -Row 3 - (1.012e+00,2.196e-32) (7.121e-02,0.000e+00) (1.288e-02,1.723e-16) (9.660e-02,-1.723e-16) (-1.220e-01,-5.729e-16) (-9.660e-02,1.723e-16) -Row 4 - (1.012e+00,3.852e-34) (-1.288e-02,-1.723e-16) (-9.660e-02,1.723e-16) (-9.660e-02,1.723e-16) (-1.220e-01,-5.729e-16) -Row 5 - (9.996e-01,2.696e-32) (6.505e-19,-6.918e-16) (0.000e+00,-6.918e-16) (0.000e+00,6.918e-16) -Row 6 - (1.012e+00,0.000e+00) (-7.121e-02,0.000e+00) (7.121e-02,0.000e+00) -Row 7 - (1.012e+00,2.196e-32) (7.121e-02,0.000e+00) -Row 8 - (1.012e+00,3.852e-34) +Ionic_Step 1 + 1 # number of spin directions + 1 # spin index + 8 # total k points + 8 # total k points after symmetrized (if open) + 2 # k-point index + -0.5 0.5 0.5 # k point coordinate (Cartesian) + 0.5 0 0 # k point coordinate (direct) + 0.25 # weight of this k point + 0.0 # Fermi energy in Ry (not applicable to S(k)) + 8 # number of localized basis + 8 8 # size of this matrix + + user_defined_lattice + 5.39761 + 0 0.5 0.5 + 0.5 0 0.5 + 0.5 0.5 0 + Si + 2 + Direct + 0 0 0 + 0.25 0.25 0.25 + + + (9.996e-01,0.000e+00) (0.000e+00,6.918e-16) (0.000e+00,6.918e-16) (0.000e+00,-6.918e-16) + (3.859e-01,-1.528e-15) (-1.288e-02,1.723e-16) (-1.288e-02,1.723e-16) (1.288e-02,-1.723e-16) + (0.000e+00,-6.918e-16) (1.012e+00,0.000e+00) (-7.121e-02,0.000e+00) (7.121e-02,0.000e+00) + (1.288e-02,-1.723e-16) (-1.220e-01,5.729e-16) (9.660e-02,1.723e-16) (-9.660e-02,-1.723e-16) + (0.000e+00,-6.918e-16) (-7.121e-02,0.000e+00) (1.012e+00,0.000e+00) (7.121e-02,0.000e+00) + (1.288e-02,-1.723e-16) (9.660e-02,1.723e-16) (-1.220e-01,5.729e-16) (-9.660e-02,-1.723e-16) + (0.000e+00,6.918e-16) (7.121e-02,0.000e+00) (7.121e-02,0.000e+00) (1.012e+00,0.000e+00) + (-1.288e-02,1.723e-16) (-9.660e-02,-1.723e-16) (-9.660e-02,-1.723e-16) (-1.220e-01,5.729e-16) + (3.859e-01,1.528e-15) (1.288e-02,1.723e-16) (1.288e-02,1.723e-16) (-1.288e-02,-1.723e-16) + (9.996e-01,0.000e+00) (0.000e+00,6.918e-16) (0.000e+00,6.918e-16) (0.000e+00,-6.918e-16) + (-1.288e-02,-1.723e-16) (-1.220e-01,-5.729e-16) (9.660e-02,-1.723e-16) (-9.660e-02,1.723e-16) + (0.000e+00,-6.918e-16) (1.012e+00,0.000e+00) (-7.121e-02,0.000e+00) (7.121e-02,0.000e+00) + (-1.288e-02,-1.723e-16) (9.660e-02,-1.723e-16) (-1.220e-01,-5.729e-16) (-9.660e-02,1.723e-16) + (0.000e+00,-6.918e-16) (-7.121e-02,0.000e+00) (1.012e+00,0.000e+00) (7.121e-02,0.000e+00) + (1.288e-02,1.723e-16) (-9.660e-02,1.723e-16) (-9.660e-02,1.723e-16) (-1.220e-01,-5.729e-16) + (0.000e+00,6.918e-16) (7.121e-02,0.000e+00) (7.121e-02,0.000e+00) (1.012e+00,0.000e+00) diff --git a/tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref index eb27cd21dae..25fa72c28cb 100644 --- a/tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 1 # number of spin directions 1 # spin index, E_Fermi = 10.4252 eV diff --git a/tests/03_NAO_multik/scf_out_hsr/sr_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr/sr_nao.csr.ref index a2217705e9f..520374db875 100644 --- a/tests/03_NAO_multik/scf_out_hsr/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs1_nao.csr.ref index 58fe3228b51..1779bc0cf9e 100644 --- a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs2_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs2_nao.csr.ref index 138e40e276d..da114693b7a 100644 --- a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs2_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/hrs2_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 2 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/sr_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/sr_nao.csr.ref index 148d5c5ed41..32c22c99830 100644 --- a/tests/03_NAO_multik/scf_out_hsr_binary_spin2/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_binary_spin2/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsr_spin2/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin2/hrs1_nao.csr.ref index fc53d6f3797..65971ffb06e 100644 --- a/tests/03_NAO_multik/scf_out_hsr_spin2/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_spin2/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 1 # spin index, E_Fermi = 10.3798 eV diff --git a/tests/03_NAO_multik/scf_out_hsr_spin2/hrs2_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin2/hrs2_nao.csr.ref index f77eec252f7..4d43c448dab 100644 --- a/tests/03_NAO_multik/scf_out_hsr_spin2/hrs2_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_spin2/hrs2_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 2 # number of spin directions 2 # spin index, E_Fermi = 10.3798 eV diff --git a/tests/03_NAO_multik/scf_out_hsr_spin2/sr_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin2/sr_nao.csr.ref index a2217705e9f..520374db875 100644 --- a/tests/03_NAO_multik/scf_out_hsr_spin2/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_spin2/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/hrs1_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/hrs1_nao.csr.ref index fe6bd68073f..b4a1d5f9505 100644 --- a/tests/03_NAO_multik/scf_out_hsr_spin4/hrs1_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_spin4/hrs1_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print H matrix in real space H(R) 1 # number of spin directions 1 # spin index, E_Fermi = -4.70347 eV diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/rr_nao.txt.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/rr_nao.txt.ref deleted file mode 100644 index 26635300247..00000000000 --- a/tests/03_NAO_multik/scf_out_hsr_spin4/rr_nao.txt.ref +++ /dev/null @@ -1,94 +0,0 @@ -STEP: 1 -Matrix Dimension of r(R): 26 -Matrix number of r(R): 7 --1 0 0 -110 - -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 6.87859277e-06 -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 6.87859277e-06 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 -7.63685749e-05 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 -7.63685749e-05 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 2.86817647e-05 -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 2.86817647e-05 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 -1.69223233e-04 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 -1.69223233e-04 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 1.07622587e-05 -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 1.07622587e-05 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 -6.02824237e-06 1.64036034e-06 -2.27284395e-08 -2.27284395e-08 6.97620951e-06 -7.78435611e-05 -2.91047669e-05 1.71845361e-04 1.07622587e-05 -1.86635073e-05 6.97620951e-06 -7.78435611e-05 -2.91047669e-05 1.71845361e-04 1.07622587e-05 -1.86635073e-05 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 -6.02824237e-06 1.64036034e-06 - 0 2 6 12 16 22 1 3 7 13 17 23 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 - 0 6 12 18 24 27 30 36 42 45 48 51 54 60 66 69 72 78 84 87 90 91 92 98 104 107 110 -84 - -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.31909199e-08 1.31909199e-08 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 -3.02541006e-07 4.97634554e-07 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 -3.02541006e-07 4.97634554e-07 -7.60096393e-08 -7.60096393e-08 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 1.76214453e-06 -2.90010459e-06 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 1.76214453e-06 -2.90010459e-06 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 -2.27284395e-08 -2.27284395e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 4.97634987e-07 -2.90010667e-06 7.86087430e-07 4.97634987e-07 -2.90010667e-06 7.86087430e-07 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 -7.86091089e-07 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 -7.86091089e-07 - 8 14 24 9 15 25 8 14 24 9 15 25 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 20 21 4 10 18 5 11 19 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 - 0 3 6 9 12 13 14 17 20 26 32 33 34 37 40 46 52 55 58 59 60 63 66 69 72 78 84 -84 - 1.51834118e-07 -8.81125374e-07 2.48618618e-07 1.51834118e-07 -8.81125374e-07 2.48618618e-07 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 -5.10825473e-07 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 -5.10825473e-07 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 -1.31909199e-08 -1.31909199e-08 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 -1.63049198e-06 2.97611422e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 -1.63049198e-06 2.97611422e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 7.60096393e-08 7.60096393e-08 2.79693904e-07 -1.63049315e-06 4.40725487e-07 2.79693904e-07 -1.63049315e-06 4.40725487e-07 -2.48619432e-07 2.54650519e-06 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 8.08819528e-07 -2.48619432e-07 2.54650519e-06 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 8.08819528e-07 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -5.10825922e-07 2.97611634e-06 -8.08815924e-07 -5.10825922e-07 2.97611634e-06 -8.08815924e-07 2.27284395e-08 2.27284395e-08 - 4 10 18 5 11 19 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 11 19 20 21 - 0 3 6 9 12 18 24 27 30 31 32 38 44 47 50 51 52 55 58 64 70 73 76 79 82 83 84 -0 -1 0 -84 - -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 -3.02541006e-07 -4.97634554e-07 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 -3.02541006e-07 -4.97634554e-07 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 1.76214453e-06 2.90010459e-06 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 1.76214453e-06 2.90010459e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 -2.27284395e-08 -2.27284395e-08 -4.97634987e-07 2.90010667e-06 -7.86087430e-07 -4.97634987e-07 2.90010667e-06 -7.86087430e-07 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 7.86091089e-07 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 7.86091089e-07 - 6 12 24 7 13 25 6 12 24 7 13 25 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 6 12 24 7 13 25 4 10 20 5 11 21 18 19 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 - 0 3 6 9 12 13 14 20 26 29 32 33 34 40 46 49 52 55 58 61 64 65 66 69 72 78 84 -110 - -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 -6.87859277e-06 -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 -6.87859277e-06 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 7.63685749e-05 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 7.63685749e-05 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 -2.86817647e-05 -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 -2.86817647e-05 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 1.69223233e-04 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 1.69223233e-04 -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 -1.07622587e-05 -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 -1.07622587e-05 -2.27284395e-08 -2.27284395e-08 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 -6.02824237e-06 1.64036034e-06 -6.97620951e-06 7.78435611e-05 2.91047669e-05 -1.71845361e-04 -1.07622587e-05 -1.86635073e-05 -6.97620951e-06 7.78435611e-05 2.91047669e-05 -1.71845361e-04 -1.07622587e-05 -1.86635073e-05 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 -6.02824237e-06 1.64036034e-06 - 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 - 0 6 12 18 24 27 30 33 36 42 48 51 54 57 60 66 72 78 84 85 86 89 92 98 104 107 110 -84 - 1.51834118e-07 -8.81125374e-07 2.48618618e-07 1.51834118e-07 -8.81125374e-07 2.48618618e-07 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 5.10825473e-07 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 5.10825473e-07 -1.31909199e-08 -1.31909199e-08 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 -1.63049198e-06 -2.97611422e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 -1.63049198e-06 -2.97611422e-06 7.60096393e-08 7.60096393e-08 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 2.79693904e-07 -1.63049315e-06 4.40725487e-07 2.79693904e-07 -1.63049315e-06 4.40725487e-07 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -2.48619432e-07 2.54650519e-06 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 -8.08819528e-07 -2.48619432e-07 2.54650519e-06 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 -8.08819528e-07 5.10825922e-07 -2.97611634e-06 8.08815924e-07 5.10825922e-07 -2.97611634e-06 8.08815924e-07 2.27284395e-08 2.27284395e-08 - 4 10 20 5 11 21 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 18 19 - 0 3 6 9 12 18 24 25 26 29 32 38 44 45 46 49 52 55 58 61 64 70 76 79 82 83 84 -0 0 -1 -84 - -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 1.31909199e-08 1.31909199e-08 1.31909199e-08 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 -7.60096393e-08 -7.60096393e-08 -7.60096393e-08 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 2.27284395e-08 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 2.27284395e-08 2.27284395e-08 2.27284395e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 - 6 12 18 7 13 19 6 12 18 7 13 19 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 8 14 20 9 15 21 - 0 3 6 9 12 15 18 24 30 31 32 35 38 44 50 51 52 55 58 64 70 71 72 75 78 81 84 -84 - -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 -1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 -1.31909199e-08 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 7.60096393e-08 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 7.60096393e-08 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 2.27284395e-08 2.27284395e-08 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 -2.27284395e-08 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 -2.27284395e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 - 8 14 20 9 15 21 8 14 20 9 15 21 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 6 12 18 7 13 19 - 0 3 6 9 12 15 18 19 20 26 32 35 38 39 40 46 52 55 58 59 60 66 72 75 78 81 84 -90 - -2.32010157e-06 2.49485414e-05 -9.69699980e-06 5.68747134e-05 7.94271477e-06 -2.32010157e-06 2.49485414e-05 -9.69699980e-06 5.68747134e-05 7.94271477e-06 2.48034530e-05 -2.62895682e-04 1.03734716e-04 -6.06952477e-04 -8.81828346e-05 2.48034530e-05 -2.62895682e-04 1.03734716e-04 -6.06952477e-04 -8.81828346e-05 9.69684545e-06 -1.04358805e-04 4.05610564e-05 -2.37867587e-04 -3.31188491e-05 9.69684545e-06 -1.04358805e-04 4.05610564e-05 -2.37867587e-04 -3.31188491e-05 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -5.68162140e-05 6.09956395e-04 -2.37619821e-04 1.39307592e-03 1.95402158e-04 -5.68162140e-05 6.09956395e-04 -2.37619821e-04 1.39307592e-03 1.95402158e-04 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 8.05543287e-06 -8.98860019e-05 3.36072900e-05 -1.98429931e-04 -2.48771002e-05 8.05543287e-06 -8.98860019e-05 3.36072900e-05 -1.98429931e-04 -2.48771002e-05 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 - 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 22 23 24 25 - 0 5 10 15 20 25 30 33 36 39 42 47 52 55 58 61 64 69 74 77 80 83 86 87 88 89 90 -0 0 0 -48 - -9.09854910e-01 3.41022274e-01 -9.09854910e-01 3.41022274e-01 5.51583244e-01 -1.60392562e+00 5.51583244e-01 -1.60392562e+00 -7.90766845e-01 -7.90766845e-01 -9.09854913e-01 5.51583265e-01 4.56549451e-01 -7.90766845e-01 -9.09854913e-01 5.51583265e-01 4.56549451e-01 -7.90766845e-01 -7.90766845e-01 -7.90766845e-01 5.48967651e-01 5.48967651e-01 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 5.48967651e-01 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 5.48967651e-01 5.48967651e-01 5.48967651e-01 4.56549454e-01 -3.16946634e-01 4.56549454e-01 -3.16946634e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 - 6 12 7 13 6 12 7 13 18 19 0 2 16 22 1 3 17 23 24 25 18 19 0 2 16 22 1 3 17 23 24 25 6 12 7 13 4 10 5 11 6 12 7 13 8 14 9 15 - 0 2 4 6 8 9 10 14 18 19 20 21 22 26 30 31 32 34 36 38 40 40 40 42 44 46 48 -48 - -9.09854910e-01 3.41022274e-01 -9.09854910e-01 3.41022274e-01 5.51583244e-01 -1.60392562e+00 5.51583244e-01 -1.60392562e+00 -7.90766845e-01 -7.90766845e-01 -7.90766845e-01 -7.90766845e-01 -9.09854913e-01 5.51583265e-01 4.56549451e-01 7.90766845e-01 -9.09854913e-01 5.51583265e-01 4.56549451e-01 7.90766845e-01 5.48967651e-01 5.48967651e-01 5.48967651e-01 5.48967651e-01 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 -5.48967651e-01 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 -5.48967651e-01 4.56549454e-01 -3.16946634e-01 4.56549454e-01 -3.16946634e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 - 8 14 9 15 8 14 9 15 20 21 24 25 0 2 16 22 1 3 17 23 20 21 24 25 0 2 16 22 1 3 17 23 8 14 9 15 4 10 5 11 8 14 9 15 6 12 7 13 - 0 2 4 6 8 9 10 11 12 16 20 21 22 23 24 28 32 34 36 36 36 38 40 42 44 46 48 -40 - 9.09854910e-01 -3.41022274e-01 9.09854910e-01 -3.41022274e-01 -5.51583244e-01 1.60392562e+00 -5.51583244e-01 1.60392562e+00 9.09854913e-01 -5.51583265e-01 9.13098902e-01 9.09854913e-01 -5.51583265e-01 9.13098902e-01 7.90766845e-01 7.90766845e-01 7.90766845e-01 7.90766845e-01 -3.41022286e-01 1.60392572e+00 -6.33893242e-01 -3.41022286e-01 1.60392572e+00 -6.33893242e-01 -5.48967651e-01 -5.48967651e-01 -5.48967651e-01 -5.48967651e-01 9.13098907e-01 -6.33893268e-01 9.13098907e-01 -6.33893268e-01 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 - 4 10 5 11 4 10 5 11 0 2 16 1 3 17 18 19 20 21 0 2 16 1 3 17 18 19 20 21 4 10 5 11 6 12 7 13 8 14 9 15 - 0 2 4 6 8 11 14 15 16 17 18 21 24 25 26 27 28 30 32 34 36 38 40 40 40 40 40 -0 0 1 -84 - -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 1.31909199e-08 1.31909199e-08 1.31909199e-08 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 -3.39263651e-06 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 -3.39263651e-06 -7.60096393e-08 -7.60096393e-08 -7.60096393e-08 5.82235177e-07 -3.39263894e-06 9.20817881e-07 5.82235177e-07 -3.39263894e-06 9.20817881e-07 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 -2.27284395e-08 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 - 6 12 18 7 13 19 6 12 18 7 13 19 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 6 12 18 7 13 19 8 14 20 9 15 21 - 0 3 6 9 12 15 18 24 30 31 32 35 38 44 50 51 52 55 58 64 70 71 72 75 78 81 84 -84 - -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 -1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 -1.31909199e-08 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 -3.39263651e-06 7.60096393e-08 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 -3.39263651e-06 7.60096393e-08 5.82235177e-07 -3.39263894e-06 9.20817881e-07 5.82235177e-07 -3.39263894e-06 9.20817881e-07 -2.27284395e-08 -2.27284395e-08 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 2.27284395e-08 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 2.27284395e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 - 8 14 20 9 15 21 8 14 20 9 15 21 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 8 14 20 9 15 21 6 12 18 7 13 19 - 0 3 6 9 12 15 18 19 20 26 32 35 38 39 40 46 52 55 58 59 60 66 72 75 78 81 84 -90 - 2.32010157e-06 -2.49485414e-05 -9.69699980e-06 5.68747134e-05 -7.94271477e-06 2.32010157e-06 -2.49485414e-05 -9.69699980e-06 5.68747134e-05 -7.94271477e-06 -2.48034530e-05 2.62895682e-04 1.03734716e-04 -6.06952477e-04 8.81828346e-05 -2.48034530e-05 2.62895682e-04 1.03734716e-04 -6.06952477e-04 8.81828346e-05 9.69684545e-06 -1.04358805e-04 -4.05610564e-05 2.37867587e-04 -3.31188491e-05 9.69684545e-06 -1.04358805e-04 -4.05610564e-05 2.37867587e-04 -3.31188491e-05 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 -5.68162140e-05 6.09956395e-04 2.37619821e-04 -1.39307592e-03 1.95402158e-04 -5.68162140e-05 6.09956395e-04 2.37619821e-04 -1.39307592e-03 1.95402158e-04 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -8.05543287e-06 8.98860019e-05 3.36072900e-05 -1.98429931e-04 2.48771002e-05 -8.05543287e-06 8.98860019e-05 3.36072900e-05 -1.98429931e-04 2.48771002e-05 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 2.27284395e-08 2.27284395e-08 2.27284395e-08 2.27284395e-08 - 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 22 23 24 25 - 0 5 10 15 20 25 30 33 36 39 42 47 52 55 58 61 64 69 74 77 80 83 86 87 88 89 90 -0 1 0 -84 - -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 -3.02541006e-07 -4.97634554e-07 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 -3.02541006e-07 -4.97634554e-07 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 1.76214453e-06 2.90010459e-06 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 1.76214453e-06 2.90010459e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.02541273e-07 1.76214578e-06 4.80092394e-07 -3.02541273e-07 1.76214578e-06 4.80092394e-07 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 2.27284395e-08 2.27284395e-08 -4.97634987e-07 2.90010667e-06 7.86087430e-07 -4.97634987e-07 2.90010667e-06 7.86087430e-07 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 -7.86091089e-07 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 -7.86091089e-07 - 6 12 24 7 13 25 6 12 24 7 13 25 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 6 12 24 7 13 25 4 10 20 5 11 21 18 19 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 - 0 3 6 9 12 13 14 20 26 29 32 33 34 40 46 49 52 55 58 61 64 65 66 69 72 78 84 -110 - 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 6.87859277e-06 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 6.87859277e-06 -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 -7.63685749e-05 -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 -7.63685749e-05 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 -2.86817647e-05 -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 -2.86817647e-05 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 1.69223233e-04 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 1.69223233e-04 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 1.07622587e-05 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 1.07622587e-05 2.27284395e-08 2.27284395e-08 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 6.97620951e-06 -7.78435611e-05 2.91047669e-05 -1.71845361e-04 1.07622587e-05 1.86635073e-05 6.97620951e-06 -7.78435611e-05 2.91047669e-05 -1.71845361e-04 1.07622587e-05 1.86635073e-05 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 - 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 - 0 6 12 18 24 27 30 33 36 42 48 51 54 57 60 66 72 78 84 85 86 89 92 98 104 107 110 -84 - 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 -1.53130114e-06 8.87063749e-06 2.54649924e-06 -1.53130114e-06 8.87063749e-06 2.54649924e-06 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 5.10825473e-07 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 5.10825473e-07 -1.31909199e-08 -1.31909199e-08 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 -1.63049198e-06 -2.97611422e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 -1.63049198e-06 -2.97611422e-06 7.60096393e-08 7.60096393e-08 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 -1.31909349e-08 7.60096793e-08 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 2.48619432e-07 -2.54650519e-06 1.02737238e-06 -5.97994780e-06 4.40727631e-07 8.08819528e-07 2.48619432e-07 -2.54650519e-06 1.02737238e-06 -5.97994780e-06 4.40727631e-07 8.08819528e-07 5.10825922e-07 -2.97611634e-06 -8.08815924e-07 5.10825922e-07 -2.97611634e-06 -8.08815924e-07 -2.27284395e-08 -2.27284395e-08 - 4 10 20 5 11 21 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 11 21 18 19 - 0 3 6 9 12 18 24 25 26 29 32 38 44 45 46 49 52 55 58 61 64 70 76 79 82 83 84 -1 0 0 -110 - 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 -6.87859277e-06 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 -6.87859277e-06 -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 7.63685749e-05 -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 7.63685749e-05 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 2.86817647e-05 -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 2.86817647e-05 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 -1.69223233e-04 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 -1.69223233e-04 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 -1.07622587e-05 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 -1.07622587e-05 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 2.27284395e-08 2.27284395e-08 -6.97620951e-06 7.78435611e-05 -2.91047669e-05 1.71845361e-04 -1.07622587e-05 1.86635073e-05 -6.97620951e-06 7.78435611e-05 -2.91047669e-05 1.71845361e-04 -1.07622587e-05 1.86635073e-05 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 - 0 2 6 12 16 22 1 3 7 13 17 23 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 - 0 6 12 18 24 27 30 36 42 45 48 51 54 60 66 69 72 78 84 87 90 91 92 98 104 107 110 -84 - -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.31909199e-08 1.31909199e-08 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 -3.02541006e-07 4.97634554e-07 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 -3.02541006e-07 4.97634554e-07 -7.60096393e-08 -7.60096393e-08 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 1.76214453e-06 -2.90010459e-06 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 1.76214453e-06 -2.90010459e-06 -3.02541273e-07 1.76214578e-06 4.80092394e-07 -3.02541273e-07 1.76214578e-06 4.80092394e-07 2.27284395e-08 2.27284395e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 4.97634987e-07 -2.90010667e-06 -7.86087430e-07 4.97634987e-07 -2.90010667e-06 -7.86087430e-07 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 7.86091089e-07 -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 7.86091089e-07 - 8 14 24 9 15 25 8 14 24 9 15 25 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 20 21 4 10 18 5 11 19 8 14 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 - 0 3 6 9 12 13 14 17 20 26 32 33 34 37 40 46 52 55 58 59 60 63 66 69 72 78 84 -84 - 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 -1.53130114e-06 8.87063749e-06 2.54649924e-06 -1.53130114e-06 8.87063749e-06 2.54649924e-06 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 -5.10825473e-07 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 -5.10825473e-07 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -1.31909199e-08 -1.31909199e-08 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 -1.63049198e-06 2.97611422e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 -1.63049198e-06 2.97611422e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 7.60096393e-08 7.60096393e-08 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 2.48619432e-07 -2.54650519e-06 1.02737238e-06 -5.97994780e-06 4.40727631e-07 -8.08819528e-07 2.48619432e-07 -2.54650519e-06 1.02737238e-06 -5.97994780e-06 4.40727631e-07 -8.08819528e-07 -1.31909349e-08 7.60096793e-08 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 -5.10825922e-07 2.97611634e-06 8.08815924e-07 -5.10825922e-07 2.97611634e-06 8.08815924e-07 -2.27284395e-08 -2.27284395e-08 - 4 10 18 5 11 19 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 11 19 20 21 - 0 3 6 9 12 18 24 27 30 31 32 38 44 47 50 51 52 55 58 64 70 73 76 79 82 83 84 diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/rrx_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/rrx_nao.csr.ref new file mode 100644 index 00000000000..89fd63cdae7 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_hsr_spin4/rrx_nao.csr.ref @@ -0,0 +1,218 @@ +Ionic_Step 1 + # print r matrix in real space r(R) x-component + 1 # number of spin directions + 1 # spin index + 26 # number of localized basis + 7 # number of Bravais lattice vector R + + user_defined_lattice + 0.793766 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 110 + # CSR values + -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 6.87859277e-06 + -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 6.87859277e-06 + 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 -7.63685749e-05 + 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 -7.63685749e-05 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 2.86817647e-05 + -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 2.86817647e-05 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 + 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 -1.69223233e-04 + 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 -1.69223233e-04 + 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 + -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 1.07622587e-05 + -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 1.07622587e-05 + 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 -6.02824237e-06 1.64036034e-06 + -2.27284395e-08 -2.27284395e-08 6.97620951e-06 -7.78435611e-05 -2.91047669e-05 1.71845361e-04 + 1.07622587e-05 -1.86635073e-05 6.97620951e-06 -7.78435611e-05 -2.91047669e-05 1.71845361e-04 + 1.07622587e-05 -1.86635073e-05 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 + -6.02824237e-06 1.64036034e-06 + # CSR column indices + 0 2 6 12 16 22 1 3 7 13 17 23 0 2 6 12 + 16 22 1 3 7 13 17 23 4 10 18 5 11 19 0 2 + 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 + 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 + 17 23 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 + 16 22 1 3 7 13 17 23 8 14 24 9 15 25 + # CSR row pointers + 0 6 12 18 24 27 30 36 42 45 48 51 54 60 66 69 + 72 78 84 87 90 91 92 98 104 107 110 + +0 -1 0 84 + # CSR values + -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 + 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + -3.02541006e-07 -4.97634554e-07 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + -3.02541006e-07 -4.97634554e-07 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 + 3.65667429e-06 -1.02737332e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 1.76214453e-06 2.90010459e-06 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 1.76214453e-06 2.90010459e-06 3.65343268e-06 -2.12018516e-05 + 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 -3.02541273e-07 1.76214578e-06 + -4.80092394e-07 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 1.31909349e-08 -7.60096793e-08 + 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 -2.27284395e-08 -2.27284395e-08 + -4.97634987e-07 2.90010667e-06 -7.86087430e-07 -4.97634987e-07 2.90010667e-06 -7.86087430e-07 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 7.86091089e-07 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 7.86091089e-07 + # CSR column indices + 6 12 24 7 13 25 6 12 24 7 13 25 18 19 0 2 + 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 + 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 + 24 7 13 25 6 12 24 7 13 25 4 10 20 5 11 21 + 18 19 6 12 24 7 13 25 0 2 8 14 16 22 1 3 + 9 15 17 23 + # CSR row pointers + 0 3 6 9 12 13 14 20 26 29 32 33 34 40 46 49 + 52 55 58 61 64 65 66 69 72 78 84 + +0 0 -1 84 + # CSR values + -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 1.31909199e-08 + -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 5.82234668e-07 1.31909199e-08 + 1.31909199e-08 1.31909199e-08 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 + 2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -3.39263651e-06 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -3.39263651e-06 -7.60096393e-08 -7.60096393e-08 -7.60096393e-08 5.82235177e-07 -3.39263894e-06 + -9.20817881e-07 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 -2.48619432e-07 2.54650519e-06 + -1.02737238e-06 5.97994780e-06 9.20822074e-07 2.27284395e-08 -2.48619432e-07 2.54650519e-06 + -1.02737238e-06 5.97994780e-06 9.20822074e-07 2.27284395e-08 2.27284395e-08 2.27284395e-08 + 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 + 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 + # CSR column indices + 6 12 18 7 13 19 6 12 18 7 13 19 6 12 18 7 + 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 + 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 + 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 + 1 3 5 11 17 23 24 25 6 12 18 7 13 19 8 14 + 20 9 15 21 + # CSR row pointers + 0 3 6 9 12 15 18 24 30 31 32 35 38 44 50 51 + 52 55 58 64 70 71 72 75 78 81 84 + +0 0 0 48 + # CSR values + -9.09854910e-01 3.41022274e-01 -9.09854910e-01 3.41022274e-01 5.51583244e-01 -1.60392562e+00 + 5.51583244e-01 -1.60392562e+00 -7.90766845e-01 -7.90766845e-01 -9.09854913e-01 5.51583265e-01 + 4.56549451e-01 -7.90766845e-01 -9.09854913e-01 5.51583265e-01 4.56549451e-01 -7.90766845e-01 + -7.90766845e-01 -7.90766845e-01 5.48967651e-01 5.48967651e-01 3.41022286e-01 -1.60392572e+00 + -3.16946621e-01 5.48967651e-01 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 5.48967651e-01 + 5.48967651e-01 5.48967651e-01 4.56549454e-01 -3.16946634e-01 4.56549454e-01 -3.16946634e-01 + -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 + -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 + # CSR column indices + 6 12 7 13 6 12 7 13 18 19 0 2 16 22 1 3 + 17 23 24 25 18 19 0 2 16 22 1 3 17 23 24 25 + 6 12 7 13 4 10 5 11 6 12 7 13 8 14 9 15 + # CSR row pointers + 0 2 4 6 8 9 10 14 18 19 20 21 22 26 30 31 + 32 34 36 38 40 40 40 42 44 46 48 + +0 0 1 84 + # CSR values + -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 1.31909199e-08 + -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 5.82234668e-07 1.31909199e-08 + 1.31909199e-08 1.31909199e-08 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 + -2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -3.39263651e-06 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -3.39263651e-06 -7.60096393e-08 -7.60096393e-08 -7.60096393e-08 5.82235177e-07 -3.39263894e-06 + 9.20817881e-07 5.82235177e-07 -3.39263894e-06 9.20817881e-07 2.48619432e-07 -2.54650519e-06 + -1.02737238e-06 5.97994780e-06 -9.20822074e-07 -2.27284395e-08 2.48619432e-07 -2.54650519e-06 + -1.02737238e-06 5.97994780e-06 -9.20822074e-07 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 + 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 + 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 + # CSR column indices + 6 12 18 7 13 19 6 12 18 7 13 19 6 12 18 7 + 13 19 0 2 4 10 16 22 1 3 5 11 17 23 24 25 + 6 12 18 7 13 19 0 2 4 10 16 22 1 3 5 11 + 17 23 24 25 6 12 18 7 13 19 0 2 4 10 16 22 + 1 3 5 11 17 23 24 25 6 12 18 7 13 19 8 14 + 20 9 15 21 + # CSR row pointers + 0 3 6 9 12 15 18 24 30 31 32 35 38 44 50 51 + 52 55 58 64 70 71 72 75 78 81 84 + +0 1 0 84 + # CSR values + -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 + 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + -3.02541006e-07 -4.97634554e-07 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + -3.02541006e-07 -4.97634554e-07 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 + -3.65667429e-06 -1.02737332e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 1.76214453e-06 2.90010459e-06 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 1.76214453e-06 2.90010459e-06 -3.65343268e-06 2.12018516e-05 + 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.02541273e-07 1.76214578e-06 + 4.80092394e-07 -3.02541273e-07 1.76214578e-06 4.80092394e-07 1.31909349e-08 -7.60096793e-08 + -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 2.27284395e-08 2.27284395e-08 + -4.97634987e-07 2.90010667e-06 7.86087430e-07 -4.97634987e-07 2.90010667e-06 7.86087430e-07 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 -7.86091089e-07 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 -7.86091089e-07 + # CSR column indices + 6 12 24 7 13 25 6 12 24 7 13 25 18 19 0 2 + 8 14 16 22 1 3 9 15 17 23 6 12 24 7 13 25 + 18 19 0 2 8 14 16 22 1 3 9 15 17 23 6 12 + 24 7 13 25 6 12 24 7 13 25 4 10 20 5 11 21 + 18 19 6 12 24 7 13 25 0 2 8 14 16 22 1 3 + 9 15 17 23 + # CSR row pointers + 0 3 6 9 12 13 14 20 26 29 32 33 34 40 46 49 + 52 55 58 61 64 65 66 69 72 78 84 + +1 0 0 110 + # CSR values + 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 -6.87859277e-06 + 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 -6.87859277e-06 + -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 7.63685749e-05 + -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 7.63685749e-05 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 2.86817647e-05 + -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 2.86817647e-05 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 + 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 -1.69223233e-04 + 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 -1.69223233e-04 + -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 + 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 -1.07622587e-05 + 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 -1.07622587e-05 + 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 + 2.27284395e-08 2.27284395e-08 -6.97620951e-06 7.78435611e-05 -2.91047669e-05 1.71845361e-04 + -1.07622587e-05 1.86635073e-05 -6.97620951e-06 7.78435611e-05 -2.91047669e-05 1.71845361e-04 + -1.07622587e-05 1.86635073e-05 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 + -6.02824237e-06 -1.64036034e-06 + # CSR column indices + 0 2 6 12 16 22 1 3 7 13 17 23 0 2 6 12 + 16 22 1 3 7 13 17 23 4 10 18 5 11 19 0 2 + 6 12 16 22 1 3 7 13 17 23 8 14 24 9 15 25 + 4 10 18 5 11 19 0 2 6 12 16 22 1 3 7 13 + 17 23 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 4 10 18 5 11 19 20 21 0 2 6 12 + 16 22 1 3 7 13 17 23 8 14 24 9 15 25 + # CSR row pointers + 0 6 12 18 24 27 30 36 42 45 48 51 54 60 66 69 + 72 78 84 87 90 91 92 98 104 107 110 + diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/rry_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/rry_nao.csr.ref new file mode 100644 index 00000000000..d0cb5cab04f --- /dev/null +++ b/tests/03_NAO_multik/scf_out_hsr_spin4/rry_nao.csr.ref @@ -0,0 +1,218 @@ +Ionic_Step 1 + # print r matrix in real space r(R) y-component + 1 # number of spin directions + 1 # spin index + 26 # number of localized basis + 7 # number of Bravais lattice vector R + + user_defined_lattice + 0.793766 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 84 + # CSR values + -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 + 1.31909199e-08 1.31909199e-08 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 + 3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + -3.02541006e-07 4.97634554e-07 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + -3.02541006e-07 4.97634554e-07 -7.60096393e-08 -7.60096393e-08 3.65343268e-06 -2.12018516e-05 + 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 1.76214453e-06 -2.90010459e-06 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 1.76214453e-06 -2.90010459e-06 -3.02541273e-07 1.76214578e-06 + -4.80092394e-07 -3.02541273e-07 1.76214578e-06 -4.80092394e-07 -2.27284395e-08 -2.27284395e-08 + 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 + 4.97634987e-07 -2.90010667e-06 7.86087430e-07 4.97634987e-07 -2.90010667e-06 7.86087430e-07 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 -7.86091089e-07 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 4.80094443e-07 -7.86091089e-07 + # CSR column indices + 8 14 24 9 15 25 8 14 24 9 15 25 20 21 8 14 + 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 + 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 8 14 24 9 15 25 20 21 4 10 18 5 + 11 19 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 + # CSR row pointers + 0 3 6 9 12 13 14 17 20 26 32 33 34 37 40 46 + 52 55 58 59 60 63 66 69 72 78 84 + +0 -1 0 110 + # CSR values + -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 -6.87859277e-06 + -2.32010157e-06 2.49485414e-05 9.69699980e-06 -5.68747134e-05 -3.97135739e-06 -6.87859277e-06 + 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 7.63685749e-05 + 2.48034530e-05 -2.62895682e-04 -1.03734716e-04 6.06952477e-04 4.40914173e-05 7.63685749e-05 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 -2.86817647e-05 + -9.69684545e-06 1.04358805e-04 4.05610564e-05 -2.37867587e-04 -1.65594246e-05 -2.86817647e-05 + 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 + 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 -2.12018516e-05 5.97995214e-06 + 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 1.69223233e-04 + 5.68162140e-05 -6.09956395e-04 -2.37619821e-04 1.39307592e-03 9.77010792e-05 1.69223233e-04 + -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 -1.07622587e-05 + -4.02771644e-06 4.49430010e-05 1.68036450e-05 -9.92149655e-05 -6.23632138e-06 -1.07622587e-05 + -2.27284395e-08 -2.27284395e-08 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 + -6.02824237e-06 1.64036034e-06 -6.97620951e-06 7.78435611e-05 2.91047669e-05 -1.71845361e-04 + -1.07622587e-05 -1.86635073e-05 -6.97620951e-06 7.78435611e-05 2.91047669e-05 -1.71845361e-04 + -1.07622587e-05 -1.86635073e-05 1.03484278e-06 -6.02824237e-06 1.64036034e-06 1.03484278e-06 + -6.02824237e-06 1.64036034e-06 + # CSR column indices + 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 + 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 + 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 + 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 + 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 + 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 + 16 22 1 3 9 15 17 23 6 12 24 7 13 25 + # CSR row pointers + 0 6 12 18 24 27 30 33 36 42 48 51 54 57 60 66 + 72 78 84 85 86 89 92 98 104 107 110 + +0 0 -1 84 + # CSR values + -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + 5.82234668e-07 -1.31909199e-08 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + 5.82234668e-07 -1.31909199e-08 -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 + 2.12018516e-05 5.97995214e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 7.60096393e-08 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 -3.39263651e-06 7.60096393e-08 5.82235177e-07 -3.39263894e-06 + -9.20817881e-07 5.82235177e-07 -3.39263894e-06 -9.20817881e-07 2.27284395e-08 2.27284395e-08 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 -2.27284395e-08 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 9.20822074e-07 -2.27284395e-08 + -1.31909349e-08 7.60096793e-08 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 + 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 + # CSR column indices + 8 14 20 9 15 21 8 14 20 9 15 21 8 14 20 9 + 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 + 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 + 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 + 16 22 1 3 5 11 17 23 8 14 20 9 15 21 6 12 + 18 7 13 19 + # CSR row pointers + 0 3 6 9 12 15 18 19 20 26 32 35 38 39 40 46 + 52 55 58 59 60 66 72 75 78 81 84 + +0 0 0 48 + # CSR values + -9.09854910e-01 3.41022274e-01 -9.09854910e-01 3.41022274e-01 5.51583244e-01 -1.60392562e+00 + 5.51583244e-01 -1.60392562e+00 -7.90766845e-01 -7.90766845e-01 -7.90766845e-01 -7.90766845e-01 + -9.09854913e-01 5.51583265e-01 4.56549451e-01 7.90766845e-01 -9.09854913e-01 5.51583265e-01 + 4.56549451e-01 7.90766845e-01 5.48967651e-01 5.48967651e-01 5.48967651e-01 5.48967651e-01 + 3.41022286e-01 -1.60392572e+00 -3.16946621e-01 -5.48967651e-01 3.41022286e-01 -1.60392572e+00 + -3.16946621e-01 -5.48967651e-01 4.56549454e-01 -3.16946634e-01 4.56549454e-01 -3.16946634e-01 + -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 7.90766850e-01 -5.48967674e-01 + 7.90766850e-01 -5.48967674e-01 -7.90766850e-01 5.48967674e-01 -7.90766850e-01 5.48967674e-01 + # CSR column indices + 8 14 9 15 8 14 9 15 20 21 24 25 0 2 16 22 + 1 3 17 23 20 21 24 25 0 2 16 22 1 3 17 23 + 8 14 9 15 4 10 5 11 8 14 9 15 6 12 7 13 + # CSR row pointers + 0 2 4 6 8 9 10 11 12 16 20 21 22 23 24 28 + 32 34 36 36 36 38 40 42 44 46 48 + +0 0 1 84 + # CSR values + -1.51834118e-07 8.81125374e-07 -2.48618618e-07 -1.51834118e-07 8.81125374e-07 -2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 2.54649924e-06 1.53130114e-06 -8.87063749e-06 2.54649924e-06 + -6.29881023e-07 3.65667429e-06 -1.02737332e-06 -6.29881023e-07 3.65667429e-06 -1.02737332e-06 + 1.31909199e-08 1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + 5.82234668e-07 -1.31909199e-08 -1.51834017e-07 1.53130036e-06 6.29880997e-07 -3.65343256e-06 + 5.82234668e-07 -1.31909199e-08 3.65343268e-06 -2.12018516e-05 5.97995214e-06 3.65343268e-06 + -2.12018516e-05 5.97995214e-06 -7.60096393e-08 -7.60096393e-08 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 -3.39263651e-06 7.60096393e-08 8.81124931e-07 -8.87063391e-06 + -3.65667416e-06 2.12018510e-05 -3.39263651e-06 7.60096393e-08 5.82235177e-07 -3.39263894e-06 + 9.20817881e-07 5.82235177e-07 -3.39263894e-06 9.20817881e-07 -2.27284395e-08 -2.27284395e-08 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 2.27284395e-08 + 2.48619432e-07 -2.54650519e-06 -1.02737238e-06 5.97994780e-06 -9.20822074e-07 2.27284395e-08 + -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 + 1.31909349e-08 -7.60096793e-08 2.27284941e-08 1.31909349e-08 -7.60096793e-08 2.27284941e-08 + # CSR column indices + 8 14 20 9 15 21 8 14 20 9 15 21 8 14 20 9 + 15 21 24 25 0 2 4 10 16 22 1 3 5 11 17 23 + 8 14 20 9 15 21 24 25 0 2 4 10 16 22 1 3 + 5 11 17 23 8 14 20 9 15 21 24 25 0 2 4 10 + 16 22 1 3 5 11 17 23 8 14 20 9 15 21 6 12 + 18 7 13 19 + # CSR row pointers + 0 3 6 9 12 15 18 19 20 26 32 35 38 39 40 46 + 52 55 58 59 60 66 72 75 78 81 84 + +0 1 0 110 + # CSR values + 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 6.87859277e-06 + 2.32010157e-06 -2.49485414e-05 9.69699980e-06 -5.68747134e-05 3.97135739e-06 6.87859277e-06 + -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 -7.63685749e-05 + -2.48034530e-05 2.62895682e-04 -1.03734716e-04 6.06952477e-04 -4.40914173e-05 -7.63685749e-05 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 + -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 -2.86817647e-05 + -9.69684545e-06 1.04358805e-04 -4.05610564e-05 2.37867587e-04 -1.65594246e-05 -2.86817647e-05 + -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 + -3.65343268e-06 2.12018516e-05 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 + 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 1.69223233e-04 + 5.68162140e-05 -6.09956395e-04 2.37619821e-04 -1.39307592e-03 9.77010792e-05 1.69223233e-04 + 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 1.07622587e-05 + 4.02771644e-06 -4.49430010e-05 1.68036450e-05 -9.92149655e-05 6.23632138e-06 1.07622587e-05 + 2.27284395e-08 2.27284395e-08 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 + -6.02824237e-06 -1.64036034e-06 6.97620951e-06 -7.78435611e-05 2.91047669e-05 -1.71845361e-04 + 1.07622587e-05 1.86635073e-05 6.97620951e-06 -7.78435611e-05 2.91047669e-05 -1.71845361e-04 + 1.07622587e-05 1.86635073e-05 1.03484278e-06 -6.02824237e-06 -1.64036034e-06 1.03484278e-06 + -6.02824237e-06 -1.64036034e-06 + # CSR column indices + 0 2 8 14 16 22 1 3 9 15 17 23 0 2 8 14 + 16 22 1 3 9 15 17 23 4 10 20 5 11 21 6 12 + 24 7 13 25 0 2 8 14 16 22 1 3 9 15 17 23 + 4 10 20 5 11 21 6 12 24 7 13 25 0 2 8 14 + 16 22 1 3 9 15 17 23 0 2 8 14 16 22 1 3 + 9 15 17 23 18 19 4 10 20 5 11 21 0 2 8 14 + 16 22 1 3 9 15 17 23 6 12 24 7 13 25 + # CSR row pointers + 0 6 12 18 24 27 30 33 36 42 48 51 54 57 60 66 + 72 78 84 85 86 89 92 98 104 107 110 + +1 0 0 84 + # CSR values + -1.51834118e-07 8.81125374e-07 2.48618618e-07 -1.51834118e-07 8.81125374e-07 2.48618618e-07 + 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 1.53130114e-06 -8.87063749e-06 -2.54649924e-06 + 1.31909199e-08 1.31909199e-08 6.29881023e-07 -3.65667429e-06 -1.02737332e-06 6.29881023e-07 + -3.65667429e-06 -1.02737332e-06 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + -3.02541006e-07 4.97634554e-07 -1.51834017e-07 1.53130036e-06 -6.29880997e-07 3.65343256e-06 + -3.02541006e-07 4.97634554e-07 -7.60096393e-08 -7.60096393e-08 -3.65343268e-06 2.12018516e-05 + 5.97995214e-06 -3.65343268e-06 2.12018516e-05 5.97995214e-06 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 1.76214453e-06 -2.90010459e-06 8.81124931e-07 -8.87063391e-06 + 3.65667416e-06 -2.12018510e-05 1.76214453e-06 -2.90010459e-06 -3.02541273e-07 1.76214578e-06 + 4.80092394e-07 -3.02541273e-07 1.76214578e-06 4.80092394e-07 2.27284395e-08 2.27284395e-08 + 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 1.31909349e-08 -7.60096793e-08 -2.27284941e-08 + 4.97634987e-07 -2.90010667e-06 -7.86087430e-07 4.97634987e-07 -2.90010667e-06 -7.86087430e-07 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 7.86091089e-07 + -2.48619432e-07 2.54650519e-06 -1.02737238e-06 5.97994780e-06 -4.80094443e-07 7.86091089e-07 + # CSR column indices + 8 14 24 9 15 25 8 14 24 9 15 25 20 21 8 14 + 24 9 15 25 0 2 6 12 16 22 1 3 7 13 17 23 + 20 21 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 8 14 24 9 15 25 20 21 4 10 18 5 + 11 19 8 14 24 9 15 25 0 2 6 12 16 22 1 3 + 7 13 17 23 + # CSR row pointers + 0 3 6 9 12 13 14 17 20 26 32 33 34 37 40 46 + 52 55 58 59 60 63 66 69 72 78 84 + diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/rrz_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/rrz_nao.csr.ref new file mode 100644 index 00000000000..1bcabef7d76 --- /dev/null +++ b/tests/03_NAO_multik/scf_out_hsr_spin4/rrz_nao.csr.ref @@ -0,0 +1,207 @@ +Ionic_Step 1 + # print r matrix in real space r(R) z-component + 1 # number of spin directions + 1 # spin index + 26 # number of localized basis + 7 # number of Bravais lattice vector R + + user_defined_lattice + 0.793766 + 10 0 0 + 0 10 0 + 0 0 10 + C + 1 + Direct + 0 0 0 + + #----------------------------------------------------------------------# + # CSR Format # + # The outer loop corresponds to the number of Bravais lattice vectors. # + # The first line contains the index of the Bravais lattice vector # + # (Rx, Ry, Rz), followed by the number of non-zero elements. # + # The subsequent lines consist of three blocks of data, which are # + # values, column indices, row pointers. # + #----------------------------------------------------------------------# + +-1 0 0 84 + # CSR values + 1.51834118e-07 -8.81125374e-07 2.48618618e-07 1.51834118e-07 -8.81125374e-07 2.48618618e-07 + -1.53130114e-06 8.87063749e-06 -2.54649924e-06 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 + 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 -5.10825473e-07 + 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 -5.10825473e-07 + 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 + -1.31909199e-08 -1.31909199e-08 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -1.63049198e-06 2.97611422e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -1.63049198e-06 2.97611422e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 + 2.12018516e-05 -5.97995214e-06 7.60096393e-08 7.60096393e-08 2.79693904e-07 -1.63049315e-06 + 4.40725487e-07 2.79693904e-07 -1.63049315e-06 4.40725487e-07 -2.48619432e-07 2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 8.08819528e-07 -2.48619432e-07 2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 8.08819528e-07 -1.31909349e-08 7.60096793e-08 + -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -5.10825922e-07 2.97611634e-06 + -8.08815924e-07 -5.10825922e-07 2.97611634e-06 -8.08815924e-07 2.27284395e-08 2.27284395e-08 + # CSR column indices + 4 10 18 5 11 19 4 10 18 5 11 19 0 2 6 12 + 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 + 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 + 11 19 20 21 4 10 18 5 11 19 0 2 6 12 16 22 + 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 + 11 19 20 21 + # CSR row pointers + 0 3 6 9 12 18 24 27 30 31 32 38 44 47 50 51 + 52 55 58 64 70 73 76 79 82 83 84 + +0 -1 0 84 + # CSR values + 1.51834118e-07 -8.81125374e-07 2.48618618e-07 1.51834118e-07 -8.81125374e-07 2.48618618e-07 + -1.53130114e-06 8.87063749e-06 -2.54649924e-06 -1.53130114e-06 8.87063749e-06 -2.54649924e-06 + 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 5.10825473e-07 + 1.51834017e-07 -1.53130036e-06 -6.29880997e-07 3.65343256e-06 2.79693662e-07 5.10825473e-07 + -1.31909199e-08 -1.31909199e-08 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 + -3.65667429e-06 1.02737332e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -1.63049198e-06 -2.97611422e-06 -8.81124931e-07 8.87063391e-06 3.65667416e-06 -2.12018510e-05 + -1.63049198e-06 -2.97611422e-06 7.60096393e-08 7.60096393e-08 -3.65343268e-06 2.12018516e-05 + -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 2.79693904e-07 -1.63049315e-06 + 4.40725487e-07 2.79693904e-07 -1.63049315e-06 4.40725487e-07 -1.31909349e-08 7.60096793e-08 + -2.27284941e-08 -1.31909349e-08 7.60096793e-08 -2.27284941e-08 -2.48619432e-07 2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 -8.08819528e-07 -2.48619432e-07 2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 -4.40727631e-07 -8.08819528e-07 5.10825922e-07 -2.97611634e-06 + 8.08815924e-07 5.10825922e-07 -2.97611634e-06 8.08815924e-07 2.27284395e-08 2.27284395e-08 + # CSR column indices + 4 10 20 5 11 21 4 10 20 5 11 21 0 2 8 14 + 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 + 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 + 20 5 11 21 4 10 20 5 11 21 6 12 24 7 13 25 + 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 + 11 21 18 19 + # CSR row pointers + 0 3 6 9 12 18 24 25 26 29 32 38 44 45 46 49 + 52 55 58 61 64 70 76 79 82 83 84 + +0 0 -1 90 + # CSR values + -2.32010157e-06 2.49485414e-05 -9.69699980e-06 5.68747134e-05 7.94271477e-06 -2.32010157e-06 + 2.49485414e-05 -9.69699980e-06 5.68747134e-05 7.94271477e-06 2.48034530e-05 -2.62895682e-04 + 1.03734716e-04 -6.06952477e-04 -8.81828346e-05 2.48034530e-05 -2.62895682e-04 1.03734716e-04 + -6.06952477e-04 -8.81828346e-05 9.69684545e-06 -1.04358805e-04 4.05610564e-05 -2.37867587e-04 + -3.31188491e-05 9.69684545e-06 -1.04358805e-04 4.05610564e-05 -2.37867587e-04 -3.31188491e-05 + -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 + -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 + -5.68162140e-05 6.09956395e-04 -2.37619821e-04 1.39307592e-03 1.95402158e-04 -5.68162140e-05 + 6.09956395e-04 -2.37619821e-04 1.39307592e-03 1.95402158e-04 3.65343268e-06 -2.12018516e-05 + -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 -2.12018516e-05 + -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 8.05543287e-06 -8.98860019e-05 + 3.36072900e-05 -1.98429931e-04 -2.48771002e-05 8.05543287e-06 -8.98860019e-05 3.36072900e-05 + -1.98429931e-04 -2.48771002e-05 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -1.03484278e-06 + 6.02824237e-06 1.64036034e-06 -1.03484278e-06 6.02824237e-06 1.64036034e-06 -1.03484278e-06 + 6.02824237e-06 1.64036034e-06 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 -2.27284395e-08 + # CSR column indices + 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 + 3 5 11 17 0 2 4 10 16 1 3 5 11 17 6 12 + 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 + 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 + 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 + 8 14 20 9 15 21 22 23 24 25 + # CSR row pointers + 0 5 10 15 20 25 30 33 36 39 42 47 52 55 58 61 + 64 69 74 77 80 83 86 87 88 89 90 + +0 0 0 40 + # CSR values + 9.09854910e-01 -3.41022274e-01 9.09854910e-01 -3.41022274e-01 -5.51583244e-01 1.60392562e+00 + -5.51583244e-01 1.60392562e+00 9.09854913e-01 -5.51583265e-01 9.13098902e-01 9.09854913e-01 + -5.51583265e-01 9.13098902e-01 7.90766845e-01 7.90766845e-01 7.90766845e-01 7.90766845e-01 + -3.41022286e-01 1.60392572e+00 -6.33893242e-01 -3.41022286e-01 1.60392572e+00 -6.33893242e-01 + -5.48967651e-01 -5.48967651e-01 -5.48967651e-01 -5.48967651e-01 9.13098907e-01 -6.33893268e-01 + 9.13098907e-01 -6.33893268e-01 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 + 7.90766850e-01 -5.48967674e-01 7.90766850e-01 -5.48967674e-01 + # CSR column indices + 4 10 5 11 4 10 5 11 0 2 16 1 3 17 18 19 + 20 21 0 2 16 1 3 17 18 19 20 21 4 10 5 11 + 6 12 7 13 8 14 9 15 + # CSR row pointers + 0 2 4 6 8 11 14 15 16 17 18 21 24 25 26 27 + 28 30 32 34 36 38 40 40 40 40 40 + +0 0 1 90 + # CSR values + 2.32010157e-06 -2.49485414e-05 -9.69699980e-06 5.68747134e-05 -7.94271477e-06 2.32010157e-06 + -2.49485414e-05 -9.69699980e-06 5.68747134e-05 -7.94271477e-06 -2.48034530e-05 2.62895682e-04 + 1.03734716e-04 -6.06952477e-04 8.81828346e-05 -2.48034530e-05 2.62895682e-04 1.03734716e-04 + -6.06952477e-04 8.81828346e-05 9.69684545e-06 -1.04358805e-04 -4.05610564e-05 2.37867587e-04 + -3.31188491e-05 9.69684545e-06 -1.04358805e-04 -4.05610564e-05 2.37867587e-04 -3.31188491e-05 + 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 + 6.29881023e-07 -3.65667429e-06 1.02737332e-06 6.29881023e-07 -3.65667429e-06 1.02737332e-06 + -5.68162140e-05 6.09956395e-04 2.37619821e-04 -1.39307592e-03 1.95402158e-04 -5.68162140e-05 + 6.09956395e-04 2.37619821e-04 -1.39307592e-03 1.95402158e-04 -3.65343268e-06 2.12018516e-05 + -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -3.65343268e-06 2.12018516e-05 + -5.97995214e-06 -3.65343268e-06 2.12018516e-05 -5.97995214e-06 -8.05543287e-06 8.98860019e-05 + 3.36072900e-05 -1.98429931e-04 2.48771002e-05 -8.05543287e-06 8.98860019e-05 3.36072900e-05 + -1.98429931e-04 2.48771002e-05 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 + 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 6.02824237e-06 -1.64036034e-06 -1.03484278e-06 + 6.02824237e-06 -1.64036034e-06 2.27284395e-08 2.27284395e-08 2.27284395e-08 2.27284395e-08 + # CSR column indices + 0 2 4 10 16 1 3 5 11 17 0 2 4 10 16 1 + 3 5 11 17 0 2 4 10 16 1 3 5 11 17 6 12 + 18 7 13 19 8 14 20 9 15 21 0 2 4 10 16 1 + 3 5 11 17 6 12 18 7 13 19 8 14 20 9 15 21 + 0 2 4 10 16 1 3 5 11 17 6 12 18 7 13 19 + 8 14 20 9 15 21 22 23 24 25 + # CSR row pointers + 0 5 10 15 20 25 30 33 36 39 42 47 52 55 58 61 + 64 69 74 77 80 83 86 87 88 89 90 + +0 1 0 84 + # CSR values + 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 + -1.53130114e-06 8.87063749e-06 2.54649924e-06 -1.53130114e-06 8.87063749e-06 2.54649924e-06 + 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 5.10825473e-07 + 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 5.10825473e-07 + -1.31909199e-08 -1.31909199e-08 -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 + 3.65667429e-06 1.02737332e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -1.63049198e-06 -2.97611422e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -1.63049198e-06 -2.97611422e-06 7.60096393e-08 7.60096393e-08 3.65343268e-06 -2.12018516e-05 + -5.97995214e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 2.79693904e-07 -1.63049315e-06 + -4.40725487e-07 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 -1.31909349e-08 7.60096793e-08 + 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 2.48619432e-07 -2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 4.40727631e-07 8.08819528e-07 2.48619432e-07 -2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 4.40727631e-07 8.08819528e-07 5.10825922e-07 -2.97611634e-06 + -8.08815924e-07 5.10825922e-07 -2.97611634e-06 -8.08815924e-07 -2.27284395e-08 -2.27284395e-08 + # CSR column indices + 4 10 20 5 11 21 4 10 20 5 11 21 0 2 8 14 + 16 22 1 3 9 15 17 23 18 19 4 10 20 5 11 21 + 0 2 8 14 16 22 1 3 9 15 17 23 18 19 4 10 + 20 5 11 21 4 10 20 5 11 21 6 12 24 7 13 25 + 0 2 8 14 16 22 1 3 9 15 17 23 4 10 20 5 + 11 21 18 19 + # CSR row pointers + 0 3 6 9 12 18 24 25 26 29 32 38 44 45 46 49 + 52 55 58 61 64 70 76 79 82 83 84 + +1 0 0 84 + # CSR values + 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 1.51834118e-07 -8.81125374e-07 -2.48618618e-07 + -1.53130114e-06 8.87063749e-06 2.54649924e-06 -1.53130114e-06 8.87063749e-06 2.54649924e-06 + 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 -5.10825473e-07 + 1.51834017e-07 -1.53130036e-06 6.29880997e-07 -3.65343256e-06 2.79693662e-07 -5.10825473e-07 + -6.29881023e-07 3.65667429e-06 1.02737332e-06 -6.29881023e-07 3.65667429e-06 1.02737332e-06 + -1.31909199e-08 -1.31909199e-08 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -1.63049198e-06 2.97611422e-06 -8.81124931e-07 8.87063391e-06 -3.65667416e-06 2.12018510e-05 + -1.63049198e-06 2.97611422e-06 3.65343268e-06 -2.12018516e-05 -5.97995214e-06 3.65343268e-06 + -2.12018516e-05 -5.97995214e-06 7.60096393e-08 7.60096393e-08 2.79693904e-07 -1.63049315e-06 + -4.40725487e-07 2.79693904e-07 -1.63049315e-06 -4.40725487e-07 2.48619432e-07 -2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 4.40727631e-07 -8.08819528e-07 2.48619432e-07 -2.54650519e-06 + 1.02737238e-06 -5.97994780e-06 4.40727631e-07 -8.08819528e-07 -1.31909349e-08 7.60096793e-08 + 2.27284941e-08 -1.31909349e-08 7.60096793e-08 2.27284941e-08 -5.10825922e-07 2.97611634e-06 + 8.08815924e-07 -5.10825922e-07 2.97611634e-06 8.08815924e-07 -2.27284395e-08 -2.27284395e-08 + # CSR column indices + 4 10 18 5 11 19 4 10 18 5 11 19 0 2 6 12 + 16 22 1 3 7 13 17 23 4 10 18 5 11 19 20 21 + 0 2 6 12 16 22 1 3 7 13 17 23 4 10 18 5 + 11 19 20 21 4 10 18 5 11 19 0 2 6 12 16 22 + 1 3 7 13 17 23 8 14 24 9 15 25 4 10 18 5 + 11 19 20 21 + # CSR row pointers + 0 3 6 9 12 18 24 27 30 31 32 38 44 47 50 51 + 52 55 58 64 70 73 76 79 82 83 84 + diff --git a/tests/03_NAO_multik/scf_out_hsr_spin4/sr_nao.csr.ref b/tests/03_NAO_multik/scf_out_hsr_spin4/sr_nao.csr.ref index 81fb0f38ffb..7aa514c786a 100644 --- a/tests/03_NAO_multik/scf_out_hsr_spin4/sr_nao.csr.ref +++ b/tests/03_NAO_multik/scf_out_hsr_spin4/sr_nao.csr.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +Ionic_Step 1 # print S matrix in real space S(R) 1 # number of spin directions 1 # spin index diff --git a/tests/03_NAO_multik/scf_out_mul/mulliken.txt.ref b/tests/03_NAO_multik/scf_out_mul/mulliken.txt.ref index 54b2d9a58ca..be24e0b7e4f 100644 --- a/tests/03_NAO_multik/scf_out_mul/mulliken.txt.ref +++ b/tests/03_NAO_multik/scf_out_mul/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 2 Decomposed Mulliken population analysis for each atom l and m from Ylm, z stands for zeta orbital diff --git a/tests/03_NAO_multik/scf_out_mul_nupdw/mulliken.txt.ref b/tests/03_NAO_multik/scf_out_mul_nupdw/mulliken.txt.ref index ce73d2cc3ab..b2bd396aaac 100644 --- a/tests/03_NAO_multik/scf_out_mul_nupdw/mulliken.txt.ref +++ b/tests/03_NAO_multik/scf_out_mul_nupdw/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 9 Total charge of spin1 5 Total charge of spin2 4 diff --git a/tests/03_NAO_multik/scf_out_mul_spin2/mulliken.txt.ref b/tests/03_NAO_multik/scf_out_mul_spin2/mulliken.txt.ref index e5f742addbf..9a0a4417854 100644 --- a/tests/03_NAO_multik/scf_out_mul_spin2/mulliken.txt.ref +++ b/tests/03_NAO_multik/scf_out_mul_spin2/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 32 Total charge of spin1 16 Total charge of spin2 16 diff --git a/tests/03_NAO_multik/scf_out_mul_spin4/mulliken.txt.ref b/tests/03_NAO_multik/scf_out_mul_spin4/mulliken.txt.ref index 489c6d34642..e1837be161e 100644 --- a/tests/03_NAO_multik/scf_out_mul_spin4/mulliken.txt.ref +++ b/tests/03_NAO_multik/scf_out_mul_spin4/mulliken.txt.ref @@ -1,4 +1,4 @@ - --- Ionic Step 1 --- +# Ionic_Step 1 Total charge 32 Decomposed Mulliken population analysis for each atom l and m from Ylm, z stands for zeta orbital diff --git a/tests/03_NAO_multik/scf_out_pot3/pots1.cube.ref b/tests/03_NAO_multik/scf_out_pot3/pots1.cube.ref index eabc456a6a5..15c04ef1bc0 100644 --- a/tests/03_NAO_multik/scf_out_pot3/pots1.cube.ref +++ b/tests/03_NAO_multik/scf_out_pot3/pots1.cube.ref @@ -1,6 +1,6 @@ -STEP: 0 Cubefile created from ABACUS. Inner loop is z, followed by y and x -1 (nspin) -2 0.0 0.0 0.0 +Ionic_Step 1 Cubefile created from ABACUS. Inner loop is z, followed by y and x +1 (nspin) +2 0.0 0.0 0.0 12 0.000000 0.425000 0.425000 12 0.425000 0.000000 0.425000 12 0.425000 0.425000 0.000000 diff --git a/tests/08_RI/scf_out_xc_multik/vxck2_nao.txt.ref b/tests/08_RI/scf_out_xc_multik/vxcmok2_nao.txt.ref similarity index 94% rename from tests/08_RI/scf_out_xc_multik/vxck2_nao.txt.ref rename to tests/08_RI/scf_out_xc_multik/vxcmok2_nao.txt.ref index ff015bac047..7854e433269 100644 --- a/tests/08_RI/scf_out_xc_multik/vxck2_nao.txt.ref +++ b/tests/08_RI/scf_out_xc_multik/vxcmok2_nao.txt.ref @@ -1,6 +1,6 @@ #------------------------------------------------------------------------ -# ionic step 0 -# filename OUT.autotest/vxck2_nao.txt +# Ionic_Step 1 +# filename OUT.autotest/vxcmok2_nao.txt # gamma only 0 # rows 6 # columns 6 diff --git a/tests/integrate/validation_tools/CompareFile.py b/tests/integrate/validation_tools/CompareFile.py index ea425babcc3..71148f80f79 100755 --- a/tests/integrate/validation_tools/CompareFile.py +++ b/tests/integrate/validation_tools/CompareFile.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import math +import re import sys usage = ''' @@ -67,6 +68,53 @@ def is_two_data_diff(data1,data2,epsilon,compareAbsoluteDiff): if abs(data1-data2)/max(abs(data1),abs(data2)) > epsilon: return True return False +# Per-frame provenance comments carry a runtime-dependent timestamp, so they +# cannot live in reference files. They are dropped before comparison. +PROVENANCE_PREFIXES = ( + "# ABACUS version:", + "# Written at", +) +INLINE_PROVENANCE_MARKERS = ("# ABACUS version:", "# Written at") + +# Older releases wrote bare "Ionic_Step N", compact "STEP: N" or the reversed +# "N # Ionic_Step"; the unified spelling is "# Ionic_Step N". All of them +# are mapped to one canonical form so old and new reference files compare. +STEP_PATTERNS = ( + re.compile(r"^\s*(?:#\s*)?Ionic_Step\s+(\d+)\s*$"), + re.compile(r"^\s*STEP:\s*(\d+)\s*$"), + re.compile(r"^\s*(\d+)\s*#\s*Ionic_Step\s*$"), +) + + +def strip_provenance(line): + """Return the comparable content of one line, or None to drop it.""" + if line.strip().startswith(PROVENANCE_PREFIXES): + return None + result = line + for marker in INLINE_PROVENANCE_MARKERS: + index = result.find(marker) + if index >= 0: + result = result[:index] + return result.rstrip() + + +def canonical_step(line): + for pattern in STEP_PATTERNS: + match = pattern.match(line) + if match: + return "Ionic_Step " + match.group(1) + return line + + +def normalize_lines(lines): + normalized = [] + for line in lines: + stripped = strip_provenance(line) + if stripped is None: + continue + normalized.append(canonical_step(stripped)) + return normalized + def ReadFile(file1,lines): # Open the path directly instead of pre-checking with os.path.isfile, # so that non-regular files such as /dev/fd/ pipes produced by bash @@ -114,6 +162,8 @@ def ExitError(iline,line1,line2,jnumber=-1): lines2 = [] ReadFile(file1,lines1) ReadFile(file2,lines2) + lines1 = normalize_lines(lines1) + lines2 = normalize_lines(lines2) for i in range(min(len(lines1),len(lines2))): if lines1[i].strip() == lines2[i].strip():continue diff --git a/tests/integrate/validation_tools/compare_hsk_binary.py b/tests/integrate/validation_tools/compare_hsk_binary.py index 69d78e32a08..417011fb49a 100644 --- a/tests/integrate/validation_tools/compare_hsk_binary.py +++ b/tests/integrate/validation_tools/compare_hsk_binary.py @@ -5,21 +5,76 @@ import sys -def read_reference(filename, value_type): - values = [] - complex_pattern = re.compile(r"\(([^,]+),([^\)]+)\)") - with open(filename, "r", encoding="utf-8") as stream: - for line in stream: - stripped = line.strip() - if not stripped or stripped.startswith("#") or stripped.startswith("Row "): - continue - if value_type == "complex": - values.extend(complex(float(real), float(imag)) for real, imag in complex_pattern.findall(stripped)) +FRAME_PATTERN = re.compile(r"^\s*#?\s*Ionic[ _]Step\b", re.IGNORECASE) +DIMENSION_PATTERN = re.compile(r"^\s*(\d+)\s+\d+\s+#\s*size of this matrix", re.IGNORECASE) +COMPLEX_PATTERN = re.compile(r"\(\s*([-+0-9.eE]+)\s*,\s*([-+0-9.eE]+)\s*\)") +REAL_PATTERN = re.compile(r"[-+]?(?:\d+\.\d*|\.\d+|\d+)(?:[eE][-+]?\d+)?") + + +def select_first_frame(lines): + """Return the lines of the first ionic-step record of a text reference.""" + start = None + for index, line in enumerate(lines): + if FRAME_PATTERN.match(line): + if start is None: + start = index else: - values.extend(float(token) for token in stripped.split()) + return lines[start:index] + if start is None: + return lines + return lines[start:] + + +def dense_dimension(lines): + """Read N from the '# size of this matrix' line of a dense text record.""" + for line in lines: + match = DIMENSION_PATTERN.match(line) + if match: + return int(match.group(1)) + return None + + +def packed_from_dense(values, dim): + """Select the row-major upper triangle from a dense row-major matrix.""" + return [values[i * dim + j] for i in range(dim) for j in range(i, dim)] + + +def read_packed_reference(lines, value_type): + """Read a legacy reference that stores only the upper triangle.""" + values = [] + for line in lines: + stripped = line.strip() + if not stripped or stripped.startswith("#") or stripped.startswith("Row "): + continue + if value_type == "complex": + values.extend(complex(float(real), float(imag)) for real, imag in COMPLEX_PATTERN.findall(stripped)) + else: + values.extend(float(token) for token in stripped.split()) return values +def read_reference(filename, value_type): + with open(filename, "r", encoding="utf-8") as stream: + lines = stream.readlines() + + frame = select_first_frame(lines) + dim = dense_dimension(frame) + if dim is None: + return read_packed_reference(frame, value_type) + + text = "".join(frame) + if value_type == "complex": + values = [complex(float(real), float(imag)) for real, imag in COMPLEX_PATTERN.findall(text)] + else: + values = [float(token) for token in REAL_PATTERN.findall(text)] + # The dense matrix body is the final N*N values of the record; any earlier + # numbers belong to the metadata and UnitCell blocks. + values = values[-dim * dim:] + if len(values) != dim * dim: + raise ValueError("dense reference does not contain a full {}x{} matrix".format(dim, dim)) + return packed_from_dense(values, dim) + + def read_binary(filename, value_type): with open(filename, "rb") as stream: header = stream.read(struct.calcsize("@i")) diff --git a/tests/integrate/validation_tools/props_mat.sh b/tests/integrate/validation_tools/props_mat.sh index abe08b60683..7f04acd9b16 100644 --- a/tests/integrate/validation_tools/props_mat.sh +++ b/tests/integrate/validation_tools/props_mat.sh @@ -142,13 +142,14 @@ run_mat_props() { if ! test -z "$gamma_only" && [ $gamma_only == 1 ]; then # ========== Γ-point (single k-point) calculation ========== if ! test -z "$nspin" && [ $nspin == 2 ]; then - # nspin=2 (spin-polarized): compare hks1 + hks2 Hamiltonian + sk overlap matrix - h1ref=hks1_nao.txt.ref - h1cal=OUT.autotest/hks1_nao.txt - h2ref=hks2_nao.txt.ref - h2cal=OUT.autotest/hks2_nao.txt - sref=sk_nao.txt.ref - scal=OUT.autotest/sk_nao.txt + # nspin=2 (spin-polarized): compare hs1 + hs2 Hamiltonian + s overlap matrix + h1ref=hs1_nao.txt.ref + h1cal=OUT.autotest/hs1_nao.txt + h2ref=hs2_nao.txt.ref + h2cal=OUT.autotest/hs2_nao.txt + # S(k) is spin-independent so only one copy is written + sref=s_nao.txt.ref + scal=OUT.autotest/s_nao.txt # Compare Hamiltonian matrix for spin 1 python3 $COMPARE_SCRIPT $h1ref $h1cal 6 echo "CompareH1_pass $?" >>$props_result_file @@ -162,11 +163,11 @@ run_mat_props() { # nspin=4 : do nothing, only matching condition without any operation true else - # nspin=1 (non-spin-polarized, default case): compare single hk + sk matrix set - href=hk_nao.txt.ref - hcal=OUT.autotest/hk_nao.txt - sref=sk_nao.txt.ref - scal=OUT.autotest/sk_nao.txt + # nspin=1 (non-spin-polarized, default case): compare single h + s matrix set + href=h_nao.txt.ref + hcal=OUT.autotest/h_nao.txt + sref=s_nao.txt.ref + scal=OUT.autotest/s_nao.txt # Compare Hamiltonian matrix python3 $COMPARE_SCRIPT $href $hcal 6 echo "CompareH_pass $?" >>$props_result_file @@ -214,9 +215,9 @@ run_mat_props() { HSK_BINARY_COMPARE="$PROPS_TOOLS_DIR/compare_hsk_binary.py" if ! test -z "$gamma_only" && [ $gamma_only == 1 ]; then HSK_TEXT_REFERENCE_DIR="../scf_out_hk" - python3 $HSK_BINARY_COMPARE OUT.autotest/hk_nao.dat "$HSK_TEXT_REFERENCE_DIR/hk_nao.txt.ref" real 3 + python3 $HSK_BINARY_COMPARE OUT.autotest/hk_nao.dat "$HSK_TEXT_REFERENCE_DIR/h_nao.txt.ref" real 3 echo "CompareH_pass $?" >>$props_result_file - python3 $HSK_BINARY_COMPARE OUT.autotest/sk_nao.dat "$HSK_TEXT_REFERENCE_DIR/sk_nao.txt.ref" real 3 + python3 $HSK_BINARY_COMPARE OUT.autotest/sk_nao.dat "$HSK_TEXT_REFERENCE_DIR/s_nao.txt.ref" real 3 echo "CompareS_pass $?" >>$props_result_file else HSK_TEXT_REFERENCE_DIR="../scf_out_hsk" @@ -232,11 +233,11 @@ run_mat_props() { #-------------------------------- if ! test -z "$has_xc" && [ "$has_xc" == 1 ]; then if ! test -z "$gamma_only" && [ $gamma_only == 1 ]; then - xcref=vxc_nao.txt.ref - xccal=OUT.autotest/vxc_nao.txt + xcref=vxcmo_nao.txt.ref + xccal=OUT.autotest/vxcmo_nao.txt else - xcref=vxck2_nao.txt.ref - xccal=OUT.autotest/vxck2_nao.txt + xcref=vxcmok2_nao.txt.ref + xccal=OUT.autotest/vxcmok2_nao.txt fi oeref=eband_vxc.ref oecal=OUT.autotest/eband_vxc.txt @@ -250,8 +251,8 @@ run_mat_props() { # exchange-correlation potential #-------------------------------- if ! test -z "$has_xc2" && [ $has_xc2 == 1 ]; then - xc2ref=Vxc_R_spin0.ref - xc2cal=OUT.autotest/Vxc_R_spin0.csr + xc2ref=vxcrs1_nao.csr.ref + xc2cal=OUT.autotest/vxcrs1_nao.csr python3 $COMPARE_SCRIPT $xc2ref $xc2cal 8 echo "CompareVXC_R_pass $?" >>$props_result_file fi @@ -320,7 +321,9 @@ run_mat_props() { #----------------------------------- #echo $has_mat_r if ! test -z "$has_mat_r" && [ $has_mat_r == 1 ]; then - python3 $COMPARE_SCRIPT rr_nao.txt.ref OUT.autotest/rr_nao.txt 8 + for axis in x y z; do + python3 $COMPARE_SCRIPT "rr${axis}_nao.csr.ref" "OUT.autotest/rr${axis}_nao.csr" 8 || return 1 + done echo "ComparerR_pass $?" >>$props_result_file fi