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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions docs/advanced/input_files/input-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -995,12 +995,24 @@ calculations.

- **Type**: String
- **Description**: In our package, the XC functional can either be set explicitly using the `dft_functional` keyword in `INPUT` file. If `dft_functional` is not specified, ABACUS will use the xc functional indicated in the pseudopotential file.
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names such as 'LDA', 'PBE', 'SCAN'. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/module_hamilt_general/module_xc/xc_functional.cpp). 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'. The list of LIBXC keywords can be found on its [website](https://libxc.gitlab.io/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**.

Furthermore, the old INPUT parameter exx_hybrid_type for hybrid functionals has been absorbed into dft_functional. Options are `hf` (pure Hartree-Fock), `pbe0`(PBE0), `hse` (Note: in order to use HSE functional, LIBXC is required). Note also that HSE has been tested while PBE0 has NOT been fully tested yet, and the maximum CPU cores for running exx in parallel is $N(N+1)/2$, with N being the number of atoms. And forces for hybrid functionals are not supported yet.

If set to `opt_orb`, the program will not perform hybrid functional calculation. Instead, it is going to generate opt-ABFs as discussed in this [article](https://pubs.acs.org/doi/abs/10.1021/acs.jpclett.0c00481).
- **Default**: same as UPF file.
On the other hand, if dft_functional is specified, it will overwrite the functional from pseudopotentials and performs calculation with whichever functional the user prefers. We further offer two ways of supplying exchange-correlation functional. The first is using 'short-hand' names. A complete list of 'short-hand' expressions can be found in [the source code](../../../source/source_hamilt/module_xc/xc_functional.cpp). Supported density functionals are:
- LDA functionals
- LDA (equivalent with PZ and SLAPZNOGXNOGC), PWLDA
- GGA functionals
- PBE (equivalent with SLAPWPBXPBC), PBESOL, REVPBE, WC, BLYP, BP(referred to BP86), PW91, HCTH, OLYP, BLYP_LR
- meta-GGA functionals
- SCAN (require LIBXC)
- Hybrid functionals
- PBE0, HF
- If LIBXC is avaliale, additional short-hand names of hybrid functionals are supported: HSE(referred to HSE06), B3LYP, LC_PBE, LC_WPBE, LRC_WPBE, LRC_WPBEH, CAM_PBEH, WP22, CWP22, MULLER (equivalent with POWER)
- Hybrid meta-GGA functionals
- SCAN0 (require LIBXC)

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'. The list of LIBXC keywords can be found on its [website](https://libxc.gitlab.io/functionals/). In this way, **we support all the LDA,GGA and mGGA functionals provided by LIBXC**. Some popular functionals and their usage are: RPBE of [Hammer et al.](https://journals.aps.org/prb/abstract/10.1103/PhysRevB.59.7413), set `dft_functional` to 'GGA_X_RPBE+GGA_C_PBE', and [r$^{2}$SCAN](https://pubs.acs.org/doi/10.1021/acs.jpclett.0c02405), set `dft_functional` to 'MGGA_X_R2SCAN+MGGA_C_R2SCAN'.

Furthermore, the old INPUT parameter exx_hybrid_type for hybrid functionals has been absorbed into dft_functional. Options are `hf` (pure Hartree-Fock), `pbe0`(PBE0), `hse` (Note: in order to use HSE functional, LIBXC is required). Note also that HSE has been tested while PBE0 has NOT been fully tested yet, and the maximum CPU cores for running exx in parallel is $N(N+1)/2$, with N being the number of atoms.

- **Default**: Used the same as DFT functional as specified in the pseudopotential files.

### xc_temperature

Expand Down
140 changes: 91 additions & 49 deletions source/module_hamilt_general/module_xc/xc_functional.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,18 @@ void XC_Functional::set_xc_first_loop(const UnitCell& ucell)
the first scf iteration only calculate the functional without exact
exchange. but in "nscf" calculation, there is no need of "two-level"
method. */
if (ucell.atoms[0].ncpp.xc_func == "HF"
|| ucell.atoms[0].ncpp.xc_func == "PBE0"
|| ucell.atoms[0].ncpp.xc_func == "HSE") {
if (ucell.atoms[0].ncpp.xc_func == "HF" || ucell.atoms[0].ncpp.xc_func == "HSE"
|| ucell.atoms[0].ncpp.xc_func == "PBE0"|| ucell.atoms[0].ncpp.xc_func == "LC_PBE"
|| ucell.atoms[0].ncpp.xc_func == "LC_WPBE" || ucell.atoms[0].ncpp.xc_func == "LRC_WPBEH"
|| ucell.atoms[0].ncpp.xc_func == "CAM_PBEH") {
XC_Functional::set_xc_type("pbe");
}
else if (ucell.atoms[0].ncpp.xc_func == "SCAN0") {
XC_Functional::set_xc_type("scan");
}
else if (ucell.atoms[0].ncpp.xc_func == "B3LYP") {
XC_Functional::set_xc_type("blyp");
}
}

// The setting values of functional id according to the index in LIBXC
Expand All @@ -65,8 +69,8 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
scaling_factor_xc.clear(); // added by jghan, 2024-07-07
std::string xc_func = xc_func_in;
std::transform(xc_func.begin(), xc_func.end(), xc_func.begin(), (::toupper));
if( xc_func == "LDA" || xc_func == "PZ" || xc_func == "SLAPZNOGXNOGC") //SLA+PZ
{
if( xc_func == "LDA" || xc_func == "PZ" || xc_func == "SLAPZNOGXNOGC") //SLA+PZ
{
func_id.push_back(XC_LDA_X);
func_id.push_back(XC_LDA_C_PZ);
func_type = 1;
Expand All @@ -84,7 +88,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
}
}
#endif
}
}
else if (xc_func == "PWLDA")
{
func_id.push_back(XC_LDA_X);
Expand All @@ -96,8 +100,8 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
}
#endif
}
else if ( xc_func == "PBE" || xc_func == "SLAPWPBXPBC") //PBX+PBC
{
else if ( xc_func == "PBE" || xc_func == "SLAPWPBXPBC") //PBX+PBC
{
func_id.push_back(XC_GGA_X_PBE);
func_id.push_back(XC_GGA_C_PBE);
func_type = 2;
Expand All @@ -106,94 +110,124 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
if(PARAM.inp.use_paw) { GlobalC::paw_cell.set_libpaw_xc(2,11);
}
#endif
}
else if ( xc_func == "PBESOL") //PBX_S+PBC_S
{
}
else if ( xc_func == "PBESOL") //PBX_S+PBC_S
{
func_id.push_back(XC_GGA_X_PBE_SOL);
func_id.push_back(XC_GGA_C_PBE_SOL);
func_type = 2;
use_libxc = false;
}
else if( xc_func == "REVPBE" ) //PBX_r+PBC
{
func_id.push_back(XC_GGA_X_PBE_R);
}
else if( xc_func == "REVPBE" ) //PBX_r+PBC
{
func_id.push_back(XC_GGA_X_PBE_R);
func_id.push_back(XC_GGA_C_PBE);
func_type = 2;
use_libxc = false;
#ifdef USE_PAW
if(PARAM.inp.use_paw) { GlobalC::paw_cell.set_libpaw_xc(2,14);
}
#endif
}
else if ( xc_func == "WC") //WC+PBC
{
}
else if ( xc_func == "WC") //WC+PBC
{
func_id.push_back(XC_GGA_X_WC);
func_id.push_back(XC_GGA_C_PBE);
func_type = 2;
use_libxc = false;
}
else if ( xc_func == "BLYP") //B88+LYP
{
}
else if ( xc_func == "BLYP") //B88+LYP
{
func_id.push_back(XC_GGA_X_B88);
func_id.push_back(XC_GGA_C_LYP);
func_type = 2;
use_libxc = false;
}
else if ( xc_func == "BP") //B88+P86
{
}
else if ( xc_func == "BP") //B88+P86
{
func_id.push_back(XC_GGA_X_B88);
func_id.push_back(XC_GGA_C_P86);
func_type = 2;
use_libxc = false;
}
else if ( xc_func == "PW91") //PW91_X+PW91_C
{
}
else if ( xc_func == "PW91") //PW91_X+PW91_C
{
func_id.push_back(XC_GGA_X_PW91);
func_id.push_back(XC_GGA_C_PW91);
func_type = 2;
use_libxc = false;
}
else if ( xc_func == "HCTH") //HCTH_X+HCTH_C
{
}
else if ( xc_func == "HCTH") //HCTH_X+HCTH_C
{
func_id.push_back(XC_GGA_X_HCTH_A);
func_id.push_back(XC_GGA_C_HCTH_A);
func_type = 2;
use_libxc = false;
}
else if ( xc_func == "OLYP") //OPTX+LYP
{
}
else if ( xc_func == "OLYP") //OPTX+LYP
{
func_id.push_back(XC_GGA_X_OPTX);
func_id.push_back(XC_GGA_C_LYP);
func_type = 2;
use_libxc = false;
}
}
#ifdef USE_LIBXC
else if ( xc_func == "SCAN")
{
else if ( xc_func == "SCAN")
{
func_id.push_back(XC_MGGA_X_SCAN);
func_id.push_back(XC_MGGA_C_SCAN);
func_type = 3;
use_libxc = true;
}
}
else if ( xc_func == "SCAN0")
{
{
func_id.push_back(XC_MGGA_X_SCAN);
func_id.push_back(XC_MGGA_C_SCAN);
func_type = 5;
use_libxc = true;
}
}
else if( xc_func == "LC_PBE")
{
func_id.push_back(XC_HYB_GGA_XC_LC_PBEOP);
func_type = 4;
use_libxc = true;
}
else if( xc_func == "LC_WPBE")
{
func_id.push_back(XC_HYB_GGA_XC_LC_WPBE);
func_type = 4;
use_libxc = true;
}
else if( xc_func == "LRC_WPBE")
{
func_id.push_back(XC_HYB_GGA_XC_LRC_WPBE);
func_type = 4;
use_libxc = true;
}
else if( xc_func == "LRC_WPBEH")
{
func_id.push_back(XC_HYB_GGA_XC_LRC_WPBEH);
func_type = 4;
use_libxc = true;
}
else if( xc_func == "CAM_PBEH")
{
func_id.push_back(XC_HYB_GGA_XC_CAM_PBEH);
func_type = 4;
use_libxc = true;
}
#endif
else if( xc_func == "HF")
{
func_type = 4;
use_libxc = false;
}
else if( xc_func == "PBE0")
{
else if( xc_func == "PBE0")
{
func_id.push_back(XC_HYB_GGA_XC_PBEH);
func_type = 4;
use_libxc = false;
}
}
else if( xc_func == "OPT_ORB" || xc_func == "NONE" || xc_func == "NOX+NOC")
{
// not doing anything
Expand Down Expand Up @@ -252,6 +286,12 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
func_type = 2;
use_libxc = true;
}
else if (xc_func == "B3LYP")
{
func_id.push_back(XC_HYB_GGA_XC_B3LYP);
func_type = 4;
use_libxc = true;
}
#endif
else
{
Expand All @@ -270,10 +310,10 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
#endif
}

