Skip to content

Commit

Permalink
Merge pull request #31 from qchempku2017/atomate2_deprecation
Browse files Browse the repository at this point in the history
[WIP] Atomate2 deprecation
  • Loading branch information
qchempku2017 committed Sep 14, 2023
2 parents 52d3880 + 6482e4a commit 625b93e
Show file tree
Hide file tree
Showing 36 changed files with 274 additions and 336 deletions.
57 changes: 5 additions & 52 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,17 @@
name: build-dist
name: build

# Use this workflow to manually trigger a build for testing purposes.
# Download it from artifacts to test installation, or upload directly to PyPI.
on:
workflow_dispatch:
inputs:
release-pypi:
required: true
type: boolean
CIBW_SKIP:
description: wheel builds to skip
# Allowed to be referenced by another workflow.
on: [workflow_dispatch, workflow_call]

jobs:

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
# No specific external lib to worry about.
os: [ubuntu-latest, windows-latest, macos-latest]
env:
CIBW_SKIP: pp* ${{ github.event.inputs.CIBW_SKIP }} # skip pypy wheels

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

# No need to build wheels.
build_sdist:
name: Build sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm

Expand All @@ -50,21 +21,3 @@ jobs:
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

release-pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event.inputs.release-pypi == 'true'

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: build-documentation

on: workflow_dispatch
on: [workflow_dispatch, workflow_call]

jobs:
docs:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches:
- main

workflow_dispatch:

workflow_call:

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
133 changes: 28 additions & 105 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,125 +1,48 @@
name: release

# Releasing on push tags is less customizable compared to release upon request.
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
release:
types: [published]
inputs:
release-pypi:
required: true
type: boolean
default: true
workflow_dispatch:
inputs:
release-pypi:
required: true
type: boolean
description: "if true a release is made on PyPI"

jobs:
test:
uses: WFacer/WFacer/.github/workflows/test.yml@main

release-docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install pandoc
run: sudo apt-get install pandoc
build:
needs: test
uses: WFacer/WFacer/.github/workflows/build.yml@main

- uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-optional.txt
pip install -e .[docs]
- name: Build docs
run: sphinx-build docs/src docs_build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./docs_build

release-github:

runs-on: ubuntu-latest
needs:
- release-docs

steps:
- uses: actions/checkout@v3

- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Write release info # CHANGES.md must be edited with the correct version being released.
run: awk 'BEGIN {p = 0} {a = 0 }; /\[v([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)\.([0-9]|[1-9][0-9]*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?\]/ { p += 1; a = 1}; p + a == 1 { print } ' CHANGES.md | sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' > release.txt

- name: Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
body_path: release.txt
draft: false
prerelease: false

build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

needs:
- release-github
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
env:
CIBW_SKIP: pp* # skip pypy wheels

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest

needs:
- release-github

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Optional, use if you use setuptools_scm

- name: Build sdist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
release-docs:
needs: test
uses: WFacer/WFacer/.github/workflows/docs.yml@main

release-pypi:
needs: [build, docs]
runs-on: ubuntu-latest
needs: [build_wheels, build_sdist]
if: github.event.inputs.release-pypi == 'true'

steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
- uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
user: __token__
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: test

env:
scip-version: 8.0.0

on:
push:
branches:
Expand All @@ -9,9 +12,14 @@ on:
branches:
- main

workflow_call:

workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
# Only 20.04 is known to work with scip 8.0.0
runs-on: ubuntu-20.04
strategy:
max-parallel: 10
matrix:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ repos:
additional_dependencies:
- flake8-typing-imports==1.10.1
- flake8-rst==0.8.0
- Flake8-pyproject

- repo: https://github.com/pycqa/pydocstyle
rev: 6.3.0 # pick a git hash / tag to point to
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.MD → CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v0.0.1](https://github.com/CederGroupHub/WFacer/tree/0.0.1) (2023-08-30)
## [v0.0.0](https://github.com/CederGroupHub/WFacer/tree/0.0.0) (2023-08-30)
Initial relatively *stable* version of the code.
3 changes: 3 additions & 0 deletions WFacer/convergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def compare_min_energy_structures_by_composition(min_e1, min_e2, matcher=None):
matcher (StructureMatcher): optional
A StructureMatcher used compare structures.
wrangler.cluster_subspace._site_matcher is recommended.
Return:
float, bool:
maximum energy difference in eV/site,
Expand Down Expand Up @@ -52,6 +53,7 @@ def compare_fitted_coefs(cluster_subspace, coefs_prev, coefs_now):
Not ECIs because not divided by multiplicity!
coefs_now(1d arrayLike):
Cluster coefficients fitted in the latest iteration.
Returns:
float:
|| ECI' - ECI ||_1 / ||ECI||_1.
Expand Down Expand Up @@ -83,6 +85,7 @@ def ce_converged(
must be equal to that of current iter_id - 1.
convergence_options(dict):
Pre-processed convergence criterion.
Returns:
bool.
"""
Expand Down
4 changes: 4 additions & 0 deletions WFacer/enumeration.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def enumerate_matrices(
to 30, to prevent over-skewing.
kwargs:
keyword arguments to pass into SpaceGroupAnalyzer.
Returns:
List of 2D lists.
"""
Expand Down Expand Up @@ -222,6 +223,7 @@ def enumerate_compositions_as_counts(
Results will be returned in "counts" format
(see smol.moca.CompositionSpace).
Args:
sc_size(int):
The super-cell size in the number of prim cells.
Expand All @@ -239,6 +241,7 @@ def enumerate_compositions_as_counts(
Default to 1.
kwargs:
Other keyword arguments to initialize CompositionSpace.
Returns:
Enumerated possible compositions in "counts" format, not normalized:
2D np.ndarray[int]
Expand Down Expand Up @@ -427,6 +430,7 @@ def generate_training_structures(
before matching. It should be used with caution.
kwargs:
Keyword arguments for utils.selection.select_initial_rows.
Returns:
list[Structure], list[3*3 list[list[int]]], list[list[float]]:
Initial training structures, super-cell matrices,
Expand Down
2 changes: 2 additions & 0 deletions WFacer/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def fit_ecis_from_wrangler(
"""Fit ECIs from a fully processed wrangler.
No weights will be used.
Args:
wrangler(CeDataWrangler):
A CeDataWrangler storing all training structures.
Expand Down Expand Up @@ -60,6 +61,7 @@ def fit_ecis_from_wrangler(
Other keyword arguments to initialize an optimizer.
kwargs:
Keyword arguments used by estimator._fit. For example, solver arguments.
Returns:
Estimator, 1D np.ndarray, float, float, float, 1D np.ndarray:
Fitted estimator, coefficients (not ECIs), cross validation error (meV/site),
Expand Down
Loading

0 comments on commit 625b93e

Please sign in to comment.