From c7914a22ec54355b94654d1ea47379e162483464 Mon Sep 17 00:00:00 2001 From: Xiaojie Wu Date: Fri, 5 Jul 2024 11:31:14 -0700 Subject: [PATCH] update benchmark markdowns (#179) * update benchmark markdowns * replace contract with cupy.dot in eval_rho2 * remove lprof --- benchmarks/README.md | 12 +- benchmarks/df/solvent_pyscf_qchem.md | 6 +- benchmarks/df_psi4.md | 160 ------------------- benchmarks/df_qchem.md | 222 --------------------------- benchmarks/scf_qchem.md | 125 --------------- benchmarks/solvent_qchem.md | 28 ---- examples/dft_driver.py | 2 +- gpu4pyscf/dft/gen_grid.py | 9 +- gpu4pyscf/dft/numint.py | 47 +++--- gpu4pyscf/lib/cupy_helper.py | 7 +- 10 files changed, 35 insertions(+), 583 deletions(-) delete mode 100644 benchmarks/df_psi4.md delete mode 100644 benchmarks/df_qchem.md delete mode 100644 benchmarks/scf_qchem.md delete mode 100644 benchmarks/solvent_qchem.md diff --git a/benchmarks/README.md b/benchmarks/README.md index 91827d55..c88370bc 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -1,22 +1,22 @@ > [!NOTE] > If you are using the following data as reference, please check out the settings carefully, such as threshold for integrals, convergence tolerance, cartesian or spherical basis, and grids. The default settings of quantum chemistry package can be significantly different. With different settings, the performances are not comparable. -# Benchmarks of algorithms +# Benchmarks of algorithms Machines and software versions - GPU4PySCF on A100-SXM4-80G with Intel(R) Xeon(R) Platinum 8336C CPU @ 2.30GHz - - CUDA driver version: 450.191.01 + - CUDA driver version: 450.191.01 - CUDA toolkit version: 11.7 - Q-Chem on 32-core vCPU, Intel(R) Xeon(R) Platinum 8336C CPU @ 2.30GHz - Psi4 on 32-core vCPU, AMD EPYC 7Y83 64-Core Processor -Find more benchmarks in +Find more benchmarks in - [DF SCF, Gradient, Hessian / Q-Chem v6.1](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/df/df_pyscf_qchem.md) -- [DF SCF / Psi4 v1.8]()(https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/df/df_pyscf_psi4.md) -- [Direct SCF, Gradient/ Q-Chem v6.1](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/scf/scf_pyscf_qchem.md) +- [DF SCF / Psi4 v1.8](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/df/df_pyscf_psi4.md) +- [Direct SCF, Gradient / Q-Chem v6.1](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/scf/scf_pyscf_qchem.md) - [DF SCF, Gradient, Hessian with PCM / Q-Chem v6.1](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/df/solvent_pyscf_qchem.md) -# Benchmarks of applications +# Benchmark scripts of applications - [Solvation free energy with SMD](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/smd) - [Transition state search for transition metals](https://github.com/pyscf/gpu4pyscf/tree/master/benchmarks/ts) diff --git a/benchmarks/df/solvent_pyscf_qchem.md b/benchmarks/df/solvent_pyscf_qchem.md index 9581d0bd..9db372b7 100644 --- a/benchmarks/df/solvent_pyscf_qchem.md +++ b/benchmarks/df/solvent_pyscf_qchem.md @@ -5,8 +5,7 @@ DF with solvent methods Difference from Q-Chem v6.1: -| mol | CPCM | CPCM | CPCM | IEFPCM | IEFPCM | IEFPCM | -| | scf | grad | hess | scf | grad | hess | +| mol | CPCM scf | CPCM grad | CPCM hess|IEFPCM scf |IEFPCM grad|IEFPCM hess| |:-----------------|---------:|----------:|---------:|----------:|----------:|----------:| | 020_Vitamin_C | 1.38e-04 | 1.20e-04 | 1.14e-03 | 1.38e-04 | 1.20e-04 | 1.14e-03 | | 031_Inosine | 2.08e-04 | 1.40e-04 | 1.18e-03 | 2.08e-04 | 1.40e-04 | 1.18e-03 | @@ -16,8 +15,7 @@ Difference from Q-Chem v6.1: Speedup over Q-Chem v6.1: -| mol | CPCM | CPCM | CPCM | IEFPCM | IEFPCM | IEFPCM | -| | scf | grad | hess | scf | grad | hess | +| mol |CPCM scf|CPCM grad|CPCM hess|IEFPCM scf|IEFPCM grad|IEFPCM hess| |:-----------------|-------:|--------:|--------:|---------:|---------:|---------:| | 020_Vitamin_C | 39.830 | 21.569 | 107.197 | 31.005 | 18.264 | 100.091 | | 031_Inosine | 64.261 | 30.356 | 162.287 | 54.346 | 30.641 | 158.179 | diff --git a/benchmarks/df_psi4.md b/benchmarks/df_psi4.md deleted file mode 100644 index 77693dc3..00000000 --- a/benchmarks/df_psi4.md +++ /dev/null @@ -1,160 +0,0 @@ -# Psi4 v1.8 vs GPU4PySCF v1.0 - -## DF SCF Energy with B3LYP/* - - -Difference from Psi4 v1.8: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|---------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 3.94e-06 | 2.92e-06 | 3.87e-06 | 3.97e-06 | 6.44e-06 | -| 031_Inosine | 5.60e-06 | 7.62e-06 | 7.70e-06 | 8.83e-06 | 1.11e-05 | -| 033_Bisphenol_A | 6.17e-06 | 4.85e-06 | 7.90e-06 | 6.77e-06 | 8.91e-06 | -| 037_Mg_Porphin | 4.61e-06 | 6.88e-05 | 1.27e-06 | 1.98e-07 | 5.48e-07 | -| 042_Penicillin_V | 4.28e-06 | 4.41e-06 | 5.73e-06 | 7.50e-06 | 1.00e-05 | -| 045_Ochratoxin_A | 7.56e-06 | 7.76e-06 | 9.46e-06 | 9.32e-06 | 1.22e-05 | -| 052_Cetirizine | 1.25e-05 | 1.29e-05 | 1.37e-05 | 1.89e-05 | 2.23e-05 | -| 057_Tamoxifen | 6.77e-06 | 6.21e-06 | 8.05e-06 | 8.46e-06 | 1.10e-05 | -| 066_Raffinose | 1.29e-06 | 9.27e-07 | 3.81e-06 | 2.70e-07 | 4.43e-06 | -| 084_Sphingomyelin | 9.02e-06 | 1.04e-05 | 1.15e-05 | 1.39e-05 | 1.58e-05 | - -Speedup over Psi4 v1.8: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|--------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 2.036 | 2.303 | 1.682 | 6.050 | 7.489 | -| 031_Inosine | 3.043 | 4.348 | 4.568 | 10.717 | 14.537 | -| 033_Bisphenol_A | 3.647 | 4.340 | 4.592 | 12.260 | 14.499 | -| 037_Mg_Porphin | 4.653 | 6.469 | 5.975 | 12.207 | 15.290 | -| 042_Penicillin_V | 4.402 | 5.982 | 5.168 | 11.653 | 14.475 | -| 045_Ochratoxin_A | 4.683 | 6.738 | 5.254 | 11.583 | 14.132 | -| 052_Cetirizine | 5.579 | 6.838 | 8.951 | 14.425 | 18.188 | -| 057_Tamoxifen | 5.910 | 8.096 | 8.857 | 13.108 | 15.729 | -| 066_Raffinose | 7.403 | 9.194 | 9.873 | 12.816 | 15.032 | -| 084_Sphingomyelin | 4.357 | 8.717 | 10.092 | 13.111 | 14.858 | - -## DF Gradient with B3LYP/* - - -Difference from Psi4 v1.8: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|---------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 2.05e-05 | 1.53e-05 | 1.63e-05 | 1.54e-05 | 1.60e-05 | -| 031_Inosine | 1.90e-05 | 3.74e-05 | 2.21e-05 | 1.68e-05 | 1.78e-05 | -| 033_Bisphenol_A | 1.44e-05 | 1.57e-05 | 1.69e-05 | 1.48e-05 | 1.48e-05 | -| 037_Mg_Porphin | 3.39e-05 | 3.85e-05 | 3.36e-05 | 3.88e-05 | 3.80e-05 | -| 042_Penicillin_V | 3.33e-05 | 2.76e-05 | 2.86e-05 | 2.45e-05 | 2.69e-05 | -| 045_Ochratoxin_A | 2.75e-05 | 2.11e-05 | 2.65e-05 | 2.47e-05 | 2.55e-05 | -| 052_Cetirizine | 2.58e-05 | 2.30e-05 | 2.43e-05 | 2.38e-05 | 2.89e-05 | -| 057_Tamoxifen | 3.21e-05 | 1.87e-05 | 2.40e-05 | 1.94e-05 | 2.67e-05 | -| 066_Raffinose | 3.88e-05 | 3.40e-05 | 3.65e-05 | 3.86e-05 | 3.57e-05 | -| 084_Sphingomyelin | 8.62e-05 | 6.58e-05 | 6.80e-05 | 6.69e-05 | 6.91e-05 | - -Speedup over Psi4 v1.8: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|--------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 11.820 | 17.117 | 11.993 | 23.867 | 27.485 | -| 031_Inosine | 18.390 | 25.608 | 17.521 | 36.825 | 43.393 | -| 033_Bisphenol_A | 14.898 | 22.793 | 14.532 | 33.466 | 39.945 | -| 037_Mg_Porphin | 18.411 | 25.384 | 15.312 | 34.411 | 38.112 | -| 042_Penicillin_V | 22.417 | 28.357 | 17.625 | 39.145 | 41.711 | -| 045_Ochratoxin_A | 23.806 | 29.375 | 17.688 | 38.940 | 42.077 | -| 052_Cetirizine | 23.829 | 30.125 | 32.081 | 42.579 | 46.687 | -| 057_Tamoxifen | 22.314 | 32.323 | 35.035 | 39.943 | 44.103 | -| 066_Raffinose | 26.787 | 36.922 | 37.953 | 42.626 | 44.503 | -| 084_Sphingomyelin | 36.525 | 39.186 | 44.866 | 56.275 | 54.244 | - -## DF Hessian with B3LYP/* - - -Difference from Psi4 v1.8: - -| mol | -|-------| - -Speedup over Psi4 v1.8: - -| mol | -|-------| - -## DF SCF Energy with */def2-tzvpp - - -Difference from Psi4 v1.8: - -| mol | PBE | M06 | B3LYP | -|:------------------|---------:|---------:|---------:| -| 020_Vitamin_C | 1.33e-06 | 9.42e-06 | 3.97e-06 | -| 031_Inosine | 3.94e-06 | 6.23e-06 | 8.83e-06 | -| 033_Bisphenol_A | 8.92e-08 | 1.21e-05 | 6.77e-06 | -| 037_Mg_Porphin | 1.18e-05 | 3.36e-04 | 1.98e-07 | -| 042_Penicillin_V | 1.10e-06 | 2.82e-05 | 7.50e-06 | -| 045_Ochratoxin_A | 2.84e-06 | 7.09e-07 | 9.32e-06 | -| 052_Cetirizine | 1.97e-05 | 5.55e-05 | 1.89e-05 | -| 057_Tamoxifen | 4.40e-07 | 5.13e-05 | 8.46e-06 | -| 066_Raffinose | 1.75e-05 | 4.66e-05 | 2.70e-07 | -| 084_Sphingomyelin | 6.49e-06 | 1.85e-05 | 1.39e-05 | - -Speedup over Psi4 v1.8: - -| mol | PBE | M06 | B3LYP | -| | scf | scf | scf | -|:------------------|-------:|-------:|--------:| -| 020_Vitamin_C | 5.914 | 8.831 | 6.799 | -| 031_Inosine | 8.944 | 11.555 | 10.830 | -| 033_Bisphenol_A | 10.984 | 13.277 | 12.233 | -| 037_Mg_Porphin | 12.392 | 14.231 | 12.043 | -| 042_Penicillin_V | 10.971 | 12.977 | 11.411 | -| 045_Ochratoxin_A | 12.511 | 12.896 | 10.330 | -| 052_Cetirizine | 15.735 | 15.302 | 14.497 | -| 057_Tamoxifen | 14.090 | 15.049 | 12.898 | -| 066_Raffinose | 13.939 | 14.076 | 12.827 | -| 084_Sphingomyelin | 13.738 | 14.585 | 13.022 | - -## DF Gradient with */def2-tzvpp - - -Difference from Psi4 v1.8: - -| mol | PBE | M06 | B3LYP | -|:------------------|---------:|---------:|---------:| -| 020_Vitamin_C | 1.64e-05 | 9.86e-05 | 1.54e-05 | -| 031_Inosine | 1.80e-05 | 1.95e-04 | 1.69e-05 | -| 033_Bisphenol_A | 1.57e-05 | 1.50e-04 | 1.50e-05 | -| 037_Mg_Porphin | 5.27e-05 | 6.12e-04 | 3.86e-05 | -| 042_Penicillin_V | 2.51e-05 | 2.70e-04 | 2.47e-05 | -| 045_Ochratoxin_A | 2.76e-05 | 2.31e-04 | 2.45e-05 | -| 052_Cetirizine | 2.47e-05 | 2.19e-04 | 2.38e-05 | -| 057_Tamoxifen | 1.93e-05 | 2.48e-04 | 2.20e-05 | -| 066_Raffinose | 3.12e-05 | 4.36e-04 | 3.85e-05 | -| 084_Sphingomyelin | 7.20e-05 | 3.89e-04 | 6.69e-05 | - -Speedup over Psi4 v1.8: - -| mol | PBE | M06 | B3LYP | -|:------------------|-------:|-------:|--------:| -| 020_Vitamin_C | 26.538 | 33.006 | 24.628 | -| 031_Inosine | 33.583 | 34.866 | 36.376 | -| 033_Bisphenol_A | 35.681 | 45.892 | 34.088 | -| 037_Mg_Porphin | 33.516 | 45.192 | 34.262 | -| 042_Penicillin_V | 36.408 | 48.302 | 38.405 | -| 045_Ochratoxin_A | 40.876 | 46.000 | 39.111 | -| 052_Cetirizine | 44.134 | 50.615 | 41.878 | -| 057_Tamoxifen | 37.867 | 51.285 | 40.409 | -| 066_Raffinose | 38.103 | 48.984 | 42.362 | -| 084_Sphingomyelin | 46.478 | 66.586 | 55.514 | - -## DF Hessian with */def2-tzvpp - - -Difference from Psi4 v1.8: - -| mol | -|-------| - -Speedup over Psi4 v1.8: - -| mol | -|-------| diff --git a/benchmarks/df_qchem.md b/benchmarks/df_qchem.md deleted file mode 100644 index 2a602204..00000000 --- a/benchmarks/df_qchem.md +++ /dev/null @@ -1,222 +0,0 @@ -# Q-Chem v6.1 vs GPU4PySCF v1.0 - -## DF SCF Energy with B3LYP/* - - -Difference from Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|----------:|----------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 3.55e-06 | 4.39e-05 | 6.31e-07 | 5.55e-07 | 5.23e-07 | -| 031_Inosine | 5.69e-05 | 8.84e-05 | 1.25e-05 | 8.17e-07 | 9.11e-07 | -| 033_Bisphenol_A | 3.98e-05 | 8.33e-05 | 9.31e-07 | 4.61e-06 | 4.78e-06 | -| 037_Mg_Porphin | 1.05e-05 | 2.41e-04 | 7.19e-06 | 8.28e-06 | 8.28e-06 | -| 042_Penicillin_V | 1.18e-04 | 4.31e-05 | 3.71e-05 | 1.86e-06 | 4.23e-06 | -| 045_Ochratoxin_A | 1.04e-04 | 1.29e-04 | 3.06e-05 | 7.67e-06 | 3.08e-06 | -| 052_Cetirizine | 6.82e-05 | 1.39e-05 | 2.26e-05 | 8.40e-06 | 6.85e-06 | -| 057_Tamoxifen | 1.02e-04 | 1.32e-04 | 1.73e-05 | 4.77e-06 | 3.36e-06 | -| 066_Raffinose | 2.14e-04 | 3.48e-04 | 5.60e-05 | 6.43e-06 | 2.57e-06 | -| 084_Sphingomyelin | -1.00e+00 | 1.09e-04 | 4.12e-05 | 1.52e-05 | 6.98e-06 | -| 095_Azadirachtin | 3.88e-04 | 1.35e-04 | 9.56e-05 | -1.00e+00 | -1.00e+00 | -| 113_Taxol | 6.81e-04 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|--------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 1.656 | 3.882 | 3.020 | 10.132 | 10.467 | -| 031_Inosine | 5.297 | 9.486 | 8.136 | 15.908 | 17.874 | -| 033_Bisphenol_A | 5.032 | 8.553 | 9.123 | 17.025 | 16.921 | -| 037_Mg_Porphin | 9.057 | 13.141 | 11.998 | 20.560 | 22.627 | -| 042_Penicillin_V | 8.078 | 12.135 | 9.998 | 20.395 | 21.016 | -| 045_Ochratoxin_A | 8.337 | 14.522 | 11.382 | 20.123 | 21.018 | -| 052_Cetirizine | 9.709 | 14.387 | 16.766 | 20.919 | 21.680 | -| 057_Tamoxifen | 10.456 | 15.605 | 18.333 | 24.072 | 21.910 | -| 066_Raffinose | 12.801 | 18.988 | 21.727 | 20.886 | 20.452 | -| 084_Sphingomyelin | -1.000 | 17.628 | 19.916 | 19.986 | 19.586 | -| 095_Azadirachtin | 37.041 | 29.223 | 28.989 | -1.000 | -1.000 | -| 113_Taxol | 27.011 | -1.000 | -1.000 | -1.000 | -1.000 | - -## DF Gradient with B3LYP/* - - -Difference from Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|----------:|----------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 2.55e-05 | 1.09e-04 | 2.54e-05 | 2.76e-05 | 2.82e-05 | -| 031_Inosine | 3.68e-05 | 1.55e-04 | 3.10e-05 | 2.79e-05 | 2.85e-05 | -| 033_Bisphenol_A | 4.41e-05 | 1.01e-04 | 4.67e-05 | 5.19e-05 | 5.16e-05 | -| 037_Mg_Porphin | 3.41e-05 | 7.72e-05 | 3.37e-05 | 3.81e-05 | 3.82e-05 | -| 042_Penicillin_V | 1.24e-04 | 1.92e-04 | 8.33e-05 | 8.77e-05 | 8.76e-05 | -| 045_Ochratoxin_A | 7.66e-05 | 1.30e-04 | 5.07e-05 | 6.80e-05 | 6.80e-05 | -| 052_Cetirizine | 9.88e-05 | 1.72e-04 | 8.69e-05 | 9.11e-05 | 9.04e-05 | -| 057_Tamoxifen | 6.74e-05 | 1.38e-04 | 6.37e-05 | 7.13e-05 | 7.18e-05 | -| 066_Raffinose | 1.34e-04 | 2.76e-04 | 1.32e-04 | 1.62e-04 | 1.61e-04 | -| 084_Sphingomyelin | -1.00e+00 | 1.76e-04 | 8.53e-05 | 9.55e-05 | 9.57e-05 | -| 095_Azadirachtin | 2.11e-04 | 3.07e-04 | 2.06e-04 | -1.00e+00 | -1.00e+00 | -| 113_Taxol | 2.09e-04 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|--------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 2.595 | 4.670 | 3.743 | 8.069 | 8.445 | -| 031_Inosine | 5.832 | 8.206 | 5.368 | 12.947 | 15.195 | -| 033_Bisphenol_A | 5.182 | 8.246 | 5.561 | 11.950 | 12.939 | -| 037_Mg_Porphin | 7.638 | 10.085 | 6.120 | 18.260 | 17.604 | -| 042_Penicillin_V | 7.633 | 9.679 | 6.272 | 17.754 | 17.536 | -| 045_Ochratoxin_A | 8.460 | 10.764 | 6.678 | 18.622 | 19.414 | -| 052_Cetirizine | 10.781 | 12.827 | 13.724 | 21.245 | 21.722 | -| 057_Tamoxifen | 10.465 | 14.536 | 15.720 | 24.097 | 22.647 | -| 066_Raffinose | 13.222 | 18.489 | 26.653 | 28.195 | 27.123 | -| 084_Sphingomyelin | -1.000 | 15.828 | 19.806 | 26.314 | 25.860 | -| 095_Azadirachtin | 31.559 | 46.052 | 46.146 | -1.000 | -1.000 | -| 113_Taxol | 37.288 | -1.000 | -1.000 | -1.000 | -1.000 | - -## DF Hessian with B3LYP/* - - -Difference from Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|----------:|----------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 1.09e-03 | 1.22e-03 | 9.42e-04 | 1.04e-03 | 1.04e-03 | -| 031_Inosine | 9.72e-04 | 1.36e-03 | 9.97e-04 | 9.70e-04 | 9.67e-04 | -| 033_Bisphenol_A | 8.78e-04 | 1.16e-03 | 9.89e-04 | 1.16e-03 | 1.17e-03 | -| 037_Mg_Porphin | 1.44e-03 | 1.15e-03 | 9.60e-04 | 1.20e-03 | 1.20e-03 | -| 042_Penicillin_V | 1.62e-03 | 2.00e-03 | 1.51e-03 | 1.69e-03 | 1.69e-03 | -| 045_Ochratoxin_A | 2.06e-03 | 1.88e-03 | 1.48e-03 | 1.76e-03 | 1.75e-03 | -| 052_Cetirizine | 2.90e-03 | 3.17e-03 | 2.93e-03 | 3.57e-03 | 3.56e-03 | -| 057_Tamoxifen | 1.09e-03 | 1.43e-03 | 1.21e-03 | 1.22e-03 | 1.31e-03 | -| 066_Raffinose | 2.34e-03 | 2.58e-03 | 2.13e-03 | 2.22e-03 | 2.21e-03 | -| 084_Sphingomyelin | -1.00e+00 | 3.25e-03 | 3.13e-03 | 3.29e-03 | 3.29e-03 | -| 095_Azadirachtin | 7.35e-01 | 4.30e-03 | 4.07e-03 | -1.00e+00 | -1.00e+00 | -| 113_Taxol | 5.20e-01 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|:------------------|---------:|--------:|-----------:|-------------:|-------------:| -| 020_Vitamin_C | 35.140 | 47.481 | 28.296 | 64.527 | 68.238 | -| 031_Inosine | 57.434 | 76.991 | 39.651 | 88.626 | 98.117 | -| 033_Bisphenol_A | 57.032 | 72.693 | 38.985 | 91.116 | 98.698 | -| 037_Mg_Porphin | 75.036 | 86.174 | 38.361 | 109.398 | 110.829 | -| 042_Penicillin_V | 70.226 | 86.167 | 36.410 | 96.950 | 108.305 | -| 045_Ochratoxin_A | 77.091 | 89.642 | 40.600 | 99.879 | 111.425 | -| 052_Cetirizine | 89.764 | 99.146 | 94.397 | 118.538 | 133.198 | -| 057_Tamoxifen | 90.284 | 100.000 | 100.812 | 150.238 | 148.537 | -| 066_Raffinose | 94.497 | 106.045 | 117.363 | 133.170 | 140.152 | -| 084_Sphingomyelin | -1.000 | 98.636 | 101.530 | 120.697 | 134.764 | -| 095_Azadirachtin | 219.241 | 218.958 | 232.750 | -1.000 | -1.000 | -| 113_Taxol | 226.304 | -1.000 | -1.000 | -1.000 | -1.000 | - -## DF SCF Energy with */def2-tzvpp - - -Difference from Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | wB97m-v | -|:------------------|---------:|----------:|----------:|----------:|----------:| -| 020_Vitamin_C | 1.32e-06 | 1.30e-06 | 7.31e-06 | 5.55e-07 | 1.91e-06 | -| 031_Inosine | 4.12e-07 | 5.55e-08 | 2.65e-05 | 8.17e-07 | 3.32e-06 | -| 033_Bisphenol_A | 6.64e-06 | 4.99e-06 | 1.13e-05 | 4.61e-06 | 3.07e-06 | -| 037_Mg_Porphin | 2.93e-06 | 9.23e-06 | 2.76e-04 | 8.28e-06 | 5.40e-06 | -| 042_Penicillin_V | 2.64e-06 | 2.48e-06 | 6.45e-06 | 1.86e-06 | 3.35e-06 | -| 045_Ochratoxin_A | 8.78e-06 | 9.07e-06 | 1.70e-05 | 7.67e-06 | 5.29e-06 | -| 052_Cetirizine | 1.03e-05 | 1.12e-05 | 2.70e-05 | 8.40e-06 | 1.54e-05 | -| 057_Tamoxifen | 6.70e-06 | 7.96e-06 | 2.17e-05 | 4.77e-06 | 3.78e-06 | -| 066_Raffinose | 7.05e-06 | 8.97e-06 | 2.96e-05 | 6.43e-06 | 7.88e-07 | -| 084_Sphingomyelin | 1.57e-05 | 1.69e-05 | 3.35e-06 | 1.52e-05 | 1.76e-05 | -| 095_Azadirachtin | 2.07e+01 | 2.93e-05 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -| 113_Taxol | 2.43e+01 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | wB97m-v | -| | scf | scf | scf | scf | scf | -|:------------------|-------:|-------:|-------:|--------:|----------:| -| 020_Vitamin_C | 3.225 | 8.283 | 14.702 | 11.454 | 19.807 | -| 031_Inosine | 10.688 | 18.406 | 20.354 | 16.745 | 23.174 | -| 033_Bisphenol_A | 12.180 | 13.531 | 20.936 | 17.634 | 24.780 | -| 037_Mg_Porphin | 12.331 | 17.275 | 24.688 | 19.595 | 33.963 | -| 042_Penicillin_V | 11.329 | 13.811 | 23.311 | 19.957 | 25.367 | -| 045_Ochratoxin_A | 12.032 | 14.590 | 24.830 | 18.211 | 25.969 | -| 052_Cetirizine | 15.199 | 15.569 | 25.549 | 20.783 | 28.030 | -| 057_Tamoxifen | 14.051 | 17.264 | 25.375 | 20.782 | 27.371 | -| 066_Raffinose | 14.983 | 16.207 | 24.959 | 21.593 | 26.969 | -| 084_Sphingomyelin | 13.251 | 14.495 | 19.456 | 19.541 | 25.265 | -| 095_Azadirachtin | 3.479 | 4.635 | -1.000 | -1.000 | -1.000 | -| 113_Taxol | 3.465 | -1.000 | -1.000 | -1.000 | -1.000 | - -## DF Gradient with */def2-tzvpp - - -Difference from Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | wB97m-v | -|:------------------|---------:|----------:|----------:|----------:|----------:| -| 020_Vitamin_C | 3.45e-05 | 3.36e-05 | 1.36e-04 | 2.76e-05 | 2.45e-05 | -| 031_Inosine | 3.89e-05 | 3.46e-05 | 2.43e-04 | 2.79e-05 | 3.99e-05 | -| 033_Bisphenol_A | 6.97e-05 | 6.40e-05 | 2.17e-04 | 5.19e-05 | 6.55e-05 | -| 037_Mg_Porphin | 3.21e-05 | 4.11e-05 | 5.49e-04 | 3.81e-05 | 4.39e-05 | -| 042_Penicillin_V | 1.17e-04 | 1.12e-04 | 5.05e-04 | 8.77e-05 | 9.27e-05 | -| 045_Ochratoxin_A | 1.06e-04 | 9.94e-05 | 4.98e-04 | 6.80e-05 | 7.32e-05 | -| 052_Cetirizine | 1.39e-04 | 1.30e-04 | 3.65e-04 | 9.11e-05 | 7.79e-05 | -| 057_Tamoxifen | 9.83e-05 | 8.99e-05 | 3.66e-04 | 7.13e-05 | 7.59e-05 | -| 066_Raffinose | 2.25e-04 | 2.15e-04 | 8.45e-04 | 1.62e-04 | 1.29e-04 | -| 084_Sphingomyelin | 1.33e-04 | 1.27e-04 | 3.15e-04 | 9.55e-05 | 9.68e-05 | -| 095_Azadirachtin | 1.18e-01 | 3.11e-04 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -| 113_Taxol | 1.23e-01 | -1.00e+00 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | wB97m-v | -|:------------------|------:|-------:|-------:|--------:|----------:| -| 020_Vitamin_C | 1.072 | 5.014 | 6.767 | 8.250 | 8.025 | -| 031_Inosine | 4.116 | 8.961 | 8.381 | 13.253 | 11.772 | -| 033_Bisphenol_A | 4.861 | 7.254 | 10.629 | 12.239 | 11.274 | -| 037_Mg_Porphin | 5.094 | 8.973 | 15.424 | 17.608 | 14.945 | -| 042_Penicillin_V | 4.638 | 7.219 | 15.530 | 17.494 | 13.310 | -| 045_Ochratoxin_A | 4.914 | 7.079 | 16.779 | 19.246 | 14.480 | -| 052_Cetirizine | 5.586 | 7.305 | 18.143 | 21.309 | 15.118 | -| 057_Tamoxifen | 5.672 | 7.522 | 19.167 | 21.858 | 15.801 | -| 066_Raffinose | 5.970 | 8.243 | 24.667 | 27.971 | 18.228 | -| 084_Sphingomyelin | 5.768 | 7.898 | 23.480 | 26.088 | 18.875 | -| 095_Azadirachtin | 3.474 | 7.355 | -1.000 | -1.000 | -1.000 | -| 113_Taxol | 3.501 | -1.000 | -1.000 | -1.000 | -1.000 | - -## DF Hessian with */def2-tzvpp - - -Difference from Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | -|:------------------|---------:|---------:|----------:|----------:| -| 020_Vitamin_C | 1.30e-03 | 1.26e-03 | 6.58e-03 | 1.04e-03 | -| 031_Inosine | 1.19e-03 | 1.19e-03 | 1.04e-02 | 9.70e-04 | -| 033_Bisphenol_A | 1.60e-03 | 1.51e-03 | 7.09e-03 | 1.16e-03 | -| 037_Mg_Porphin | 9.92e-04 | 1.34e-03 | 3.09e-02 | 1.20e-03 | -| 042_Penicillin_V | 2.21e-03 | 2.17e-03 | 1.16e-02 | 1.69e-03 | -| 045_Ochratoxin_A | 2.35e-03 | 2.32e-03 | 1.60e-02 | 1.76e-03 | -| 052_Cetirizine | 5.02e-03 | 4.77e-03 | 1.10e-02 | 3.57e-03 | -| 057_Tamoxifen | 1.66e-03 | 1.75e-03 | 1.37e-02 | 1.22e-03 | -| 066_Raffinose | 2.97e-03 | 2.97e-03 | 1.81e-02 | 2.22e-03 | -| 084_Sphingomyelin | 4.08e-03 | 4.10e-03 | 1.94e-02 | 3.29e-03 | -| 095_Azadirachtin | 3.75e-01 | 6.35e-03 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | LDA | PBE | M06 | B3LYP | wB97m-v | -|:------------------|-------:|--------:|--------:|--------:|----------:| -| 020_Vitamin_C | 44.609 | 61.806 | 62.693 | 63.289 | 1.429 | -| 031_Inosine | 69.021 | 125.023 | 81.656 | 88.213 | 0.297 | -| 033_Bisphenol_A | 73.170 | 91.514 | 83.032 | 91.552 | 0.264 | -| 037_Mg_Porphin | 74.378 | 93.379 | 98.220 | 105.635 | 0.292 | -| 042_Penicillin_V | 70.177 | 84.351 | 85.733 | 97.295 | 0.222 | -| 045_Ochratoxin_A | 68.865 | 80.841 | 86.347 | 99.872 | 0.198 | -| 052_Cetirizine | 80.808 | 92.162 | 97.702 | 116.982 | 0.167 | -| 057_Tamoxifen | 90.906 | 99.162 | 106.604 | 132.020 | 0.156 | -| 066_Raffinose | 85.604 | 89.162 | 106.622 | 130.474 | 0.117 | -| 084_Sphingomyelin | 86.058 | 86.905 | 98.105 | 119.471 | -1.000 | -| 095_Azadirachtin | 31.689 | 98.780 | -1.000 | -1.000 | -1.000 | diff --git a/benchmarks/scf_qchem.md b/benchmarks/scf_qchem.md deleted file mode 100644 index 63a73e91..00000000 --- a/benchmarks/scf_qchem.md +++ /dev/null @@ -1,125 +0,0 @@ -# Q-Chem v6.1 vs GPU4PySCF v1.0 - -## Direct SCF Energy with B3LYP/* - - -Difference from Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|------:|---------:|---------:|-----------:|-------------:|-------------:| -| 002 | 1.41e-07 | 7.80e-08 | 4.97e-08 | 2.05e-08 | 1.01e-08 | -| 003 | 4.76e-07 | 6.28e-07 | 1.44e-07 | 2.98e-07 | 7.44e-08 | -| 004 | 3.43e-06 | 8.23e-07 | 1.30e-06 | 6.10e-07 | 2.28e-06 | -| 005 | 3.79e-05 | 5.51e-06 | 7.45e-06 | 2.39e-07 | 2.87e-06 | -| 006 | 1.04e-04 | 5.75e-05 | 5.68e-05 | 2.44e-06 | 2.47e-08 | -| 007 | 2.31e-04 | 2.11e-04 | 1.60e-04 | 2.24e-05 | 8.05e-06 | -| 008 | 3.78e-04 | 6.53e-04 | 3.95e-04 | 1.14e-04 | -1.00e+00 | -| 009 | 6.41e-04 | 1.16e-03 | 6.81e-04 | 2.24e-04 | -1.00e+00 | -| 010 | 9.30e-04 | 2.02e-03 | 1.09e-03 | 4.74e-04 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|------:|---------:|--------:|-----------:|-------------:|-------------:| -| 002 | 0.000 | 0.000 | 1.264 | 0.220 | 0.206 | -| 003 | 2.691 | 1.110 | 1.869 | 1.314 | 1.926 | -| 004 | 2.748 | 3.453 | 3.036 | 2.240 | 4.632 | -| 005 | 4.307 | 4.657 | 4.865 | 3.699 | 7.628 | -| 006 | 8.574 | 6.512 | 7.497 | 5.646 | 8.143 | -| 007 | 9.849 | 6.275 | 6.111 | 6.460 | 11.156 | -| 008 | 9.020 | 5.230 | 5.702 | 4.785 | -1.000 | -| 009 | 8.174 | 5.007 | 5.375 | 4.590 | -1.000 | -| 010 | 5.547 | 5.097 | 6.348 | 5.472 | -1.000 | - -## Direct SCF Gradient with B3LYP/* - - -Difference from Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|------:|---------:|---------:|-----------:|-------------:|-------------:| -| 002 | 3.00e-06 | 1.11e-06 | 9.35e-07 | 2.52e-06 | 1.49e-06 | -| 003 | 1.13e-05 | 4.89e-06 | 8.47e-06 | 7.59e-06 | 5.29e-06 | -| 004 | 1.76e-05 | 1.32e-05 | 1.15e-05 | 1.25e-05 | 1.01e-05 | -| 005 | 4.14e-05 | 2.99e-05 | 2.66e-05 | 2.88e-05 | 2.92e-05 | -| 006 | 1.00e-04 | 4.36e-05 | 4.35e-05 | 4.81e-05 | 5.08e-05 | -| 007 | 1.59e-04 | 7.61e-05 | 7.81e-05 | 7.24e-05 | 7.64e-05 | -| 008 | 2.76e-04 | 1.42e-04 | 1.55e-04 | 1.07e-04 | -1.00e+00 | -| 009 | 3.33e-04 | 1.74e-04 | 1.97e-04 | 1.31e-04 | -1.00e+00 | -| 010 | 4.30e-04 | 2.29e-04 | 2.66e-04 | 1.61e-04 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | sto-3g | 6-31g | def2-svp | def2-tzvpp | def2-tzvpd | -|------:|---------:|--------:|-----------:|-------------:|-------------:| -| 002 | 1.624 | 1.415 | 1.178 | 0.238 | 0.265 | -| 003 | 3.815 | 2.113 | 1.124 | 0.692 | 1.042 | -| 004 | 6.716 | 4.334 | 3.086 | 1.323 | 2.659 | -| 005 | 22.154 | 8.285 | 3.906 | 1.643 | 3.314 | -| 006 | 29.173 | 12.149 | 4.967 | 1.708 | 3.337 | -| 007 | 36.437 | 13.789 | 5.377 | 1.749 | 3.260 | -| 008 | 77.314 | 19.917 | 7.482 | 1.796 | -1.000 | -| 009 | 87.759 | 25.967 | 9.488 | 1.898 | -1.000 | -| 010 | 85.196 | 26.559 | 9.836 | 2.027 | -1.000 | - -## Direct SCF Energy with */def2-tzvpp - - -Difference from Q-Chem v6.1: - -| mol | HF | LDA | PBE | M06 | B3LYP | wB97m-v | -|------:|---------:|---------:|---------:|---------:|---------:|----------:| -| 002 | 4.62e-11 | 1.28e-08 | 1.29e-08 | 9.42e-07 | 1.10e-08 | 7.39e-08 | -| 003 | 1.01e-09 | 6.56e-08 | 2.49e-08 | 3.90e-06 | 1.74e-07 | 3.05e-07 | -| 004 | 2.98e-09 | 9.17e-07 | 5.20e-07 | 4.49e-05 | 1.56e-06 | 2.84e-06 | -| 005 | 9.13e-09 | 1.83e-06 | 1.83e-06 | 1.39e-05 | 1.49e-06 | 3.90e-06 | -| 006 | 1.73e-08 | 8.76e-07 | 1.07e-06 | 2.17e-05 | 4.83e-07 | 1.56e-05 | -| 007 | 2.86e-08 | 2.08e-05 | 2.13e-05 | 2.55e-06 | 2.36e-05 | 1.40e-05 | -| 008 | 4.96e-08 | 1.34e-04 | 1.33e-04 | 1.53e-04 | 1.14e-04 | 3.18e-05 | -| 009 | 6.80e-08 | 2.65e-04 | 2.67e-04 | 1.23e-04 | 2.24e-04 | 7.58e-05 | -| 010 | 9.56e-08 | 5.63e-04 | 5.67e-04 | 5.12e-04 | 4.74e-04 | 2.06e-04 | - -Speedup over Q-Chem v6.1: - -| mol | HF | LDA | PBE | M06 | B3LYP | wB97m-v | -|------:|------:|------:|------:|------:|--------:|----------:| -| 002 | 0.706 | 0.216 | 0.182 | 0.211 | 0.182 | 0.415 | -| 003 | 0.921 | 0.650 | 0.735 | 1.988 | 1.387 | 2.826 | -| 004 | 1.925 | 0.821 | 1.769 | 3.877 | 2.658 | 4.991 | -| 005 | 3.310 | 1.120 | 2.414 | 5.498 | 4.784 | 5.912 | -| 006 | 3.706 | 1.538 | 3.082 | 7.184 | 5.896 | 6.112 | -| 007 | 4.106 | 1.533 | 2.960 | 7.958 | 6.617 | 6.157 | -| 008 | 4.624 | 1.653 | 3.559 | 7.402 | 6.743 | 6.488 | -| 009 | 4.893 | 1.922 | 3.979 | 8.265 | 6.723 | 6.560 | -| 010 | 5.278 | 3.629 | 3.658 | 8.734 | 8.003 | 6.385 | - -## Direct SCF Gradient with */def2-tzvpp - - -Difference from Q-Chem v6.1: - -| mol | HF | LDA | PBE | M06 | B3LYP | wB97m-v | -|------:|---------:|---------:|---------:|---------:|---------:|----------:| -| 002 | 1.79e-07 | 1.46e-06 | 2.74e-06 | 3.51e-05 | 1.78e-06 | 4.00e-06 | -| 003 | 5.68e-07 | 5.26e-06 | 6.23e-06 | 2.88e-04 | 5.70e-06 | 1.72e-05 | -| 004 | 1.90e-07 | 1.11e-05 | 1.42e-05 | 5.27e-04 | 1.03e-05 | 2.77e-05 | -| 005 | 2.77e-07 | 3.25e-05 | 3.46e-05 | 1.18e-03 | 2.74e-05 | 7.74e-05 | -| 006 | 3.41e-07 | 5.83e-05 | 5.82e-05 | 1.08e-03 | 4.86e-05 | 8.83e-05 | -| 007 | 4.87e-07 | 8.73e-05 | 8.52e-05 | 1.54e-03 | 7.24e-05 | 1.24e-04 | -| 008 | 6.95e-07 | 1.25e-04 | 1.22e-04 | 1.96e-03 | 1.07e-04 | 1.79e-04 | -| 009 | 8.16e-07 | 1.53e-04 | 1.48e-04 | 2.33e-03 | 1.31e-04 | 2.22e-04 | -| 010 | 2.97e-07 | 1.89e-04 | 1.84e-04 | 2.86e-03 | 1.61e-04 | 2.69e-04 | - -Speedup over Q-Chem v6.1: - -| mol | HF | LDA | PBE | M06 | B3LYP | wB97m-v | -|------:|------:|------:|------:|------:|--------:|----------:| -| 002 | 0.485 | 0.302 | 0.298 | 0.300 | 0.278 | 0.253 | -| 003 | 0.412 | 0.202 | 0.452 | 0.823 | 0.686 | 0.815 | -| 004 | 0.627 | 0.139 | 0.576 | 1.384 | 1.447 | 1.172 | -| 005 | 0.618 | 0.106 | 0.540 | 1.679 | 1.664 | 1.181 | -| 006 | 0.564 | 0.108 | 0.582 | 1.739 | 1.697 | 1.075 | -| 007 | 0.528 | 0.128 | 0.612 | 1.770 | 1.811 | 0.993 | -| 008 | 0.519 | 0.174 | 0.731 | 1.846 | 1.829 | 0.951 | -| 009 | 0.491 | 0.221 | 0.892 | 1.922 | 1.944 | 0.964 | -| 010 | 0.474 | 0.962 | 1.078 | 2.026 | 2.024 | 0.933 | diff --git a/benchmarks/solvent_qchem.md b/benchmarks/solvent_qchem.md deleted file mode 100644 index a61254e9..00000000 --- a/benchmarks/solvent_qchem.md +++ /dev/null @@ -1,28 +0,0 @@ -# Q-Chem v6.1 vs GPU4PySCF v1.0 - -DF with solvent methods - - -Difference from Q-Chem v6.1: - -| mol | CPCM | CPCM | CPCM | IEFPCM | IEFPCM | IEFPCM | -| | scf | grad | hess | scf | grad | hess | -|:-----------------|---------:|----------:|---------:|----------:|----------:|----------:| -| 020_Vitamin_C | 1.38e-04 | 1.20e-04 | 1.14e-03 | 1.38e-04 | 1.20e-04 | 1.14e-03 | -| 031_Inosine | 2.08e-04 | 1.40e-04 | 1.18e-03 | 2.08e-04 | 1.40e-04 | 1.18e-03 | -| 033_Bisphenol_A | 1.99e-04 | 1.78e-04 | 1.36e-03 | 1.99e-04 | 1.78e-04 | 1.36e-03 | -| 037_Mg_Porphin | 1.40e-04 | 1.35e-04 | 1.33e-03 | 1.40e-04 | 1.35e-04 | 1.33e-03 | -| 042_Penicillin_V | 2.55e-04 | -1.00e+00 | 1.84e-03 | 2.55e-04 | -1.00e+00 | 1.84e-03 | -| 045_Ochratoxin_A | 2.33e-04 | -1.00e+00 | 2.08e-03 | -1.00e+00 | -1.00e+00 | -1.00e+00 | - -Speedup over Q-Chem v6.1: - -| mol | CPCM | CPCM | CPCM | IEFPCM | IEFPCM | IEFPCM | -| | scf | grad | hess | scf | grad | hess | -|:-----------------|-------:|--------:|--------:|---------:|---------:|---------:| -| 020_Vitamin_C | 39.830 | 21.569 | 107.197 | 31.005 | 18.264 | 100.091 | -| 031_Inosine | 64.261 | 30.356 | 162.287 | 54.346 | 30.641 | 158.179 | -| 033_Bisphenol_A | 72.835 | 35.851 | 158.716 | 67.061 | 37.584 | 155.163 | -| 037_Mg_Porphin | 86.810 | 40.948 | 168.547 | 81.064 | 41.420 | 166.417 | -| 042_Penicillin_V | 78.003 | 36.844 | 186.077 | 81.012 | 36.729 | 186.541 | -| 045_Ochratoxin_A | 80.617 | 39.482 | 191.103 | -1.000 | -1.000 | -1.000 | diff --git a/examples/dft_driver.py b/examples/dft_driver.py index 69b45ce1..7871e12d 100644 --- a/examples/dft_driver.py +++ b/examples/dft_driver.py @@ -56,7 +56,7 @@ e_tot = mf_df.kernel() scf_time = time.time() - start_time print(f'compute time for energy: {scf_time:.3f} s') - +exit() start_time = time.time() g = mf_df.nuc_grad_method() g.auxbasis_response = True diff --git a/gpu4pyscf/dft/gen_grid.py b/gpu4pyscf/dft/gen_grid.py index c37246f1..30feb01e 100644 --- a/gpu4pyscf/dft/gen_grid.py +++ b/gpu4pyscf/dft/gen_grid.py @@ -380,7 +380,7 @@ def argsort_group(group_ids, ngroup): ''' groups = [] for i in range(ngroup): - groups.append(numpy.where(group_ids==i)[0]) + groups.append(cupy.argwhere(group_ids==i)[0]) return cupy.hstack(groups) def atomic_group_grids(mol, coords): @@ -405,8 +405,6 @@ def atomic_group_grids(mol, coords): current_node = next_node atom_coords = cupy.asarray(atom_coords[path]) - #dij = cupy.sum((atom_coords[:,None,:] - coords[None,:,:])**2, axis=2) - #group_ids = cupy.argmin(dij, axis=0) coords = cupy.asarray(coords, order='F') atom_coords = cupy.asarray(atom_coords, order='F') @@ -423,7 +421,8 @@ def atomic_group_grids(mol, coords): if err != 0: raise RuntimeError('CUDA Error') - return group_ids.argsort() + idx = group_ids.argsort() + return idx def arg_group_grids(mol, coords, box_size=GROUP_BOX_SIZE): ''' @@ -497,7 +496,7 @@ def __setattr__(self, key, val): @property def size(self): return getattr(self.weights, 'size', 0) - + def build(self, mol=None, with_non0tab=False, sort_grids=True, **kwargs): if mol is None: mol = self.mol if self.verbose >= logger.WARN: diff --git a/gpu4pyscf/dft/numint.py b/gpu4pyscf/dft/numint.py index 3179d62a..a5110d90 100644 --- a/gpu4pyscf/dft/numint.py +++ b/gpu4pyscf/dft/numint.py @@ -192,26 +192,17 @@ def eval_rho2(mol, ao, mo_coeff, mo_occ, non0tab=None, xctype='LDA', else: _, ngrids = ao[0].shape - shls_slice = (0, mol.nbas) - ao_loc = mol.ao_loc_nr() - - #cpos = cupy.einsum('ij,j->ij', mo_coeff[:,mo_occ>0], cupy.sqrt(mo_occ[mo_occ>0])) - #cpos = mo_coeff[:,mo_occ>0] * cupy.sqrt(mo_occ[mo_occ>0]) cpos = (mo_coeff * mo_occ**0.5)[:,mo_occ>0] if xctype == 'LDA' or xctype == 'HF': - c0 = _dot_ao_dm(mol, ao, cpos, non0tab, shls_slice, ao_loc) - #:rho = numpy.einsum('pi,pi->p', c0, c0) + c0 = cupy.dot(cpos.T, ao) rho = _contract_rho(c0, c0) elif xctype in ('GGA', 'NLC'): rho = cupy.empty((4,ngrids)) - #c0 = _dot_ao_dm(mol, ao[0], cpos, non0tab, shls_slice, ao_loc) - c0 = contract('nig,io->nog', ao, cpos) - #:rho[0] = numpy.einsum('pi,pi->p', c0, c0) - _contract_rho(c0[0], c0[0], rho=rho[0]) + c0 = cupy.dot(cpos.T, ao[0]) + _contract_rho(c0, c0, rho=rho[0]) for i in range(1, 4): - #c1 = _dot_ao_dm(mol, ao[i], cpos, non0tab, shls_slice, ao_loc) - #:rho[i] = numpy.einsum('pi,pi->p', c0, c1) * 2 # *2 for +c.c. - _contract_rho(c0[0], c0[i], rho=rho[i]) + c1 = cupy.dot(cpos.T, ao[i]) + _contract_rho(c0, c1, rho=rho[i]) rho[1:] *= 2 else: # meta-GGA if with_lapl: @@ -221,26 +212,23 @@ def eval_rho2(mol, ao, mo_coeff, mo_occ, non0tab=None, xctype='LDA', else: rho = cupy.empty((5,ngrids)) tau_idx = 4 - #c0 = _dot_ao_dm(mol, ao[0], cpos, non0tab, shls_slice, ao_loc) - c0 = contract('nig,io->nog', ao, cpos) - #:rho[0] = numpy.einsum('pi,pi->p', c0, c0) - _contract_rho(c0[0], c0[0], rho=rho[0]) + + c0 = cupy.dot(cpos.T, ao[0]) + _contract_rho(c0, c0, rho=rho[0]) rho[tau_idx] = 0 for i in range(1, 4): - #c1 = _dot_ao_dm(mol, ao[i], cpos, non0tab, shls_slice, ao_loc) - #:rho[i] = numpy.einsum('pi,pi->p', c0, c1) * 2 # *2 for +c.c. - #:rho[5] += numpy.einsum('pi,pi->p', c1, c1) - rho[i] = _contract_rho(c0[0], c0[i]) - rho[tau_idx] += _contract_rho(c0[i], c0[i]) + c1 = cupy.dot(cpos.T, ao[i]) + rho[i] = _contract_rho(c0, c1) + rho[tau_idx] += _contract_rho(c1, c1) if with_lapl: if ao.shape[0] > 4: XX, YY, ZZ = 4, 7, 9 ao2 = ao[XX] + ao[YY] + ao[ZZ] - c1 = _dot_ao_dm(mol, ao2, cpos, non0tab, shls_slice, ao_loc) + c1 = cupy.dot(cpos.T, ao2) #:rho[4] = numpy.einsum('pi,pi->p', c0, c1) - rho[4] = _contract_rho(c0[0], c1) + rho[4] = _contract_rho(c0, c1) rho[4] += rho[5] rho[4] *= 2 else: @@ -510,7 +498,8 @@ def nr_rks(ni, mol, grids, xc_code, dms, relativity=0, hermi=1, exc = cupy.asarray(exc, order='C') den = rho_tot[i][0] * grids.weights nelec[i] = den.sum() - excsum[i] = cupy.sum(den * exc[:,0]) + excsum[i] = cupy.dot(den, exc[:,0]) + wv.append(vxc * grids.weights) if xctype == 'GGA': wv[i][0] *= .5 @@ -1554,7 +1543,7 @@ def _block_loop(ni, mol, grids, nao=None, deriv=0, max_memory=2000, shls_slice=non0shl_idx, ao_loc_slice=ao_loc_slice, ctr_offsets_slice=ctr_offsets_slice) - + t1 = log.timer_debug2('evaluate ao slice', *t1) if pad > 0: if deriv == 0: @@ -1675,7 +1664,7 @@ class NumInt(lib.StreamObject, LibXCMixin): pair_mask = None screen_index = None xcfuns = None # can be multiple xc functionals - + def build(self, mol, coords): self.gdftopt = _GDFTOpt.from_mol(mol) if USE_SPARSITY == 1: @@ -1932,7 +1921,7 @@ def __init__(self, mol): self.envs_cache = ctypes.POINTER(_GDFTEnvsCache)() self._sorted_mol = None # sorted mol object based on contraction pattern self.mol = mol - + def build(self, mol=None): if mol is None: mol = self.mol diff --git a/gpu4pyscf/lib/cupy_helper.py b/gpu4pyscf/lib/cupy_helper.py index d679769b..1b549059 100644 --- a/gpu4pyscf/lib/cupy_helper.py +++ b/gpu4pyscf/lib/cupy_helper.py @@ -510,7 +510,7 @@ def krylov(aop, b, x0=None, tol=1e-10, max_cycle=30, dot=cupy.dot, nroots, ndim = x1.shape x1, rmat = _stable_qr(x1, cupy.dot, lindep=lindep) x1 *= rmat.diagonal()[:,None] - + innerprod = [rmat[i,i].real ** 2 for i in range(x1.shape[0])] max_innerprod = max(innerprod) @@ -550,7 +550,7 @@ def krylov(aop, b, x0=None, tol=1e-10, max_cycle=30, dot=cupy.dot, x1 = x1[mask] innerprod.extend(innerprod1[mask]) if max_innerprod > 1e10: - raise RuntimeError('Krylov subspace iterations diverge') + raise RuntimeError('Krylov subspace iterations diverge') else: raise RuntimeError('Krylov solver failed to converge') @@ -795,4 +795,5 @@ def grouped_gemm(As, Bs, Cs=None): ) if err != 0: raise RuntimeError('failed in grouped_gemm kernel') - return Cs \ No newline at end of file + return Cs +