if (func_id[0] == XC_GGA_X_OPTX)
{
std::cerr << "\n OPTX untested please test,";
}
if (func_id[0] == XC_GGA_X_OPTX)
{
std::cerr << "\n OPTX untested please test,";
}

if((func_type == 4 || func_type == 5) && PARAM.inp.basis_type == "pw")
{
Expand All @@ -297,11 +337,13 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)

#ifndef USE_LIBXC
if(xc_func == "SCAN" || xc_func == "HSE" || xc_func == "SCAN0"
|| xc_func == "MULLER" || xc_func == "POWER" || xc_func == "WP22" || xc_func == "CWP22")
|| xc_func == "MULLER" || xc_func == "POWER" || xc_func == "WP22" || xc_func == "CWP22" ||
xc_func == "LC_PBE" || xc_func == "LC_WPBE" || xc_func == "LRC_WPBE" ||
xc_func == "LRC_PBEH" || xc_func == "CAM_PBEH")
{
ModuleBase::WARNING_QUIT("set_xc_type","to use SCAN, SCAN0, or HSE, LIBXC is required");
ModuleBase::WARNING_QUIT("set_xc_type","to use SCAN, SCAN0, HSE, long-range corrected (LC_PBE, LC_WPBE...) or CAM_PBEH LIBXC is required");
}
use_libxc = false;
#endif

}
}
2 changes: 1 addition & 1 deletion source/module_hamilt_general/module_xc/xc_functional.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,4 @@ class XC_Functional

};

#endif //XC_FUNCTION_H
#endif //XC_FUNCTION_H
Loading