Skip to content

Commit

Permalink
Release 0.1.5 (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
fishjojo authored Jun 22, 2024
1 parent b2180a5 commit 6ad7181
Show file tree
Hide file tree
Showing 107 changed files with 2,002 additions and 803 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/build_pyscf_linux.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .github/workflows/build_pyscf_macos.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
environment: ci
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: install pyscf
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/install_pyscf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
python -m pip install --upgrade pip
python -m pip cache purge
pip install wheel
pip install pytest
pip install pytest-cov
pip install numpy
pip install 'scipy<1.12'
pip install h5py
pip install jaxlib
pip install jax
pip install pytest
pip install pytest-cov

pip install 'pyscf==2.3'
pip install 'pyscfadlib==0.1.4'
pip install 'pyscf>=2.3,<2.7'
pip install 'pyscfadlib>=0.1.4'
36 changes: 36 additions & 0 deletions .github/workflows/publish_pyscfad.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish pyscfad

on:
release:
types:
- released
workflow_dispatch:

jobs:
publish_pypi_any:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ["3.11"]

environment: release
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Build wheels
run: |
python3 -m pip install --upgrade build
python3 -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
name: Build
name: Publish pyscfadlib

on:
release:
types: [published]
types:
- released
workflow_dispatch:

jobs:
build_wheels_x86:
publish_pypi_linux_macos_x86:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12]

environment: release
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

Expand All @@ -22,21 +28,23 @@ jobs:
CMAKE_CONFIGURE_ARGS: "-DWITH_F12=OFF"
with:
package-dir: pyscfadlib
output-dir: pyscfadlib/wheelhouse
output-dir: dist
config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: pyscfadlib/wheelhouse/*.whl
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

build_wheels_arm64:
publish_pypi_macos_arm64:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-14]

environment: release
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

Expand All @@ -47,11 +55,8 @@ jobs:
CMAKE_OSX_ARCHITECTURES: arm64
with:
package-dir: pyscfadlib
output-dir: pyscfadlib/wheelhouse
output-dir: dist
config-file: "{package}/pyproject.toml"

- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: pyscfadlib/wheelhouse/*.whl

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
24 changes: 24 additions & 0 deletions .github/workflows/release_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: github release

on: [workflow_dispatch]

jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Release Info
run: ./.github/workflows/release_info.sh
id: release_info
- name: Create Release
if: ${{ steps.release_info.outputs.version_tag }}
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.release_info.outputs.version_tag }}
release_name: pyscfad release ${{ steps.release_info.outputs.version_tag }}
body_path: RELEASE.md
prerelease: true
# draft: true
28 changes: 28 additions & 0 deletions .github/workflows/release_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -e

# Get latest version tag
get_last_tag() {
curl --silent "https://api.github.com/repos/fishjojo/pyscfad/releases/latest" | sed -n 's/.*"tag_name": "v\(.*\)",.*/\1/p'
}
last_version=$(get_last_tag)
echo Last version: $last_version

# Get current version tag
cur_version=$(sed -n "/^__version__ =/s/.*\"\(.*\)\"/\1/p" pyscfad/version.py)
if [ -z "$cur_version" ]; then
cur_version=$(sed -n "/^__version__ =/s/.*'\(.*\)'/\1/p" pyscfad/version.py)
fi
echo Current version: $cur_version

# Create version tag
if [ -n "$last_version" ] && [ -n "$cur_version" ] && [ "$cur_version" != "$last_version" ]; then
git config user.name "Github Actions"
git config user.email "[email protected]"
version_tag=v"$cur_version"

# Extract release info from CHANGELOG
sed -n "/^## pyscfad $cur_version/,/^## pyscfad $last_version/p" CHANGELOG.md | tail -n +2 | sed -e '/^## pyscfad /,$d' | head -n -1 > RELEASE.md
echo "::set-output name=version_tag::$version_tag"
fi
6 changes: 1 addition & 5 deletions .github/workflows/run_test.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/usr/bin/env bash
export OMP_NUM_THREADS=1
export PYTHONPATH=$(pwd):$(pwd)/pyscf:$PYTHONPATH
echo "pyscfad = True" >> $HOME/.pyscf_conf.py
#echo "pyscf_numpy_backend = 'jax'" >> $HOME/.pyscf_conf.py
#echo "pyscf_scipy_linalg_backend = 'pyscfad'" >> $HOME/.pyscf_conf.py
#echo "pyscf_scipy_backend = 'jax'" >> $HOME/.pyscf_conf.py
export PYTHONPATH=$(pwd):$PYTHONPATH

pytest ./pyscfad --cov-report xml --cov=. --verbosity=1 --durations=10
4 changes: 3 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
[MASTER]

# Files or directories to be skipped. They should be base names, not paths.
ignore=test
ignore=test,
backend,
ml,

# Files or directories matching the regex patterns are skipped. The regex
# matches against base names, not paths.
Expand Down
61 changes: 61 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Change log

## pyscfad 0.1.5
* Changes
* pyscfad is now compatable with pyscf 2.6.
* Add `backend` module (experimental).
* Add GCCSD(T).
* Add interface to Jabobi sweep for Pipek-Mezey localization.

