Skip to content

Commit

Permalink
v0.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
hspark1212 committed Nov 28, 2023
1 parent 883e9ed commit 4ccf0a6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 7 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build and upload to PyPI

on: [push, pull_request]

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-11, windows-2019]

steps:
- uses: actions/checkout@v4

- name: Build wheels
uses: pypa/[email protected]
env:
# Build wheels for CPython only, skipping PyPy
CIBW_BUILD: "cp*"
CIBW_SKIP: "*-pp*"

- uses: actions/upload-artifact@v3
with:
name: artifact-name
path: ./wheelhouse/*.whl
13 changes: 9 additions & 4 deletions fast_grid/calculate_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def calculate_grid(
float16: bool = False,
emax: float = 5000.0,
emin: float = -5000.0,
output_shape_grid: bool = False,
return_dict: bool = False,
) -> np.array:
"""Calculate the energy grid for a given structure and force field.
It takes a structure (ase Atoms object or cif file path) and returns the energy grid.
Expand All @@ -54,7 +54,7 @@ def calculate_grid(
:param float16: use float16 to save memory, defaults to False
:param emax: clip energy values for better visualization, defaults to 5000.0
:param emin: clip energy values for better visualization, defaults to -5000.0
:param output_shape_grid: output shape of energy grid, defaults to False
:param return_dict: return a dictionary of outputs, defaults to False
:return: energy grid
"""
# read structure
Expand Down Expand Up @@ -140,8 +140,13 @@ def calculate_grid(
print(f"Visualizing energy grid | supercell {supercell}...")
visualize_grid(pos_grid, pos_atoms, calculated_grid, emax, emin)

if output_shape_grid:
return calculated_grid.reshape(grid_size)
if return_dict:
return {
"atoms": atoms, # supercelled atoms
"supercell": supercell,
"pos_grid": pos_grid,
"calculated_grid": calculated_grid,
}

return calculated_grid

Expand Down
13 changes: 10 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

setup(
name="fast-grid",
version="0.1.12",
version="0.1.13",
description="Fast grid calculation",
author="Hyunsoo Park",
author_email="[email protected]",
Expand All @@ -23,13 +23,20 @@
package_data={"fast_grid": ["assets/*.csv"]},
include_package_data=True,
python_requires=">=3.9",
# readme
# long_description=open("README.md").read(),
# long_description_content_type="text/markdown",
# cython
setup_requires=["cython"],
setup_requires=["cython", "numpy"],
ext_modules=cythonize(
[
"fast_grid/libs/distance_matrix.pyx",
"fast_grid/libs/potential.pyx",
]
],
compiler_directives={"language_level": "3"},
),
include_dirs=[np.get_include()],
extras_require={
"pypy": ["pypy-cffi"]
}, # Additional configurations for PyPy compatibility
)

0 comments on commit 4ccf0a6

Please sign in to comment.