Skip to content

Commit c66f5d1

Browse files
authored
Update supported shorthand names of xc functionals from develop branch (#6629)
* Update supported xc functionals from develop branch * Revert unnecessary changes * Revert changes in xc_functional.h
1 parent 85a8671 commit c66f5d1

File tree

3 files changed

+110
-56
lines changed

3 files changed

+110
-56
lines changed

docs/advanced/input_files/input-main.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,12 +995,24 @@ calculations.
995995

996996
- **Type**: String
997997
- **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.
998-
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**.
999-
1000-
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.
1001-
1002-
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).
1003-
- **Default**: same as UPF file.
998+
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:
999+
- LDA functionals
1000+
- LDA (equivalent with PZ and SLAPZNOGXNOGC), PWLDA
1001+
- GGA functionals
1002+
- PBE (equivalent with SLAPWPBXPBC), PBESOL, REVPBE, WC, BLYP, BP(referred to BP86), PW91, HCTH, OLYP, BLYP_LR
1003+
- meta-GGA functionals
1004+
- SCAN (require LIBXC)
1005+
- Hybrid functionals
1006+
- PBE0, HF
1007+
- 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)
1008+
- Hybrid meta-GGA functionals
1009+
- SCAN0 (require LIBXC)
1010+
1011+
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'.
1012+
1013+
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.
1014+
1015+
- **Default**: Used the same as DFT functional as specified in the pseudopotential files.
10041016

10051017
### xc_temperature
10061018

source/module_hamilt_general/module_xc/xc_functional.cpp

Lines changed: 91 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,18 @@ void XC_Functional::set_xc_first_loop(const UnitCell& ucell)
4040
the first scf iteration only calculate the functional without exact
4141
exchange. but in "nscf" calculation, there is no need of "two-level"
4242
method. */
43-
if (ucell.atoms[0].ncpp.xc_func == "HF"
44-
|| ucell.atoms[0].ncpp.xc_func == "PBE0"
45-
|| ucell.atoms[0].ncpp.xc_func == "HSE") {
43+
if (ucell.atoms[0].ncpp.xc_func == "HF" || ucell.atoms[0].ncpp.xc_func == "HSE"
44+
|| ucell.atoms[0].ncpp.xc_func == "PBE0"|| ucell.atoms[0].ncpp.xc_func == "LC_PBE"
45+
|| ucell.atoms[0].ncpp.xc_func == "LC_WPBE" || ucell.atoms[0].ncpp.xc_func == "LRC_WPBEH"
46+
|| ucell.atoms[0].ncpp.xc_func == "CAM_PBEH") {
4647
XC_Functional::set_xc_type("pbe");
4748
}
4849
else if (ucell.atoms[0].ncpp.xc_func == "SCAN0") {
4950
XC_Functional::set_xc_type("scan");
5051
}
52+
else if (ucell.atoms[0].ncpp.xc_func == "B3LYP") {
53+
XC_Functional::set_xc_type("blyp");
54+
}
5155
}
5256

