diff --git a/docs/advanced/elec_properties/wfc.md b/docs/advanced/elec_properties/wfc.md index 51be1d8a31..dc96eb8884 100644 --- a/docs/advanced/elec_properties/wfc.md +++ b/docs/advanced/elec_properties/wfc.md @@ -1,14 +1,18 @@ # Extracting Wave Functions -ABACUS is able to output electron wave functions in both PW and LCAO basis calculations. One can find the examples in [examples/wfc](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/wfc). +ABACUS is able to output electron wave functions in both PW and LCAO basis calculations. One can find the examples in [examples/11_wfc](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/11_wfc). -## wave function in G space -For the wave function in G space, one only needs to do a ground-state energy calculation with one additional keyword in the INPUT file: '***[out_wfc_pw](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-pw)***' for PW basis calculation, and '***[out_wfc_lcao](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-lcao)***' for LCAO basis calculation. -In the PW basis case, the wave function is output in a file called `WAVEFUNC${k}.txt`, where `${k}` is the index of K point. \ -In the LCAO basis case, several `WFC_NAO_K${k}.dat` files will be output in multi-k calculation and `WFC_NAO_GAMMA1.dat` in gamma-only calculation. +## Wave Function in G-Space -## wave function in real space +To output wave functions in G-space, add one of the following keywords to the `INPUT` file while performing SCF calculation: +- **PW basis**: Set [`out_wfc_pw`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-pw) to `1`. Output file format: `wfs[spin]k[kpoint]_pw.txt`, where `[spin]` is the spin channel index, and `[kpoint]` the k-point index. -One can also choose to output real-space wave function in PW basis calculation with the key word ***[out_wfc_norm](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-norm)***. +- **LCAO basis**: Set [`out_wfc_lcao`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-lcao) to `1`. + - **Multi-k calculations**: Generates multiple files `wfs[spin]k[kpoint]_nao.txt`. + - **Gamma-only calculations**: `wfs[spin]_nao.txt` instead. -Notice: when the ***[basis_type](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#basis_type)*** is `lcao`, only `get_wf` ***[calculation](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#calculation)*** is effective. An example is [examples/wfc/lcao_ienvelope_Si2](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/wfc/lcao_ienvelope_Si2). \ No newline at end of file +## Wave Function in Real Space + +One can also choose to output real-space wave functions with the keyword [`out_wfc_norm`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-norm) or [`out_wfc_re_im`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-re-im). + +Notice: When the [`basis_type`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#basis-type) is `lcao`, only `get_wf` [`calculation`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#calculation) is effective. An example is [examples/11_wfc/lcao_ienvelope_Si2](https://github.com/deepmodeling/abacus-develop/tree/develop/examples/11_wfc/lcao_ienvelope_Si2). \ No newline at end of file diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index cfbc73065e..b0df655cbf 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -1703,7 +1703,7 @@ These variables are used to control the output of properties. - **Type**: Boolean - **Availability**: Numerical atomic orbital basis (multi-k points) -- **Description**: Whether to output the density matrix with Bravias lattice vector R index into files in the folder `OUT.${suffix}`. The files are named as `dmr{s}{spin index}{g}{geometry index}{_nao} + {".csr"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and the sparse matrix format 'csr' is mentioned in [out_mat_hs2](#out_mat_hs2). Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optinal 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the density matrix with respect to Bravias lattice vector R accumulates during ionic steps: +- **Description**: Whether to output the density matrix with Bravias lattice vector R index into files in the folder `OUT.${suffix}`. The files are named as `dmr{s}{spin index}{g}{geometry index}{_nao} + {".csr"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and the sparse matrix format 'csr' is mentioned in [out_mat_hs2](#out_mat_hs2). Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the density matrix with respect to Bravias lattice vector R accumulates during ionic steps: - nspin = 1: `dmrs1_nao.csr`; - nspin = 2: `dmrs1_nao.csr` and `dmrs2_nao.csr` for the two spin channels. - **Default**: False @@ -1726,7 +1726,7 @@ These variables are used to control the output of properties. - **Type**: Integer - **Availability**: Numerical atomic orbital basis -- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optinal)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optinal 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps. +- **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder `OUT.${suffix}`. The files are named as `wf{s}{spin index}{k(optional)}{k-point index}{g(optional)}{geometry index1}{_nao} + {".txt"/".dat"}`. Here, 's' refers to spin, where s1 means spin up channel while s2 means spin down channel, and 's12' refer to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. In addition, if 'gamma_only' is set to 0, then the optinoal k-point sampling index appears with the k-point index attached to the electronic wave function file names. Finally, if [out_app_flag](#out_app_flag) is set to false, the file name contains the optional 'g' index for each ionic step that may have different geometries, and if [out_app_flag](#out_app_flag) is set to true, the wave functions accumulate during ionic steps. - 0: no output - 1: (txt format) - gamma-only: `wfs1_nao.txt` or `wfs2_nao.txt`, ...; diff --git a/examples/08_charge_density/lcao_nspin1_Si2/INPUT b/examples/08_charge_density/lcao_nspin1_Si2/INPUT index e00ccae3cf..6a5e071c1a 100644 --- a/examples/08_charge_density/lcao_nspin1_Si2/INPUT +++ b/examples/08_charge_density/lcao_nspin1_Si2/INPUT @@ -1,16 +1,16 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB -calculation scf +calculation scf nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao -symmetry 0 +symmetry 0 #Parameters (Accuracy) -ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] +ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) out_chg 1 diff --git a/examples/08_charge_density/pw_nspin1_Al/INPUT b/examples/08_charge_density/pw_nspin1_Al/INPUT index 3abe224685..5e39315e4b 100644 --- a/examples/08_charge_density/pw_nspin1_Al/INPUT +++ b/examples/08_charge_density/pw_nspin1_Al/INPUT @@ -1,15 +1,15 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB -calculation scf +calculation scf symmetry 0 -#Parameters (Methos) +#Parameters (Methods) basis_type pw -ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] +ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] scf_thr 1.0e-8 // about iteration -scf_nmax 100 -smearing_method gauss -smearing_sigma 0.01 +scf_nmax 100 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) out_chg 1 diff --git a/examples/09_density_matrix/lcao_nspin1_Si2/INPUT b/examples/09_density_matrix/lcao_nspin1_Si2/INPUT index efccd50235..e9697104ae 100644 --- a/examples/09_density_matrix/lcao_nspin1_Si2/INPUT +++ b/examples/09_density_matrix/lcao_nspin1_Si2/INPUT @@ -1,18 +1,18 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB -calculation scf +calculation scf nbands 16 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao -symmetry 0 +symmetry 0 #Parameters (Accuracy) -ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] +ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) -gamma_only 1 +gamma_only 1 out_dmk 1 diff --git a/examples/11_wfc/README b/examples/11_wfc/README index d72132fb65..9c316fe2d8 100644 --- a/examples/11_wfc/README +++ b/examples/11_wfc/README @@ -1,16 +1,16 @@ -These examples show how to output the wavefunction in G space. -For PW basis: - - set 'out_wfc_pw' to '1' -The wave function is output in a file called 'WAVEFUNC1.txt' +These examples demonstrate how to output wave functions in G-space and real space. -For LCAO basis: - - set 'out_wfc_lcao' to '1' -Several `WFC_NAO_K#.txt` files will be output in multi-k calculation and -`WFC_NAO_GAMMA1.txt` in gamma-only calculation. +For Plane-Wave (PW) Basis: + - Set `out_wfc_pw = 1`. +The wave functions will be output to a series of files named `wfs[spin]k[kpoint]_pw.txt`. +For LCAO Basis: + - Set `out_wfc_lcao = 1`. +In multi-k calculations, multiple files named `wfs[spin]k[kpoint]_nao.txt` will be generated. +In gamma-only calculations, `wfs[spin]_nao.txt` instead. -For the wave functions in Real Space: - - set 'out_wfc_r' to '1' -The wave function is output in files OUT.${suffix}/wfc_realspace/wfc_realspace_$K_$B, -where $K and $B is the index of k point and band respectively. -Note, it is only used in planewave basis and get_wf calculation in localized orbitals set +For Wave Functions in Real Space: + - Set either `out_wfc_norm` or `out_wfc_re_im` to a space-separated string of 0s and 1s. + - E.g.: `1 0 0 0 0 1 1 1 1 1 0`, or `1 4*0 5*1 0` for short. +The wave functions will be output to files named `wfi[state]s[spin]k[kpoint][re/im].cube`. +Note, it is only supported for PW basis and `get_wf` calculation under LCAO basis. diff --git a/examples/11_wfc/lcao_ienvelope_Si2/INPUT1 b/examples/11_wfc/lcao_ienvelope_Si2/INPUT1 index f3f16b73e2..0b9d756815 100644 --- a/examples/11_wfc/lcao_ienvelope_Si2/INPUT1 +++ b/examples/11_wfc/lcao_ienvelope_Si2/INPUT1 @@ -1,16 +1,16 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB calculation scf ntype 1 nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao symmetry 0 #Parameters (Accuracy) ecutwfc 50 scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) -out_wfc_lcao 1 +out_wfc_lcao 1 diff --git a/examples/11_wfc/lcao_ienvelope_Si2/INPUT2 b/examples/11_wfc/lcao_ienvelope_Si2/INPUT2 index e7204ca808..ff23138ad0 100644 --- a/examples/11_wfc/lcao_ienvelope_Si2/INPUT2 +++ b/examples/11_wfc/lcao_ienvelope_Si2/INPUT2 @@ -1,14 +1,14 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB calculation get_wf nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao symmetry 0 #Parameters (Accuracy) ecutwfc 50 #Parameters (File) -init_wfc file -out_wfc_r 1 +init_wfc file +out_wfc_norm 4*1 diff --git a/examples/11_wfc/lcao_ienvelope_Si2/run.sh b/examples/11_wfc/lcao_ienvelope_Si2/run.sh index 76b6dee1ef..bccfe4d409 100644 --- a/examples/11_wfc/lcao_ienvelope_Si2/run.sh +++ b/examples/11_wfc/lcao_ienvelope_Si2/run.sh @@ -15,8 +15,8 @@ if [[ ! -f scf.output ]] || [[ ! -f get_wf.output ]] || [[ ! -f OUT.ABACUS/running_scf.log ]] || [[ ! -f OUT.ABACUS/running_get_wf.log ]] || - [[ ! -f OUT.ABACUS/WFC_NAO_K1.txt ]] || - [[ ! -f OUT.ABACUS/WFC_NAO_K36.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] || [[ ! ( "$(tail -1 OUT.ABACUS/running_get_wf.log)" == " Total Time :"* ) ]] then diff --git a/examples/11_wfc/lcao_scf_Si2/INPUT b/examples/11_wfc/lcao_scf_Si2/INPUT index 97c5e305c9..4998ebf5fe 100644 --- a/examples/11_wfc/lcao_scf_Si2/INPUT +++ b/examples/11_wfc/lcao_scf_Si2/INPUT @@ -1,18 +1,18 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB calculation scf nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao symmetry 0 #Parameters (Accuracy) -ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] +ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) -out_wfc_lcao 1 +out_wfc_lcao 1 ### [1] Energy cutoff determines the quality of numerical quadratures in your calculations. diff --git a/examples/11_wfc/lcao_scf_Si2/run.sh b/examples/11_wfc/lcao_scf_Si2/run.sh index b3f89aabf2..016f9df82f 100644 --- a/examples/11_wfc/lcao_scf_Si2/run.sh +++ b/examples/11_wfc/lcao_scf_Si2/run.sh @@ -8,8 +8,8 @@ OMP_NUM_THREADS=${ABACUS_THREADS} mpirun -np ${ABACUS_NPROCS} ${ABACUS_PATH} | t if [[ ! -f output ]] || [[ ! -f OUT.ABACUS/running_scf.log ]] || - [[ ! -f OUT.ABACUS/WFC_NAO_K1.txt ]] || - [[ ! -f OUT.ABACUS/WFC_NAO_K36.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k1_nao.txt ]] || + [[ ! -f OUT.ABACUS/wfs1k36_nao.txt ]] || [[ ! ( "$(tail -1 OUT.ABACUS/running_scf.log)" == " Total Time :"* ) ]] then echo "job failed!" diff --git a/examples/11_wfc/pw_scf_Al/INPUT b/examples/11_wfc/pw_scf_Al/INPUT index 36b30243ac..83bd18cf63 100644 --- a/examples/11_wfc/pw_scf_Al/INPUT +++ b/examples/11_wfc/pw_scf_Al/INPUT @@ -1,18 +1,18 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB calculation scf symmetry 0 -#Parameters (Methos) +#Parameters (Methods) basis_type pw -ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] +ecutwfc 60 ###Energy cutoff needs to be tested to ensure your calculation is reliable.[1] scf_thr 1.0e-8 // about iteration -scf_nmax 100 -smearing_method gauss -smearing_sigma 0.01 +scf_nmax 100 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) -out_wfc_pw 1 -out_wfc_r 1 +out_wfc_pw 1 +out_wfc_norm 1*1 ### [1] Energy cutoff determines the quality of numerical quadratures in your calculations. diff --git a/examples/12_band/lcao_Si2/INPUT1 b/examples/12_band/lcao_Si2/INPUT1 index 951cd252eb..6ef4693493 100644 --- a/examples/12_band/lcao_Si2/INPUT1 +++ b/examples/12_band/lcao_Si2/INPUT1 @@ -1,16 +1,16 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB calculation scf -ntype 1 +ntype 1 nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao -symmetry 0 +symmetry 0 #Parameters (Accuracy) ecutwfc 50 scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) out_chg 1 diff --git a/examples/12_band/lcao_Si2/INPUT2 b/examples/12_band/lcao_Si2/INPUT2 index 4a1741aa29..17d948a40b 100644 --- a/examples/12_band/lcao_Si2/INPUT2 +++ b/examples/12_band/lcao_Si2/INPUT2 @@ -1,16 +1,16 @@ INPUT_PARAMETERS #Parameters (General) -kpoint_file KLINES -pseudo_dir ../../../tests/PP_ORB -orbital_dir ../../../tests/PP_ORB -calculation nscf -ntype 1 -nbands 8 -symmetry 0 -#Parameters (Methos) -basis_type lcao +kpoint_file KLINES +pseudo_dir ../../../tests/PP_ORB +orbital_dir ../../../tests/PP_ORB +calculation nscf +ntype 1 +nbands 8 +symmetry 0 +#Parameters (Methods) +basis_type lcao #Parameters (Accuracy) -ecutwfc 50 +ecutwfc 50 #Parameters (File) -init_chg file -out_band 1 +init_chg file +out_band 1 diff --git a/examples/12_band/pw_Al/INPUT1 b/examples/12_band/pw_Al/INPUT1 index 9dfc8da764..7e03c67d33 100644 --- a/examples/12_band/pw_Al/INPUT1 +++ b/examples/12_band/pw_Al/INPUT1 @@ -1,15 +1,15 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB calculation scf -ntype 1 +ntype 1 symmetry 0 -#Parameters (Methos) +#Parameters (Methods) basis_type pw ecutwfc 50 scf_thr 1.0e-8 // about iteration -scf_nmax 100 -smearing_method gauss -smearing_sigma 0.01 +scf_nmax 100 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) out_chg 1 diff --git a/examples/12_band/pw_Al/INPUT2 b/examples/12_band/pw_Al/INPUT2 index 158c0da9e3..621e6b9e8b 100644 --- a/examples/12_band/pw_Al/INPUT2 +++ b/examples/12_band/pw_Al/INPUT2 @@ -1,18 +1,18 @@ INPUT_PARAMETERS #Parameters (General) -kpoint_file KLINES -pseudo_dir ../../../tests/PP_ORB -calculation nscf -ntype 1 -symmetry 0 -#Parameters (Methos) -ecutwfc 50 -basis_type pw -pw_diag_thr 1e-10 -pw_diag_nmax 100 +kpoint_file KLINES +pseudo_dir ../../../tests/PP_ORB +calculation nscf +ntype 1 +symmetry 0 +#Parameters (Methods) +ecutwfc 50 +basis_type pw +pw_diag_thr 1e-10 +pw_diag_nmax 100 #Parameters (Accuracy) -smearing_method gauss -smearing_sigma 0.01 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) -init_chg file -out_band 1 +init_chg file +out_band 1 diff --git a/examples/13_dos/lcao_Si2/INPUT1 b/examples/13_dos/lcao_Si2/INPUT1 index 2918af1081..04fc9f5c02 100644 --- a/examples/13_dos/lcao_Si2/INPUT1 +++ b/examples/13_dos/lcao_Si2/INPUT1 @@ -1,16 +1,16 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB orbital_dir ../../../tests/PP_ORB calculation scf ntype 1 nbands 8 -#Parameters (Methos) +#Parameters (Methods) basis_type lcao symmetry 0 #Parameters (Accuracy) ecutwfc 50 scf_thr 1.0e-7 // about iteration -scf_nmax 100 +scf_nmax 100 #Parameters (File) out_chg 1 \ No newline at end of file diff --git a/examples/13_dos/lcao_Si2/INPUT2 b/examples/13_dos/lcao_Si2/INPUT2 index 8f02b8355c..48051763a2 100644 --- a/examples/13_dos/lcao_Si2/INPUT2 +++ b/examples/13_dos/lcao_Si2/INPUT2 @@ -1,16 +1,16 @@ INPUT_PARAMETERS #Parameters (General) -pseudo_dir ../../../tests/PP_ORB -orbital_dir ../../../tests/PP_ORB -calculation nscf -ntype 1 -nbands 8 -symmetry 0 -#Parameters (Methos) -basis_type lcao +pseudo_dir ../../../tests/PP_ORB +orbital_dir ../../../tests/PP_ORB +calculation nscf +ntype 1 +nbands 8 +symmetry 0 +#Parameters (Methods) +basis_type lcao #Parameters (Accuracy) -ecutwfc 50 +ecutwfc 50 #Parameters (File) -init_chg file -out_dos 1 -dos_sigma 0.07 +init_chg file +out_dos 1 +dos_sigma 0.07 diff --git a/examples/13_dos/pw_Al/INPUT1 b/examples/13_dos/pw_Al/INPUT1 index 9dfc8da764..ff0c3091c0 100644 --- a/examples/13_dos/pw_Al/INPUT1 +++ b/examples/13_dos/pw_Al/INPUT1 @@ -1,15 +1,15 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) pseudo_dir ../../../tests/PP_ORB calculation scf ntype 1 symmetry 0 -#Parameters (Methos) +#Parameters (Methods) basis_type pw ecutwfc 50 scf_thr 1.0e-8 // about iteration -scf_nmax 100 -smearing_method gauss -smearing_sigma 0.01 +scf_nmax 100 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) out_chg 1 diff --git a/examples/13_dos/pw_Al/INPUT2 b/examples/13_dos/pw_Al/INPUT2 index d8645e16e7..36e5bf89b3 100644 --- a/examples/13_dos/pw_Al/INPUT2 +++ b/examples/13_dos/pw_Al/INPUT2 @@ -1,17 +1,17 @@ INPUT_PARAMETERS #Parameters (General) -pseudo_dir ../../../tests/PP_ORB -calculation nscf -ntype 1 -symmetry 0 -#Parameters (Methos) -ecutwfc 50 -basis_type pw -pw_diag_thr 1e-10 -pw_diag_nmax 100 +pseudo_dir ../../../tests/PP_ORB +calculation nscf +ntype 1 +symmetry 0 +#Parameters (Methods) +ecutwfc 50 +basis_type pw +pw_diag_thr 1e-10 +pw_diag_nmax 100 #Parameters (Accuracy) -smearing_method gauss -smearing_sigma 0.01 +smearing_method gauss +smearing_sigma 0.01 #Parameters (File) -init_chg file -out_dos 1 +init_chg file +out_dos 1 diff --git a/examples/interface_ShengBTE/LCAO/2nd/INPUT b/examples/interface_ShengBTE/LCAO/2nd/INPUT index d958881645..1ca1870848 100644 --- a/examples/interface_ShengBTE/LCAO/2nd/INPUT +++ b/examples/interface_ShengBTE/LCAO/2nd/INPUT @@ -1,5 +1,5 @@ INPUT_PARAMETERS -#Parameters (General) +#Parameters (General) suffix DIA-50 calculation scf diff --git a/examples/interface_ShengBTE/LCAO/3rd/run_stru.sh b/examples/interface_ShengBTE/LCAO/3rd/run_stru.sh index 14566f6421..c96a9458f7 100644 --- a/examples/interface_ShengBTE/LCAO/3rd/run_stru.sh +++ b/examples/interface_ShengBTE/LCAO/3rd/run_stru.sh @@ -9,7 +9,7 @@ cd SCF-$stru pwd cat > INPUT < INPUT < diff --git a/source/source_esolver/esolver_ks_pw.cpp b/source/source_esolver/esolver_ks_pw.cpp index 559bb593a4..68c8fb43dc 100644 --- a/source/source_esolver/esolver_ks_pw.cpp +++ b/source/source_esolver/esolver_ks_pw.cpp @@ -31,7 +31,6 @@ #include "source_io/winput.h" #include "source_io/write_dos_pw.h" #include "source_io/write_wfc_pw.h" -#include "source_io/write_wfc_r.h" #include "module_parameter/parameter.h" #include @@ -944,16 +943,6 @@ void ESolver_KS_PW::after_all_runners(UnitCell& ucell) //---------------------------------------------------------- //! 5) Print out electronic wave functions in real space //---------------------------------------------------------- - - //---------------------------------------------------------- - //! The write_psi_r_1 interface will be removed in the very - //! near future. Don't use it! - //---------------------------------------------------------- - // if (PARAM.inp.out_wfc_r == 1) // Peize Lin add 2021.11.21 - // { - // ModuleIO::write_psi_r_1(ucell, this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv); - // } - const std::vector out_wfc_norm = PARAM.inp.out_wfc_norm; const std::vector out_wfc_re_im = PARAM.inp.out_wfc_re_im; if (out_wfc_norm.size() > 0 || out_wfc_re_im.size() > 0) diff --git a/source/source_esolver/pw_others.cpp b/source/source_esolver/pw_others.cpp index 37bd3d3efc..4915f8834e 100644 --- a/source/source_esolver/pw_others.cpp +++ b/source/source_esolver/pw_others.cpp @@ -33,7 +33,6 @@ #include "source_io/to_wannier90_pw.h" #include "source_io/winput.h" #include "source_io/write_elecstat_pot.h" -#include "source_io/write_wfc_r.h" #include "module_parameter/parameter.h" #include diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index 33ef23f987..7fb9ff113a 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -30,7 +30,6 @@ list(APPEND objects write_dipole.cpp write_mlkedf_descriptors.cpp td_current_io.cpp - write_wfc_r.cpp write_libxc_r.cpp output_log.cpp para_json.cpp diff --git a/source/source_io/filename.cpp b/source/source_io/filename.cpp index 39c5da6315..d2b22fb084 100644 --- a/source/source_io/filename.cpp +++ b/source/source_io/filename.cpp @@ -19,7 +19,7 @@ std::string filename_output( const int istep) { // output filename = "{PARAM.globalv.global_out_dir}/property{s}{spin index} - // {k(optinal)}{k-point index}{g(optional)}{geometry index1}{_basis(nao|pw)} + // {k(optional)}{k-point index}{g(optional)}{geometry index1}{_basis(nao|pw)} // + {".txt"/".dat"}" std::set valid_properties = {"wf", "chg", "hk", "sk", "tk", "vxc"}; diff --git a/source/source_io/write_wfc_r.cpp b/source/source_io/write_wfc_r.cpp deleted file mode 100644 index ef52c4347a..0000000000 --- a/source/source_io/write_wfc_r.cpp +++ /dev/null @@ -1,207 +0,0 @@ -//====================== -// AUTHOR : Peize Lin -#include "module_parameter/parameter.h" -// DATE : 2021-11-21 -//====================== - -//====================== -// WARNING: These interfaces will be removed in the future! Do not use them! -// Taoni add 2024-10-08 -//====================== - -#include "source_base/timer.h" -#include "source_base/tool_title.h" -#include "source_pw/hamilt_pwdft/global.h" -#include "write_wfc_r.h" - -#include -#include -#include - -namespace ModuleIO -{ -// write ||wfc_r|| for all k-points and all bands -// Input: wfc_g(ik, ib, ig) -// loop order is for(z){for(y){for(x)}} -void write_psi_r_1(const UnitCell& ucell, - const psi::Psi>& wfc_g, - const ModulePW::PW_Basis_K* wfcpw, - const std::string& folder_name, - const bool& square, - const K_Vectors& kv) -{ - ModuleBase::TITLE("ModuleIO", "write_psi_r_1"); - ModuleBase::timer::tick("ModuleIO", "write_psi_r_1"); - - const std::string outdir = PARAM.globalv.global_out_dir + folder_name + "/"; - ModuleBase::GlobalFunc::MAKE_DIR(outdir); -#ifdef __MPI - std::vector mpi_requests; -#endif - for (int ik = 0; ik < wfc_g.get_nk(); ++ik) - { - wfc_g.fix_k(ik); - const int ik_out = (PARAM.inp.nspin != 2) - ? ik + kv.para_k.startk_pool[GlobalV::MY_POOL] - : ik - kv.get_nks() / 2 * kv.isk[ik] + kv.get_nkstot() / 2 * kv.isk[ik] - + kv.para_k.startk_pool[GlobalV::MY_POOL]; - for (int ib = 0; ib < wfc_g.get_nbands(); ++ib) - { - const std::vector> wfc_r = cal_wfc_r(wfcpw, wfc_g, ik, ib); - - std::vector wfc_real(wfc_r.size()); - std::vector wfc_imag; - if (square) - { - for (int ir = 0; ir < wfc_real.size(); ++ir) - { - wfc_real[ir] = std::norm(wfc_r[ir]); // "std::norm(z)" returns |z|^2 - } - } - else - { - wfc_imag.resize(wfc_r.size()); - for (int ir = 0; ir < wfc_real.size(); ++ir) - { - wfc_real[ir] = wfc_r[ir].real(); - wfc_imag[ir] = wfc_r[ir].imag(); - } - } - const std::string file_name_base = outdir + "wfc_realspace_" + - ModuleBase::GlobalFunc::TO_STRING(ik_out) + "_" + - ModuleBase::GlobalFunc::TO_STRING(ib); - const std::string file_name = square ? file_name_base : file_name_base + "_imag"; -#ifdef __MPI - // Use write_chg_r_1 to output the real and imaginary parts of the wave function to file - mpi_requests.push_back({}); - write_chg_r_1(ucell,wfcpw, wfc_real, file_name, mpi_requests.back()); -#else - write_chg_r_1(ucell,wfcpw, wfc_real, file_name); - // if (!square) - // write_chg_r_1(wfc_imag, file_name + "_imag", mpi_requests.back()); -#endif - } - } -#ifdef __MPI - MPI_Waitall(mpi_requests.size(), mpi_requests.data(), MPI_STATUSES_IGNORE); -#endif - ModuleBase::timer::tick("ModuleIO", "write_psi_r_1"); -} -// processes output pipeline: -// -// t0 t1 t2 t3 t4 t5 t6 t7 -// --------------------------------> -// rank0 k0 k1 k2 k3 k4 k5 -// \ \ \ \ \ \ - // rank1 k0 k1 k2 k3 k4 k5 -// \ \ \ \ \ \ - // rank2 k0 k1 k2 k3 k4 k5 - -// Input: wfc_g(ib,ig) -// Output: wfc_r[ir] -std::vector> cal_wfc_r(const ModulePW::PW_Basis_K* wfcpw, - const psi::Psi>& wfc_g, - const int ik, - const int ib) -{ - ModuleBase::timer::tick("ModuleIO", "cal_wfc_r"); - - std::vector> wfc_r(wfcpw->nrxx); - wfcpw->recip2real(&wfc_g(ib, 0), wfc_r.data(), ik); - - ModuleBase::timer::tick("ModuleIO", "cal_wfc_r"); - return wfc_r; -} - -// Input: chg_r[ir] -void write_chg_r_1(const UnitCell& ucell, - const ModulePW::PW_Basis_K* wfcpw, - const std::vector& chg_r, - const std::string& file_name - #ifdef __MPI - ,MPI_Request& mpi_request - #endif - ) -{ - ModuleBase::timer::tick("ModuleIO", "write_chg_r_1"); - std::ofstream ofs; - -#ifdef __MPI - constexpr int mpi_tag = 100; - if (GlobalV::RANK_IN_POOL == 0) - { -#endif - ofs.open(file_name); - - ofs << "calculated by ABACUS" << std::endl; - ofs << ucell.lat0_angstrom << std::endl; - ofs << ucell.latvec.e11 << " " << ucell.latvec.e12 << " " << ucell.latvec.e13 - << std::endl - << ucell.latvec.e21 << " " << ucell.latvec.e22 << " " << ucell.latvec.e23 - << std::endl - << ucell.latvec.e31 << " " << ucell.latvec.e32 << " " << ucell.latvec.e33 - << std::endl; - - for (int it = 0; it < ucell.ntype; ++it) - { - ofs << ucell.atoms[it].label << "\t"; - } - ofs << std::endl; - for (int it = 0; it < ucell.ntype; ++it) - { - ofs << ucell.atoms[it].na << "\t"; - } - ofs << std::endl; - - ofs << "Direct" << std::endl; - for (int it = 0; it < ucell.ntype; ++it) - { - for (int ia = 0; ia < ucell.atoms[it].na; ++ia) - { - ofs << ucell.atoms[it].taud[ia].x << " " << ucell.atoms[it].taud[ia].y << " " - << ucell.atoms[it].taud[ia].z << std::endl; - } - } - ofs << std::endl; - - ofs << wfcpw->nx << " " << wfcpw->ny << " " << wfcpw->nz << std::endl; -#ifdef __MPI - } - else - { - char recv_tmp; - MPI_Recv(&recv_tmp, 1, MPI_CHAR, GlobalV::RANK_IN_POOL - 1, mpi_tag, POOL_WORLD, MPI_STATUS_IGNORE); - - ofs.open(file_name, std::ofstream::app); - } -#endif - - assert(wfcpw->nx * wfcpw->ny * wfcpw->nplane == chg_r.size()); - for (int iz = 0; iz < wfcpw->nplane; ++iz) - { - for (int iy = 0; iy < wfcpw->ny; ++iy) - { - for (int ix = 0; ix < wfcpw->nx; ++ix) - { - const int ir = (ix * wfcpw->ny + iy) * wfcpw->nplane + iz; - ofs << chg_r[ir] << " "; - } - ofs << "\n"; - } - } - ofs.close(); - -#ifdef __MPI - if (GlobalV::RANK_IN_POOL < GlobalV::NPROC_IN_POOL - 1) - { - const char send_tmp = 'c'; - MPI_Isend(&send_tmp, 1, MPI_CHAR, GlobalV::RANK_IN_POOL + 1, mpi_tag, POOL_WORLD, &mpi_request); - } - else - { - mpi_request = MPI_REQUEST_NULL; - } -#endif - ModuleBase::timer::tick("ModuleIO", "write_chg_r_1"); -} -}; // namespace ModuleIO diff --git a/source/source_io/write_wfc_r.h b/source/source_io/write_wfc_r.h deleted file mode 100644 index f952c21603..0000000000 --- a/source/source_io/write_wfc_r.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef WRITE_WFC_R_H -#define WRITE_WFC_R_H - -#ifdef __MPI -#include "mpi.h" -#endif - -#include -#include -#include - -#include "source_base/complexmatrix.h" -#include "source_base/vector3.h" -#include "source_basis/module_pw/pw_basis_k.h" -#include "source_cell/klist.h" -#include "source_psi/psi.h" - -namespace ModuleIO -{ - // write ||wfc_r|| for all k-points and all bands - // Input: wfc_g[ik](ib,ig) - // loop order is for(z){for(y){for(x)}} -void write_psi_r_1(const UnitCell& ucell, - const psi::Psi>& wfc_g, - const ModulePW::PW_Basis_K* wfcpw, - const std::string& folder_name, - const bool& square, - const K_Vectors& kv); - -// Input: wfc_g(ib,ig) -// Output: wfc_r[ir] -std::vector> cal_wfc_r(const ModulePW::PW_Basis_K* wfcpw, - const psi::Psi>& wfc_g, - const int ik, - const int ib); - -// Input: chg_r[ir] -void write_chg_r_1(const UnitCell& ucell, - const ModulePW::PW_Basis_K* wfcpw, - const std::vector& chg_r, - const std::string& file_name - #ifdef __MPI - ,MPI_Request& mpi_request - #endif - ); -} - -#endif diff --git a/source/source_relax/relax_driver.cpp b/source/source_relax/relax_driver.cpp index e15b294fb1..2e198f6012 100644 --- a/source/source_relax/relax_driver.cpp +++ b/source/source_relax/relax_driver.cpp @@ -7,7 +7,6 @@ #include "source_io/output_log.h" #include "source_io/print_info.h" #include "source_io/read_exit_file.h" -#include "source_io/write_wfc_r.h" #include "module_parameter/parameter.h" #include "source_cell/print_cell.h"