Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions docs/advanced/elec_properties/wfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ ABACUS is able to output electron wave functions in both PW and LCAO basis calcu
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.

- **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.
- **LCAO basis**: Set [`out_wfc_lcao`](https://abacus-rtd.readthedocs.io/en/latest/advanced/input_files/input-main.html#out-wfc-lcao) to `1` for text or `2` for binary output.
- **Multi-k calculations**: Generates multiple files `wfs[spin]k[kpoint]_nao.txt` or `.dat`.
- **Gamma-only calculations**: Generates `wfs[spin]_nao.txt` or `.dat` instead.

To reuse LCAO coefficients, set `init_wfc file`, point `read_file_dir` to the coefficient files, and set `read_wfc_lcao` to `1` for text or `2` for binary input. The selected extension is required; there is no automatic format fallback.

## 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).
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).
17 changes: 16 additions & 1 deletion docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- [latname](#latname)
- [assume\_isolated](#assume_isolated)
- [init\_wfc](#init_wfc)
- [read\_wfc\_lcao](#read_wfc_lcao)
- [init\_chg](#init_chg)
- [init\_vel](#init_vel)
- [mem\_saver](#mem_saver)
Expand Down Expand Up @@ -737,14 +738,28 @@

- atomic: from atomic pseudo wave functions. If they are not enough, other wave functions are initialized with random numbers.
- atomic+random: add small random numbers on atomic pseudo-wavefunctions
- file: from binary files wf*.dat, which are output by setting out_wfc_pw to 2.
- file: from wave function coefficient files. For PW calculations, binary `wf*.dat` files are generated by setting `out_wfc_pw` to 2. For LCAO calculations, the text or binary format is selected by `read_wfc_lcao` and generated by setting `out_wfc_lcao` to the corresponding value.
- random: random numbers
- nao: from numerical atomic orbitals. If they are not enough, other wave functions are initialized with random numbers.
- nao+random: add small random numbers on numerical atomic orbitals

> Note: Only the file option is useful for the lcao basis set, which is mostly used when calculation is set to get_wf and get_pchg.
- **Default**: atomic

### read_wfc_lcao

- **Type**: Integer
- **Availability**: *[`basis_type`](#basis_type)==lcao*
- **Description**: The file format used when reading LCAO wave function coefficients.

Available options are:

- 1: text files (`.txt`) generated by setting `out_wfc_lcao` to 1.
- 2: binary files (`.dat`) generated by setting `out_wfc_lcao` to 2.

The selected format is used directly; ABACUS does not automatically detect or fall back to the other format. Only independent wave function files are supported, not files accumulated with `out_app_flag`.
- **Default**: 1

### init_chg

- **Type**: String
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/scf/initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ Atomic wave function is read from pseudopotential file under keyword `PP_PSWFC`,

When `basis_type=lcao`, we further support reading of initial wavefunction by setting `init_wfc` to `file`.
In LCAO code, wave function is used to initialize density matrix and real-space charge density.
For such purpose, a file containing wavefunction must be prepared. Such files can be generated from previous calculations with [`out_wfc_lcao 1`](../elec_properties/wfc.md).
For such purpose, files containing wavefunction coefficients must be prepared. They can be generated by a previous calculation with [`out_wfc_lcao 1`](../elec_properties/wfc.md) for text files or `out_wfc_lcao 2` for binary files. Set `read_wfc_lcao` to the same value when reading them; ABACUS does not automatically switch between formats.
16 changes: 15 additions & 1 deletion docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ parameters:
Available options are:
* atomic: from atomic pseudo wave functions. If they are not enough, other wave functions are initialized with random numbers.
* atomic+random: add small random numbers on atomic pseudo-wavefunctions
* file: from binary files wf*.dat, which are output by setting out_wfc_pw to 2.
* file: from wave function coefficient files. For PW calculations, binary `wf*.dat` files are generated by setting `out_wfc_pw` to 2. For LCAO calculations, the text or binary format is selected by `read_wfc_lcao` and generated by setting `out_wfc_lcao` to the corresponding value.
* random: random numbers
* nao: from numerical atomic orbitals. If they are not enough, other wave functions are initialized with random numbers.
* nao+random: add small random numbers on numerical atomic orbitals
Expand All @@ -177,6 +177,20 @@ parameters:
default_value: atomic
unit: ""
availability: ""
- name: read_wfc_lcao
category: System variables
type: Integer
description: |
The file format used when reading LCAO wave function coefficients.

Available options are:
* 1: text files (`.txt`) generated by setting `out_wfc_lcao` to 1.
* 2: binary files (`.dat`) generated by setting `out_wfc_lcao` to 2.

The selected format is used directly; ABACUS does not automatically detect or fall back to the other format. Only independent wave function files are supported, not files accumulated with `out_app_flag`.
default_value: "1"
unit: ""
availability: basis_type==lcao
- name: init_chg
category: System variables
type: String
Expand Down
1 change: 1 addition & 0 deletions source/source_esolver/esolver_ks_lcao_tddft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ void ESolver_KS_LCAO_TDDFT<TR, Device>::before_all_runners(BaseCell& basecell, c
this->kv.ik2iktot,
this->kv.get_nkstot(),
this->inp_->nspin,
this->inp_->read_wfc_lcao,
0,
TD_info::estep_shift))
{
Expand Down
1 change: 1 addition & 0 deletions source/source_esolver/esolver_lr_lcao_tddft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,7 @@ void ModuleESolver::ESolver_LR<T, TR>::read_ks_wfc()
this->kv.ik2iktot,
this->kv.get_nkstot(),
this->inp_->nspin,
this->inp_->read_wfc_lcao,
/*skip_bands=*/this->nocc_max - this->nocc_in)) {
ModuleBase::WARNING_QUIT("ESolver_LR", "read ground-state wavefunction failed.");
}
Expand Down
1 change: 1 addition & 0 deletions source/source_io/module_parameter/input_parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct Input_para
double erf_sigma = 0.1; ///< the width of the energy step for reciprocal vectors
int fft_mode = 0; ///< fftw mode 0: estimate, 1: measure, 2: patient, 3: exhaustive
std::string init_wfc = "atomic"; ///< "file","atomic","random"
int read_wfc_lcao = 1; ///< LCAO wavefunction input format: 1 text, 2 binary
int pw_seed = 0; ///< random seed for initializing wave functions
std::string init_chg = "atomic"; ///< "file","atomic"
bool dm_to_rho = false; ///< read density matrix from npz format and calculate charge density
Expand Down
26 changes: 25 additions & 1 deletion source/source_io/module_parameter/read_inp_sys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ Theory: G. Makov and M. C. Payne, Phys. Rev. B 51, 4014 (1995).)";
Available options are:
* atomic: from atomic pseudo wave functions. If they are not enough, other wave functions are initialized with random numbers.
* atomic+random: add small random numbers on atomic pseudo-wavefunctions
* file: from binary files wf*.dat, which are output by setting out_wfc_pw to 2.
* file: from wave function coefficient files. For PW calculations, binary `wf*.dat` files are generated by setting `out_wfc_pw` to 2. For LCAO calculations, the text or binary format is selected by `read_wfc_lcao` and generated by setting `out_wfc_lcao` to the corresponding value.
* random: random numbers
* nao: from numerical atomic orbitals. If they are not enough, other wave functions are initialized with random numbers.
* nao+random: add small random numbers on numerical atomic orbitals
Expand All @@ -474,6 +474,30 @@ Available options are:
read_sync_string(input.init_wfc);
this->add_item(item);
}
{
Input_Item item("read_wfc_lcao");
item.annotation = "LCAO wave function input format: 1 text, 2 binary";
item.category = "System variables";
item.type = "Integer";
item.description = R"(The file format used when reading LCAO wave function coefficients.

Available options are:
* 1: text files (`.txt`) generated by setting `out_wfc_lcao` to 1.
* 2: binary files (`.dat`) generated by setting `out_wfc_lcao` to 2.

The selected format is used directly; ABACUS does not automatically detect or fall back to the other format. Only independent wave function files are supported, not files accumulated with `out_app_flag`.)";
item.default_value = "1";
item.unit = "";
item.set_availability("basis_type==lcao");
read_sync_int(input.read_wfc_lcao);
item.check_value = [](const Input_Item& item, const Parameter& para) {
if (para.input.read_wfc_lcao != 1 && para.input.read_wfc_lcao != 2)
{
ModuleBase::WARNING_QUIT("ReadInput", "read_wfc_lcao should be 1 or 2");
}
};
this->add_item(item);
}
{
Input_Item item("init_chg");
item.annotation = "start charge is from 'atomic' or file";
Expand Down
Loading
Loading