jxc-python 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. jxc_python-0.1.0/PKG-INFO +15 -0
  2. jxc_python-0.1.0/README.md +320 -0
  3. jxc_python-0.1.0/jxc/__init__.py +28 -0
  4. jxc_python-0.1.0/jxc/composite.py +175 -0
  5. jxc_python-0.1.0/jxc/functionals/__init__.py +9 -0
  6. jxc_python-0.1.0/jxc/functionals/_libxc_laplacian.py +119 -0
  7. jxc_python-0.1.0/jxc/functionals/deorbitalized_common.py +120 -0
  8. jxc_python-0.1.0/jxc/functionals/gga_c_acgga.py +2995 -0
  9. jxc_python-0.1.0/jxc/functionals/gga_c_acggap.py +1539 -0
  10. jxc_python-0.1.0/jxc/functionals/gga_c_am05.py +2071 -0
  11. jxc_python-0.1.0/jxc/functionals/gga_c_bmk.py +3841 -0
  12. jxc_python-0.1.0/jxc/functionals/gga_c_ccdf.py +744 -0
  13. jxc_python-0.1.0/jxc/functionals/gga_c_chachiyo.py +1411 -0
  14. jxc_python-0.1.0/jxc/functionals/gga_c_cs1.py +1011 -0
  15. jxc_python-0.1.0/jxc/functionals/gga_c_ft97.py +2134 -0
  16. jxc_python-0.1.0/jxc/functionals/gga_c_gapc.py +1075 -0
  17. jxc_python-0.1.0/jxc/functionals/gga_c_gaploc.py +3063 -0
  18. jxc_python-0.1.0/jxc/functionals/gga_c_hcth_a.py +3555 -0
  19. jxc_python-0.1.0/jxc/functionals/gga_c_lm.py +1443 -0
  20. jxc_python-0.1.0/jxc/functionals/gga_c_lyp.py +1452 -0
  21. jxc_python-0.1.0/jxc/functionals/gga_c_lypr.py +2855 -0
  22. jxc_python-0.1.0/jxc/functionals/gga_c_op_b88.py +1668 -0
  23. jxc_python-0.1.0/jxc/functionals/gga_c_op_g96.py +1293 -0
  24. jxc_python-0.1.0/jxc/functionals/gga_c_op_pbe.py +1347 -0
  25. jxc_python-0.1.0/jxc/functionals/gga_c_op_pw91.py +1637 -0
  26. jxc_python-0.1.0/jxc/functionals/gga_c_op_xalpha.py +1116 -0
  27. jxc_python-0.1.0/jxc/functionals/gga_c_optc.py +2450 -0
  28. jxc_python-0.1.0/jxc/functionals/gga_c_p86.py +1994 -0
  29. jxc_python-0.1.0/jxc/functionals/gga_c_p86vwn.py +3445 -0
  30. jxc_python-0.1.0/jxc/functionals/gga_c_pbe.py +1883 -0
  31. jxc_python-0.1.0/jxc/functionals/gga_c_pbe_erf_gws.py +981 -0
  32. jxc_python-0.1.0/jxc/functionals/gga_c_pbe_vwn.py +2878 -0
  33. jxc_python-0.1.0/jxc/functionals/gga_c_pbeloc.py +2645 -0
  34. jxc_python-0.1.0/jxc/functionals/gga_c_pw91.py +3020 -0
  35. jxc_python-0.1.0/jxc/functionals/gga_c_q2d.py +4064 -0
  36. jxc_python-0.1.0/jxc/functionals/gga_c_regtpss.py +2256 -0
  37. jxc_python-0.1.0/jxc/functionals/gga_c_revtca.py +1442 -0
  38. jxc_python-0.1.0/jxc/functionals/gga_c_scan_e0.py +1925 -0
  39. jxc_python-0.1.0/jxc/functionals/gga_c_sg4.py +2388 -0
  40. jxc_python-0.1.0/jxc/functionals/gga_c_sogga11.py +2118 -0
  41. jxc_python-0.1.0/jxc/functionals/gga_c_tca.py +1008 -0
  42. jxc_python-0.1.0/jxc/functionals/gga_c_w94.py +661 -0
  43. jxc_python-0.1.0/jxc/functionals/gga_c_wi.py +768 -0
  44. jxc_python-0.1.0/jxc/functionals/gga_c_wl.py +566 -0
  45. jxc_python-0.1.0/jxc/functionals/gga_c_zpbeint.py +2629 -0
  46. jxc_python-0.1.0/jxc/functionals/gga_c_zvpbeint.py +2801 -0
  47. jxc_python-0.1.0/jxc/functionals/gga_c_zvpbeloc.py +2854 -0
  48. jxc_python-0.1.0/jxc/functionals/gga_k_apbe.py +872 -0
  49. jxc_python-0.1.0/jxc/functionals/gga_k_apbeint.py +1252 -0
  50. jxc_python-0.1.0/jxc/functionals/gga_k_dk.py +1061 -0
  51. jxc_python-0.1.0/jxc/functionals/gga_k_exp4.py +856 -0
  52. jxc_python-0.1.0/jxc/functionals/gga_k_lc94.py +1595 -0
  53. jxc_python-0.1.0/jxc/functionals/gga_k_lgap.py +948 -0
  54. jxc_python-0.1.0/jxc/functionals/gga_k_lgap_ge.py +840 -0
  55. jxc_python-0.1.0/jxc/functionals/gga_k_lkt.py +961 -0
  56. jxc_python-0.1.0/jxc/functionals/gga_k_llp.py +1056 -0
  57. jxc_python-0.1.0/jxc/functionals/gga_k_meyer.py +1432 -0
  58. jxc_python-0.1.0/jxc/functionals/gga_k_mpbe.py +1316 -0
  59. jxc_python-0.1.0/jxc/functionals/gga_k_ol1.py +717 -0
  60. jxc_python-0.1.0/jxc/functionals/gga_k_ol2.py +932 -0
  61. jxc_python-0.1.0/jxc/functionals/gga_k_pearson.py +861 -0
  62. jxc_python-0.1.0/jxc/functionals/gga_k_pg.py +851 -0
  63. jxc_python-0.1.0/jxc/functionals/gga_k_pw86.py +910 -0
  64. jxc_python-0.1.0/jxc/functionals/gga_k_rational_p.py +957 -0
  65. jxc_python-0.1.0/jxc/functionals/gga_k_tflw.py +757 -0
  66. jxc_python-0.1.0/jxc/functionals/gga_k_thakkar.py +1022 -0
  67. jxc_python-0.1.0/jxc/functionals/gga_k_vt84f.py +1656 -0
  68. jxc_python-0.1.0/jxc/functionals/gga_x_2d_b86.py +849 -0
  69. jxc_python-0.1.0/jxc/functionals/gga_x_2d_b86_mgc.py +785 -0
  70. jxc_python-0.1.0/jxc/functionals/gga_x_2d_b88.py +898 -0
  71. jxc_python-0.1.0/jxc/functionals/gga_x_2d_pbe.py +731 -0
  72. jxc_python-0.1.0/jxc/functionals/gga_x_airy.py +1677 -0
  73. jxc_python-0.1.0/jxc/functionals/gga_x_ak13.py +1119 -0
  74. jxc_python-0.1.0/jxc/functionals/gga_x_am05.py +1979 -0
  75. jxc_python-0.1.0/jxc/functionals/gga_x_b86.py +956 -0
  76. jxc_python-0.1.0/jxc/functionals/gga_x_b88.py +851 -0
  77. jxc_python-0.1.0/jxc/functionals/gga_x_bayesian.py +1027 -0
  78. jxc_python-0.1.0/jxc/functionals/gga_x_beefvdw.py +1637 -0
  79. jxc_python-0.1.0/jxc/functionals/gga_x_bkl.py +1117 -0
  80. jxc_python-0.1.0/jxc/functionals/gga_x_bpccac.py +1747 -0
  81. jxc_python-0.1.0/jxc/functionals/gga_x_c09x.py +860 -0
  82. jxc_python-0.1.0/jxc/functionals/gga_x_cap.py +1150 -0
  83. jxc_python-0.1.0/jxc/functionals/gga_x_chachiyo.py +1313 -0
  84. jxc_python-0.1.0/jxc/functionals/gga_x_dk87.py +1189 -0
  85. jxc_python-0.1.0/jxc/functionals/gga_x_ev93.py +1433 -0
  86. jxc_python-0.1.0/jxc/functionals/gga_x_fd_lb94.py +956 -0
  87. jxc_python-0.1.0/jxc/functionals/gga_x_ft97.py +1782 -0
  88. jxc_python-0.1.0/jxc/functionals/gga_x_g96.py +724 -0
  89. jxc_python-0.1.0/jxc/functionals/gga_x_gg99.py +1781 -0
  90. jxc_python-0.1.0/jxc/functionals/gga_x_hcth_a.py +1512 -0
  91. jxc_python-0.1.0/jxc/functionals/gga_x_hjs.py +1998 -0
  92. jxc_python-0.1.0/jxc/functionals/gga_x_hjs_b88.py +3 -0
  93. jxc_python-0.1.0/jxc/functionals/gga_x_hjs_b88_v2.py +975 -0
  94. jxc_python-0.1.0/jxc/functionals/gga_x_htbs.py +1726 -0
  95. jxc_python-0.1.0/jxc/functionals/gga_x_ityh.py +1932 -0
  96. jxc_python-0.1.0/jxc/functionals/gga_x_ityh_optx.py +1868 -0
  97. jxc_python-0.1.0/jxc/functionals/gga_x_ityh_pbe.py +1644 -0
  98. jxc_python-0.1.0/jxc/functionals/gga_x_kt.py +1194 -0
  99. jxc_python-0.1.0/jxc/functionals/gga_x_lb.py +468 -0
  100. jxc_python-0.1.0/jxc/functionals/gga_x_lg93.py +1358 -0
  101. jxc_python-0.1.0/jxc/functionals/gga_x_lspbe.py +1050 -0
  102. jxc_python-0.1.0/jxc/functionals/gga_x_lsrpbe.py +1015 -0
  103. jxc_python-0.1.0/jxc/functionals/gga_x_lv_rpw86.py +1407 -0
  104. jxc_python-0.1.0/jxc/functionals/gga_x_mpbe.py +1295 -0
  105. jxc_python-0.1.0/jxc/functionals/gga_x_n12.py +2200 -0
  106. jxc_python-0.1.0/jxc/functionals/gga_x_ncap.py +1871 -0
  107. jxc_python-0.1.0/jxc/functionals/gga_x_ol2.py +910 -0
  108. jxc_python-0.1.0/jxc/functionals/gga_x_optx.py +905 -0
  109. jxc_python-0.1.0/jxc/functionals/gga_x_pbe.py +723 -0
  110. jxc_python-0.1.0/jxc/functionals/gga_x_pbe_erf_gws.py +470 -0
  111. jxc_python-0.1.0/jxc/functionals/gga_x_pbea.py +702 -0
  112. jxc_python-0.1.0/jxc/functionals/gga_x_pbeint.py +1229 -0
  113. jxc_python-0.1.0/jxc/functionals/gga_x_pbepow.py +991 -0
  114. jxc_python-0.1.0/jxc/functionals/gga_x_pbetrans.py +1251 -0
  115. jxc_python-0.1.0/jxc/functionals/gga_x_pw86.py +1030 -0
  116. jxc_python-0.1.0/jxc/functionals/gga_x_pw91.py +1572 -0
  117. jxc_python-0.1.0/jxc/functionals/gga_x_q1d.py +1312 -0
  118. jxc_python-0.1.0/jxc/functionals/gga_x_q2d.py +1404 -0
  119. jxc_python-0.1.0/jxc/functionals/gga_x_rge2.py +820 -0
  120. jxc_python-0.1.0/jxc/functionals/gga_x_rpbe.py +845 -0
  121. jxc_python-0.1.0/jxc/functionals/gga_x_s12.py +1230 -0
  122. jxc_python-0.1.0/jxc/functionals/gga_x_sfat.py +1748 -0
  123. jxc_python-0.1.0/jxc/functionals/gga_x_sfat_pbe.py +2268 -0
  124. jxc_python-0.1.0/jxc/functionals/gga_x_sg4.py +1089 -0
  125. jxc_python-0.1.0/jxc/functionals/gga_x_sogga11.py +1715 -0
  126. jxc_python-0.1.0/jxc/functionals/gga_x_ssb_sw.py +1242 -0
  127. jxc_python-0.1.0/jxc/functionals/gga_x_vmt.py +1099 -0
  128. jxc_python-0.1.0/jxc/functionals/gga_x_vmt84.py +1310 -0
  129. jxc_python-0.1.0/jxc/functionals/gga_x_wc.py +1040 -0
  130. jxc_python-0.1.0/jxc/functionals/gga_x_wpbeh.py +1723 -0
  131. jxc_python-0.1.0/jxc/functionals/gga_xc_b97.py +2108 -0
  132. jxc_python-0.1.0/jxc/functionals/gga_xc_th1.py +989 -0
  133. jxc_python-0.1.0/jxc/functionals/gga_xc_th2.py +1158 -0
  134. jxc_python-0.1.0/jxc/functionals/gga_xc_th3.py +1312 -0
  135. jxc_python-0.1.0/jxc/functionals/hyb_gga_x_cam_s12.py +2201 -0
  136. jxc_python-0.1.0/jxc/functionals/hyb_gga_xc_case21.py +2852 -0
  137. jxc_python-0.1.0/jxc/functionals/hyb_gga_xc_wb97.py +2607 -0
  138. jxc_python-0.1.0/jxc/functionals/hyb_lda_xc_bn05.py +490 -0
  139. jxc_python-0.1.0/jxc/functionals/hyb_mgga_x_dldf.py +1281 -0
  140. jxc_python-0.1.0/jxc/functionals/hyb_mgga_x_js18.py +1491 -0
  141. jxc_python-0.1.0/jxc/functionals/hyb_mgga_x_m05.py +2456 -0
  142. jxc_python-0.1.0/jxc/functionals/hyb_mgga_x_pjs18.py +132 -0
  143. jxc_python-0.1.0/jxc/functionals/hyb_mgga_xc_gas22.py +2502 -0
  144. jxc_python-0.1.0/jxc/functionals/hyb_mgga_xc_wb97mv.py +3679 -0
  145. jxc_python-0.1.0/jxc/functionals/jax_derivatives.py +452 -0
  146. jxc_python-0.1.0/jxc/functionals/lda_c_1d_csc.py +221 -0
  147. jxc_python-0.1.0/jxc/functionals/lda_c_1d_loos.py +173 -0
  148. jxc_python-0.1.0/jxc/functionals/lda_c_2d_amgb.py +238 -0
  149. jxc_python-0.1.0/jxc/functionals/lda_c_2d_prm.py +195 -0
  150. jxc_python-0.1.0/jxc/functionals/lda_c_chachiyo.py +287 -0
  151. jxc_python-0.1.0/jxc/functionals/lda_c_chachiyo_mod.py +300 -0
  152. jxc_python-0.1.0/jxc/functionals/lda_c_epc17.py +188 -0
  153. jxc_python-0.1.0/jxc/functionals/lda_c_epc18.py +203 -0
  154. jxc_python-0.1.0/jxc/functionals/lda_c_gk72.py +131 -0
  155. jxc_python-0.1.0/jxc/functionals/lda_c_gombas.py +91 -0
  156. jxc_python-0.1.0/jxc/functionals/lda_c_hl.py +232 -0
  157. jxc_python-0.1.0/jxc/functionals/lda_c_lp96.py +133 -0
  158. jxc_python-0.1.0/jxc/functionals/lda_c_ml1.py +286 -0
  159. jxc_python-0.1.0/jxc/functionals/lda_c_pk09.py +2017 -0
  160. jxc_python-0.1.0/jxc/functionals/lda_c_pmgb06.py +4141 -0
  161. jxc_python-0.1.0/jxc/functionals/lda_c_pw.py +2036 -0
  162. jxc_python-0.1.0/jxc/functionals/lda_c_pw_erf.py +4347 -0
  163. jxc_python-0.1.0/jxc/functionals/lda_c_pz.py +1215 -0
  164. jxc_python-0.1.0/jxc/functionals/lda_c_rc04.py +542 -0
  165. jxc_python-0.1.0/jxc/functionals/lda_c_rpa.py +217 -0
  166. jxc_python-0.1.0/jxc/functionals/lda_c_vwn.py +2321 -0
  167. jxc_python-0.1.0/jxc/functionals/lda_c_vwn_1.py +1764 -0
  168. jxc_python-0.1.0/jxc/functionals/lda_c_vwn_2.py +3634 -0
  169. jxc_python-0.1.0/jxc/functionals/lda_c_vwn_3.py +3992 -0
  170. jxc_python-0.1.0/jxc/functionals/lda_c_vwn_4.py +2353 -0
  171. jxc_python-0.1.0/jxc/functionals/lda_c_vwn_rpa.py +1764 -0
  172. jxc_python-0.1.0/jxc/functionals/lda_c_w20.py +193 -0
  173. jxc_python-0.1.0/jxc/functionals/lda_c_wigner.py +383 -0
  174. jxc_python-0.1.0/jxc/functionals/lda_k_gds08_worker.py +755 -0
  175. jxc_python-0.1.0/jxc/functionals/lda_k_tf.py +411 -0
  176. jxc_python-0.1.0/jxc/functionals/lda_k_zlp.py +473 -0
  177. jxc_python-0.1.0/jxc/functionals/lda_x.py +510 -0
  178. jxc_python-0.1.0/jxc/functionals/lda_x_1d_exponential.py +699 -0
  179. jxc_python-0.1.0/jxc/functionals/lda_x_1d_soft.py +682 -0
  180. jxc_python-0.1.0/jxc/functionals/lda_x_2d.py +360 -0
  181. jxc_python-0.1.0/jxc/functionals/lda_x_erf.py +1602 -0
  182. jxc_python-0.1.0/jxc/functionals/lda_x_rel.py +809 -0
  183. jxc_python-0.1.0/jxc/functionals/lda_x_sloc.py +501 -0
  184. jxc_python-0.1.0/jxc/functionals/lda_x_yukawa.py +2027 -0
  185. jxc_python-0.1.0/jxc/functionals/lda_xc_1d_ehwlrg.py +363 -0
  186. jxc_python-0.1.0/jxc/functionals/lda_xc_ksdt.py +2668 -0
  187. jxc_python-0.1.0/jxc/functionals/lda_xc_teter93.py +828 -0
  188. jxc_python-0.1.0/jxc/functionals/lda_xc_tih.py +178 -0
  189. jxc_python-0.1.0/jxc/functionals/lda_xc_zlp.py +219 -0
  190. jxc_python-0.1.0/jxc/functionals/mgga_c_b88.py +2739 -0
  191. jxc_python-0.1.0/jxc/functionals/mgga_c_b94.py +2708 -0
  192. jxc_python-0.1.0/jxc/functionals/mgga_c_bc95.py +1717 -0
  193. jxc_python-0.1.0/jxc/functionals/mgga_c_cc.py +1839 -0
  194. jxc_python-0.1.0/jxc/functionals/mgga_c_ccalda.py +2564 -0
  195. jxc_python-0.1.0/jxc/functionals/mgga_c_cs.py +885 -0
  196. jxc_python-0.1.0/jxc/functionals/mgga_c_kcis.py +2113 -0
  197. jxc_python-0.1.0/jxc/functionals/mgga_c_kcisk.py +1741 -0
  198. jxc_python-0.1.0/jxc/functionals/mgga_c_ltapw.py +2321 -0
  199. jxc_python-0.1.0/jxc/functionals/mgga_c_m05.py +4277 -0
  200. jxc_python-0.1.0/jxc/functionals/mgga_c_m06l.py +2922 -0
  201. jxc_python-0.1.0/jxc/functionals/mgga_c_m08.py +1002 -0
  202. jxc_python-0.1.0/jxc/functionals/mgga_c_pkzb.py +1981 -0
  203. jxc_python-0.1.0/jxc/functionals/mgga_c_r2scan.py +2422 -0
  204. jxc_python-0.1.0/jxc/functionals/mgga_c_r2scanl.py +24 -0
  205. jxc_python-0.1.0/jxc/functionals/mgga_c_revscan.py +3408 -0
  206. jxc_python-0.1.0/jxc/functionals/mgga_c_revtpss.py +1758 -0
  207. jxc_python-0.1.0/jxc/functionals/mgga_c_rmggac.py +3123 -0
  208. jxc_python-0.1.0/jxc/functionals/mgga_c_rppscan.py +3664 -0
  209. jxc_python-0.1.0/jxc/functionals/mgga_c_rregtm.py +3692 -0
  210. jxc_python-0.1.0/jxc/functionals/mgga_c_rscan.py +3403 -0
  211. jxc_python-0.1.0/jxc/functionals/mgga_c_scan.py +3690 -0
  212. jxc_python-0.1.0/jxc/functionals/mgga_c_scanl.py +24 -0
  213. jxc_python-0.1.0/jxc/functionals/mgga_c_tpss.py +1644 -0
  214. jxc_python-0.1.0/jxc/functionals/mgga_c_tpssloc.py +1714 -0
  215. jxc_python-0.1.0/jxc/functionals/mgga_c_vsxc.py +4077 -0
  216. jxc_python-0.1.0/jxc/functionals/mgga_k_csk.py +1641 -0
  217. jxc_python-0.1.0/jxc/functionals/mgga_k_csk_loc.py +1788 -0
  218. jxc_python-0.1.0/jxc/functionals/mgga_k_gea2.py +745 -0
  219. jxc_python-0.1.0/jxc/functionals/mgga_k_gea4.py +858 -0
  220. jxc_python-0.1.0/jxc/functionals/mgga_k_lk.py +1345 -0
  221. jxc_python-0.1.0/jxc/functionals/mgga_k_pc07.py +1765 -0
  222. jxc_python-0.1.0/jxc/functionals/mgga_k_pgslb.py +960 -0
  223. jxc_python-0.1.0/jxc/functionals/mgga_k_rda.py +2014 -0
  224. jxc_python-0.1.0/jxc/functionals/mgga_x_2d_js17.py +985 -0
  225. jxc_python-0.1.0/jxc/functionals/mgga_x_2d_prhg07.py +1171 -0
  226. jxc_python-0.1.0/jxc/functionals/mgga_x_2d_prp10.py +860 -0
  227. jxc_python-0.1.0/jxc/functionals/mgga_x_br89.py +2462 -0
  228. jxc_python-0.1.0/jxc/functionals/mgga_x_br89_explicit.py +908 -0
  229. jxc_python-0.1.0/jxc/functionals/mgga_x_edmgga.py +1691 -0
  230. jxc_python-0.1.0/jxc/functionals/mgga_x_eel.py +1657 -0
  231. jxc_python-0.1.0/jxc/functionals/mgga_x_ft98.py +2959 -0
  232. jxc_python-0.1.0/jxc/functionals/mgga_x_gdme.py +947 -0
  233. jxc_python-0.1.0/jxc/functionals/mgga_x_gvt4.py +1186 -0
  234. jxc_python-0.1.0/jxc/functionals/mgga_x_gx.py +1564 -0
  235. jxc_python-0.1.0/jxc/functionals/mgga_x_jk.py +1330 -0
  236. jxc_python-0.1.0/jxc/functionals/mgga_x_ktbm.py +1860 -0
  237. jxc_python-0.1.0/jxc/functionals/mgga_x_lak.py +3455 -0
  238. jxc_python-0.1.0/jxc/functionals/mgga_x_lta.py +723 -0
  239. jxc_python-0.1.0/jxc/functionals/mgga_x_m06l.py +2843 -0
  240. jxc_python-0.1.0/jxc/functionals/mgga_x_m08.py +3238 -0
  241. jxc_python-0.1.0/jxc/functionals/mgga_x_m11.py +3277 -0
  242. jxc_python-0.1.0/jxc/functionals/mgga_x_m11_l.py +3227 -0
  243. jxc_python-0.1.0/jxc/functionals/mgga_x_mbeef.py +1084 -0
  244. jxc_python-0.1.0/jxc/functionals/mgga_x_mbeefvdw.py +1659 -0
  245. jxc_python-0.1.0/jxc/functionals/mgga_x_mbr.py +1708 -0
  246. jxc_python-0.1.0/jxc/functionals/mgga_x_mbrxc_bg.py +1844 -0
  247. jxc_python-0.1.0/jxc/functionals/mgga_x_mbrxh_bg.py +2579 -0
  248. jxc_python-0.1.0/jxc/functionals/mgga_x_mcml.py +1126 -0
  249. jxc_python-0.1.0/jxc/functionals/mgga_x_mggac.py +1760 -0
  250. jxc_python-0.1.0/jxc/functionals/mgga_x_mn12.py +3541 -0
  251. jxc_python-0.1.0/jxc/functionals/mgga_x_ms.py +1635 -0
  252. jxc_python-0.1.0/jxc/functionals/mgga_x_msb.py +1869 -0
  253. jxc_python-0.1.0/jxc/functionals/mgga_x_msb86bl.py +2097 -0
  254. jxc_python-0.1.0/jxc/functionals/mgga_x_mspbel.py +1789 -0
  255. jxc_python-0.1.0/jxc/functionals/mgga_x_msrpbel.py +1850 -0
  256. jxc_python-0.1.0/jxc/functionals/mgga_x_mvs.py +1491 -0
  257. jxc_python-0.1.0/jxc/functionals/mgga_x_mvsb.py +1769 -0
  258. jxc_python-0.1.0/jxc/functionals/mgga_x_pbe_gx.py +1384 -0
  259. jxc_python-0.1.0/jxc/functionals/mgga_x_pkzb.py +1043 -0
  260. jxc_python-0.1.0/jxc/functionals/mgga_x_r2scan.py +3019 -0
  261. jxc_python-0.1.0/jxc/functionals/mgga_x_r2scanl.py +24 -0
  262. jxc_python-0.1.0/jxc/functionals/mgga_x_r4scan.py +3944 -0
  263. jxc_python-0.1.0/jxc/functionals/mgga_x_regtm.py +2826 -0
  264. jxc_python-0.1.0/jxc/functionals/mgga_x_regtpss.py +3203 -0
  265. jxc_python-0.1.0/jxc/functionals/mgga_x_revscan.py +52 -0
  266. jxc_python-0.1.0/jxc/functionals/mgga_x_revscanl.py +24 -0
  267. jxc_python-0.1.0/jxc/functionals/mgga_x_revtm.py +2200 -0
  268. jxc_python-0.1.0/jxc/functionals/mgga_x_rlda.py +838 -0
  269. jxc_python-0.1.0/jxc/functionals/mgga_x_rppscan.py +2121 -0
  270. jxc_python-0.1.0/jxc/functionals/mgga_x_rscan.py +1399 -0
  271. jxc_python-0.1.0/jxc/functionals/mgga_x_rtpss.py +2192 -0
  272. jxc_python-0.1.0/jxc/functionals/mgga_x_sa_tpss.py +3075 -0
  273. jxc_python-0.1.0/jxc/functionals/mgga_x_scan.py +2491 -0
  274. jxc_python-0.1.0/jxc/functionals/mgga_x_scanl.py +24 -0
  275. jxc_python-0.1.0/jxc/functionals/mgga_x_task.py +768 -0
  276. jxc_python-0.1.0/jxc/functionals/mgga_x_tau_hcth.py +1760 -0
  277. jxc_python-0.1.0/jxc/functionals/mgga_x_tb09.py +2005 -0
  278. jxc_python-0.1.0/jxc/functionals/mgga_x_th.py +703 -0
  279. jxc_python-0.1.0/jxc/functionals/mgga_x_tm.py +1933 -0
  280. jxc_python-0.1.0/jxc/functionals/mgga_x_tpss.py +2428 -0
  281. jxc_python-0.1.0/jxc/functionals/mgga_x_vcml.py +1109 -0
  282. jxc_python-0.1.0/jxc/functionals/mgga_x_vt84.py +2703 -0
  283. jxc_python-0.1.0/jxc/functionals/mgga_xc_b97mv.py +5485 -0
  284. jxc_python-0.1.0/jxc/functionals/mgga_xc_b98.py +3903 -0
  285. jxc_python-0.1.0/jxc/functionals/mgga_xc_cc06.py +2223 -0
  286. jxc_python-0.1.0/jxc/functionals/mgga_xc_lp90.py +476 -0
  287. jxc_python-0.1.0/jxc/functionals/mgga_xc_zlp.py +583 -0
  288. jxc_python-0.1.0/jxc/functionals/util.py +2 -0
  289. jxc_python-0.1.0/jxc/functionals/utils.py +982 -0
  290. jxc_python-0.1.0/jxc/get_params.py +570 -0
  291. jxc_python-0.1.0/jxc/helper.cpython-313-x86_64-linux-gnu.so +0 -0
  292. jxc_python-0.1.0/jxc/libxc_aliases.py +82 -0
  293. jxc_python-0.1.0/jxc/maple_series_overrides.py +42 -0
  294. jxc_python-0.1.0/jxc/maple_taylor_overrides.py +21 -0
  295. jxc_python-0.1.0/jxc_python.egg-info/PKG-INFO +15 -0
  296. jxc_python-0.1.0/jxc_python.egg-info/SOURCES.txt +301 -0
  297. jxc_python-0.1.0/jxc_python.egg-info/dependency_links.txt +1 -0
  298. jxc_python-0.1.0/jxc_python.egg-info/requires.txt +10 -0
  299. jxc_python-0.1.0/jxc_python.egg-info/top_level.txt +1 -0
  300. jxc_python-0.1.0/pyproject.toml +139 -0
  301. jxc_python-0.1.0/setup.cfg +4 -0
  302. jxc_python-0.1.0/setup.py +69 -0
  303. jxc_python-0.1.0/tests/test_composite.py +105 -0
