diff --git a/MANIFEST.in b/MANIFEST.in index 9783e62200..65502295ad 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -18,5 +18,8 @@ include pyscf/gto/basis/bse_meta.json recursive-include pyscf/lib *.c *.h CMakeLists.txt recursive-exclude pyscf/lib *.cl +# Benchmarks data +recursive-include pyscf/tools/benchmarks * + global-exclude *.py[cod] prune pyscf/lib/build diff --git a/pyscf/tools/benchmarks/__init__.py b/pyscf/tools/benchmarks/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pyscf/tools/benchmarks/dft.py b/pyscf/tools/benchmarks/dft.py new file mode 100644 index 0000000000..b8607e999e --- /dev/null +++ b/pyscf/tools/benchmarks/dft.py @@ -0,0 +1,88 @@ +# Copyright 2025 The PySCF Developers. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +''' +Benchmark tests for DFT and density fitting DFT methods. This module can be +executed fromm cli: + + python -m pyscf.tools.benchmarks.dft --save-json=pyscf-2.9-dft.json --print-summary=True +''' + +import os +import pyscf +from pyscf.tools.benchmarks.utils import molecules_dir, benchmark, cli_parser, run + +def run_rks(atom, basis, xc, auxbasis=None, with_grad=False): + mol = pyscf.M(atom=atom, basis=basis, verbose=0) + mf = mol.RKS(xc=xc) + if auxbasis is not None: + mf = mf.density_fit(auxbasis=auxbasis) + mf.grids.atom_grid = (99,590) + mf.nlcgrids.atom_grid = (50,194) + mf.conv_tol = 1e-8 + mf.run() + if with_grad: + mf.Gradients().run() + return mf.e_tot + +def benchmark_df_rks(): + for xyz_file in [ + '020_Vitamin_C.xyz', + '031_Inosine.xyz', + '033_Bisphenol_A.xyz', + '037_Mg_Porphin.xyz', + '042_Penicillin_V.xyz', + '045_Ochratoxin_A.xyz', + ]: + xyz_file = os.path.join(molecules_dir, 'organic', xyz_file) + for xc in ['pbe', 'b3lyp', 'wb97m-v']: + for basis in ['def2-tzvp']: + mol_name = xyz_file.rsplit('.', 1)[0] + benchmark( + lambda: run_rks(xyz_file, basis, xc, 'def2-universal-jkfit'), + label=f'DFRKS {mol_name} {xc}/{basis}') + +def benchmark_rks_gradients(): + for xyz_file in [ + '020_Vitamin_C.xyz', + '031_Inosine.xyz', + '033_Bisphenol_A.xyz', + '037_Mg_Porphin.xyz', + '042_Penicillin_V.xyz', + '045_Ochratoxin_A.xyz', + '052_Cetirizine.xyz', + '057_Tamoxifen.xyz', + '066_Raffinose.xyz', + '084_Sphingomyelin.xyz', + '095_Azadirachtin.xyz', + '113_Taxol.xyz', + ]: + xyz_file = os.path.join(molecules_dir, 'organic', xyz_file) + for xc in ['pbe', 'b3lyp', 'wb97m-v']: + for basis in ['def2-tzvp']: + mol_name = xyz_file.rsplit('.', 1)[0] + benchmark( + lambda: run_rks(xyz_file, basis, xc, with_grad=True), + label=f'RKS {mol_name} {xc}/{basis} Gradients', + tags=['slow']) + +def main(): + parser = cli_parser() + args = parser.parse_args() + benchmark_df_rks() + benchmark_rks_gradients() + run(output_file=args.save_json, print_summary=args.print_summary) + +if __name__ == '__main__': + main() diff --git a/pyscf/tools/benchmarks/h2o.py b/pyscf/tools/benchmarks/h2o.py new file mode 100644 index 0000000000..378ea84d46 --- /dev/null +++ b/pyscf/tools/benchmarks/h2o.py @@ -0,0 +1,51 @@ +# Copyright 2025 The PySCF Developers. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +''' +Benchmark example. This module can be executed fromm cli: + + python -m pyscf.tools.benchmarks.h2o --save-json=pyscf-2.9-h2o.json --print-summary=True +''' + +import os +import pyscf +from pyscf.tools.benchmarks.utils import molecules_dir, benchmark, cli_parser, run + +@benchmark +def water_hf(): + mol = pyscf.M(atom=f'{molecules_dir}/water_clusters/002.xyz', basis='cc-pvdz', verbose=0) + mf = mol.RHF() + counts = 0 + def scf_iter_counts(envs): + nonlocal counts + counts += 1 + mf.callback = scf_iter_counts + mf.run() + return {'E': mf.e_tot, 'SCF iters': counts} + +@benchmark +def water_tdhf(): + mol = pyscf.M(atom=f'{molecules_dir}/water_clusters/002.xyz', basis='cc-pvdz', verbose=0) + mf = mol.RHF().run() + td = mf.TDHF() + td.run() + return {'E': mf.e_tot} + +def main(): + parser = cli_parser() + args = parser.parse_args() + run(output_file=args.save_json, print_summary=args.print_summary) + +if __name__ == '__main__': + main() diff --git a/pyscf/tools/benchmarks/molecules/organic/020_Vitamin_C.xyz b/pyscf/tools/benchmarks/molecules/organic/020_Vitamin_C.xyz new file mode 100644 index 0000000000..e119c6d32e --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/020_Vitamin_C.xyz @@ -0,0 +1,22 @@ +20 +Vitamin C +C -0.07551087 1.68127663 -0.10745193 +O 1.33621755 1.87147409 -0.39326987 +C 1.67074668 2.95729545 0.49387976 +C 0.41740763 3.77281969 0.78495878 +C -0.60481480 3.07572636 0.28906224 +H -0.19316298 1.01922455 0.72486113 +O 0.35092043 5.03413298 1.45545728 +H 0.42961487 5.74279041 0.81264173 +O -1.95331750 3.53349874 0.15912025 +H -2.55333895 2.78846397 0.23972698 +O 2.81976302 3.20110148 0.94542226 +C -0.81772499 1.09230218 -1.32146482 +H -0.70955636 1.74951833 -2.15888136 +C -2.31163857 0.93420736 -0.98260166 +H -2.72575463 1.89080093 -0.74107186 +H -2.41980721 0.27699120 -0.14518512 +O -0.26428017 -0.18613595 -1.64425697 +H -0.72695910 -0.55328886 -2.40104423 +O -3.00083741 0.38730252 -2.10989934 +H -3.93210821 0.28874990 -1.89865997 diff --git a/pyscf/tools/benchmarks/molecules/organic/031_Inosine.xyz b/pyscf/tools/benchmarks/molecules/organic/031_Inosine.xyz new file mode 100644 index 0000000000..923dc7d5c5 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/031_Inosine.xyz @@ -0,0 +1,33 @@ +31 +Inosine +C -0.84925689 1.19426748 0.00000000 +O 0.58111411 1.19426748 0.00000000 +C 1.08310511 2.53365748 0.00000000 +C -0.09344989 3.50382448 -0.00000100 +C -1.34480089 2.63646648 -0.00000100 +H -1.17341789 0.63528848 0.91513200 +H 1.71994411 2.64115648 0.91536000 +H -0.06206089 4.16301548 -0.90190500 +H -1.97307989 2.83841948 -0.90190500 +O -0.05328805 4.34730633 1.15404640 +H -0.02922706 5.26656976 0.87840928 +O -2.14872719 2.89488055 1.15404608 +H -3.07612353 2.89074011 0.90601607 +C -1.29487091 0.42585647 -1.25800344 +H -2.36057357 0.33005726 -1.25860833 +H -0.98433839 0.96058082 -2.13123848 +O -0.69940910 -0.87426857 -1.25830689 +H -1.15722348 -1.43626839 -1.88772107 +N 1.95854804 2.68143304 -1.25831716 +C 3.40750745 2.83869936 -1.24831720 +C 1.52513756 2.69033382 -2.59758791 +C 3.83177447 2.94266783 -2.62652798 +H 0.49017157 2.59129990 -2.92355570 +C 5.16750068 3.10114669 -2.93617186 +C 5.68858554 3.05790761 -0.55874621 +H 6.43570855 3.10532282 0.24755786 +N 2.63327508 2.84671184 -3.45064980 +N 4.33322006 2.89644875 -0.22604840 +N 6.09645965 3.15797838 -1.88374496 +H 6.74393404 2.41331683 -2.04578224 +O 5.60770510 3.20620138 -4.29266866 diff --git a/pyscf/tools/benchmarks/molecules/organic/033_Bisphenol_A.xyz b/pyscf/tools/benchmarks/molecules/organic/033_Bisphenol_A.xyz new file mode 100644 index 0000000000..451e070825 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/033_Bisphenol_A.xyz @@ -0,0 +1,35 @@ +33 +Bisphenol A +C 0.17302217 -0.05367870 0.02060230 +C 0.68636442 0.67471439 1.27659722 +H 0.33130807 1.68408369 1.27366248 +H 0.32809533 0.17314097 2.15122134 +H 1.75636261 0.67300961 1.27757926 +C 0.68636436 0.66983803 -1.23820799 +H 1.75636429 0.67015162 -1.23801986 +H 0.32999896 0.16352848 -2.11087880 +H 0.32940246 1.67853700 -1.24035286 +C -1.36697783 -0.05365972 0.02060230 +C -2.06451416 -1.26192666 0.02294888 +C -2.06446856 1.15425163 0.01836764 +C -3.45922608 -1.26218837 0.02237872 +H -1.51433285 -2.21405130 0.02393307 +C -3.45960644 1.15416501 0.01879292 +H -1.51485954 2.10664659 0.01669790 +C -4.15704263 -0.05377385 0.02065983 +H -4.00910069 -2.21451865 0.02359421 +H -4.00927970 2.10670462 0.01744603 +C 0.68633788 -1.50560812 0.02341767 +C 0.91946288 -2.16536088 -1.18358293 +C 0.91831096 -2.16106624 1.23259561 +C 1.38381298 -3.48050177 -1.18131091 +H 0.73574920 -1.64859280 -2.13670508 +C 1.38374179 -3.47627650 1.23504147 +H 0.73479448 -1.64116737 2.18399242 +C 1.61638160 -4.13609396 0.02836974 +H 1.56698980 -4.00080229 -2.13264163 +H 1.56694472 -3.99268549 2.18857840 +O 2.09255288 -5.48448444 0.03037417 +H 3.05255142 -5.48531759 0.03182891 +O -5.58704242 -0.05436711 0.02015267 +H -5.90797050 0.43788494 0.77929237 diff --git a/pyscf/tools/benchmarks/molecules/organic/037_Mg_Porphin.xyz b/pyscf/tools/benchmarks/molecules/organic/037_Mg_Porphin.xyz new file mode 100644 index 0000000000..5b3303d021 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/037_Mg_Porphin.xyz @@ -0,0 +1,39 @@ +37 +Mg Porphin +C -1.41478807 -1.38673987 -0.27546855 +C 0.10179343 -1.53458053 -0.07889229 +C 0.53408642 -0.37025944 0.45145190 +C -0.67562941 0.57796327 0.46559768 +H 0.69507620 -2.39648436 -0.30089545 +H 1.52737697 -0.14599081 0.78086417 +C -0.62370820 1.96362793 0.78635139 +H 0.21323483 2.35384028 1.32735933 +C -2.29970743 -2.44324831 -0.63702830 +H -1.91393373 -3.32969289 -1.09683478 +C -1.64052102 2.84486117 0.32186518 +C -3.52932141 3.58449372 -0.59511281 +C -2.59214132 4.79754521 -0.48499553 +H -2.78843501 5.79301664 -0.82737225 +C -1.48137242 4.36442701 0.14972837 +N -2.86612663 2.50908907 -0.12553285 +N -1.74741954 -0.12018577 0.04126910 +H -0.64679525 4.95921480 0.45645615 +C -3.68393396 -2.35600549 -0.31223368 +C -4.63005393 -3.55629325 -0.15598101 +N -4.37818634 -1.24301980 -0.00220836 +C -5.78557755 -3.06857539 0.34505536 +H -4.41027665 -4.57910031 -0.38223928 +C -5.63589939 -1.53901637 0.37901842 +H -6.64304239 -3.63441062 0.64304078 +C -6.68305631 -0.62113443 0.67405446 +H -7.56136499 -0.96043354 1.18328735 +C -6.60122370 0.72696467 0.22471451 +C -7.80292122 1.66378985 0.02269080 +N -5.49689043 1.38542695 -0.17958107 +C -7.32644297 2.77323824 -0.58189005 +H -8.81986259 1.46790799 0.29231039 +C -5.79921052 2.61414176 -0.64211669 +H -7.89795710 3.60669127 -0.93279659 +C -4.88433877 3.63473378 -1.03220086 +H -5.22991618 4.47158073 -1.60163868 +Mg -3.62049120 0.63120563 -0.10251958 diff --git a/pyscf/tools/benchmarks/molecules/organic/042_Penicillin_V.xyz b/pyscf/tools/benchmarks/molecules/organic/042_Penicillin_V.xyz new file mode 100644 index 0000000000..7861c57c1e --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/042_Penicillin_V.xyz @@ -0,0 +1,44 @@ +42 +Penicillin V +C -0.77452336 -0.08132633 1.74172506 +C -0.26411504 -0.11129929 0.43692360 +C -0.35397350 1.02601929 -0.37692764 +C -0.95424489 2.19330919 0.11402082 +C -1.46465579 2.22328125 1.41882131 +C -1.37479443 1.08596370 2.23267366 +H -0.70591476 -0.94969444 2.36311840 +H 0.03573621 1.00313485 -1.37317189 +H -1.02285582 3.06167644 -0.50737346 +H -1.92297618 3.11453305 1.79367143 +H -1.76450608 1.10884747 3.22891718 +O 0.34840202 -1.30241314 -0.06404605 +C 1.35270587 -0.95567870 -1.02115052 +H 2.09459791 -0.34266532 -0.55348523 +H 0.90396901 -0.41799437 -1.83011950 +C 2.01233961 -2.23841673 -1.56065630 +O 2.09302887 -3.25968240 -0.82985109 +N 2.54773286 -2.26985691 -2.92932924 +H 3.50527213 -1.98172537 -2.91939174 +C 2.45289144 -3.63693794 -3.46130165 +C 3.06213638 -3.98156820 -4.81429695 +C 3.20775770 -4.83278916 -2.92168779 +H 1.41330079 -3.88850264 -3.43186598 +H 2.21258260 -3.95040754 -5.46405646 +O 3.42944279 -5.30612203 -1.77696850 +N 3.67522246 -5.14821806 -4.31096996 +C 3.66579173 -6.10484804 -5.36714016 +H 4.49655524 -6.75828572 -5.20055325 +C 3.84517881 -5.06783193 -6.57540908 +C 4.72191908 -5.64179240 -7.70390186 +H 4.27386857 -6.53609107 -8.08387642 +H 4.80563701 -4.92235784 -8.49149645 +H 5.69541534 -5.86571901 -7.32041536 +C 2.45462245 -4.72770184 -7.14309246 +H 2.00895589 -5.61186346 -7.54872716 +H 1.83452668 -4.34238508 -6.36084427 +H 2.55421902 -3.99253283 -7.91413529 +S 4.42031248 -3.49330876 -5.80985222 +C 2.41628932 -6.97906376 -5.58182741 +O 1.24772273 -6.54739905 -5.20566321 +O 2.52902641 -8.14944067 -6.13940253 +H 3.39110571 -8.46788950 -6.41690875 diff --git a/pyscf/tools/benchmarks/molecules/organic/045_Ochratoxin_A.xyz b/pyscf/tools/benchmarks/molecules/organic/045_Ochratoxin_A.xyz new file mode 100644 index 0000000000..21f65e2179 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/045_Ochratoxin_A.xyz @@ -0,0 +1,47 @@ +45 +Ochratoxin A +C -2.81999319 2.42808848 0.54098799 +C -1.48506359 2.12574154 0.24053959 +C -0.57560888 3.15808633 -0.02458108 +C -1.00054575 4.49301108 0.01119766 +C -2.33541234 4.79564647 0.31151005 +C -3.24524285 3.76302115 0.57613058 +H -3.51427777 1.63974701 0.74369099 +H 0.44352769 2.92714554 -0.25417935 +H -0.30609255 5.28106112 -0.19052950 +H -2.66014056 5.81490526 0.33906034 +H -4.26458005 3.99396043 0.80476437 +C -1.01732442 0.65950815 0.20185290 +H -0.67533111 0.36853591 1.17285734 +H -1.83249438 0.03203052 -0.09154374 +C 0.13235379 0.51505962 -0.81252046 +H -0.21019462 0.80566498 -1.78314105 +C 1.30596367 1.41901641 -0.39114863 +C 1.67510534 -1.02185697 -1.82127087 +N 0.57986576 -0.88420978 -0.85050744 +H -0.18284568 -1.47067933 -1.12333537 +C 2.75580261 -2.09988547 -1.61482923 +C 2.69427195 -2.95177434 -0.50654721 +C 3.79955020 -2.23324053 -2.53790490 +C 3.70091458 -3.90483765 -0.30182990 +H 1.88147807 -2.87383893 0.18522781 +C 4.78600353 -3.21184574 -2.34716707 +H 3.84167861 -1.59151423 -3.39308111 +C 4.77253365 -4.00413187 -1.20130033 +C 5.85248621 -3.42589670 -3.42542028 +C 5.90561132 -5.00024671 -0.90103115 +C 6.77658910 -5.27533663 -2.15038566 +H 6.54653968 -4.59705454 -0.14509272 +O 2.17311788 1.97320056 -1.38357913 +H 2.51483540 2.81560975 -1.07582854 +O 1.50162390 1.66968264 0.82605442 +O 1.72973935 -0.25904981 -2.82056879 +C 7.73469993 -6.47923452 -2.09043925 +H 7.25757496 -7.33559502 -2.51759025 +H 8.62396559 -6.25453714 -2.64131193 +H 7.98803284 -6.68347394 -1.07133620 +Cl 3.62524241 -4.97417462 1.09396391 +O 5.79027817 -2.75121797 -4.48594121 +O 6.90897033 -4.37928239 -3.27178983 +H 5.46196268 -5.90980388 -0.55344219 +H 7.47765424 -4.60305065 -1.70382804 diff --git a/pyscf/tools/benchmarks/molecules/organic/052_Cetirizine.xyz b/pyscf/tools/benchmarks/molecules/organic/052_Cetirizine.xyz new file mode 100644 index 0000000000..67f0b0e18e --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/052_Cetirizine.xyz @@ -0,0 +1,54 @@ +52 +Cetirizine +C -1.31610737 2.63679048 -0.00084644 +C 0.07905007 2.63934168 -0.00004682 +C 0.77437809 3.84836613 0.00070992 +C 0.07451596 5.05559768 -0.00053176 +C -1.32030606 5.05296923 -0.00181022 +C -2.01569681 3.84348937 -0.00157112 +H -1.86412404 1.68346969 -0.00099299 +H 1.87405556 3.85045682 0.00197421 +H 0.62297373 6.00874516 0.00000598 +H -1.87216801 6.00424292 -0.00279707 +H -3.11529902 3.84166168 -0.00238130 +C 0.85103942 1.30681443 0.00184158 +H 1.79337581 1.43985720 -0.48724099 +C 0.41505987 -0.48736387 1.68199576 +C 2.57473964 0.77351617 1.72731358 +C 0.69110348 -1.01300628 3.07592768 +H 0.78959033 -1.22526334 0.92463509 +H -0.69101600 -0.38321987 1.53238838 +C 2.85074861 0.24863316 3.12155937 +H 3.05729485 0.09861578 0.97233225 +H 3.03204876 1.79032016 1.61147100 +H 0.23490280 -2.03043373 3.19085261 +H 0.20695056 -0.33927459 3.83095099 +H 3.95676021 0.14403431 3.27103621 +H 2.47681583 0.98744831 3.87839265 +N 1.08617979 0.85184124 1.45418741 +N 2.17897791 -1.08989652 3.35069584 +C 0.03162829 0.23777883 -0.74470266 +C 0.56867017 -0.39587510 -1.86565767 +C -1.24736307 -0.09709064 -0.30018981 +C -0.17344898 -1.36368445 -2.54228606 +H 1.57672684 -0.13109474 -2.21630694 +C -1.98945087 -1.06588037 -0.97632740 +H -1.67071899 0.40210131 0.58338598 +C -1.45278973 -1.69908441 -2.09730218 +H 0.24953934 -1.86273063 -3.42621495 +H -2.99769071 -1.33000002 -0.62537518 +Cl -2.38893911 -2.92048839 -2.95134941 +C 2.78094574 -2.08721982 2.45410174 +H 2.02278564 -2.75673563 2.10504323 +H 3.23055355 -1.59117358 1.61942159 +C 3.85566305 -2.88236770 3.21851166 +H 3.99860784 -3.83253439 2.74771441 +H 4.77651636 -2.33753632 3.20913280 +C 4.26802920 -4.18276315 5.33113825 +H 3.99105398 -4.28769779 6.35932766 +H 5.29898799 -3.90383432 5.26615610 +C 4.05157947 -5.52181188 4.60196201 +O 4.49897618 -6.59036968 5.09348105 +O 3.33974189 -5.55104438 3.36206979 +H 3.28517852 -6.45557385 3.04513244 +O 3.39930599 -3.09413546 4.67401592 diff --git a/pyscf/tools/benchmarks/molecules/organic/057_Tamoxifen.xyz b/pyscf/tools/benchmarks/molecules/organic/057_Tamoxifen.xyz new file mode 100644 index 0000000000..b51df6f59f --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/057_Tamoxifen.xyz @@ -0,0 +1,59 @@ +57 +Tamoxifen +C -1.42666665 1.35988349 0.01780185 +C -0.75139234 2.53486079 0.01780185 +C -2.96666665 1.35988349 0.01780185 +C -3.66418809 0.15160568 0.01780185 +C -3.66417225 2.56778831 0.01791304 +C -5.05890001 0.15132789 0.01723115 +H -3.11399504 -0.80051230 0.01693694 +C -5.05931013 2.56768367 0.01833813 +H -3.11457497 3.52019148 0.01809296 +C -5.75673144 1.35973487 0.01785909 +H -5.60876287 -0.80100973 0.01659711 +H -5.60899513 3.52021733 0.01884114 +H -6.85641138 1.35926586 0.01746817 +C -1.51874951 3.87006226 0.01780185 +C -1.63823871 4.60590036 -1.16149287 +C -2.09440347 4.34371845 1.19670832 +C -2.33266580 5.81544273 -1.16163975 +H -1.18363273 4.23258432 -2.09058400 +C -2.78991814 5.55312706 1.19651365 +H -2.00047584 3.76380313 2.12622693 +C -2.90901419 6.28907563 0.01764434 +H -2.42635385 6.39580205 -2.09099551 +H -3.24404320 5.92613353 2.12608927 +C 0.78860766 2.53486079 0.01780185 +C 1.48612910 3.74313859 0.01780185 +C 1.48611327 1.32695597 0.01791304 +C 2.88084102 3.74341639 0.01723115 +H 0.93593606 4.69525658 0.01693694 +C 2.88125115 1.32706060 0.01833813 +H 0.93651599 0.37455279 0.01809296 +C 3.57867246 2.53500940 0.01785909 +H 3.43070389 4.69575400 0.01659711 +H 3.43093615 0.37452694 0.01884114 +H 4.67835240 2.53547842 0.01746817 +C -0.65930948 0.02468201 0.01780185 +H -0.04466478 -0.03344716 -0.85611628 +H -0.04386363 -0.03298673 0.89118649 +C -1.66236338 -1.14385651 0.01856968 +H -2.27713573 -1.08561745 0.89239069 +H -2.27768159 -1.08629703 -0.85491210 +H -1.12919956 -2.07156136 0.01876393 +O -3.62101473 7.52921876 0.01715974 +C -2.69982994 8.60858726 0.19402752 +H -2.03011871 8.64615667 -0.63962434 +H -2.14108178 8.45680900 1.09384076 +C -3.47584819 9.93535894 0.28927757 +H -4.05456450 10.07469158 -0.59986462 +H -4.12694690 9.90759901 1.13792346 +C -1.65137806 10.90285045 1.72438609 +H -2.24764703 10.40869908 2.46274761 +H -0.79110440 10.30633800 1.50302183 +H -1.33836538 11.85545774 2.09783276 +C -3.25771829 12.42866058 0.53449492 +H -2.56611180 13.24181825 0.60767325 +H -3.86037095 12.55070987 -0.34118410 +H -3.88574784 12.41553739 1.40069735 +N -2.48185199 11.10154878 0.44281205 diff --git a/pyscf/tools/benchmarks/molecules/organic/066_Raffinose.xyz b/pyscf/tools/benchmarks/molecules/organic/066_Raffinose.xyz new file mode 100644 index 0000000000..058c3910d5 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/066_Raffinose.xyz @@ -0,0 +1,68 @@ +66 +Raffinose +C -1.42958937 -1.01658249 2.44831265 +C -1.54149463 -0.27943595 1.12935913 +C -2.95243912 1.47129501 2.22492550 +C -2.84134324 0.73400280 3.54388810 +C -1.55797242 -0.06742235 3.62210684 +H -0.66497820 0.41085733 1.01283439 +H -0.44314689 -1.54644194 2.49994231 +H -3.93813646 2.00251835 2.17350554 +H -3.71865156 0.04459988 3.66018043 +H -0.68133448 0.63238265 3.63327796 +O -1.92499204 2.46279929 2.14636482 +C -1.46076301 4.67520648 3.08258818 +C -1.65192906 4.60593616 4.58432062 +H -0.74117334 5.43388332 2.85565168 +C -3.37658473 6.27667868 2.91318631 +C -2.26541279 5.88367074 5.11970508 +H -2.31747310 3.73866848 4.83580579 +C -3.56636040 6.20921206 4.41472333 +H -4.36600055 6.45426127 2.41719619 +H -1.54350069 6.73075622 4.97913735 +H -4.32958469 5.42429404 4.65913754 +O -2.52952388 7.38269576 2.59051909 +C -3.31900286 8.44866624 2.05635630 +C -3.26458455 9.66301263 2.97202724 +C -2.80523815 10.85434814 2.14390783 +H -4.26911658 9.86120175 3.42267320 +C -2.45049436 10.34868118 0.75291070 +H -1.92149828 11.34764146 2.62047963 +H -3.01626404 10.91739387 -0.02697788 +C -4.76356005 7.92754855 1.94107026 +H -4.78266313 7.06714393 1.30527236 +H -5.12531018 7.66145994 2.91227245 +O -2.82580898 0.52071700 1.05150767 +C -0.93849427 3.31732760 2.57761263 +H -0.77727115 3.36776157 1.52103158 +H -0.01653199 3.08491476 3.06839754 +C -1.49224313 -1.28985314 -0.03177454 +H -0.58145107 -1.84899344 0.02037852 +H -2.32526415 -1.95746693 0.04080516 +C -0.95163774 10.56175833 0.47072820 +H -0.66603955 9.99216789 -0.38886496 +H -0.38034325 10.24135666 1.31681648 +O -1.55044662 -0.58860344 -1.27666860 +H -1.40118565 -1.20385620 -1.99832308 +O -2.45542951 -2.00981905 2.52598600 +H -2.07814582 -2.83668451 2.83509848 +O -1.53066740 -0.81010098 4.84381994 +H -0.61998842 -0.98424670 5.09269150 +O -2.88646987 1.67226139 4.62209700 +H -3.42291955 1.31644411 5.33428785 +O -0.39050984 4.37790095 5.21813565 +H -0.43907755 4.65272412 6.13667438 +O -2.50206790 5.74947404 6.52358741 +H -2.24542728 6.55931660 6.97067871 +O -4.06906224 7.46048270 4.89065678 +H -4.76357327 7.30283533 5.53439721 +O -2.76235824 4.99928466 2.37789525 +O -5.59594331 8.94915410 1.38576835 +H -6.48998576 8.61436213 1.28476127 +O -2.79571817 8.86766013 0.68976834 +O -2.35757225 9.42976003 4.05268533 +H -2.22828280 10.24429373 4.54402949 +O -3.84292711 11.83519815 2.06622328 +H -3.45759742 12.71343457 2.10890596 +O -0.70503591 11.94904429 0.22675035 +H 0.04258943 12.04182451 -0.36826913 diff --git a/pyscf/tools/benchmarks/molecules/organic/084_Sphingomyelin.xyz b/pyscf/tools/benchmarks/molecules/organic/084_Sphingomyelin.xyz new file mode 100644 index 0000000000..e031c92ecb --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/084_Sphingomyelin.xyz @@ -0,0 +1,86 @@ +84 +Sphingomyelin +C -7.49315956 -1.43773119 -5.92299552 +H -7.94182211 -2.40858579 -5.95529496 +H -7.95636393 -0.85617992 -5.15348929 +H -7.62668554 -0.95153649 -6.86675689 +C -5.79642037 -2.27443704 -4.26611112 +H -6.24577738 -3.24503611 -4.29637197 +H -4.75102405 -2.37166315 -4.05972888 +H -6.25894988 -1.69106781 -3.49757564 +C -5.32241415 -2.41652735 -6.73175378 +H -5.45614320 -1.93219937 -7.67644576 +H -4.27697469 -2.51320533 -6.52533261 +H -5.77127293 -3.38735843 -6.76196670 +C -5.34230471 -0.18003416 -5.58198519 +H -5.80528977 0.40321281 -4.81363123 +H -5.47564419 0.30434483 -6.52670609 +C -3.83777346 -0.31946968 -5.28442266 +H -3.37486869 -0.90308305 -6.05254674 +H -3.70443723 -0.80345768 -4.33950093 +O -3.19138412 1.07764258 -5.24131661 +O -1.08666761 2.23553569 -4.90355336 +O -1.06813532 0.15822874 -5.97009968 +O -1.50879854 0.29141327 -3.68074512 +N -5.98857475 -1.57718235 -5.62571128 +C 0.31042939 2.10678634 -4.62706904 +H 0.77368465 1.52318382 -5.39499004 +H 0.44389576 1.62311344 -3.68200436 +C 0.95616173 3.50421186 -4.58427124 +H 0.49289614 4.08781851 -3.81635961 +N 0.77281830 4.16868977 -5.88263725 +C 1.54573854 5.24091768 -6.23123101 +H 0.07949519 3.81992495 -6.49108736 +O 2.42345554 5.69243391 -5.47559455 +C 1.24369185 5.83589104 -7.61916994 +H 1.38780673 5.08532476 -8.36802317 +H 0.23032024 6.17818782 -7.64764610 +H 1.90308508 6.65755098 -7.80618734 +C 2.46072393 3.36555987 -4.28649918 +H 2.81093231 4.25132556 -3.79898177 +H 2.62197169 2.52066581 -3.65006128 +C 3.22917105 3.16808327 -5.60638252 +H 2.71745824 3.26576104 -6.54099958 +C 4.55128586 2.87101548 -5.58821090 +H 5.06299867 2.77333771 -4.65359384 +P -1.68688011 0.93821529 -4.94361253 +C 5.31973298 2.67353888 -6.90809424 +H 5.50187069 3.62584722 -7.36068089 +H 4.73852105 2.06839074 -7.57208852 +C 6.66254822 1.97641122 -6.62093532 +H 7.23864011 2.57569669 -5.94723283 +H 6.48011089 1.01887673 -6.17963685 +C 7.43879459 1.79489451 -7.93854423 +H 7.60827107 2.75133158 -8.38732686 +H 6.86923187 1.18328757 -8.60670234 +C 8.79086565 1.11708026 -7.64859306 +H 9.33478428 1.00070210 -8.56265469 +H 8.62122899 0.15610604 -7.20967171 +C 9.60424993 1.98984817 -6.67479524 +H 9.31147739 1.77019553 -5.66934163 +H 9.41944065 3.02310864 -6.88244478 +C 11.10499458 1.69162880 -6.84923923 +H 11.41365563 1.97843059 -7.83279049 +H 11.27894526 0.64483722 -6.71187639 +C 11.91113852 2.48722658 -5.80580446 +H 11.72501028 3.53319241 -5.93312987 +H 11.61354107 2.18914178 -4.82219823 +C 13.41348542 2.20643447 -5.99477425 +H 13.59898733 1.15986871 -5.87152995 +H 13.71197645 2.50833327 -6.97694542 +C 14.21924372 2.99740615 -4.94753151 +H 14.03182008 4.04381613 -5.06918080 +H 13.92251458 2.69373112 -3.96537404 +C 15.72181966 2.71939448 -5.13877756 +H 15.90913955 1.67288842 -5.01779686 +H 16.01869462 3.02369321 -6.12069789 +C 16.52751640 3.50960658 -4.09091421 +H 16.33925543 4.55603385 -4.21111315 +H 16.23150563 3.20443884 -3.10900267 +C 18.03020202 3.23295881 -4.28327314 +H 18.21842532 2.18649741 -4.16331260 +H 18.32626477 3.53834869 -5.26509994 +C 18.83587717 4.02290009 -3.23518901 +H 19.87999516 3.83124105 -3.36929500 +H 18.64710066 5.06931441 -3.35469007 +H 18.54032269 3.71699987 -2.25336795 diff --git a/pyscf/tools/benchmarks/molecules/organic/095_Azadirachtin.xyz b/pyscf/tools/benchmarks/molecules/organic/095_Azadirachtin.xyz new file mode 100644 index 0000000000..8c03f7bb0b --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/095_Azadirachtin.xyz @@ -0,0 +1,97 @@ +95 +Azadirachtin +C 0.24028400 -0.96854600 0.05735800 +C 1.49955800 -0.38999400 0.79976500 +C 1.84405900 1.11309900 0.52612700 +C 0.61115200 2.06994900 0.41027500 +C -0.38718900 1.44909800 -0.58288900 +C -0.81198100 0.11367700 0.01403200 +H 1.34464500 -0.48336800 1.89667000 +H 0.90815500 3.09474100 0.10955200 +H 0.07146500 1.40030200 -1.59457300 +H -1.08538000 0.33936800 1.09841400 +O -0.03234300 2.14051500 1.69756400 +H 0.43832200 2.76739400 2.27637900 +O -1.64345600 2.15598600 -0.77527600 +C -2.74935800 1.17918600 -0.75355500 +H -3.33770900 1.41858200 0.14457000 +H -3.31820200 1.39744800 -1.66649800 +C -2.11058900 -0.22990000 -0.71994400 +C 2.72998200 1.32748400 -0.70483200 +H 2.81316800 2.38444500 -0.97758400 +H 3.74960400 0.95856700 -0.53283000 +H 2.35200700 0.78104000 -1.58051000 +C 2.60140000 -1.34386400 0.30659000 +C 0.84678200 -1.40613600 -1.29617000 +H 0.88274800 -0.59319600 -2.03951200 +H 0.38815200 -2.30137400 -1.74034600 +O 2.22547600 -1.78168600 -1.02946800 +C -0.42290800 -2.19363100 0.75277400 +H -0.32012900 -3.08353500 0.10236100 +C -1.91400700 -2.00763500 1.11237500 +H -2.33420900 -2.99527800 1.38379200 +H -1.98093100 -1.38866600 2.03106200 +C -2.81353800 -1.37055100 0.02719800 +H -3.12020000 -2.14713900 -0.69849000 +C -1.82661295 -0.68751599 -2.16270012 +O -1.03585236 -0.24261727 -2.99355789 +O -2.59156054 -1.74766325 -2.52650357 +C -2.29916153 -2.14198817 -3.86960099 +H -2.96290254 -2.92828960 -4.16299137 +H -2.42740743 -1.30452633 -4.52313804 +H -1.28838658 -2.48820275 -3.92764814 +O -4.01986539 -0.90962471 0.64138134 +C -4.89301012 -1.93494775 0.80793745 +O -4.54153100 -3.05110585 0.42818050 +C -6.20834727 -1.48087047 1.46771166 +H -6.70958996 -0.78829922 0.82428269 +H -6.83594045 -2.33131805 1.63434212 +H -5.99341406 -1.00749899 2.40292455 +O 0.29104226 -2.52037085 1.94793763 +C 0.31248536 -3.86361432 2.13937213 +O -0.25336168 -4.56806573 1.30443072 +C 1.07328546 -4.25938123 3.41849362 +C 1.18469713 -5.56341278 3.77014145 +H 0.75137836 -6.32562659 3.15681858 +C 1.70966559 -3.16955354 4.30104443 +H 2.52793619 -2.72004059 3.77829081 +H 0.97813456 -2.42251044 4.52839648 +H 2.06508607 -3.60889199 5.20964665 +C 1.93754031 -5.94957419 5.05688405 +H 1.46239499 -5.49165555 5.89917107 +H 1.92238977 -7.01309886 5.17344190 +H 2.95091533 -5.61227499 4.99207421 +C 3.99823568 -0.71610148 0.14421916 +O 4.54063921 0.18499764 0.78248292 +O 4.69984280 -1.27738694 -0.87269582 +O 2.69271189 -2.53050618 1.09933364 +H 3.60067733 -2.84219679 1.10624230 +C 5.98847134 -0.66885730 -0.99113633 +H 6.49970371 -0.73075570 -0.05320774 +H 6.55618159 -1.17887968 -1.74112449 +H 5.87374685 0.35839671 -1.26770006 +C 2.63486992 1.58151749 1.76176538 +C 2.13434327 2.21842175 3.11643757 +C 3.90461234 2.45387090 1.74128354 +O 2.44467967 0.78466796 2.96396625 +C 3.35337126 2.98709450 3.79243900 +C 0.74513758 2.60743687 3.44136489 +O 5.00327683 3.19196370 1.11718214 +C 4.47769203 2.16352749 3.16877423 +H 3.15573566 3.35599353 1.51547111 +C 3.84794511 4.41584726 3.25643717 +H 3.24116904 2.99889070 4.88162906 +H 0.00697023 1.93995296 2.97068106 +H 0.55491721 2.57388288 4.52449549 +H 0.54134467 3.63458255 3.09753074 +C 4.84981258 4.42246076 1.92099071 +H 4.49637929 1.09030804 3.43212004 +H 5.51163803 2.50195502 3.32489990 +C 4.76579887 5.04464694 4.26535741 +O 2.75093022 5.20578033 2.83652107 +H 4.60685318 5.22136931 1.20459035 +O 6.17282363 4.70855901 2.47193815 +H 4.42807865 5.31783232 5.24674785 +C 6.01838353 5.12565144 3.78006571 +H 2.50011685 5.87405238 3.50751412 +H 6.95619123 5.44887224 4.20308201 diff --git a/pyscf/tools/benchmarks/molecules/organic/113_Taxol.xyz b/pyscf/tools/benchmarks/molecules/organic/113_Taxol.xyz new file mode 100644 index 0000000000..e472fda314 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/organic/113_Taxol.xyz @@ -0,0 +1,115 @@ + 113 + + C -3.78400 3.91800 3.08500 + O -4.61300 4.80300 2.94200 + C 6.71300 1.23300 4.89600 + C -5.60200 2.29400 3.72100 + C -6.05000 1.05200 4.18300 + C -5.13000 0.05200 4.50500 + C -3.76400 0.29300 4.34500 + C -3.32300 1.53700 3.88500 + C -4.23400 2.55300 3.57300 + C 5.67500 0.94800 3.84600 + C 2.37100 0.84900 2.62900 + C 3.10500 -0.12600 3.21600 + C 1.03100 1.22200 3.23900 + C 0.28800 -0.09400 3.59500 + C 1.16700 -1.28400 4.12700 + C 2.60800 -0.78500 4.51100 + C 3.43500 -1.97000 5.13400 + C 2.60600 0.31200 5.64300 + C 2.73200 1.62200 1.37000 + C 1.10300 -2.50000 3.10700 + C 1.79900 -2.32400 1.70000 + C 3.30800 -2.77100 1.51300 + C 3.49500 -4.31700 1.69500 + C 4.37200 -2.13300 2.41400 + O 5.24200 -2.81400 2.93800 + C 4.41900 -0.64300 2.66300 + C 3.72500 -2.34100 0.06800 + C 2.99700 -3.14600 -1.03900 + C 1.46100 -3.21500 -0.83100 + C 0.84800 -2.79300 0.53600 + C 0.29500 -4.23600 0.67300 + O 1.01800 -4.54200 -0.52000 + O -0.29100 -1.91800 0.36400 + O 0.12900 1.93600 2.35400 + C 0.33500 3.25800 2.23100 + O 1.17100 3.88700 2.86000 + C -0.56900 3.95300 1.24000 + O -0.32500 5.36800 1.25200 + C -2.07200 3.65200 1.50300 + C -2.91400 4.25500 0.36500 + N -2.51800 4.22500 2.79400 + C -0.02700 -0.74400 -0.23000 + O 1.05900 -0.43700 -0.69700 + C -1.19800 0.19400 -0.31800 + O 5.14800 -2.36500 -0.15400 + O 5.47500 -0.35700 3.60400 + O 0.49900 -1.68300 5.34200 + O -0.30500 -2.72300 2.83100 + C -1.05000 -3.31600 3.77500 + O -0.56400 -3.88100 4.74200 + C -2.55500 -3.28300 3.61300 + C -3.13100 -2.57300 2.55300 + C -4.51900 -2.53100 2.39800 + C -5.34300 -3.21000 3.30000 + C -4.77400 -3.91900 4.36200 + C -3.38600 -3.95500 4.51800 + C -3.21900 5.62000 0.36700 + C -3.98100 6.17900 -0.66400 + C -4.44900 5.37200 -1.70500 + C -4.15200 4.00700 -1.71000 + C -3.39100 3.45200 -0.67800 + O 5.07500 1.85100 3.28400 + H 7.65600 0.72800 4.63700 + H 6.35900 0.85900 5.86800 + H 6.90100 2.31400 4.97700 + H -6.33500 3.05700 3.47700 + H -7.11300 0.86500 4.29300 + H -5.47500 -0.90600 4.88100 + H -3.04600 -0.48600 4.58000 + H -2.25800 1.69900 3.77900 + H 1.15700 1.83600 4.14200 + H -0.25400 -0.39000 2.68600 + H -0.48800 0.16600 4.33300 + H 3.04900 -2.24700 6.12600 + H 3.41800 -2.89600 4.55900 + H 4.48300 -1.68700 5.29600 + H 3.18300 0.03600 6.53800 + H 3.06600 1.25300 5.30500 + H 1.58900 0.52100 6.00500 + H 3.55600 1.24200 0.76000 + H 1.87100 1.65200 0.68700 + H 2.99500 2.65100 1.65000 + H 1.49200 -3.43200 3.53200 + H 1.78900 -1.25500 1.51200 + H 2.84900 -4.92100 1.05300 + H 4.52100 -4.63300 1.46000 + H 3.30100 -4.62300 2.73100 + H 4.77700 -0.23200 1.71600 + H 3.47200 -1.28000 -0.08100 + H 3.20600 -2.65900 -2.00600 + H 3.40700 -4.16400 -1.10900 + H 0.87600 -2.86500 -1.69900 + H 0.59700 -4.82300 1.55300 + H -0.79000 -4.31300 0.49800 + H -0.29700 3.59300 0.23500 + H -0.50800 5.75400 2.10300 + H -2.21100 2.56000 1.50700 + H -1.85600 3.97900 3.61000 + H -1.75600 0.19900 0.62900 + H -0.85000 1.21600 -0.53100 + H -1.86900 -0.13200 -1.12700 + H 5.52800 -3.23500 -0.12600 + H 0.81500 -2.49000 5.73000 + H -2.50600 -2.04400 1.84200 + H -4.95700 -1.97200 1.57800 + H -6.42200 -3.18500 3.17700 + H -5.41400 -4.44300 5.06600 + H -2.95900 -4.50700 5.34800 + H -2.86800 6.25900 1.17000 + H -4.21000 7.24000 -0.65500 + H -5.04000 5.80500 -2.50600 + H -4.51500 3.37800 -2.51700 + H -3.17400 2.38900 -0.69700 \ No newline at end of file diff --git a/pyscf/tools/benchmarks/molecules/water_clusters/002.xyz b/pyscf/tools/benchmarks/molecules/water_clusters/002.xyz new file mode 100644 index 0000000000..8c50538dee --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/water_clusters/002.xyz @@ -0,0 +1,5 @@ +3 + +O 99.814000000 100.835000000 101.232000000 +H 99.329200000 99.976800000 101.063000000 +H 99.151600000 101.561000000 101.414000000 diff --git a/pyscf/tools/benchmarks/molecules/water_clusters/003.xyz b/pyscf/tools/benchmarks/molecules/water_clusters/003.xyz new file mode 100644 index 0000000000..f0bdd6dd40 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/water_clusters/003.xyz @@ -0,0 +1,17 @@ +15 + +O 99.814000000 100.835000000 101.232000000 +H 99.329200000 99.976800000 101.063000000 +H 99.151600000 101.561000000 101.414000000 +O 98.804000000 98.512200000 97.758100000 +H 99.782100000 98.646900000 97.916700000 +H 98.421800000 99.326500000 97.321300000 +O 98.070300000 98.516900000 100.438000000 +H 97.172800000 98.878600000 100.690000000 +H 98.194000000 98.592200000 99.448100000 +O 102.360000000 101.551000000 99.964500000 +H 102.675000000 102.370000000 100.444000000 +H 101.556000000 101.180000000 100.430000000 +O 101.665000000 98.316100000 98.319400000 +H 101.904000000 99.233800000 98.002000000 +H 102.224000000 97.640900000 97.837700000 diff --git a/pyscf/tools/benchmarks/molecules/water_clusters/004.xyz b/pyscf/tools/benchmarks/molecules/water_clusters/004.xyz new file mode 100644 index 0000000000..8a06164f31 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/water_clusters/004.xyz @@ -0,0 +1,32 @@ +30 + +O 97.873900000 103.017000000 100.816000000 +H 98.128600000 103.038000000 99.848800000 +H 97.173800000 102.317000000 100.960000000 +O 99.814000000 100.835000000 101.232000000 +H 99.329200000 99.976800000 101.063000000 +H 99.151600000 101.561000000 101.414000000 +O 98.804000000 98.512200000 97.758100000 +H 99.782100000 98.646900000 97.916700000 +H 98.421800000 99.326500000 97.321300000 +O 100.747000000 100.164000000 103.736000000 +H 100.658000000 100.628000000 102.855000000 +H 100.105000000 99.398600000 103.776000000 +O 98.070300000 98.516900000 100.438000000 +H 97.172800000 98.878600000 100.690000000 +H 98.194000000 98.592200000 99.448100000 +O 98.548000000 101.265000000 97.248600000 +H 98.688900000 102.140000000 97.711000000 +H 97.919900000 101.391000000 96.480800000 +O 102.891000000 100.842000000 97.477600000 +H 103.837000000 100.662000000 97.209700000 +H 102.868000000 101.166000000 98.423400000 +O 102.360000000 101.551000000 99.964500000 +H 102.675000000 102.370000000 100.444000000 +H 101.556000000 101.180000000 100.430000000 +O 101.836000000 97.446700000 102.110000000 +H 100.860000000 97.397400000 101.898000000 +H 101.991000000 97.133400000 103.047000000 +O 101.665000000 98.316100000 98.319400000 +H 101.904000000 99.233800000 98.002000000 +H 102.224000000 97.640900000 97.837700000 diff --git a/pyscf/tools/benchmarks/molecules/water_clusters/005.xyz b/pyscf/tools/benchmarks/molecules/water_clusters/005.xyz new file mode 100644 index 0000000000..976e8f7458 --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/water_clusters/005.xyz @@ -0,0 +1,62 @@ +60 + +O 97.873900000 103.017000000 100.816000000 +H 98.128600000 103.038000000 99.848800000 +H 97.173800000 102.317000000 100.960000000 +O 100.645000000 100.169000000 95.891500000 +H 101.491000000 100.305000000 96.406200000 +H 99.888700000 100.618000000 96.367800000 +O 99.814000000 100.835000000 101.232000000 +H 99.329200000 99.976800000 101.063000000 +H 99.151600000 101.561000000 101.414000000 +O 98.804000000 98.512200000 97.758100000 +H 99.782100000 98.646900000 97.916700000 +H 98.421800000 99.326500000 97.321300000 +O 100.747000000 100.164000000 103.736000000 +H 100.658000000 100.628000000 102.855000000 +H 100.105000000 99.398600000 103.776000000 +O 98.070300000 98.516900000 100.438000000 +H 97.172800000 98.878600000 100.690000000 +H 98.194000000 98.592200000 99.448100000 +O 98.548000000 101.265000000 97.248600000 +H 98.688900000 102.140000000 97.711000000 +H 97.919900000 101.391000000 96.480800000 +O 103.898000000 98.427900000 99.984500000 +H 103.015000000 98.654900000 99.573700000 +H 104.128000000 97.477300000 99.776100000 +O 99.166600000 96.442100000 101.723000000 +H 98.843200000 97.206600000 101.166000000 +H 99.643900000 95.783700000 101.141000000 +O 102.891000000 100.842000000 97.477600000 +H 103.837000000 100.662000000 97.209700000 +H 102.868000000 101.166000000 98.423400000 +O 96.227200000 100.990000000 101.698000000 +H 96.148800000 100.422000000 102.517000000 +H 95.313600000 101.237000000 101.375000000 +O 98.864800000 98.222500000 103.917000000 +H 98.949800000 97.463000000 103.272000000 +H 99.054800000 97.896400000 104.843000000 +O 104.578000000 100.035000000 101.952000000 +H 104.419000000 101.011000000 101.802000000 +H 104.206000000 99.514900000 101.184000000 +O 102.429000000 104.060000000 101.348000000 +H 101.757000000 103.665000000 101.974000000 +H 102.209000000 105.021000000 101.185000000 +O 98.708200000 103.752000000 98.244300000 +H 98.397100000 104.234000000 97.425400000 +H 99.598500000 104.111000000 98.524400000 +O 95.630300000 99.996600000 98.245400000 +H 96.540400000 100.410000000 98.268900000 +H 94.982900000 100.638000000 97.834500000 +O 102.360000000 101.551000000 99.964500000 +H 102.675000000 102.370000000 100.444000000 +H 101.556000000 101.180000000 100.430000000 +O 101.836000000 97.446700000 102.110000000 +H 100.860000000 97.397400000 101.898000000 +H 101.991000000 97.133400000 103.047000000 +O 101.665000000 98.316100000 98.319400000 +H 101.904000000 99.233800000 98.002000000 +H 102.224000000 97.640900000 97.837700000 +O 99.984700000 103.272000000 102.307000000 +H 99.640700000 103.104000000 103.231000000 +H 99.216500000 103.453000000 101.693000000 diff --git a/pyscf/tools/benchmarks/molecules/water_clusters/006.xyz b/pyscf/tools/benchmarks/molecules/water_clusters/006.xyz new file mode 100644 index 0000000000..ed702f3dda --- /dev/null +++ b/pyscf/tools/benchmarks/molecules/water_clusters/006.xyz @@ -0,0 +1,98 @@ +96 + +O 97.873900000 103.017000000 100.816000000 +H 98.128600000 103.038000000 99.848800000 +H 97.173800000 102.317000000 100.960000000 +O 101.099000000 104.850000000 99.030700000 +H 101.483000000 104.260000000 99.740500000 +H 101.829000000 105.396000000 98.619700000 +O 100.645000000 100.169000000 95.891500000 +H 101.491000000 100.305000000 96.406200000 +H 99.888700000 100.618000000 96.367800000 +O 99.814000000 100.835000000 101.232000000 +H 99.329200000 99.976800000 101.063000000 +H 99.151600000 101.561000000 101.414000000 +O 98.804000000 98.512200000 97.758100000 +H 99.782100000 98.646900000 97.916700000 +H 98.421800000 99.326500000 97.321300000 +O 100.747000000 100.164000000 103.736000000 +H 100.658000000 100.628000000 102.855000000 +H 100.105000000 99.398600000 103.776000000 +O 98.070300000 98.516900000 100.438000000 +H 97.172800000 98.878600000 100.690000000 +H 98.194000000 98.592200000 99.448100000 +O 96.373500000 99.168100000 103.663000000 +H 96.032600000 99.385200000 104.578000000 +H 97.337900000 98.909800000 103.720000000 +O 96.740700000 101.641000000 95.246600000 +H 95.765200000 101.625000000 95.027600000 +H 97.256100000 101.957000000 94.450300000 +O 103.969000000 95.809900000 100.611000000 +H 104.656000000 95.771500000 101.336000000 +H 103.152000000 96.276300000 100.950000000 +O 98.548000000 101.265000000 97.248600000 +H 98.688900000 102.140000000 97.711000000 +H 97.919900000 101.391000000 96.480800000 +O 104.764000000 102.907000000 101.929000000 +H 104.157000000 103.650000000 101.648000000 +H 105.597000000 103.289000000 102.328000000 +O 103.898000000 98.427900000 99.984500000 +H 103.015000000 98.654900000 99.573700000 +H 104.128000000 97.477300000 99.776100000 +O 99.166600000 96.442100000 101.723000000 +H 98.843200000 97.206600000 101.166000000 +H 99.643900000 95.783700000 101.141000000 +O 102.891000000 100.842000000 97.477600000 +H 103.837000000 100.662000000 97.209700000 +H 102.868000000 101.166000000 98.423400000 +O 96.227200000 100.990000000 101.698000000 +H 96.148800000 100.422000000 102.517000000 +H 95.313600000 101.237000000 101.375000000 +O 95.278100000 97.169000000 98.965800000 +H 95.144800000 97.377000000 99.934800000 +H 95.587900000 97.991100000 98.488100000 +O 98.864800000 98.222500000 103.917000000 +H 98.949800000 97.463000000 103.272000000 +H 99.054800000 97.896400000 104.843000000 +O 104.578000000 100.035000000 101.952000000 +H 104.419000000 101.011000000 101.802000000 +H 104.206000000 99.514900000 101.184000000 +O 102.429000000 104.060000000 101.348000000 +H 101.757000000 103.665000000 101.974000000 +H 102.209000000 105.021000000 101.185000000 +O 95.118700000 97.700600000 101.797000000 +H 94.171300000 97.423600000 101.957000000 +H 95.377300000 98.403200000 102.460000000 +O 98.708200000 103.752000000 98.244300000 +H 98.397100000 104.234000000 97.425400000 +H 99.598500000 104.111000000 98.524400000 +O 103.454000000 97.589900000 96.421800000 +H 103.885000000 98.135100000 95.702500000 +H 104.142000000 97.009800000 96.857500000 +O 95.630300000 99.996600000 98.245400000 +H 96.540400000 100.410000000 98.268900000 +H 94.982900000 100.638000000 97.834500000 +O 99.505700000 94.600000000 99.762000000 +H 98.915000000 94.230400000 99.044800000 +H 100.455000000 94.596700000 99.446700000 +O 102.360000000 101.551000000 99.964500000 +H 102.675000000 102.370000000 100.444000000 +H 101.556000000 101.180000000 100.430000000 +O 99.128800000 95.980100000 96.602100000 +H 99.037300000 96.941600000 96.861200000 +H 100.097000000 95.729200000 96.588100000 +O 103.544000000 99.038500000 104.412000000 +H 104.182000000 99.184200000 103.655000000 +H 102.605000000 99.102500000 104.073000000 +O 103.133000000 101.981000000 104.535000000 +H 103.581000000 102.216000000 103.673000000 +H 102.678000000 101.095000000 104.444000000 +O 101.836000000 97.446700000 102.110000000 +H 100.860000000 97.397400000 101.898000000 +H 101.991000000 97.133400000 103.047000000 +O 101.665000000 98.316100000 98.319400000 +H 101.904000000 99.233800000 98.002000000 +H 102.224000000 97.640900000 97.837700000 +O 99.984700000 103.272000000 102.307000000 +H 99.640700000 103.104000000 103.231000000 +H 99.216500000 103.453000000 101.693000000 diff --git a/pyscf/tools/benchmarks/utils.py b/pyscf/tools/benchmarks/utils.py new file mode 100644 index 0000000000..504c1c3d52 --- /dev/null +++ b/pyscf/tools/benchmarks/utils.py @@ -0,0 +1,229 @@ +# Copyright 2025 The PySCF Developers. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +import sys +import time +import json +import functools +import traceback +import io +import contextlib +from pathlib import Path +import numpy as np +from pyscf import lib + +molecules_dir = os.path.abspath(f'{__file__}/../molecules') + +def _numpy_blas_info(): + if hasattr(np.__config__, 'CONFIG'): # 2.0 + np_blas = np.__config__.CONFIG['Build Dependencies']['blas']['name'] + else: + buf = io.StringIO() + with contextlib.redirect_stdout(buf): + np.show_config() + lines = buf.getvalue().splitlines() + for i, line in enumerate(lines): + if line.startswith('blas'): + break + else: + return None + + for line in lines[i+1:]: + if not line.startswith(' '): + return None + keys = line.split(' = ') + if keys[0].strip() == 'libraries': + np_blas = keys[1] + break + return np_blas + +def get_sys_info(): + '''Collect OS, libraries, and runtime environment information''' + sys_info = lib.format_sys_info() + np_blas = _numpy_blas_info() + if np_blas: + sys_info.append(f'BLAS for NumPy: {np_blas}') + + try: + import lief + libdir = os.path.abspath(f'{lib.__file__}/..') + # Shared libraries that PySCF links to + if sys.platform == "darwin": + binary = lief.parse(f'{libdir}/libnp_helper.dylib') + else: + binary = lief.parse(f'{libdir}/libnp_helper.so') + pyscf_blas = [so for so in binary.libraries if 'mkl' in so or 'blas' in so] + sys_info.append(f'BLAS for PySCF: {", ".join(pyscf_blas)}') + except ImportError: + pass + + try: + import cpuinfo + info = cpuinfo.get_cpu_info() + sys_info.append('Brand: {0}'.format(info.get('brand_raw', ''))) + sys_info.append('Hz: {0}'.format(info.get('hz_actual_friendly', ''))) + sys_info.append('Arch: {0}'.format(info.get('arch', ''))) + sys_info.append('Count: {0}'.format(info.get('count', ''))) + sys_info.append('L1 Data Cache Size: {0}'.format(info.get('l1_data_cache_size', ''))) + sys_info.append('L1 Instruction Cache Size: {0}'.format(info.get('l1_instruction_cache_size', ''))) + sys_info.append('L2 Cache Size: {0}'.format(info.get('l2_cache_size', ''))) + sys_info.append('L2 Cache Line Size: {0}'.format(info.get('l2_cache_line_size', ''))) + sys_info.append('L2 Cache Associativity: {0}'.format(info.get('l2_cache_associativity', ''))) + sys_info.append('L3 Cache Size: {0}'.format(info.get('l3_cache_size', ''))) + except ImportError: + pass + + # TODO: Add memory info + + sys_info = '\n'.join(sys_info) + return sys_info + +_tasks = {} + +def benchmark(func_or_label, label=None, tags=None): + ''' + Register a benchmark test. + + Args: + label (str): Unique name for the test. Defaults to module.function_name + tags (list[str]): To filter benchmark tests from the command line. + + This function can be used as a decorator: + + @benchmark('test I') + def test_fn(): + return result + + Or called directly to register functions: + + for basis in config['basis']: + def f(): + mf = pyscf.M(..., basis=basis).RHF().run() + return mf.e_tot + benchmark(f, label=f'RHF-{basis}') + + If the function for benchmark returns a value, the result will be JSON + serialized and stored in the output file, if applicable. Therefore, it is + recommended to return JSON-serializable objects from the function. If the + function raises errors, the error status will be saved as the result of the + function. + ''' + if callable(func_or_label): + if label is None: + mod = func_or_label.__module__ + if mod == '__main__': + mod = os.path.basename(get_caller_filename())[:-3] + fname = func_or_label.__name__ + label = f'{mod}.{fname}' + if label in _tasks: + raise RuntimeError(f'task {label} is already registered') + _tasks[label] = (func_or_label, tags) + return func_or_label + + elif isinstance(func_or_label, str): + return functools.partial(benchmark, label=func_or_label) + +def exec_tasks(tasks): + results = {} + for name, (f, tags) in tasks.items(): + print(f'Processing {name}') + t0 = time.perf_counter() + try: + # save the output as a dict + out = f() + except Exception as e: + print(e) + traceback.print_stack() + out = str(e) + finally: + t1 = time.perf_counter() + print(f'{name}: {t1-t0:.3f}s') + + try: + json.dumps(out) + except Exception: + out = None + results[name] = { + 'result': out, + 'time': t1 - t0, + 'tags': tags, + } + return results + +def get_caller_filename(): + import __main__ + return os.path.abspath(__main__.__file__) + +def cli_parser(): + import argparse + parser = argparse.ArgumentParser( + description="Run benchmark and write timing data in JSON document" + ) + parser.add_argument( + '--save-json', + type=str, + default=None, + help=('Filename to save results in JSON format. ' + 'By default, the module name is used as the filename for the output.') + ) + parser.add_argument( + '--print-summary', + action='store_true', + ) + # TODO: task filter + return parser + +def run(tasks=None, output_file=None, print_summary=False): + if print_summary: + # Ensure pandas library is installed + import pandas as pd + + if output_file is None: + fname = os.path.basename(get_caller_filename()) + output_file = Path(fname).with_suffix('.json') + else: + os.makedirs(os.path.dirname(output_file), exist_ok=True) + + if tasks is None: + tasks = _tasks + if not tasks: + print('Empty benchmark tasks.') + sys.exit(1) + print(f'Collected {len(tasks)} benchmark tests.') + + results = exec_tasks(tasks) + + if print_summary: + print() + print(get_sys_info()) + print() + output = {} + for name, val in results.items(): + if isinstance(val['result'], dict): + output[name] = {'time': val['time'], **val['result']} + else: + output[name] = {'time': val['time'], 'result': val['results']} + df = pd.DataFrame.from_dict(output, orient='index') + df['time'] = df['time'].apply(lambda x: f"{x:.2f} s") + + pd.set_option('display.max_rows', None) # Print all rows + print(df) + pd.reset_option('display.max_rows') + + with open(output_file, 'w') as f: + json.dump({ + 'metadata': get_sys_info(), + 'timing': results + }, f) diff --git a/pytest.ini b/pytest.ini index b4ab584dd6..7cda8d4e5e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -8,4 +8,4 @@ addopts = --import-mode=importlib --ignore-glob="*test_bz*" --ignore-glob="*pbc/cc/test/*test_h_*.py" --ignore-glob="*test_ks_noimport*.py" - + --ignore=pyscf/tools/benchmarks