* Bug fixes
* Fix LRC hybrid density functionals.

## pyscfad 0.1.4 (Mar 5, 2024)
* Changes
* pyscfad is now compatable with pyscf 2.3.
* Drop support for python 3.7.
* Drop dependence on jaxopt.
* Update JAX custom pytree node auxiliary data for safe comparison.
* Add `pyscfadlib`, fast C codes for custom VJPs.
* Add dynamic configuration.
* Allow `implicit_diff` to use preconditioners.
* Improve `scipy.linalg.eigh`.
* Add `scipy.linalg.svd`.
* Improve `lib.unpack_tril`, `lib.pack_tril`.
* Refactor `gto.moleintor`.
* Add fast VJP for molecular integrals.
* Improve `gto.eval_gto` performance.
* Add `gto.eval_gto` gradient w.r.t. `Mole.ctr_coeff` and `Mole.exp`.
* Avoid `df.DF` to create temperary files.
* Optimize `df.df_jk`.
* Add `scf.cphf`.
* Add `ao2mo._ao2mo`.
* Add `lo.iao`, `lo.boys`, `lo.pipek`, `lo.orth`.
* Add `geomopt`.
* Add `mp.dfmp2`, MP2 one-RDM.
* Consider permutation symmetry for CCSD.
* Disable `jit` for CCSD which causes memory leak.
* Simplify implementation of `cc.ccsd_t_slow`.
* Add optimized `cc.ccsd_t`.
* Add iterative CCSD(T) solver.
* Add `cc.dfccsd`, `cc.dcsd`.
* Add `tools.timer`.

* Bug fixes
* Fix integral derivatives w.r.t. `Mole.ctr_coeff` and `Mole.exp`.

## pyscfad 0.1.3 (Sep 13, 2023)
* Bug fixes
* Fix installation issues.

## pyscfad 0.1.2 (Mar 13, 2023)
* Changes
* Add AD support for ROHF.

## pyscfad 0.1.1 (Jan 25, 2023)
* Changes
* pyscfad is now compatable with pyscf 2.1.

## pyscfad 0.1.0 (Aug 3, 2022)
* Changes
* First release.
2 changes: 0 additions & 2 deletions examples/scf/00-simple.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import pyscf
from pyscfad import gto, scf

"""
Expand All @@ -12,7 +11,6 @@
mol.build()

mf = scf.RHF(mol)
mf.kernel()
jac = mf.energy_grad()
print(f'Nuclaer gradient:\n{jac.coords}')
print(f'Gradient wrt basis exponents:\n{jac.exp}')
Expand Down
6 changes: 3 additions & 3 deletions examples/scf/10-polarizability.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import numpy
import jax
from pyscfad import numpy as np
from pyscfad import gto, scf
from pyscfad.lib import numpy as jnp

mol = gto.Mole()
mol.atom = '''H , 0. 0. 0.
Expand All @@ -15,7 +15,7 @@
h1 = mf.get_hcore()

def apply_E(E):
mf.get_hcore = lambda *args, **kwargs: h1 + jnp.einsum('x,xij->ij', E, ao_dip)
mf.get_hcore = lambda *args, **kwargs: h1 + np.einsum('x,xij->ij', E, ao_dip)
mf.kernel()
return mf.dip_moment(mol, mf.make_rdm1(), unit='AU', verbose=0)

Expand All @@ -24,7 +24,7 @@ def apply_E(E):
print(polar)

def apply_E1(E):
mf.get_hcore = lambda *args, **kwargs: h1 + jnp.einsum('x,xij->ij', E, ao_dip)
mf.get_hcore = lambda *args, **kwargs: h1 + np.einsum('x,xij->ij', E, ao_dip)
return mf.kernel()

polar = -jax.hessian(apply_E1)(E0)
Expand Down
14 changes: 9 additions & 5 deletions pyscfad/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
"""
PySCF with auto-differentiation
"""
import sys
from pyscfad.version import __version__

#from pyscfad import util
#from pyscfad import implicit_diff

from pyscfad._src._config import (
config,
config_update
)

import jax
jax.config.update("jax_enable_x64", True)
# export backend.numpy to pyscfad namespace
# pylint: disable=useless-import-alias
from pyscfad.backend import numpy as numpy
from pyscfad.backend import ops as ops
sys.modules['pyscfad.numpy'] = numpy
sys.modules['pyscfad.ops'] = ops

del sys
1 change: 0 additions & 1 deletion pyscfad/_src/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def reset(self):

config = _Config()

config.set_default('pyscfad_numpy_backend', 'jax')
config.set_default('pyscfad_scf_implicit_diff', False)
config.set_default('pyscfad_ccsd_implicit_diff', False)
config.set_default('pyscfad_ccsd_checkpoint', False)
Expand Down
2 changes: 1 addition & 1 deletion pyscfad/_src/scipy/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import scipy.linalg
from jax import numpy as np
from jax import scipy as jax_scipy
from pyscfad.lib import custom_jvp, jit
from pyscfad.ops import custom_jvp, jit

# default threshold for degenerate eigenvalues
DEG_THRESH = 1e-9
Expand Down
Loading

0 comments on commit 6ad7181

Please sign in to comment.