diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 5ada0540ef8..428190292f5 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -172,9 +172,12 @@ An practical example is class [LCAO_Deepks](https://github.com/deepmodeling/abac ## Documenting INPUT Parameters -ABACUS includes a built-in help system that allows users to query INPUT parameters directly from the command line (e.g., `abacus -h ecutwfc`). Parameter metadata is defined inline in the C++ source files (`source/source_io/module_parameter/read_input_item_*.cpp`) using `Input_Item` registrations. +ABACUS includes a built-in help system that allows users to query INPUT parameters directly from the command line (e.g., `abacus -h ecutwfc`). Parameter metadata is defined inline in the C++ source files under `source/source_io/module_parameter/` using `Input_Item` registrations. -A checked-in file `docs/parameters.yaml` contains a YAML dump of all parameter metadata, generated from the binary itself. This file is used by Sphinx to produce the online documentation page `input-main.md`. +The C++ `Input_Item` registrations are the source of truth for parameter metadata. The checked-in `docs/parameters.yaml` and `docs/advanced/input_files/input-main.md` files are generated artifacts: do not edit either file manually. `parameters.yaml` is generated from the binary and is used by Sphinx to produce `input-main.md`. + +Availability expressions follow the grammar and invariants in +[`developers_guide/input_availability.md`](developers_guide/input_availability.md). ### When to Update `docs/parameters.yaml` @@ -198,13 +201,13 @@ Then verify the YAML is valid: python3 -c "import yaml; d=yaml.safe_load(open('docs/parameters.yaml')); print(len(d['parameters']), 'parameters')" ``` -You can also regenerate the markdown documentation locally: +Then regenerate the markdown documentation locally: ```bash python3 docs/generate_input_main.py docs/parameters.yaml --output docs/advanced/input_files/input-main.md ``` -**Important:** Include the updated `docs/parameters.yaml` and `input-main.md` in your commit when submitting a PR that modifies INPUT parameters. Reviewers should verify the YAML changes match the C++ source changes and the `input-main.md` is updated. +**Important:** Include the updated `docs/parameters.yaml` and `input-main.md` in your commit when submitting a PR that modifies INPUT parameters. CI regenerates both files from the built binary and rejects any mismatch. Do not fix a documentation mismatch by editing either generated file; update the C++ `Input_Item` registration and regenerate them instead. ### Parameter Documentation Format @@ -218,7 +221,7 @@ When adding or modifying INPUT parameters in C++ source, set the following field item.description = "Description of what this parameter does."; item.default_value = "0"; item.unit = "Ry"; // Optional, empty string if no unit - item.availability = ""; // Optional, empty string if always available + item.set_availability("basis_type==pw"); // Optional; omit if always available // ... read_value, reset_value, check_value functions ... this->add_item(item); } diff --git a/docs/advanced/input_files/input-main.md b/docs/advanced/input_files/input-main.md index 502c22442da..36274d69409 100644 --- a/docs/advanced/input_files/input-main.md +++ b/docs/advanced/input_files/input-main.md @@ -656,7 +656,7 @@ ### symmetry_autoclose - **Type**: Boolean -- **Availability**: *symmetry==1* +- **Availability**: *[`symmetry`](#symmetry)==1* - **Description**: Control how to deal with error in symmetry analysis due to inaccurate lattice parameters or atom positions in STRU file, especially useful when calculation==cell-relax - False: quit with an error message - True: automatically set symmetry to 0 and continue running without symmetry analysis @@ -758,7 +758,7 @@ ### mem_saver - **Type**: Integer -- **Availability**: *Used only for nscf calculations with plane wave basis set.* +- **Availability**: *[`calculation`](#calculation)==nscf and [`basis_type`](#basis_type)==pw* - **Description**: Save memory when performing nscf calculations. - 0: no memory saving techniques are used. - 1: a memory saving technique will be used for many k point calculations. @@ -773,7 +773,7 @@ ### diago_proc - **Type**: Integer -- **Availability**: *Used only for plane wave basis set.* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: - 0: it will be set to the number of MPI processes. - >0: it specifies the number of processes used for carrying out diagonalization. Must be less than or equal to total number of MPI processes. - **Default**: 0 @@ -826,7 +826,7 @@ ### precision - **Type**: String -- **Availability**: *Used only for plane wave basis set.* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Specifies the precision when performing scf calculation. - single: single precision - double: double precision @@ -835,7 +835,7 @@ ### gint_precision - **Type**: String -- **Availability**: *Used only for LCAO basis set.* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Specifies the precision when performing grid integral in LCAO calculations. - single: single precision - double: double precision @@ -918,14 +918,14 @@ ### restart_load - **Type**: Boolean -- **Availability**: *Used only when numerical atomic orbitals are employed as basis set.* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: If restart_save is set to true and an electronic iteration is finished, calculations can be restarted from the charge density file, which are saved in the former calculation. - **Default**: False ### spillage_outdir - **Type**: String -- **Availability**: *Used only for plane wave basis set.* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: The directory to save the spillage files. - **Default**: "./" @@ -999,7 +999,7 @@ ### pw_seed - **Type**: Integer -- **Availability**: *Only used for plane wave basis.* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Specify the random seed to initialize wave functions. Only positive integers are available. - **Default**: 0 @@ -1058,14 +1058,14 @@ ### use_k_continuity - **Type**: Boolean -- **Availability**: *Used only for plane wave basis set.* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: If TRUE, the wavefunctions at k-point will be initialized from the converged wavefunctions at the nearest k-point, which can speed up the SCF convergence. Only works for PW basis. - **Default**: false ### pw_diag_nmax - **Type**: Integer -- **Availability**: *basis_type==pw, ks_solver==cg/dav/dav_subspace/bpcg* +- **Availability**: *[`basis_type`](#basis_type)==pw and [`ks_solver`](#ks_solver) in [cg, dav, dav_subspace, bpcg]* - **Description**: Only useful when you use ks_solver = cg/dav/dav_subspace/bpcg. It indicates the maximal iteration number for cg/david/dav_subspace/bpcg method. - **Default**: 50 @@ -1369,7 +1369,7 @@ ### mixing_dmr - **Type**: Boolean -- **Availability**: *Only for mixing_restart >= 0.0* +- **Availability**: *[`mixing_restart`](#mixing_restart)>=0* - **Description**: At n-th iteration which is calculated by drho<mixing_restart, SCF will start a mixing for real-space density matrix by using the same coefficiences as the mixing of charge density. - **Default**: false @@ -1402,7 +1402,7 @@ ### mixing_angle - **Type**: Real -- **Availability**: *Only relevant for non-colinear calculations nspin=4.* +- **Availability**: *[`nspin`](#nspin)==4* - **Description**: Normal broyden mixing can give the converged result for a given magnetic configuration. If one is not interested in the energies of a given magnetic configuration but wants to determine the ground state by relaxing the magnetic moments' directions, one cannot rely on the standard Broyden mixing algorithm. To enhance the ability to find correct magnetic configuration for non-colinear calculations, ABACUS implements a promising mixing method proposed by J. Phys. Soc. Jpn. 82 (2013) 114706. Here, mixing_angle is the angle mixing parameter. In fact, only mixing_angle=1.0 is implemented currently. - <=0: Normal broyden mixing - >0: Angle mixing for the modulus with mixing_angle=1.0 @@ -1411,16 +1411,17 @@ ### mixing_tau - **Type**: Boolean -- **Availability**: *Only relevant for meta-GGA calculations.* - **Description**: Whether to mix the kinetic energy density. - True: The kinetic energy density will also be mixed. It seems for general cases, SCF converges fine even without this mixing. However, if there is difficulty in converging SCF for meta-GGA, it might be helpful to turn this on. - False: The kinetic energy density will not be mixed. + + This setting takes effect only when the selected exchange-correlation functional uses the kinetic energy density, such as a meta-GGA or hybrid meta-GGA functional. - **Default**: False ### mixing_dftu - **Type**: Boolean -- **Availability**: *Only relevant for DFT+U calculations.* +- **Availability**: *[`dft_plus_u`](#dft_plus_u)==1* - **Description**: Whether to mix the occupation matrices. - True: The occupation matrices will also be mixed by plain mixing. From experience this is not very helpful if the +U calculation does not converge. - False: The occupation matrices will not be mixed. @@ -1429,7 +1430,7 @@ ### gamma_only - **Type**: Boolean -- **Availability**: *Only used in localized orbitals set* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to use gamma_only algorithm. - 0: more than one k-point is used and the ABACUS is slower compared to the gamma only algorithm. - 1: ABACUS uses gamma only, the algorithm is faster and you don't need to specify the k-points file. @@ -1524,7 +1525,7 @@ ### soc_lambda - **Type**: Real -- **Availability**: *Only works when lspinorb=true* +- **Availability**: *[`lspinorb`](#lspinorb)==true* - **Description**: Modulates the strength of spin-orbit coupling effect. Sometimes, for some real materials, both scalar-relativistic and full-relativistic pseudopotentials cannot describe the exact spin-orbit coupling. Artificial modulation may help in such cases. soc_lambda, which has value range [0.0, 1.0], is used to modulate SOC effect: @@ -1551,7 +1552,7 @@ ### method_sto - **Type**: Integer -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Different methods to do stochastic DFT - 1: Calculate twice, this method cost less memory but is slower. - 2: Calculate once but needs much more memory. This method is much faster. Besides, it calculates with a smaller nche_sto. However, when the memory is not enough, only method 1 can be used. @@ -1561,7 +1562,7 @@ ### nbands_sto - **Type**: Integer or string -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: The number of stochastic orbitals - 1-1000000: Perform stochastic DFT. Increasing the number of bands improves accuracy and reduces stochastic errors; To perform mixed stochastic-deterministic DFT, you should set nbands, which represents the number of KS orbitals. - 0: Invalid. Use all for the complete-basis SDFT mode. @@ -1571,14 +1572,14 @@ ### nche_sto - **Type**: Integer -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Chebyshev expansion orders for stochastic DFT. - **Default**: 100 ### emin_sto - **Type**: Real -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Trial energy to guess the lower bound of eigen energies of the Hamiltonian Operator. - **Default**: 0.0 - **Unit**: Ry @@ -1586,7 +1587,7 @@ ### emax_sto - **Type**: Real -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Trial energy to guess the upper bound of eigen energies of the Hamiltonian Operator. - **Default**: 0.0 - **Unit**: Ry @@ -1594,7 +1595,7 @@ ### seed_sto - **Type**: Integer -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: The random seed to generate stochastic orbitals. - >= 0: Stochastic orbitals have the form of exp(i*theta), where theta is a uniform distribution in [0, 2*pi). - 0: the seed is decided by time(NULL). @@ -1605,7 +1606,7 @@ ### initsto_ecut - **Type**: Real -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Stochastic wave functions are initialized in a large box generated by "4*initsto_ecut". initsto_ecut should be larger than ecutwfc. In this method, SDFT results are the same when using different cores. Besides, coefficients of the same G are the same when ecutwfc is rising to initsto_ecut. If it is smaller than ecutwfc, it will be turned off. - **Default**: 0.0 - **Unit**: Ry @@ -1613,7 +1614,7 @@ ### initsto_freq - **Type**: Integer -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Frequency (once each initsto_freq steps) to generate new stochastic orbitals when running md. - positive integer: Update stochastic orbitals - 0: Never change stochastic orbitals. @@ -1622,7 +1623,7 @@ ### npart_sto - **Type**: Integer -- **Availability**: *method_sto = 2 and out_dos = 1 or cal_cond = True* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft and (([`method_sto`](#method_sto)==2 and [`out_dos`](#out_dos)==1) or ([`basis_type`](#basis_type)==pw and [`cal_cond`](#cal_cond)==true))* - **Description**: Make memory cost to 1/npart_sto times of the previous one when running the post process of SDFT like DOS or conductivities. - **Default**: 1 @@ -1658,7 +1659,7 @@ ### relax_scale_force - **Type**: Real -- **Availability**: *Only used when relax_method is cg 2* +- **Availability**: *[`relax_method`](#relax_method)=="cg 2"* - **Description**: The paramether controls the size of the first conjugate gradient step. A smaller value means the first step along a new CG direction is smaller. This might be helpful for large systems, where it is safer to take a smaller initial step to prevent the collapse of the whole configuration. - **Default**: 0.5 @@ -1671,7 +1672,7 @@ ### relax_cg_thr - **Type**: Real -- **Availability**: *Only used when relax_method is cg_bfgs* +- **Availability**: *[`relax_method`](#relax_method)==cg_bfgs* - **Description**: When relax_method is set to cg_bfgs, a mixed algorithm of conjugate gradient (CG) and Broyden–Fletcher–Goldfarb–Shanno (BFGS) is used. The ions first move according to the CG method, then switch to the BFGS method when the maximum force on atoms is reduced below this threshold. - **Default**: 0.5 - **Unit**: eV/Angstrom @@ -1700,21 +1701,21 @@ ### relax_bfgs_w1 - **Type**: Real -- **Availability**: *Only used when relax_method is bfgs or cg_bfgs* +- **Availability**: *[`relax_method`](#relax_method) in [bfgs, cg_bfgs]* - **Description**: Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the sufficient decrease condition (c1 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177. - **Default**: 0.01 ### relax_bfgs_w2 - **Type**: Real -- **Availability**: *Only used when relax_method is bfgs or cg_bfgs* +- **Availability**: *[`relax_method`](#relax_method) in [bfgs, cg_bfgs]* - **Description**: Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the curvature condition (c2 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177. - **Default**: 0.5 ### relax_bfgs_rmax - **Type**: Real -- **Availability**: *Only used when relax_method is bfgs or cg_bfgs* +- **Availability**: *[`relax_method`](#relax_method) in [bfgs, cg_bfgs]* - **Description**: Maximum allowed total displacement of all atoms during geometry optimization. The sum of atomic displacements can increase during optimization steps but cannot exceed this value. - **Default**: 0.8 - **Unit**: Bohr @@ -1722,7 +1723,7 @@ ### relax_bfgs_rmin - **Type**: Real -- **Availability**: *Only used when relax_method is bfgs 1 (traditional BFGS)* +- **Availability**: *[`relax_method`](#relax_method)=="bfgs 1"* - **Description**: Minimum allowed total displacement of all atoms. When the total atomic displacement falls below this value and force convergence is not achieved, the calculation will terminate. Note: This parameter is not used in the default BFGS algorithm (relax_method = bfgs 2 or bfgs). - **Default**: 1e-5 - **Unit**: Bohr @@ -1730,7 +1731,7 @@ ### relax_bfgs_init - **Type**: Real -- **Availability**: *Only used when relax_method is bfgs or cg_bfgs* +- **Availability**: *[`relax_method`](#relax_method) in [bfgs, cg_bfgs]* - **Description**: Initial total displacement of all atoms in the first BFGS step. This sets the scale for the initial movement. - **Default**: 0.5 - **Unit**: Bohr @@ -1766,7 +1767,7 @@ ### fixed_axes - **Type**: String -- **Availability**: *Only used when calculation is set to cell-relax* +- **Availability**: *[`calculation`](#calculation)==cell-relax* - **Description**: Specifies which cell degrees of freedom are fixed during variable-cell relaxation. The available options depend on relax_method: With relax_method = cg 2 (default), all options are available: @@ -1790,7 +1791,7 @@ ### fixed_ibrav - **Type**: Boolean -- **Availability**: *Only used with relax_method = cg 2. A specific latname must be provided.* +- **Availability**: *[`relax_method`](#relax_method)=="cg 2" and [`latname`](#latname)!=none* - **Description**: - True: the lattice type will be preserved during relaxation. The lattice vectors are reconstructed to match the specified Bravais lattice type after each update. - False: No restrictions are exerted during relaxation in terms of lattice type @@ -1894,7 +1895,7 @@ ### out_dmk - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to output the density matrix for each k-point into files in the folder OUT.${suffix}. For current develop versions, out_dmk writes *_nao.txt files and includes a g{istep} index in the file name: - For gamma only case: - nspin = 1 and 4: dmg1_nao.txt; @@ -1913,7 +1914,7 @@ ### out_dmr - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis (multi-k points)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **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_hsr. Finally, if 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 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. @@ -1924,7 +1925,7 @@ ### out_wfc_pw - **Type**: Integer -- **Availability**: *Output electronic wave functions in plane wave basis, or transform the real-space electronic wave function into plane wave basis (see get_wf option in calculation with NAO basis)* +- **Availability**: *[`basis_type`](#basis_type)==pw or ([`basis_type`](#basis_type)==lcao and [`calculation`](#calculation)==get_wf)* - **Description**: Whether to output the electronic wavefunction coefficients into files and store them in the folder OUT.${suffix}. The files are named as wf{k}{k-point index}{s}{spin index}{g}{geometry index}{e}{electronic iteration index}{_pw} + {".txt"/".dat"}. Here, the s index refers to spin but the label will not show up for non-spin-polarized calculations, where s1 means spin up channel while s2 means spin down channel, and s4 refers to spinor wave functions that contains both spin channels with spin-orbital coupling or noncollinear calculations enabled. For scf or nscf calculations, g index will not appear, but the g index appears for geometry relaxation and molecular dynamics, where one can use the out_freq_ion command to control. To print out the electroinc wave functions every few SCF iterations, use the out_freq_elec command and the e index will appear in the file name. - 0: no output - 1: (txt format) @@ -1942,7 +1943,7 @@ ### out_wfc_lcao - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **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 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 is set to true, the wave functions accumulate during ionic steps. If the out_app_flag is set to false, a new folder named WFC will be created, and the wave function files will be saved into it. - 0: no output - 1: (txt format) @@ -2018,7 +2019,7 @@ ### out_hsk - **Type**: Integer \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: 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: - 0: disabled; - 1: text output; the optional second integer controls precision and defaults to 8; @@ -2044,7 +2045,7 @@ ### out_mat_hs - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Legacy alias for out_hsk 1, which outputs Hamiltonian and overlap matrices in reciprocal space for each k-point. The optional second integer controls text precision. If both out_hsk and out_mat_hs are present, out_hsk takes precedence. - **Default**: False 8 - **Unit**: Ry @@ -2052,7 +2053,7 @@ ### out_hsr - **Type**: Integer \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Output Hamiltonian and overlap matrices in real space, indexed by the Bravais lattice vector R, in the directory OUT.${suffix}. The first integer selects the format: - 0: disabled; - 1: text CSR output; the optional second integer controls precision and defaults to 8; @@ -2070,7 +2071,7 @@ ### out_mat_hs2 - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Legacy alias for out_hsr 1, which outputs Hamiltonian and overlap matrices in real space indexed by the Bravais lattice vector R. The optional second integer controls text precision. If both out_hsr and out_mat_hs2 are present, out_hsr takes precedence. - **Default**: False 8 - **Unit**: Ry @@ -2078,7 +2079,7 @@ ### out_mat_tk - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **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. > Note: In the 3.10-LTS version, the file names are data-TR-sparse_SPIN0.csr, etc. @@ -2088,7 +2089,7 @@ ### out_mat_r - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **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. > Note: In the 3.10-LTS version, the file name is data-rR-sparse.csr. @@ -2098,7 +2099,7 @@ ### out_mat_t - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **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 trs1_nao.csr and so on. Also controled by out_freq_ion and out_app_flag. > Note: In the 3.10-LTS version, the file name is data-TR-sparse_SPIN0.csr. @@ -2108,7 +2109,7 @@ ### out_mat_dh - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **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. Format: <enable> [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. @@ -2228,7 +2229,7 @@ ### out_mat_ds - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **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. > Note: In the 3.10-LTS version, the file name is data-dSRx-sparse_SPIN0.csr and so on. @@ -2238,7 +2239,7 @@ ### out_mat_xc - **Type**: Boolean -- **Availability**: *Numerical atomic orbital (NAO) and NAO-in-PW basis* +- **Availability**: *[`basis_type`](#basis_type) in [lcao, lcao_in_pw]* - **Description**: Whether to print the upper triangular part of the exchange-correlation matrices in Kohn-Sham orbital representation: for each k point into files in the directory OUT.i_nao.txt, where {suffix}/vxc_out.dat. If EXX is calculated, the local and EXX part of band energy will also be printed in OUT.{suffix}/vxc_exx_out.dat, respectively. All the vxc_out.dat files contains 3 integers (nk, nspin, nband) followed by nk*nspin*nband lines of energy Hartree and eV. > Note: In the 3.10-LTS version, the file name is k-$k-Vxc and so on. @@ -2248,7 +2249,7 @@ ### out_mat_xc2 - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital (NAO) basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **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. > Note: In the 3.10-LTS version, the file name is Vxc_R_spin$s and so on. @@ -2258,7 +2259,7 @@ ### out_mat_l - **Type**: Boolean \[Integer\](optional) -- **Availability**: *Numerical atomic orbital (NAO) basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **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 OUT.{suffix}_Lx.dat, OUT.{suffix}_Ly.dat, and OUT.{suffix}_Lz.dat. The second integer controls the precision of the output. - **Default**: False 8 @@ -2280,14 +2281,14 @@ ### out_eband_terms - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to print the band energy terms separately in the file OUT.{term}_out.dat. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated). - **Default**: False ### out_hr_npz - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **Description**: Whether to print Hamiltonian matrices H(R) in NPZ format as hrs1_nao.npz and, for nspin = 2, hrs2_nao.npz. This feature does not work for gamma-only calculations. - **Default**: False - **Unit**: Ry @@ -2295,7 +2296,7 @@ ### out_hsr_npz - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Legacy alias for out_hsr 3, writing hrs1_nao.npz, hrs2_nao.npz when needed, and sr_nao.npz. If both out_hsr and out_hsr_npz are present, out_hsr takes precedence. Gamma-only calculations write the folded R = (0, 0, 0) representation. - **Default**: False - **Unit**: Ry @@ -2303,28 +2304,28 @@ ### out_dm_npz - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **Description**: Whether to print density matrices DM(R) in npz format. This feature does not work for gamma-only calculations. - **Default**: False ### out_mul - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to print the Mulliken population analysis result into OUT.${suffix}/mulliken.txt. In molecular dynamics calculations, the output frequency is controlled by out_freq_ion. - **Default**: False ### out_app_flag - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis (not gamma-only algorithm)* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`gamma_only`](#gamma_only)==0* - **Description**: Whether to output r(R), H(R), S(R), T(R), dH(R), dS(R), and wfc matrices in an append manner during molecular dynamics calculations. Check input parameters out_mat_r, out_hsr, out_mat_t, out_mat_dh, out_hsk and out_wfc_lcao for more information. - **Default**: true ### out_ndigits - **Type**: Integer -- **Availability**: *out_hsk 1 case presently.* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`out_hsk`](#out_hsk)==1* - **Description**: Controls the length of decimal part of output data, such as charge density, Hamiltonian matrix, Overlap matrix and so on. - **Default**: 8 @@ -2337,7 +2338,7 @@ ### restart_save - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to save charge density files per ionic step, which are used to restart calculations. According to the value of read_file_dir: - auto: These files are saved in folder OUT.{read_file_dir}/restart/. @@ -2347,7 +2348,7 @@ ### rpa - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Generate output files used in rpa calculations. > Note: If symmetry is set to 1, additional files containing the necessary information for exploiting symmetry in the subsequent rpa calculation will be output: irreducible_sector.txt, symrot_k.txt and symrot_R.txt. @@ -2356,7 +2357,7 @@ ### rpa_out_vel - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Velocity matrix in KS basis (in unit of eV *Angstrom). Loop layer: spin -> k -> direction -> KS_basis1 -> KS_basis2. - **Default**: False - **Unit**: eV * A @@ -2364,42 +2365,42 @@ ### rpa_outdir - **Type**: String -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: The directory to save files for LibRPA. - **Default**: "./OUT.librpa/" ### out_pchg - **Type**: String -- **Availability**: *For both PW and LCAO. When basis_type = lcao, used when calculation = get_pchg.* +- **Availability**: *[`basis_type`](#basis_type)==pw or ([`basis_type`](#basis_type)==lcao and [`calculation`](#calculation)==get_pchg)* - **Description**: Specifies the electronic states to calculate the charge densities with state index for, using a space-separated string of 0s and 1s. Each digit in the string corresponds to a state, starting from the first state. A 1 indicates that the charge density should be calculated for that state, while a 0 means the state will be ignored. The parameter allows a compact and flexible notation (similar to ocp_set), for example the syntax 1 4*0 5*1 0 is used to denote the selection of states: 1 means calculate for the first state, 4*0 skips the next four states, 5*1 means calculate for the following five states, and the final 0 skips the next state. It's essential that the total count of states does not exceed the total number of states (nbands); otherwise, it results in an error, and the process exits. The input string must contain only numbers and the asterisk (*) for repetition, ensuring correct format and intention of state selection. The outputs comprise multiple .cube files following the naming convention pchgi[state]s[spin]k[kpoint].cube. - **Default**: none ### out_wfc_norm - **Type**: String -- **Availability**: *For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf.* +- **Availability**: *[`basis_type`](#basis_type)==pw or ([`basis_type`](#basis_type)==lcao and [`calculation`](#calculation)==get_wf)* - **Description**: Specifies the electronic states to calculate the real-space wave function modulus (norm, or known as the envelope function) with state index. The syntax and state selection rules are identical to out_pchg, but the output is the norm of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint].cube. - **Default**: none ### out_wfc_re_im - **Type**: String -- **Availability**: *For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf.* +- **Availability**: *[`basis_type`](#basis_type)==pw or ([`basis_type`](#basis_type)==lcao and [`calculation`](#calculation)==get_wf)* - **Description**: Specifies the electronic states to calculate the real and imaginary parts of the wave function with state index. The syntax and state selection rules are identical to out_pchg, but the output contains both the real and imaginary components of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint][re/im].cube. - **Default**: none ### if_separate_k - **Type**: Boolean -- **Availability**: *For both PW and LCAO. When basis_type = pw, used if out_pchg is set. When basis_type = lcao, used only when calculation = get_pchg and gamma_only = 0.* +- **Availability**: *([`basis_type`](#basis_type)==pw and [`out_pchg`](#out_pchg)!=none) or ([`basis_type`](#basis_type)==lcao and [`calculation`](#calculation)==get_pchg and [`gamma_only`](#gamma_only)==0)* - **Description**: Specifies whether to write the partial charge densities for all k-points to individual files or merge them. Warning: Enabling symmetry may produce unwanted results due to reduced k-point weights and symmetry operations in real space. Therefore when calculating partial charge densities, if you are not sure what you want exactly, it is strongly recommended to set symmetry = -1. It is noteworthy that your symmetry setting should remain the same as that in the SCF procedure. - **Default**: false ### out_elf - **Type**: Integer \[Integer\](optional) -- **Availability**: *Only for Kohn-Sham DFT and Orbital Free DFT.* +- **Availability**: *[`esolver_type`](#esolver_type) in [ksdft, ofdft]* - **Description**: Whether to output the electron localization function (ELF) in the folder `OUT.${suffix}`. The files are named as - nspin = 1: - elftot.cube: ${\rm{ELF}} = \frac{1}{1+\chi^2}$, $\chi = \frac{\frac{1}{2}\sum_{i}{f_i |\nabla\psi_{i}|^2} - \frac{|\nabla\rho|^2}{8\rho}}{\frac{3}{10}(3\pi^2)^{2/3}\rho^{5/3}}$; @@ -2419,7 +2420,7 @@ ### out_spillage - **Type**: Integer -- **Availability**: *Only for Kohn-Sham DFT with plane-wave basis.* +- **Availability**: *[`esolver_type`](#esolver_type)==ksdft and [`basis_type`](#basis_type)==pw* - **Description**: This output is only intentively needed by the ABACUS numerical atomic orbital generation workflow. This parameter is used to control whether to output the overlap integrals between truncated spherical Bessel functions (TSBFs) and plane-wave basis expanded wavefunctions (named as OVERLAP_Q), and between TSBFs (named as OVERLAP_Sq), also their first order derivatives. The output files are named starting with orb_matrix. A value of 2 would enable the output. - **Default**: 0 @@ -2535,7 +2536,7 @@ ### deepks_out_labels - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Print labels and descriptors for DeePKS in OUT.${suffix}. The names of these files start with "deepks". - 0 : No output. - 1 : Output intermediate files needed during DeePKS training. @@ -2547,21 +2548,21 @@ ### deepks_out_freq_elec - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: When deepks_out_freq_elec is greater than 0, print labels and descriptors for DeePKS in OUT.${suffix}/DeePKS_Labels_Elec per deepks_out_freq_elec electronic iterations, with suffix _e* to distinguish different steps. Often used with deepks_out_labels equals 1. - **Default**: 0 ### deepks_out_base - **Type**: String -- **Availability**: *Numerical atomic orbital basis and deepks_out_freq_elec is greater than 0* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`deepks_out_freq_elec`](#deepks_out_freq_elec)>0* - **Description**: Print labels and descriptors calculated by base functional ( determined by deepks_out_base ) and target functional ( determined by dft_functional ) for DeePKS in per deepks_out_freq_elec electronic iterations. The SCF process, labels and descriptors output of the target functional are all consistent with those when the target functional is used alone. The only additional output under this configuration is the labels of the base functional. Often used with deepks_out_labels equals 1. - **Default**: None ### deepks_scf - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: perform self-consistent field iteration in DeePKS method > Note: A trained, traced model file is needed. @@ -2570,7 +2571,7 @@ ### deepks_equiv - **Type**: Boolean -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: whether to use equivariant version of DeePKS > Note: The equivariant version of DeePKS-kit is still under development, so this feature is currently only intended for internal usage. @@ -2579,21 +2580,21 @@ ### deepks_model - **Type**: String -- **Availability**: *Numerical atomic orbital basis and deepks_scf is true* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`deepks_scf`](#deepks_scf)==true* - **Description**: the path of the trained, traced neural network model file generated by deepks-kit - **Default**: None ### bessel_descriptor_lmax - **Type**: Integer -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: the maximum angular momentum of the Bessel functions generated as the projectors in DeePKS - NOte: To generate such projectors, set calculation type to gen_bessel in ABACUS. See also calculation. - **Default**: 2 ### bessel_descriptor_ecut - **Type**: String -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: energy cutoff of Bessel functions - **Default**: same as ecutwfc - **Unit**: Ry @@ -2601,14 +2602,14 @@ ### bessel_descriptor_tolerence - **Type**: Real -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: tolerance for searching the zeros of Bessel functions - **Default**: 1.0e-12 ### bessel_descriptor_rcut - **Type**: Real -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: cutoff radius of Bessel functions - **Default**: 6.0 - **Unit**: Bohr @@ -2616,14 +2617,14 @@ ### bessel_descriptor_smooth - **Type**: Boolean -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: smooth the Bessel functions at radius cutoff - **Default**: False ### bessel_descriptor_sigma - **Type**: Real -- **Availability**: *gen_bessel calculation* +- **Availability**: *[`calculation`](#calculation)==gen_bessel* - **Description**: smooth parameter at the cutoff radius of projectors - **Default**: 0.1 - **Unit**: Bohr @@ -2631,7 +2632,7 @@ ### deepks_bandgap - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis and deepks_scf is true* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`deepks_scf`](#deepks_scf)==true* - **Description**: include bandgap label for DeePKS training - 0: Don't include bandgap label - 1: Include target bandgap label (see deepks_band_range for more details) @@ -2642,7 +2643,7 @@ ### deepks_band_range - **Type**: Integer*2 -- **Availability**: *Numerical atomic orbital basis, deepks_scf is true, and deepks_bandgap is 1 or 2* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`deepks_scf`](#deepks_scf)==true and [`deepks_bandgap`](#deepks_bandgap) in [1, 2]* - **Description**: The first value should not be larger than the second one and the meaning differs in different cases below - deepks_bandgap is 1: Bandgap label is the energy between LUMO + deepks_band_range[0] and LUMO + deepks_band_range[1]. If not set, it will calculate energy between HOMO and LUMO states. - deepks_bandgap is 2: Bandgap labels are energies between HOMO and all states in range [LUMO + deepks_band_range[0], LUMO + deepks_band_range[1]] (Thus there are deepks_band_range[1] - deepks_band_range[0] + 1 bandgaps in total). If HOMO is included in the setting range, it will be ignored since it will always be zero and has no valuable messages (deepks_band_range[1] - deepks_band_range[0] bandgaps in this case). NOTICE: The set range can be greater than, less than, or include the value of HOMO. In the bandgap label, we always calculate the energy of the state in the set range minus the energy of HOMO state, so the bandgap can be negative if the state is lower than HOMO. @@ -2651,7 +2652,7 @@ ### deepks_v_delta - **Type**: Integer -- **Availability**: *Numerical atomic orbital basis* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Include V_delta/V_delta_R (Hamiltonian in k/real space) label for DeePKS training. When deepks_out_labels is true and deepks_v_delta > 0 (k space), ABACUS will output deepks_hbase.npy, deepks_vdelta.npy and deepks_htot.npy(htot=hbase+vdelta). When deepks_out_labels is true and deepks_v_delta < 0 (real space), ABACUS will output deepks_hrtot.csr, deepks_hrdelta.csr. Some more files output for different settings. NOTICE: To match the unit Normally used in DeePKS, the unit of Hamiltonian in k space is Hartree. However, currently in R space the unit is still Ry. - deepks_v_delta = 1: deepks_vdpre.npy, which is used to calculate V_delta during DeePKS training. - deepks_v_delta = 2: deepks_phialpha.npy and deepks_gevdm.npy, which can be used to calculate deepks_vdpre.npy. A recommanded method for memory saving. @@ -2674,7 +2675,7 @@ ### of_kinetic - **Type**: String -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Kinetic energy functional type: - tf: Thomas-Fermi (TF) functional - vw: von Weizsacker (vW) functional @@ -2691,7 +2692,7 @@ ### of_method - **Type**: String -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: The optimization method used in OFDFT. - cg1: Polak-Ribiere. Standard CG algorithm. - cg2: Hager-Zhang (generally faster than cg1). @@ -2701,7 +2702,7 @@ ### of_conv - **Type**: String -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Criterion used to check the convergence of OFDFT. - energy: Total energy changes less than of_tole. - potential: The norm of potential is less than of_tolp. @@ -2711,7 +2712,7 @@ ### of_tole - **Type**: Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Tolerance of the energy change for determining the convergence. - **Default**: 2e-6 - **Unit**: Ry @@ -2719,7 +2720,7 @@ ### of_tolp - **Type**: Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Tolerance of potential for determining the convergence. - **Default**: 1e-5 - **Unit**: Ry @@ -2727,40 +2728,40 @@ ### of_tf_weight - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=tf, tf+, wt, ext-wt, xwm* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic) in [tf, tf+, wt, ext-wt, xwm]* - **Description**: Weight of TF KEDF (kinetic energy density functional). - **Default**: 1.0 ### of_vw_weight - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=vw, tf+, wt, ext-wt, lkt, xwm* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic) in [vw, tf+, wt, ext-wt, lkt, xwm]* - **Description**: Weight of vW KEDF (kinetic energy density functional). - **Default**: 1.0 ### of_wt_alpha - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=wt, ext-wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic) in [wt, ext-wt]* - **Description**: Parameter alpha of WT KEDF (kinetic energy density functional). ### of_wt_beta - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=wt, ext-wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic) in [wt, ext-wt]* - **Description**: Parameter beta of WT KEDF (kinetic energy density functional). ### of_extwt_kappa - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=ext-wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==ext-wt* - **Description**: Parameter kappa for EXT-WT KEDF. - **Default**: 1.0 / (2.0 * std::pow(4./3., 1./3.) - 1.0) ### of_wt_rho0 - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==wt* - **Description**: The average density of system. - **Default**: 0.0 - **Unit**: Bohr^-3 @@ -2768,7 +2769,7 @@ ### of_hold_rho0 - **Type**: Boolean -- **Availability**: *OFDFT with of_kinetic=wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==wt* - **Description**: Whether to fix the average density rho0. - True: rho0 will be fixed even if the volume of system has changed, it will be set to True automatically if of_wt_rho0 is not zero. - False: rho0 will change if volume of system has changed. @@ -2777,28 +2778,28 @@ ### of_lkt_a - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=lkt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==lkt* - **Description**: Parameter a of LKT KEDF (kinetic energy density functional). - **Default**: 1.3 ### of_xwm_rho_ref - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=xwm* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==xwm* - **Description**: Reference charge density for XWM kinetic energy functional. If set to 0, the program will use average charge density. - **Default**: 0.0 ### of_xwm_kappa - **Type**: Real -- **Availability**: *OFDFT with of_kinetic=xwm* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==xwm* - **Description**: Parameter for XWM kinetic energy functional. See PHYSICAL REVIEW B 100, 205132 (2019) for optimal values. - **Default**: 0.0 ### of_read_kernel - **Type**: Boolean -- **Availability**: *OFDFT with of_kinetic=wt* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==wt* - **Description**: Whether to read in the kernel file. - True: The kernel of WT KEDF (kinetic energy density functional) will be filled from the file specified by of_kernel_file. - False: The kernel of WT KEDF (kinetic energy density functional) will be filled from formula. @@ -2807,14 +2808,14 @@ ### of_kernel_file - **Type**: String -- **Availability**: *OFDFT with of_read_kernel=True* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_kinetic`](#of_kinetic)==wt and [`of_read_kernel`](#of_read_kernel)==true* - **Description**: The name of WT kernel file. - **Default**: WTkernel.txt ### of_full_pw - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Whether to use full planewaves. - True: Ecut will be ignored while collecting planewaves, so that all planewaves will be used in FFT. - False: Only use the planewaves inside ecut, the same as KSDFT. @@ -2823,7 +2824,7 @@ ### of_full_pw_dim - **Type**: Integer -- **Availability**: *OFDFT with of_full_pw = True* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft and [`of_full_pw`](#of_full_pw)==true* - **Description**: Specify the parity of FFT dimensions. - 0: either odd or even. - 1: odd only. @@ -2839,14 +2840,14 @@ ### of_ml_gene_data - **Type**: Boolean -- **Availability**: *Used only for KSDFT with plane wave basis* +- **Availability**: *[`esolver_type`](#esolver_type)==ksdft and [`basis_type`](#basis_type)==pw* - **Description**: Controls the generation of machine learning training data. When enabled, training data in .npy format will be saved in the directory OUT.${suffix}/. - **Default**: False ### of_ml_device - **Type**: String -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Run Neural Network on GPU or CPU. - cpu: CPU - gpu: GPU @@ -2855,7 +2856,7 @@ ### of_ml_feg - **Type**: Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: The method to incorporate the Free Electron Gas (FEG) limit. - 0: Do not incorporate the FEG limit. - 1: Incorporate the FEG limit by translation. @@ -2865,14 +2866,14 @@ ### of_ml_nkernel - **Type**: Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Number of kernel functions. - **Default**: 1 ### of_ml_kernel - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the type of the i-th kernel function. - 1: Wang-Teter kernel function. - 2: Modified Yukawa function, and alpha is specified by of_ml_yukawa_alpha. @@ -2882,168 +2883,168 @@ ### of_ml_kernel_scaling - **Type**: Vector of Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the RECIPROCAL of scaling parameter of the i-th kernel function. - **Default**: 1.0 ### of_ml_yukawa_alpha - **Type**: Vector of Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the parameter alpha of i-th kernel function. ONLY used for Yukawa kernel function. - **Default**: 1.0 ### of_ml_kernel_file - **Type**: Vector of String -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the file containing the i-th kernel function. ONLY used for TKK. - **Default**: none ### of_ml_gamma - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Local descriptor: gamma = (rho / rho0)^(1/3). - **Default**: False ### of_ml_p - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Semi-local descriptor: p = |nabla rho|^2 / [2 (3 pi^2)^(1/3) rho^(4/3)]^2. - **Default**: False ### of_ml_q - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Semi-local descriptor: q = nabla^2 rho / [4 (3 pi^2)^(2/3) rho^(5/3)]. - **Default**: False ### of_ml_tanhp - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Semi-local descriptor: tanhp = tanh(chi_p * p). - **Default**: False ### of_ml_tanhq - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Semi-local descriptor: tanhq = tanh(chi_q * q). - **Default**: False ### of_ml_chi_p - **Type**: Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Hyperparameter chi_p: tanhp = tanh(chi_p * p). - **Default**: 1.0 ### of_ml_chi_q - **Type**: Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Hyperparameter chi_q: tanhq = tanh(chi_q * q). - **Default**: 1.0 ### of_ml_gammanl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor gammanl defined by the i-th kernel function. - **Default**: 0 ### of_ml_pnl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor pnl defined by the i-th kernel function. - **Default**: 0 ### of_ml_qnl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor qnl defined by the i-th kernel function. - **Default**: 0 ### of_ml_xi - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor xi defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanhxi - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanhxi_nl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi_nl defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanh_pnl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_pnl defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanh_qnl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_qnl defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanhp_nl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhp_nl defined by the i-th kernel function. - **Default**: 0 ### of_ml_tanhq_nl - **Type**: Vector of Integer -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhq_nl defined by the i-th kernel function. - **Default**: 0 ### of_ml_chi_xi - **Type**: Vector of Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_xi of non-local descriptor tanhxi defined by the i-th kernel function. - **Default**: 1.0 ### of_ml_chi_pnl - **Type**: Vector of Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_pnl of non-local descriptor tanh_pnl defined by the i-th kernel function. - **Default**: 1.0 ### of_ml_chi_qnl - **Type**: Vector of Real -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_qnl of non-local descriptor tanh_qnl defined by the i-th kernel function. - **Default**: 1.0 ### of_ml_local_test - **Type**: Boolean -- **Availability**: *OFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==ofdft* - **Description**: FOR TEST. Read in the density, and output the F and Pauli potential. - **Default**: False @@ -3060,7 +3061,7 @@ ### of_cd - **Type**: Boolean -- **Availability**: *TDOFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==tdofdft* - **Description**: Added the current dependent(CD) potential. (https://doi.org/10.1103/PhysRevB.98.144302) - True: Added the CD potential. - False: Not added the CD potential. @@ -3069,7 +3070,7 @@ ### of_mcd_alpha - **Type**: Real -- **Availability**: *TDOFDFT* +- **Availability**: *[`esolver_type`](#esolver_type)==tdofdft* - **Description**: The value of the parameter alpha in modified CD potential method. mCDPotential=alpha*CDPotential (proposed in paper PhysRevB.98.144302) - **Default**: 1.0 @@ -3088,7 +3089,7 @@ ### dip_cor_flag - **Type**: Boolean -- **Availability**: *With dip_cor_flag = True and efield_flag = True.* +- **Availability**: *[`efield_flag`](#efield_flag)==true* - **Description**: Added a dipole correction to the bare ionic potential. - True: A dipole correction is also added to the bare ionic potential. - False: A dipole correction is not added to the bare ionic potential. @@ -3099,7 +3100,7 @@ ### efield_dir - **Type**: Integer -- **Availability**: *with efield_flag = True.* +- **Availability**: *[`efield_flag`](#efield_flag)==true* - **Description**: The direction of the electric field or dipole correction is parallel to the reciprocal lattice vector, so the potential is constant in planes defined by FFT grid points, efield_dir can set to 0, 1 or 2. - 0: parallel to the first reciprocal lattice vector - 1: parallel to the second reciprocal lattice vector @@ -3109,21 +3110,21 @@ ### efield_pos_max - **Type**: Real -- **Availability**: *with efield_flag = True.* +- **Availability**: *[`efield_flag`](#efield_flag)==true* - **Description**: Position of the maximum of the saw-like potential along crystal axis efield_dir, within the unit cell, 0 <= efield_pos_max < 1. - **Default**: Autoset to center of vacuum - width of vacuum / 20 ### efield_pos_dec - **Type**: Real -- **Availability**: *with efield_flag = True.* +- **Availability**: *[`efield_flag`](#efield_flag)==true* - **Description**: Zone in the unit cell where the saw-like potential decreases, 0 < efield_pos_dec < 1. - **Default**: Autoset to width of vacuum / 10 ### efield_amp - **Type**: Real -- **Availability**: *with efield_flag = True.* +- **Availability**: *[`efield_flag`](#efield_flag)==true* - **Description**: Amplitude of the electric field. The saw-like potential increases with slope efield_amp in the region from efield_pos_max+efield_pos_dec-1) to (efield_pos_max), then decreases until (efield_pos_max+efield_pos_dec), in units of the crystal vector efield_dir. > Note: The change of slope of this potential must be located in the empty region, or else unphysical forces will result. @@ -3211,14 +3212,14 @@ ### exx_hybrid_step - **Type**: Integer -- **Availability**: *exx_separate_loop==1* +- **Availability**: *[`exx_separate_loop`](#exx_separate_loop)==1* - **Description**: The maximal iteration number of the outer-loop, where the Fock exchange is calculated - **Default**: 100 ### exx_mixing_beta - **Type**: Real -- **Availability**: *exx_separate_loop==1* +- **Availability**: *[`exx_separate_loop`](#exx_separate_loop)==1* - **Description**: Mixing parameter for densty matrix in each iteration of the outer-loop - **Default**: 1.0 @@ -3229,7 +3230,7 @@ ### exx_fock_lambda - **Type**: Real -- **Availability**: *basis_type==lcao_in_pw* +- **Availability**: *[`basis_type`](#basis_type)==lcao_in_pw* - **Description**: It is used to compensate for divergence points at G=0 in the evaluation of Fock exchange using lcao_in_pw method. - **Default**: 0.3 @@ -3299,14 +3300,14 @@ ### exx_opt_orb_lmax - **Type**: Integer -- **Availability**: *calculation==gen_opt_abfs* +- **Availability**: *[`calculation`](#calculation)==gen_opt_abfs* - **Description**: The maximum l of the spherical Bessel functions, when the radial part of opt-ABFs are generated as linear combinations of spherical Bessel functions. A reasonable choice is 2. - **Default**: 0 ### exx_opt_orb_ecut - **Type**: Real -- **Availability**: *calculation==gen_opt_abfs* +- **Availability**: *[`calculation`](#calculation)==gen_opt_abfs* - **Description**: The cut-off of plane wave expansion, when the plane wave basis is used to optimize the radial ABFs. A reasonable choice is 60. - **Default**: 0 - **Unit**: Ry @@ -3314,7 +3315,7 @@ ### exx_opt_orb_tolerence - **Type**: Real -- **Availability**: *calculation==gen_opt_abfs* +- **Availability**: *[`calculation`](#calculation)==gen_opt_abfs* - **Description**: The threshold when solving for the zeros of spherical Bessel functions. A reasonable choice is 1e-12. - **Default**: 1E-12 @@ -3341,7 +3342,7 @@ ### exx_symmetry_realspace - **Type**: Boolean -- **Availability**: *symmetry==1 and exx calculation (dft_fuctional==hse/hf/pbe0/scan0 or rpa==True)* +- **Availability**: *[`symmetry`](#symmetry)==1 and ([`dft_functional`](#dft_functional) in [hse, hf, pbe0, scan0] or ([`basis_type`](#basis_type)==lcao and [`rpa`](#rpa)==true))* - **Description**: - False: only rotate k-space density matrix D(k) from irreducible k-points to accelerate diagonalization - True: rotate both D(k) and Hexx(R) to accelerate both diagonalization and EXX calculation - **Default**: True @@ -3359,7 +3360,7 @@ ### exxace - **Type**: Boolean -- **Availability**: *exx_separate_loop==True.* +- **Availability**: *[`exx_separate_loop`](#exx_separate_loop)==true* - **Description**: Whether to use the ACE method (https://doi.org/10.1021/acs.jctc.6b00092) to accelerate the calculation the Fock exchange matrix. Should be set to true most of the time. - True: Use the ACE method to calculate the Fock exchange operator. - False: Use the traditional method to calculate the Fock exchange operator. @@ -3389,7 +3390,7 @@ ### exx_ene_thr - **Type**: Real -- **Availability**: *exx_thr_type==energy* +- **Availability**: *[`exx_thr_type`](#exx_thr_type)==energy* - **Description**: The threshold for the change of exact exchange energy to judge convergence of the outer loop in the separate loop EXX calculation. - **Default**: 1e-5 - **Unit**: Ry @@ -3626,21 +3627,21 @@ ### dp_rescaling - **Type**: Real -- **Availability**: *esolver_type = dp.* +- **Availability**: *[`esolver_type`](#esolver_type)==dp* - **Description**: Rescaling factor to use a temperature-dependent DP. Energy, stress and force calculated by DP will be multiplied by this factor. - **Default**: 1.0 ### dp_fparam - **Type**: Real -- **Availability**: *esolver_type = dp.* +- **Availability**: *[`esolver_type`](#esolver_type)==dp* - **Description**: The frame parameter for dp potential. The array size is dim_fparam, then all frames are assumed to be provided with the same fparam. - **Default**: {} ### dp_aparam - **Type**: Real -- **Availability**: *esolver_type = dp.* +- **Availability**: *[`esolver_type`](#esolver_type)==dp* - **Description**: The atomic parameter for dp potential. The array size can be (1) natoms x dim_aparam, then all frames are assumed to be provided with the same aparam; (2) dim_aparam, then all frames and atoms are assumed to be provided with the same aparam. - **Default**: {} @@ -3689,7 +3690,7 @@ ### md_csvr_tau - **Type**: Real -- **Availability**: *md_thermostat = csvr* +- **Availability**: *[`md_thermostat`](#md_thermostat)==csvr* - **Description**: The characteristic time scale for the CSVR (Canonical Sampling through Velocity Rescaling) thermostat. Larger values give weaker coupling, smaller values give stronger coupling. Recommended value: 100 * md_dt. - **Default**: 100.0 - **Unit**: fs @@ -3744,7 +3745,7 @@ ### dft_plus_dmft - **Type**: Boolean -- **Availability**: *basis_type==lcao* +- **Availability**: *[`basis_type`](#basis_type)==lcao* - **Description**: Whether to enable DFT+DMFT calculation. True: DFT+DMFT; False: standard DFT calculation. - **Default**: False @@ -3777,14 +3778,14 @@ ### yukawa_lambda - **Type**: Real -- **Availability**: *DFT+U with yukawa_potential = True.* +- **Availability**: *[`dft_plus_u`](#dft_plus_u)==1 and [`yukawa_potential`](#yukawa_potential)==true* - **Description**: The screen length of Yukawa potential. If left to default, the screen length will be calculated as an average of the entire system. It's better to stick to the default setting unless there is a very good reason. - **Default**: Calculated on the fly. ### uramping - **Type**: Real -- **Availability**: *DFT+U calculations with mixing_restart > 0.* +- **Availability**: *[`dft_plus_u`](#dft_plus_u)==1 and [`mixing_restart`](#mixing_restart)>0* - **Description**: Once uramping > 0.15 eV. DFT+U calculations will start SCF with U = 0 eV, namely normal LDA/PBE calculations. Once SCF restarts when drho<mixing_restart, U value will increase by uramping eV. SCF will repeat above calcuations until U values reach target defined in hubbard_u. As for uramping=1.0 eV, the recommendations of mixing_restart is around 5e-4. - **Default**: -1.0. - **Unit**: eV @@ -3803,7 +3804,7 @@ ### onsite_radius - **Type**: Real -- **Availability**: *dft_plus_u is set to 1* +- **Availability**: *[`dft_plus_u`](#dft_plus_u)==1* - **Description**: - The onsite_radius parameter facilitates modulation of the single-zeta portion of numerical atomic orbitals used for DFT+U projections. - The modulation algorithm applies a smooth truncation to the orbital tail followed by normalization. A representative profile is $f(r)=\frac{1}{2}\left[1+\operatorname{erf}\!\left(\frac{r_c-r}{\sigma}\right)\right]$, where $r_c$ is the cutoff radius and $\sigma=\gamma r_c$ controls smoothness. - **Default**: 3.0 @@ -3828,7 +3829,7 @@ ### sc_thr - **Type**: Real -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Convergence criterion of spin-constrained iteration (RMS) in uB - **Default**: 1.0e-6 - **Unit**: uB @@ -3836,21 +3837,21 @@ ### nsc - **Type**: Integer -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Maximal number of spin-constrained iteration - **Default**: 100 ### nsc_min - **Type**: Integer -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Minimum number of spin-constrained iteration - **Default**: 2 ### alpha_trial - **Type**: Real -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Initial trial step size for lambda in eV/uB^2 - **Default**: 0.01 - **Unit**: eV/uB^2 @@ -3858,7 +3859,7 @@ ### sccut - **Type**: Real -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Maximal step size for lambda in eV/uB - **Default**: 3.0 - **Unit**: eV/uB @@ -3866,21 +3867,21 @@ ### sc_drop_thr - **Type**: Real -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Convergence criterion ratio of lambda iteration in Spin-constrained DFT - **Default**: 1.0e-2 ### sc_scf_thr - **Type**: Real -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Density error threshold for inner loop of spin-constrained SCF - **Default**: 1.0e-4 ### sc_direction_only - **Type**: Boolean -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: When true, only the direction of the magnetic moment is constrained to the target direction, while the magnitude is allowed to vary freely. This is useful for studying magnetic anisotropy or when the magnitude of the moment is determined by the electronic structure rather than an external constraint. When false (default), both the direction and magnitude of the magnetic moment are constrained to the target values. @@ -3889,7 +3890,7 @@ ### sc_lambda_strategy - **Type**: String -- **Availability**: *sc_mag_switch is true* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true* - **Description**: Lambda update strategy for spin-constrained DFT: - bfgs: BFGS quasi-Newton method - linear_response: linear response (Scheme B) @@ -3901,7 +3902,7 @@ ### sc_scan_lambda_start - **Type**: Float -- **Availability**: *sc_lambda_strategy is linear_scan* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true and [`sc_lambda_strategy`](#sc_lambda_strategy)==linear_scan* - **Description**: Starting lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan. - **Default**: 0.0 - **Unit**: eV/uB @@ -3909,7 +3910,7 @@ ### sc_scan_lambda_end - **Type**: Float -- **Availability**: *sc_lambda_strategy is linear_scan* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true and [`sc_lambda_strategy`](#sc_lambda_strategy)==linear_scan* - **Description**: Ending lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan. - **Default**: 1.0 - **Unit**: eV/uB @@ -3917,7 +3918,7 @@ ### sc_scan_steps - **Type**: Integer -- **Availability**: *sc_lambda_strategy is linear_scan* +- **Availability**: *[`sc_mag_switch`](#sc_mag_switch)==true and [`sc_lambda_strategy`](#sc_lambda_strategy)==linear_scan* - **Description**: Number of lambda values to scan. Only used when sc_lambda_strategy=linear_scan. - **Default**: 20 @@ -3941,7 +3942,7 @@ ### vdw_d4_xc - **Type**: String -- **Availability**: *vdw_method is set to d4* +- **Availability**: *[`vdw_method`](#vdw_method)==d4* - **Description**: Functional name used to load DFT-D4 damping parameters from the DFT-D4 library. If set to default, ABACUS infers the functional name from dft_functional or pseudopotential metadata. - **Default**: default @@ -3949,7 +3950,7 @@ ### vdw_d4_model - **Type**: String -- **Availability**: *vdw_method is set to d4* +- **Availability**: *[`vdw_method`](#vdw_method)==d4* - **Description**: DFT-D4 dispersion model used by the external DFT-D4 library. Available options are: @@ -3960,38 +3961,38 @@ ### vdw_s6 - **Type**: String -- **Availability**: *vdw_method is set to d2, d3_0, or d3_bj* +- **Availability**: *[`vdw_method`](#vdw_method) in [d2, d3_0, d3_bj]* - **Description**: This scale factor is used to optimize the interaction energy deviations in van der Waals (vdW) corrected calculations. The recommended values of this parameter are dependent on the chosen vdW correction method and the DFT functional being used. For DFT-D2, the recommended values are 0.75 (PBE), 1.2 (BLYP), 1.05 (B-P86), 1.0 (TPSS), and 1.05 (B3LYP). If not set, will use values of PBE functional. For DFT-D3, recommended values with different DFT functionals can be found on the here. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. ### vdw_s8 - **Type**: String -- **Availability**: *vdw_method is set to d3_0 or d3_bj* +- **Availability**: *[`vdw_method`](#vdw_method) in [d3_0, d3_bj]* - **Description**: This scale factor is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. ### vdw_a1 - **Type**: String -- **Availability**: *vdw_method is set to d3_0 or d3_bj* +- **Availability**: *[`vdw_method`](#vdw_method) in [d3_0, d3_bj]* - **Description**: This damping function parameter is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. ### vdw_a2 - **Type**: String -- **Availability**: *vdw_method is set to d3_0 or d3_bj* +- **Availability**: *[`vdw_method`](#vdw_method) in [d3_0, d3_bj]* - **Description**: This damping function parameter is only relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. ### vdw_d - **Type**: Real -- **Availability**: *vdw_method is set to d2* +- **Availability**: *[`vdw_method`](#vdw_method)==d2* - **Description**: Controls the damping rate of the damping function in the DFT-D2 method. - **Default**: 20 ### vdw_abc - **Type**: Boolean -- **Availability**: *vdw_method is set to d3_0 or d3_bj* +- **Availability**: *[`vdw_method`](#vdw_method) in [d3_0, d3_bj]* - **Description**: Determines whether three-body terms are calculated for DFT-D3 methods. - True: ABACUS will calculate the three-body term. - False: The three-body term is not included. @@ -4000,7 +4001,7 @@ ### vdw_c6_file - **Type**: String -- **Availability**: *vdw_method is set to d2* +- **Availability**: *[`vdw_method`](#vdw_method)==d2* - **Description**: Specifies the name of the file containing parameters for each element when using the D2 method. If not set, ABACUS uses the default parameters (Jnm6/mol) stored in the program. To manually set the parameters, provide a file containing the parameters. An example is given by: H 0.1 Si 9.0 @@ -4011,7 +4012,7 @@ ### vdw_c6_unit - **Type**: String -- **Availability**: *vdw_C6_file is not default* +- **Availability**: *[`vdw_method`](#vdw_method)==d2 and [`vdw_c6_file`](#vdw_c6_file)!=default* - **Description**: Specifies the unit of the provided parameters in the D2 method. Available options are: - Jnm6/mol (J nm^6/mol) - eVA (eV Angstrom) @@ -4020,7 +4021,7 @@ ### vdw_r0_file - **Type**: String -- **Availability**: *vdw_method is set to d2* +- **Availability**: *[`vdw_method`](#vdw_method)==d2* - **Description**: Specifies the name of the file containing parameters for each element when using the D2 method. If not set, ABACUS uses the default parameters (Angstrom) stored in the program. To manually set the parameters, provide a file containing the parameters. An example is given by: Li 1.0 Cl 2.0 @@ -4031,7 +4032,7 @@ ### vdw_r0_unit - **Type**: String -- **Availability**: *vdw_R0_file is not default* +- **Availability**: *[`vdw_method`](#vdw_method)==d2 and [`vdw_r0_file`](#vdw_r0_file)!=default* - **Description**: Specifies the unit for the parameters in the D2 method when manually set by the user. Available options are: - A (Angstrom) - Bohr @@ -4048,14 +4049,14 @@ ### vdw_cutoff_radius - **Type**: String -- **Availability**: *vdw_cutoff_type is set to radius* +- **Availability**: *[`vdw_cutoff_type`](#vdw_cutoff_type)==radius* - **Description**: Defines the radius of the cutoff sphere when vdw_cutoff_type is set to radius. The default values depend on the chosen vdw_method. - **Unit**: defined by vdw_radius_unit (default Bohr) ### vdw_radius_unit - **Type**: String -- **Availability**: *vdw_cutoff_type is set to radius* +- **Availability**: *[`vdw_cutoff_type`](#vdw_cutoff_type)==radius* - **Description**: Specify the unit of vdw_cutoff_radius. Available options are: - A(Angstrom) - Bohr @@ -4064,14 +4065,14 @@ ### vdw_cutoff_period - **Type**: Integer Integer Integer -- **Availability**: *vdw_cutoff_type is set to period* +- **Availability**: *[`vdw_cutoff_type`](#vdw_cutoff_type)==period* - **Description**: The three integers supplied here explicitly specify the extent of the supercell in the directions of the three basis lattice vectors. - **Default**: 3 3 3 ### vdw_cn_thr - **Type**: Real -- **Availability**: *vdw_method is set to d3_0, d3_bj, or d4* +- **Availability**: *[`vdw_method`](#vdw_method) in [d3_0, d3_bj, d4]* - **Description**: The cutoff radius when calculating coordination numbers. - **Default**: 40 - **Unit**: defined by vdw_cn_thr_unit (default: Bohr) @@ -4290,7 +4291,7 @@ ### td_gauss_freq - **Type**: Vector of Real -- **Availability**: *td_ttype contains 0* +- **Availability**: *[`td_ttype`](#td_ttype) contains 0* - **Description**: Ordinary frequency $f$ in the Gaussian-pulse formula, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order. - **Default**: 22.13 - **Unit**: 1/fs @@ -4298,7 +4299,7 @@ ### td_gauss_phase - **Type**: Vector of Real -- **Availability**: *td_ttype contains 0* +- **Availability**: *[`td_ttype`](#td_ttype) contains 0* - **Description**: Carrier phase $\varphi$ in the Gaussian-pulse formula. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order. - **Default**: 0.0 - **Unit**: rad @@ -4306,7 +4307,7 @@ ### td_gauss_sigma - **Type**: Vector of Real -- **Availability**: *td_ttype contains 0* +- **Availability**: *[`td_ttype`](#td_ttype) contains 0* - **Description**: Nonzero standard deviation $\sigma$ of the Gaussian envelope. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order. - **Default**: 30.0 - **Unit**: fs @@ -4314,14 +4315,14 @@ ### td_gauss_t0 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 0* +- **Availability**: *[`td_ttype`](#td_ttype) contains 0* - **Description**: Electronic-step position of the Gaussian center, which defines $t_0=\mathtt{td\_gauss\_t0}\Delta t$. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order. - **Default**: 100 ### td_gauss_amp - **Type**: Vector of Real -- **Availability**: *td_ttype contains 0* +- **Availability**: *[`td_ttype`](#td_ttype) contains 0* - **Description**: Electric-field scale $E_0$ in the Gaussian-pulse formula. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order. - **Default**: 0.25 - **Unit**: V/Angstrom @@ -4329,7 +4330,7 @@ ### td_trape_freq - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Ordinary carrier frequency $f$ in the trapezoid-pulse formula, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 1.60 - **Unit**: 1/fs @@ -4337,7 +4338,7 @@ ### td_trape_phase - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Carrier phase $\varphi$ in the trapezoid-pulse formula. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 0.0 - **Unit**: rad @@ -4345,28 +4346,28 @@ ### td_trape_t1 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Electronic step defining the end of the linear rise, $t_1=\mathtt{td\_trape\_t1}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 1875 ### td_trape_t2 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Electronic step defining the end of the plateau, $t_2=\mathtt{td\_trape\_t2}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 5625 ### td_trape_t3 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Electronic step defining the end of the linear fall, $t_3=\mathtt{td\_trape\_t3}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 7500 ### td_trape_amp - **Type**: Vector of Real -- **Availability**: *td_ttype contains 1* +- **Availability**: *[`td_ttype`](#td_ttype) contains 1* - **Description**: Electric-field scale $E_0$ in the trapezoid-pulse formula. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order. - **Default**: 2.74 - **Unit**: V/Angstrom @@ -4374,7 +4375,7 @@ ### td_trigo_freq1 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 2* +- **Availability**: *[`td_ttype`](#td_ttype) contains 2* - **Description**: First ordinary frequency $f_1$ in the trigonometric-pulse formula, with $\omega_1=2\pi f_1$. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order. - **Default**: 1.164656 - **Unit**: 1/fs @@ -4382,7 +4383,7 @@ ### td_trigo_freq2 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 2* +- **Availability**: *[`td_ttype`](#td_ttype) contains 2* - **Description**: Second ordinary frequency $f_2$ in the trigonometric-pulse formula, with $\omega_2=2\pi f_2$. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order. - **Default**: 0.029116 - **Unit**: 1/fs @@ -4390,7 +4391,7 @@ ### td_trigo_phase1 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 2* +- **Availability**: *[`td_ttype`](#td_ttype) contains 2* - **Description**: Carrier phase $\varphi_1$ in the cosine factor of the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order. - **Default**: 0.0 - **Unit**: rad @@ -4398,7 +4399,7 @@ ### td_trigo_phase2 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 2* +- **Availability**: *[`td_ttype`](#td_ttype) contains 2* - **Description**: Envelope phase $\varphi_2$ in the sine-squared factor of the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order. - **Default**: 0.0 - **Unit**: rad @@ -4406,7 +4407,7 @@ ### td_trigo_amp - **Type**: Vector of Real -- **Availability**: *td_ttype contains 2* +- **Availability**: *[`td_ttype`](#td_ttype) contains 2* - **Description**: Electric-field scale $E_0$ in the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order. - **Default**: 2.74 - **Unit**: V/Angstrom @@ -4414,14 +4415,14 @@ ### td_heavi_t0 - **Type**: Vector of Real -- **Availability**: *td_ttype contains 3* +- **Availability**: *[`td_ttype`](#td_ttype) contains 3* - **Description**: Electronic switch step $n_0$ in the Heaviside-pulse definition. The field is $E_0$ for $n\lt n_0$ and zero for $n\geqslant n_0$. Supply exactly one value for each td_ttype 3 occurrence, in occurrence order. - **Default**: 100 ### td_heavi_amp - **Type**: Vector of Real -- **Availability**: *td_ttype contains 3* +- **Availability**: *[`td_ttype`](#td_ttype) contains 3* - **Description**: Electric-field scale $E_0$ in the Heaviside-pulse definition. Supply exactly one value for each td_ttype 3 occurrence, in occurrence order. - **Default**: 1.0 - **Unit**: V/Angstrom @@ -4429,7 +4430,7 @@ ### td_supsine_amp - **Type**: Vector of Real -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Carrier electric-field scale $E_0$ of each supersine pulse. This is not a normalization of the complete waveform maximum, because the envelope-derivative term also contributes. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order. - **Default**: 0.27 - **Unit**: V/Angstrom @@ -4437,7 +4438,7 @@ ### td_supsine_freq - **Type**: Vector of Real -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Nonzero ordinary carrier frequency $f$ of each supersine pulse, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order. - **Default**: 0.18737028625 - **Unit**: 1/fs @@ -4445,7 +4446,7 @@ ### td_supsine_phase - **Type**: Vector of Real -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Electric-field carrier phase $\varphi$ at the center of each supersine envelope. A value of 0 places a cosine carrier maximum at the envelope center. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order. - **Default**: 0.0 - **Unit**: rad @@ -4453,21 +4454,21 @@ ### td_supsine_sigma - **Type**: Vector of Real -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Dimensionless shape parameter $\sigma$ of each supersine envelope. It must satisfy $0\lt\sigma\lt\pi/2$ so that the electric field approaches zero at the pulse boundaries. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order. - **Default**: 0.75 ### td_supsine_tstart - **Type**: Vector of String -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Integer electronic step at the left, exactly zero boundary of each supersine pulse, defining $t_{\mathrm{s}}=\mathtt{td\_supsine\_tstart}\Delta t$. Supply exactly one integer or default token for each td_ttype 4 occurrence, in occurrence order; each default token inherits td_tstart. The complete pulse support must lie inside the inclusive global td_tstart to td_tend interval; hard truncation of a supersine pulse is rejected. - **Default**: default ### td_supsine_tend - **Type**: Vector of String -- **Availability**: *td_ttype contains 4* +- **Availability**: *[`td_ttype`](#td_ttype) contains 4* - **Description**: Integer electronic step at the right, exactly zero boundary of each supersine pulse, defining $t_{\mathrm{e}}=\mathtt{td\_supsine\_tend}\Delta t$. Supply exactly one integer or default token for each td_ttype 4 occurrence, in occurrence order; each default token inherits td_tend. The complete pulse support must lie inside the inclusive global td_tstart to td_tend interval; hard truncation of a supersine pulse is rejected. - **Default**: default @@ -4507,7 +4508,7 @@ ### out_current - **Type**: Integer -- **Availability**: *basis_type==lcao and esolver_type==tddft* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`esolver_type`](#esolver_type)==tddft* - **Description**: Controls the current-density output method for LCAO RT-TDDFT. Output rows contain the one-based electronic-step index followed by $J_x$, $J_y$, and $J_z$ in atomic units. - 0: Do not output current. - 1: Explicitly construct the velocity operator from the momentum, vector-potential, and KB nonlocal-pseudopotential terms using two-center and spherical-grid integrals: $\hat{v}_{\alpha}=-\mathrm{i}\nabla_{\alpha}+A_{\alpha}(t)+\mathrm{i}\left[\widetilde{V}_{\mathrm{NL}}^{\mathrm{KB}},r_{\alpha}\right]$, where $\widetilde{V}_{\mathrm{NL}}^{\mathrm{KB}}=\mathrm{e}^{-\mathrm{i}\boldsymbol{A}(t)\cdot\boldsymbol{r}}\hat{V}_{\mathrm{NL}}^{\mathrm{KB}}\mathrm{e}^{\mathrm{i}\boldsymbol{A}(t)\cdot\boldsymbol{r}}$. $\boldsymbol{A}(t)$ is nonzero only for the velocity gauge (td_stype=1); otherwise $\boldsymbol{A}(t)=0$. Other nonlocal Hamiltonian terms, such as EXX, are not included explicitly. The total current is written to OUT.{suffix}/current_tot.txt. @@ -4517,7 +4518,7 @@ ### out_current_k - **Type**: Boolean -- **Availability**: *basis_type==lcao and esolver_type==tddft and out_current>0* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`esolver_type`](#esolver_type)==tddft and [`out_current`](#out_current)>0* - **Description**: Controls whether LCAO RT-TDDFT current density is also resolved by spin and k-point. The total-current file is always written when out_current is 1 or 2. - True: In addition to the total, out_current=1 writes OUT.{suffix}/current_s[spin]k[kpoint].txt; out_current=2 writes OUT.{suffix}/current_s[spin]k[kpoint]_comm.txt. Both use one-based spin and k-point numbers, with k-points numbered independently within each spin channel. Each row contains the one-based electronic-step index followed by $J_x$, $J_y$, and $J_z$ in atomic units. - False: Output only current_tot.txt for out_current=1 or current_tot_comm.txt for out_current=2. @@ -4526,7 +4527,7 @@ ### out_efield - **Type**: Boolean -- **Availability**: *esolver_type==tddft and td_vext==true* +- **Availability**: *[`esolver_type`](#esolver_type)==tddft and [`td_vext`](#td_vext)==true* - **Description**: Controls time-dependent electric-field output. For each configured field, OUT.{suffix}/efield_[index].txt contains two columns: physical time in fs and the field value in V/Angstrom. The one-based field index follows the occurrence order shared by td_ttype and td_vext_dire, so fields assigned to the same direction remain in separate files. At initialization, a fresh calculation with md_restart=False truncates the files corresponding to the currently configured fields, whereas a calculation with md_restart=True preserves them and appends new samples. - True: Output electric-field values on active electronic steps. - False: Do not output electric-field values. @@ -4535,7 +4536,7 @@ ### out_vecpot - **Type**: Boolean -- **Availability**: *basis_type==lcao and esolver_type==tddft* +- **Availability**: *[`basis_type`](#basis_type)==lcao and [`esolver_type`](#esolver_type)==tddft* - **Description**: Controls Cartesian vector-potential output for LCAO RT-TDDFT. OUT.{suffix}/vector_pot.txt contains four columns: the one-based electronic-step index followed by $A_x$, $A_y$, and $A_z$ in atomic units. At initialization, a fresh calculation with md_restart=False truncates the file and writes a new header, whereas a calculation with md_restart=True preserves a nonempty existing file and appends new samples. If the restart output file is missing or empty, a new file with a header is created. - True: Write vector-potential samples on electronic propagation steps. - False: Do not output the vector potential. @@ -4622,21 +4623,21 @@ ### cal_cond - **Type**: Boolean -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Whether to calculate electronic conductivities. - **Default**: False ### cond_che_thr - **Type**: Real -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: Control the error of Chebyshev expansions for conductivities. - **Default**: 1e-8 ### cond_dw - **Type**: Real -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Frequency interval () for frequency-dependent conductivities. - **Default**: 0.1 - **Unit**: eV @@ -4644,7 +4645,7 @@ ### cond_wcut - **Type**: Real -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Cutoff frequency for frequency-dependent conductivities. - **Default**: 10.0 - **Unit**: eV @@ -4652,7 +4653,7 @@ ### cond_dt - **Type**: Real -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Time interval () to integrate Onsager coefficients. - **Default**: 0.02 - **Unit**: a.u. @@ -4660,7 +4661,7 @@ ### cond_dtbatch - **Type**: Integer -- **Availability**: *esolver_type = sdft* +- **Availability**: *[`esolver_type`](#esolver_type)==sdft* - **Description**: exp(iH\dt\cond_dtbatch) is expanded with Chebyshev expansion to calculate conductivities. It is faster but costs more memory. - If cond_dtbatch = 0: Autoset this parameter to make expansion orders larger than 100. - **Default**: 0 @@ -4676,7 +4677,7 @@ ### cond_fwhm - **Type**: Real -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: FWHM for conductivities. For Gaussian smearing, ; for Lorentzian smearing, . - **Default**: 0.4 - **Unit**: eV @@ -4684,7 +4685,7 @@ ### cond_nonlocal - **Type**: Boolean -- **Availability**: *basis_type = pw* +- **Availability**: *[`basis_type`](#basis_type)==pw* - **Description**: Whether to consider nonlocal potential correction when calculating velocity matrix . - True: . - False: . @@ -4703,7 +4704,7 @@ ### eb_k - **Type**: Real -- **Availability**: *imp_sol is true.* +- **Availability**: *[`imp_sol`](#imp_sol)==true* - **Description**: The relative permittivity of the bulk solvent, 80 for water - **Default**: 80 @@ -5006,7 +5007,7 @@ ### exciton_plot_format - **Type**: String -- **Availability**: *lr_solver = plot* +- **Availability**: *[`lr_solver`](#lr_solver)==plot* - **Description**: The exciton-density output format. Average density supports cube, slice, and both; conditional density supports slice only. - **Default**: cube @@ -5037,7 +5038,7 @@ ### exciton_slice_range - **Type**: Vector of Integer (4 values) -- **Availability**: *lr_solver = plot and exciton_plot_format = slice or both* +- **Availability**: *[`lr_solver`](#lr_solver)==plot and [`exciton_plot_format`](#exciton_plot_format) in [slice, both]* - **Description**: The in-plane primitive-cell range of an exciton slice: ustart uend vstart vend. The end values are exclusive cell boundaries, while grid data include both range endpoints. - **Default**: -1 2 -1 2 - **Unit**: primitive cells @@ -5051,7 +5052,7 @@ ### aims_nbasis - **Type**: A number(ntype) of Integers -- **Availability**: *ri_hartree_benchmark = aims* +- **Availability**: *[`ri_hartree_benchmark`](#ri_hartree_benchmark)==aims* - **Description**: Atomic basis set size for each atom type (with the same order as in STRU) in FHI-aims. - **Default**: {} (empty list, where ABACUS use its own basis set size) diff --git a/docs/developers_guide/agent_governance.md b/docs/developers_guide/agent_governance.md index 71e7657b64c..b8fb2fa7eff 100644 --- a/docs/developers_guide/agent_governance.md +++ b/docs/developers_guide/agent_governance.md @@ -220,6 +220,10 @@ or parsing behavior should include both: - `docs/parameters.yaml` - `docs/advanced/input_files/input-main.md` +These files are generated artifacts, not additional sources of truth. Update +the C++ `Input_Item` registrations and regenerate both files; do not edit the +YAML or Markdown output by hand. + If the diff touches parameter internals but does not change user-visible INPUT behavior, the PR should state why no documentation update is required. Missing documentation updates trigger a governance warning (not a block), but maintainers diff --git a/docs/developers_guide/index.rst b/docs/developers_guide/index.rst index f346894be47..80224240428 100644 --- a/docs/developers_guide/index.rst +++ b/docs/developers_guide/index.rst @@ -10,4 +10,5 @@ This section provides guidelines and resources for developers working on the ABA :caption: Developer Resources basic_types_class.md + input_availability.md agent_governance.md diff --git a/docs/developers_guide/input_availability.md b/docs/developers_guide/input_availability.md new file mode 100644 index 00000000000..8bad5f2c97e --- /dev/null +++ b/docs/developers_guide/input_availability.md @@ -0,0 +1,71 @@ +# Structured INPUT availability + +## Purpose + +Input item availability metadata describes when an INPUT parameter is +applicable. It is used by documentation and tooling; it does not reject or +alter a user's INPUT based on this condition. Runtime diagnostics, if added, +must define how explicitly supplied parameters whose conditions are false are +handled. + +## Invariants + +- The C++ `Input_Item` registration is the source of truth. YAML and Markdown + are generated artifacts. +- Every non-empty registration is canonical. `set_availability()` rejects + syntax errors and non-canonical spelling. +- The AST is the stored representation; the exported string is serialized from + it, so the two forms cannot diverge. +- Every expression is a complete, independently evaluable predicate. It must + include enclosing requirements rather than inheriting them implicitly from a + referenced parameter. +- After all INPUT items are registered, every referenced label, operator and + literal is checked against machine-readable parameter type information. + +## Grammar and meaning + +```text +expression := or-expression +or-expression := and-expression ("or" and-expression)* +and-expression := primary (("and" | ",") primary)* +primary := condition | "(" expression ")" +condition := parameter comparison value + | parameter "in" "[" value "," value ("," value)* "]" + | parameter "contains" value +comparison := "==" | "!=" | ">" | ">=" | "<" | "<=" +value := token | '"' quoted-value '"' +``` + +`and` binds more tightly than `or`. `==` compares one complete value; double +quotes delimit a complete value containing whitespace, such as +`relax_method=="cg 2"`. Two or more alternatives use `in [...]`, while +`parameter contains value` tests whether a vector contains one element, such as +`td_ttype contains 0`. `/` is an ordinary value character, not another spelling +of membership. Ordered comparisons require a numeric scalar. + +A path that references a parameter must imply that parameter's availability. +Every `and` operand is required, while satisfying either branch of an `or` is +sufficient. Repeated `and` or `or` groups are order-independent. Different leaf +conditions are not related; for example, `mode==a` does not satisfy +`mode in [a, b]`. + +Examples: + +```cpp +item.set_availability("basis_type==pw"); +item.set_availability("vdw_method in [d2, d3_0]"); +item.set_availability("td_ttype contains 2"); +item.set_availability("esolver_type==sdft and method_sto==2"); +``` + +## Registration and validation workflow + +1. Parse and require canonical spelling in `set_availability()`. +2. Finish registering all `Input_Item` objects. +3. Validate referenced parameter names, operator compatibility, literal values, and that every referenced parameter carries its own enclosing requirements on the referencing path. +4. Serialize the AST into `docs/parameters.yaml`. +5. Generate `docs/advanced/input_files/input-main.md` from that YAML. + +Runtime evaluation is outside this metadata contract. Any implementation must +define evaluation timing, treatment of defaults and reset values, and warning +behavior for explicitly supplied parameters. diff --git a/docs/generate_input_main.py b/docs/generate_input_main.py index b3043bd7eb6..62c660d6793 100644 --- a/docs/generate_input_main.py +++ b/docs/generate_input_main.py @@ -140,7 +140,28 @@ def format_description(desc: str) -> str: return result.strip() -def generate_parameter_markdown(param: Dict[str, str]) -> str: +def link_availability(availability: str, name_anchors: Dict[str, str]) -> str: + """ + Link parameter names on the left side of a condition. + + This deliberately recognizes the condition boundary instead of linking + every identifier: a value such as ``pw`` may happen to have the same name + as another parameter, but it is not a parameter reference. + """ + def replace(match): + name = match.group(0) + anchor = name_anchors.get(name) + if anchor: + return f"[`{name}`]({anchor})" + return name + left_parameter = ( + r'\b[A-Za-z_][A-Za-z0-9_]*\b' + r'(?=\s*(?:==|!=|>=|<=|>|<|\bin\b|\bcontains\b))' + ) + return re.sub(left_parameter, replace, availability) + +def generate_parameter_markdown(param: Dict[str, str], + name_anchors: Dict[str, str]) -> str: """ Generate markdown for a single parameter. """ @@ -153,8 +174,9 @@ def generate_parameter_markdown(param: Dict[str, str]) -> str: # Availability (before description, as in original format) if param.get('availability', '') != '': - availability_text = escape_md_text(str(param['availability'])) - lines.append(f"- **Availability**: *{availability_text}*") + lines.append("- **Availability**: *" + + link_availability(str(param['availability']), name_anchors) + + "*") # Description if param.get('description', '') != '': @@ -184,14 +206,15 @@ def generate_parameter_markdown(param: Dict[str, str]) -> str: return '\n'.join(lines) -def generate_category_markdown(category: str, params: List[Dict[str, str]]) -> str: +def generate_category_markdown(category: str, params: List[Dict[str, str]], + name_anchors: Dict[str, str]) -> str: """ Generate markdown for a category section. """ lines = [f"## {category}", ""] for param in params: - lines.append(generate_parameter_markdown(param)) + lines.append(generate_parameter_markdown(param, name_anchors)) # Keep legacy navigation aid used by downstream tooling/rendering. lines.append("[back to top](#full-list-of-input-keywords)") @@ -266,6 +289,9 @@ def generate(yaml_path: Path, output: Path, verbose: bool = False): if cat not in sorted_categories: sorted_categories[cat] = by_category[cat] + name_anchors = {param['name']: '#' + generate_anchor(param['name']) + for param in all_params} + # Generate markdown md_parts = [ "# Full List of INPUT Keywords", @@ -281,7 +307,7 @@ def generate(yaml_path: Path, output: Path, verbose: bool = False): for category, params in sorted_categories.items(): if verbose: print(f"Category '{category}': {len(params)} parameters") - md_parts.append(generate_category_markdown(category, params)) + md_parts.append(generate_category_markdown(category, params, name_anchors)) # Write output output_content = '\n'.join(md_parts) diff --git a/docs/parameters.yaml b/docs/parameters.yaml index bef9069df66..1f824d5e807 100644 --- a/docs/parameters.yaml +++ b/docs/parameters.yaml @@ -203,7 +203,7 @@ parameters: * 1: a memory saving technique will be used for many k point calculations. default_value: "0" unit: "" - availability: Used only for nscf calculations with plane wave basis set. + availability: calculation==nscf and basis_type==pw - name: cal_stress category: System variables type: Boolean @@ -220,7 +220,7 @@ parameters: * >0: it specifies the number of processes used for carrying out diagonalization. Must be less than or equal to total number of MPI processes. default_value: "0" unit: "" - availability: Used only for plane wave basis set. + availability: basis_type==pw - name: nbspline category: System variables type: Integer @@ -286,7 +286,7 @@ parameters: * double: double precision default_value: double unit: "" - availability: Used only for plane wave basis set. + availability: basis_type==pw - name: gint_precision category: System variables type: String @@ -297,7 +297,7 @@ parameters: * mix: mixed precision, starting from single precision and switching to double precision when the SCF residual becomes small enough default_value: double unit: "" - availability: Used only for LCAO basis set. + availability: basis_type==lcao - name: timer_enable_nvtx category: System variables type: Boolean @@ -417,7 +417,7 @@ parameters: Specify the random seed to initialize wave functions. Only positive integers are available. default_value: "0" unit: "" - availability: Only used for plane wave basis. + availability: basis_type==pw - name: diag_subspace category: Plane wave related variables type: Integer @@ -512,7 +512,7 @@ parameters: If restart_save is set to true and an electronic iteration is finished, calculations can be restarted from the charge density file, which are saved in the former calculation. default_value: "False" unit: "" - availability: Used only when numerical atomic orbitals are employed as basis set. + availability: basis_type==lcao - name: basis_type category: Electronic structure type: String @@ -760,7 +760,7 @@ parameters: At n-th iteration which is calculated by drho= 0.0" + availability: "mixing_restart>=0" - name: mixing_gg0 category: Electronic structure type: Real @@ -802,7 +802,7 @@ parameters: * >0: Angle mixing for the modulus with mixing_angle=1.0 default_value: "-10.0" unit: "" - availability: Only relevant for non-colinear calculations nspin=4. + availability: nspin==4 - name: mixing_tau category: Electronic structure type: Boolean @@ -810,9 +810,11 @@ parameters: Whether to mix the kinetic energy density. * True: The kinetic energy density will also be mixed. It seems for general cases, SCF converges fine even without this mixing. However, if there is difficulty in converging SCF for meta-GGA, it might be helpful to turn this on. * False: The kinetic energy density will not be mixed. + + This setting takes effect only when the selected exchange-correlation functional uses the kinetic energy density, such as a meta-GGA or hybrid meta-GGA functional. default_value: "False" unit: "" - availability: Only relevant for meta-GGA calculations. + availability: "" - name: mixing_dftu category: Electronic structure type: Boolean @@ -822,7 +824,7 @@ parameters: * False: The occupation matrices will not be mixed. default_value: "False" unit: "" - availability: Only relevant for DFT+U calculations. + availability: dft_plus_u==1 - name: gamma_only category: Electronic structure type: Boolean @@ -834,7 +836,7 @@ parameters: Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure to turn off gamma_only for multi-k calculations. default_value: "0" unit: "" - availability: Only used in localized orbitals set + availability: basis_type==lcao - name: scf_nmax category: Electronic structure type: Integer @@ -951,7 +953,7 @@ parameters: Use case: When experimental or high-level theoretical results suggest that the SOC effect is weaker or stronger than what full-relativistic pseudopotentials predict, you can adjust this parameter to match the target behavior. default_value: "1.0" unit: "" - availability: Only works when lspinorb=true + availability: lspinorb==true - name: dfthalf_type category: Electronic structure type: Integer @@ -985,7 +987,7 @@ parameters: If TRUE, the wavefunctions at k-point will be initialized from the converged wavefunctions at the nearest k-point, which can speed up the SCF convergence. Only works for PW basis. default_value: "false" unit: "" - availability: Used only for plane wave basis set. + availability: basis_type==pw - name: pw_diag_nmax category: Plane wave related variables type: Integer @@ -993,7 +995,7 @@ parameters: Only useful when you use ks_solver = cg/dav/dav_subspace/bpcg. It indicates the maximal iteration number for cg/david/dav_subspace/bpcg method. default_value: "50" unit: "" - availability: "basis_type==pw, ks_solver==cg/dav/dav_subspace/bpcg" + availability: "basis_type==pw and ks_solver in [cg, dav, dav_subspace, bpcg]" - name: pw_diag_ndim category: Plane wave related variables type: Integer @@ -1180,7 +1182,7 @@ parameters: The paramether controls the size of the first conjugate gradient step. A smaller value means the first step along a new CG direction is smaller. This might be helpful for large systems, where it is safer to take a smaller initial step to prevent the collapse of the whole configuration. default_value: "0.5" unit: "" - availability: Only used when relax_method is cg 2 + availability: "relax_method==\"cg 2\"" - name: relax_nmax category: Geometry relaxation type: Integer @@ -1196,7 +1198,7 @@ parameters: When relax_method is set to cg_bfgs, a mixed algorithm of conjugate gradient (CG) and Broyden–Fletcher–Goldfarb–Shanno (BFGS) is used. The ions first move according to the CG method, then switch to the BFGS method when the maximum force on atoms is reduced below this threshold. default_value: "0.5" unit: eV/Angstrom - availability: Only used when relax_method is cg_bfgs + availability: relax_method==cg_bfgs - name: force_thr category: Geometry relaxation type: Real @@ -1228,7 +1230,7 @@ parameters: Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the sufficient decrease condition (c1 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177. default_value: "0.01" unit: "" - availability: Only used when relax_method is bfgs or cg_bfgs + availability: "relax_method in [bfgs, cg_bfgs]" - name: relax_bfgs_w2 category: Geometry relaxation type: Real @@ -1236,7 +1238,7 @@ parameters: Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the curvature condition (c2 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177. default_value: "0.5" unit: "" - availability: Only used when relax_method is bfgs or cg_bfgs + availability: "relax_method in [bfgs, cg_bfgs]" - name: relax_bfgs_rmax category: Geometry relaxation type: Real @@ -1244,7 +1246,7 @@ parameters: Maximum allowed total displacement of all atoms during geometry optimization. The sum of atomic displacements can increase during optimization steps but cannot exceed this value. default_value: "0.8" unit: Bohr - availability: Only used when relax_method is bfgs or cg_bfgs + availability: "relax_method in [bfgs, cg_bfgs]" - name: relax_bfgs_rmin category: Geometry relaxation type: Real @@ -1252,7 +1254,7 @@ parameters: Minimum allowed total displacement of all atoms. When the total atomic displacement falls below this value and force convergence is not achieved, the calculation will terminate. Note: This parameter is not used in the default BFGS algorithm (relax_method = bfgs 2 or bfgs). default_value: "1e-5" unit: Bohr - availability: Only used when relax_method is bfgs 1 (traditional BFGS) + availability: "relax_method==\"bfgs 1\"" - name: relax_bfgs_init category: Geometry relaxation type: Real @@ -1260,7 +1262,7 @@ parameters: Initial total displacement of all atoms in the first BFGS step. This sets the scale for the initial movement. default_value: "0.5" unit: Bohr - availability: Only used when relax_method is bfgs or cg_bfgs + availability: "relax_method in [bfgs, cg_bfgs]" - name: stress_thr category: Geometry relaxation type: Real @@ -1316,7 +1318,7 @@ parameters: [NOTE] For VASP users, see the ISIF correspondence table in the geometry optimization documentation. default_value: None unit: "" - availability: Only used when calculation is set to cell-relax + availability: calculation==cell-relax - name: fixed_ibrav category: Geometry relaxation type: Boolean @@ -1327,7 +1329,7 @@ parameters: [NOTE] Note: it is possible to use fixed_ibrav with fixed_axes, but please make sure you know what you are doing. For example, if we are doing relaxation of a simple cubic lattice (latname = "sc"), and we use fixed_ibrav along with fixed_axes = "volume", then the cell is never allowed to move and as a result, the relaxation never converges. When both are used, fixed_ibrav is applied first, then fixed_axes = "volume" rescaling is applied. default_value: "False" unit: "" - availability: Only used with relax_method = cg 2. A specific latname must be provided. + availability: "relax_method==\"cg 2\" and latname!=none" - name: fixed_atoms category: Geometry relaxation type: Boolean @@ -1619,7 +1621,7 @@ parameters: Rescaling factor to use a temperature-dependent DP. Energy, stress and force calculated by DP will be multiplied by this factor. default_value: "1.0" unit: "" - availability: esolver_type = dp. + availability: esolver_type==dp - name: dp_fparam category: Molecular dynamics type: Real @@ -1627,7 +1629,7 @@ parameters: The frame parameter for dp potential. The array size is dim_fparam, then all frames are assumed to be provided with the same fparam. default_value: "{}" unit: "" - availability: esolver_type = dp. + availability: esolver_type==dp - name: dp_aparam category: Molecular dynamics type: Real @@ -1635,7 +1637,7 @@ parameters: The atomic parameter for dp potential. The array size can be (1) natoms x dim_aparam, then all frames are assumed to be provided with the same aparam; (2) dim_aparam, then all frames and atoms are assumed to be provided with the same aparam. default_value: "{}" unit: "" - availability: esolver_type = dp. + availability: esolver_type==dp - name: msst_direction category: Molecular dynamics type: Integer @@ -1694,7 +1696,7 @@ parameters: The characteristic time scale for the CSVR (Canonical Sampling through Velocity Rescaling) thermostat. Larger values give weaker coupling, smaller values give stronger coupling. Recommended value: 100 * md_dt. default_value: "100.0" unit: fs - availability: md_thermostat = csvr + availability: md_thermostat==csvr - name: md_tolerance category: Molecular dynamics type: Real @@ -1752,7 +1754,7 @@ parameters: * cpn5: CPN5 KEDF (automatically sets ml parameters) default_value: wt unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_method category: "OFDFT: orbital free density functional theory" type: String @@ -1763,7 +1765,7 @@ parameters: * tn: Truncated Newton algorithm. default_value: tn unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_conv category: "OFDFT: orbital free density functional theory" type: String @@ -1774,7 +1776,7 @@ parameters: * both: Both energy and potential must satisfy the convergence criterion. default_value: energy unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_tole category: "OFDFT: orbital free density functional theory" type: Real @@ -1782,7 +1784,7 @@ parameters: Tolerance of the energy change for determining the convergence. default_value: "2e-6" unit: Ry - availability: OFDFT + availability: esolver_type==ofdft - name: of_tolp category: "OFDFT: orbital free density functional theory" type: Real @@ -1790,7 +1792,7 @@ parameters: Tolerance of potential for determining the convergence. default_value: "1e-5" unit: Ry - availability: OFDFT + availability: esolver_type==ofdft - name: of_tf_weight category: "OFDFT: orbital free density functional theory" type: Real @@ -1798,7 +1800,7 @@ parameters: Weight of TF KEDF (kinetic energy density functional). default_value: "1.0" unit: "" - availability: "OFDFT with of_kinetic=tf, tf+, wt, ext-wt, xwm" + availability: "esolver_type==ofdft and of_kinetic in [tf, tf+, wt, ext-wt, xwm]" - name: of_vw_weight category: "OFDFT: orbital free density functional theory" type: Real @@ -1806,7 +1808,7 @@ parameters: Weight of vW KEDF (kinetic energy density functional). default_value: "1.0" unit: "" - availability: "OFDFT with of_kinetic=vw, tf+, wt, ext-wt, lkt, xwm" + availability: "esolver_type==ofdft and of_kinetic in [vw, tf+, wt, ext-wt, lkt, xwm]" - name: of_wt_alpha category: "OFDFT: orbital free density functional theory" type: Real @@ -1814,7 +1816,7 @@ parameters: Parameter alpha of WT KEDF (kinetic energy density functional). default_value: "" unit: "" - availability: "OFDFT with of_kinetic=wt, ext-wt" + availability: "esolver_type==ofdft and of_kinetic in [wt, ext-wt]" - name: of_wt_beta category: "OFDFT: orbital free density functional theory" type: Real @@ -1822,7 +1824,7 @@ parameters: Parameter beta of WT KEDF (kinetic energy density functional). default_value: "" unit: "" - availability: "OFDFT with of_kinetic=wt, ext-wt" + availability: "esolver_type==ofdft and of_kinetic in [wt, ext-wt]" - name: of_extwt_kappa category: "OFDFT: orbital free density functional theory" type: Real @@ -1830,7 +1832,7 @@ parameters: Parameter kappa for EXT-WT KEDF. default_value: "1.0 / (2.0 * std::pow(4./3., 1./3.) - 1.0)" unit: "" - availability: OFDFT with of_kinetic=ext-wt + availability: esolver_type==ofdft and of_kinetic==ext-wt - name: of_wt_rho0 category: "OFDFT: orbital free density functional theory" type: Real @@ -1838,7 +1840,7 @@ parameters: The average density of system. default_value: "0.0" unit: Bohr^-3 - availability: OFDFT with of_kinetic=wt + availability: esolver_type==ofdft and of_kinetic==wt - name: of_hold_rho0 category: "OFDFT: orbital free density functional theory" type: Boolean @@ -1848,7 +1850,7 @@ parameters: * False: rho0 will change if volume of system has changed. default_value: "False" unit: "" - availability: OFDFT with of_kinetic=wt + availability: esolver_type==ofdft and of_kinetic==wt - name: of_lkt_a category: "OFDFT: orbital free density functional theory" type: Real @@ -1856,7 +1858,7 @@ parameters: Parameter a of LKT KEDF (kinetic energy density functional). default_value: "1.3" unit: "" - availability: OFDFT with of_kinetic=lkt + availability: esolver_type==ofdft and of_kinetic==lkt - name: of_xwm_rho_ref category: "OFDFT: orbital free density functional theory" type: Real @@ -1864,7 +1866,7 @@ parameters: Reference charge density for XWM kinetic energy functional. If set to 0, the program will use average charge density. default_value: "0.0" unit: "" - availability: OFDFT with of_kinetic=xwm + availability: esolver_type==ofdft and of_kinetic==xwm - name: of_xwm_kappa category: "OFDFT: orbital free density functional theory" type: Real @@ -1872,7 +1874,7 @@ parameters: Parameter for XWM kinetic energy functional. See PHYSICAL REVIEW B 100, 205132 (2019) for optimal values. default_value: "0.0" unit: "" - availability: OFDFT with of_kinetic=xwm + availability: esolver_type==ofdft and of_kinetic==xwm - name: of_read_kernel category: "OFDFT: orbital free density functional theory" type: Boolean @@ -1882,7 +1884,7 @@ parameters: * False: The kernel of WT KEDF (kinetic energy density functional) will be filled from formula. default_value: "False" unit: "" - availability: OFDFT with of_kinetic=wt + availability: esolver_type==ofdft and of_kinetic==wt - name: of_kernel_file category: "OFDFT: orbital free density functional theory" type: String @@ -1890,7 +1892,7 @@ parameters: The name of WT kernel file. default_value: WTkernel.txt unit: "" - availability: OFDFT with of_read_kernel=True + availability: esolver_type==ofdft and of_kinetic==wt and of_read_kernel==true - name: of_full_pw category: "OFDFT: orbital free density functional theory" type: Boolean @@ -1900,7 +1902,7 @@ parameters: * False: Only use the planewaves inside ecut, the same as KSDFT. default_value: "True" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_full_pw_dim category: "OFDFT: orbital free density functional theory" type: Integer @@ -1913,7 +1915,7 @@ parameters: Note: Even dimensions may cause slight errors in FFT. It should be ignorable in ofdft calculation, but it may make Cardinal B-spline interpolation unstable, so please set of_full_pw_dim = 1 if nbspline != -1. default_value: "0" unit: "" - availability: OFDFT with of_full_pw = True + availability: esolver_type==ofdft and of_full_pw==true - name: of_ml_gene_data category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -1921,7 +1923,7 @@ parameters: Controls the generation of machine learning training data. When enabled, training data in .npy format will be saved in the directory OUT.${suffix}/. default_value: "False" unit: "" - availability: Used only for KSDFT with plane wave basis + availability: esolver_type==ksdft and basis_type==pw - name: of_ml_device category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: String @@ -1931,7 +1933,7 @@ parameters: * gpu: GPU default_value: cpu unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_feg category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Integer @@ -1942,7 +1944,7 @@ parameters: * 3: Incorporate the FEG limit by nonlinear transformation using softplus function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_nkernel category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Integer @@ -1950,7 +1952,7 @@ parameters: Number of kernel functions. default_value: "1" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_kernel category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -1961,7 +1963,7 @@ parameters: * 3: Truncated kinetic kernel (TKK), the file containing TKK is specified by of_ml_kernel_file. default_value: "1" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_kernel_scaling category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Real @@ -1969,7 +1971,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the RECIPROCAL of scaling parameter of the i-th kernel function. default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_yukawa_alpha category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Real @@ -1977,7 +1979,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the parameter alpha of i-th kernel function. ONLY used for Yukawa kernel function. default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_kernel_file category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of String @@ -1985,7 +1987,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the file containing the i-th kernel function. ONLY used for TKK. default_value: none unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_gamma category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -1993,7 +1995,7 @@ parameters: Local descriptor: gamma = (rho / rho0)^(1/3). default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_p category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2001,7 +2003,7 @@ parameters: Semi-local descriptor: p = |nabla rho|^2 / [2 (3 pi^2)^(1/3) rho^(4/3)]^2. default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_q category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2009,7 +2011,7 @@ parameters: Semi-local descriptor: q = nabla^2 rho / [4 (3 pi^2)^(2/3) rho^(5/3)]. default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhp category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2017,7 +2019,7 @@ parameters: Semi-local descriptor: tanhp = tanh(chi_p * p). default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhq category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2025,7 +2027,7 @@ parameters: Semi-local descriptor: tanhq = tanh(chi_q * q). default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_chi_p category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Real @@ -2033,7 +2035,7 @@ parameters: Hyperparameter chi_p: tanhp = tanh(chi_p * p). default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_chi_q category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Real @@ -2041,7 +2043,7 @@ parameters: Hyperparameter chi_q: tanhq = tanh(chi_q * q). default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_gammanl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2049,7 +2051,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor gammanl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_pnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2057,7 +2059,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor pnl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_qnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2065,7 +2067,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor qnl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_xi category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2073,7 +2075,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor xi defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhxi category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2081,7 +2083,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhxi_nl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2089,7 +2091,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi_nl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanh_pnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2097,7 +2099,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_pnl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanh_qnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2105,7 +2107,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_qnl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhp_nl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2113,7 +2115,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhp_nl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_tanhq_nl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Integer @@ -2121,7 +2123,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhq_nl defined by the i-th kernel function. default_value: "0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_chi_xi category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Real @@ -2129,7 +2131,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_xi of non-local descriptor tanhxi defined by the i-th kernel function. default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_chi_pnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Real @@ -2137,7 +2139,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_pnl of non-local descriptor tanh_pnl defined by the i-th kernel function. default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_chi_qnl category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Vector of Real @@ -2145,7 +2147,7 @@ parameters: Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_qnl of non-local descriptor tanh_qnl defined by the i-th kernel function. default_value: "1.0" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: of_ml_local_test category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2153,7 +2155,7 @@ parameters: FOR TEST. Read in the density, and output the F and Pauli potential. default_value: "False" unit: "" - availability: OFDFT + availability: esolver_type==ofdft - name: ml_exx category: "ML-KEDF: machine learning based kinetic energy density functional for OFDFT" type: Boolean @@ -2172,7 +2174,7 @@ parameters: * other: use 2 default_value: "2" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: nbands_sto category: Electronic structure (SDFT) type: Integer or string @@ -2183,7 +2185,7 @@ parameters: * all: All complete basis sets are used to replace stochastic orbitals with the Chebyshev method (CT), resulting in the same results as KSDFT without stochastic errors. default_value: "256" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: nche_sto category: Electronic structure (SDFT) type: Integer @@ -2191,7 +2193,7 @@ parameters: Chebyshev expansion orders for stochastic DFT. default_value: "100" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: emin_sto category: Electronic structure (SDFT) type: Real @@ -2199,7 +2201,7 @@ parameters: Trial energy to guess the lower bound of eigen energies of the Hamiltonian Operator. default_value: "0.0" unit: Ry - availability: esolver_type = sdft + availability: esolver_type==sdft - name: emax_sto category: Electronic structure (SDFT) type: Real @@ -2207,7 +2209,7 @@ parameters: Trial energy to guess the upper bound of eigen energies of the Hamiltonian Operator. default_value: "0.0" unit: Ry - availability: esolver_type = sdft + availability: esolver_type==sdft - name: seed_sto category: Electronic structure (SDFT) type: Integer @@ -2219,7 +2221,7 @@ parameters: * -1: the seed is decided by time(NULL). default_value: "0" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: initsto_ecut category: Electronic structure (SDFT) type: Real @@ -2227,7 +2229,7 @@ parameters: Stochastic wave functions are initialized in a large box generated by "4*initsto_ecut". initsto_ecut should be larger than ecutwfc. In this method, SDFT results are the same when using different cores. Besides, coefficients of the same G are the same when ecutwfc is rising to initsto_ecut. If it is smaller than ecutwfc, it will be turned off. default_value: "0.0" unit: Ry - availability: esolver_type = sdft + availability: esolver_type==sdft - name: initsto_freq category: Electronic structure (SDFT) type: Integer @@ -2237,7 +2239,7 @@ parameters: * 0: Never change stochastic orbitals. default_value: "0" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: npart_sto category: Electronic structure (SDFT) type: Integer @@ -2245,7 +2247,7 @@ parameters: Make memory cost to 1/npart_sto times of the previous one when running the post process of SDFT like DOS or conductivities. default_value: "1" unit: "" - availability: method_sto = 2 and out_dos = 1 or cal_cond = True + availability: esolver_type==sdft and ((method_sto==2 and out_dos==1) or (basis_type==pw and cal_cond==true)) - name: deepks_out_labels category: DeePKS type: Integer @@ -2258,7 +2260,7 @@ parameters: [NOTE] When deepks_out_labels equals 1, the path of a numerical descriptor (an orb file) is needed to be specified under the NUMERICAL_DESCRIPTOR tag in the STRU file. This is not needed when deepks_out_labels equals 2. default_value: "0" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: deepks_out_freq_elec category: DeePKS type: Integer @@ -2266,7 +2268,7 @@ parameters: When deepks_out_freq_elec is greater than 0, print labels and descriptors for DeePKS in OUT.${suffix}/DeePKS_Labels_Elec per deepks_out_freq_elec electronic iterations, with suffix _e* to distinguish different steps. Often used with deepks_out_labels equals 1. default_value: "0" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: deepks_out_base category: DeePKS type: String @@ -2274,7 +2276,7 @@ parameters: Print labels and descriptors calculated by base functional ( determined by deepks_out_base ) and target functional ( determined by dft_functional ) for DeePKS in per deepks_out_freq_elec electronic iterations. The SCF process, labels and descriptors output of the target functional are all consistent with those when the target functional is used alone. The only additional output under this configuration is the labels of the base functional. Often used with deepks_out_labels equals 1. default_value: None unit: "" - availability: Numerical atomic orbital basis and deepks_out_freq_elec is greater than 0 + availability: "basis_type==lcao and deepks_out_freq_elec>0" - name: deepks_scf category: DeePKS type: Boolean @@ -2284,7 +2286,7 @@ parameters: [NOTE] A trained, traced model file is needed. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: deepks_equiv category: DeePKS type: Boolean @@ -2294,7 +2296,7 @@ parameters: [NOTE] The equivariant version of DeePKS-kit is still under development, so this feature is currently only intended for internal usage. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: deepks_model category: DeePKS type: String @@ -2302,7 +2304,7 @@ parameters: the path of the trained, traced neural network model file generated by deepks-kit default_value: None unit: "" - availability: Numerical atomic orbital basis and deepks_scf is true + availability: basis_type==lcao and deepks_scf==true - name: bessel_descriptor_lmax category: DeePKS type: Integer @@ -2310,7 +2312,7 @@ parameters: the maximum angular momentum of the Bessel functions generated as the projectors in DeePKS - NOte: To generate such projectors, set calculation type to gen_bessel in ABACUS. See also calculation. default_value: "2" unit: "" - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: bessel_descriptor_ecut category: DeePKS type: String @@ -2318,7 +2320,7 @@ parameters: energy cutoff of Bessel functions default_value: same as ecutwfc unit: Ry - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: bessel_descriptor_tolerence category: DeePKS type: Real @@ -2326,7 +2328,7 @@ parameters: tolerance for searching the zeros of Bessel functions default_value: "1.0e-12" unit: "" - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: bessel_descriptor_rcut category: DeePKS type: Real @@ -2334,7 +2336,7 @@ parameters: cutoff radius of Bessel functions default_value: "6.0" unit: Bohr - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: bessel_descriptor_smooth category: DeePKS type: Boolean @@ -2342,7 +2344,7 @@ parameters: smooth the Bessel functions at radius cutoff default_value: "False" unit: "" - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: bessel_descriptor_sigma category: DeePKS type: Real @@ -2350,7 +2352,7 @@ parameters: smooth parameter at the cutoff radius of projectors default_value: "0.1" unit: Bohr - availability: gen_bessel calculation + availability: calculation==gen_bessel - name: deepks_bandgap category: DeePKS type: Integer @@ -2362,7 +2364,7 @@ parameters: * 3: Used for systems containing H atoms. Here HOMO is defined as the max occupation except H atoms and the bandgap label is the energy between HOMO and (HOMO + 1) default_value: "0" unit: "" - availability: Numerical atomic orbital basis and deepks_scf is true + availability: basis_type==lcao and deepks_scf==true - name: deepks_band_range category: DeePKS type: "Integer*2" @@ -2372,7 +2374,7 @@ parameters: * deepks_bandgap is 2: Bandgap labels are energies between HOMO and all states in range [LUMO + deepks_band_range[0], LUMO + deepks_band_range[1]] (Thus there are deepks_band_range[1] - deepks_band_range[0] + 1 bandgaps in total). If HOMO is included in the setting range, it will be ignored since it will always be zero and has no valuable messages (deepks_band_range[1] - deepks_band_range[0] bandgaps in this case). NOTICE: The set range can be greater than, less than, or include the value of HOMO. In the bandgap label, we always calculate the energy of the state in the set range minus the energy of HOMO state, so the bandgap can be negative if the state is lower than HOMO. default_value: "-1 0" unit: "" - availability: "Numerical atomic orbital basis, deepks_scf is true, and deepks_bandgap is 1 or 2" + availability: "basis_type==lcao and deepks_scf==true and deepks_bandgap in [1, 2]" - name: deepks_v_delta category: DeePKS type: Integer @@ -2384,7 +2386,7 @@ parameters: * deepks_v_delta = -2: deepks_phialpha_r.npy and deepks_gevdm.npy, which can be used to calculate deepks_vdrpre.npy. A recommanded method for memory saving. default_value: "0" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: deepks_out_unittest category: DeePKS type: Boolean @@ -2758,7 +2760,7 @@ parameters: * False: Not added the CD potential. default_value: "False" unit: "" - availability: TDOFDFT + availability: esolver_type==tdofdft - name: of_mcd_alpha category: "TDOFDFT: time dependent orbital free density functional theory" type: Real @@ -2766,7 +2768,7 @@ parameters: The value of the parameter alpha in modified CD potential method. mCDPotential=alpha*CDPotential (proposed in paper PhysRevB.98.144302) default_value: "1.0" unit: "" - availability: TDOFDFT + availability: esolver_type==tdofdft - name: xc_kernel category: Linear Response TDDFT type: String @@ -2967,7 +2969,7 @@ parameters: The exciton-density output format. Average density supports cube, slice, and both; conditional density supports slice only. default_value: cube unit: "" - availability: lr_solver = plot + availability: lr_solver==plot - name: exciton_fixed_coordinate category: Linear Response TDDFT type: Vector of Real (6 values) @@ -3007,7 +3009,7 @@ parameters: The in-plane primitive-cell range of an exciton slice: ustart uend vstart vend. The end values are exclusive cell boundaries, while grid data include both range endpoints. default_value: "-1 2 -1 2" unit: primitive cells - availability: lr_solver = plot and exciton_plot_format = slice or both + availability: "lr_solver==plot and exciton_plot_format in [slice, both]" - name: out_freq_ion category: Output information type: Integer @@ -3120,7 +3122,7 @@ parameters: * In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_dmr category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3132,7 +3134,7 @@ parameters: [NOTE] In the 3.10-LTS version, the parameter is named out_dm1, and the file names are data-DMR-sparse_SPIN0.csr and data-DMR-sparse_SPIN1.csr, etc. default_value: "False" unit: "" - availability: Numerical atomic orbital basis (multi-k points) + availability: basis_type==lcao and gamma_only==0 - name: out_wfc_pw category: Output information type: Integer @@ -3151,7 +3153,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file names are WAVEFUNC1.dat, WAVEFUNC2.dat, etc. default_value: "0" unit: "" - availability: "Output electronic wave functions in plane wave basis, or transform the real-space electronic wave function into plane wave basis (see get_wf option in calculation with NAO basis)" + availability: basis_type==pw or (basis_type==lcao and calculation==get_wf) - name: out_wfc_lcao category: Output information type: Integer @@ -3172,7 +3174,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file names are WFC_NAO_GAMMA1_ION1.txt and WFC_NAO_K1_ION1.txt, etc. default_value: "0" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_dos category: Output information type: Integer @@ -3265,7 +3267,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc. default_value: 0 8 unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_mat_hs category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3273,7 +3275,7 @@ parameters: Legacy alias for out_hsk 1, which outputs Hamiltonian and overlap matrices in reciprocal space for each k-point. The optional second integer controls text precision. If both out_hsk and out_mat_hs are present, out_hsk takes precedence. default_value: False 8 unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_hsr category: Output information type: "Integer \\[Integer\\](optional)" @@ -3291,7 +3293,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file names are data-HR-sparse_SPIN0.csr and data-SR-sparse_SPIN0.csr, etc. default_value: 0 8 unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_mat_hs2 category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3299,7 +3301,7 @@ parameters: Legacy alias for out_hsr 1, which outputs Hamiltonian and overlap matrices in real space indexed by the Bravais lattice vector R. The optional second integer controls text precision. If both out_hsr and out_mat_hs2 are present, out_hsr takes precedence. default_value: False 8 unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_mat_tk category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3309,7 +3311,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file names are data-TR-sparse_SPIN0.csr, etc. default_value: "False [8]" unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_mat_r category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3319,7 +3321,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is data-rR-sparse.csr. default_value: False 8 unit: Bohr - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_mat_t category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3329,7 +3331,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is data-TR-sparse_SPIN0.csr. default_value: False 8 unit: Ry - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_mat_dh category: Output information type: Integer @@ -3341,7 +3343,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is data-dHRx-sparse_SPIN0.csr and so on. default_value: 0 8 unit: Ry/Bohr - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_mat_dh_t category: Output information type: Integer @@ -3471,7 +3473,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is data-dSRx-sparse_SPIN0.csr and so on. default_value: False 8 unit: Ry/Bohr - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_mat_xc category: Output information type: Boolean @@ -3481,7 +3483,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is k-$k-Vxc and so on. default_value: "False" unit: Ry - availability: Numerical atomic orbital (NAO) and NAO-in-PW basis + availability: "basis_type in [lcao, lcao_in_pw]" - name: out_mat_xc2 category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3491,7 +3493,7 @@ parameters: [NOTE] In the 3.10-LTS version, the file name is Vxc_R_spin$s and so on. default_value: False 8 unit: Ry - availability: Numerical atomic orbital (NAO) basis + availability: basis_type==lcao - name: out_mat_l category: Output information type: "Boolean \\[Integer\\](optional)" @@ -3499,7 +3501,7 @@ parameters: Whether to print the expectation value of the angular momentum operator , , and in the basis of the localized atomic orbitals. The files are named OUT.{suffix}_Lx.dat, OUT.{suffix}_Ly.dat, and OUT.{suffix}_Lz.dat. The second integer controls the precision of the output. default_value: False 8 unit: "" - availability: Numerical atomic orbital (NAO) basis + availability: basis_type==lcao - name: out_xc_r category: Output information type: "Integer \\[Integer\\](optional)" @@ -3524,7 +3526,7 @@ parameters: Whether to print the band energy terms separately in the file OUT.{term}_out.dat. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated). default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_hr_npz category: Output information type: Boolean @@ -3532,7 +3534,7 @@ parameters: Whether to print Hamiltonian matrices H(R) in NPZ format as hrs1_nao.npz and, for nspin = 2, hrs2_nao.npz. This feature does not work for gamma-only calculations. default_value: "False" unit: Ry - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_hsr_npz category: Output information type: Boolean @@ -3540,7 +3542,7 @@ parameters: Legacy alias for out_hsr 3, writing hrs1_nao.npz, hrs2_nao.npz when needed, and sr_nao.npz. If both out_hsr and out_hsr_npz are present, out_hsr takes precedence. Gamma-only calculations write the folded R = (0, 0, 0) representation. default_value: "False" unit: Ry - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_dm_npz category: Output information type: Boolean @@ -3548,7 +3550,7 @@ parameters: Whether to print density matrices DM(R) in npz format. This feature does not work for gamma-only calculations. default_value: "False" unit: "" - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_mul category: Output information type: Boolean @@ -3556,7 +3558,7 @@ parameters: Whether to print the Mulliken population analysis result into OUT.${suffix}/mulliken.txt. In molecular dynamics calculations, the output frequency is controlled by out_freq_ion. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_app_flag category: Output information type: Boolean @@ -3564,7 +3566,7 @@ parameters: Whether to output r(R), H(R), S(R), T(R), dH(R), dS(R), and wfc matrices in an append manner during molecular dynamics calculations. Check input parameters out_mat_r, out_hsr, out_mat_t, out_mat_dh, out_hsk and out_wfc_lcao for more information. default_value: "true" unit: "" - availability: Numerical atomic orbital basis (not gamma-only algorithm) + availability: basis_type==lcao and gamma_only==0 - name: out_ndigits category: Output information type: Integer @@ -3572,7 +3574,7 @@ parameters: Controls the length of decimal part of output data, such as charge density, Hamiltonian matrix, Overlap matrix and so on. default_value: "8" unit: "" - availability: out_hsk 1 case presently. + availability: basis_type==lcao and out_hsk==1 - name: out_element_info category: Output information type: Boolean @@ -3591,7 +3593,7 @@ parameters: If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or rpa==True), the Hexx(R) files for each processor will also be saved in the above folder, which can be read in EXX calculation with restart_load==True. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: rpa category: Output information type: Boolean @@ -3601,7 +3603,7 @@ parameters: [NOTE] If symmetry is set to 1, additional files containing the necessary information for exploiting symmetry in the subsequent rpa calculation will be output: irreducible_sector.txt, symrot_k.txt and symrot_R.txt. default_value: "False" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: rpa_out_vel category: Output information type: Boolean @@ -3609,7 +3611,7 @@ parameters: Velocity matrix in KS basis (in unit of eV *Angstrom). Loop layer: spin -> k -> direction -> KS_basis1 -> KS_basis2. default_value: "False" unit: "eV * A" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: rpa_outdir category: Output information type: String @@ -3617,7 +3619,7 @@ parameters: The directory to save files for LibRPA. default_value: "\"./OUT.librpa/\"" unit: "" - availability: Numerical atomic orbital basis + availability: basis_type==lcao - name: out_pchg category: Output information type: String @@ -3625,7 +3627,7 @@ parameters: Specifies the electronic states to calculate the charge densities with state index for, using a space-separated string of 0s and 1s. Each digit in the string corresponds to a state, starting from the first state. A 1 indicates that the charge density should be calculated for that state, while a 0 means the state will be ignored. The parameter allows a compact and flexible notation (similar to ocp_set), for example the syntax 1 4*0 5*1 0 is used to denote the selection of states: 1 means calculate for the first state, 4*0 skips the next four states, 5*1 means calculate for the following five states, and the final 0 skips the next state. It's essential that the total count of states does not exceed the total number of states (nbands); otherwise, it results in an error, and the process exits. The input string must contain only numbers and the asterisk (*) for repetition, ensuring correct format and intention of state selection. The outputs comprise multiple .cube files following the naming convention pchgi[state]s[spin]k[kpoint].cube. default_value: none unit: "" - availability: "For both PW and LCAO. When basis_type = lcao, used when calculation = get_pchg." + availability: basis_type==pw or (basis_type==lcao and calculation==get_pchg) - name: out_wfc_norm category: Output information type: String @@ -3633,7 +3635,7 @@ parameters: Specifies the electronic states to calculate the real-space wave function modulus (norm, or known as the envelope function) with state index. The syntax and state selection rules are identical to out_pchg, but the output is the norm of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint].cube. default_value: none unit: "" - availability: "For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf." + availability: basis_type==pw or (basis_type==lcao and calculation==get_wf) - name: out_wfc_re_im category: Output information type: String @@ -3641,7 +3643,7 @@ parameters: Specifies the electronic states to calculate the real and imaginary parts of the wave function with state index. The syntax and state selection rules are identical to out_pchg, but the output contains both the real and imaginary components of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint][re/im].cube. default_value: none unit: "" - availability: "For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf." + availability: basis_type==pw or (basis_type==lcao and calculation==get_wf) - name: if_separate_k category: Output information type: Boolean @@ -3649,7 +3651,7 @@ parameters: Specifies whether to write the partial charge densities for all k-points to individual files or merge them. Warning: Enabling symmetry may produce unwanted results due to reduced k-point weights and symmetry operations in real space. Therefore when calculating partial charge densities, if you are not sure what you want exactly, it is strongly recommended to set symmetry = -1. It is noteworthy that your symmetry setting should remain the same as that in the SCF procedure. default_value: "false" unit: "" - availability: "For both PW and LCAO. When basis_type = pw, used if out_pchg is set. When basis_type = lcao, used only when calculation = get_pchg and gamma_only = 0." + availability: "(basis_type==pw and out_pchg!=none) or (basis_type==lcao and calculation==get_pchg and gamma_only==0)" - name: out_elf category: Output information type: "Integer \\[Integer\\](optional)" @@ -3670,7 +3672,7 @@ parameters: In molecular dynamics calculations, the output frequency is controlled by out_freq_ion. default_value: 0 3 unit: "" - availability: Only for Kohn-Sham DFT and Orbital Free DFT. + availability: "esolver_type in [ksdft, ofdft]" - name: out_spillage category: Output information type: Integer @@ -3678,7 +3680,7 @@ parameters: This output is only intentively needed by the ABACUS numerical atomic orbital generation workflow. This parameter is used to control whether to output the overlap integrals between truncated spherical Bessel functions (TSBFs) and plane-wave basis expanded wavefunctions (named as OVERLAP_Q), and between TSBFs (named as OVERLAP_Sq), also their first order derivatives. The output files are named starting with orb_matrix. A value of 2 would enable the output. default_value: "0" unit: "" - availability: Only for Kohn-Sham DFT with plane-wave basis. + availability: esolver_type==ksdft and basis_type==pw - name: out_dipole category: "RT-TDDFT: Real-Time Time-Dependent Density Functional Theory" type: Boolean @@ -3745,7 +3747,7 @@ parameters: The directory to save the spillage files. default_value: "\"./\"" unit: "" - availability: Used only for plane wave basis set. + availability: basis_type==pw - name: dos_edelta_ev category: Density of states type: Real @@ -3823,7 +3825,7 @@ parameters: Whether to calculate electronic conductivities. default_value: "False" unit: "" - availability: basis_type = pw + availability: basis_type==pw - name: cond_che_thr category: Electronic conductivities type: Real @@ -3831,7 +3833,7 @@ parameters: Control the error of Chebyshev expansions for conductivities. default_value: "1e-8" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: cond_dw category: Electronic conductivities type: Real @@ -3839,7 +3841,7 @@ parameters: Frequency interval () for frequency-dependent conductivities. default_value: "0.1" unit: eV - availability: basis_type = pw + availability: basis_type==pw - name: cond_wcut category: Electronic conductivities type: Real @@ -3847,7 +3849,7 @@ parameters: Cutoff frequency for frequency-dependent conductivities. default_value: "10.0" unit: eV - availability: basis_type = pw + availability: basis_type==pw - name: cond_dt category: Electronic conductivities type: Real @@ -3855,7 +3857,7 @@ parameters: Time interval () to integrate Onsager coefficients. default_value: "0.02" unit: a.u. - availability: basis_type = pw + availability: basis_type==pw - name: cond_dtbatch category: Electronic conductivities type: Integer @@ -3864,7 +3866,7 @@ parameters: * If cond_dtbatch = 0: Autoset this parameter to make expansion orders larger than 100. default_value: "0" unit: "" - availability: esolver_type = sdft + availability: esolver_type==sdft - name: cond_smear category: Electronic conductivities type: Integer @@ -3882,7 +3884,7 @@ parameters: FWHM for conductivities. For Gaussian smearing, ; for Lorentzian smearing, . default_value: "0.4" unit: eV - availability: basis_type = pw + availability: basis_type==pw - name: cond_nonlocal category: Electronic conductivities type: Boolean @@ -3892,7 +3894,7 @@ parameters: * False: . default_value: "True" unit: "" - availability: basis_type = pw + availability: basis_type==pw - name: berry_phase category: Berry phase and wannier90 interface type: Boolean @@ -4023,7 +4025,7 @@ parameters: [NOTE] Note: If you do not want any electric field, the parameter efield_amp should be set to zero. This should ONLY be used in a slab geometry for surface calculations, with the discontinuity FALLING IN THE EMPTY SPACE. default_value: "False" unit: "" - availability: With dip_cor_flag = True and efield_flag = True. + availability: efield_flag==true - name: efield_dir category: Electric field and dipole correction type: Integer @@ -4034,7 +4036,7 @@ parameters: * 2: parallel to the third reciprocal lattice vector default_value: "2" unit: "" - availability: with efield_flag = True. + availability: efield_flag==true - name: efield_pos_max category: Electric field and dipole correction type: Real @@ -4042,7 +4044,7 @@ parameters: Position of the maximum of the saw-like potential along crystal axis efield_dir, within the unit cell, 0 <= efield_pos_max < 1. default_value: Autoset to center of vacuum - width of vacuum / 20 unit: "" - availability: with efield_flag = True. + availability: efield_flag==true - name: efield_pos_dec category: Electric field and dipole correction type: Real @@ -4050,7 +4052,7 @@ parameters: Zone in the unit cell where the saw-like potential decreases, 0 < efield_pos_dec < 1. default_value: Autoset to width of vacuum / 10 unit: "" - availability: with efield_flag = True. + availability: efield_flag==true - name: efield_amp category: Electric field and dipole correction type: Real @@ -4060,7 +4062,7 @@ parameters: [NOTE] Note: The change of slope of this potential must be located in the empty region, or else unphysical forces will result. default_value: "0.0" unit: "a.u., 1 a.u. = 51.4220632*10^10 V/m." - availability: with efield_flag = True. + availability: efield_flag==true - name: gate_flag category: Gate field (compensating charge) type: Boolean @@ -4128,7 +4130,7 @@ parameters: The relative permittivity of the bulk solvent, 80 for water default_value: "80" unit: "" - availability: imp_sol is true. + availability: imp_sol==true - name: tau category: Implicit solvation model type: Real @@ -4176,7 +4178,7 @@ parameters: If set to default, ABACUS infers the functional name from dft_functional or pseudopotential metadata. default_value: default unit: "" - availability: vdw_method is set to d4 + availability: vdw_method==d4 - name: vdw_d4_model category: vdW correction type: String @@ -4187,7 +4189,7 @@ parameters: * d4s: smooth D4S model default_value: "d4" unit: "" - availability: vdw_method is set to d4 + availability: vdw_method==d4 - name: vdw_s6 category: vdW correction type: String @@ -4195,7 +4197,7 @@ parameters: This scale factor is used to optimize the interaction energy deviations in van der Waals (vdW) corrected calculations. The recommended values of this parameter are dependent on the chosen vdW correction method and the DFT functional being used. For DFT-D2, the recommended values are 0.75 (PBE), 1.2 (BLYP), 1.05 (B-P86), 1.0 (TPSS), and 1.05 (B3LYP). If not set, will use values of PBE functional. For DFT-D3, recommended values with different DFT functionals can be found on the here. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. default_value: "" unit: "" - availability: "vdw_method is set to d2, d3_0, or d3_bj" + availability: "vdw_method in [d2, d3_0, d3_bj]" - name: vdw_s8 category: vdW correction type: String @@ -4203,7 +4205,7 @@ parameters: This scale factor is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. default_value: "" unit: "" - availability: vdw_method is set to d3_0 or d3_bj + availability: "vdw_method in [d3_0, d3_bj]" - name: vdw_a1 category: vdW correction type: String @@ -4211,7 +4213,7 @@ parameters: This damping function parameter is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. default_value: "" unit: "" - availability: vdw_method is set to d3_0 or d3_bj + availability: "vdw_method in [d3_0, d3_bj]" - name: vdw_a2 category: vdW correction type: String @@ -4219,7 +4221,7 @@ parameters: This damping function parameter is only relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value. default_value: "" unit: "" - availability: vdw_method is set to d3_0 or d3_bj + availability: "vdw_method in [d3_0, d3_bj]" - name: vdw_d category: vdW correction type: Real @@ -4227,7 +4229,7 @@ parameters: Controls the damping rate of the damping function in the DFT-D2 method. default_value: "20" unit: "" - availability: vdw_method is set to d2 + availability: vdw_method==d2 - name: vdw_abc category: vdW correction type: Boolean @@ -4237,7 +4239,7 @@ parameters: * False: The three-body term is not included. default_value: "False" unit: "" - availability: vdw_method is set to d3_0 or d3_bj + availability: "vdw_method in [d3_0, d3_bj]" - name: vdw_c6_file category: vdW correction type: String @@ -4249,7 +4251,7 @@ parameters: Namely, each line contains the element name and the corresponding parameter. default_value: default unit: "" - availability: vdw_method is set to d2 + availability: vdw_method==d2 - name: vdw_c6_unit category: vdW correction type: String @@ -4259,7 +4261,7 @@ parameters: * eVA (eV Angstrom) default_value: Jnm6/mol unit: "" - availability: vdw_C6_file is not default + availability: "vdw_method==d2 and vdw_c6_file!=default" - name: vdw_r0_file category: vdW correction type: String @@ -4271,7 +4273,7 @@ parameters: Namely, each line contains the element name and the corresponding parameter. default_value: default unit: "" - availability: vdw_method is set to d2 + availability: vdw_method==d2 - name: vdw_r0_unit category: vdW correction type: String @@ -4281,7 +4283,7 @@ parameters: * Bohr default_value: "A" unit: "" - availability: vdw_R0_file is not default + availability: "vdw_method==d2 and vdw_r0_file!=default" - name: vdw_cutoff_type category: vdW correction type: String @@ -4299,7 +4301,7 @@ parameters: Defines the radius of the cutoff sphere when vdw_cutoff_type is set to radius. The default values depend on the chosen vdw_method. default_value: "" unit: defined by vdw_radius_unit (default Bohr) - availability: vdw_cutoff_type is set to radius + availability: vdw_cutoff_type==radius - name: vdw_radius_unit category: vdW correction type: String @@ -4309,7 +4311,7 @@ parameters: * Bohr default_value: Bohr unit: "" - availability: vdw_cutoff_type is set to radius + availability: vdw_cutoff_type==radius - name: vdw_cutoff_period category: vdW correction type: Integer Integer Integer @@ -4317,7 +4319,7 @@ parameters: The three integers supplied here explicitly specify the extent of the supercell in the directions of the three basis lattice vectors. default_value: 3 3 3 unit: "" - availability: vdw_cutoff_type is set to period + availability: vdw_cutoff_type==period - name: vdw_cn_thr category: vdW correction type: Real @@ -4325,7 +4327,7 @@ parameters: The cutoff radius when calculating coordination numbers. default_value: "40" unit: "defined by vdw_cn_thr_unit (default: Bohr)" - availability: "vdw_method is set to d3_0, d3_bj, or d4" + availability: "vdw_method in [d3_0, d3_bj, d4]" - name: vdw_cn_thr_unit category: vdW correction type: String @@ -4532,7 +4534,7 @@ parameters: * True: rotate both D(k) and Hexx(R) to accelerate both diagonalization and EXX calculation default_value: "True" unit: "" - availability: symmetry==1 and exx calculation (dft_fuctional==hse/hf/pbe0/scan0 or rpa==True) + availability: "symmetry==1 and (dft_functional in [hse, hf, pbe0, scan0] or (basis_type==lcao and rpa==true))" - name: out_ri_cv category: Exact Exchange (LCAO) type: Boolean @@ -4599,7 +4601,7 @@ parameters: The screen length of Yukawa potential. If left to default, the screen length will be calculated as an average of the entire system. It's better to stick to the default setting unless there is a very good reason. default_value: Calculated on the fly. unit: "" - availability: DFT+U with yukawa_potential = True. + availability: dft_plus_u==1 and yukawa_potential==true - name: uramping category: DFT+U correction type: Real @@ -4607,7 +4609,7 @@ parameters: Once uramping > 0.15 eV. DFT+U calculations will start SCF with U = 0 eV, namely normal LDA/PBE calculations. Once SCF restarts when drho 0." + availability: "dft_plus_u==1 and mixing_restart>0" - name: omc category: DFT+U correction type: Integer @@ -4629,7 +4631,7 @@ parameters: * The modulation algorithm applies a smooth truncation to the orbital tail followed by normalization. A representative profile is $f(r)=\frac{1}{2}\left[1+\operatorname{erf}\!\left(\frac{r_c-r}{\sigma}\right)\right]$, where $r_c$ is the cutoff radius and $\sigma=\gamma r_c$ controls smoothness. default_value: "3.0" unit: Bohr - availability: dft_plus_u is set to 1 + availability: dft_plus_u==1 - name: sc_mag_switch category: Spin-Constrained DFT type: Boolean @@ -4653,7 +4655,7 @@ parameters: Convergence criterion of spin-constrained iteration (RMS) in uB default_value: "1.0e-6" unit: uB - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: nsc category: Spin-Constrained DFT type: Integer @@ -4661,7 +4663,7 @@ parameters: Maximal number of spin-constrained iteration default_value: "100" unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: nsc_min category: Spin-Constrained DFT type: Integer @@ -4669,7 +4671,7 @@ parameters: Minimum number of spin-constrained iteration default_value: "2" unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: alpha_trial category: Spin-Constrained DFT type: Real @@ -4677,7 +4679,7 @@ parameters: Initial trial step size for lambda in eV/uB^2 default_value: "0.01" unit: eV/uB^2 - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sccut category: Spin-Constrained DFT type: Real @@ -4685,7 +4687,7 @@ parameters: Maximal step size for lambda in eV/uB default_value: "3.0" unit: eV/uB - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sc_drop_thr category: Spin-Constrained DFT type: Real @@ -4693,7 +4695,7 @@ parameters: Convergence criterion ratio of lambda iteration in Spin-constrained DFT default_value: "1.0e-2" unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sc_scf_thr category: Spin-Constrained DFT type: Real @@ -4701,7 +4703,7 @@ parameters: Density error threshold for inner loop of spin-constrained SCF default_value: "1.0e-4" unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sc_direction_only category: Spin-Constrained DFT type: Boolean @@ -4711,7 +4713,7 @@ parameters: When false (default), both the direction and magnitude of the magnetic moment are constrained to the target values. default_value: "False" unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sc_lambda_strategy category: Spin-Constrained DFT type: String @@ -4724,7 +4726,7 @@ parameters: * linear_scan: linear sweep of lambda for testing magnetic moment response default_value: bfgs unit: "" - availability: sc_mag_switch is true + availability: sc_mag_switch==true - name: sc_scan_lambda_start category: Spin-Constrained DFT type: Float @@ -4732,7 +4734,7 @@ parameters: Starting lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan. default_value: "0.0" unit: eV/uB - availability: sc_lambda_strategy is linear_scan + availability: sc_mag_switch==true and sc_lambda_strategy==linear_scan - name: sc_scan_lambda_end category: Spin-Constrained DFT type: Float @@ -4740,7 +4742,7 @@ parameters: Ending lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan. default_value: "1.0" unit: eV/uB - availability: sc_lambda_strategy is linear_scan + availability: sc_mag_switch==true and sc_lambda_strategy==linear_scan - name: sc_scan_steps category: Spin-Constrained DFT type: Integer @@ -4748,7 +4750,7 @@ parameters: Number of lambda values to scan. Only used when sc_lambda_strategy=linear_scan. default_value: "20" unit: "" - availability: sc_lambda_strategy is linear_scan + availability: sc_mag_switch==true and sc_lambda_strategy==linear_scan - name: qo_switch category: Quasiatomic Orbital (QO) analysis type: Boolean @@ -5088,7 +5090,7 @@ parameters: Atomic basis set size for each atom type (with the same order as in STRU) in FHI-aims. default_value: "{} (empty list, where ABACUS use its own basis set size)" unit: "" - availability: ri_hartree_benchmark = aims + availability: ri_hartree_benchmark==aims - name: rdmft category: Reduced Density Matrix Functional Theory type: Boolean @@ -5114,7 +5116,7 @@ parameters: * False: Use the traditional method to calculate the Fock exchange operator. default_value: "True" unit: "" - availability: exx_separate_loop==True. + availability: exx_separate_loop==true - name: exx_gamma_extrapolation category: Exact Exchange (PW) type: Boolean diff --git a/source/Makefile.Objects b/source/Makefile.Objects index 30c3243dbbd..0948487aa7b 100644 --- a/source/Makefile.Objects +++ b/source/Makefile.Objects @@ -603,6 +603,8 @@ OBJS_IO=module_parameter/input_conv.o\ readin_info.o\ output_info.o\ parse_args.o\ + module_parameter/availability.o\ + module_parameter/availability_validator.o\ module_parameter/read_input.o\ module_parameter/read_inp_sys.o\ module_parameter/read_inp_estruc.o\ @@ -611,6 +613,7 @@ OBJS_IO=module_parameter/input_conv.o\ module_parameter/read_inp_ofdft.o\ module_parameter/read_input_item_sdft.o\ module_parameter/read_inp_tddft.o\ + module_parameter/read_inp_bse.o\ module_parameter/read_inp_deepks.o\ module_parameter/read_inp_model.o\ module_parameter/read_inp_postproc.o\ diff --git a/source/source_io/CMakeLists.txt b/source/source_io/CMakeLists.txt index b506a2ad794..ae4435cd973 100644 --- a/source/source_io/CMakeLists.txt +++ b/source/source_io/CMakeLists.txt @@ -1,4 +1,4 @@ -# Note: Help data is now embedded in Input_Item objects in read_input_item_*.cpp +# 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 @@ -109,6 +109,8 @@ add_library( module_parameter/read_inp_exx_dftu.cpp module_parameter/read_inp_other.cpp module_parameter/read_inp_out.cpp + module_parameter/availability.cpp + module_parameter/availability_validator.cpp module_parameter/read_input.cpp module_parameter/read_set_globalv.cpp ) @@ -137,6 +139,7 @@ if(ENABLE_COVERAGE) endif() if(BUILD_TESTING) + add_subdirectory(module_parameter/test) if(ENABLE_MPI) add_subdirectory(test) add_subdirectory(test_serial) diff --git a/source/source_io/input_help.cpp b/source/source_io/input_help.cpp index a53392d5fb9..9681f717841 100644 --- a/source/source_io/input_help.cpp +++ b/source/source_io/input_help.cpp @@ -370,7 +370,7 @@ void ParameterHelp::build_registry() { meta.description = item.description; meta.default_value = item.default_value; meta.unit = item.unit; - meta.availability = item.availability; + meta.availability = item.get_availability(); // Pre-compute lowercase name for fast fuzzy matching meta.name_lowercase = to_lowercase(item.label); @@ -505,7 +505,7 @@ void ParameterHelp::generate_yaml(std::ostream& os) { os << " default_value: " << yaml_quote_if_needed(item.default_value) << "\n"; os << " unit: " << yaml_quote_if_needed(item.unit) << "\n"; - os << " availability: " << yaml_quote_if_needed(item.availability) << "\n"; + os << " availability: " << yaml_quote_if_needed(item.get_availability()) << "\n"; } } diff --git a/source/source_io/module_parameter/availability.cpp b/source/source_io/module_parameter/availability.cpp new file mode 100644 index 00000000000..611fa0526e6 --- /dev/null +++ b/source/source_io/module_parameter/availability.cpp @@ -0,0 +1,348 @@ +#include "source_io/module_parameter/availability.h" + +#include +#include +#include + +namespace ModuleIO +{ +namespace +{ + +bool is_identifier_start(const char c) +{ + return std::isalpha(static_cast(c)) != 0; +} + +bool is_identifier_char(const char c) +{ + return std::isalnum(static_cast(c)) != 0 || c == '_'; +} + +std::string format_value(const std::string& value) +{ + for (const char c : value) + { + if (std::isspace(static_cast(c)) || c == '(' || c == ')' + || c == '[' || c == ']' || c == ',' || c == '=' || c == '<' + || c == '>' || c == '!') + { + return "\"" + value + "\""; + } + } + return value; +} + +class AvailabilityParser +{ + public: + explicit AvailabilityParser(const std::string& text) : text_(text) {} + + AvailabilityExpr parse() + { + if (at_end()) + { + return AvailabilityExpr(); + } + skip_space(); + if (at_end()) + { + fail("expected parameter identifier"); + } + + AvailabilityExpr result = parse_or(); + skip_space(); + if (!at_end()) + { + fail("unexpected token"); + } + return result; + } + + private: + const std::string& text_; + std::size_t pos_ = 0; + + bool at_end() const + { + return pos_ == text_.size(); + } + + void skip_space() + { + while (!at_end() && std::isspace(static_cast(text_[pos_]))) + { + ++pos_; + } + } + + [[noreturn]] void fail(const std::string& message) const + { + throw std::invalid_argument("Invalid availability expression at column " + + std::to_string(pos_ + 1) + ": " + message + + " in '" + text_ + "'"); + } + + bool consume_char(const char expected) + { + skip_space(); + if (!at_end() && text_[pos_] == expected) + { + ++pos_; + return true; + } + return false; + } + + bool consume_keyword(const char* keyword) + { + skip_space(); + const std::size_t length = std::char_traits::length(keyword); + if (text_.compare(pos_, length, keyword) != 0) + { + return false; + } + const std::size_t end = pos_ + length; + if ((pos_ > 0 && is_identifier_char(text_[pos_ - 1])) + || (end < text_.size() && is_identifier_char(text_[end]))) + { + return false; + } + pos_ = end; + return true; + } + + std::string parse_identifier() + { + skip_space(); + if (at_end() || !is_identifier_start(text_[pos_])) + { + fail("expected parameter identifier"); + } + const std::size_t begin = pos_++; + while (!at_end() && is_identifier_char(text_[pos_])) + { + ++pos_; + } + return text_.substr(begin, pos_ - begin); + } + + std::string parse_scalar_value() + { + skip_space(); + if (!at_end() && text_[pos_] == '"') + { + ++pos_; + const std::size_t content_begin = pos_; + while (!at_end() && text_[pos_] != '"') + { + ++pos_; + } + if (at_end()) + { + fail("expected closing quote"); + } + if (pos_ == content_begin) + { + fail("expected non-empty quoted value"); + } + const std::string value = text_.substr(content_begin, pos_ - content_begin); + ++pos_; + return value; + } + + const std::size_t begin = pos_; + while (!at_end() && !std::isspace(static_cast(text_[pos_])) + && text_[pos_] != '(' && text_[pos_] != ')' && text_[pos_] != '[' + && text_[pos_] != ']' && text_[pos_] != ',') + { + if (text_[pos_] == '=' || text_[pos_] == '<' || text_[pos_] == '>' + || text_[pos_] == '!') + { + fail("invalid character in value"); + } + ++pos_; + } + if (begin == pos_) + { + fail("expected value"); + } + return text_.substr(begin, pos_ - begin); + } + + AvailabilityExpr parse_condition() + { + AvailabilityExpr result; + skip_space(); + if (at_end()) + { + fail("expected parameter identifier"); + } + + result.condition.param = parse_identifier(); + skip_space(); + + static const char* comparison_ops[] = {"==", "!=", ">=", "<=", ">", "<"}; + for (const char* op : comparison_ops) + { + const std::size_t length = std::char_traits::length(op); + if (text_.compare(pos_, length, op) == 0) + { + pos_ += length; + result.condition.op = op; + result.condition.values.push_back(parse_scalar_value()); + return result; + } + } + + if (consume_keyword("contains")) + { + result.condition.op = "contains"; + result.condition.values.push_back(parse_scalar_value()); + return result; + } + + if (consume_keyword("in")) + { + if (!consume_char('[')) + { + fail("expected '[' after 'in'"); + } + result.condition.op = "in"; + result.condition.values.push_back(parse_scalar_value()); + while (consume_char(',')) + { + result.condition.values.push_back(parse_scalar_value()); + } + if (!consume_char(']')) + { + fail("expected ']' after list"); + } + if (result.condition.values.size() == 1) + { + fail("use '==' for a single value"); + } + return result; + } + + fail("expected comparison operator"); + } + + AvailabilityExpr parse_primary() + { + skip_space(); + if (consume_char('(')) + { + AvailabilityExpr result = parse_or(); + if (!consume_char(')')) + { + fail("expected ')' after grouped expression"); + } + return result; + } + return parse_condition(); + } + + AvailabilityExpr parse_and() + { + AvailabilityExpr result = parse_primary(); + std::vector children; + children.push_back(result); + while (true) + { + if (!consume_keyword("and") && !consume_char(',')) + { + break; + } + children.push_back(parse_primary()); + } + if (children.size() == 1) + { + return result; + } + AvailabilityExpr node; + node.op = "and"; + node.children = std::move(children); + return node; + } + + AvailabilityExpr parse_or() + { + AvailabilityExpr result = parse_and(); + std::vector children; + children.push_back(result); + while (consume_keyword("or")) + { + children.push_back(parse_and()); + } + if (children.size() == 1) + { + return result; + } + AvailabilityExpr node; + node.op = "or"; + node.children = std::move(children); + return node; + } +}; + +} // namespace + +std::string AvailabilityCondition::to_string() const +{ + if (values.empty()) + { + return {}; + } + if (op == "in") + { + std::string result = param + " in ["; + for (std::size_t i = 0; i < values.size(); ++i) + { + if (i) + { + result += ", "; + } + result += format_value(values[i]); + } + return result + "]"; + } + if (op == "contains") + { + return param + " contains " + format_value(values[0]); + } + return param + op + format_value(values[0]); +} + +std::string AvailabilityExpr::to_string() const +{ + if (is_leaf()) + { + return condition.to_string(); + } + const std::string separator = op == "or" ? " or " : " and "; + std::string result; + for (std::size_t i = 0; i < children.size(); ++i) + { + if (i) + { + result += separator; + } + if (children[i].is_leaf()) + { + result += children[i].to_string(); + } + else + { + result += "(" + children[i].to_string() + ")"; + } + } + return result; +} + +AvailabilityExpr parse_availability(const std::string& raw) +{ + return AvailabilityParser(raw).parse(); +} + +} // namespace ModuleIO diff --git a/source/source_io/module_parameter/availability.h b/source/source_io/module_parameter/availability.h new file mode 100644 index 00000000000..0eabc619f99 --- /dev/null +++ b/source/source_io/module_parameter/availability.h @@ -0,0 +1,48 @@ +#ifndef AVAILABILITY_H +#define AVAILABILITY_H + +#include +#include + +namespace ModuleIO +{ + +/// A single condition `param op values` (e.g. `basis_type==lcao` or +/// `vdw_method in [d2, d3_0]`). +struct AvailabilityCondition +{ + std::string param; ///< parameter identifier + std::string op; ///< ==, !=, >, >=, <, <=, "in" or vector containment + std::vector values; ///< one value for comparisons, several for "in" + + std::string to_string() const; +}; + +/// Boolean expression tree. A leaf holds a single condition; a non-leaf node +/// holds `op` ("and"|"or") and `children`. +struct AvailabilityExpr +{ + std::string op; ///< "" (leaf) | "and" | "or" + AvailabilityCondition condition; ///< valid when leaf + std::vector children; ///< valid when non-leaf + + bool is_leaf() const + { + return op.empty(); + } + + std::string to_string() const; +}; + +/// Parse an availability string into its boolean-expression tree. +/// +/// Accepts the canonical grammar (`param==value`, `param in [a, b]`, the +/// comparison operators ==, !=, >, >=, <, <=, `and`/`or`/`,` combinators and +/// `(...)` grouping). An empty string yields an empty (always-available) +/// expression. Non-empty input that is not consumed by this grammar throws +/// std::invalid_argument. +AvailabilityExpr parse_availability(const std::string& raw); + +} // namespace ModuleIO + +#endif // AVAILABILITY_H diff --git a/source/source_io/module_parameter/availability_validator.cpp b/source/source_io/module_parameter/availability_validator.cpp new file mode 100644 index 00000000000..8ffc538b22f --- /dev/null +++ b/source/source_io/module_parameter/availability_validator.cpp @@ -0,0 +1,363 @@ +#include "source_io/module_parameter/availability_validator.h" + +#include +#include +#include +#include +#include + +namespace ModuleIO +{ +namespace +{ + +bool starts_with(const std::string& value, const std::string& prefix) +{ + return value.compare(0, prefix.size(), prefix) == 0; +} + +bool is_vector(const AvailabilityValueKind kind) +{ + return kind == AvailabilityValueKind::BooleanVector + || kind == AvailabilityValueKind::IntegerVector + || kind == AvailabilityValueKind::RealVector + || kind == AvailabilityValueKind::StringVector; +} + +AvailabilityValueKind element_kind(const AvailabilityValueKind kind) +{ + switch (kind) + { + case AvailabilityValueKind::BooleanVector: + return AvailabilityValueKind::Boolean; + case AvailabilityValueKind::IntegerVector: + return AvailabilityValueKind::Integer; + case AvailabilityValueKind::RealVector: + return AvailabilityValueKind::Real; + case AvailabilityValueKind::StringVector: + return AvailabilityValueKind::String; + default: + return kind; + } +} + +bool is_integer(const std::string& value) +{ + if (value.empty()) + { + return false; + } + char* end = nullptr; + errno = 0; + std::strtol(value.c_str(), &end, 10); + return errno != ERANGE && end != value.c_str() && *end == '\0'; +} + +bool is_real(const std::string& value) +{ + if (value.empty()) + { + return false; + } + char* end = nullptr; + errno = 0; + std::strtod(value.c_str(), &end); + return errno != ERANGE && end != value.c_str() && *end == '\0'; +} + +bool literal_matches(const std::string& value, const AvailabilityValueKind kind) +{ + switch (kind) + { + case AvailabilityValueKind::Boolean: + return value == "true" || value == "false" || value == "0" || value == "1"; + case AvailabilityValueKind::Integer: + return is_integer(value); + case AvailabilityValueKind::Real: + return is_real(value); + case AvailabilityValueKind::String: + return !value.empty(); + default: + return false; + } +} + +void fail(const std::string& owner, const std::string& message) +{ + throw std::invalid_argument("Invalid availability for '" + owner + "': " + message); +} + +void validate_condition( + const std::string& owner, + const AvailabilityCondition& condition, + const std::map& parameter_types) +{ + const auto parameter = parameter_types.find(condition.param); + if (parameter == parameter_types.end()) + { + fail(owner, "unknown parameter '" + condition.param + "'"); + } + if (parameter->second == AvailabilityValueKind::Unknown) + { + fail(owner, "parameter '" + condition.param + "' has no machine-readable type"); + } + + const AvailabilityValueKind kind = parameter->second; + if (condition.op == "contains" && !is_vector(kind)) + { + fail(owner, "vector containment requires a vector parameter, but '" + condition.param + + "' is scalar"); + } + if ((condition.op == ">" || condition.op == ">=" || condition.op == "<" + || condition.op == "<=") + && kind != AvailabilityValueKind::Integer && kind != AvailabilityValueKind::Real) + { + fail(owner, "ordered comparison requires a numeric scalar parameter, but '" + + condition.param + "' is not one"); + } + + const AvailabilityValueKind literal_kind = element_kind(kind); + for (const std::string& value : condition.values) + { + const bool legacy_string_vector + = kind == AvailabilityValueKind::StringVector && condition.op == "in"; + if (!legacy_string_vector && !literal_matches(value, literal_kind)) + { + fail(owner, + "value '" + value + "' is incompatible with parameter '" + condition.param + + "'"); + } + } +} + +void validate_node( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& parameter_types) +{ + if (expression.is_leaf()) + { + if (!expression.condition.param.empty()) + { + validate_condition(owner, expression.condition, parameter_types); + } + return; + } + for (const AvailabilityExpr& child : expression.children) + { + validate_node(owner, child, parameter_types); + } +} + +} // namespace + +AvailabilityValueKind availability_value_kind(const std::string& type) +{ + if (starts_with(type, "Vector of Boolean")) + { + return AvailabilityValueKind::BooleanVector; + } + if (starts_with(type, "Vector of Integer") || starts_with(type, "A number(ntype) of Integers") + || starts_with(type, "Integer \\[Integer\\]")) + { + return AvailabilityValueKind::IntegerVector; + } + if (starts_with(type, "Vector of Real")) + { + return AvailabilityValueKind::RealVector; + } + if (starts_with(type, "Vector of String") || starts_with(type, "Vector of string")) + { + return AvailabilityValueKind::StringVector; + } + if (type == "Boolean") + { + return AvailabilityValueKind::Boolean; + } + if (type == "Integer") + { + return AvailabilityValueKind::Integer; + } + if (type == "Real" || type == "Float") + { + return AvailabilityValueKind::Real; + } + if (type == "String") + { + return AvailabilityValueKind::String; + } + return AvailabilityValueKind::Unknown; +} + +void validate_availability_expr( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& parameter_types) +{ + validate_node(owner, expression, parameter_types); +} + +namespace +{ + +using Conjunction = std::set; + +std::string structural_key(const AvailabilityExpr& expression); + +void collect_operands(const AvailabilityExpr& expression, + const std::string& op, + std::vector& operands) +{ + if (!expression.is_leaf() && expression.op == op) + { + for (const AvailabilityExpr& child : expression.children) + { + collect_operands(child, op, operands); + } + return; + } + operands.push_back(structural_key(expression)); +} + +/// Build an order-independent key while flattening only associative uses of the +/// same boolean operator. No distributive or condition-level inference is done. +std::string structural_key(const AvailabilityExpr& expression) +{ + if (expression.is_leaf()) + { + const std::string condition = expression.condition.to_string(); + return "leaf:" + std::to_string(condition.size()) + ":" + condition; + } + + std::vector operands; + collect_operands(expression, expression.op, operands); + std::sort(operands.begin(), operands.end()); + + std::string result = expression.op + ":"; + for (const std::string& operand : operands) + { + result += std::to_string(operand.size()) + ":" + operand; + } + return result; +} + +void add_conjuncts(const AvailabilityExpr& expression, Conjunction& conjunction) +{ + if (!expression.is_leaf() && expression.op == "and") + { + for (const AvailabilityExpr& child : expression.children) + { + add_conjuncts(child, conjunction); + } + return; + } + conjunction.insert(structural_key(expression)); +} + +bool conjunction_implies(const AvailabilityExpr& prerequisite, + const Conjunction& conjunction) +{ + if (prerequisite.is_leaf() && prerequisite.condition.param.empty()) + { + return true; + } + if (conjunction.count(structural_key(prerequisite)) != 0) + { + return true; + } + if (prerequisite.is_leaf()) + { + return false; + } + if (prerequisite.op == "and") + { + for (const AvailabilityExpr& child : prerequisite.children) + { + if (!conjunction_implies(child, conjunction)) + { + return false; + } + } + return true; + } + for (const AvailabilityExpr& child : prerequisite.children) + { + if (conjunction_implies(child, conjunction)) + { + return true; + } + } + return false; +} + +/// Check every reference against the explicit conditions in its enclosing +/// conjunction. An AND prerequisite needs every operand, while any satisfied OR +/// branch is sufficient. Different leaf conditions are not related. +void validate_node_self_contained( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& expressions, + const Conjunction& enclosing_conjunction) +{ + if (expression.is_leaf()) + { + if (expression.condition.param.empty()) + { + return; + } + const std::string& referenced = expression.condition.param; + if (referenced == owner) + { + fail(owner, "references itself"); + } + const auto it = expressions.find(referenced); + if (it != expressions.end()) + { + if (!conjunction_implies(it->second, enclosing_conjunction)) + { + fail(owner, + "references '" + referenced + "', whose availability requires '" + + it->second.to_string() + + "'; ensure that prerequisite is implied on the same path"); + } + } + return; + } + + if (expression.op == "and") + { + for (std::size_t i = 0; i < expression.children.size(); ++i) + { + Conjunction child_conjunction = enclosing_conjunction; + for (std::size_t j = 0; j < expression.children.size(); ++j) + { + if (i != j) + { + add_conjuncts(expression.children[j], child_conjunction); + } + } + validate_node_self_contained(owner, + expression.children[i], + expressions, + child_conjunction); + } + return; + } + + for (const AvailabilityExpr& child : expression.children) + { + validate_node_self_contained(owner, child, expressions, enclosing_conjunction); + } +} + +} // namespace + +void validate_availability_self_contained( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& expressions) +{ + validate_node_self_contained(owner, expression, expressions, Conjunction{}); +} + +} // namespace ModuleIO diff --git a/source/source_io/module_parameter/availability_validator.h b/source/source_io/module_parameter/availability_validator.h new file mode 100644 index 00000000000..f1bf59f28b0 --- /dev/null +++ b/source/source_io/module_parameter/availability_validator.h @@ -0,0 +1,50 @@ +#ifndef AVAILABILITY_VALIDATOR_H +#define AVAILABILITY_VALIDATOR_H + +#include "source_io/module_parameter/availability.h" + +#include +#include + +namespace ModuleIO +{ + +enum class AvailabilityValueKind +{ + Unknown, + Boolean, + Integer, + Real, + String, + BooleanVector, + IntegerVector, + RealVector, + StringVector +}; + +/// Convert the documentation type of an Input_Item into the type information +/// needed to validate availability operators and literals. +AvailabilityValueKind availability_value_kind(const std::string& type); + +/// Validate references, operators and literal values in one availability AST. +/// Throws std::invalid_argument when metadata cannot be evaluated safely. +void validate_availability_expr( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& parameter_types); + +/// Validate that each path referencing a parameter implies that parameter's +/// availability AST. Associative AND/OR groups are flattened and +/// order-independent; AND prerequisites require every operand, while any +/// satisfied OR branch is sufficient. Different leaf conditions are not +/// related. \p expressions maps every parameter label to its availability AST. +/// Throws std::invalid_argument when a referenced parameter's prerequisite is +/// missing. +void validate_availability_self_contained( + const std::string& owner, + const AvailabilityExpr& expression, + const std::map& expressions); + +} // namespace ModuleIO + +#endif // AVAILABILITY_VALIDATOR_H diff --git a/source/source_io/module_parameter/input_item.h b/source/source_io/module_parameter/input_item.h index ed07d04f831..b77a656bd40 100644 --- a/source/source_io/module_parameter/input_item.h +++ b/source/source_io/module_parameter/input_item.h @@ -3,10 +3,12 @@ #include #include #include +#include #include #include #include "source_io/module_parameter/parameter.h" +#include "source_io/module_parameter/availability.h" namespace ModuleIO { class Input_Item @@ -30,7 +32,7 @@ class Input_Item description = item.description; default_value = item.default_value; unit = item.unit; - availability = item.availability; + availability_expr_ = item.availability_expr_; annotation = item.annotation; read_value = item.read_value; check_value = item.check_value; @@ -48,7 +50,29 @@ class Input_Item std::string description; ///< full description (supports multi-line, lists, notes) std::string default_value; ///< default value as string std::string unit; ///< unit of measurement (empty if none) - std::string availability; ///< availability conditions (empty if always) + /// Set and validate the canonical availability expression. An empty value + /// means that the item is always available. + void set_availability(const std::string& value) + { + const AvailabilityExpr parsed = parse_availability(value); + const std::string canonical = parsed.to_string(); + if (value != canonical) + { + throw std::invalid_argument("Non-canonical availability expression '" + value + + "'; expected '" + canonical + "'"); + } + availability_expr_ = parsed; + } + + std::string get_availability() const + { + return availability_expr_.to_string(); + } + + const AvailabilityExpr& get_availability_expr() const + { + return availability_expr_; + } bool is_read() const ///< check if the input item is read { @@ -74,7 +98,10 @@ class Input_Item /// get final_value function for output INPUT file std::function get_final_value = nullptr; // ====== !!! Do not add any more functions here. ====== + + private: + AvailabilityExpr availability_expr_; ///< parsed condition tree }; } // namespace ModuleIO -#endif // INPUT_ITEM_H \ No newline at end of file +#endif // INPUT_ITEM_H diff --git a/source/source_io/module_parameter/read_inp_bse.cpp b/source/source_io/module_parameter/read_inp_bse.cpp index 172de3a18f6..e87cfafc2ed 100644 --- a/source/source_io/module_parameter/read_inp_bse.cpp +++ b/source/source_io/module_parameter/read_inp_bse.cpp @@ -156,7 +156,7 @@ void ReadInput::item_bse() "supports slice only."; item.default_value = "cube"; item.unit = ""; - item.availability = "lr_solver = plot"; + item.set_availability("lr_solver==plot"); read_sync_string(input.exciton_plot_format); item.check_value = [](const Input_Item&, const Parameter& para) { const auto lower = [](std::string value) { @@ -249,7 +249,7 @@ void ReadInput::item_bse() "exclusive cell boundaries, while grid data include both range endpoints."; item.default_value = "-1 2 -1 2"; item.unit = "primitive cells"; - item.availability = "lr_solver = plot and exciton_plot_format = slice or both"; + item.set_availability("lr_solver==plot and exciton_plot_format in [slice, both]"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.exciton_slice_range); }; diff --git a/source/source_io/module_parameter/read_inp_deepks.cpp b/source/source_io/module_parameter/read_inp_deepks.cpp index e1eac18e4b8..335523ad265 100644 --- a/source/source_io/module_parameter/read_inp_deepks.cpp +++ b/source/source_io/module_parameter/read_inp_deepks.cpp @@ -23,7 +23,7 @@ void ReadInput::item_deepks() [NOTE] When deepks_out_labels equals 1, the path of a numerical descriptor (an orb file) is needed to be specified under the NUMERICAL_DESCRIPTOR tag in the STRU file. This is not needed when deepks_out_labels equals 2.)"; item.default_value = "0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_int(input.deepks_out_labels); this->add_item(item); } @@ -35,7 +35,7 @@ void ReadInput::item_deepks() item.description = "When deepks_out_freq_elec is greater than 0, print labels and descriptors for DeePKS in OUT.${suffix}/DeePKS_Labels_Elec per deepks_out_freq_elec electronic iterations, with suffix _e* to distinguish different steps. Often used with deepks_out_labels equals 1."; item.default_value = "0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_int(input.deepks_out_freq_elec); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.deepks_out_freq_elec < 0) @@ -57,7 +57,7 @@ void ReadInput::item_deepks() item.description = "Print labels and descriptors calculated by base functional ( determined by deepks_out_base ) and target functional ( determined by dft_functional ) for DeePKS in per deepks_out_freq_elec electronic iterations. The SCF process, labels and descriptors output of the target functional are all consistent with those when the target functional is used alone. The only additional output under this configuration is the labels of the base functional. Often used with deepks_out_labels equals 1."; item.default_value = "None"; item.unit = ""; - item.availability = "Numerical atomic orbital basis and deepks_out_freq_elec is greater than 0"; + item.set_availability("basis_type==lcao and deepks_out_freq_elec>0"); read_sync_string(input.deepks_out_base); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.deepks_out_base != "none" && para.input.deepks_out_labels == 0) @@ -80,7 +80,7 @@ void ReadInput::item_deepks() "\n\n[NOTE] A trained, traced model file is needed."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.deepks_scf); item.check_value = [](const Input_Item& item, const Parameter& para) { #ifndef __MLALGO @@ -107,7 +107,7 @@ void ReadInput::item_deepks() "so this feature is currently only intended for internal usage."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.deepks_equiv); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.deepks_equiv && para.input.deepks_bandgap) @@ -125,7 +125,7 @@ void ReadInput::item_deepks() item.description = "the path of the trained, traced neural network model file generated by deepks-kit"; item.default_value = "None"; item.unit = ""; - item.availability = "Numerical atomic orbital basis and deepks_scf is true"; + item.set_availability("basis_type==lcao and deepks_scf==true"); read_sync_string(input.deepks_model); this->add_item(item); } @@ -137,7 +137,7 @@ void ReadInput::item_deepks() item.description = "the maximum angular momentum of the Bessel functions generated as the projectors in DeePKS - NOte: To generate such projectors, set calculation type to gen_bessel in ABACUS. See also calculation."; item.default_value = "2"; item.unit = ""; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_int(input.bessel_descriptor_lmax); this->add_item(item); } @@ -149,7 +149,7 @@ void ReadInput::item_deepks() item.description = "energy cutoff of Bessel functions"; item.default_value = "same as ecutwfc"; item.unit = "Ry"; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_string(input.bessel_descriptor_ecut); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.bessel_descriptor_ecut == "default") @@ -173,7 +173,7 @@ void ReadInput::item_deepks() item.description = "tolerance for searching the zeros of Bessel functions"; item.default_value = "1.0e-12"; item.unit = ""; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_double(input.bessel_descriptor_tolerence); this->add_item(item); } @@ -185,7 +185,7 @@ void ReadInput::item_deepks() item.description = "cutoff radius of Bessel functions"; item.default_value = "6.0"; item.unit = "Bohr"; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_double(input.bessel_descriptor_rcut); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.bessel_descriptor_rcut < 0) @@ -203,7 +203,7 @@ void ReadInput::item_deepks() item.description = "smooth the Bessel functions at radius cutoff"; item.default_value = "False"; item.unit = ""; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_bool(input.bessel_descriptor_smooth); this->add_item(item); } @@ -215,7 +215,7 @@ void ReadInput::item_deepks() item.description = "smooth parameter at the cutoff radius of projectors"; item.default_value = "0.1"; item.unit = "Bohr"; - item.availability = "gen_bessel calculation"; + item.set_availability("calculation==gen_bessel"); read_sync_double(input.bessel_descriptor_sigma); this->add_item(item); } @@ -231,7 +231,7 @@ void ReadInput::item_deepks() * 3: Used for systems containing H atoms. Here HOMO is defined as the max occupation except H atoms and the bandgap label is the energy between HOMO and (HOMO + 1))"; item.default_value = "0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis and deepks_scf is true"; + item.set_availability("basis_type==lcao and deepks_scf==true"); read_sync_int(input.deepks_bandgap); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.deepks_bandgap < 0 || para.input.deepks_bandgap > 3) @@ -251,7 +251,7 @@ void ReadInput::item_deepks() * deepks_bandgap is 2: Bandgap labels are energies between HOMO and all states in range [LUMO + deepks_band_range[0], LUMO + deepks_band_range[1]] (Thus there are deepks_band_range[1] - deepks_band_range[0] + 1 bandgaps in total). If HOMO is included in the setting range, it will be ignored since it will always be zero and has no valuable messages (deepks_band_range[1] - deepks_band_range[0] bandgaps in this case). NOTICE: The set range can be greater than, less than, or include the value of HOMO. In the bandgap label, we always calculate the energy of the state in the set range minus the energy of HOMO state, so the bandgap can be negative if the state is lower than HOMO.)"; item.default_value = "-1 0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis, deepks_scf is true, and deepks_bandgap is 1 or 2"; + item.set_availability("basis_type==lcao and deepks_scf==true and deepks_bandgap in [1, 2]"); item.read_value = [](const Input_Item& item, Parameter& para) { para.input.deepks_band_range[0] = std::stod(item.str_values[0]); para.input.deepks_band_range[1] = std::stod(item.str_values[1]); @@ -295,7 +295,7 @@ void ReadInput::item_deepks() * deepks_v_delta = -2: deepks_phialpha_r.npy and deepks_gevdm.npy, which can be used to calculate deepks_vdrpre.npy. A recommanded method for memory saving.)"; item.default_value = "0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_int(input.deepks_v_delta); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.deepks_v_delta < -2 || para.input.deepks_v_delta > 2) @@ -316,7 +316,6 @@ void ReadInput::item_deepks() "When set to 1, ABACUS needs to be run with only 1 process."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.deepks_out_unittest); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.deepks_out_unittest) diff --git a/source/source_io/module_parameter/read_inp_estruc.cpp b/source/source_io/module_parameter/read_inp_estruc.cpp index 147292ce37e..6204db08d88 100644 --- a/source/source_io/module_parameter/read_inp_estruc.cpp +++ b/source/source_io/module_parameter/read_inp_estruc.cpp @@ -21,7 +21,6 @@ void ReadInput::item_elec_stru() * lcao_in_pw: Expand the localized atomic set in plane-wave basis, non-self-consistent field calculation not tested.)"; item.default_value = "pw"; item.unit = ""; - item.availability = ""; read_sync_string(input.basis_type); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.towannier90) @@ -79,7 +78,6 @@ Then the user has to correct the input file and restart the calculation.)"; - scalapack_gvx (if compiling option `ENABLE_ELPA` has not been set and compiling option `ENABLE_MPI` has been set) - cusolver (if compiling option `USE_CUDA` has been set))"; item.unit = ""; - item.availability = ""; read_sync_string(input.ks_solver); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.ks_solver == "default") @@ -246,7 +244,6 @@ Then the user has to correct the input file and restart the calculation.)"; item.description = "The number of Kohn-Sham orbitals to calculate. It is recommended to setup this value, especially when smearing techniques are utilized, more bands should be included."; item.default_value = ""; item.unit = ""; - item.availability = ""; read_sync_int(input.nbands); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nbands < 0) @@ -265,7 +262,6 @@ Then the user has to correct the input file and restart the calculation.)"; * >0.0: this denotes the total number of electrons in the system. Must be less than 2*nbands.)"; item.default_value = "0.0"; item.unit = ""; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nelec < 0) { @@ -287,7 +283,6 @@ Then the user has to correct the input file and restart the calculation.)"; item.description = "The total number of electrons will be calculated by nelec+nelec_delta."; item.default_value = "0.0"; item.unit = ""; - item.availability = ""; read_sync_double(input.nelec_delta); this->add_item(item); } @@ -301,7 +296,6 @@ Then the user has to correct the input file and restart the calculation.)"; * >0.0: The different number of electrons between spin-up and spin-down channels. The range of value must be in [-nelec ~ nelec]. It is one type of constrainted DFT method, two Fermi energies will be calculated.)"; item.default_value = "0.0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.nupdown = doublevalue; para.sys.two_fermi = (doublevalue != 0.0); @@ -343,7 +337,6 @@ Then the user has to correct the input file and restart the calculation.)"; The other way is only available when compiling with LIBXC, and it allows for supplying exchange-correlation functionals as combinations of LIBXC keywords for functional components, joined by a plus sign, for example, dft_functional='LDA_X_1D_EXPONENTIAL+LDA_C_1D_CSC'.)"; item.default_value = "Used the same as DFT functional as specified in the pseudopotential files."; item.unit = ""; - item.availability = ""; read_sync_string(input.dft_functional); this->add_item(item); } @@ -355,7 +348,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup item.description = "Specifies temperature when using temperature-dependent XC functionals (KSDT and so on)."; item.default_value = "0.0"; item.unit = "Ry"; - item.availability = ""; read_sync_double(input.xc_temperature); this->add_item(item); } @@ -370,7 +362,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup "Presently this feature can only support parameterization on one exchange functional."; item.default_value = ""; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.xc_exch_ext.resize(item.get_size()); std::transform(item.str_values.begin(), item.str_values.end(), @@ -418,7 +409,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup "Presently this feature can only support parameterization on one correlation functional."; item.default_value = ""; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.xc_corr_ext.resize(item.get_size()); std::transform(item.str_values.begin(), item.str_values.end(), @@ -463,7 +453,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup item.description = "Cut-off of radial integration for pseudopotentials."; item.default_value = "15"; item.unit = "Bohr"; - item.availability = ""; read_sync_double(input.pseudo_rcut); this->add_item(item); } @@ -477,7 +466,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup * 1: Use the mesh that is consistent with quantum espresso)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pseudo_mesh); this->add_item(item); } @@ -492,7 +480,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup * 4: Noncollinear or spin-orbit calculations. Set nspin to 4 explicitly when noncolin or lspinorb is enabled.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.nspin); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nspin != 1 && para.input.nspin != 2 && para.input.nspin != 4) @@ -520,7 +507,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup * fd: Fermi-Dirac smearing method: and smearing_sigma below is the temperature (in Ry).)"; item.default_value = "gauss"; item.unit = ""; - item.availability = ""; read_sync_string(input.smearing_method); item.check_value = [](const Input_Item& item, const Parameter& para) { const std::vector methods = {"gauss", "gaussian", @@ -544,7 +530,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup item.description = "Energy range for smearing."; item.default_value = "0.015"; item.unit = "Ry"; - item.availability = ""; read_sync_double(input.smearing_sigma); this->add_item(item); } @@ -558,7 +543,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup item.description = "Energy range for smearing, smearing_sigma = 1/2 kB smearing_sigma_temp."; item.default_value = "2 * smearing_sigma / kB."; item.unit = "K"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.smearing_sigma = 3.166815e-6 * doublevalue; }; // only to set smearing_sigma, so no need to write to output INPUT file @@ -578,7 +562,6 @@ The other way is only available when compiling with LIBXC, and it allows for sup In general, the convergence of the Broyden method is slightly faster than that of the Pulay method.)"; item.default_value = "broyden"; item.unit = ""; - item.availability = ""; read_sync_string(input.mixing_mode); this->add_item(item); } @@ -599,7 +582,6 @@ Note: For low-dimensional large systems, the setup of mixing_beta=0.1, mixing_nd For spin-polarized calculations (nspin=2 or nspin=4) that are difficult to converge, try reducing both mixing_beta and mixing_beta_mag simultaneously, e.g., mixing_beta=0.1 and mixing_beta_mag=0.1 or lower.)"; item.default_value = "0.8 for nspin=1, 0.4 for nspin=2 and nspin=4."; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_beta); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mixing_beta < 0.0) @@ -635,7 +617,6 @@ If SCF convergence is difficult with spin polarization (nspin=2 or nspin=4), try item.default_value = "4*mixing_beta, but the maximum value is 1.6."; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_beta_mag); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mixing_beta_mag < 0.0) @@ -665,7 +646,6 @@ If SCF convergence is difficult with spin polarization (nspin=2 or nspin=4), try For systems that are difficult to converge, one could try increasing the value of 'mixing_ndim' to enhance the stability of the self-consistent field (SCF) calculation.)"; item.default_value = "8"; item.unit = ""; - item.availability = ""; read_sync_int(input.mixing_ndim); this->add_item(item); } @@ -677,7 +657,6 @@ For systems that are difficult to converge, one could try increasing the value o item.description = "If the density difference between input and output drho is smaller than mixing_restart, SCF will restart at next step which means SCF will restart by using output charge density from perivos iteration as input charge density directly, and start a new mixing. Notice that mixing_restart will only take effect once in one SCF."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_restart); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.sc_mag_switch == 1) @@ -702,7 +681,7 @@ For systems that are difficult to converge, one could try increasing the value o item.description = "At n-th iteration which is calculated by drho=0"); read_sync_bool(input.mixing_dmr); this->add_item(item); } @@ -718,7 +697,6 @@ For systems that are difficult to converge, one could try increasing the value o For systems that are difficult to converge, particularly metallic systems, enabling Kerker scaling may aid in achieving convergence.)"; item.default_value = "1.0"; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_gg0); this->add_item(item); } @@ -732,7 +710,6 @@ For systems that are difficult to converge, particularly metallic systems, enabl The magnetic-density Kerker preconditioner is bypassed when mixing_beta_mag <= 0.1, so mixing_gg0_mag has no effect in that regime. It is also unavailable when the charge-density Kerker preconditioner itself is bypassed.)"; item.default_value = "0.0"; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_gg0_mag); this->add_item(item); } @@ -746,7 +723,6 @@ The magnetic-density Kerker preconditioner is bypassed when mixing_beta_mag <= 0 In the current implementation, the automatic bypass thresholds are fixed independently of mixing_gg0_min: charge-density Kerker is bypassed when mixing_beta <= 0.1, and magnetic-density Kerker is bypassed when mixing_beta_mag <= 0.1. Changing mixing_gg0_min does not change these thresholds or re-enable Kerker.)"; item.default_value = "0.1"; item.unit = ""; - item.availability = ""; read_sync_double(input.mixing_gg0_min); this->add_item(item); } @@ -760,7 +736,7 @@ In the current implementation, the automatic bypass thresholds are fixed indepen * >0: Angle mixing for the modulus with mixing_angle=1.0)"; item.default_value = "-10.0"; item.unit = ""; - item.availability = "Only relevant for non-colinear calculations nspin=4."; + item.set_availability("nspin==4"); read_sync_double(input.mixing_angle); this->add_item(item); } @@ -771,10 +747,11 @@ In the current implementation, the automatic bypass thresholds are fixed indepen item.type = "Boolean"; item.description = R"(Whether to mix the kinetic energy density. * True: The kinetic energy density will also be mixed. It seems for general cases, SCF converges fine even without this mixing. However, if there is difficulty in converging SCF for meta-GGA, it might be helpful to turn this on. -* False: The kinetic energy density will not be mixed.)"; +* False: The kinetic energy density will not be mixed. + +This setting takes effect only when the selected exchange-correlation functional uses the kinetic energy density, such as a meta-GGA or hybrid meta-GGA functional.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Only relevant for meta-GGA calculations."; read_sync_bool(input.mixing_tau); this->add_item(item); } @@ -788,7 +765,7 @@ In the current implementation, the automatic bypass thresholds are fixed indepen * False: The occupation matrices will not be mixed.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Only relevant for DFT+U calculations."; + item.set_availability("dft_plus_u==1"); read_sync_bool(input.mixing_dftu); this->add_item(item); } @@ -805,7 +782,7 @@ In the current implementation, the automatic bypass thresholds are fixed indepen Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure to turn off gamma_only for multi-k calculations.)"; item.default_value = "0"; item.unit = ""; - item.availability = "Only used in localized orbitals set"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.gamma_only); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.basis_type == "pw" && para.input.gamma_only) @@ -841,7 +818,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "This variable indicates the maximal iteration number for electronic iterations."; item.default_value = "100"; item.unit = ""; - item.availability = ""; read_sync_int(input.scf_nmax); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.calculation == "nscf") @@ -859,7 +835,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "It's the density threshold for electronic iteration. It represents the charge density error between two sequential densities from electronic iterations. Usually for local orbitals, usually 1e-6 may be accurate enough."; item.default_value = "1.0e-9 (plane-wave basis), or 1.0e-7 (localized atomic orbital basis)."; item.unit = "Ry if scf_thr_type=1, dimensionless if scf_thr_type=2"; - item.availability = ""; read_sync_double(input.scf_thr); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.scf_thr == -1.0) @@ -893,7 +868,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "It's the energy threshold for electronic iteration. It represents the total energy error between two sequential densities from electronic iterations."; item.default_value = "-1.0. If the user does not set this parameter, it will not take effect."; item.unit = "eV"; - item.availability = ""; read_sync_double(input.scf_ene_thr); this->add_item(item); } @@ -908,7 +882,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure * 2: the criterion is defined in real space, where is the number of electron, which is used in SCF of LCAO with unit dimensionless.)"; item.default_value = "1 (plane-wave basis), or 2 (localized atomic orbital basis)."; item.unit = ""; - item.availability = ""; read_sync_int(input.scf_thr_type); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.scf_thr_type == -1) @@ -936,7 +909,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure * 1: If the calculated slope is larger than scf_os_thr, stop the SCF.)"; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.scf_os_stop); this->add_item(item); } @@ -948,7 +920,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "The slope threshold to determine if the SCF is stuck in a charge density oscillation. If the calculated slope is larger than scf_os_thr, stop the SCF."; item.default_value = "-0.01"; item.unit = ""; - item.availability = ""; read_sync_double(input.scf_os_thr); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.scf_os_thr >= 0) @@ -966,7 +937,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "To determine the number of old iterations' drho used in slope calculations."; item.default_value = "mixing_ndim"; item.unit = ""; - item.availability = ""; read_sync_int(input.scf_os_ndim); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.scf_os_ndim <= 0) // default value @@ -984,7 +954,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure item.description = "To determine the number of old iterations to judge oscillation, it occured, more accurate lambda with DeltaSpin method would be calculated, only for PW base."; item.default_value = "5"; item.unit = ""; - item.availability = ""; read_sync_int(input.sc_os_ndim); this->add_item(item); } @@ -1002,7 +971,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure * Common Error: "no soc upf used for lspinorb calculation" - ensure you are using full-relativistic pseudopotentials)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.lspinorb); this->add_item(item); } @@ -1025,7 +993,6 @@ Note: If gamma_only is set to 1, the KPT file will be overwritten. So make sure * noncolin=1, lspinorb=1: Both non-collinear magnetism and SOC)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.noncolin); this->add_item(item); } @@ -1044,7 +1011,7 @@ soc_lambda, which has value range [0.0, 1.0], is used to modulate SOC effect: Use case: When experimental or high-level theoretical results suggest that the SOC effect is weaker or stronger than what full-relativistic pseudopotentials predict, you can adjust this parameter to match the target behavior.)"; item.default_value = "1.0"; item.unit = ""; - item.availability = "Only works when lspinorb=true"; + item.set_availability("lspinorb==true"); read_sync_double(input.soc_lambda); this->add_item(item); } @@ -1056,7 +1023,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "DFT-1/2 type:\n* 0: DFT-1/2 is off.\n* 1: Shell DFT-1/2 method is used."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.dfthalf_type); this->add_item(item); } @@ -1068,7 +1034,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Only used when you use ks_solver = cg/dav/dav_subspace/bpcg. It indicates the threshold for the first electronic iteration, from the second iteration the pw_diag_thr will be updated automatically. For nscf calculations with planewave basis set, pw_diag_thr should be <= 1e-3."; item.default_value = "0.01"; item.unit = ""; - item.availability = ""; read_sync_double(input.pw_diag_thr); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.calculation == "get_s" && para.input.basis_type == "pw") @@ -1089,7 +1054,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "If TRUE, the smooth threshold strategy, which applies a larger threshold (10e-5) for the empty states, will be implemented in the diagonalization methods. (This strategy should not affect total energy, forces, and other ground-state properties, but computational efficiency will be improved.) If FALSE, the smooth threshold strategy will not be applied."; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.diago_smooth_ethr); this->add_item(item); } @@ -1101,7 +1065,7 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "If TRUE, the wavefunctions at k-point will be initialized from the converged wavefunctions at the nearest k-point, which can speed up the SCF convergence. Only works for PW basis."; item.default_value = "false"; item.unit = ""; - item.availability = "Used only for plane wave basis set."; + item.set_availability("basis_type==pw"); read_sync_bool(input.use_k_continuity); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.use_k_continuity && para.input.basis_type != "pw") { @@ -1130,7 +1094,7 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Only useful when you use ks_solver = cg/dav/dav_subspace/bpcg. It indicates the maximal iteration number for cg/david/dav_subspace/bpcg method."; item.default_value = "50"; item.unit = ""; - item.availability = "basis_type==pw, ks_solver==cg/dav/dav_subspace/bpcg"; + item.set_availability("basis_type==pw and ks_solver in [cg, dav, dav_subspace, bpcg]"); read_sync_int(input.pw_diag_nmax); this->add_item(item); } @@ -1142,7 +1106,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Only useful when you use ks_solver = dav or ks_solver = dav_subspace. It indicates dimension of workspace(number of wavefunction packets, at least 2 needed) for the Davidson method. A larger value may yield a smaller number of iterations in the algorithm but uses more memory and more CPU time in subspace diagonalization."; item.default_value = "4"; item.unit = ""; - item.availability = ""; read_sync_int(input.pw_diag_ndim); this->add_item(item); } @@ -1154,7 +1117,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Preconditioner type for conjugate gradient diagonalization method."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.diago_cg_prec); this->add_item(item); } @@ -1168,7 +1130,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "In LCAO calculations, the Hamiltonian and overlap matrices are distributed across 2D processor grid. This parameter controls the 2D block size for distribution."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.nb2d); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nb2d < 0) @@ -1186,7 +1147,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "If not equals to 2, then the maximum l channels on LCAO is set to lmaxmax. If 2, then the number of l channels will be read from the LCAO data sets. Normally no input should be supplied for this variable so that it is kept as its default."; item.default_value = "2."; item.unit = ""; - item.availability = ""; read_sync_int(input.lmaxmax); this->add_item(item); } @@ -1198,7 +1158,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Energy cutoff (in Ry) for two-center integrals in LCAO. The two-center integration table are obtained via a k space integral whose upper limit is about sqrt(lcao_ecut)."; item.default_value = "ecutwfc"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.lcao_ecut == 0 && para.input.basis_type == "lcao") { @@ -1217,7 +1176,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "the interval of k points for two-center integrals. The two-center integration table are obtained via a k space integral on a uniform grid with spacing lcao_dk."; item.default_value = "0.01"; item.unit = "Bohr"; - item.availability = ""; read_sync_double(input.lcao_dk); this->add_item(item); } @@ -1229,7 +1187,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "r spacing of the integration table of two-center integrals."; item.default_value = "0.01"; item.unit = "Bohr"; - item.availability = ""; read_sync_double(input.lcao_dr); this->add_item(item); } @@ -1241,7 +1198,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Maximum distance for the two-center integration table."; item.default_value = "30"; item.unit = "Bohr"; - item.availability = ""; read_sync_double(input.lcao_rmax); this->add_item(item); } @@ -1253,7 +1209,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Searching radius in finding the neighbouring atoms. By default the radius will be automatically determined by the cutoffs of orbitals and nonlocal beta projectors."; item.default_value = "-1"; item.unit = "Bohr"; - item.availability = ""; read_sync_double(input.search_radius); this->add_item(item); } @@ -1265,7 +1220,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "In the matrix operation of grid integral, bx/by/bz grids (in x, y, z directions) are treated as a whole as a matrix element. A different value will affect the calculation speed. The default is 0, which means abacus will automatically calculate these values."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.bx); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.bx > 10) @@ -1292,7 +1246,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "In the matrix operation of grid integral, bx/by/bz grids (in x, y, z directions) are treated as a whole as a matrix element. A different value will affect the calculation speed. The default is 0, which means abacus will automatically calculate these values."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.by); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.by > 10) @@ -1310,7 +1263,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "In the matrix operation of grid integral, bx/by/bz grids (in x, y, z directions) are treated as a whole as a matrix element. A different value will affect the calculation speed. The default is 0, which means abacus will automatically calculate these values."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.bz); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.bz > 10) @@ -1328,7 +1280,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Number of threads used in one elpa calculation.\n\nIf the number is below 0 or 0 or beyond the max number of threads, all elpa calculation will be using all mpi threads"; item.default_value = "-1"; item.unit = ""; - item.availability = ""; read_sync_int(input.elpa_num_thread); this->add_item(item); } @@ -1340,7 +1291,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "The number of CUDA streams used in LCAO calculations with GPU acceleration."; item.default_value = "4"; item.unit = ""; - item.availability = ""; read_sync_int(input.nstream); this->add_item(item); } @@ -1352,7 +1302,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "\"Energy cutoff\" (in Ry) of spherical Bessel functions. The number of spherical Bessel functions that constitute the radial parts of NAOs is determined by sqrt(bessel_nao_ecut)*bessel_nao_rcut/."; item.default_value = "ecutwfc"; item.unit = ""; - item.availability = ""; read_sync_string(input.bessel_nao_ecut); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.bessel_nao_ecut == "default") @@ -1376,7 +1325,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Tolerance when searching for the zeros of spherical Bessel functions."; item.default_value = "1.0e-12"; item.unit = ""; - item.availability = ""; read_sync_double(input.bessel_nao_tolerence); this->add_item(item); } @@ -1388,7 +1336,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Cutoff radius (in Bohr) and the common node of spherical Bessel functions used to construct the NAOs."; item.default_value = "6.0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -1416,7 +1363,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "If True, NAOs will be smoothed near the cutoff radius. See bessel_nao_rcut and bessel_nao_sigma for parameters."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.bessel_nao_smooth); this->add_item(item); } @@ -1428,7 +1374,6 @@ Use case: When experimental or high-level theoretical results suggest that the S item.description = "Smoothing range (in Bohr). See also bessel_nao_smooth."; item.default_value = "0.1"; item.unit = ""; - item.availability = ""; read_sync_double(input.bessel_nao_sigma); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_inp_exx_dftu.cpp b/source/source_io/module_parameter/read_inp_exx_dftu.cpp index e4e2d4f4ec5..ad43f1b966c 100644 --- a/source/source_io/module_parameter/read_inp_exx_dftu.cpp +++ b/source/source_io/module_parameter/read_inp_exx_dftu.cpp @@ -18,7 +18,6 @@ void ReadInput::item_exx() item.description = R"(Fraction of full-ranged Fock exchange $1/r$ in range-separated hybrid functionals.)"; item.default_value = "see hybrid_func_params"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.exx_fock_alpha = item.str_values; @@ -67,7 +66,6 @@ void ReadInput::item_exx() item.description = R"(Fraction of short-ranged Fock exchange $\mathrm{erfc}(\omega r)/r$ in range-separated hybrid functionals.)"; item.default_value = "see hybrid_func_params"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.exx_erfc_alpha = item.str_values; @@ -117,7 +115,6 @@ void ReadInput::item_exx() item.description = R"(Range-separation parameter $\omega$ in the short-ranged Fock term $\mathrm{erfc}(\omega r)/r$.)"; item.default_value = "see hybrid_func_params"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.exx_erfc_omega = item.str_values; @@ -173,7 +170,6 @@ void ReadInput::item_exx() * True: A two-step method is employed, i.e. in the inner iterations, density matrix is updated, while in the outer iterations, is calculated based on density matrix that converges in the inner iteration.)"; item.default_value = "True"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.esolver_type == "tddft" && para.input.exx_separate_loop) { @@ -193,7 +189,7 @@ void ReadInput::item_exx() item.description = "The maximal iteration number of the outer-loop, where the Fock exchange is calculated"; item.default_value = "100"; item.unit = ""; - item.availability = "exx_separate_loop==1"; + item.set_availability("exx_separate_loop==1"); read_sync_int(input.exx_hybrid_step); item.check_value = [](const Input_Item& item, const Parameter& para) { @@ -212,7 +208,7 @@ void ReadInput::item_exx() item.description = "Mixing parameter for densty matrix in each iteration of the outer-loop"; item.default_value = "1.0"; item.unit = ""; - item.availability = "exx_separate_loop==1"; + item.set_availability("exx_separate_loop==1"); read_sync_double(input.exx_mixing_beta); this->add_item(item); } @@ -226,7 +222,7 @@ void ReadInput::item_exx() item.description = "It is used to compensate for divergence points at G=0 in the evaluation of Fock exchange using lcao_in_pw method."; item.default_value = "0.3"; item.unit = ""; - item.availability = "basis_type==lcao_in_pw"; + item.set_availability("basis_type==lcao_in_pw"); item.read_value = [](const Input_Item& item, Parameter& para) { para.input.exx_fock_lambda = item.str_values; @@ -249,7 +245,6 @@ void ReadInput::item_exx() item.description = "To accelerate the evaluation of four-center integrals (), the product of atomic orbitals are expanded in the basis of auxiliary basis functions (ABF): . The size of the ABF (i.e. number of ) is reduced using principal component analysis. When a large PCA threshold is used, the number of ABF will be reduced, hence the calculation becomes faster. However, this comes at the cost of computational accuracy. A relatively safe choice of the value is 1e-4."; item.default_value = "1E-4"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_pca_threshold); this->add_item(item); } @@ -261,7 +256,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. Smaller components (less than exx_c_threshold) of the matrix are neglected to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 1e-4."; item.default_value = "1E-4"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_c_threshold); this->add_item(item); } @@ -273,7 +267,6 @@ void ReadInput::item_exx() item.description = "By default, the Coulomb matrix inversion required for obtaining LRI coefficients is performed using LU decomposition. However, this approach may suffer from numerical instabilities when a large set of auxiliary basis functions (ABFs) is employed. When exx_cs_inv_thr > 0, the inversion is instead carried out via matrix diagonalization. Eigenvalues smaller than exx_cs_inv_thr are discarded to improve numerical stability. A relatively safe and commonly recommended value is 1e-5."; item.default_value = "-1"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_cs_inv_thr); this->add_item(item); } @@ -285,7 +278,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. With the approximation , the four-center integral in Fock exchange is expressed as , where is a double-center integral. Smaller values of the V matrix can be truncated to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 0, i.e. no truncation."; item.default_value = "1E-1"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_v_threshold); this->add_item(item); } @@ -297,7 +289,6 @@ void ReadInput::item_exx() item.description = "The Fock exchange can be expressed as where D is the density matrix. Smaller values of the density matrix can be truncated to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 1e-4."; item.default_value = "1E-4"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_dm_threshold); this->add_item(item); } @@ -309,7 +300,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. is used in force. Smaller components (less than exx_c_grad_threshold) of the matrix are neglected to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 1e-4."; item.default_value = "1E-4"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_c_grad_threshold); this->add_item(item); } @@ -321,7 +311,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. With the approximation , the four-center integral in Fock exchange is expressed as , where is a double-center integral. is used in force. Smaller values of the V matrix can be truncated to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 0, i.e. no truncation."; item.default_value = "1E-1"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_v_grad_threshold); this->add_item(item); } @@ -333,7 +322,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. is used in stress. Smaller components (less than exx_c_grad_r_threshold) of the matrix are neglected to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 1e-4."; item.default_value = "1E-4"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_c_grad_r_threshold); this->add_item(item); } @@ -345,7 +333,6 @@ void ReadInput::item_exx() item.description = "See also the entry exx_pca_threshold. With the approximation , the four-center integral in Fock exchange is expressed as , where is a double-center integral. is used in force and stress. Smaller values of the V matrix can be truncated to accelerate calculation. The larger the threshold is, the faster the calculation and the lower the accuracy. A relatively safe choice of the value is 0, i.e. no truncation."; item.default_value = "1E-1"; item.unit = ""; - item.availability = ""; read_sync_double(input.exx_v_grad_r_threshold); this->add_item(item); } @@ -359,7 +346,6 @@ void ReadInput::item_exx() item.description = "This parameter determines how many times larger the radial mesh required for calculating Columb potential is to that of atomic orbitals. The value should be larger than 0. Reducing this value can effectively increase the speed of self-consistent calculations using hybrid functionals."; item.default_value = ""; item.unit = ""; - item.availability = ""; read_sync_string(input.exx_ccp_rmesh_times); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.exx_ccp_rmesh_times == "default") @@ -411,7 +397,7 @@ void ReadInput::item_exx() item.description = "The maximum l of the spherical Bessel functions, when the radial part of opt-ABFs are generated as linear combinations of spherical Bessel functions. A reasonable choice is 2."; item.default_value = "0"; item.unit = ""; - item.availability = "calculation==gen_opt_abfs"; + item.set_availability("calculation==gen_opt_abfs"); read_sync_int(input.exx_opt_orb_lmax); this->add_item(item); } @@ -423,7 +409,7 @@ void ReadInput::item_exx() item.description = "The cut-off of plane wave expansion, when the plane wave basis is used to optimize the radial ABFs. A reasonable choice is 60."; item.default_value = "0"; item.unit = "Ry"; - item.availability = "calculation==gen_opt_abfs"; + item.set_availability("calculation==gen_opt_abfs"); read_sync_double(input.exx_opt_orb_ecut); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.exx_opt_orb_ecut < 0) @@ -442,7 +428,7 @@ void ReadInput::item_exx() item.description = "The threshold when solving for the zeros of spherical Bessel functions. A reasonable choice is 1e-12."; item.default_value = "1E-12"; item.unit = ""; - item.availability = "calculation==gen_opt_abfs"; + item.set_availability("calculation==gen_opt_abfs"); read_sync_double(input.exx_opt_orb_tolerence); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.exx_opt_orb_tolerence < 0) @@ -461,7 +447,6 @@ void ReadInput::item_exx() * False: Enforce LibRI to use complex data type. Setting it to True can effectively improve the speed of self-consistent calculations with hybrid functionals.)"; item.default_value = "depends on the gamma_only option"; item.unit = ""; - item.availability = ""; read_sync_string(input.exx_real_number); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.exx_real_number == "default") @@ -487,7 +472,6 @@ void ReadInput::item_exx() * revised_spencer: see Phys. Rev. Mater. 5, 013807 (2021). Set the scheme of Coulomb singularity correction.)"; item.default_value = "default"; item.unit = ""; - item.availability = ""; read_sync_string(input.exx_singularity_correction); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.exx_singularity_correction == "default") @@ -526,7 +510,6 @@ void ReadInput::item_exx() item.description = "How many times larger the radial mesh required is to that of atomic orbitals in the postprocess calculation of the bare Coulomb matrix for RPA, GW, etc."; item.default_value = "10"; item.unit = ""; - item.availability = ""; read_sync_double(input.rpa_ccp_rmesh_times); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.rpa_ccp_rmesh_times < 1) @@ -545,7 +528,7 @@ void ReadInput::item_exx() * True: rotate both D(k) and Hexx(R) to accelerate both diagonalization and EXX calculation)"; item.default_value = "True"; item.unit = ""; - item.availability = "symmetry==1 and exx calculation (dft_fuctional==hse/hf/pbe0/scan0 or rpa==True)"; + item.set_availability("symmetry==1 and (dft_functional in [hse, hf, pbe0, scan0] or (basis_type==lcao and rpa==true))"); read_sync_bool(input.exx_symmetry_realspace); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.symmetry != "1") { para.input.exx_symmetry_realspace = false; } @@ -560,7 +543,6 @@ void ReadInput::item_exx() item.description = "Whether to output the coefficient tensor C(R) and ABFs-representation Coulomb matrix V(R) for each atom pair and cell in real space."; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_ri_cv); this->add_item(item); } @@ -618,7 +600,6 @@ void ReadInput::item_dftu() * 0: Do not calculate plus U correction.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.dft_plus_u); item.reset_value = [](const Input_Item& item, Parameter& para) { bool all_minus1 = true; @@ -659,7 +640,7 @@ void ReadInput::item_dftu() item.description = "Whether to enable DFT+DMFT calculation. True: DFT+DMFT; False: standard DFT calculation."; item.default_value = "False"; item.unit = ""; - item.availability = "basis_type==lcao"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.dft_plus_dmft); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.basis_type != "lcao" && para.input.dft_plus_dmft) @@ -682,7 +663,6 @@ void ReadInput::item_dftu() * 3: For f-electron orbits, the plus U correction is needed.)"; item.default_value = "-1"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -723,7 +703,6 @@ void ReadInput::item_dftu() [NOTE] Note: Since only the simplified scheme by Duradev is implemented, the 'U' here is actually U-effective, which is given by Hubbard U minus Hund J.)"; item.default_value = "0.0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -765,7 +744,6 @@ void ReadInput::item_dftu() * False: hubbard_u does need to be specified.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (!item.is_read()) { return; } if (para.inp.yukawa_potential && para.globalv.uramping > 0.01) @@ -787,7 +765,7 @@ void ReadInput::item_dftu() item.description = "The screen length of Yukawa potential. If left to default, the screen length will be calculated as an average of the entire system. It's better to stick to the default setting unless there is a very good reason."; item.default_value = "Calculated on the fly."; item.unit = ""; - item.availability = "DFT+U with yukawa_potential = True."; + item.set_availability("dft_plus_u==1 and yukawa_potential==true"); read_sync_double(input.yukawa_lambda); this->add_item(item); } @@ -799,7 +777,7 @@ void ReadInput::item_dftu() item.description = "Once uramping > 0.15 eV. DFT+U calculations will start SCF with U = 0 eV, namely normal LDA/PBE calculations. Once SCF restarts when drho0"); item.read_value = [](const Input_Item& item, Parameter& para) { para.input.uramping_eV = doublevalue; para.sys.uramping = para.input.uramping_eV / ModuleBase::Ry_to_eV; @@ -840,7 +818,6 @@ void ReadInput::item_dftu() [NOTE] The easiest way to create dm_onsite_ini.txt is to run a DFT+U calculation with out_chg=1, look for a file named dm_onsite.txt in the OUT.prefix directory, copy and rename it to dm_onsite_ini.txt. The file dm_onsite_ini.txt should be placed in the directory specified by read_file_dir. The format of the file is rather straight-forward.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.omc); this->add_item(item); } @@ -853,7 +830,7 @@ void ReadInput::item_dftu() * The modulation algorithm applies a smooth truncation to the orbital tail followed by normalization. A representative profile is $f(r)=\frac{1}{2}\left[1+\operatorname{erf}\!\left(\frac{r_c-r}{\sigma}\right)\right]$, where $r_c$ is the cutoff radius and $\sigma=\gamma r_c$ controls smoothness.)"; item.default_value = "3.0"; item.unit = "Bohr"; - item.availability = "dft_plus_u is set to 1"; + item.set_availability("dft_plus_u==1"); read_sync_double(input.onsite_radius); item.reset_value = [](const Input_Item& item, Parameter& para) { if ((para.input.dft_plus_u == 1 || para.input.sc_mag_switch) && para.input.onsite_radius == 0.0) diff --git a/source/source_io/module_parameter/read_inp_model.cpp b/source/source_io/module_parameter/read_inp_model.cpp index 2b29a9b5ec7..a0db9a9f4cb 100644 --- a/source/source_io/module_parameter/read_inp_model.cpp +++ b/source/source_io/module_parameter/read_inp_model.cpp @@ -20,7 +20,6 @@ void ReadInput::item_model() * False: Not added the electric field.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.efield_flag); this->add_item(item); } @@ -36,7 +35,7 @@ void ReadInput::item_model() [NOTE] Note: If you do not want any electric field, the parameter efield_amp should be set to zero. This should ONLY be used in a slab geometry for surface calculations, with the discontinuity FALLING IN THE EMPTY SPACE.)"; item.default_value = "False"; item.unit = ""; - item.availability = "With dip_cor_flag = True and efield_flag = True."; + item.set_availability("efield_flag==true"); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.dip_cor_flag && !para.input.efield_flag) { @@ -57,7 +56,7 @@ void ReadInput::item_model() * 2: parallel to the third reciprocal lattice vector)"; item.default_value = "2"; item.unit = ""; - item.availability = "with efield_flag = True."; + item.set_availability("efield_flag==true"); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.gate_flag && para.input.efield_flag && !para.input.dip_cor_flag) { @@ -78,7 +77,7 @@ void ReadInput::item_model() item.description = "Position of the maximum of the saw-like potential along crystal axis efield_dir, within the unit cell, 0 <= efield_pos_max < 1."; item.default_value = "Autoset to center of vacuum - width of vacuum / 20"; item.unit = ""; - item.availability = "with efield_flag = True."; + item.set_availability("efield_flag==true"); read_sync_double(input.efield_pos_max); this->add_item(item); } @@ -90,7 +89,7 @@ void ReadInput::item_model() item.description = "Zone in the unit cell where the saw-like potential decreases, 0 < efield_pos_dec < 1."; item.default_value = "Autoset to width of vacuum / 10"; item.unit = ""; - item.availability = "with efield_flag = True."; + item.set_availability("efield_flag==true"); read_sync_double(input.efield_pos_dec); this->add_item(item); } @@ -104,7 +103,7 @@ void ReadInput::item_model() [NOTE] Note: The change of slope of this potential must be located in the empty region, or else unphysical forces will result.)"; item.default_value = "0.0"; item.unit = "a.u., 1 a.u. = 51.4220632*10^10 V/m."; - item.availability = "with efield_flag = True."; + item.set_availability("efield_flag==true"); read_sync_double(input.efield_amp); this->add_item(item); } @@ -120,7 +119,6 @@ void ReadInput::item_model() * false: No compensating charge is added.)"; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.gate_flag); this->add_item(item); } @@ -132,7 +130,6 @@ void ReadInput::item_model() item.description = "Position of the charged plate in the unit cell"; item.default_value = "0.5"; item.unit = "Unit cell size"; - item.availability = ""; read_sync_double(input.zgate); this->add_item(item); } @@ -147,7 +144,6 @@ void ReadInput::item_model() * false: No potential barrier is added.)"; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.block); this->add_item(item); } @@ -159,7 +155,6 @@ void ReadInput::item_model() item.description = "Lower beginning of the potential barrier"; item.default_value = "0.45"; item.unit = "Unit cell size"; - item.availability = ""; read_sync_double(input.block_down); this->add_item(item); } @@ -171,7 +166,6 @@ void ReadInput::item_model() item.description = "Upper beginning of the potential barrier"; item.default_value = "0.55"; item.unit = "Unit cell size"; - item.availability = ""; read_sync_double(input.block_up); this->add_item(item); } @@ -183,7 +177,6 @@ void ReadInput::item_model() item.description = "Height of the potential barrier"; item.default_value = "0.1"; item.unit = "Rydberg"; - item.availability = ""; read_sync_double(input.block_height); this->add_item(item); } @@ -197,7 +190,6 @@ void ReadInput::item_model() item.description = "Calculate implicit solvation correction"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.imp_sol); this->add_item(item); } @@ -209,7 +201,7 @@ void ReadInput::item_model() item.description = "The relative permittivity of the bulk solvent, 80 for water"; item.default_value = "80"; item.unit = ""; - item.availability = "imp_sol is true."; + item.set_availability("imp_sol==true"); read_sync_double(input.eb_k); this->add_item(item); } @@ -221,7 +213,6 @@ void ReadInput::item_model() item.description = "The effective surface tension parameter that describes the cavitation, the dispersion, and the repulsion interaction between the solute and the solvent which are not captured by the electrostatic terms"; item.default_value = "1.0798e-05"; item.unit = ""; - item.availability = ""; read_sync_double(input.tau); this->add_item(item); } @@ -233,7 +224,6 @@ void ReadInput::item_model() item.description = "The width of the diffuse cavity that is implicitly determined by the electronic structure of the solute"; item.default_value = "0.6"; item.unit = ""; - item.availability = ""; read_sync_double(input.sigma_k); this->add_item(item); } @@ -245,7 +235,6 @@ void ReadInput::item_model() item.description = "The value of the electron density at which the dielectric cavity forms"; item.default_value = "0.00037"; item.unit = ""; - item.availability = ""; read_sync_double(input.nc_k); this->add_item(item); } @@ -266,7 +255,6 @@ void ReadInput::item_model() [NOTE] ABACUS supports automatic setting of DFT-D3 parameters for common functionals. To benefit from this feature, please specify the parameter dft_functional explicitly, otherwise the autoset procedure will crash. If not satisfied with the built-in parameters, any manual setting on vdw_s6, vdw_s8, vdw_a1 and vdw_a2 will overwrite the automatic values.)"; item.default_value = "none"; item.unit = ""; - item.availability = ""; read_sync_string(input.vdw_method); this->add_item(item); } @@ -279,7 +267,7 @@ void ReadInput::item_model() If set to default, ABACUS infers the functional name from dft_functional or pseudopotential metadata.)"; item.default_value = "default"; item.unit = ""; - item.availability = "vdw_method is set to d4"; + item.set_availability("vdw_method==d4"); read_sync_string(input.vdw_d4_xc); this->add_item(item); } @@ -294,7 +282,7 @@ Available options are: * d4s: smooth D4S model)"; item.default_value = "d4"; item.unit = ""; - item.availability = "vdw_method is set to d4"; + item.set_availability("vdw_method==d4"); read_sync_string(input.vdw_d4_model); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.vdw_d4_model != "d4" && para.input.vdw_d4_model != "d4s" @@ -313,7 +301,7 @@ Available options are: item.description = "This scale factor is used to optimize the interaction energy deviations in van der Waals (vdW) corrected calculations. The recommended values of this parameter are dependent on the chosen vdW correction method and the DFT functional being used. For DFT-D2, the recommended values are 0.75 (PBE), 1.2 (BLYP), 1.05 (B-P86), 1.0 (TPSS), and 1.05 (B3LYP). If not set, will use values of PBE functional. For DFT-D3, recommended values with different DFT functionals can be found on the here. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value."; item.default_value = ""; item.unit = ""; - item.availability = "vdw_method is set to d2, d3_0, or d3_bj"; + item.set_availability("vdw_method in [d2, d3_0, d3_bj]"); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.vdw_s6 == "default") { @@ -338,7 +326,7 @@ Available options are: item.description = "This scale factor is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value."; item.default_value = ""; item.unit = ""; - item.availability = "vdw_method is set to d3_0 or d3_bj"; + item.set_availability("vdw_method in [d3_0, d3_bj]"); item.reset_value = [](const Input_Item& item, Parameter& para) { // if (para.input.vdw_s8 == "default") // { @@ -363,7 +351,7 @@ Available options are: item.description = "This damping function parameter is relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value."; item.default_value = ""; item.unit = ""; - item.availability = "vdw_method is set to d3_0 or d3_bj"; + item.set_availability("vdw_method in [d3_0, d3_bj]"); item.reset_value = [](const Input_Item& item, Parameter& para) { // if (para.input.vdw_a1 == "default") // { @@ -388,7 +376,7 @@ Available options are: item.description = "This damping function parameter is only relevant for D3(0) and D3(BJ) van der Waals (vdW) correction methods. The recommended values of this parameter with different DFT functionals can be found on the webpage. If not set, will search in ABACUS built-in dataset based on the dft_functional keywords. User set value will overwrite the searched value."; item.default_value = ""; item.unit = ""; - item.availability = "vdw_method is set to d3_0 or d3_bj"; + item.set_availability("vdw_method in [d3_0, d3_bj]"); item.reset_value = [](const Input_Item& item, Parameter& para) { // if (para.input.vdw_a2 == "default") // { @@ -413,7 +401,7 @@ Available options are: item.description = "Controls the damping rate of the damping function in the DFT-D2 method."; item.default_value = "20"; item.unit = ""; - item.availability = "vdw_method is set to d2"; + item.set_availability("vdw_method==d2"); read_sync_double(input.vdw_d); this->add_item(item); } @@ -427,7 +415,7 @@ Available options are: * False: The three-body term is not included.)"; item.default_value = "False"; item.unit = ""; - item.availability = "vdw_method is set to d3_0 or d3_bj"; + item.set_availability("vdw_method in [d3_0, d3_bj]"); read_sync_bool(input.vdw_abc); this->add_item(item); } @@ -443,7 +431,7 @@ H 0.1 Si 9.0 Namely, each line contains the element name and the corresponding parameter.)"; item.default_value = "default"; item.unit = ""; - item.availability = "vdw_method is set to d2"; + item.set_availability("vdw_method==d2"); read_sync_string(input.vdw_C6_file); this->add_item(item); } @@ -457,7 +445,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; * eVA (eV Angstrom))"; item.default_value = "Jnm6/mol"; item.unit = ""; - item.availability = "vdw_C6_file is not default"; + item.set_availability("vdw_method==d2 and vdw_c6_file!=default"); read_sync_string(input.vdw_C6_unit); item.check_value = [](const Input_Item& item, const Parameter& para) { if ((para.input.vdw_C6_unit != "Jnm6/mol") && (para.input.vdw_C6_unit != "eVA6")) @@ -479,7 +467,7 @@ Li 1.0 Cl 2.0 Namely, each line contains the element name and the corresponding parameter.)"; item.default_value = "default"; item.unit = ""; - item.availability = "vdw_method is set to d2"; + item.set_availability("vdw_method==d2"); read_sync_string(input.vdw_R0_file); this->add_item(item); } @@ -493,7 +481,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; * Bohr)"; item.default_value = "A"; item.unit = ""; - item.availability = "vdw_R0_file is not default"; + item.set_availability("vdw_method==d2 and vdw_r0_file!=default"); read_sync_string(input.vdw_R0_unit); item.check_value = [](const Input_Item& item, const Parameter& para) { if ((para.input.vdw_R0_unit != "A") && (para.input.vdw_R0_unit != "Bohr")) @@ -513,7 +501,6 @@ Namely, each line contains the element name and the corresponding parameter.)"; * period: The extent of the supercell is explicitly specified using the vdw_cutoff_period keyword.)"; item.default_value = "radius"; item.unit = ""; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.vdw_cutoff_type != "radius" && para.input.vdw_cutoff_type != "period") { @@ -531,7 +518,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; item.description = "Defines the radius of the cutoff sphere when vdw_cutoff_type is set to radius. The default values depend on the chosen vdw_method."; item.default_value = ""; item.unit = "defined by vdw_radius_unit (default Bohr)"; - item.availability = "vdw_cutoff_type is set to radius"; + item.set_availability("vdw_cutoff_type==radius"); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.vdw_cutoff_radius == "default") { @@ -575,7 +562,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; * Bohr)"; item.default_value = "Bohr"; item.unit = ""; - item.availability = "vdw_cutoff_type is set to radius"; + item.set_availability("vdw_cutoff_type==radius"); read_sync_string(input.vdw_radius_unit); item.check_value = [](const Input_Item& item, const Parameter& para) { if ((para.input.vdw_radius_unit != "A") && (para.input.vdw_radius_unit != "Bohr")) @@ -593,7 +580,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; item.description = "The three integers supplied here explicitly specify the extent of the supercell in the directions of the three basis lattice vectors."; item.default_value = "3 3 3"; item.unit = ""; - item.availability = "vdw_cutoff_type is set to period"; + item.set_availability("vdw_cutoff_type==period"); item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); if (count == 3) @@ -632,7 +619,7 @@ Namely, each line contains the element name and the corresponding parameter.)"; item.description = "The cutoff radius when calculating coordination numbers."; item.default_value = "40"; item.unit = "defined by vdw_cn_thr_unit (default: Bohr)"; - item.availability = "vdw_method is set to d3_0, d3_bj, or d4"; + item.set_availability("vdw_method in [d3_0, d3_bj, d4]"); item.reset_value = [](const Input_Item& item, Parameter& para) { if (!item.is_read() && para.input.vdw_method == "d4") { @@ -659,7 +646,6 @@ Namely, each line contains the element name and the corresponding parameter.)"; * Bohr)"; item.default_value = "Bohr"; item.unit = ""; - item.availability = ""; read_sync_string(input.vdw_cn_thr_unit); item.check_value = [](const Input_Item& item, const Parameter& para) { if ((para.input.vdw_cn_thr_unit != "A") && (para.input.vdw_cn_thr_unit != "Bohr")) diff --git a/source/source_io/module_parameter/read_inp_ofdft.cpp b/source/source_io/module_parameter/read_inp_ofdft.cpp index 46647a7bed6..ce9d8bd5f32 100644 --- a/source/source_io/module_parameter/read_inp_ofdft.cpp +++ b/source/source_io/module_parameter/read_inp_ofdft.cpp @@ -28,7 +28,7 @@ void ReadInput::item_ofdft() * cpn5: CPN5 KEDF (automatically sets ml parameters))"; item.default_value = "wt"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.check_value = [](const Input_Item& item, const Parameter& para) { #ifndef __MLALGO if (para.input.of_kinetic == "ml" || para.input.of_kinetic == "mpn" || para.input.of_kinetic == "cpn5") @@ -124,7 +124,7 @@ void ReadInput::item_ofdft() * tn: Truncated Newton algorithm.)"; item.default_value = "tn"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_string(input.of_method); this->add_item(item); } @@ -139,7 +139,7 @@ void ReadInput::item_ofdft() * both: Both energy and potential must satisfy the convergence criterion.)"; item.default_value = "energy"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_string(input.of_conv); this->add_item(item); } @@ -152,7 +152,7 @@ void ReadInput::item_ofdft() item.description = "Tolerance of the energy change for determining the convergence."; item.default_value = "2e-6"; item.unit = "Ry"; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_double(input.of_tole); this->add_item(item); } @@ -165,7 +165,7 @@ void ReadInput::item_ofdft() item.description = "Tolerance of potential for determining the convergence."; item.default_value = "1e-5"; item.unit = "Ry"; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_double(input.of_tolp); this->add_item(item); } @@ -177,7 +177,7 @@ void ReadInput::item_ofdft() item.description = "Weight of TF KEDF (kinetic energy density functional)."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=tf, tf+, wt, ext-wt, xwm"; + item.set_availability("esolver_type==ofdft and of_kinetic in [tf, tf+, wt, ext-wt, xwm]"); read_sync_double(input.of_tf_weight); this->add_item(item); } @@ -189,7 +189,7 @@ void ReadInput::item_ofdft() item.description = "Weight of vW KEDF (kinetic energy density functional)."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=vw, tf+, wt, ext-wt, lkt, xwm"; + item.set_availability("esolver_type==ofdft and of_kinetic in [vw, tf+, wt, ext-wt, lkt, xwm]"); read_sync_double(input.of_vw_weight); this->add_item(item); } @@ -201,7 +201,7 @@ void ReadInput::item_ofdft() item.description = "Parameter alpha of WT KEDF (kinetic energy density functional)."; item.default_value = ""; item.unit = ""; - item.availability = "OFDFT with of_kinetic=wt, ext-wt"; + item.set_availability("esolver_type==ofdft and of_kinetic in [wt, ext-wt]"); read_sync_double(input.of_wt_alpha); this->add_item(item); } @@ -213,7 +213,7 @@ void ReadInput::item_ofdft() item.description = "Parameter beta of WT KEDF (kinetic energy density functional)."; item.default_value = ""; item.unit = ""; - item.availability = "OFDFT with of_kinetic=wt, ext-wt"; + item.set_availability("esolver_type==ofdft and of_kinetic in [wt, ext-wt]"); read_sync_double(input.of_wt_beta); this->add_item(item); } @@ -225,7 +225,7 @@ void ReadInput::item_ofdft() item.description = "Parameter kappa for EXT-WT KEDF."; item.default_value = "1.0 / (2.0 * std::pow(4./3., 1./3.) - 1.0)"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=ext-wt"; + item.set_availability("esolver_type==ofdft and of_kinetic==ext-wt"); read_sync_double(input.of_extwt_kappa); this->add_item(item); } @@ -237,7 +237,7 @@ void ReadInput::item_ofdft() item.description = "The average density of system."; item.default_value = "0.0"; item.unit = "Bohr^-3"; - item.availability = "OFDFT with of_kinetic=wt"; + item.set_availability("esolver_type==ofdft and of_kinetic==wt"); read_sync_double(input.of_wt_rho0); this->add_item(item); } @@ -253,7 +253,7 @@ void ReadInput::item_ofdft() * False: rho0 will change if volume of system has changed.)"; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=wt"; + item.set_availability("esolver_type==ofdft and of_kinetic==wt"); read_sync_bool(input.of_hold_rho0); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.of_wt_rho0 != 0) @@ -271,7 +271,7 @@ void ReadInput::item_ofdft() item.description = "Parameter a of LKT KEDF (kinetic energy density functional)."; item.default_value = "1.3"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=lkt"; + item.set_availability("esolver_type==ofdft and of_kinetic==lkt"); read_sync_double(input.of_lkt_a); this->add_item(item); } @@ -283,7 +283,7 @@ void ReadInput::item_ofdft() item.description = "Reference charge density for XWM kinetic energy functional. If set to 0, the program will use average charge density."; item.default_value = "0.0"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=xwm"; + item.set_availability("esolver_type==ofdft and of_kinetic==xwm"); read_sync_double(input.of_xwm_rho_ref); this->add_item(item); } @@ -295,7 +295,7 @@ void ReadInput::item_ofdft() item.description = "Parameter for XWM kinetic energy functional. See PHYSICAL REVIEW B 100, 205132 (2019) for optimal values."; item.default_value = "0.0"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=xwm"; + item.set_availability("esolver_type==ofdft and of_kinetic==xwm"); read_sync_double(input.of_xwm_kappa); this->add_item(item); } @@ -311,7 +311,7 @@ void ReadInput::item_ofdft() * False: The kernel of WT KEDF (kinetic energy density functional) will be filled from formula.)"; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT with of_kinetic=wt"; + item.set_availability("esolver_type==ofdft and of_kinetic==wt"); read_sync_bool(input.of_read_kernel); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.of_kinetic != "wt") @@ -329,7 +329,7 @@ void ReadInput::item_ofdft() item.description = "The name of WT kernel file."; item.default_value = "WTkernel.txt"; item.unit = ""; - item.availability = "OFDFT with of_read_kernel=True"; + item.set_availability("esolver_type==ofdft and of_kinetic==wt and of_read_kernel==true"); read_sync_string(input.of_kernel_file); this->add_item(item); } @@ -344,7 +344,7 @@ void ReadInput::item_ofdft() * False: Only use the planewaves inside ecut, the same as KSDFT.)"; item.default_value = "True"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_full_pw); this->add_item(item); } @@ -363,7 +363,7 @@ void ReadInput::item_ofdft() Note: Even dimensions may cause slight errors in FFT. It should be ignorable in ofdft calculation, but it may make Cardinal B-spline interpolation unstable, so please set of_full_pw_dim = 1 if nbspline != -1.)"; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT with of_full_pw = True"; + item.set_availability("esolver_type==ofdft and of_full_pw==true"); read_sync_int(input.of_full_pw_dim); item.reset_value = [](const Input_Item& item, Parameter& para) { if (!para.input.of_full_pw) @@ -381,7 +381,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Controls the generation of machine learning training data. When enabled, training data in .npy format will be saved in the directory OUT.${suffix}/."; item.default_value = "False"; item.unit = ""; - item.availability = "Used only for KSDFT with plane wave basis"; + item.set_availability("esolver_type==ksdft and basis_type==pw"); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.of_ml_gene_data && (para.input.esolver_type != "ksdft" || para.input.basis_type != "pw" || GlobalV::NPROC != 1)) @@ -404,7 +404,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in * gpu: GPU)"; item.default_value = "cpu"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_string(input.of_ml_device); this->add_item(item); } @@ -419,7 +419,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in * 3: Incorporate the FEG limit by nonlinear transformation using softplus function.)"; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_int(input.of_ml_feg); this->add_item(item); } @@ -431,7 +431,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Number of kernel functions."; item.default_value = "1"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.of_ml_nkernel > 0) { @@ -469,7 +469,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in * 3: Truncated kinetic kernel (TKK), the file containing TKK is specified by of_ml_kernel_file.)"; item.default_value = "1"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_kernel); }; @@ -484,7 +484,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the RECIPROCAL of scaling parameter of the i-th kernel function."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_kernel_scaling); }; @@ -499,7 +499,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the parameter alpha of i-th kernel function. ONLY used for Yukawa kernel function."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_yukawa_alpha); }; @@ -514,7 +514,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the file containing the i-th kernel function. ONLY used for TKK."; item.default_value = "none"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -533,7 +533,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Local descriptor: gamma = (rho / rho0)^(1/3)."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_gamma); this->add_item(item); } @@ -545,7 +545,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Semi-local descriptor: p = |nabla rho|^2 / [2 (3 pi^2)^(1/3) rho^(4/3)]^2."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_p); this->add_item(item); } @@ -557,7 +557,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Semi-local descriptor: q = nabla^2 rho / [4 (3 pi^2)^(2/3) rho^(5/3)]."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_q); this->add_item(item); } @@ -569,7 +569,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Semi-local descriptor: tanhp = tanh(chi_p * p)."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_tanhp); this->add_item(item); } @@ -581,7 +581,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Semi-local descriptor: tanhq = tanh(chi_q * q)."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_tanhq); this->add_item(item); } @@ -593,7 +593,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Hyperparameter chi_p: tanhp = tanh(chi_p * p)."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_double(input.of_ml_chi_p); this->add_item(item); } @@ -605,7 +605,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Hyperparameter chi_q: tanhq = tanh(chi_q * q)."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_double(input.of_ml_chi_q); this->add_item(item); } @@ -617,7 +617,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor gammanl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_gammanl); }; @@ -632,7 +632,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor pnl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_pnl); }; @@ -647,7 +647,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor qnl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_qnl); }; @@ -662,7 +662,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor xi defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_xi); }; @@ -677,7 +677,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanhxi); }; @@ -692,7 +692,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhxi_nl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanhxi_nl); }; @@ -707,7 +707,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_pnl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanh_pnl); }; @@ -722,7 +722,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanh_qnl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanh_qnl); }; @@ -737,7 +737,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhp_nl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanhp_nl); }; @@ -752,7 +752,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element controls the non-local descriptor tanhq_nl defined by the i-th kernel function."; item.default_value = "0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_tanhq_nl); }; @@ -767,7 +767,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_xi of non-local descriptor tanhxi defined by the i-th kernel function."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_chi_xi); }; @@ -782,7 +782,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_pnl of non-local descriptor tanh_pnl defined by the i-th kernel function."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_chi_pnl); }; @@ -797,7 +797,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Containing nkernel (see of_ml_nkernel) elements. The i-th element specifies the hyperparameter chi_qnl of non-local descriptor tanh_qnl defined by the i-th kernel function."; item.default_value = "1.0"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.of_ml_chi_qnl); }; @@ -812,7 +812,7 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "FOR TEST. Read in the density, and output the F and Pauli potential."; item.default_value = "False"; item.unit = ""; - item.availability = "OFDFT"; + item.set_availability("esolver_type==ofdft"); read_sync_bool(input.of_ml_local_test); this->add_item(item); } @@ -824,9 +824,8 @@ Note: Even dimensions may cause slight errors in FFT. It should be ignorable in item.description = "Whether to use machine learning based exact exchange (ML-EXX)."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.ml_exx); this->add_item(item); } } -} // namespace ModuleIO \ No newline at end of file +} // namespace ModuleIO diff --git a/source/source_io/module_parameter/read_inp_other.cpp b/source/source_io/module_parameter/read_inp_other.cpp index d2e53a71ef1..7021da0e492 100644 --- a/source/source_io/module_parameter/read_inp_other.cpp +++ b/source/source_io/module_parameter/read_inp_other.cpp @@ -23,7 +23,6 @@ void ReadInput::item_others() item.description = "Switch to control spin-constrained DFT calculation"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.sc_mag_switch); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.sc_mag_switch) @@ -44,7 +43,6 @@ void ReadInput::item_others() item.description = "Switch to control gradient break condition in spin-constrained DFT"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.decay_grad_switch); this->add_item(item); } @@ -56,7 +54,7 @@ void ReadInput::item_others() item.description = "Convergence criterion of spin-constrained iteration (RMS) in uB"; item.default_value = "1.0e-6"; item.unit = "uB"; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_double(input.sc_thr); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.sc_thr < 0) @@ -74,7 +72,7 @@ void ReadInput::item_others() item.description = "Maximal number of spin-constrained iteration"; item.default_value = "100"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_int(input.nsc); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nsc <= 0) @@ -92,7 +90,7 @@ void ReadInput::item_others() item.description = "Minimum number of spin-constrained iteration"; item.default_value = "2"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_int(input.nsc_min); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.nsc_min <= 0) @@ -110,7 +108,7 @@ void ReadInput::item_others() item.description = "Initial trial step size for lambda in eV/uB^2"; item.default_value = "0.01"; item.unit = "eV/uB^2"; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_double(input.alpha_trial); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.alpha_trial <= 0) @@ -128,7 +126,7 @@ void ReadInput::item_others() item.description = "Maximal step size for lambda in eV/uB"; item.default_value = "3.0"; item.unit = "eV/uB"; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_double(input.sccut); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.sccut <= 0) @@ -146,7 +144,7 @@ void ReadInput::item_others() item.description = "Convergence criterion ratio of lambda iteration in Spin-constrained DFT"; item.default_value = "1.0e-2"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_double(input.sc_drop_thr); this->add_item(item); } @@ -158,7 +156,7 @@ void ReadInput::item_others() item.description = "Density error threshold for inner loop of spin-constrained SCF"; item.default_value = "1.0e-4"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_double(input.sc_scf_thr); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.sc_scf_thr <= 0.0) @@ -178,7 +176,7 @@ void ReadInput::item_others() When false (default), both the direction and magnitude of the magnetic moment are constrained to the target values.)"; item.default_value = "False"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_bool(input.sc_direction_only); this->add_item(item); } @@ -195,7 +193,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar * linear_scan: linear sweep of lambda for testing magnetic moment response)"; item.default_value = "bfgs"; item.unit = ""; - item.availability = "sc_mag_switch is true"; + item.set_availability("sc_mag_switch==true"); read_sync_string(input.sc_lambda_strategy); item.check_value = [](const Input_Item& item, const Parameter& para) { const std::vector valid = {"bfgs", "bfgs2", "linear_response", "augmented_lagrangian", "hybrid_delayed", "linear_scan"}; @@ -214,7 +212,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Starting lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan."; item.default_value = "0.0"; item.unit = "eV/uB"; - item.availability = "sc_lambda_strategy is linear_scan"; + item.set_availability("sc_mag_switch==true and sc_lambda_strategy==linear_scan"); read_sync_double(input.sc_scan_lambda_start); this->add_item(item); } @@ -226,7 +224,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Ending lambda value for linear_scan strategy. Only used when sc_lambda_strategy=linear_scan."; item.default_value = "1.0"; item.unit = "eV/uB"; - item.availability = "sc_lambda_strategy is linear_scan"; + item.set_availability("sc_mag_switch==true and sc_lambda_strategy==linear_scan"); read_sync_double(input.sc_scan_lambda_end); this->add_item(item); } @@ -238,7 +236,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Number of lambda values to scan. Only used when sc_lambda_strategy=linear_scan."; item.default_value = "20"; item.unit = ""; - item.availability = "sc_lambda_strategy is linear_scan"; + item.set_availability("sc_mag_switch==true and sc_lambda_strategy==linear_scan"); read_sync_int(input.sc_scan_steps); this->add_item(item); } @@ -252,7 +250,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to let ABACUS output QO analysis required files"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.qo_switch); this->add_item(item); } @@ -268,7 +265,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * szv: single-zeta valence basis)"; item.default_value = "szv"; item.unit = ""; - item.availability = ""; read_sync_string(input.qo_basis); this->add_item(item); } @@ -280,7 +276,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Strategy to generate radial orbitals for QO analysis. For hydrogen: energy-valence, for pswfc and szv: all"; item.default_value = "for hydrogen: energy-valence, for pswfc and szv: all"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -328,7 +323,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The screening coefficient for each atom type to rescale the shape of radial orbitals"; item.default_value = "0.1"; item.unit = "Bohr^-1"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -385,7 +379,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The convergence threshold determining the cutoff of generated orbital. Lower threshold will yield orbital with larger cutoff radius."; item.default_value = "1.0e-6"; item.unit = ""; - item.availability = ""; read_sync_double(input.qo_thr); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.qo_thr > 1e-6) @@ -407,7 +400,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The number of poles used in the pole expansion method, should be a even number."; item.default_value = "40"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_npole); this->add_item(item); } @@ -420,7 +412,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether inertia counting is used at the very beginning."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pexsi_inertia); this->add_item(item); } @@ -433,7 +424,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Maximum number of PEXSI iterations after each inertia counting procedure."; item.default_value = "80"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_nmax); this->add_item(item); } @@ -445,7 +435,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to construct PSelInv communication pattern."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pexsi_comm); this->add_item(item); } @@ -458,7 +447,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to use symmetric storage space used by the Selected Inversion algorithm for symmetric matrices."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pexsi_storage); this->add_item(item); } @@ -470,7 +458,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Ordering strategy for factorization and selected inversion. 0: Parallel ordering using ParMETIS, 1: Sequential ordering using METIS, 2: Multiple minimum degree ordering"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_ordering); this->add_item(item); } @@ -483,7 +470,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Row permutation strategy for factorization and selected inversion, 0: No row permutation, 1: Make the diagonal entry of the matrix larger than the off-diagonal entries."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_row_ordering); this->add_item(item); } @@ -495,7 +481,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Number of processors for PARMETIS. Only used if pexsi_ordering == 0."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_nproc); this->add_item(item); } @@ -507,7 +492,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether the matrix is symmetric."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pexsi_symm); this->add_item(item); } @@ -519,7 +503,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to factorize the transpose of the matrix."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.pexsi_trans); this->add_item(item); } @@ -532,7 +515,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The pole expansion method to be used. 1 for Cauchy Contour Integral method, 2 for Moussa optimized method."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_method); this->add_item(item); } @@ -544,7 +526,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The point parallelizaion of PEXSI. Recommend two points parallelization."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.pexsi_nproc_pole); this->add_item(item); } @@ -556,7 +537,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Temperature in Fermi-Dirac distribution, in Ry, should have the same effect as the smearing sigma when smearing method is set to Fermi-Dirac."; item.default_value = "0.015"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_temp); this->add_item(item); } @@ -568,7 +548,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Spectral gap, this can be set to be 0 in most cases."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_gap); this->add_item(item); } @@ -580,7 +559,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Upper bound for the spectral radius of S^{-1}H."; item.default_value = "20"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_delta_e); this->add_item(item); } @@ -592,7 +570,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Initial guess of lower bound for mu."; item.default_value = "-10"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu_lower); this->add_item(item); } @@ -604,7 +581,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Initial guess of upper bound for mu."; item.default_value = "10"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu_upper); this->add_item(item); } @@ -616,7 +592,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Initial guess for mu (for the solver)."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu); this->add_item(item); } @@ -629,7 +604,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Stopping criterion in terms of the chemical potential for the inertia counting procedure."; item.default_value = "0.05"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu_thr); this->add_item(item); } @@ -643,7 +617,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "If the chemical potential is not in the initial interval, the interval is expanded by this value."; item.default_value = "0.3"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu_expand); this->add_item(item); } @@ -656,7 +629,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Safe guard criterion in terms of the chemical potential to reinvoke the inertia counting procedure."; item.default_value = "0.2"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_mu_guard); this->add_item(item); } @@ -670,7 +642,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Stopping criterion of the PEXSI iteration in terms of the number of electrons compared to numElectronExact."; item.default_value = "0.001"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_elec_thr); this->add_item(item); } @@ -683,7 +654,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "if the absolute value of CCS matrix element is less than this value, it will be considered as zero."; item.default_value = "1e-10"; item.unit = ""; - item.availability = ""; read_sync_double(input.pexsi_zero_thr); this->add_item(item); } @@ -697,7 +667,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to print information into individual logs from all ranks in an MPI run.\n* True: Information from each rank will be written into individual files named OUT.{calculation}_{suffix}/running_${calculation}.log."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_alllog); this->add_item(item); } @@ -709,7 +678,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Debugging flag for developers"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.nurse); this->add_item(item); } @@ -723,7 +691,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.t_in_h); this->add_item(item); } @@ -737,7 +704,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.vl_in_h); this->add_item(item); } @@ -751,7 +717,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.vnl_in_h); this->add_item(item); } @@ -765,7 +730,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.vh_in_h); this->add_item(item); } @@ -779,7 +743,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.vion_in_h); this->add_item(item); } @@ -793,7 +756,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.test_force); this->add_item(item); } @@ -807,7 +769,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.test_stress); this->add_item(item); } @@ -821,7 +782,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * 1: Yes.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.test_skip_ewald); this->add_item(item); } @@ -833,7 +793,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to use the RI approximation for the Hartree term in LR-TDDFT for benchmark (with FHI-aims/ABACUS read-in style)"; item.default_value = "none"; item.unit = ""; - item.availability = ""; read_sync_string(input.ri_hartree_benchmark); this->add_item(item); } @@ -845,7 +804,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Atomic basis set size for each atom type (with the same order as in STRU) in FHI-aims."; item.default_value = "{} (empty list, where ABACUS use its own basis set size)"; item.unit = ""; - item.availability = "ri_hartree_benchmark = aims"; + item.set_availability("ri_hartree_benchmark==aims"); item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -869,7 +828,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar "of the system in the ground state, etc."; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.rdmft); this->add_item(item); item.check_value = [](const Input_Item& item, const Parameter& para) { @@ -888,7 +846,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The alpha parameter of power-functional(or other exx-type/hybrid functionals) which used in RDMFT, g(occ_number) = occ_number^alpha"; item.default_value = "0.656"; item.unit = ""; - item.availability = ""; read_sync_double(input.rdmft_power_alpha); item.reset_value = [](const Input_Item& item, Parameter& para) { if( para.input.dft_functional == "hf" || para.input.dft_functional == "pbe0" ) @@ -920,7 +877,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar * False: Use the traditional method to calculate the Fock exchange operator.)"; item.default_value = "True"; item.unit = ""; - item.availability = "exx_separate_loop==True."; + item.set_availability("exx_separate_loop==true"); read_sync_bool(input.exxace); this->add_item(item); } @@ -932,7 +889,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "Whether to use the gamma point extrapolation method to calculate the Fock exchange operator. See https://doi.org/10.1103/PhysRevB.79.205114 for details. Should be set to true most of the time."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.exx_gamma_extrapolation); this->add_item(item); } @@ -944,7 +900,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The energy cutoff for EXX (Fock) exchange operator in plane wave basis calculations. Reducing ecutexx below ecutrho may significantly accelerate EXX computations. This speed improvement comes with a reduced numerical accuracy in the exchange energy calculation."; item.default_value = "same as ecutrho"; item.unit = "Ry"; - item.availability = ""; read_sync_double(input.ecutexx); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.ecutexx < 0) @@ -965,7 +920,6 @@ When false (default), both the direction and magnitude of the magnetic moment ar * density: if the change of charge density difference between two successive outer loop iterations is seen as converged according to scf_thr, then the outer loop is seen as converged.)"; item.default_value = "density"; item.unit = ""; - item.availability = ""; read_sync_string(input.exx_thr_type); item.check_value = [](const Input_Item& item, const Parameter& para) { std::string thr_type = para.input.exx_thr_type; @@ -985,7 +939,7 @@ When false (default), both the direction and magnitude of the magnetic moment ar item.description = "The threshold for the change of exact exchange energy to judge convergence of the outer loop in the separate loop EXX calculation."; item.default_value = "1e-5"; item.unit = "Ry"; - item.availability = "exx_thr_type==energy"; + item.set_availability("exx_thr_type==energy"); read_sync_double(input.exx_ene_thr); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.exx_ene_thr <= 0) diff --git a/source/source_io/module_parameter/read_inp_out.cpp b/source/source_io/module_parameter/read_inp_out.cpp index 55f64ec833a..dd5abd63372 100644 --- a/source/source_io/module_parameter/read_inp_out.cpp +++ b/source/source_io/module_parameter/read_inp_out.cpp @@ -19,7 +19,6 @@ void ReadInput::item_output() "\n\n[NOTE] In RT-TDDFT calculations, this parameter is inactive; output frequency is instead controlled by out_freq_td."; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.out_freq_ion <= 0) { @@ -38,7 +37,6 @@ void ReadInput::item_output() "\n\n[NOTE] This parameter is only active in RT-TDDFT mode (esolver_type = tddft). It has no effect in ground-state calculations."; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.out_freq_td <= 0) { @@ -56,7 +54,6 @@ void ReadInput::item_output() item.description = "Output the charge density (only binary format, controlled by out_chg), wavefunction (controlled by out_wfc_pw) per out_freq_elec electronic iterations. Note that they are always output when converged or reach the maximum iterations scf_nmax."; item.default_value = "scf_nmax"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.out_freq_elec <= 0) { @@ -102,7 +99,6 @@ In molecular dynamics simulations, the output frequency is controlled by out_fre [NOTE] In the 3.10-LTS version, the file names are SPIN1_CHG.cube and SPIN1_CHG_INI.cube, etc.)"; item.default_value = "0 3"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_chg needs at least 1 value"); @@ -151,7 +147,6 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr [NOTE] In the 3.10-LTS version, the file names are SPIN1_POT.cube and SPIN1_POT_INI.cube, etc.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_pot needs at least 1 value"); @@ -191,7 +186,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * In 3.10-LTS, the corresponding keyword is out_dm, and the output files are SPIN1_DM and SPIN2_DM, etc.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_dmk needs at least 1 value"); @@ -222,7 +217,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr [NOTE] In the 3.10-LTS version, the parameter is named out_dm1, and the file names are data-DMR-sparse_SPIN0.csr and data-DMR-sparse_SPIN1.csr, etc.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis (multi-k points)"; + 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(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_dmr needs at least 1 value"); @@ -267,7 +262,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr [NOTE] In the 3.10-LTS version, the file names are WAVEFUNC1.dat, WAVEFUNC2.dat, etc.)"; item.default_value = "0"; item.unit = ""; - item.availability = "Output electronic wave functions in plane wave basis, or transform the real-space electronic wave function into plane wave basis (see get_wf option in calculation with NAO basis)"; + item.set_availability("basis_type==pw or (basis_type==lcao and calculation==get_wf)"); read_sync_int(input.out_wfc_pw); this->add_item(item); } @@ -292,7 +287,7 @@ Also controled by out_freq_ion and out_app_flag. [NOTE] In the 3.10-LTS version, the file names are WFC_NAO_GAMMA1_ION1.txt and WFC_NAO_K1_ION1.txt, etc.)"; item.default_value = "0"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_int(input.out_wfc_lcao); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.qo_switch) @@ -326,7 +321,6 @@ Also controled by out_freq_ion and out_app_flag. * 3: output the Fermi surface file (fermi.bxsf) in BXSF format that can be visualized by XCrySDen)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.out_dos); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg") @@ -362,7 +356,6 @@ Also controled by out_freq_ion and out_app_flag. * 3: output both two LDOS modes above.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count != 1 && count != 2) @@ -392,7 +385,6 @@ Also controled by out_freq_ion and out_app_flag. * For more information, refer to the band.md)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count != 1 && count != 2) @@ -419,7 +411,6 @@ Also controled by out_freq_ion and out_app_flag. item.description = "Whether to output the projected band structure. For more information, refer to the band.md"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_proj_band); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.calculation == "get_wf" || para.input.calculation == "get_pchg") @@ -447,7 +438,6 @@ Also controled by out_freq_ion and out_app_flag. "[NOTE] For backward compatibility, true/false (case insensitive) are accepted and converted to 1/0."; item.default_value = "1"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const std::string val = FmtCore::lower(item.str_values[0]); if (val == "true" || val == "t" || val == "yes" || val == "y" || val == "on" || val == ".true.") @@ -511,7 +501,6 @@ Also controled by out_freq_ion and out_app_flag. * m: molecular dynamics level, which does not print some information for simplicity.)"; item.default_value = "ie"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.out_level = strvalue; para.sys.out_md_control = true; @@ -551,7 +540,7 @@ When out_app_flag is false, g followed by the one-based ionic-step index is inse [NOTE] In the 3.10-LTS version, the file names are data-0-H and data-0-S, etc.)"; item.default_value = "0 8"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1 || count > 2) @@ -594,7 +583,7 @@ When out_app_flag is false, g followed by the one-based ionic-step index is inse item.description = "Legacy alias for out_hsk 1, which outputs Hamiltonian and overlap matrices in reciprocal space for each k-point. The optional second integer controls text precision. If both out_hsk and out_mat_hs are present, out_hsk takes precedence."; item.default_value = "False 8"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_hs needs at least 1 value"); @@ -624,7 +613,7 @@ For binary output, each file uses the same basename as text output with a .dat s [NOTE] In the 3.10-LTS version, the file names are data-HR-sparse_SPIN0.csr and data-SR-sparse_SPIN0.csr, etc.)"; item.default_value = "0 8"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1 || count > 2) @@ -672,7 +661,7 @@ For binary output, each file uses the same basename as text output with a .dat s item.description = "Legacy alias for out_hsr 1, which outputs Hamiltonian and overlap matrices in real space indexed by the Bravais lattice vector R. The optional second integer controls text precision. If both out_hsr and out_mat_hs2 are present, out_hsr takes precedence."; item.default_value = "False 8"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_hs2 needs at least 1 value"); @@ -693,7 +682,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_tk needs at least 1 value"); @@ -715,7 +704,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + 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(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_r needs at least 1 value"); @@ -754,7 +743,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + 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(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_t needs at least 1 value"); @@ -783,7 +772,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; item.unit = "Ry/Bohr"; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + 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(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_dh needs at least 1 value"); @@ -1182,7 +1171,7 @@ For binary output, each file uses the same basename as text output with a .dat 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.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + 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(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_ds needs at least 1 value"); @@ -1216,7 +1205,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; - item.availability = "Numerical atomic orbital (NAO) and NAO-in-PW basis"; + item.set_availability("basis_type in [lcao, lcao_in_pw]"); read_sync_bool(input.out_mat_xc); this->add_item(item); } @@ -1229,7 +1218,7 @@ For binary output, each file uses the same basename as text output with a .dat s "\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"; - item.availability = "Numerical atomic orbital (NAO) basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_xc2 needs at least 1 value"); @@ -1256,7 +1245,7 @@ For binary output, each file uses the same basename as text output with a .dat s 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 OUT.{suffix}_Lx.dat, OUT.{suffix}_Ly.dat, and OUT.{suffix}_Lz.dat. The second integer controls the precision of the output."; item.default_value = "False 8"; item.unit = ""; - item.availability = "Numerical atomic orbital (NAO) basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "out_mat_l needs at least 1 value"); @@ -1286,7 +1275,6 @@ The second integer controls the precision of the charge density output, if not g 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).)"; item.default_value = "-1 3"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count >= 1) @@ -1318,7 +1306,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to print the band energy terms separately in the file OUT.{term}_out.dat. The terms include the kinetic, pseudopotential (local + nonlocal), Hartree and exchange-correlation (including exact exchange if calculated)."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.out_eband_terms); this->add_item(item); } @@ -1330,7 +1318,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to print Hamiltonian matrices H(R) in NPZ format as hrs1_nao.npz and, for nspin = 2, hrs2_nao.npz. This feature does not work for gamma-only calculations."; item.default_value = "False"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + item.set_availability("basis_type==lcao and gamma_only==0"); read_sync_bool(input.out_hr_npz); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_hr_npz) @@ -1352,7 +1340,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Legacy alias for out_hsr 3, writing hrs1_nao.npz, hrs2_nao.npz when needed, and sr_nao.npz. If both out_hsr and out_hsr_npz are present, out_hsr takes precedence. Gamma-only calculations write the folded R = (0, 0, 0) representation."; item.default_value = "False"; item.unit = "Ry"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); item.read_value = [](const Input_Item& item, Parameter& para) { para.input.out_hsr_npz = assume_as_boolean(item.str_values[0]); }; @@ -1376,7 +1364,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to print density matrices DM(R) in npz format. This feature does not work for gamma-only calculations."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + item.set_availability("basis_type==lcao and gamma_only==0"); read_sync_bool(input.out_dm_npz); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.out_dm_npz) @@ -1398,7 +1386,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to print the Mulliken population analysis result into OUT.${suffix}/mulliken.txt. In molecular dynamics calculations, the output frequency is controlled by out_freq_ion."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.out_mul); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.basis_type == "pw" && para.input.out_mul) @@ -1417,7 +1405,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to output r(R), H(R), S(R), T(R), dH(R), dS(R), and wfc matrices in an append manner during molecular dynamics calculations. Check input parameters out_mat_r, out_hsr, out_mat_t, out_mat_dh, out_hsk and out_wfc_lcao for more information."; item.default_value = "true"; item.unit = ""; - item.availability = "Numerical atomic orbital basis (not gamma-only algorithm)"; + item.set_availability("basis_type==lcao and gamma_only==0"); read_sync_bool(input.out_app_flag); this->add_item(item); } @@ -1429,7 +1417,7 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Controls the length of decimal part of output data, such as charge density, Hamiltonian matrix, Overlap matrix and so on."; item.default_value = "8"; item.unit = ""; - item.availability = "out_hsk 1 case presently."; + item.set_availability("basis_type==lcao and out_hsk==1"); read_sync_int(input.out_ndigits); this->add_item(item); } @@ -1441,7 +1429,6 @@ The circle order of the charge density on real space grids is: x is the outer lo item.description = "Whether to print element information into files in the directory OUT.{element_label}, including pseudopotential and orbital information of the element (in atomic Ryberg units)."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_element_info); this->add_item(item); } @@ -1456,7 +1443,7 @@ The circle order of the charge density on real space grids is: x is the outer lo If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or rpa==True), the Hexx(R) files for each processor will also be saved in the above folder, which can be read in EXX calculation with restart_load==True.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.restart_save); this->add_item(item); } @@ -1472,7 +1459,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r "irreducible_sector.txt, symrot_k.txt and symrot_R.txt."; item.default_value = "False"; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.rpa); this->add_item(item); } @@ -1484,7 +1471,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = " Velocity matrix in KS basis (in unit of eV *Angstrom). Loop layer: spin -> k -> direction -> KS_basis1 -> KS_basis2."; item.default_value = "False"; item.unit = "eV * A"; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_bool(input.rpa_out_vel); this->add_item(item); } @@ -1496,7 +1483,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = "The directory to save files for LibRPA."; item.default_value = "\"./OUT.librpa/\""; item.unit = ""; - item.availability = "Numerical atomic orbital basis"; + item.set_availability("basis_type==lcao"); read_sync_string(input.rpa_outdir); item.reset_value = [](const Input_Item& item, Parameter& para) { para.input.rpa_outdir = to_dir(para.input.rpa_outdir); @@ -1511,7 +1498,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = R"(Specifies the electronic states to calculate the charge densities with state index for, using a space-separated string of 0s and 1s. Each digit in the string corresponds to a state, starting from the first state. A 1 indicates that the charge density should be calculated for that state, while a 0 means the state will be ignored. The parameter allows a compact and flexible notation (similar to ocp_set), for example the syntax 1 4*0 5*1 0 is used to denote the selection of states: 1 means calculate for the first state, 4*0 skips the next four states, 5*1 means calculate for the following five states, and the final 0 skips the next state. It's essential that the total count of states does not exceed the total number of states (nbands); otherwise, it results in an error, and the process exits. The input string must contain only numbers and the asterisk (*) for repetition, ensuring correct format and intention of state selection. The outputs comprise multiple .cube files following the naming convention pchgi[state]s[spin]k[kpoint].cube.)"; item.default_value = "none"; item.unit = ""; - item.availability = "For both PW and LCAO. When basis_type = lcao, used when calculation = get_pchg."; + item.set_availability("basis_type==pw or (basis_type==lcao and calculation==get_pchg)"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.out_pchg); }; item.get_final_value = [](Input_Item& item, const Parameter& para) { @@ -1531,7 +1518,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = "Specifies the electronic states to calculate the real-space wave function modulus (norm, or known as the envelope function) with state index. The syntax and state selection rules are identical to out_pchg, but the output is the norm of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint].cube."; item.default_value = "none"; item.unit = ""; - item.availability = "For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf."; + item.set_availability("basis_type==pw or (basis_type==lcao and calculation==get_wf)"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.out_wfc_norm); }; @@ -1552,7 +1539,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = "Specifies the electronic states to calculate the real and imaginary parts of the wave function with state index. The syntax and state selection rules are identical to out_pchg, but the output contains both the real and imaginary components of the wave function. The outputs comprise multiple .cube files following the naming convention wfi[state]s[spin]k[kpoint][re/im].cube."; item.default_value = "none"; item.unit = ""; - item.availability = "For both PW and LCAO. When basis_type = lcao, used when calculation = get_wf."; + item.set_availability("basis_type==pw or (basis_type==lcao and calculation==get_wf)"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.out_wfc_re_im); }; @@ -1574,7 +1561,7 @@ If EXX(exact exchange) is calculated (i.e. dft_fuctional==hse/hf/pbe0/scan0 or r item.description = "Specifies whether to write the partial charge densities for all k-points to individual files or merge them. Warning: Enabling symmetry may produce unwanted results due to reduced k-point weights and symmetry operations in real space. Therefore when calculating partial charge densities, if you are not sure what you want exactly, it is strongly recommended to set symmetry = -1. It is noteworthy that your symmetry setting should remain the same as that in the SCF procedure."; item.default_value = "false"; item.unit = ""; - item.availability = "For both PW and LCAO. When basis_type = pw, used if out_pchg is set. When basis_type = lcao, used only when calculation = get_pchg and gamma_only = 0."; + item.set_availability("(basis_type==pw and out_pchg!=none) or (basis_type==lcao and calculation==get_pchg and gamma_only==0)"); read_sync_bool(input.if_separate_k); this->add_item(item); } @@ -1600,7 +1587,7 @@ The second integer controls the precision of the kinetic energy density output, In molecular dynamics calculations, the output frequency is controlled by out_freq_ion.)"; item.default_value = "0 3"; item.unit = ""; - item.availability = "Only for Kohn-Sham DFT and Orbital Free DFT."; + item.set_availability("esolver_type in [ksdft, ofdft]"); item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count >= 1) @@ -1630,7 +1617,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr item.description = "This output is only intentively needed by the ABACUS numerical atomic orbital generation workflow. This parameter is used to control whether to output the overlap integrals between truncated spherical Bessel functions (TSBFs) and plane-wave basis expanded wavefunctions (named as OVERLAP_Q), and between TSBFs (named as OVERLAP_Sq), also their first order derivatives. The output files are named starting with orb_matrix. A value of 2 would enable the output."; item.default_value = "0"; item.unit = ""; - item.availability = "Only for Kohn-Sham DFT with plane-wave basis."; + item.set_availability("esolver_type==ksdft and basis_type==pw"); read_sync_int(input.out_spillage); this->add_item(item); } @@ -1644,7 +1631,6 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * False: Do not output the electric dipole information.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_dipole); this->add_item(item); } @@ -1659,7 +1645,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * 2: Use the full Hamiltonian to construct the generalized velocity matrix in a nonorthogonal NAO basis, $\widetilde{v}_{\alpha}=\partial_{\alpha}H+\mathrm{i}HS^{-1}\mathcal{R}_{\alpha}-\mathrm{i}\mathcal{R}_{\alpha}S^{-1}H-HS^{-1}\partial_{\alpha}S$. This includes all contributions available in the real-space Hamiltonian matrix when enabled. This method is more general but more expensive. The total current is written to OUT.{suffix}/current_tot_comm.txt.)"; item.default_value = "0"; item.unit = ""; - item.availability = "basis_type==lcao and esolver_type==tddft"; + item.set_availability("basis_type==lcao and esolver_type==tddft"); read_sync_int(input.out_current); this->add_item(item); } @@ -1673,7 +1659,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * False: Output only current_tot.txt for out_current=1 or current_tot_comm.txt for out_current=2.)"; item.default_value = "False"; item.unit = ""; - item.availability = "basis_type==lcao and esolver_type==tddft and out_current>0"; + item.set_availability("basis_type==lcao and esolver_type==tddft and out_current>0"); read_sync_bool(input.out_current_k); this->add_item(item); } @@ -1687,7 +1673,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * False: Do not output electric-field values.)"; item.default_value = "False"; item.unit = ""; - item.availability = "esolver_type==tddft and td_vext==true"; + item.set_availability("esolver_type==tddft and td_vext==true"); read_sync_bool(input.out_efield); this->add_item(item); } @@ -1701,7 +1687,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr * False: Do not output the vector potential.)"; item.default_value = "False"; item.unit = ""; - item.availability = "basis_type==lcao and esolver_type==tddft"; + item.set_availability("basis_type==lcao and esolver_type==tddft"); read_sync_bool(input.out_vecpot); this->add_item(item); } @@ -1717,7 +1703,6 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr item.description = "Whether to print the matrix representation of symmetry operation to running log file. If the first value is given as 1, then all matrix representations will be printed. The second optional parameter controls the precision (number of digits) to print, default is 3, which is enough for a quick check."; item.default_value = "1 3"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count >= 1) @@ -1747,7 +1732,7 @@ In molecular dynamics calculations, the output frequency is controlled by out_fr item.description = "The directory to save the spillage files."; item.default_value = "\"./\""; item.unit = ""; - item.availability = "Used only for plane wave basis set."; + item.set_availability("basis_type==pw"); read_sync_string(input.spillage_outdir); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_inp_postproc.cpp b/source/source_io/module_parameter/read_inp_postproc.cpp index 6955d840410..27fef04e844 100644 --- a/source/source_io/module_parameter/read_inp_postproc.cpp +++ b/source/source_io/module_parameter/read_inp_postproc.cpp @@ -17,7 +17,6 @@ void ReadInput::item_postprocess() item.description = "The step size in writing Density of States (DOS)"; item.default_value = "0.01"; item.unit = "eV"; - item.availability = ""; read_sync_double(input.dos_edelta_ev); this->add_item(item); } @@ -29,7 +28,6 @@ void ReadInput::item_postprocess() item.description = "The width of the Gaussian factor when obtaining smeared Density of States (DOS)"; item.default_value = "0.07"; item.unit = "eV"; - item.availability = ""; read_sync_double(input.dos_sigma); this->add_item(item); } @@ -41,7 +39,6 @@ void ReadInput::item_postprocess() item.description = "Defines the energy range of DOS output as (emax-emin)*(1+dos_scale), centered at (emax+emin)/2. This parameter will be used when dos_emin and dos_emax are not set."; item.default_value = "0.01"; item.unit = "eV"; - item.availability = ""; read_sync_double(input.dos_scale); this->add_item(item); } @@ -55,7 +52,6 @@ void ReadInput::item_postprocess() * If set, "dos_scale" will be ignored.)"; item.default_value = "Minimal eigenenergy of"; item.unit = "eV"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.dos_emin_ev = doublevalue; para.sys.dos_setemin = true; @@ -73,7 +69,6 @@ void ReadInput::item_postprocess() * If set, "dos_scale" will be ignored.)"; item.default_value = "Maximal eigenenergy of"; item.unit = "eV"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.dos_emax_ev = doublevalue; para.sys.dos_setemax = true; @@ -90,7 +85,6 @@ void ReadInput::item_postprocess() item.description = "The order of Chebyshev expansions when using Stochastic Density Functional Theory (SDFT) to calculate DOS."; item.default_value = "100"; item.unit = ""; - item.availability = ""; read_sync_int(input.dos_nche); this->add_item(item); } @@ -106,7 +100,6 @@ void ReadInput::item_postprocess() * The third parameter determines the total number of voltage points)"; item.default_value = "1.0"; item.unit = "V"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count != 1 && count != 3) @@ -138,7 +131,6 @@ void ReadInput::item_postprocess() item.description = "Specify the path of the three-dimensional space and display LDOS in the form of a two-dimensional color chart, see details in out_ldos. The first three paramenters are the direct coordinates of the start point, the next three paramenters are the direct coordinates of the end point, and the final one is the number of points along the path, whose default is 100."; item.default_value = "0.0 0.0 0.0 0.0 0.0 1.0 100"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count != 6 && count != 7) @@ -170,7 +162,7 @@ void ReadInput::item_postprocess() item.description = "Whether to calculate electronic conductivities."; item.default_value = "False"; item.unit = ""; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_bool(input.cal_cond); this->add_item(item); } @@ -182,7 +174,7 @@ void ReadInput::item_postprocess() item.description = "Control the error of Chebyshev expansions for conductivities."; item.default_value = "1e-8"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_double(input.cond_che_thr); this->add_item(item); } @@ -194,7 +186,7 @@ void ReadInput::item_postprocess() item.description = "Frequency interval () for frequency-dependent conductivities."; item.default_value = "0.1"; item.unit = "eV"; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_double(input.cond_dw); this->add_item(item); } @@ -206,7 +198,7 @@ void ReadInput::item_postprocess() item.description = "Cutoff frequency for frequency-dependent conductivities."; item.default_value = "10.0"; item.unit = "eV"; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_double(input.cond_wcut); this->add_item(item); } @@ -218,7 +210,7 @@ void ReadInput::item_postprocess() item.description = "Time interval () to integrate Onsager coefficients."; item.default_value = "0.02"; item.unit = "a.u."; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_double(input.cond_dt); this->add_item(item); } @@ -231,7 +223,7 @@ void ReadInput::item_postprocess() * If cond_dtbatch = 0: Autoset this parameter to make expansion orders larger than 100.)"; item.default_value = "0"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_int(input.cond_dtbatch); this->add_item(item); } @@ -245,7 +237,6 @@ void ReadInput::item_postprocess() * 2: Lorentzian smearing)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.cond_smear); this->add_item(item); } @@ -257,7 +248,7 @@ void ReadInput::item_postprocess() item.description = "FWHM for conductivities. For Gaussian smearing, ; for Lorentzian smearing, ."; item.default_value = "0.4"; item.unit = "eV"; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_double(input.cond_fwhm); this->add_item(item); } @@ -271,7 +262,7 @@ void ReadInput::item_postprocess() * False: .)"; item.default_value = "True"; item.unit = ""; - item.availability = "basis_type = pw"; + item.set_availability("basis_type==pw"); read_sync_bool(input.cond_nonlocal); this->add_item(item); } @@ -293,7 +284,6 @@ void ReadInput::item_postprocess() * false: Do not calculate Berry phase.)"; item.default_value = "false"; item.unit = ""; - item.availability = ""; read_sync_bool(input.berry_phase); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.berry_phase) @@ -332,7 +322,6 @@ void ReadInput::item_postprocess() * 3: Calculate the polarization in the direction of the lattice vector a_3 defined in the STRU file.)"; item.default_value = "3"; item.unit = ""; - item.availability = ""; read_sync_int(input.gdir); this->add_item(item); } @@ -346,7 +335,6 @@ void ReadInput::item_postprocess() * 0: Do not generate files for the Wannier90 code.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.towannier90); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.towannier90) @@ -376,7 +364,6 @@ void ReadInput::item_postprocess() item.description = "The file name generated when running \"wannier90 -pp ...\" command"; item.default_value = "seedname.nnkp"; item.unit = ""; - item.availability = ""; read_sync_string(input.nnkpfile); this->add_item(item); } @@ -390,7 +377,6 @@ void ReadInput::item_postprocess() * 2: The overlap between atomic orbitals is calculated using grid integration. The radial grid points are generated using the Gauss-Legendre method, while the spherical grid points are generated using the Lebedev-Laikov method.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { /* Developer's notes: on the repair of lcao_in_pw @@ -424,7 +410,6 @@ void ReadInput::item_postprocess() * down: Calculate spin down for the Wannier function.)"; item.default_value = "up"; item.unit = ""; - item.availability = ""; read_sync_string(input.wannier_spin); this->add_item(item); } @@ -438,7 +423,6 @@ void ReadInput::item_postprocess() * 1: write the "*.mmn" file.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wannier_mmn); this->add_item(item); } @@ -452,7 +436,6 @@ void ReadInput::item_postprocess() * 1: write the "*.amn" file.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wannier_amn); this->add_item(item); } @@ -466,7 +449,6 @@ void ReadInput::item_postprocess() * 1: write the "*.eig" file.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wannier_eig); this->add_item(item); } @@ -480,7 +462,6 @@ void ReadInput::item_postprocess() * 1: write the "UNK.*" file.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wannier_unk); this->add_item(item); } @@ -494,7 +475,6 @@ void ReadInput::item_postprocess() * 1: write the "UNK.*" file in ASCII format (text file format).)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wannier_wvfn_formatted); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_inp_relax.cpp b/source/source_io/module_parameter/read_inp_relax.cpp index b038674551d..d3946a2ca4b 100644 --- a/source/source_io/module_parameter/read_inp_relax.cpp +++ b/source/source_io/module_parameter/read_inp_relax.cpp @@ -72,7 +72,6 @@ The second element is not accepted by other methods. [NOTE] In the 3.10-LTS version, the type of this parameter is std::string. It can be set to "cg", "bfgs", "cg_bfgs", "bfgs_trad", "lbfgs", "sd", "fire".)"; item.default_value = "cg 2"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.relax_method = parse_relax_method(item.str_values); }; @@ -87,7 +86,7 @@ The second element is not accepted by other methods. item.description = "The paramether controls the size of the first conjugate gradient step. A smaller value means the first step along a new CG direction is smaller. This might be helpful for large systems, where it is safer to take a smaller initial step to prevent the collapse of the whole configuration."; item.default_value = "0.5"; item.unit = ""; - item.availability = "Only used when relax_method is cg 2"; + item.set_availability("relax_method==\"cg 2\""); read_sync_double(input.relax_scale_force); this->add_item(item); } @@ -99,7 +98,6 @@ The second element is not accepted by other methods. item.description = "The maximal number of ionic iteration steps. If set to 0, the code performs a quick \"dry run\", stopping just after initialization. This is useful to check for input correctness and to have the summary printed."; item.default_value = "1 for SCF, 50 for relax and cell-relax calcualtions"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { const std::string& calculation = para.input.calculation; const std::vector singlelist @@ -130,7 +128,7 @@ The second element is not accepted by other methods. item.description = "When relax_method is set to cg_bfgs, a mixed algorithm of conjugate gradient (CG) and Broyden–Fletcher–Goldfarb–Shanno (BFGS) is used. The ions first move according to the CG method, then switch to the BFGS method when the maximum force on atoms is reduced below this threshold."; item.default_value = "0.5"; item.unit = "eV/Angstrom"; - item.availability = "Only used when relax_method is cg_bfgs"; + item.set_availability("relax_method==cg_bfgs"); read_sync_double(input.relax_cg_thr); this->add_item(item); } @@ -142,7 +140,6 @@ The second element is not accepted by other methods. item.description = "Threshold of the force convergence. The threshold is compared with the largest force among all of the atoms. The recommended value for using atomic orbitals is 0.04 eV/Angstrom (0.0016 Ry/Bohr). The parameter is equivalent to force_thr_ev except for the unit, you can choose either you like."; item.default_value = "0.001"; item.unit = "Ry/Bohr (25.7112 eV/Angstrom)"; - item.availability = ""; // read_sync_double(input.force_thr); item.read_value = [](const Input_Item& item, Parameter& para) { para.input.force_thr = doublevalue; }; item.reset_value = [](const Input_Item& item, Parameter& para) { @@ -173,7 +170,6 @@ The second element is not accepted by other methods. item.description = "Threshold of the force convergence. The threshold is compared with the largest force among all of the atoms. The recommended value for using atomic orbitals is 0.04 eV/Angstrom (0.0016 Ry/Bohr). The parameter is equivalent to force_thr except for the unit. You may choose either you like."; item.default_value = "0.0257112"; item.unit = "eV/Angstrom (0.03889 Ry/Bohr)"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { para.input.force_thr_ev = doublevalue; }; sync_double(input.force_thr_ev); this->add_item(item); @@ -186,7 +182,6 @@ The second element is not accepted by other methods. item.description = "The atomic forces that are smaller than force_zero_out will be treated as zero."; item.default_value = "0.0"; item.unit = "eV/Angstrom"; - item.availability = ""; read_sync_double(input.force_zero_out); this->add_item(item); } @@ -198,7 +193,7 @@ The second element is not accepted by other methods. item.description = "Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the sufficient decrease condition (c1 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177."; item.default_value = "0.01"; item.unit = ""; - item.availability = "Only used when relax_method is bfgs or cg_bfgs"; + item.set_availability("relax_method in [bfgs, cg_bfgs]"); read_sync_double(input.relax_bfgs_w1); this->add_item(item); } @@ -210,7 +205,7 @@ The second element is not accepted by other methods. item.description = "Controls the Wolfe condition for the Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm used in geometry relaxation. This parameter sets the curvature condition (c2 in Wolfe conditions). For more information, see Phys. Chem. Chem. Phys., 2000, 2, 2177."; item.default_value = "0.5"; item.unit = ""; - item.availability = "Only used when relax_method is bfgs or cg_bfgs"; + item.set_availability("relax_method in [bfgs, cg_bfgs]"); read_sync_double(input.relax_bfgs_w2); this->add_item(item); } @@ -222,7 +217,7 @@ The second element is not accepted by other methods. item.description = "Maximum allowed total displacement of all atoms during geometry optimization. The sum of atomic displacements can increase during optimization steps but cannot exceed this value."; item.default_value = "0.8"; item.unit = "Bohr"; - item.availability = "Only used when relax_method is bfgs or cg_bfgs"; + item.set_availability("relax_method in [bfgs, cg_bfgs]"); read_sync_double(input.relax_bfgs_rmax); this->add_item(item); } @@ -234,7 +229,7 @@ The second element is not accepted by other methods. item.description = "Minimum allowed total displacement of all atoms. When the total atomic displacement falls below this value and force convergence is not achieved, the calculation will terminate. Note: This parameter is not used in the default BFGS algorithm (relax_method = bfgs 2 or bfgs)."; item.default_value = "1e-5"; item.unit = "Bohr"; - item.availability = "Only used when relax_method is bfgs 1 (traditional BFGS)"; + item.set_availability("relax_method==\"bfgs 1\""); read_sync_double(input.relax_bfgs_rmin); this->add_item(item); } @@ -246,7 +241,7 @@ The second element is not accepted by other methods. item.description = "Initial total displacement of all atoms in the first BFGS step. This sets the scale for the initial movement."; item.default_value = "0.5"; item.unit = "Bohr"; - item.availability = "Only used when relax_method is bfgs or cg_bfgs"; + item.set_availability("relax_method in [bfgs, cg_bfgs]"); read_sync_double(input.relax_bfgs_init); this->add_item(item); } @@ -258,7 +253,6 @@ The second element is not accepted by other methods. item.description = "The threshold of the stress convergence. The threshold is compared with the largest component of the stress tensor."; item.default_value = "0.5"; item.unit = "kbar"; - item.availability = ""; read_sync_double(input.stress_thr); this->add_item(item); } @@ -270,7 +264,6 @@ The second element is not accepted by other methods. item.description = "The external pressures along three axes. Positive input value is taken as compressive stress."; item.default_value = "0"; item.unit = "kbar"; - item.availability = ""; read_sync_double(input.press1); this->add_item(item); } @@ -282,7 +275,6 @@ The second element is not accepted by other methods. item.description = "The external pressures along three axes. Positive input value is taken as compressive stress."; item.default_value = "0"; item.unit = "kbar"; - item.availability = ""; read_sync_double(input.press2); this->add_item(item); } @@ -294,7 +286,6 @@ The second element is not accepted by other methods. item.description = "The external pressures along three axes. Positive input value is taken as compressive stress."; item.default_value = "0"; item.unit = "kbar"; - item.availability = ""; read_sync_double(input.press3); this->add_item(item); } @@ -322,7 +313,7 @@ With relax_method set to cg 1, bfgs, lbfgs, sd, or cg_bfgs, None and a, b, c, ab [NOTE] For VASP users, see the ISIF correspondence table in the geometry optimization documentation.)"; item.default_value = "None"; item.unit = ""; - item.availability = "Only used when calculation is set to cell-relax"; + item.set_availability("calculation==cell-relax"); read_sync_string(input.fixed_axes); item.check_value = [](const Input_Item& item, const Parameter& para) { if ((para.input.fixed_axes == "shape" || para.input.fixed_axes == "volume") @@ -344,7 +335,7 @@ With relax_method set to cg 1, bfgs, lbfgs, sd, or cg_bfgs, None and a, b, c, ab [NOTE] Note: it is possible to use fixed_ibrav with fixed_axes, but please make sure you know what you are doing. For example, if we are doing relaxation of a simple cubic lattice (latname = "sc"), and we use fixed_ibrav along with fixed_axes = "volume", then the cell is never allowed to move and as a result, the relaxation never converges. When both are used, fixed_ibrav is applied first, then fixed_axes = "volume" rescaling is applied.)"; item.default_value = "False"; item.unit = ""; - item.availability = "Only used with relax_method = cg 2. A specific latname must be provided."; + item.set_availability("relax_method==\"cg 2\" and latname!=none"); read_sync_bool(input.fixed_ibrav); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.fixed_ibrav && !para.input.uses_simultaneous_relaxation()) @@ -368,7 +359,6 @@ With relax_method set to cg 1, bfgs, lbfgs, sd, or cg_bfgs, None and a, b, c, ab * False: No restrictions are exerted on positions of all atoms. However, users can still fix certain components of certain atoms by using the m keyword in STRU file. For the latter option, check the end of this instruction.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.fixed_atoms); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.fixed_atoms && para.input.calculation == "relax") diff --git a/source/source_io/module_parameter/read_inp_sys.cpp b/source/source_io/module_parameter/read_inp_sys.cpp index 74b21ae33d3..015314956e5 100644 --- a/source/source_io/module_parameter/read_inp_sys.cpp +++ b/source/source_io/module_parameter/read_inp_sys.cpp @@ -260,7 +260,7 @@ void ReadInput::item_system() "* False: quit with an error message\n" "* True: automatically set symmetry to 0 and continue running without symmetry analysis"; item.default_value = "True"; - item.availability = "symmetry==1"; + item.set_availability("symmetry==1"); read_sync_bool(input.symmetry_autoclose); this->add_item(item); } @@ -547,7 +547,7 @@ Available options are: * 0: no memory saving techniques are used. * 1: a memory saving technique will be used for many k point calculations.)"; item.default_value = "0"; - item.availability = "Used only for nscf calculations with plane wave basis set."; + item.set_availability("calculation==nscf and basis_type==pw"); read_sync_int(input.mem_saver); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mem_saver == 1) @@ -593,7 +593,7 @@ Available options are: item.description = R"(* 0: it will be set to the number of MPI processes. * >0: it specifies the number of processes used for carrying out diagonalization. Must be less than or equal to total number of MPI processes.)"; item.default_value = "0"; - item.availability = "Used only for plane wave basis set."; + item.set_availability("basis_type==pw"); read_sync_int(input.diago_proc); item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.diago_proc == 0) @@ -773,7 +773,7 @@ Available options are: * single: single precision * double: double precision)"; item.default_value = "double"; - item.availability = "Used only for plane wave basis set."; + item.set_availability("basis_type==pw"); read_sync_string(input.precision); item.check_value = [](const Input_Item& item, const Parameter& para) { std::vector avail_list = {"single", "double"}; @@ -811,7 +811,7 @@ Available options are: * double: double precision * mix: mixed precision, starting from single precision and switching to double precision when the SCF residual becomes small enough)"; item.default_value = "double"; - item.availability = "Used only for LCAO basis set."; + item.set_availability("basis_type==lcao"); read_sync_string(input.gint_precision); item.check_value = [](const Input_Item& item, const Parameter& para) { std::vector avail_list = {"single", "double", "mix"}; @@ -1164,7 +1164,7 @@ Available options are: item.type = "Integer"; item.description = "Specify the random seed to initialize wave functions. Only positive integers are available."; item.default_value = "0"; - item.availability = "Only used for plane wave basis."; + item.set_availability("basis_type==pw"); read_sync_int(input.pw_seed); this->add_item(item); } @@ -1325,7 +1325,7 @@ Available options are: item.description = "If restart_save is set to true and an electronic iteration is finished, calculations can be " "restarted from the charge density file, which are saved in the former calculation."; item.default_value = "False"; - item.availability = "Used only when numerical atomic orbitals are employed as basis set."; + item.set_availability("basis_type==lcao"); read_sync_bool(input.restart_load); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_inp_tddft.cpp b/source/source_io/module_parameter/read_inp_tddft.cpp index d72cecc507f..695d9d36fff 100644 --- a/source/source_io/module_parameter/read_inp_tddft.cpp +++ b/source/source_io/module_parameter/read_inp_tddft.cpp @@ -163,7 +163,6 @@ void ReadInput::item_rt_tddft() item.description = "The number of electronic propagation steps between two ionic steps."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.estep_per_md); this->add_item(item); } @@ -176,7 +175,6 @@ void ReadInput::item_rt_tddft() item.description = R"(The time step used for electronic propagation. If td_dt is not specified, it is set to md_dt / estep_per_md. If td_dt is specified explicitly, md_dt is reset to td_dt * estep_per_md.)"; item.default_value = "md_dt / estep_per_md"; item.unit = "fs"; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.td_dt == -1.0) { @@ -197,7 +195,6 @@ void ReadInput::item_rt_tddft() * 1: Use the ground-state eigenvalue-weighted expression $\mathrm{EDM}_{\mu\nu,\boldsymbol{k}}=\sum_i w_{i\boldsymbol{k}}\epsilon_{i\boldsymbol{k}}C_{\mu i,\boldsymbol{k}}C_{\nu i,\boldsymbol{k}}^*$. This expression is deprecated for RT-TDDFT and is generally not valid when the propagated wave functions are not Hamiltonian eigenstates.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.td_edm); this->add_item(item); } @@ -211,7 +208,6 @@ void ReadInput::item_rt_tddft() * $\geqslant 0$: Print an element when either $\left|\operatorname{Re}E_{ij}\right|$ or $\left|\operatorname{Im}E_{ij}\right|$ is greater than or equal to td_print_eij.)"; item.default_value = "-1"; item.unit = "Ry"; - item.availability = ""; read_sync_double(input.td_print_eij); this->add_item(item); } @@ -229,7 +225,6 @@ void ReadInput::item_rt_tddft() [NOTE] GPU execution currently supports only method 0 in both single-GPU and multi-GPU solver configurations. CPU execution supports methods 0 through 3.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.propagator); this->add_item(item); } @@ -243,7 +238,6 @@ void ReadInput::item_rt_tddft() * False: No external electric field.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.td_vext); this->add_item(item); } @@ -258,7 +252,6 @@ void ReadInput::item_rt_tddft() * 3: The external field direction is along the z-axis.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_vext_dire); }; @@ -276,7 +269,6 @@ void ReadInput::item_rt_tddft() * 2: Hybrid gauge. See J. Chem. Theory Comput. 2025, 21, 3335-3341 for more information.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.td_stype); this->add_item(item); } @@ -297,7 +289,6 @@ The formulas below use Hartree atomic units. For every ordinary input frequency In the velocity and hybrid gauges, ABACUS obtains the vector potential actually used in propagation by Simpson integration of the selected electric fields, including the supersine field, so a residual at the numerical-quadrature accuracy scale may remain.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_ttype); }; @@ -313,7 +304,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(First electronic step at which the time-dependent electric field is active. The interval from td_tstart through td_tend includes both endpoints. On each active step $n$, the velocity and hybrid gauges integrate the field over $[n\Delta t,(n+1)\Delta t]$, where $\Delta t=\mathtt{td\_dt}$.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.td_tstart); this->add_item(item); } @@ -325,7 +315,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Last electronic step at which the time-dependent electric field is active. The interval from td_tstart through td_tend includes both endpoints. On each active step $n$, the velocity and hybrid gauges integrate the field over $[n\Delta t,(n+1)\Delta t]$, where $\Delta t=\mathtt{td\_dt}$.)"; item.default_value = "1000"; item.unit = ""; - item.availability = ""; read_sync_int(input.td_tend); this->add_item(item); } @@ -337,7 +326,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Lower fractional-coordinate cutoff for the periodic spatial modulation used in the length gauge. Let $c_1=\mathtt{td\_lcut1}$, $c_2=\mathtt{td\_lcut2}$, $D=c_2-c_1$, and $G=c_1+1-c_2$. For a fractional coordinate $x$, the field factor is $\eta(x)=1$ when $c_1\leqslant x\lt c_2$ and $\eta(x)=-D/G$ elsewhere. The reversed outer interval makes the potential periodic and continuous and gives the field zero cell average.)"; item.default_value = "0.05"; item.unit = ""; - item.availability = ""; read_sync_double(input.td_lcut1); this->add_item(item); } @@ -349,7 +337,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Upper fractional-coordinate cutoff for the periodic spatial modulation used in the length gauge. Let $c_1=\mathtt{td\_lcut1}$, $c_2=\mathtt{td\_lcut2}$, $D=c_2-c_1$, and $G=c_1+1-c_2$. For a fractional coordinate $x$, the field factor is $\eta(x)=1$ when $c_1\leqslant x\lt c_2$ and $\eta(x)=-D/G$ elsewhere. The reversed outer interval makes the potential periodic and continuous and gives the field zero cell average.)"; item.default_value = "0.95"; item.unit = ""; - item.availability = ""; read_sync_double(input.td_lcut2); this->add_item(item); } @@ -361,7 +348,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Ordinary frequency $f$ in the Gaussian-pulse formula, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order.)"; item.default_value = "22.13"; item.unit = "1/fs"; - item.availability = "td_ttype contains 0"; + item.set_availability("td_ttype contains 0"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_gauss_freq); }; @@ -376,7 +363,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Carrier phase $\varphi$ in the Gaussian-pulse formula. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order.)"; item.default_value = "0.0"; item.unit = "rad"; - item.availability = "td_ttype contains 0"; + item.set_availability("td_ttype contains 0"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_gauss_phase); }; @@ -391,7 +378,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Nonzero standard deviation $\sigma$ of the Gaussian envelope. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order.)"; item.default_value = "30.0"; item.unit = "fs"; - item.availability = "td_ttype contains 0"; + item.set_availability("td_ttype contains 0"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_gauss_sigma); }; @@ -406,7 +393,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electronic-step position of the Gaussian center, which defines $t_0=\mathtt{td\_gauss\_t0}\Delta t$. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order.)"; item.default_value = "100"; item.unit = ""; - item.availability = "td_ttype contains 0"; + item.set_availability("td_ttype contains 0"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_gauss_t0); }; @@ -421,7 +408,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electric-field scale $E_0$ in the Gaussian-pulse formula. Supply exactly one value for each td_ttype 0 occurrence, in occurrence order.)"; item.default_value = "0.25"; item.unit = "V/Angstrom"; - item.availability = "td_ttype contains 0"; + item.set_availability("td_ttype contains 0"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_gauss_amp); }; @@ -436,7 +423,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Ordinary carrier frequency $f$ in the trapezoid-pulse formula, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "1.60"; item.unit = "1/fs"; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_freq); }; @@ -451,7 +438,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Carrier phase $\varphi$ in the trapezoid-pulse formula. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "0.0"; item.unit = "rad"; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_phase); }; @@ -466,7 +453,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electronic step defining the end of the linear rise, $t_1=\mathtt{td\_trape\_t1}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "1875"; item.unit = ""; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_t1); }; @@ -481,7 +468,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electronic step defining the end of the plateau, $t_2=\mathtt{td\_trape\_t2}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "5625"; item.unit = ""; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_t2); }; @@ -496,7 +483,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electronic step defining the end of the linear fall, $t_3=\mathtt{td\_trape\_t3}\Delta t$. Each field must satisfy td_trape_t1 <= td_trape_t2 <= td_trape_t3. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "7500"; item.unit = ""; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_t3); }; @@ -511,7 +498,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electric-field scale $E_0$ in the trapezoid-pulse formula. Supply exactly one value for each td_ttype 1 occurrence, in occurrence order.)"; item.default_value = "2.74"; item.unit = "V/Angstrom"; - item.availability = "td_ttype contains 1"; + item.set_availability("td_ttype contains 1"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trape_amp); }; @@ -526,7 +513,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(First ordinary frequency $f_1$ in the trigonometric-pulse formula, with $\omega_1=2\pi f_1$. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order.)"; item.default_value = "1.164656"; item.unit = "1/fs"; - item.availability = "td_ttype contains 2"; + item.set_availability("td_ttype contains 2"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trigo_freq1); }; @@ -541,7 +528,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Second ordinary frequency $f_2$ in the trigonometric-pulse formula, with $\omega_2=2\pi f_2$. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order.)"; item.default_value = "0.029116"; item.unit = "1/fs"; - item.availability = "td_ttype contains 2"; + item.set_availability("td_ttype contains 2"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trigo_freq2); }; @@ -556,7 +543,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Carrier phase $\varphi_1$ in the cosine factor of the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order.)"; item.default_value = "0.0"; item.unit = "rad"; - item.availability = "td_ttype contains 2"; + item.set_availability("td_ttype contains 2"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trigo_phase1); }; @@ -571,7 +558,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Envelope phase $\varphi_2$ in the sine-squared factor of the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order.)"; item.default_value = "0.0"; item.unit = "rad"; - item.availability = "td_ttype contains 2"; + item.set_availability("td_ttype contains 2"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trigo_phase2); }; @@ -586,7 +573,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electric-field scale $E_0$ in the trigonometric-pulse formula. Supply exactly one value for each td_ttype 2 occurrence, in occurrence order.)"; item.default_value = "2.74"; item.unit = "V/Angstrom"; - item.availability = "td_ttype contains 2"; + item.set_availability("td_ttype contains 2"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_trigo_amp); }; @@ -601,7 +588,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electronic switch step $n_0$ in the Heaviside-pulse definition. The field is $E_0$ for $n\lt n_0$ and zero for $n\geqslant n_0$. Supply exactly one value for each td_ttype 3 occurrence, in occurrence order.)"; item.default_value = "100"; item.unit = ""; - item.availability = "td_ttype contains 3"; + item.set_availability("td_ttype contains 3"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_heavi_t0); }; @@ -616,7 +603,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electric-field scale $E_0$ in the Heaviside-pulse definition. Supply exactly one value for each td_ttype 3 occurrence, in occurrence order.)"; item.default_value = "1.0"; item.unit = "V/Angstrom"; - item.availability = "td_ttype contains 3"; + item.set_availability("td_ttype contains 3"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_heavi_amp); }; @@ -631,7 +618,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Carrier electric-field scale $E_0$ of each supersine pulse. This is not a normalization of the complete waveform maximum, because the envelope-derivative term also contributes. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order.)"; item.default_value = "0.27"; item.unit = "V/Angstrom"; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_supsine_amp); }; @@ -646,7 +633,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Nonzero ordinary carrier frequency $f$ of each supersine pulse, with $\omega=2\pi f$. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order.)"; item.default_value = "0.18737028625"; item.unit = "1/fs"; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_supsine_freq); }; @@ -661,7 +648,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Electric-field carrier phase $\varphi$ at the center of each supersine envelope. A value of 0 places a cosine carrier maximum at the envelope center. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order.)"; item.default_value = "0.0"; item.unit = "rad"; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_supsine_phase); }; @@ -676,7 +663,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Dimensionless shape parameter $\sigma$ of each supersine envelope. It must satisfy $0\lt\sigma\lt\pi/2$ so that the electric field approaches zero at the pulse boundaries. Supply exactly one value for each td_ttype 4 occurrence, in occurrence order.)"; item.default_value = "0.75"; item.unit = ""; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.td_supsine_sigma); }; @@ -691,7 +678,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Integer electronic step at the left, exactly zero boundary of each supersine pulse, defining $t_{\mathrm{s}}=\mathtt{td\_supsine\_tstart}\Delta t$. Supply exactly one integer or default token for each td_ttype 4 occurrence, in occurrence order; each default token inherits td_tstart. The complete pulse support must lie inside the inclusive global td_tstart to td_tend interval; hard truncation of a supersine pulse is rejected.)"; item.default_value = "default"; item.unit = ""; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.reset_value = [](const Input_Item& item, Parameter& para) { para.input.td_supsine_tstart = parse_supersine_steps(item, para.input.td_tstart); }; @@ -709,7 +696,7 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually item.description = R"(Integer electronic step at the right, exactly zero boundary of each supersine pulse, defining $t_{\mathrm{e}}=\mathtt{td\_supsine\_tend}\Delta t$. Supply exactly one integer or default token for each td_ttype 4 occurrence, in occurrence order; each default token inherits td_tend. The complete pulse support must lie inside the inclusive global td_tstart to td_tend interval; hard truncation of a supersine pulse is rejected.)"; item.default_value = "default"; item.unit = ""; - item.availability = "td_ttype contains 4"; + item.set_availability("td_ttype contains 4"); item.reset_value = [](const Input_Item& item, Parameter& para) { para.input.td_supsine_tend = parse_supersine_steps(item, para.input.td_tend); }; @@ -729,7 +716,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually * False: Obtain the vector potential by integrating the configured electric field.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.init_vecpot_file); this->add_item(item); } @@ -743,7 +729,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually * False: Keep the occupations determined by the initial SCF.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.ocp); this->add_item(item); } @@ -758,7 +743,6 @@ In the velocity and hybrid gauges, ABACUS obtains the vector potential actually * The sum of all weights must equal nelec; otherwise the calculation terminates with an error.)"; item.default_value = "None"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { parse_expression(item.str_values, para.input.ocp_kb); }; @@ -788,7 +772,7 @@ void ReadInput::item_tdofdft() * False: Not added the CD potential.)"; item.default_value = "False"; item.unit = ""; - item.availability = "TDOFDFT"; + item.set_availability("esolver_type==tdofdft"); read_sync_bool(input.of_cd); this->add_item(item); } @@ -800,7 +784,7 @@ void ReadInput::item_tdofdft() item.description = "The value of the parameter alpha in modified CD potential method. mCDPotential=alpha*CDPotential (proposed in paper PhysRevB.98.144302)"; item.default_value = "1.0"; item.unit = ""; - item.availability = "TDOFDFT"; + item.set_availability("esolver_type==tdofdft"); read_sync_double(input.of_mCD_alpha); this->add_item(item); } @@ -818,7 +802,6 @@ void ReadInput::item_lr_tddft() item.description = "The exchange-correlation kernel used in the calculation. Currently supported: RPA, LDA, PBE, HSE, HF."; item.default_value = "LDA"; item.unit = ""; - item.availability = ""; read_sync_string(input.xc_kernel); this->add_item(item); } @@ -833,7 +816,6 @@ void ReadInput::item_lr_tddft() * "from_charge_file": Calculate fxc from the charge density read from the provided files. The following words should be the paths of ".cube" files, where the first nspin files will be read in.)"; item.default_value = "\"default\""; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); auto& ifxc = para.input.lr_init_xc_kernel; @@ -856,7 +838,6 @@ void ReadInput::item_lr_tddft() * spectrum: Calculate absorption spectrum only without solving Casida equation.)"; item.default_value = "dav"; item.unit = ""; - item.availability = ""; read_sync_string(input.lr_solver); this->add_item(item); } @@ -868,7 +849,6 @@ void ReadInput::item_lr_tddft() item.description = "The convergence threshold of iterative diagonalization solver for LR-TDDFT. It is a pure-math number with the same meaning as pw_diag_thr, but since the Casida equation is a one-shot eigenvalue problem, it is also the convergence threshold of LR-TDDFT."; item.default_value = "1e-2"; item.unit = ""; - item.availability = ""; read_sync_double(input.lr_thr); this->add_item(item); } @@ -881,7 +861,6 @@ void ReadInput::item_lr_tddft() * Note: If the value is illegal ( > nelec/2 or <= 0), it will be autoset to nelec/2.)"; item.default_value = "nband"; item.unit = ""; - item.availability = ""; read_sync_int(input.nocc); item.reset_value = [](const Input_Item& item, Parameter& para) { const int nocc_default = std::max(static_cast(para.input.nelec + 1) / 2, para.input.nbands); @@ -897,7 +876,6 @@ void ReadInput::item_lr_tddft() item.description = "The number of virtual orbitals (starting from LUMO) used in the LR-TDDFT calculation."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.nvirt); this->add_item(item); } @@ -910,7 +888,6 @@ void ReadInput::item_lr_tddft() item.description = "The number of 2-particle states to be solved."; item.default_value = "0"; item.unit = ""; - item.availability = ""; read_sync_int(input.lr_nstates); this->add_item(item); } @@ -924,7 +901,6 @@ void ReadInput::item_lr_tddft() * False: Use unrestricted LR-TDDFT only when the system is open-shell.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.lr_unrestricted); this->add_item(item); } @@ -936,7 +912,6 @@ void ReadInput::item_lr_tddft() item.description = "The range of the wavelength for the absorption spectrum calculation."; item.default_value = "0.0 0.0"; item.unit = "nm"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); for (int i = 0; i < count; i++) @@ -955,7 +930,6 @@ void ReadInput::item_lr_tddft() item.description = "Whether to output the eigenstates (excitation energy) and eigenvectors (excitation amplitude) of the LR-TDDFT calculation. The output files are OUT.{suffix}/Excitation_Amplitude_${processor_rank}.dat."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.out_wfc_lr); this->add_item(item); } @@ -967,7 +941,6 @@ void ReadInput::item_lr_tddft() item.description = "Whether to use length or velocity gauge to calculate the absorption spectrum in LR-TDDFT."; item.default_value = "velocity"; item.unit = ""; - item.availability = ""; read_sync_string(input.abs_gauge); this->add_item(item); } @@ -979,7 +952,6 @@ void ReadInput::item_lr_tddft() item.description = "The broadening factor for the absorption spectrum calculation."; item.default_value = "0.01"; item.unit = ""; - item.availability = ""; read_sync_double(input.abs_broadening); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_input.cpp b/source/source_io/module_parameter/read_input.cpp index 30d6b68551e..0c1c642939d 100644 --- a/source/source_io/module_parameter/read_input.cpp +++ b/source/source_io/module_parameter/read_input.cpp @@ -1,4 +1,5 @@ #include "read_input.h" +#include "availability_validator.h" #include @@ -180,6 +181,26 @@ ReadInput::ReadInput(const int& rank) this->item_exx(); this->item_dftu(); this->item_others(); + + if (!this->input_lists.empty()) + { + std::map parameter_types; + std::map expressions; + for (const auto& entry : this->input_lists) + { + parameter_types[entry.first] = availability_value_kind(entry.second.type); + expressions[entry.first] = entry.second.get_availability_expr(); + } + for (const auto& entry : this->input_lists) + { + validate_availability_expr(entry.first, + entry.second.get_availability_expr(), + parameter_types); + validate_availability_self_contained(entry.first, + entry.second.get_availability_expr(), + expressions); + } + } } void ReadInput::read_parameters(Parameter& param, const std::string& filename_in) diff --git a/source/source_io/module_parameter/read_input_item_md.cpp b/source/source_io/module_parameter/read_input_item_md.cpp index ac9054cc119..ab54c3f026d 100644 --- a/source/source_io/module_parameter/read_input_item_md.cpp +++ b/source/source_io/module_parameter/read_input_item_md.cpp @@ -25,7 +25,6 @@ void ReadInput::item_md() * msst: MSST method, see msst_direction, msst_vel, msst_qmass, msst_vis, msst_tscale in detail.)"; item.default_value = "nvt"; item.unit = ""; - item.availability = ""; read_sync_string(input.mdp.md_type); this->add_item(item); } @@ -37,7 +36,6 @@ void ReadInput::item_md() item.description = "The total number of molecular dynamics steps."; item.default_value = "10"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mdp.md_nstep == 0 && para.input.esolver_type != "tddft") { @@ -56,7 +54,6 @@ void ReadInput::item_md() item.description = "The time step used in molecular dynamics calculations."; item.default_value = "1.0"; item.unit = "fs"; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.mdp.md_dt < 0) { ModuleBase::WARNING_QUIT("ReadInput", "time interval of MD calculation should be positive"); @@ -87,7 +84,6 @@ void ReadInput::item_md() * csvr: Canonical Sampling through Velocity Rescaling, see md_csvr_tau in detail.)"; item.default_value = "nhc"; item.unit = ""; - item.availability = ""; read_sync_string(input.mdp.md_thermostat); this->add_item(item); } @@ -105,7 +101,6 @@ If md_tfirst is set to a positive value and init_vel is true simultaneously, ple Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or less than zero, md_tlast is set to md_tfirst. If md_tlast is set to be different from md_tfirst, ABACUS will automatically change the temperature from md_tfirst to md_tlast.)"; item.default_value = "No default"; item.unit = "K"; - item.availability = ""; read_sync_double(input.mdp.md_tfirst); this->add_item(item); } @@ -123,7 +118,6 @@ If md_tfirst is set to a positive value and init_vel is true simultaneously, ple Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or less than zero, md_tlast is set to md_tfirst. If md_tlast is set to be different from md_tfirst, ABACUS will automatically change the temperature from md_tfirst to md_tlast.)"; item.default_value = "No default"; item.unit = "K"; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.mdp.md_tlast < 0) { @@ -143,7 +137,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or * 2: FFT grids change per step. This level is suitable for cases where the variation of the volume and shape is large, such as the MSST method. However, accuracy comes at the cost of efficiency.)"; item.default_value = "0"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.calculation != "md") { @@ -168,7 +161,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or * False: ABACUS will start molecular dynamics calculations normally from the first step.)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.mdp.md_restart); this->add_item(item); } @@ -180,7 +172,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or item.description = "The output frequency of OUT.{suffix}/STRIU/, which are used to restart molecular dynamics calculations, see md_restart in detail."; item.default_value = "5"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_restartfreq); this->add_item(item); } @@ -192,7 +183,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or item.description = "The output frequency of OUT.${suffix}/MD_dump in molecular dynamics calculations, which including the information of lattices and atoms."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_dumpfreq); this->add_item(item); } @@ -204,7 +194,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or item.description = "Whether to output atomic forces into the file OUT.${suffix}/MD_dump."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.mdp.dump_force); this->add_item(item); } @@ -216,7 +205,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or item.description = "Whether to output atomic velocities into the file OUT.${suffix}/MD_dump."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.mdp.dump_vel); this->add_item(item); } @@ -228,7 +216,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or item.description = "Whether to output lattice virials into the file OUT.${suffix}/MD_dump."; item.default_value = "True"; item.unit = ""; - item.availability = ""; read_sync_bool(input.mdp.dump_virial); this->add_item(item); } @@ -242,7 +229,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or * >= 0: The function srand(md_seed) is called.)"; item.default_value = "-1"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_seed); this->add_item(item); } @@ -256,7 +242,6 @@ Note that md_tlast is only used in NVT/NPT simulations. If md_tlast is unset or Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to 1/(100*md_dt). An improper choice might lead to the failure of jobs.)"; item.default_value = "1/40/md_dt"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mdp.md_tfreq == 0 && para.input.calculation == "md") { @@ -274,7 +259,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to item.description = "Number of thermostats coupled with the particles in the NVT/NPT ensemble based on the Nose-Hoover style non-Hamiltonian equations of motion."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_tchain); this->add_item(item); } @@ -288,7 +272,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to * 2: FFT grids change per step. This level is suitable for cases where the variation of the volume and shape is large, such as the MSST method. However, accuracy comes at the cost of efficiency.)"; item.default_value = "iso"; item.unit = ""; - item.availability = ""; read_sync_string(input.mdp.md_pmode); this->add_item(item); } @@ -300,7 +283,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to item.description = "Construct a reference cell bigger than the initial cell. The reference cell has to be large enough so that the lattice vectors of the fluctuating cell do not exceed the reference lattice vectors during MD. Typically, 1.02 ~ 1.10 is sufficient. However, the cell fluctuations depend on the specific system and thermodynamic conditions. So users must test for a proper choice. This parameters should be used in conjunction with erf_ecut, erf_height, and erf_sigma."; item.default_value = "1.0"; item.unit = ""; - item.availability = ""; read_sync_double(input.ref_cell_factor); this->add_item(item); } @@ -317,7 +299,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to * yz: Lattice vectors y and z scale proportionally.)"; item.default_value = "none"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.mdp.md_pmode == "iso") { @@ -335,7 +316,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to item.description = "The target pressure used in NPT ensemble simulations, the default value of md_plast is md_pfirst. If md_plast is set to be different from md_pfirst, ABACUS will automatically change the target pressure from md_pfirst to md_plast."; item.default_value = "-1.0"; item.unit = "kbar"; - item.availability = ""; read_sync_double(input.mdp.md_pfirst); this->add_item(item); } @@ -347,7 +327,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to item.description = "The target pressure used in NPT ensemble simulations, the default value of md_plast is md_pfirst. If md_plast is set to be different from md_pfirst, ABACUS will automatically change the target pressure from md_pfirst to md_plast."; item.default_value = "-1.0"; item.unit = "kbar"; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (!item.is_read()) { // no md_plast in INPUT para.input.mdp.md_plast = para.input.mdp.md_pfirst; @@ -367,7 +346,6 @@ Note: It is a system-dependent empirical parameter, ranging from 1/(40*md_dt) to Note: It is a system-dependent empirical parameter. An improper choice might lead to the failure of jobs.)"; item.default_value = "1/400/md_dt"; item.unit = ""; - item.availability = ""; item.reset_value = [](const Input_Item& item, Parameter& para) { if (para.input.mdp.md_pfreq == 0 && para.input.calculation == "md") { @@ -385,7 +363,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The number of thermostats coupled with the barostat in the NPT ensemble based on the Nose-Hoover style non-Hamiltonian equations of motion."; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_pchain); this->add_item(item); } @@ -397,7 +374,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The Lennard-Jones potential between two atoms equals: $\\sigma_k\\sigma(i,j)$"; item.default_value = "2"; item.unit = ""; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.esolver_type == "lj" && para.input.mdp.lj_rule != 1 && para.input.mdp.lj_rule != 2) { @@ -415,7 +391,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "It True, the LJ potential is shifted by a constant such that it is zero at the cut-off distance."; item.default_value = "False"; item.unit = ""; - item.availability = ""; read_sync_bool(input.mdp.lj_eshift); this->add_item(item); } @@ -427,7 +402,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "Cut-off radius for Leonard Jones potential, beyond which the interaction will be neglected. It can be a single value, which means that all pairs of atoms types share the same cut-off radius. Otherwise, it should be a multiple-component vector, containing values, see details in lj_rule."; item.default_value = "No default"; item.unit = "Angstrom"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); para.input.mdp.lj_rcut.resize(count); @@ -464,7 +438,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The vector representing the matrix for Leonard Jones potential. See details in lj_rule."; item.default_value = "No default"; item.unit = "eV"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); para.input.mdp.lj_epsilon.resize(count); @@ -494,7 +467,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The vector representing the matrix for Leonard Jones potential. See details in lj_rule."; item.default_value = "No default"; item.unit = "Angstrom"; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); para.input.mdp.lj_sigma.resize(count); @@ -524,7 +496,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The filename of DP/NEP potential files, see md.md in detail."; item.default_value = "graph.pb"; item.unit = ""; - item.availability = ""; read_sync_string(input.mdp.pot_file); this->add_item(item); } @@ -536,7 +507,7 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "Rescaling factor to use a temperature-dependent DP. Energy, stress and force calculated by DP will be multiplied by this factor."; item.default_value = "1.0"; item.unit = ""; - item.availability = "esolver_type = dp."; + item.set_availability("esolver_type==dp"); read_sync_double(input.mdp.dp_rescaling); this->add_item(item); } @@ -548,7 +519,7 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The frame parameter for dp potential. The array size is dim_fparam, then all frames are assumed to be provided with the same fparam."; item.default_value = "{}"; item.unit = ""; - item.availability = "esolver_type = dp."; + item.set_availability("esolver_type==dp"); item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); para.input.mdp.dp_fparam.resize(count); @@ -568,7 +539,7 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The atomic parameter for dp potential. The array size can be (1) natoms x dim_aparam, then all frames are assumed to be provided with the same aparam; (2) dim_aparam, then all frames and atoms are assumed to be provided with the same aparam."; item.default_value = "{}"; item.unit = ""; - item.availability = "esolver_type = dp."; + item.set_availability("esolver_type==dp"); item.read_value = [](const Input_Item& item, Parameter& para) { size_t count = item.get_size(); para.input.mdp.dp_aparam.resize(count); @@ -591,7 +562,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea * 2: z direction)"; item.default_value = "2"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.msst_direction); this->add_item(item); } @@ -603,7 +573,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The velocity of the shock wave in the MSST method."; item.default_value = "0.0"; item.unit = "Angstrom/fs"; - item.availability = ""; read_sync_double(input.mdp.msst_vel); this->add_item(item); } @@ -615,7 +584,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "Artificial viscosity in the MSST method."; item.default_value = "0.0"; item.unit = "g/(mol*Angstrom*fs)"; - item.availability = ""; read_sync_double(input.mdp.msst_vis); this->add_item(item); } @@ -627,7 +595,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The reduction percentage of the initial temperature used to compress volume in the MSST method."; item.default_value = "0.01"; item.unit = ""; - item.availability = ""; read_sync_double(input.mdp.msst_tscale); this->add_item(item); } @@ -639,7 +606,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "Inertia of the extended system variable. You should set a number larger than 0."; item.default_value = "No default"; item.unit = ""; - item.availability = ""; item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.mdp.msst_qmass <= 0) { @@ -658,7 +624,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The damping parameter used to add fictitious force in the Langevin method."; item.default_value = "1.0"; item.unit = "fs"; - item.availability = ""; read_sync_double(input.mdp.md_damp); this->add_item(item); } @@ -672,7 +637,7 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea "stronger coupling. Recommended value: 100 * md_dt."; item.default_value = "100.0"; item.unit = "fs"; - item.availability = "md_thermostat = csvr"; + item.set_availability("md_thermostat==csvr"); read_sync_double(input.mdp.md_csvr_tau); this->add_item(item); } @@ -684,7 +649,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The temperature tolerance for velocity rescaling. Velocities are rescaled if the current and target temperature differ more than md_tolerance."; item.default_value = "100.0"; item.unit = "K"; - item.availability = ""; read_sync_double(input.mdp.md_tolerance); this->add_item(item); } @@ -698,7 +662,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea * Rescale_v: Every md_nraise steps the current temperature is rescaled to the target temperature.)"; item.default_value = "1"; item.unit = ""; - item.availability = ""; read_sync_int(input.mdp.md_nraise); this->add_item(item); } @@ -716,7 +679,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea [NOTE] Only works with LCAO basis and molecular dynamics calculations. Requires atomic velocities. Output starts from the second MD step (istep > 0).)"; item.default_value = "False"; item.unit = ""; - item.availability = ""; item.read_value = [](const Input_Item& item, Parameter& para) { const size_t count = item.get_size(); if (count < 1) ModuleBase::WARNING_QUIT("ReadInput", "cal_syns needs at least 1 value"); @@ -738,7 +700,6 @@ Note: It is a system-dependent empirical parameter. An improper choice might lea item.description = "The maximum displacement of all atoms in one step. This parameter is useful when cal_syns = True."; item.default_value = "0.01"; item.unit = "bohr"; - item.availability = ""; read_sync_double(input.dmax); this->add_item(item); } diff --git a/source/source_io/module_parameter/read_input_item_sdft.cpp b/source/source_io/module_parameter/read_input_item_sdft.cpp index 2df4f2d6616..6924fa8b300 100644 --- a/source/source_io/module_parameter/read_input_item_sdft.cpp +++ b/source/source_io/module_parameter/read_input_item_sdft.cpp @@ -22,7 +22,7 @@ void ReadInput::item_sdft() * other: use 2)"; item.default_value = "2"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_int(input.method_sto); item.check_value = [](const Input_Item& item, const Parameter& para) { if (para.input.method_sto != 1 && para.input.method_sto != 2) @@ -43,7 +43,7 @@ void ReadInput::item_sdft() * all: All complete basis sets are used to replace stochastic orbitals with the Chebyshev method (CT), resulting in the same results as KSDFT without stochastic errors.)"; item.default_value = "256"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); item.read_value = [](const Input_Item& item, Parameter& para) { std::string nbandsto_str = strvalue; if (nbandsto_str != "all") @@ -97,7 +97,7 @@ void ReadInput::item_sdft() item.description = "Chebyshev expansion orders for stochastic DFT."; item.default_value = "100"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_int(input.nche_sto); this->add_item(item); } @@ -110,7 +110,7 @@ void ReadInput::item_sdft() item.description = "Trial energy to guess the lower bound of eigen energies of the Hamiltonian Operator."; item.default_value = "0.0"; item.unit = "Ry"; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_double(input.emin_sto); this->add_item(item); } @@ -123,7 +123,7 @@ void ReadInput::item_sdft() item.description = "Trial energy to guess the upper bound of eigen energies of the Hamiltonian Operator."; item.default_value = "0.0"; item.unit = "Ry"; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_double(input.emax_sto); this->add_item(item); } @@ -139,7 +139,7 @@ void ReadInput::item_sdft() * -1: the seed is decided by time(NULL).)"; item.default_value = "0"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_int(input.seed_sto); this->add_item(item); } @@ -151,7 +151,7 @@ void ReadInput::item_sdft() item.description = R"(Stochastic wave functions are initialized in a large box generated by "4*initsto_ecut". initsto_ecut should be larger than ecutwfc. In this method, SDFT results are the same when using different cores. Besides, coefficients of the same G are the same when ecutwfc is rising to initsto_ecut. If it is smaller than ecutwfc, it will be turned off.)"; item.default_value = "0.0"; item.unit = "Ry"; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_double(input.initsto_ecut); this->add_item(item); } @@ -165,7 +165,7 @@ void ReadInput::item_sdft() * 0: Never change stochastic orbitals.)"; item.default_value = "0"; item.unit = ""; - item.availability = "esolver_type = sdft"; + item.set_availability("esolver_type==sdft"); read_sync_int(input.initsto_freq); this->add_item(item); } @@ -177,7 +177,7 @@ void ReadInput::item_sdft() item.description = "Make memory cost to 1/npart_sto times of the previous one when running the post process of SDFT like DOS or conductivities."; item.default_value = "1"; item.unit = ""; - item.availability = "method_sto = 2 and out_dos = 1 or cal_cond = True"; + item.set_availability("esolver_type==sdft and ((method_sto==2 and out_dos==1) or (basis_type==pw and cal_cond==true))"); read_sync_int(input.npart_sto); this->add_item(item); } diff --git a/source/source_io/module_parameter/test/CMakeLists.txt b/source/source_io/module_parameter/test/CMakeLists.txt new file mode 100644 index 00000000000..6469e5b15c6 --- /dev/null +++ b/source/source_io/module_parameter/test/CMakeLists.txt @@ -0,0 +1,8 @@ +# The availability parser and metadata validator depend only on the standard +# library. Keep this target outside ENABLE_MPI so serial-only builds exercise it. +AddTest( + TARGET MODULE_IO_availability + SOURCES availability_test.cpp + ../availability.cpp + ../availability_validator.cpp +) diff --git a/source/source_io/module_parameter/test/availability_test.cpp b/source/source_io/module_parameter/test/availability_test.cpp new file mode 100644 index 00000000000..8987c90bddc --- /dev/null +++ b/source/source_io/module_parameter/test/availability_test.cpp @@ -0,0 +1,300 @@ +/// Unit tests for the INPUT availability parser and metadata validator. +#include "source_io/module_parameter/availability.h" +#include "source_io/module_parameter/availability_validator.h" +#include "source_io/module_parameter/input_item.h" + +#include "gtest/gtest.h" + +#include +#include + +namespace ModuleIO +{ + +TEST(AvailabilityParser, LeafEqualityRoundTrip) +{ + const AvailabilityExpr e = parse_availability("basis_type==pw"); + EXPECT_TRUE(e.is_leaf()); + EXPECT_EQ(e.condition.param, "basis_type"); + EXPECT_EQ(e.condition.op, "=="); + EXPECT_EQ(e.condition.values, (std::vector{"pw"})); + EXPECT_EQ(e.to_string(), "basis_type==pw"); +} + +TEST(AvailabilityParser, SlashRemainsPartOfSingleEqualityValue) +{ + const AvailabilityExpr e = parse_availability("basis_type==pw/lcao"); + ASSERT_EQ(e.condition.values.size(), 1u); + EXPECT_EQ(e.condition.values[0], "pw/lcao"); + EXPECT_EQ(e.to_string(), "basis_type==pw/lcao"); +} + +TEST(AvailabilityParser, InListRoundTrip) +{ + const AvailabilityExpr e = parse_availability("vdw_method in [d2, d3_0]"); + EXPECT_TRUE(e.is_leaf()); + EXPECT_EQ(e.condition.op, "in"); + EXPECT_EQ(e.condition.values, (std::vector{"d2", "d3_0"})); + EXPECT_EQ(e.to_string(), "vdw_method in [d2, d3_0]"); +} + +TEST(AvailabilityParser, VectorContainmentSemantics) +{ + const AvailabilityExpr e = parse_availability("td_ttype contains 2"); + EXPECT_TRUE(e.is_leaf()); + EXPECT_EQ(e.condition.op, "contains"); + EXPECT_EQ(e.condition.values, (std::vector{"2"})); + EXPECT_EQ(e.to_string(), "td_ttype contains 2"); +} + +TEST(AvailabilityParser, QuotedMultiTokenValueRoundTrip) +{ + const AvailabilityExpr e = parse_availability("relax_method==\"cg 2\""); + EXPECT_TRUE(e.is_leaf()); + EXPECT_EQ(e.condition.op, "=="); + EXPECT_EQ(e.condition.values, (std::vector{"cg 2"})); + EXPECT_EQ(e.to_string(), "relax_method==\"cg 2\""); +} + +TEST(AvailabilityParser, AndGroup) +{ + const AvailabilityExpr e = parse_availability("basis_type==lcao and esolver_type==tddft"); + EXPECT_FALSE(e.is_leaf()); + EXPECT_EQ(e.op, "and"); + ASSERT_EQ(e.children.size(), 2u); + EXPECT_EQ(e.to_string(), "basis_type==lcao and esolver_type==tddft"); +} + +TEST(AvailabilityParser, ParenthesisedOrNesting) +{ + const AvailabilityExpr e = parse_availability( + "symmetry==1 and (dft_functional in [hse, hf] or rpa==true)"); + EXPECT_FALSE(e.is_leaf()); + EXPECT_EQ(e.op, "and"); + ASSERT_EQ(e.children.size(), 2u); + EXPECT_EQ(e.to_string(), + "symmetry==1 and (dft_functional in [hse, hf] or rpa==true)"); +} + +TEST(AvailabilityParser, EmptyIsAlwaysAvailable) +{ + const AvailabilityExpr e = parse_availability(""); + EXPECT_TRUE(e.is_leaf()); + EXPECT_TRUE(e.condition.param.empty()); +} + +TEST(AvailabilityParser, InvalidExpressionsAreRejected) +{ + const char* invalid_expressions[] = { + "Only used for plane wave basis.", + " ", + "and", + " or", + "basis_type==pw or", + "a and", + " and basis_type==pw", + "basis_type==lcao and esolver_type==tddft or ", + "basis_type==pw==lcao", + "relax_method in [cg 2]", + "relax_method in [cg 2, bfgs]", + "relax_method in [\"cg 2\"]", + "relax_method==\"cg 2", + "2 in td_ttype", + "basis_type==pw)", + "(basis_type==pw", + }; + for (const char* expression : invalid_expressions) + { + EXPECT_THROW(parse_availability(expression), std::invalid_argument) << expression; + } +} + +TEST(AvailabilityParser, SetterRequiresCanonicalInputAndPreservesStateOnFailure) +{ + Input_Item item("example"); + item.set_availability("basis_type==pw"); + EXPECT_EQ(item.get_availability(), "basis_type==pw"); + + EXPECT_THROW(item.set_availability("basis_type == pw"), std::invalid_argument); + EXPECT_THROW(item.set_availability("basis_type==pw and"), std::invalid_argument); + EXPECT_EQ(item.get_availability(), "basis_type==pw"); +} + +TEST(AvailabilityValidator, AcceptsKnownTypedReferences) +{ + const std::map types = { + {"basis_type", AvailabilityValueKind::String}, + {"mixing_restart", AvailabilityValueKind::Real}, + {"td_ttype", AvailabilityValueKind::IntegerVector}, + {"relax_method", AvailabilityValueKind::StringVector}, + }; + EXPECT_NO_THROW(validate_availability_expr( + "example", + parse_availability("basis_type==pw and mixing_restart>0"), + types)); + EXPECT_NO_THROW(validate_availability_expr( + "example", parse_availability("td_ttype contains 2"), types)); + EXPECT_THROW(validate_availability_expr( + "example", parse_availability("td_ttype contains two"), types), + std::invalid_argument); + EXPECT_NO_THROW(validate_availability_expr( + "example", parse_availability("relax_method==\"cg 2\""), types)); +} + +TEST(AvailabilityValidator, InfersDocumentedTypes) +{ + EXPECT_EQ(availability_value_kind("Vector of string"), + AvailabilityValueKind::StringVector); + EXPECT_EQ(availability_value_kind("Integer \\[Integer\\](optional)"), + AvailabilityValueKind::IntegerVector); + EXPECT_EQ(availability_value_kind("Float"), AvailabilityValueKind::Real); + EXPECT_EQ(availability_value_kind("Integer or string"), AvailabilityValueKind::Unknown); +} + +TEST(AvailabilityValidator, RejectsUnknownAndIncompatibleReferences) +{ + const std::map types = { + {"basis_type", AvailabilityValueKind::String}, + {"mixing_restart", AvailabilityValueKind::Real}, + }; + EXPECT_THROW(validate_availability_expr( + "example", parse_availability("missing==1"), types), + std::invalid_argument); + EXPECT_THROW(validate_availability_expr( + "example", parse_availability("basis_type contains pw"), types), + std::invalid_argument); + EXPECT_THROW(validate_availability_expr( + "example", parse_availability("basis_type>0"), types), + std::invalid_argument); + EXPECT_THROW(validate_availability_expr( + "example", parse_availability("mixing_restart>none"), types), + std::invalid_argument); +} + +TEST(AvailabilityValidator, AcceptsDependenciesOfDependencies) +{ + std::map expressions; + expressions["esolver_type"] = parse_availability(""); + expressions["basis_type"] = parse_availability(""); + expressions["out_dos"] = parse_availability(""); + expressions["method_sto"] = parse_availability("esolver_type==sdft"); + expressions["cal_cond"] = parse_availability("basis_type==pw"); + // Each referenced parameter carries its own enclosing requirement, both + // directly (method_sto -> esolver_type==sdft) and transitively + // (cal_cond -> basis_type==pw) along its own path. + expressions["npart_sto"] = parse_availability( + "esolver_type==sdft and ((method_sto==2 and out_dos==1) or (basis_type==pw and cal_cond==true))"); + EXPECT_NO_THROW(validate_availability_self_contained( + "npart_sto", expressions["npart_sto"], expressions)); + + // A requirement present only on a different OR branch does not satisfy the + // referencing path. + expressions["broken"] = parse_availability( + "(method_sto==2 and out_dos==1) or (esolver_type==sdft and cal_cond==true)"); + EXPECT_THROW(validate_availability_self_contained( + "broken", expressions["broken"], expressions), + std::invalid_argument); +} + +TEST(AvailabilityValidator, RejectsMissingTransitiveRequirement) +{ + std::map expressions; + expressions["esolver_type"] = parse_availability(""); + expressions["out_dos"] = parse_availability(""); + expressions["method_sto"] = parse_availability("esolver_type==sdft"); + expressions["npart_sto"] = parse_availability("method_sto==2 and out_dos==1"); + EXPECT_THROW(validate_availability_self_contained( + "npart_sto", expressions["npart_sto"], expressions), + std::invalid_argument); +} + +TEST(AvailabilityValidator, AcceptsOrPrerequisiteImpliedByPath) +{ + std::map expressions; + expressions["q"] = parse_availability(""); + expressions["r"] = parse_availability(""); + expressions["p"] = parse_availability("q==2 or r==3"); + + expressions["factored"] = parse_availability("p==1 and (r==3 or q==2)"); + EXPECT_NO_THROW(validate_availability_self_contained( + "factored", expressions["factored"], expressions)); + + expressions["all"] = parse_availability("q==2 and r==3"); + expressions["and_order"] = parse_availability("all==1 and r==3 and q==2"); + EXPECT_NO_THROW(validate_availability_self_contained( + "and_order", expressions["and_order"], expressions)); + + expressions["distributed"] = parse_availability( + "(p==1 and q==2) or (p==1 and r==3)"); + EXPECT_NO_THROW(validate_availability_self_contained( + "distributed", expressions["distributed"], expressions)); + + expressions["basis_type"] = parse_availability(""); + expressions["calculation"] = parse_availability(""); + expressions["gamma_only"] = parse_availability(""); + expressions["out_pchg"] = parse_availability( + "basis_type==pw or (basis_type==lcao and calculation==get_pchg)"); + expressions["if_separate_k"] = parse_availability( + "(basis_type==pw and out_pchg!=none) or " + "(basis_type==lcao and calculation==get_pchg and gamma_only==0)"); + EXPECT_NO_THROW(validate_availability_self_contained( + "if_separate_k", expressions["if_separate_k"], expressions)); + + expressions["missing"] = parse_availability("p==1"); + EXPECT_THROW(validate_availability_self_contained( + "missing", expressions["missing"], expressions), + std::invalid_argument); +} + +TEST(AvailabilityValidator, RequiresExactNonEqualityPrerequisite) +{ + std::map expressions; + expressions["mode"] = parse_availability(""); + expressions["feature"] = parse_availability("mode in [a, b]"); + + expressions["explicit"] = parse_availability( + "feature==enabled and mode in [a, b]"); + EXPECT_NO_THROW(validate_availability_self_contained( + "explicit", expressions["explicit"], expressions)); + + expressions["inferred"] = parse_availability("feature==enabled and mode==a"); + EXPECT_THROW(validate_availability_self_contained( + "inferred", expressions["inferred"], expressions), + std::invalid_argument); +} + +TEST(AvailabilityValidator, ChecksPrerequisitesTransitivelyThroughOr) +{ + std::map expressions; + expressions["root"] = parse_availability(""); + expressions["q"] = parse_availability("root==ready"); + expressions["r"] = parse_availability(""); + expressions["p"] = parse_availability("q==2 or r==3"); + + expressions["complete"] = parse_availability( + "root==ready and p==1 and (q==2 or r==3)"); + EXPECT_NO_THROW(validate_availability_self_contained( + "complete", expressions["complete"], expressions)); + + expressions["missing"] = parse_availability("p==1 and (q==2 or r==3)"); + EXPECT_THROW(validate_availability_self_contained( + "missing", expressions["missing"], expressions), + std::invalid_argument); +} + +TEST(AvailabilityValidator, RejectsSelfReference) +{ + std::map expressions; + expressions["self"] = parse_availability("self==true"); + EXPECT_THROW(validate_availability_self_contained( + "self", expressions["self"], expressions), + std::invalid_argument); + + expressions["duplicate_self"] = parse_availability( + "duplicate_self==true and duplicate_self==true"); + EXPECT_THROW(validate_availability_self_contained( + "duplicate_self", expressions["duplicate_self"], expressions), + std::invalid_argument); +} + +} // namespace ModuleIO diff --git a/source/source_io/test_serial/CMakeLists.txt b/source/source_io/test_serial/CMakeLists.txt index bef63108a32..09e509dff21 100644 --- a/source/source_io/test_serial/CMakeLists.txt +++ b/source/source_io/test_serial/CMakeLists.txt @@ -22,6 +22,8 @@ add_library( ../module_parameter/read_inp_out.cpp ../module_parameter/read_input.cpp ../module_parameter/read_set_globalv.cpp + ../module_parameter/availability.cpp + ../module_parameter/availability_validator.cpp ) file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/support DESTINATION ${CMAKE_CURRENT_BINARY_DIR})