Skip to content

Commit b9e83cb

Browse files
committed
Feature: Support cube format real-space wave function output for Plane Wave basis set
1 parent 281d2a2 commit b9e83cb

File tree

4 files changed

+381
-122
lines changed

4 files changed

+381
-122
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ These variables are used to control the output of properties.
16701670
- 2: results are stored in binary files named `OUT.${suffix}/WAVEFUNC${K}.dat`.
16711671
- **Default**: 0
16721672

1673-
### out_wfc_r
1673+
### out_wfc_r (deprecated)
16741674

16751675
- **Type**: Boolean
16761676
- **Availability**: Plane wave basis or get_wf calculation in numerical atomic orbital basis
@@ -1911,14 +1911,14 @@ The band (KS orbital) energy for each (k-point, spin, band) will be printed in t
19111911
### out_wfc_norm
19121912

19131913
- **Type**: String
1914-
- **Availability**: For LCAO, used when `calculation = get_wf`.
1914+
- **Availability**: For both PW and LCAO. When `basis_type = lcao`, used when `calculation = get_wf`.
19151915
- **Description**: Specifies the bands to calculate the real-space wave function modulus (norm, or known as the envelope function) $|\psi(r)|$. The syntax and band selection rules are identical to [`out_pchg`](#out_pchg), but the output is the norm of the wave function.
19161916
- **Default**: none
19171917

19181918
### out_wfc_re_im
19191919

19201920
- **Type**: String
1921-
- **Availability**: For LCAO, used when `calculation = get_wf`.
1921+
- **Availability**: For both PW and LCAO. When `basis_type = lcao`, used when `calculation = get_wf`.
19221922
- **Description**: Specifies the bands to calculate the real and imaginary parts of the wave function $\text{Re}(\psi(r))$ and $\text{Im}(\psi(r))$. The syntax and band selection rules are identical to [`out_pchg`](#out_pchg), but the output contains both the real and imaginary components of the wave function.
19231923
- **Default**: none
19241924

source/module_esolver/esolver_ks_pw.cpp

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "module_io/berryphase.h"
2525
#include "module_io/cal_ldos.h"
2626
#include "module_io/get_pchg_pw.h"
27+
#include "module_io/get_wf_pw.h"
2728
#include "module_io/numerical_basis.h"
2829
#include "module_io/numerical_descriptor.h"
2930
#include "module_io/to_wannier90_pw.h"
@@ -933,9 +934,41 @@ void ESolver_KS_PW<T, Device>::after_all_runners(UnitCell& ucell)
933934
//----------------------------------------------------------
934935
//! 5) Print out electronic wave functions in real space
935936
//----------------------------------------------------------
936-
if (PARAM.inp.out_wfc_r == 1) // Peize Lin add 2021.11.21
937+
938+
//----------------------------------------------------------
939+
//! The write_psi_r_1 interface will be removed in the very
940+
//! near future. Don't use it!
941+
//----------------------------------------------------------
942+
// if (PARAM.inp.out_wfc_r == 1) // Peize Lin add 2021.11.21
943+
// {
944+
// ModuleIO::write_psi_r_1(ucell, this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv);
945+
// }
946+
947+
const std::vector<int> out_wfc_norm = PARAM.inp.out_wfc_norm;
948+
const std::vector<int> out_wfc_re_im = PARAM.inp.out_wfc_re_im;
949+
if (out_wfc_norm.size() > 0)
937950
{
938-
ModuleIO::write_psi_r_1(ucell, this->psi[0], this->pw_wfc, "wfc_realspace", true, this->kv);
951+
ModuleIO::get_wf_pw(out_wfc_norm,
952+
out_wfc_re_im,
953+
this->kspw_psi->get_nbands(),
954+
PARAM.inp.nspin,
955+
this->pw_rhod->nx,
956+
this->pw_rhod->ny,
957+
this->pw_rhod->nz,
958+
this->pw_rhod->nxyz,
959+
this->kv.get_nks(),
960+
this->kv.isk,
961+
this->kv.wk,
962+
this->pw_big->bz,
963+
this->pw_big->nbz,
964+
this->chr.ngmc,
965+
&ucell,
966+
this->psi,
967+
this->pw_rhod,
968+
this->pw_wfc,
969+
this->ctx,
970+
this->Pgrid,
971+
PARAM.globalv.global_out_dir);
939972
}
940973

941974
//----------------------------------------------------------

0 commit comments

Comments
 (0)