@@ -0,0 +1,15 @@
1
+ Metadata-Version: 2.4
2
+ Name: jxc-python
3
+ Version: 0.1.0
4
+ Summary: JAX-based exchange-correlation functionals library
5
+ Requires-Python: <3.14,>=3.11
6
+ Requires-Dist: wheel>=0.37.0
7
+ Requires-Dist: setuptools==68.2.2
8
+ Requires-Dist: absl-py==2.1.0
9
+ Requires-Dist: jaxtyping>=0.2.0
10
+ Requires-Dist: numpy<3.0.0,>=2.0.0
11
+ Requires-Dist: scipy>=1.15.0
12
+ Requires-Dist: ml-dtypes>=0.5.0
13
+ Requires-Dist: opt-einsum>=3.4.0
14
+ Requires-Dist: jinja2>=3.0.0
15
+ Requires-Dist: matplotlib>=3.10.7
@@ -0,0 +1,320 @@
1
+ # JXC
2
+
3
+ Translation of LibXC into JAX and Julia.
4
+
5
+ ## Quickstart
6
+
7
+ ### Python Usage
8
+
9
+ **Preferred API: `get_xc_functional()` (supports composites)**
10
+
11
+ `jxc.get_xc_functional()` returns a callable that handles both single-component
12
+ and composite functionals without having to import generated Maple modules:
13
+
14
+ ``` python
15
+ import jxc
16
+ import jax.numpy as jnp
17
+
18
+ # Works with single-component functionals
19
+ lda_func = jxc.get_xc_functional('lda_x', polarized=False)
20
+ rho = jnp.array([0.1, 0.2, 0.3])
21
+ print(lda_func(rho)) # Returns epsilon_xc values
22
+
23
+ # Works with composite functionals (e.g., B3LYP)
24
+ b3lyp = jxc.get_xc_functional('hyb_gga_xc_b3lyp', polarized=False)
25
+ sigma = jnp.array([0.01, 0.05, 0.1]) # |grad rho|^2
26
+ print(b3lyp(rho, s=sigma)) # Composite of 4 functionals
27
+
28
+ # Access hybrid parameters
29
+ print(b3lyp.cam_alpha) # 0.2 for B3LYP (20% HF exchange)
30
+ ```
31
+
32
+ This API automatically handles:
33
+ - **Single-component functionals**: Direct calls to generated Maple translations (272 functionals)
34
+ - **Composite functionals**: Weighted combinations like B3LYP (407 additional functionals)
35
+ - **Hybrid metadata**: Exposes `cam_alpha`, `cam_beta`, `cam_omega` for range-separated hybrids
36
+ - **NLC parameters**: Exposes `nlc_b`, `nlc_C` for non-local correlation
37
+
38
+ #### High-Level Derivative API (Python)
39
+
40
+ `get_xc_functional` also returns fully assembled derivative callables:
41
+
42
+ ```python
43
+ import jxc
44
+ import numpy as np
45
+
46
+ rho = np.linspace(1e-4, 0.5, 32)
47
+ sigma = 0.1 * rho**(4/3)
48
+
49
+ vxc = jxc.get_xc_functional("gga_x_pbe", polarized=False, order="vxc")
50
+ print("vrho:", vxc(rho, sigma=sigma)["vrho"][:3])
51
+
52
+ fxc = jxc.get_xc_functional("gga_x_pbe", polarized=False, order="fxc")
53
+ print("v2rho2:", fxc(rho, sigma=sigma)["v2rho2"][:3])
54
+
55
+ # Higher orders use the same API:
56
+ kxc = jxc.get_xc_functional("gga_x_pbe", polarized=False, order="kxc")
57
+ lxc = jxc.get_xc_functional("gga_x_pbe", polarized=False, order="lxc")
58
+ print("v3rho3 shape:", kxc(rho, sigma=sigma)["v3rho3"].shape)
59
+ print("v4rho4 shape:", lxc(rho, sigma=sigma)["v4rho4"].shape)
60
+ ```
61
+
62
+ All derivative orders (`vxc`, `fxc`, `kxc`, `lxc`) can also accept a
63
+ precomputed parameter object as the first positional argument
64
+ (`f(params, rho, ...)`), but this is optional; if omitted, `get_xc_functional`
65
+ internally calls `get_params` for you. Julia’s API remains EXC-only for now.
66
+
67
+ #### Listing available functionals
68
+
69
+ To discover which LibXC functionals JXC can use, call:
70
+
71
+ ```python
72
+ import jxc
73
+
74
+ all_names = jxc.list_functionals()
75
+ print(len(all_names), "functionals available")
76
+ print([n for n in all_names if "blyp" in n.lower()])
77
+ ```
78
+
79
+ This uses LibXC’s registry via `pylibxc.util.xc_available_functional_names()`
80
+ when available and otherwise falls back to the set of generated Maple modules
81
+ in `jxc.functionals`.
82
+
83
+ #### Example: constructing BLYP from components
84
+
85
+ LibXC does not expose a single `gga_xc_blyp` name; “BLYP” is conventionally
86
+ `B88` exchange + `LYP` correlation. You can build it explicitly:
87
+
88
+ ```python
89
+ import jax.numpy as jnp
90
+ import jxc
91
+
92
+ rho = jnp.linspace(1e-4, 0.5, 32)
93
+ s = 0.1 * rho ** (4 / 3) # |∇ρ|^2 for GGA
94
+
95
+ ex_b88 = jxc.get_xc_functional("gga_x_b88", polarized=False) # exchange only
96
+ ec_lyp = jxc.get_xc_functional("gga_c_lyp", polarized=False) # correlation only
97
+
98
+ def blyp(rho, s=None):
99
+ """Pure BLYP = B88 exchange + LYP correlation."""
100
+ return ex_b88(rho, s=s) + ec_lyp(rho, s=s)
101
+
102
+ eps_xc = blyp(rho, s=s)
103
+ print("BLYP ε_xc:", eps_xc[:3])
104
+ ```
105
+
106
+ This BLYP construction is different from “B3LYP without HF”: B3LYP uses
107
+ additional LSDA/VWN mixing and fixed coefficients on B88/LYP, whereas the
108
+ example above is pure B88 + pure LYP.
109
+
110
+ **Important Note on Hybrid Functionals:**
111
+ JXC returns the DFT component (epsilon_xc) only. For hybrid functionals with exact (Hartree-Fock) exchange:
112
+ - Use `cam_alpha` to determine the HF exchange fraction (e.g., 0.2 for B3LYP = 20% HF exchange)
113
+ - Your upstream code must compute the HF exchange term separately
114
+ - Total energy: E_xc = (1 - cam_alpha) * E_DFT + cam_alpha * E_HF
115
+
116
+ ### Julia Usage (Package: JXC)
117
+
118
+ We provide a native Julia module named `JXC` under `JXC.jl`.
119
+
120
+ Start a Julia REPL in the module folder (set `JULIA_PKG_SERVER=""` if your network blocks the regional mirrors):
121
+ ```bash
122
+ pushd JXC.jl
123
+ export JULIA_PKG_SERVER="" # optional but avoids geo-routed mirrors such as in.pkg.julialang.org
124
+ julia --project
125
+ ```
126
+
127
+ Then in Julia (option A: use as a package):
128
+ ```julia
129
+ using Pkg
130
+ Pkg.instantiate()
131
+ using JXC
132
+
133
+ # Python-style EXC API parity
134
+ lda = JXC.get_xc_functional("lda_x"; polarized=false)
135
+ rho = fill(0.3, 4)
136
+ p = JXC.get_params("lda_x", JXC.XC_UNPOLARIZED)
137
+ println("LDA ε_xc: ", lda(p, rho))
138
+
139
+ # Composite example (B3LYP)
140
+ b3lyp = JXC.get_xc_functional("hyb_gga_xc_b3lyp"; polarized=false)
141
+ sigma = fill(0.01, length(rho))
142
+ println("B3LYP ε_xc: ", b3lyp(rho; s=sigma))
143
+ println("B3LYP cam_alpha: ", b3lyp.cam_alpha)
144
+ ```
145
+
146
+ Or (option B: without package registration): `include("src/JXC.jl"); using .JXC`
147
+ If you are activating a different project and want to make this checkout available globally,
148
+ run `Pkg.develop(path="/path/to/JXC.jl")` from that outer environment.
149
+
150
+ Notes:
151
+ - Python Maple outputs live under `jxc/functionals/` (tracked in git).
152
+ - Julia Maple outputs live under `JXC.jl/src/functionals/` (tracked in git).
153
+ - Julia callables expose the same hybrid/NLC metadata as Python (`cam_alpha`, `cam_beta`, `cam_omega`, `nlc_b`, `nlc_C`) so you can inspect HF fractions directly from `get_xc_functional`.
154
+ - To (re)generate locally, run `make convert-maple` and/or `make convert-maple-julia`, then `make pregenerate-commit` to commit the results.
155
+
156
+ ## Testing & Parity
157
+
158
+ | Command | Scope | Notes |
159
+ | --- | --- | --- |
160
+ | `bazel test //tests:jax_parity_test_*` | Python energy parity | auto-generated targets covering the full LibXC catalogue |
161
+ | `bazel test //tests/derivatives/vxc:all_vxc_functionals` | Python VXC parity | compares `jxc.derivatives.ad_derivs` derivatives against LibXC |
162
+ | `bazel test //tests:julia_parity_test` | Julia energy smoke | mirrors the structure of `jax_parity_test.py` for a small representative set (`lda_x`, `lda_c_pw`, `gga_x_pbe`, `gga_c_pbe`) |
163
+ | `bazel test //tests:julia_vxc_parity_test` | Julia VXC smoke | ensures the PythonCall-backed Laplacian helpers are wired correctly |
164
+ | `make julia-test` | Convenience wrapper | runs the two Julia Bazel targets above |
165
+
166
+ The parity suites are the canonical source of truth—consult `tests/jax_parity_test.py`, `tests/derivatives/vxc/`, and `tests/julia_parity_test.jl` for the exact tolerances in use. Expand the Julia list as additional functionals stabilise.
167
+
168
+ ## Prerequisites
169
+
170
+ ### Required Software
171
+
172
+ 1. **Maple 18** (optional) – Only needed if you regenerate functionals
173
+ - If not available, pre-generated functionals in `JXC.jl/src/functionals` are used
174
+
175
+ 2. **Python 3.12** - Required Python version (project uses `uv` for env management)
176
+
177
+ 3. **Build tools**:
178
+ - CMake (>= 3.5)
179
+ - C/C++ compiler (gcc/clang)
180
+ - wget
181
+ - tar
182
+ - patch
183
+
184
+ ### System Dependencies
185
+ `Arch Linux`
186
+ ```bash
187
+ sudo pacman -S cmake gcc wget tar patch
188
+ ```
189
+
190
+ `Ubuntu/Debian`
191
+ ```bash
192
+ sudo apt install cmake build-essential wget tar patch
193
+ ```
194
+
195
+
196
+ ## Local Build
197
+
198
+ All commands below assume you are inside `projects/jxc/`. The repository uses
199
+ [`uv`](https://docs.astral.sh/uv/) so you can stay in a regular shell—prefix
200
+ build steps with `uv run` instead of activating the virtualenv.
201
+
202
+ ```bash
203
+ # create venv, build and install both pylibxc + jxc (default python version 3.13)
204
+ make install
205
+
206
+ # switch to python 3.12
207
+ PYVER=3.12 make install
208
+
209
+ # Launch an interactive shell
210
+ uv run ipython
211
+
212
+ # Discover other handy targets
213
+ make help
214
+ ```
215
+
216
+ `make build-wheel` automatically runs `git submodule update --init --recursive`,
217
+ regenerates the helper glue, builds (or reuses) the LibXC core under
218
+ `.libxc-core/`, compiles the pybind11 helper against that installation, bundles
219
+ the Python sources, and drops a wheel into `dist/`. Use `make install` to
220
+ install the freshly built `pylibxc` and `jxc` wheels into the selected `uv`
221
+ environment. The first phase (`scripts/build_libxc_core.sh`) only
222
+ runs when `.libxc-core` is absent; subsequent builds for new Python versions
223
+ reuse the same C artifacts.
224
+
225
+ The Makefile always targets `.venv`; when you set `PYVER=3.12` (or similar)
226
+ the `venv` prerequisite will recreate `.venv` with that interpreter before the
227
+ rest of the build runs. `make build` remains an alias for the same pipeline.
228
+
229
+ ### Julia (Native Package: JXC)
230
+
231
+ The Julia package now lives under `projects/jxc/JXC.jl`.
232
+
233
+ > **Heads-up:** `JXC.get_params` defers to the Python helper via
234
+ > [PythonCall.jl](https://github.com/JuliaPy/PythonCall.jl). Build the helper
235
+ > (`make build-wheel` / `make install`) so that `pylibxc` and the `jxc.helper`
236
+ > extension are importable, or point Julia at your existing virtualenv with
237
+ > `JULIA_CONDAPKG_BACKEND=Null JULIA_PYTHONCALL_EXE=@venv julia --project`.
238
+ > If those prerequisites are missing, the Julia API will fall back to a minimal
239
+ > parameter stub and emit a warning.
240
+
241
+ > Use `make sync-julia-wheels` (and optionally `PYVER=3.12 make sync-julia-wheels`)
242
+ > to copy freshly built `pylibxc`/`jxc` wheels, the matching helper, and a cached
243
+ > NumPy wheel into `JXC.jl/python_wheels`. Run `make package-julia` to produce a
244
+ > tarball under `artifacts/` that GitHub Actions can publish as the Julia bundle.
245
+
246
+ If you are preparing a distributable Julia package, run `make sync-julia-wheels`
247
+ after building so the latest `pylibxc`/`jxc` wheels are copied into
248
+ `JXC.jl/python_wheels/`. The Julia runtime will install from that cache on first
249
+ use when the helper is absent.
250
+
251
+ ```bash
252
+ # Start Julia REPL in project
253
+ pushd projects/jxc/JXC.jl && julia --project
254
+ ```
255
+
256
+ ```julia
257
+ using Pkg; Pkg.instantiate(); using JXC
258
+ p = JXC.get_params("lda_x", JXC.XC_UNPOLARIZED); println("LDA unpol:", JXC.lda_x.unpol(p, 0.3))
259
+ pp = JXC.get_params("gga_x_pbe", JXC.XC_UNPOLARIZED); println("PBE unpol:", JXC.gga_x_pbe.unpol(pp, 0.3))
260
+ ```
261
+
262
+ ## Performance Benchmarks
263
+
264
+ JXC provides significant performance improvements over pylibxc, especially for larger batch sizes. Below are benchmark results comparing JXC against pylibxc on both CPU and GPU backends.
265
+
266
+ ### CPU Performance
267
+
268
+ ![CPU Benchmark](docs/bench_cpu.png)
269
+
270
+ **CPU Speedup Distribution:**
271
+ - **Batch=1,000**: Median 7.6x faster, Mean 9.5x faster (range: 0.3x - 120x)
272
+ - **Batch=100,000**: Median 439x faster, Mean 616x faster (range: 3.1x - 9,120x)
273
+
274
+ ### GPU Performance
275
+
276
+ ![GPU Benchmark](docs/bench_gpu.png)
277
+
278
+ **GPU Speedup Distribution:**
279
+ - **Batch=1,000**: Median 2.7x faster, Mean 3.3x faster (range: 0.0x - 14.9x)
280
+ - **Batch=100,000**: Median 194x faster, Mean 243x faster (range: 0.0x - 1,413x)
281
+
282
+ The histograms show that JXC provides substantial speedups across most functionals, with performance gains increasing significantly for larger batch sizes. The CPU backend shows particularly impressive speedups, with many functionals achieving >100x performance improvements at batch size 100,000.
283
+
284
+ ### Derivative Performance (VXC)
285
+
286
+ ![VXC Derivative Benchmark](docs/bench_deriv_vxc.png)
287
+
288
+ **VXC Derivative Speedup Highlights:**
289
+ - **Maple-generated code**: Up to 130x faster than pylibxc for functionals like `mgga_x_r2scan` and `hyb_gga_xc_b3lyp`
290
+ - **JAX AD**: Comparable performance to Maple code, with most functionals showing 20-100x speedup
291
+ - Median speedup across all functionals: ~25x for both Maple and AD approaches
292
+
293
+ The chart compares first derivative (VXC) computation performance for a batch size of 100 points. Blue bars show speedup from Maple-generated analytical derivatives, while orange bars show JAX automatic differentiation performance. Both approaches significantly outperform pylibxc's implementation.
294
+
295
+ **Benchmark Details:**
296
+ - Tested on 620 functionals (626 total, 6 excluded due to extreme compilation times)
297
+ - Each functional tested with polarized/unpolarized variants
298
+ - Batch sizes: 1,000 and 100,000 grid points
299
+ - Speedup = pylibxc_time / jxc_time (higher is better)
300
+
301
+ ## Notes on Coverage
302
+
303
+ - The Bazel parity suites (see table above) are the authoritative source for supported functionals and tolerances.
304
+ - The Julia harness is intentionally limited to a smoke subset while the native codegen evolves.
305
+ - Deprecated tables that previously tracked unsupported or numerically delicate functionals have been removed; refer to the test logs instead.
306
+
307
+ ## Troubleshooting
308
+
309
+ ### Maple Not Found
310
+ Maple is only required for local code generation (`make convert-maple*`). CI never runs Maple.
311
+ If you need to regenerate locally:
312
+ 1. Ensure Maple 18 is installed
313
+ 2. Add to PATH: `export PATH="$HOME/maple18/bin:$PATH"`
314
+ 3. Or set: `export MAPLE_PATH="$HOME/maple18/bin"`
315
+
316
+ ### CMake Errors
317
+ If CMake fails:
318
+ - Ensure CMake >= 3.5 is installed
319
+ - Check that the patch file is applied correctly
320
+ - Run `make distclean` and try again
@@ -0,0 +1,28 @@
1
+ """
2
+ JAX-XC: JAX implementations of exchange-correlation functionals.
3
+ This file should be copied to jxc/__init__.py during build.
4
+ """
5
+
6
+ from . import functionals
7
+
8
+ # Import main functions from get_params if it exists
9
+ try:
10
+ from .get_params import (
11
+ XC_POLARIZED,
12
+ XC_UNPOLARIZED,
13
+ get_params,
14
+ get_xc_functional,
15
+ list_functionals,
16
+ )
17
+
18
+ __all__ = [
19
+ "functionals",
20
+ "get_params",
21
+ "get_xc_functional",
22
+ "list_functionals",
23
+ "XC_UNPOLARIZED",
24
+ "XC_POLARIZED",
25
+ ]
26
+ except ImportError:
27
+ # If get_params doesn't exist, just export functionals
28
+ __all__ = ["functionals"]
@@ -0,0 +1,175 @@
1
+ """
2
+ Builder for composite (mixed) functionals.
3
+
4
+ Composite functionals are linear combinations of component functionals,
5
+ such as B3LYP which combines LDA exchange, B88 GGA exchange, VWN correlation, and LYP correlation.
6
+
7
+ All functionals are expected to have Maple-derived Python implementations;
8
+ if a module is missing, the runtime raises an explicit error so it can be
9
+ fixed via codegen rather than silently falling back to LibXC.
10
+ """
11
+
12
+ import importlib
13
+ from typing import Callable, Any
14
+
15
+ from .get_params import get_params as _get_params
16
+
17
+
18
+ def make_epsilon_xc(p, deo_functional=None) -> Callable:
19
+ """
20
+ Build an epsilon_xc function from a params namedtuple.
21
+
22
+ Parameters
23
+ ----------
24
+ p : namedtuple
25
+ Parameters from get_params(), containing fields:
26
+ - maple_name: str (empty for composite, "DEORBITALIZE" for deorbitalized, or actual name)
27
+ - func_aux: list of child params (for composite/deorbitalize)
28
+ - mix_coef: list of float (weights for composite)
29
+ - cam_alpha, cam_beta, cam_omega: float (range-separated hybrid params)
30
+ - nlc_b, nlc_C: float (non-local correlation params)
31
+ - nspin: int (1 for unpolarized, 2 for polarized)
32
+ deo_functional : Callable, optional
33
+ For DEORBITALIZE functionals, the deorbitalized functional to use.
34
+
35
+ Returns
36
+ -------
37
+ Callable
38
+ A function that computes epsilon_xc given input densities.
39
+ For composites, also has attributes: cam_alpha, cam_beta, cam_omega, nlc_b, nlc_C
40
+ """
41
+ if p.maple_name == "DEORBITALIZE":
42
+ # Deorbitalize pattern: p.func_aux = [p0, p1]
43
+ # Build p1 first, then build p0 using p1 as deo_functional
44
+ # TODO: Full implementation requires threading mo (molecular orbitals) through inputs
45
+ p0, p1 = (p.func_aux[0], p.func_aux[1])
46
+ epsilon_xc_p1 = make_epsilon_xc(p1)
47
+ epsilon_xc_p0 = make_epsilon_xc(p0, epsilon_xc_p1)
48
+ return epsilon_xc_p0
49
+
50
+ elif hasattr(p, 'func_aux') and p.func_aux and len(p.func_aux) > 0:
51
+ # Composite: linear mix of func_aux with mix_coef weights
52
+ # Detect via presence of func_aux (not maple_name=="")
53
+ # Rehydrate child params if helper provided uninitialized params (common in LibXC composites)
54
+ def _nonempty_params(cp) -> bool:
55
+ try:
56
+ return bool(getattr(cp, 'params', None) and cp.params._asdict())
57
+ except Exception:
58
+ return False
59
+ children_ps = []
60
+ for child_p in p.func_aux:
61
+ if _nonempty_params(child_p):
62
+ children_ps.append(child_p)
63
+ else:
64
+ child_name = getattr(child_p, 'name', getattr(child_p, 'maple_name', ''))
65
+ if not child_name:
66
+ children_ps.append(child_p)
67
+ else:
68
+ try:
69
+ rebuilt = _get_params(child_name, polarized=(p.nspin == 2))
70
+ children_ps.append(rebuilt)
71
+ except Exception:
72
+ children_ps.append(child_p)
73
+ # Build children outside closure to avoid recompiling on every call
74
+ # Preserve child-specific CAM params when rehydrating children.
75
+ # If a child entry from helper already carries cam_* fields, keep them.
76
+ # Only rebuild minimal child metadata via get_params when the helper left
77
+ # params empty, and carry over any cam_* present on the original child.
78
+ patched_children = []
79
+ for orig_cp, cp in zip(p.func_aux, children_ps):
80
+ rebuilt = cp
81
+ # If orig child has explicit cam params, prefer them over any defaults
82
+ for attr in ("cam_alpha", "cam_beta", "cam_omega"):
83
+ if hasattr(orig_cp, attr):
84
+ try:
85
+ rebuilt = rebuilt._replace(**{attr: getattr(orig_cp, attr)})
86
+ except Exception:
87
+ # Not a namedtuple or field missing; ignore
88
+ pass
89
+ patched_children.append(rebuilt)
90
+
91
+ children = [make_epsilon_xc(cp) for cp in patched_children]
92
+
93
+ EXCLUDE_BASE_ADDITION = {
94
+ 'hyb_gga_xc_lb07',
95
+ 'hyb_gga_xc_apbe0', # defined in zvpbeloc.c; base is not part of mix
96
+ }
97
+
98
+ def epsilon_xc(*args, **kwargs):
99
+ # Specialization: LibXC mixes b0kcis as (1 - alpha) * Ex_B88 + 2 * Ec_KCIS.
100
+ if p.name == 'hyb_mgga_xc_b0kcis':
101
+ try:
102
+ ex = children[0](*args, **kwargs)
103
+ corr = children[1](*args, **kwargs)
104
+ return (1.0 - getattr(p, 'cam_alpha', 0.25)) * ex + 2.0 * corr
105
+ except Exception:
106
+ pass
107
+ # Weighted sum - children already built
108
+ result = sum(coef * child(*args, **kwargs)
109
+ for coef, child in zip(p.mix_coef, children))
110
+
111
+ # For some LibXC hybrids, a base functional is implied in addition
112
+ # to func_aux; re-add it if not already included, except for known
113
+ # cases (e.g., LB07) where this would double-count.
114
+ if p.maple_name and (p.name not in EXCLUDE_BASE_ADDITION):
115
+ base_in_aux = any(child_p.name == p.maple_name or child_p.maple_name == p.maple_name
116
+ for child_p in p.func_aux)
117
+ if not base_in_aux:
118
+ try:
119
+ base_module = importlib.import_module(f"jxc.functionals.{p.maple_name}")
120
+ base_func = base_module.unpol if p.nspin == 1 else base_module.pol
121
+ # Rebuild correct params for the base functional, and propagate CAM params
122
+ base_p = _get_params(p.maple_name, polarized=(p.nspin == 2))
123
+ try:
124
+ base_p = base_p._replace(
125
+ cam_alpha=getattr(p, 'cam_alpha', 0.0),
126
+ cam_beta=getattr(p, 'cam_beta', 0.0),
127
+ cam_omega=getattr(p, 'cam_omega', 0.0),
128
+ )
129
+ except Exception:
130
+ pass
131
+ result = result + base_func(base_p, *args, **kwargs)
132
+ except (ImportError, AttributeError):
133
+ pass
134
+ return result
135
+
136
+ # Attach hybrid/nlc metadata as attributes
137
+ epsilon_xc.cam_alpha = p.cam_alpha
138
+ epsilon_xc.cam_beta = p.cam_beta
139
+ epsilon_xc.cam_omega = p.cam_omega
140
+ epsilon_xc.nlc_b = p.nlc_b
141
+ epsilon_xc.nlc_C = p.nlc_C
142
+ return epsilon_xc
143
+
144
+ else:
145
+ # Single maple-based functional: import the generated module
146
+ module_name = p.maple_name or p.name
147
+
148
+ try:
149
+ module = importlib.import_module(f"jxc.functionals.{module_name}")
150
+ except ImportError as exc:
151
+ raise ImportError(
152
+ f"No Maple implementation found for '{p.name}' (expected module '{module_name}'). "
153
+ "Run the Maple codegen pipeline to generate it."
154
+ ) from exc
155
+
156
+ # Select pol/unpol based on nspin
157
+ if p.nspin == 1:
158
+ func = module.unpol
159
+ elif p.nspin == 2:
160
+ func = module.pol
161
+ else:
162
+ raise ValueError(f"Unsupported nspin={p.nspin} for {p.maple_name}")
163
+
164
+ # Wrap to pass full p object
165
+ def epsilon_xc(*args, **kwargs):
166
+ return func(p, *args, **kwargs)
167
+
168
+ # Attach hybrid/nlc metadata
169
+ epsilon_xc.cam_alpha = p.cam_alpha
170
+ epsilon_xc.cam_beta = p.cam_beta
171
+ epsilon_xc.cam_omega = p.cam_omega
172
+ epsilon_xc.nlc_b = p.nlc_b
173
+ epsilon_xc.nlc_C = p.nlc_C
174
+
175
+ return epsilon_xc
@@ -0,0 +1,9 @@
1
+ """Maple-generated functionals and helpers.
2
+
3
+ This package contains EXC energy implementations under this directory and
4
+ first-derivative VXC implementations under the subpackage `vxc` when generated
5
+ via `make convert-maple`.
6
+ """
7
+
8
+ __all__ = []
9
+
@@ -0,0 +1,119 @@
1
+ """LibXC-backed wrappers for Laplacian-sensitive MGGA XC functionals."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import functools
6
+ from typing import Tuple
7
+
8
+ import jax
9
+ import jax.numpy as jnp
10
+ import numpy as np
11
+ import pylibxc
12
+
13
+
14
+ @functools.lru_cache(maxsize=None)
15
+ def _get_libxc(name: str, spin: int) -> pylibxc.LibXCFunctional:
16
+ return pylibxc.LibXCFunctional(name, spin)
17
+
18
+
19
+ def _prepare_unpolarized(rho: jnp.ndarray, sigma: jnp.ndarray, lapl: jnp.ndarray):
20
+ rho_arr = jnp.asarray(rho, dtype=jnp.float64).reshape(-1, 1)
21
+ sigma_arr = jnp.asarray(sigma, dtype=jnp.float64).reshape(-1, 1)
22
+ lapl_arr = jnp.asarray(lapl, dtype=jnp.float64).reshape(-1, 1)
23
+ return rho_arr, sigma_arr, lapl_arr
24
+
25
+
26
+ def _prepare_polarized(
27
+ rho: Tuple[jnp.ndarray, jnp.ndarray],
28
+ sigma: Tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray],
29
+ lapl: Tuple[jnp.ndarray, jnp.ndarray],
30
+ ):
31
+ rho_arr = jnp.stack([jnp.asarray(rho[0], dtype=jnp.float64),
32
+ jnp.asarray(rho[1], dtype=jnp.float64)], axis=1)
33
+ sigma_arr = jnp.stack(
34
+ [jnp.asarray(sigma[0], dtype=jnp.float64),
35
+ jnp.asarray(sigma[1], dtype=jnp.float64),
36
+ jnp.asarray(sigma[2], dtype=jnp.float64)],
37
+ axis=1,
38
+ )
39
+ lapl_arr = jnp.stack([jnp.asarray(lapl[0], dtype=jnp.float64),
40
+ jnp.asarray(lapl[1], dtype=jnp.float64)], axis=1)
41
+ return rho_arr, sigma_arr, lapl_arr
42
+
43
+
44
+ def _libxc_callback(name: str, spin: int, rho, sigma, lapl):
45
+ rho_np = np.asarray(rho, dtype=np.float64)
46
+ sigma_np = np.asarray(sigma, dtype=np.float64)
47
+ lapl_np = np.asarray(lapl, dtype=np.float64)
48
+ inputs = {
49
+ "rho": rho_np,
50
+ "sigma": sigma_np,
51
+ "lapl": lapl_np,
52
+ }
53
+ out = _get_libxc(name, spin).compute(inputs, do_vxc=True)
54
+ energy = np.asarray(out["zk"], dtype=np.float64).reshape(rho_np.shape[0])
55
+ vrho = np.asarray(out["vrho"], dtype=np.float64)
56
+ vsigma = np.asarray(out["vsigma"], dtype=np.float64)
57
+ vlapl = np.asarray(out["vlapl"], dtype=np.float64)
58
+ return energy, vrho, vsigma, vlapl
59
+
60
+
61
+ def _libxc_energy_core(name: str, spin: int, rho, sigma, lapl):
62
+ shapes = (
63
+ jax.ShapeDtypeStruct((rho.shape[0],), jnp.float64),
64
+ jax.ShapeDtypeStruct((rho.shape[0], rho.shape[1]), jnp.float64),
65
+ jax.ShapeDtypeStruct((sigma.shape[0], sigma.shape[1]), jnp.float64),
66
+ jax.ShapeDtypeStruct((lapl.shape[0], lapl.shape[1]), jnp.float64),
67
+ )
68
+ return jax.pure_callback(
69
+ lambda rho_cb, sigma_cb, lapl_cb: _libxc_callback(name, spin, rho_cb, sigma_cb, lapl_cb),
70
+ shapes,
71
+ rho,
72
+ sigma,
73
+ lapl,
74
+ )
75
+
76
+
77
+ @functools.lru_cache(maxsize=None)
78
+ def _make_energy_fn(name: str, spin: int):
79
+ def core(rho, sigma, lapl):
80
+ return _libxc_energy_core(name, spin, rho, sigma, lapl)
81
+
82
+ @jax.custom_vjp
83
+ def energy(rho, sigma, lapl):
84
+ energy_val, _, _, _ = core(rho, sigma, lapl)
85
+ return energy_val
86
+
87
+ def fwd(rho, sigma, lapl):
88
+ energy_val, vrho, vsigma, vlapl = core(rho, sigma, lapl)
89
+ return energy_val, (vrho, vsigma, vlapl)
90
+
91
+ def bwd(residual, g):
92
+ vrho, vsigma, vlapl = residual
93
+ g_arr = jnp.asarray(g, dtype=jnp.float64).reshape(-1, 1)
94
+ grad_rho = g_arr * jnp.asarray(vrho, dtype=jnp.float64)
95
+ grad_sigma = g_arr * jnp.asarray(vsigma, dtype=jnp.float64)
96
+ grad_lapl = g_arr * jnp.asarray(vlapl, dtype=jnp.float64)
97
+ return grad_rho, grad_sigma, grad_lapl
98
+
99
+ energy.defvjp(fwd, bwd)
100
+ return energy
101
+
102
+
103
+ def eval_unpolarized(name: str, rho, sigma, lapl):
104
+ rho_arr, sigma_arr, lapl_arr = _prepare_unpolarized(rho, sigma, lapl)
105
+ energy_fn = _make_energy_fn(name, 1)
106
+ energy = energy_fn(rho_arr, sigma_arr, lapl_arr)
107
+ return energy.reshape(-1)
108
+
109
+
110
+ def eval_polarized(
111
+ name: str,
112
+ rho: Tuple[jnp.ndarray, jnp.ndarray],
113
+ sigma: Tuple[jnp.ndarray, jnp.ndarray, jnp.ndarray],
114
+ lapl: Tuple[jnp.ndarray, jnp.ndarray],
115
+ ):
116
+ rho_arr, sigma_arr, lapl_arr = _prepare_polarized(rho, sigma, lapl)
117
+ energy_fn = _make_energy_fn(name, 2)
118
+ energy = energy_fn(rho_arr, sigma_arr, lapl_arr)
119
+ return energy.reshape(-1)