Skip to content
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

Refactor Diffraction Module for Nanobind Integration #1294

Merged
merged 14 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
gsd==${{ matrix.python.oldest_gsd }}
matplotlib==${{ matrix.python.oldest_matplotlib }}
# Test only the currently ported modules
CIBW_TEST_COMMAND: "cd {package}/tests && pytest test_box_box.py test_parallel.py test_locality_*.py test_data.py test_pmft.py test_util.py test_msd_msd.py test_interface.py test_order_*.py test_cluster.py -v --log-level=DEBUG"
CIBW_TEST_COMMAND: "cd {package}/tests && pytest test_box_box.py test_parallel.py test_locality_*.py test_data.py test_pmft.py test_util.py test_msd_msd.py test_interface.py test_order_*.py test_cluster.py test_diffraction_*.py -v --log-level=DEBUG"

# CIBW_TEST_COMMAND: "cd {package}/tests && pytest . -v --log-level=DEBUG"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
pytest tests/test_data.py -v
pytest tests/test_pmft.py -v
pytest tests/test_util.py -v
pytest tests/test_diffraction*.py -v
pytest tests/test_interface.py -v
pytest tests/test_msd_msd.py -v
pytest tests/test_cluster.py -v
Expand Down
2 changes: 2 additions & 0 deletions .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
target-version = "py39"

extend-exclude = [ 'extern', 'doc/source/gettingstarted/examples' ]

lint.extend-select = [
"A",
"B",
Expand Down
33 changes: 18 additions & 15 deletions freud/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ add_library(
# density/RDF.cc
# density/SphereVoxelization.h
# density/SphereVoxelization.cc
# diffraction
# diffraction/StaticStructureFactor.h
# diffraction/StaticStructureFactor.cc
# diffraction/StaticStructureFactorDebye.h
# diffraction/StaticStructureFactorDebye.cc
# diffraction/StaticStructureFactorDirect.h
# diffraction/StaticStructureFactorDirect.cc
diffraction/StaticStructureFactor.h
diffraction/StaticStructureFactor.cc
diffraction/StaticStructureFactorDebye.h
diffraction/StaticStructureFactorDebye.cc
diffraction/StaticStructureFactorDirect.h
diffraction/StaticStructureFactorDirect.cc
# environment
# environment/AngularSeparation.h
# environment/AngularSeparation.cc
Expand Down Expand Up @@ -144,9 +143,14 @@ target_set_install_rpath(_cluster)
# target_link_libraries(_density PUBLIC freud TBB::tbb)
# target_set_install_rpath(_density)

# diffraction nanobind_add_module(_diffraction diffraction/...)
# target_link_libraries(_diffraction PUBLIC freud TBB::tbb)
# target_set_install_rpath(_diffraction)
nanobind_add_module(
_diffraction
diffraction/module-diffraction.cc
diffraction/export-StaticStructureFactor.cc
diffraction/export-StaticStructureFactorDebye.cc
diffraction/export-StaticStructureFactorDirect.cc)
target_link_libraries(_diffraction PUBLIC freud TBB::tbb)
target_set_install_rpath(_diffraction)

# environment nanobind_add_module(_environment environment/...)
# target_link_libraries(_environment PUBLIC freud TBB::tbb)
Expand All @@ -170,9 +174,6 @@ nanobind_add_module(
target_link_libraries(_locality PUBLIC freud TBB::tbb)
target_set_install_rpath(_locality)

# order nanobind_add_module(_order order/...) target_link_libraries(_order
# PUBLIC freud TBB::tbb) target_set_install_rpath(_order)

# order
nanobind_add_module(
_order
Expand Down Expand Up @@ -212,6 +213,7 @@ set(python_files
box.py
cluster.py
data.py
diffraction.py
errors.py
locality.py
msd.py
Expand All @@ -230,8 +232,9 @@ if(SKBUILD)
install(FILES ${python_files} DESTINATION freud)
install(TARGETS _box DESTINATION freud)
install(TARGETS _cluster DESTINATION freud)
# install(TARGETS _density DESTINATION freud) install(TARGETS _diffraction
# DESTINATION freud) install(TARGETS _environment DESTINATION freud)
install(TARGETS _diffraction DESTINATION freud)
# install(TARGETS _density DESTINATION freud) install(TARGETS _environment
# DESTINATION freud)
install(TARGETS _locality DESTINATION freud)
install(TARGETS _order DESTINATION freud)
install(TARGETS _parallel DESTINATION freud)
Expand Down
16 changes: 13 additions & 3 deletions freud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# Copyright (c) 2010-2024 The Regents of the University of Michigan
# This file is from the freud project, released under the BSD 3-Clause License.

# cluster,; density,; diffraction,; environment,; interface,; msd,;
from . import box, cluster, data, interface, locality, msd, order, parallel, pmft
from . import (
box,
cluster,
data,
diffraction,
interface,
locality,
msd,
order,
parallel,
pmft,
)
from .box import Box
from .locality import AABBQuery, LinkCell, NeighborList
from .parallel import NumThreads, get_num_threads, set_num_threads
Expand All @@ -19,7 +29,7 @@
"cluster",
"data",
# "density",
# "diffraction",
"diffraction",
# "environment",
"interface",
"locality",
Expand Down
Loading