Skip to content

Commit

Permalink
Feature: build-in DFTD3 parameters (#5378)
Browse files Browse the repository at this point in the history
* Feature: build-in DFTD3 parameters with fall-back parameter search strategy

* update

* correct parameters

* correct the annotation at the end of file dftd3.h

* support libxc

* add annotations

* update alias: hse06 -> hse

* [pre-commit.ci lite] apply automatic fixes

* update the autoset strategy: if user defined, then use

* fix compilation error

* correct the unittest

* xc with _v, _d3 should be carefully treated

* give up the so-called fall-back strategy

* correct a minor bug

* disable the output

* support the dft_functional value without the XC_ header

* ouch... stupid mistake

* Update doc

* add more unittests

* correct behavior on wb97 functional family according to advice

---------

Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
kirk0830 and pre-commit-ci-lite[bot] authored Nov 5, 2024
1 parent ddf990f commit edfa4c1
Show file tree
Hide file tree
Showing 21 changed files with 1,767 additions and 310 deletions.
32 changes: 14 additions & 18 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@
- [exx\_opt\_orb\_ecut](#exx_opt_orb_ecut)
- [exx\_opt\_orb\_tolerence](#exx_opt_orb_tolerence)
- [exx\_real\_number](#exx_real_number)
- [exx\_symmetry\_realspace](#exx_symmetry_realspace)
- [rpa\_ccp\_rmesh\_times](#rpa_ccp_rmesh_times)
- [exx\_symmetry\_realspace](#exx_symmetry_realspace)
- [out\_ri\_cv](#out_ri_cv)
- [Molecular dynamics](#molecular-dynamics)
- [md\_type](#md_type)
Expand Down Expand Up @@ -273,6 +273,9 @@
- [lj\_epsilon](#lj_epsilon)
- [lj\_sigma](#lj_sigma)
- [pot\_file](#pot_file)
- [dp\_rescaling](#dp_rescaling)
- [dp\_fparam](#dp_fparam)
- [dp\_aparam](#dp_aparam)
- [msst\_direction](#msst_direction)
- [msst\_vel](#msst_vel)
- [msst\_vis](#msst_vis)
Expand Down Expand Up @@ -422,11 +425,12 @@
- [nocc](#nocc)
- [nvirt](#nvirt)
- [lr\_nstates](#lr_nstates)
- [lr\_unrestricted](#lr_unrestricted)
- [abs\_wavelen\_range](#abs_wavelen_range)
- [out\_wfc\_lr](#out_wfc_lr)
- [abs\_broadening](#abs_broadening)
- [ri\_hartree\_benchmark](#ri_hartree_benchmark)
- [aims_nbasis](#aims_nbasis)
- [aims\_nbasis](#aims_nbasis)

[back to top](#full-list-of-input-keywords)
## System variables
Expand Down Expand Up @@ -2908,46 +2912,38 @@ These variables are used to control vdW-corrected related parameters.
- **Type**: String
- **Description**: Specifies the method used for Van der Waals (VdW) correction. Available options are:
- `d2`: [Grimme's D2](https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.20495) dispersion correction method
- `d3_0`: [Grimme's DFT-D3(0)](https://aip.scitation.org/doi/10.1063/1.3382344) dispersion correction method
- `d3_bj`: [Grimme's DFTD3(BJ)](https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.21759) dispersion correction method
- `d3_0`: [Grimme's DFT-D3(0)](https://aip.scitation.org/doi/10.1063/1.3382344) dispersion correction method (zero-damping)
- `d3_bj`: [Grimme's DFTD3(BJ)](https://onlinelibrary.wiley.com/doi/abs/10.1002/jcc.21759) dispersion correction method (BJ-damping)
- `none`: no vdW correction
- **Default**: none
- **Note**: ABACUS supports automatic setting on DFT-D3 parameters for common functionals after version 3.8.3 (and several develop versions earlier). To benefit from this feature, please specify the parameter `dft_functional` explicitly (for more details on this parameter, please see [dft_functional](#dft_functional)), otherwise the autoset procedure will crash with error message like `cannot find DFT-D3 parameter for XC(***)`. If not satisfied with those in-built parameters, any manually setting on `vdw_s6`, `vdw_s8`, `vdw_a1` and `vdw_a2` will overwrite.
- **Special**: There are special cases for functional family wB97 (Omega-B97): if want to use the functional wB97X-D3BJ, one needs to specify the `dft_functional` as `HYB_GGA_WB97X_V` and `vdw_method` as `d3_bj`. If want to use the functional wB97X-D3, specify `dft_functional` as `HYB_GGA_WB97X_D3` and `vdw_method` as `d3_0`.

### vdw_s6

- **Type**: Real
- **Availability**: `vdw_method` is set to `d2`, `d3_0`, or `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). For DFT-D3, recommended values with different DFT functionals can be found on the [here](https://www.chemiebn.uni-bonn.de/pctc/mulliken-center/software/dft-d3/dft-d3). The default value of this parameter in ABACUS is set to be the recommended value for PBE.
- **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](https://github.com/dftd3/simple-dftd3/blob/main/assets/parameters.toml). 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**:
- 0.75: if `vdw_method` is set to `d2`
- 1.0: if `vdw_method` is set to `d3_0` or `d3_bj`

### vdw_s8

- **Type**: Real
- **Availability**: `vdw_method` is set to `d3_0` or `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](https://www.chemiebn.uni-bonn.de/pctc/mulliken-center/software/dft-d3/dft-d3). The default value of this parameter in ABACUS is set to be the recommended value for PBE.
- **Default**:
- 0.722: if `vdw_method` is set to `d3_0`
- 0.7875: if `vdw_method` is set to `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](https://github.com/dftd3/simple-dftd3/blob/main/assets/parameters.toml). 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**: Real
- **Availability**: `vdw_method` is set to `d3_0` or `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](https://www.chemiebn.uni-bonn.de/pctc/mulliken-center/software/dft-d3/dft-d3). The default value of this parameter in ABACUS is set to be the recommended value for PBE.
- **Default**:
- 1.217: if `vdw_method` is set to `d3_0`
- 0.4289: if `vdw_method` is set to `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](https://github.com/dftd3/simple-dftd3/blob/main/assets/parameters.toml). 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**: Real
- **Availability**: `vdw_method` is set to `d3_0` or `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](https://www.chemiebn.uni-bonn.de/pctc/mulliken-center/software/dft-d3/dft-d3). The default value of this parameter in ABACUS is set to be the recommended value for PBE.
- **Default**:
- 1.0: if `vdw_method` is set to `d3_0`
- 4.4407: if `vdw_method` is set to `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](https://github.com/dftd3/simple-dftd3/blob/main/assets/parameters.toml). 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

Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/esolver_ks_pw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void ESolver_KS_PW<T, Device>::before_scf(const int istep)
//----------------------------------------------------------
// about vdw, jiyy add vdwd3 and linpz add vdwd2
//----------------------------------------------------------
auto vdw_solver = vdw::make_vdw(GlobalC::ucell, PARAM.inp);
auto vdw_solver = vdw::make_vdw(GlobalC::ucell, PARAM.inp, &(GlobalV::ofs_running));
if (vdw_solver != nullptr)
{
this->pelec->f_en.evdw = vdw_solver->get_energy();
Expand Down
2 changes: 1 addition & 1 deletion source/module_esolver/lcao_before_scf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void ESolver_KS_LCAO<TK, TR>::before_scf(const int istep)
//----------------------------------------------------------
// about vdw, jiyy add vdwd3 and linpz add vdwd2
//----------------------------------------------------------
auto vdw_solver = vdw::make_vdw(GlobalC::ucell, PARAM.inp);
auto vdw_solver = vdw::make_vdw(GlobalC::ucell, PARAM.inp, &(GlobalV::ofs_running));
if (vdw_solver != nullptr)
{
this->pelec->f_en.evdw = vdw_solver->get_energy();
Expand Down
Loading

0 comments on commit edfa4c1

Please sign in to comment.