5357
// The setting values of functional id according to the index in LIBXC
@@ -65,8 +69,8 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
6569
scaling_factor_xc.clear(); // added by jghan, 2024-07-07
6670
std::string xc_func = xc_func_in;
6771
std::transform(xc_func.begin(), xc_func.end(), xc_func.begin(), (::toupper));
68-
if( xc_func == "LDA" || xc_func == "PZ" || xc_func == "SLAPZNOGXNOGC") //SLA+PZ
69-
{
72+
if( xc_func == "LDA" || xc_func == "PZ" || xc_func == "SLAPZNOGXNOGC") //SLA+PZ
73+
{
7074
func_id.push_back(XC_LDA_X);
7175
func_id.push_back(XC_LDA_C_PZ);
7276
func_type = 1;
@@ -84,7 +88,7 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
8488
}
8589
}
8690
#endif
87-
}
91+
}
8892
else if (xc_func == "PWLDA")
8993
{
9094
func_id.push_back(XC_LDA_X);
@@ -96,8 +100,8 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
96100
}
97101
#endif
98102
}
99-
else if ( xc_func == "PBE" || xc_func == "SLAPWPBXPBC") //PBX+PBC
100-
{
103+
else if ( xc_func == "PBE" || xc_func == "SLAPWPBXPBC") //PBX+PBC
104+
{
101105
func_id.push_back(XC_GGA_X_PBE);
102106
func_id.push_back(XC_GGA_C_PBE);
103107
func_type = 2;
@@ -106,94 +110,124 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
106110
if(PARAM.inp.use_paw) { GlobalC::paw_cell.set_libpaw_xc(2,11);
107111
}
108112
#endif
109-
}
110-
else if ( xc_func == "PBESOL") //PBX_S+PBC_S
111-
{
113+
}
114+
else if ( xc_func == "PBESOL") //PBX_S+PBC_S
115+
{
112116
func_id.push_back(XC_GGA_X_PBE_SOL);
113117
func_id.push_back(XC_GGA_C_PBE_SOL);
114118
func_type = 2;
115119
use_libxc = false;
116-
}
117-
else if( xc_func == "REVPBE" ) //PBX_r+PBC
118-
{
119-
func_id.push_back(XC_GGA_X_PBE_R);
120+
}
121+
else if( xc_func == "REVPBE" ) //PBX_r+PBC
122+
{
123+
func_id.push_back(XC_GGA_X_PBE_R);
120124
func_id.push_back(XC_GGA_C_PBE);
121125
func_type = 2;
122126
use_libxc = false;
123127
#ifdef USE_PAW
124128
if(PARAM.inp.use_paw) { GlobalC::paw_cell.set_libpaw_xc(2,14);
125129
}
126130
#endif
127-
}
128-
else if ( xc_func == "WC") //WC+PBC
129-
{
131+
}
132+
else if ( xc_func == "WC") //WC+PBC
133+
{
130134
func_id.push_back(XC_GGA_X_WC);
131135
func_id.push_back(XC_GGA_C_PBE);
132136
func_type = 2;
133137
use_libxc = false;
134-
}
135-
else if ( xc_func == "BLYP") //B88+LYP
136-
{
138+
}
139+
else if ( xc_func == "BLYP") //B88+LYP
140+
{
137141
func_id.push_back(XC_GGA_X_B88);
138142
func_id.push_back(XC_GGA_C_LYP);
139143
func_type = 2;
140144
use_libxc = false;
141-
}
142-
else if ( xc_func == "BP") //B88+P86
143-
{
145+
}
146+
else if ( xc_func == "BP") //B88+P86
147+
{
144148
func_id.push_back(XC_GGA_X_B88);
145149
func_id.push_back(XC_GGA_C_P86);
146150
func_type = 2;
147151
use_libxc = false;
148-
}
149-
else if ( xc_func == "PW91") //PW91_X+PW91_C
150-
{
152+
}
153+
else if ( xc_func == "PW91") //PW91_X+PW91_C
154+
{
151155
func_id.push_back(XC_GGA_X_PW91);
152156
func_id.push_back(XC_GGA_C_PW91);
153157
func_type = 2;
154158
use_libxc = false;
155-
}
156-
else if ( xc_func == "HCTH") //HCTH_X+HCTH_C
157-
{
159+
}
160+
else if ( xc_func == "HCTH") //HCTH_X+HCTH_C
161+
{
158162
func_id.push_back(XC_GGA_X_HCTH_A);
159163
func_id.push_back(XC_GGA_C_HCTH_A);
160164
func_type = 2;
161165
use_libxc = false;
162-
}
163-
else if ( xc_func == "OLYP") //OPTX+LYP
164-
{
166+
}
167+
else if ( xc_func == "OLYP") //OPTX+LYP
168+
{
165169
func_id.push_back(XC_GGA_X_OPTX);
166170
func_id.push_back(XC_GGA_C_LYP);
167171
func_type = 2;
168172
use_libxc = false;
169-
}
173+
}
170174
#ifdef USE_LIBXC
171-
else if ( xc_func == "SCAN")
172-
{
175+
else if ( xc_func == "SCAN")
176+
{
173177
func_id.push_back(XC_MGGA_X_SCAN);
174178
func_id.push_back(XC_MGGA_C_SCAN);
175179
func_type = 3;
176180
use_libxc = true;
177-
}
181+
}
178182
else if ( xc_func == "SCAN0")
179-
{
183+
{
180184
func_id.push_back(XC_MGGA_X_SCAN);
181185
func_id.push_back(XC_MGGA_C_SCAN);
182186
func_type = 5;
183187
use_libxc = true;
184-
}
188+
}
189+
else if( xc_func == "LC_PBE")
190+
{
191+
func_id.push_back(XC_HYB_GGA_XC_LC_PBEOP);
192+
func_type = 4;
193+
use_libxc = true;
194+
}
195+
else if( xc_func == "LC_WPBE")
196+
{
197+
func_id.push_back(XC_HYB_GGA_XC_LC_WPBE);
198+
func_type = 4;
199+
use_libxc = true;
200+
}
201+
else if( xc_func == "LRC_WPBE")
202+
{
203+
func_id.push_back(XC_HYB_GGA_XC_LRC_WPBE);
204+
func_type = 4;
205+
use_libxc = true;
206+
}
207+
else if( xc_func == "LRC_WPBEH")
208+
{
209+
func_id.push_back(XC_HYB_GGA_XC_LRC_WPBEH);
210+
func_type = 4;
211+
use_libxc = true;
212+
}
213+
else if( xc_func == "CAM_PBEH")
214+
{
215+
func_id.push_back(XC_HYB_GGA_XC_CAM_PBEH);
216+
func_type = 4;
217+
use_libxc = true;
218+
}
185219
#endif
186220
else if( xc_func == "HF")
187221
{
188222
func_type = 4;
189223
use_libxc = false;
190224
}
191-
else if( xc_func == "PBE0")
192-
{
225+
else if( xc_func == "PBE0")
226+
{
193227
func_id.push_back(XC_HYB_GGA_XC_PBEH);
194228
func_type = 4;
195229
use_libxc = false;
196-
}
230+
}
197231
else if( xc_func == "OPT_ORB" || xc_func == "NONE" || xc_func == "NOX+NOC")
198232
{
199233
// not doing anything
@@ -252,6 +286,12 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
252286
func_type = 2;
253287
use_libxc = true;
254288
}
289+
else if (xc_func == "B3LYP")
290+
{
291+
func_id.push_back(XC_HYB_GGA_XC_B3LYP);
292+
func_type = 4;
293+
use_libxc = true;
294+
}
255295
#endif
256296
else
257297
{
@@ -270,10 +310,10 @@ void XC_Functional::set_xc_type(const std::string xc_func_in)
270310
#endif
271311
}
272312

