diff --git a/psi4-1.3.2-libxc5.patch b/psi4-1.3.2-libxc5.patch new file mode 100644 index 0000000..5e72c28 --- /dev/null +++ b/psi4-1.3.2-libxc5.patch @@ -0,0 +1,226 @@ +diff -up psi4-1.3.2/psi4/driver/procrouting/dft/dh_functionals.py.libxc5 psi4-1.3.2/psi4/driver/procrouting/dft/dh_functionals.py +--- psi4-1.3.2/psi4/driver/procrouting/dft/dh_functionals.py.libxc5 2020-05-05 09:06:43.806038249 +0200 ++++ psi4-1.3.2/psi4/driver/procrouting/dft/dh_functionals.py 2020-05-05 09:02:26.227501499 +0200 +@@ -594,13 +594,13 @@ def get_pwpb95_tweaks(): + c_pw6 = bt / (X_FACTOR_C * X2S * X2S) + d_pw6 = -(bt - beta) / (X_FACTOR_C * X2S * X2S) + f_pw6 = 1.0e-6 / (X_FACTOR_C * X2S**expo_pw6) +- return ([a_pw6, b_pw6, c_pw6, d_pw6, f_pw6, alpha_pw6, expo_pw6]) ++ return ([bt, alpha_pw6, expo_pw6]) + + + funcs.append({ + "name": "PWPB95", + "x_functionals": { +- "GGA_X_PW91": { ++ "GGA_X_MPW91": { # only mpw91, not pw91, is tweakable + "tweak": get_pwpb95_tweaks(), + "alpha": 0.50 + } +@@ -626,7 +626,7 @@ funcs.append({ + "name": "PTPSS", + "x_functionals": { + "MGGA_X_TPSS": { +- "tweak": [0.15, 0.88491, 0.047, 0.872, 0.16952], ++ "tweak": [0.15, 0.88491, 0.047, 0.872, 0.16952, -999., -999.], # last two are filled in from defaults + "alpha": 0.50 + } + }, +diff -up psi4-1.3.2/psi4/driver/procrouting/dft/gga_functionals.py.libxc5 psi4-1.3.2/psi4/driver/procrouting/dft/gga_functionals.py +--- psi4-1.3.2/psi4/driver/procrouting/dft/gga_functionals.py.libxc5 2020-05-05 09:06:48.714819789 +0200 ++++ psi4-1.3.2/psi4/driver/procrouting/dft/gga_functionals.py 2020-05-05 09:02:26.238501010 +0200 +@@ -138,7 +138,7 @@ funcs.append({ + "GGA_X_PW91": {} + }, + "c_functionals": { +- "GGA_C_Pw91": {} ++ "GGA_C_PW91": {} + }, + "citation": ' J.P. Perdew et. al., Phys. Rev. B., 46(11), 6671-6687, 1992\n', + "description": ' PW91 GGA Exchange-Correlation Functional\n', +@@ -150,7 +150,7 @@ funcs.append({ + "GGA_X_mPW91": {} + }, + "c_functionals": { +- "GGA_C_Pw91": {} ++ "GGA_C_PW91": {} + }, + "citation": ' C. Adamo, V. Barone, J. Chem. Phys., 108, 664, 1998\n', + "description": ' mPWPW GGA Exchange-Correlation Functional\n', +diff -up psi4-1.3.2/psi4/driver/procrouting/dft/hyb_functionals.py.libxc5 psi4-1.3.2/psi4/driver/procrouting/dft/hyb_functionals.py +--- psi4-1.3.2/psi4/driver/procrouting/dft/hyb_functionals.py.libxc5 2020-05-05 09:06:43.816037804 +0200 ++++ psi4-1.3.2/psi4/driver/procrouting/dft/hyb_functionals.py 2020-05-05 09:02:26.240500921 +0200 +@@ -174,7 +174,7 @@ funcs.append({ + }, + "c_functionals": { + "GGA_C_PBE": { +- "tweak": [0.03] ++ "tweak": [0.03, -999., -999.] # last two are filled in from defaults + } + }, + "dispersion": { +@@ -357,13 +357,13 @@ def get_pw6b95_tweaks(): + c_pw6 = bt / (X_FACTOR_C * X2S * X2S) + d_pw6 = -(bt - beta) / (X_FACTOR_C * X2S * X2S) + f_pw6 = 1.0e-6 / (X_FACTOR_C * X2S**expo_pw6) +- return ([a_pw6, b_pw6, c_pw6, d_pw6, f_pw6, alpha_pw6, expo_pw6]) ++ return ([bt, alpha_pw6, expo_pw6]) + + + funcs.append({ + "name": "PW6B95", + "x_functionals": { +- "GGA_X_PW91": { ++ "GGA_X_MPW91": { + "tweak": get_pw6b95_tweaks(), + "alpha": 0.72 + } +diff -up psi4-1.3.2/psi4/src/psi4/libfunctional/LibXCfunctional.cc.libxc5 psi4-1.3.2/psi4/src/psi4/libfunctional/LibXCfunctional.cc +--- psi4-1.3.2/psi4/src/psi4/libfunctional/LibXCfunctional.cc.libxc5 2020-05-05 09:06:43.824037448 +0200 ++++ psi4-1.3.2/psi4/src/psi4/libfunctional/LibXCfunctional.cc 2020-05-05 09:02:26.258500120 +0200 +@@ -199,11 +199,11 @@ void LibXCFunctional::set_omega(double o + omega_ = omega; + user_omega_ = true; + if (xc_func_name_ == "XC_GGA_X_WPBEH") { +- xc_gga_x_wpbeh_set_params(xc_functional_.get(), omega); ++ xc_func_set_ext_params(xc_functional_.get(), &omega); + } else if (xc_func_name_ == "XC_GGA_X_HJS_PBE") { +- xc_gga_x_hjs_set_params(xc_functional_.get(), omega); ++ xc_func_set_ext_params(xc_functional_.get(), &omega); + } else if (xc_func_name_ == "XC_HYB_GGA_XC_LRC_WPBEH") { +- xc_gga_x_wpbeh_set_params(xc_functional_->func_aux[0], omega); ++ xc_func_set_ext_params(xc_functional_->func_aux[0], &omega); + } else if (xc_func_name_ == "XC_HYB_GGA_XC_WB97X") { + xc_functional_->cam_omega = omega; + } else if (xc_func_name_ == "XC_HYB_GGA_XC_WB97") { +@@ -249,100 +249,45 @@ std::map LibXCFunct + void LibXCFunctional::set_tweak(std::vector values) { + bool failed = true; + size_t vsize = values.size(); +- if (xc_func_name_ == "XC_GGA_X_B86") { +- if (vsize == 3) { +- // (XC(func_type) *p, FLOAT beta, FLOAT gamma, FLOAT omega); +- xc_gga_x_b86_set_params(xc_functional_.get(), values[0], values[1], values[2]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_X_B88") { +- if (vsize == 2) { +- // (XC(func_type) *p, FLOAT beta, FLOAT gamma); +- xc_gga_x_b88_set_params(xc_functional_.get(), values[0], values[1]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_X_PBE") { +- if (vsize == 2) { +- // (XC(func_type) *p, FLOAT kappa, FLOAT mu); +- xc_gga_x_pbe_set_params(xc_functional_.get(), values[0], values[1]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_C_PBE") { +- if (vsize == 1) { +- // (XC(func_type) *p, FLOAT beta); +- xc_gga_c_pbe_set_params(xc_functional_.get(), values[0]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_X_PW91") { +- if (vsize == 7) { +- // (XC(func_type) *p, FLOAT a, FLOAT b, FLOAT c, FLOAT d, FLOAT f, FLOAT alpha, FLOAT expo); +- xc_gga_x_pw91_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3], values[4], +- values[5], values[6]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_X_RPBE") { +- if (vsize == 2) { +- // (XC(func_type) *p, FLOAT kappa, FLOAT mu); +- xc_gga_x_rpbe_set_params(xc_functional_.get(), values[0], values[1]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_X_OPTX") { +- if (vsize == 3) { +- // (XC(func_type) *p, FLOAT a, FLOAT b, FLOAT gamma); +- xc_gga_x_optx_set_params(xc_functional_.get(), values[0], values[1], values[2]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_GGA_C_LYP") { +- if (vsize == 4) { +- // (XC(func_type) *p, FLOAT A, FLOAT B, FLOAT c, FLOAT d); +- xc_gga_c_lyp_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3]); +- failed = false; +- } +- } else if ((xc_func_name_ == "XC_HYB_GGA_XC_HSE03") || (xc_func_name_ == "XC_HYB_GGA_XC_HSE06")) { ++ int npars = xc_func_info_get_n_ext_params(xc_functional_.get()->info); ++ if (npars == 0) { ++ throw PSIEXCEPTION( ++ "LibXCfunctional: set_tweak: There are no known tweaks for this functional, please double check " ++ "the functional form and add them if required."); ++ } else if (npars != vsize) { ++ std::ostringstream oss; ++ oss << "got " << vsize << ", expected " << npars; ++ throw PSIEXCEPTION( ++ "LibXCfunctional: set_tweak: Mismatch in size of tweaker vector and expected number of " ++ "input parameters:" + ++ oss.str() + "\n"); ++ } ++ ++ if (xc_func_name_ == "XC_GGA_C_PBE") { + if (vsize == 3) { +- // "Mixing parameter beta", "Screening parameter omega_HF", "Screening parameter omega_PBE" ++ // (XC(func_type) *p, FLOAT beta); FLOAT gamma, FLOAT BB ++ // xc_gga_c_pbe_set_params(xc_functional_.get(), values[0]); ++ values[1] = ++ xc_func_info_get_ext_params_default_value(const_cast(xc_functional_->info), 1); ++ values[2] = ++ xc_func_info_get_ext_params_default_value(const_cast(xc_functional_->info), 2); + xc_func_set_ext_params(xc_functional_.get(), values.data()); + failed = false; + } + } else if (xc_func_name_ == "XC_MGGA_X_TPSS") { +- if (vsize == 5) { ++ if (vsize == 7) { + // (xc_func_type *p, double b, double c, double e, double kappa, double mu, double BLOC_a, double BLOC_bu); +- xc_mgga_x_tpss_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3], values[4], 2.0, +- 0.0); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_MGGA_C_TPSS") { +- if (vsize == 6) { +- // (xc_func_type *p, double beta, double d, double C0_0, double C0_1, double C0_2, double C0_3); +- xc_mgga_c_tpss_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3], values[4], +- values[5]); +- failed = false; +- } +- } else if (xc_func_name_ == "XC_MGGA_C_BC95") { +- if (vsize == 2) { +- // (XC(func_type) *p, FLOAT css, FLOAT copp); +- xc_mgga_c_bc95_set_params(xc_functional_.get(), values[0], values[1]); ++ // xc_mgga_x_tpss_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3], ++ // values[4], 2.0, ++ // 0.0); ++ values[5] = 2.0; ++ values[6] = 0.0; ++ xc_func_set_ext_params(xc_functional_.get(), values.data()); + failed = false; + } +- // } else if (xc_func_name_ == "XC_MGGA_C_PKZB") { +- // if (vsize == 6) { +- // // ((XC(func_type) *p, FLOAT beta, FLOAT d, FLOAT C0_0, FLOAT C0_1, FLOAT C0_2, FLOAT +- // // C0_3); +- // xc_mgga_c_pkzb_set_params(xc_functional_.get(), values[0], values[1], values[2], values[3], +- // values[4], values[5]); +- // failed = false; +- // } + } else { +- throw PSIEXCEPTION( +- "LibXCfunctional: set_tweak: There are no known tweaks for this functional, please double check " +- "the functional form and add them if required."); +- } +- +- // Did we match fully? +- if (failed) { +- throw PSIEXCEPTION( +- "LibXCfunctional: set_tweak: Mismatch in size of tweaker vector and expected number of " +- "input parameters."); ++ xc_func_set_ext_params(xc_functional_.get(), values.data()); ++ failed = false; + } + + user_tweakers_ = values; diff --git a/psi4.spec b/psi4.spec index e73d470..42cd0ad 100644 --- a/psi4.spec +++ b/psi4.spec @@ -11,6 +11,8 @@ Source0: https://github.com/psi4/psi4/archive/v%{version}/psi4-%{version} Patch0: psi4-1.3.2-fedora.patch # Use python3 not python in test runner Patch1: psi4-1.3.2-python3.patch +# Patch for libxc5 support +Patch2: psi4-1.3.2-libxc5.patch BuildRequires: cmake BuildRequires: bison-devel @@ -90,6 +92,9 @@ This package contains static libraries and development headers for psi. %setup -q %patch0 -p1 -b .fedora %patch1 -p1 -b .python3 +%if 0%{?fedora} > 32 +%patch2 -p1 -b .libxc5 +%endif %build export F77=gfortran @@ -144,7 +149,7 @@ ctest -L smoketests %{_libdir}/psi4/ %changelog -* Sat Apr 25 2020 Susi Lehtola - 1:1.3.2-3 +* Tue May 05 2020 Susi Lehtola - 1:1.3.2-3 - Rebuild against libxc 5 in rawhide. - Add missing deepdiff requires.