Skip to content

Commit f932a1b

Browse files
Add M06-2X and PKZB Implementations (#41)
* Add EXCHCXX_ENABLE_LIBXC option to disable LibXC backend on request * Bump to Libxc 7.0.0, update impls and scripts, add impls of M062X_{X,C} * Added M062X as a Functional implementation * Add PKZB implementation * remove debug statement * Add XC Functional impl of PKZB
1 parent cfe5eaf commit f932a1b

26 files changed

Lines changed: 5034 additions & 109 deletions

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ endif()
5757
if(EXCHCXX_ENABLE_LIBXC)
5858

5959
## Find LibXC
60-
find_package( Libxc 6.2.0 CONFIG QUIET )
60+
find_package( Libxc 7.0.0 CONFIG QUIET )
6161

6262
if( ${Libxc_FOUND} )
6363

@@ -71,10 +71,10 @@ else()
7171
FetchContent_Declare(
7272
libxc
7373
GIT_REPOSITORY https://gitlab.com/libxc/libxc.git
74-
GIT_TAG 6.2.0 # v6.2.0
74+
GIT_TAG 7.0.0
7575
PATCH_COMMAND sed -i -e "s/p->info->family != XC_KINETIC/p->info->kind != XC_KINETIC/g" src/work_mgga_inc.c
7676
)
77-
set( Libxc_VERSION 6.2.0 )
77+
set( Libxc_VERSION 7.0.0 )
7878

7979
set( OLD_BUILD_TESTING ${BUILD_TESTING} )
8080
set( BUILD_TESTING OFF CACHE BOOL "" FORCE )

bin/generate_primitive_kernels.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ def __init__( self, local_name, libxc_file, ofname, xc_type, dens_tol, exx_coeff
490490

491491
#libxc_prefix = '/Users/meji656/Projects/libxc/src/maple2c/'
492492
#kernel_prefix = '/Users/meji656/Projects/ExchCXX/include/exchcxx/impl/builtin/kernels/'
493-
libxc_prefix = '/home/dbwy/Software/Chemistry/libxc/6.2.0/libxc-6.2.0/src/maple2c/'
493+
#libxc_prefix = '/home/dbwy/Software/Chemistry/libxc/6.2.0/libxc-6.2.0/src/maple2c/'
494+
libxc_prefix = '/home/davidwillia/Development/ExchCXX/libxc-7.0.0/src/maple2c/'
494495
kernel_prefix = 'include/exchcxx/impl/builtin/kernels/'
495496
gen_table = {
496497

@@ -688,6 +689,71 @@ def __init__( self, local_name, libxc_file, ofname, xc_type, dens_tol, exx_coeff
688689
{'eta': '0.001'}
689690
),
690691

692+
'M062X_X' : GenMetaData( 'BuiltinM062X_X',
693+
libxc_prefix + 'mgga_exc/hyb_mgga_x_m05.c',
694+
kernel_prefix + 'm06_2x_x.hpp',
695+
'MGGA', 1e-15, 0.54,
696+
{'a_0' : '0.46',
697+
'a_1' : '-0.2206052',
698+
'a_2' : '-9.431788e-02',
699+
'a_3' : '2.164494e+00',
700+
'a_4' : '-2.556466e+00',
701+
'a_5' : '-1.422133e+01',
702+
'a_6' : '1.555044e+01',
703+
'a_7' : '3.598078e+01',
704+
'a_8' : '-2.722754e+01',
705+
'a_9' : '-3.924093e+01',
706+
'a_10': '1.522808e+01',
707+
'a_11': '1.522227e+01',
708+
'csi_HF': '1.0',
709+
'cx': '0.54'}
710+
),
711+
712+
'M062X_C' : GenMetaData( 'BuiltinM062X_C',
713+
libxc_prefix + 'mgga_exc/mgga_c_m06l.c',
714+
kernel_prefix + 'm06_2x_c.hpp',
715+
'MGGA', 1e-12, 0.0,
716+
{
717+
'gamma_ss': '0.06',
718+
'gamma_ab': '0.0031',
719+
'alpha_ss': '0.00515088',
720+
'alpha_ab': '0.00304966',
721+
'css_0': '3.097855e-01',
722+
'css_1': '-5.528642e+00',
723+
'css_2': '1.347420e+01',
724+
'css_3': '-3.213623e+01',
725+
'css_4': '2.846742e+01',
726+
'cab_0': '8.833596e-01',
727+
'cab_1': '3.357972e+01',
728+
'cab_2': '-7.043548e+01',
729+
'cab_3': '4.978271e+01',
730+
'cab_4': '-1.852891e+01',
731+
'dss_0': '6.902145e-01',
732+
'dss_1': '9.847204e-02',
733+
'dss_2': '2.214797e-01',
734+
'dss_3': '-1.968264e-03',
735+
'dss_4': '-6.775479e-03',
736+
'dss_5': '0.000000e+00',
737+
'dab_0': '1.166404e-01',
738+
'dab_1': '-9.120847e-02',
739+
'dab_2': '-6.726189e-02',
740+
'dab_3': '6.720580e-05',
741+
'dab_4': '8.448011e-04',
742+
'dab_5': '0.000000e+00',
743+
'Fermi_D_cnst': '1e-10'
744+
}
745+
),
746+
747+
'PKZB_X' : GenMetaData( 'BuiltinPKZB_X',
748+
libxc_prefix + 'mgga_exc/mgga_x_pkzb.c',
749+
kernel_prefix + 'pkzb_x.hpp',
750+
'MGGA', 1e-15, 0., {}),
751+
752+
'PKZB_C' : GenMetaData( 'BuiltinPKZB_C',
753+
libxc_prefix + 'mgga_exc/mgga_c_pkzb.c',
754+
kernel_prefix + 'pkzb_c.hpp',
755+
'MGGA', 1e-13, 0., {}),
756+
691757
'FT98' : GenMetaData( 'BuiltinFT98_X',
692758
libxc_prefix + 'mgga_exc/mgga_x_ft98.c',
693759
kernel_prefix + 'ft98_x.hpp',

include/exchcxx/enums/functionals.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ enum class Functional {
6060
SCAN,
6161
R2SCAN,
6262
R2SCANL,
63+
M062X,
64+
PKZB,
6365
EPC17_1,
6466
EPC17_2,
6567
EPC18_1,

include/exchcxx/enums/kernels.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ enum class Kernel {
9393
R2SCANL_C,
9494
R2SCANL_X,
9595
FT98_X,
96+
M062X_X,
97+
M062X_C,
98+
PKZB_X,
99+
PKZB_C,
100+
96101

97102
// KEDFs
98103
PC07_K,

include/exchcxx/impl/builtin/fwd.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ struct BuiltinSCAN_X;
7676
struct BuiltinSCAN_C;
7777
struct BuiltinR2SCAN_X;
7878
struct BuiltinR2SCAN_C;
79+
struct BuiltinM062X_X;
80+
struct BuiltinM062X_C;
81+
struct BuiltinPKZB_X;
82+
struct BuiltinPKZB_C;
7983
struct BuiltinFT98_X;
8084

8185
struct BuiltinPC07_K;

include/exchcxx/impl/builtin/kernels.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@
7777
#include <exchcxx/impl/builtin/kernels/scanl_x.hpp>
7878
#include <exchcxx/impl/builtin/kernels/r2scanl_c.hpp>
7979
#include <exchcxx/impl/builtin/kernels/r2scanl_x.hpp>
80+
#include <exchcxx/impl/builtin/kernels/m06_2x_x.hpp>
81+
#include <exchcxx/impl/builtin/kernels/m06_2x_c.hpp>
82+
#include <exchcxx/impl/builtin/kernels/pkzb_x.hpp>
83+
#include <exchcxx/impl/builtin/kernels/pkzb_c.hpp>
8084

8185
#include <exchcxx/impl/builtin/kernels/pc07_k.hpp>
8286
#include <exchcxx/impl/builtin/kernels/pc07opt_k.hpp>

include/exchcxx/impl/builtin/kernels/ft98_x.hpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct kernel_traits< BuiltinFT98_X > :
7777
const double t31 = safe_math::sqrt( t30 );
7878
const double t32 = a * t31;
7979
const double t33 = b1 * sigma;
80-
const double t35 = t28 * t33 + 0.1e1;
80+
const double t35 = t33 * t28 + 0.1e1;
8181
const double t36 = pow_1_4( t35 );
8282
const double t37 = t36 * t36;
8383
const double t38 = t37 * t36;
@@ -130,15 +130,15 @@ struct kernel_traits< BuiltinFT98_X > :
130130
const double t109 = safe_math::sqrt( t108 );
131131
const double t110 = t106 + t109;
132132
const double t112 = piecewise_functor_5( t79, -0.4e1 * t67 + 0.4e1 * t74 + 0.2e1 * b2 - 0.1e1 / t76 / 0.2e1 + t87 / 0.8e1 - t91 / 0.16e2, t97, 0.1e1 - t68 + t75 + b2 + t85 / 0.2e1 - t89 / 0.8e1 + t100 / 0.16e2 - 0.5e1 / 0.128e3 * t102, 0.1e1 / t110 );
133-
const double t114 = t112 * t60 + 0.1e1;
133+
const double t114 = t60 * t112 + 0.1e1;
134134
const double t116 = t115 * t60;
135-
const double t118 = t112 * t116 + 0.1e1;
135+
const double t118 = t116 * t112 + 0.1e1;
136136
const double t119 = t118 * t118;
137137
const double t120 = t119 * t118;
138138
const double t121 = 0.1e1 / t120;
139139
const double t122 = t114 * t121;
140140
const double t123 = t122 * t49;
141-
const double t125 = t123 * t56 + t40 * t42 + 0.1e1;
141+
const double t125 = t56 * t123 + t40 * t42 + 0.1e1;
142142
const double t133 = b * sigma;
143143
const double t137 = 0.1e1 + 0.81e2 / 0.4e1 * t130 * t131 * t133 * t28;
144144
const double t138 = 0.1e1 / t137;
@@ -192,7 +192,7 @@ struct kernel_traits< BuiltinFT98_X > :
192192
const double t31 = safe_math::sqrt( t30 );
193193
const double t32 = a * t31;
194194
const double t33 = b1 * sigma;
195-
const double t35 = t28 * t33 + 0.1e1;
195+
const double t35 = t33 * t28 + 0.1e1;
196196
const double t36 = pow_1_4( t35 );
197197
const double t37 = t36 * t36;
198198
const double t38 = t37 * t36;
@@ -245,15 +245,15 @@ struct kernel_traits< BuiltinFT98_X > :
245245
const double t109 = safe_math::sqrt( t108 );
246246
const double t110 = t106 + t109;
247247
const double t112 = piecewise_functor_5( t79, -0.4e1 * t67 + 0.4e1 * t74 + 0.2e1 * b2 - 0.1e1 / t76 / 0.2e1 + t87 / 0.8e1 - t91 / 0.16e2, t97, 0.1e1 - t68 + t75 + b2 + t85 / 0.2e1 - t89 / 0.8e1 + t100 / 0.16e2 - 0.5e1 / 0.128e3 * t102, 0.1e1 / t110 );
248-
const double t114 = t112 * t60 + 0.1e1;
248+
const double t114 = t60 * t112 + 0.1e1;
249249
const double t116 = t115 * t60;
250-
const double t118 = t112 * t116 + 0.1e1;
250+
const double t118 = t116 * t112 + 0.1e1;
251251
const double t119 = t118 * t118;
252252
const double t120 = t119 * t118;
253253
const double t121 = 0.1e1 / t120;
254254
const double t122 = t114 * t121;
255255
const double t123 = t122 * t49;
256-
const double t125 = t123 * t56 + t40 * t42 + 0.1e1;
256+
const double t125 = t56 * t123 + t40 * t42 + 0.1e1;
257257
const double t133 = b * sigma;
258258
const double t137 = 0.1e1 + 0.81e2 / 0.4e1 * t130 * t131 * t133 * t28;
259259
const double t138 = 0.1e1 / t137;
@@ -296,7 +296,7 @@ struct kernel_traits< BuiltinFT98_X > :
296296
const double t222 = piecewise_functor_3( t105, t201, 0.0 );
297297
const double t223 = 0.1e1 / t109;
298298
const double t224 = t223 * t106;
299-
const double t226 = t222 * t224 + t222;
299+
const double t226 = t224 * t222 + t222;
300300
const double t228 = piecewise_functor_5( t79, 0.64e2 / 0.3e1 * t192 - 0.4e2 / 0.3e1 * t196 + t198 * t201 / 0.2e1 - 0.3e1 / 0.8e1 * t204 * t201 + 0.5e1 / 0.16e2 * t207 * t201, t97, t199 - t200 + t76 * t201 - t86 * t201 / 0.2e1 + 0.3e1 / 0.8e1 * t90 * t201 - 0.5e1 / 0.16e2 * t216 * t201, -t221 * t226 );
301301
const double t229 = t228 * t121;
302302
const double t230 = t229 * t49;
@@ -315,15 +315,15 @@ struct kernel_traits< BuiltinFT98_X > :
315315
const double t249 = 0.1e1 / t248;
316316
const double t251 = t125 * t249 * t130;
317317
const double t253 = t252 * t172;
318-
const double t256 = t138 * t246 + 0.54e2 * t251 * t253;
318+
const double t256 = t246 * t138 + 0.54e2 * t251 * t253;
319319
const double t261 = piecewise_functor_3( t3, 0.0, -t7 * t146 * t140 / 0.8e1 - 0.3e1 / 0.16e2 * t150 * t152 * t256 );
320320
const double t264 = sigma * t22;
321321
const double t272 = t39 * t23;
322322
const double t275 = t53 * t23;
323323
const double t276 = t275 * t27;
324324
const double t278 = t184 * t23;
325325
const double t279 = t278 * t27;
326-
const double t283 = b * ( 0.2e1 * t175 * t276 - 0.2e1 * t279 * t50 );
326+
const double t283 = b * ( 0.2e1 * t175 * t276 - 0.2e1 * t50 * t279 );
327327
const double t285 = t264 * t66;
328328
const double t287 = t198 * sigma;
329329
const double t288 = t22 * t66;
@@ -502,15 +502,15 @@ struct kernel_traits< BuiltinFT98_X > :
502502
const double t153 = safe_math::cbrt( t151 );
503503
const double t155 = piecewise_functor_3( t152, t23, t153 * t151 );
504504
const double t156 = t155 * t27;
505-
const double t157 = a1 * sigma_bb;
506505
const double t158 = rho_b * rho_b;
507506
const double t159 = safe_math::cbrt( rho_b );
508507
const double t160 = t159 * t159;
509508
const double t162 = 0.1e1 / t160 / t158;
510-
const double t164 = t157 * t162 + 0.1e1;
509+
const double t164 = a1 * sigma_bb * t162 + 0.1e1;
511510
const double t165 = safe_math::sqrt( t164 );
512511
const double t166 = a * t165;
513-
const double t169 = b1 * sigma_bb * t162 + 0.1e1;
512+
const double t167 = b1 * sigma_bb;
513+
const double t169 = t167 * t162 + 0.1e1;
514514
const double t170 = pow_1_4( t169 );
515515
const double t171 = t170 * t170;
516516
const double t172 = t171 * t170;
@@ -694,15 +694,15 @@ struct kernel_traits< BuiltinFT98_X > :
694694
const double t153 = safe_math::cbrt( t151 );
695695
const double t155 = piecewise_functor_3( t152, t23, t153 * t151 );
696696
const double t156 = t155 * t27;
697-
const double t157 = a1 * sigma_bb;
698697
const double t158 = rho_b * rho_b;
699698
const double t159 = safe_math::cbrt( rho_b );
700699
const double t160 = t159 * t159;
701700
const double t162 = 0.1e1 / t160 / t158;
702-
const double t164 = t157 * t162 + 0.1e1;
701+
const double t164 = a1 * sigma_bb * t162 + 0.1e1;
703702
const double t165 = safe_math::sqrt( t164 );
704703
const double t166 = a * t165;
705-
const double t169 = b1 * sigma_bb * t162 + 0.1e1;
704+
const double t167 = b1 * sigma_bb;
705+
const double t169 = t167 * t162 + 0.1e1;
706706
const double t170 = pow_1_4( t169 );
707707
const double t171 = t170 * t170;
708708
const double t172 = t171 * t170;

0 commit comments

Comments
 (0)