-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
pythonPackages.pyscf: init at 1.7.1 #78872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1703025
pythonPackages.pyscf: init at 1.7.0
drewrisinger 29126f8
pyscf: tests running
drewrisinger a706275
pyscf: cleanup unused code
drewrisinger 3bc5a81
pyscf: break check into multiple hooks
drewrisinger b781a5c
xcfun: init TODO
drewrisinger 7863033
xcfun: init at 1.0.0
drewrisinger 144cbbd
xcfun: build library as .so vs .a
drewrisinger a3a400c
python.xcfun: remove
drewrisinger 9d71cdb
WIP: fix xcfun/pyscf
drewrisinger 3d26d60
pythonPackages.pyscf: 1.6.6 -> 1.7.1
drewrisinger 7952bb5
libcint: add pythonPackages.pyscf build flags
drewrisinger 3ff39bf
pythonPackages.pyscf: make most tests work. few errors remain
drewrisinger a5e4fc6
pythonPackages.pyscf: cleanup with code review suggestions
drewrisinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| { stdenv | ||
| , fetchFromGitHub | ||
| , cmake | ||
| , gfortran | ||
| , perl | ||
| , bzip2 | ||
| }: | ||
|
|
||
| stdenv.mkDerivation rec { | ||
| pname = "xcfun"; | ||
| version = "1.0.X"; | ||
|
|
||
| src = fetchFromGitHub { | ||
| owner = "dftlibs"; | ||
| repo = pname; | ||
| rev = "355f42497a9cd17d16ae91da1f1aaaf93756ae8b"; # rev recommended by pythonPackages.pyscf: https://sunqm.github.io/pyscf/install.html#installation-without-network | ||
| sha256 = "09hs8lxks2d98a5q2xky9dz5sfsrxaww3kyryksi9b6l1f1m3hxp"; | ||
| }; | ||
|
|
||
| nativeBuildInputs = [ | ||
| cmake | ||
| ]; | ||
|
|
||
| buildInputs = [ | ||
| bzip2 | ||
| gfortran | ||
| perl | ||
| ]; | ||
|
|
||
| cmakeFlags = [ | ||
| "-DBUILD_TESTING=1" | ||
| "-DBUILD_SHARED_LIBS=1" | ||
| "-DXC_MAX_ORDER=3" | ||
| ]; | ||
|
|
||
| # TODO: tests are very quick. check it actually does something. | ||
| doCheck = true; | ||
| checkPhase = '' | ||
| # set path for finding libxc.so for tests | ||
| export LD_LIBRARY_PATH=/build/source/build | ||
| ctest --progress | ||
| ''; | ||
|
|
||
| meta = with stdenv.lib; { | ||
| description = "Exchange-correlation functionals with arbitrary order derivatives"; | ||
| homepage = "https://xcfun.readthedocs.io/en/latest/"; | ||
| downloadPage = "https://github.com/dftlibs/xcfun/releases"; | ||
| license = licenses.mpl20; | ||
| maintainers = with maintainers; [ drewrisinger ]; | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,164 @@ | ||||||||||||||
| { lib | ||||||||||||||
| , buildPythonPackage | ||||||||||||||
| , isPy27 | ||||||||||||||
| , fetchFromGitHub | ||||||||||||||
| # C/build dependencies | ||||||||||||||
| , cmake | ||||||||||||||
| , openblas | ||||||||||||||
| , libcint | ||||||||||||||
| , libxc | ||||||||||||||
| , xcfun | ||||||||||||||
| # Python dependencies | ||||||||||||||
| , h5py | ||||||||||||||
| , numpy | ||||||||||||||
| , scipy | ||||||||||||||
| # Check Inputs | ||||||||||||||
| , nose | ||||||||||||||
| , nose-exclude | ||||||||||||||
| }: | ||||||||||||||
|
|
||||||||||||||
| buildPythonPackage rec { | ||||||||||||||
| pname = "pyscf"; | ||||||||||||||
| version = "1.7.1"; | ||||||||||||||
|
|
||||||||||||||
| # must download from GitHub to get the Cmake & C source files | ||||||||||||||
| src = fetchFromGitHub { | ||||||||||||||
| owner = "pyscf"; | ||||||||||||||
| repo = pname; | ||||||||||||||
| rev = "v${version}"; | ||||||||||||||
| sha256 = "0fciw9id8fr9396sz52ap5gys0i9hmrmrwm0i1k1k7aciqab3kls"; | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| disabled = isPy27; | ||||||||||||||
|
|
||||||||||||||
| nativeBuildInputs = [ cmake ]; | ||||||||||||||
|
|
||||||||||||||
| buildInputs = [ | ||||||||||||||
| libcint | ||||||||||||||
| libxc | ||||||||||||||
| openblas | ||||||||||||||
| xcfun | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| postPatch = '' | ||||||||||||||
| mkdir -p ./pyscf/lib/deps/include ./pyscf/lib/deps/lib | ||||||||||||||
| ln -s ${lib.getDev xcfun}/include/xc.h ./pyscf/lib/deps/include/xcfun.h | ||||||||||||||
| ln -s ${lib.getLib xcfun}/lib/libxc.so ./pyscf/lib/deps/lib/libxcfun.so | ||||||||||||||
| substituteInPlace pyscf/rt/__init__.py --replace "from tdscf import *" "from pyscf.tdscf import *" | ||||||||||||||
| ''; | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| cmakeFlags = [ | ||||||||||||||
| # disable rebuilding/downloading the required libraries | ||||||||||||||
| "-DBUILD_LIBCINT=0" | ||||||||||||||
| "-DBUILD_LIBXC=0" | ||||||||||||||
| "-DBUILD_XCFUN=0" | ||||||||||||||
| "-DENABLE_XCFUN=1" | ||||||||||||||
| ]; | ||||||||||||||
| # Configure CMake to build C files in pyscf/lib. Python build expects files in ./pyscf/lib/build | ||||||||||||||
| preConfigure = '' | ||||||||||||||
| pushd pyscf/lib | ||||||||||||||
| ''; | ||||||||||||||
drewrisinger marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||
| postConfigure = '' | ||||||||||||||
| popd | ||||||||||||||
| ''; | ||||||||||||||
|
|
||||||||||||||
| # Build C dependencies, then build python package. | ||||||||||||||
| preBuild = '' | ||||||||||||||
| pushd pyscf/lib/build | ||||||||||||||
| make | ||||||||||||||
| popd | ||||||||||||||
| ''; | ||||||||||||||
|
Comment on lines
+67
to
+71
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should work as well
Suggested change
|
||||||||||||||
|
|
||||||||||||||
| propagatedBuildInputs = [ | ||||||||||||||
| h5py | ||||||||||||||
| numpy | ||||||||||||||
| scipy | ||||||||||||||
| ]; | ||||||||||||||
|
|
||||||||||||||
| # add libcint, libxc, xcfun headers to include path. | ||||||||||||||
| PYSCF_INC_DIR = lib.makeSearchPath "include" (map lib.getDev [ | ||||||||||||||
| libcint | ||||||||||||||
| libxc | ||||||||||||||
| xcfun | ||||||||||||||
| ]); | ||||||||||||||
|
|
||||||||||||||
| pythonImportsCheck = [ "pyscf" ]; | ||||||||||||||
|
|
||||||||||||||
| checkInputs = [ nose nose-exclude ]; | ||||||||||||||
| # from source/.travis.yml, mostly | ||||||||||||||
| # Tests take about 30 mins to run | ||||||||||||||
| preCheck = '' | ||||||||||||||
| # HACK: Move compiled libraries to test dir so pyscf import mechanism can find them | ||||||||||||||
| cp ./dist/tmpbuild/pyscf/pyscf/lib/*.so ./pyscf/lib/ | ||||||||||||||
|
Comment on lines
+92
to
+93
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this might not be needed anymore, the |
||||||||||||||
|
|
||||||||||||||
| # Set config used by tests to ensure reproducibility | ||||||||||||||
| echo 'pbc_tools_pbc_fft_engine = "NUMPY"' > pyscf/pyscf_config.py | ||||||||||||||
| export OMP_NUM_THREADS=1 | ||||||||||||||
| export PYSCF_CONFIG_FILE=$(pwd)/pyscf/pyscf_config.py | ||||||||||||||
| ''; | ||||||||||||||
| checkPhase = '' | ||||||||||||||
| runHook preCheck | ||||||||||||||
|
|
||||||||||||||
| nosetests -v \ | ||||||||||||||
| --where=pyscf \ | ||||||||||||||
| --detailed-errors \ | ||||||||||||||
| --exclude-dir=geomopt \ | ||||||||||||||
| --exclude-dir=dmrgscf \ | ||||||||||||||
| --exclude-dir=fciqmcscf \ | ||||||||||||||
| --exclude-dir=icmpspt \ | ||||||||||||||
| --exclude-dir=shciscf \ | ||||||||||||||
| --exclude-dir=nao \ | ||||||||||||||
| --exclude-dir=cornell_shci \ | ||||||||||||||
| --exclude-dir=xianci \ | ||||||||||||||
| --exclude=test_bz \ | ||||||||||||||
| --exclude=h2o_vdz \ | ||||||||||||||
| --exclude=test_mc2step_4o4e \ | ||||||||||||||
| --exclude=test_ks_noimport \ | ||||||||||||||
| --exclude=test_jk_single_kpt \ | ||||||||||||||
| --exclude=test_jk_hermi0 \ | ||||||||||||||
| --exclude=test_j_kpts \ | ||||||||||||||
| --exclude=test_k_kpts \ | ||||||||||||||
| --exclude=high_cost \ | ||||||||||||||
| --exclude=skip \ | ||||||||||||||
| --exclude=call_in_background \ | ||||||||||||||
| --exclude=libxc_cam_beta_bug \ | ||||||||||||||
| --ignore-files=test_kuccsd_supercell_vs_kpts\.py \ | ||||||||||||||
| --ignore-files=test_kccsd_ghf\.py \ | ||||||||||||||
| --ignore-files=test_h_.*\.py \ | ||||||||||||||
| --ignore-files=test_P_uadc_ip\.py \ | ||||||||||||||
| --ignore-files=test_P_uadc_ea\.py \ | ||||||||||||||
| --exclude-test=pbc/tdscf/test/test_kproxy_hf.DiamondTestSupercell3 \ | ||||||||||||||
| --exclude-test=pbc/tdscf/test/test_kproxy_ks.DiamondTestSupercell3 \ | ||||||||||||||
| --exclude-test=pbc/tdscf/test/test_kproxy_supercell_hf.DiamondTestSupercell3 \ | ||||||||||||||
| --exclude-test=pbc/tdscf/test/test_kproxy_supercell_ks.DiamondTestSupercell3 \ | ||||||||||||||
| --ignore-files=.*_slow.*\.py \ | ||||||||||||||
| --ignore-files=.*_kproxy_.*\.py \ | ||||||||||||||
| --ignore-files=test_proxy\.py \ | ||||||||||||||
| --ignore-files=test_krhf_slow_gamma\.py \ | ||||||||||||||
| --ignore-files=test_krhf_slow\.py \ | ||||||||||||||
| --ignore-files=test_krhf_slow_supercell\.py \ | ||||||||||||||
| --ignore-files=test_ddcosmo_grad\.py \ | ||||||||||||||
| --exclude=test_range_separated \ | ||||||||||||||
| --ignore-files=test_ksproxy_ks\.py \ | ||||||||||||||
| --ignore-files=test_kproxy_hf\.py \ | ||||||||||||||
| --ignore-files=test_kgw_slow\.py | ||||||||||||||
|
|
||||||||||||||
| # NOTE: disables below test_proxy.py are manually added to get it to pass in Nix, and are NOT in the upstream Travis config | ||||||||||||||
|
|
||||||||||||||
| runHook postCheck | ||||||||||||||
| ''; | ||||||||||||||
|
|
||||||||||||||
| meta = with lib; { | ||||||||||||||
| description = "Python-based Simulations of Chemistry Framework"; | ||||||||||||||
| longDescription = '' | ||||||||||||||
| PySCF is an open-source collection of electronic structure modules powered by Python. | ||||||||||||||
| The package aims to provide a simple, lightweight, and efficient platform | ||||||||||||||
| for quantum chemistry calculations and methodology development. | ||||||||||||||
| ''; | ||||||||||||||
| homepage = "http://www.pyscf.org/"; | ||||||||||||||
| downloadPage = "https://github.com/pyscf/pyscf/releases"; | ||||||||||||||
| license = licenses.asl20; | ||||||||||||||
| maintainers = with maintainers; [ drewrisinger ]; | ||||||||||||||
| }; | ||||||||||||||
| } | ||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.