273-
if (func_id[0] == XC_GGA_X_OPTX)
274-
{
275-
std::cerr << "\n OPTX untested please test,";
276-
}
313+
if (func_id[0] == XC_GGA_X_OPTX)
314+
{
315+
std::cerr << "\n OPTX untested please test,";
316+
}
277317

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

298338
#ifndef USE_LIBXC
299339
if(xc_func == "SCAN" || xc_func == "HSE" || xc_func == "SCAN0"
300-
|| xc_func == "MULLER" || xc_func == "POWER" || xc_func == "WP22" || xc_func == "CWP22")
340+
|| xc_func == "MULLER" || xc_func == "POWER" || xc_func == "WP22" || xc_func == "CWP22" ||
341+
xc_func == "LC_PBE" || xc_func == "LC_WPBE" || xc_func == "LRC_WPBE" ||
342+
xc_func == "LRC_PBEH" || xc_func == "CAM_PBEH")
301343
{
302-
ModuleBase::WARNING_QUIT("set_xc_type","to use SCAN, SCAN0, or HSE, LIBXC is required");
344+
ModuleBase::WARNING_QUIT("set_xc_type","to use SCAN, SCAN0, HSE, long-range corrected (LC_PBE, LC_WPBE...) or CAM_PBEH LIBXC is required");
303345
}
304346
use_libxc = false;
305347
#endif
306348

307-
}
349+
}

source/module_hamilt_general/module_xc/xc_functional.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,4 +316,4 @@ class XC_Functional
316316

317317
};
318318

319-
#endif //XC_FUNCTION_H
319+
#endif //XC_FUNCTION_H

0 commit comments

Comments
 (0)