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

Nanobind port: Order module #1281

Merged
merged 94 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from 77 commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
004edac
Update order/Nematic
janbridley Sep 11, 2024
8ef385e
Export nematic and module order
janbridley Sep 11, 2024
be23b20
Update cmakelists
janbridley Sep 11, 2024
82718d8
Move order.pyx to order.py
janbridley Sep 11, 2024
cc18bda
Update init.py
janbridley Sep 11, 2024
3aa882d
Update python side for Nematic order
janbridley Sep 11, 2024
addde43
Convert to numpy array
janbridley Sep 11, 2024
5f40d6e
Update order/Nematic
janbridley Sep 11, 2024
89bac0c
Export nematic and module order
janbridley Sep 11, 2024
24eec22
Update cmakelists
janbridley Sep 11, 2024
770a769
Move order.pyx to order.py
janbridley Sep 11, 2024
2bb30bb
Update init.py
janbridley Sep 11, 2024
c77b5ef
Update python side for Nematic order
janbridley Sep 11, 2024
32972de
Convert to numpy array
janbridley Sep 11, 2024
04c2a97
Merging in updated files from others working on porting nanobind
seoulfood Oct 22, 2024
1758f4e
Progress on RotationalAutocorrelation translation
janbridley Oct 22, 2024
5592e25
Update python side of RotationalAutocorrelation
janbridley Oct 23, 2024
b0900b7
Export RotationalAutocorrelation
janbridley Oct 23, 2024
a4e7a82
Include missing header
janbridley Oct 23, 2024
3194225
WIP on Steinhardt
janbridley Oct 22, 2024
c85fdde
17 errors
janbridley Oct 23, 2024
728f08e
6 errors
janbridley Oct 23, 2024
1cf8133
5 errors
janbridley Oct 23, 2024
b19d521
17 errors
janbridley Oct 23, 2024
356efee
15
janbridley Oct 23, 2024
5ec3279
10 errors
janbridley Oct 23, 2024
4a82ec9
5 errors
janbridley Oct 23, 2024
be22bf8
3 errors
janbridley Oct 23, 2024
0193019
2 errors
janbridley Oct 23, 2024
bff43f0
1 error
janbridley Oct 23, 2024
aa0ffb1
3 errors
janbridley Oct 23, 2024
9872c90
0 errors
janbridley Oct 23, 2024
391dad0
Fix Steinhardt __init__
janbridley Oct 23, 2024
264d749
First property
janbridley Oct 23, 2024
19a0006
Scalar properties
janbridley Oct 23, 2024
77b31a8
Initial compute interface
janbridley Oct 23, 2024
21cdd7a
Fix final method in RotationalAutocorrelation
janbridley Oct 24, 2024
3352f46
Steinhardt shared_ptr to neighbor queries
janbridley Oct 24, 2024
3a6ea38
Update NeighborComputeFunctional to use shared pointers
janbridley Oct 24, 2024
522e3ec
Fix compile error.
joaander Oct 24, 2024
4d009cb
compute() call completes.
joaander Oct 24, 2024
7833b4c
Add qlm and particle order exports
janbridley Oct 25, 2024
fcfd1d9
Fix segfalt when computing averaged steinhardt
janbridley Oct 25, 2024
a9c8cd8
export ql
janbridley Oct 25, 2024
6c472fc
Clean up order.py for steinhardt
janbridley Oct 25, 2024
51fdb5a
SolidLiquid progress
janbridley Oct 25, 2024
80ecb1e
2 errors
janbridley Oct 25, 2024
744c016
1 error
janbridley Oct 25, 2024
5a12795
Compile SolidLiquid
janbridley Oct 25, 2024
5c0ddce
clean up SolidLiquid
janbridley Oct 25, 2024
39a9e14
export SolidLiquid
janbridley Oct 25, 2024
7b66c2b
Initial SolidLiquid python layer
janbridley Oct 25, 2024
ac7065d
Finish exporting SolidLiquid
janbridley Oct 26, 2024
da32e83
Clean up exports thus far
janbridley Oct 26, 2024
41606ba
export continuouscoordination
janbridley Oct 26, 2024
ed234ca
Compiling version of ContinuousCoordination
janbridley Oct 26, 2024
215bb83
Python export for ContinuousCoordination
janbridley Oct 26, 2024
b55deaf
Lint cpp files
janbridley Oct 26, 2024
f59ce23
export cubatic
janbridley Oct 26, 2024
2cc36c2
Replace prepare
janbridley Oct 26, 2024
3d049a3
Finish cubatic
janbridley Oct 26, 2024
db06962
clang format
janbridley Oct 26, 2024
d5e0abf
Export ContinuousCoordination properly
janbridley Oct 26, 2024
211632e
Merge remote-tracking branch 'origin/nanobind' into nanobind-order
janbridley Oct 28, 2024
577376d
gabby trying to merge, unhelpful message
seoulfood Nov 4, 2024
3989a5d
Export HexaticTranslational
janbridley Nov 4, 2024
08c8eb1
pre-commit autofix
janbridley Nov 4, 2024
52e0893
Lint order.py
janbridley Nov 4, 2024
90cb85d
Lint import block
janbridley Nov 4, 2024
687a28e
Remove unused header
janbridley Nov 4, 2024
be49b3f
Merge remote-tracking branch 'origin/nanobind' into nanobind-order
janbridley Nov 4, 2024
b88f132
Add missing header
janbridley Nov 4, 2024
1fc13ce
Fix fstring issue
janbridley Nov 4, 2024
34e2d5f
Swap to proper submodule version
janbridley Nov 4, 2024
21bc88f
Fix fstring weirdness
janbridley Nov 4, 2024
3fbec56
Fix CI scripts
janbridley Nov 4, 2024
e2809f2
Fix fstring weirdness part 2
janbridley Nov 4, 2024
ca7aac5
Fix missing imports
janbridley Nov 4, 2024
c3f4d38
Fix fstring again
janbridley Nov 5, 2024
8bae101
Address clang-tidy violations.
joaander Nov 5, 2024
f716ee2
Apply suggestions from code review.
joaander Nov 5, 2024
7395311
Update freud/order.py
janbridley Nov 5, 2024
1ce2288
Fix EM101
janbridley Nov 5, 2024
da307a4
Globally disable E741
janbridley Nov 5, 2024
e8a6e8d
Update freud/order/Steinhardt.cc
janbridley Nov 5, 2024
1abbdaf
Update freud/order/Steinhardt.cc
janbridley Nov 5, 2024
0491da2
Update freud/order/Wigner3j.cc
janbridley Nov 5, 2024
83fa6c5
Update freud/order/Steinhardt.h
janbridley Nov 5, 2024
b0dba0a
Update freud/order/Wigner3j.h
janbridley Nov 5, 2024
4475fb9
Run pre-commit
janbridley Nov 5, 2024
6461db5
Fix remaining lint errors
janbridley Nov 5, 2024
a205850
Fix docstring format
janbridley Nov 7, 2024
79f92e8
Apply suggestions from code review
joaander Nov 8, 2024
a0286f4
pre-commit
joaander Nov 8, 2024
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_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 -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 @@ -68,6 +68,7 @@ jobs:
pytest tests/test_interface.py -v
pytest tests/test_msd_msd.py -v
pytest tests/test_cluster.py -v
pytest tests/test_order_*.py -v
# pytest tests/ -v

tests_complete:
Expand Down
53 changes: 34 additions & 19 deletions freud/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,23 +89,23 @@ add_library(
${VOROPP_SOURCE_DIR}/wall.cc
${VOROPP_SOURCE_DIR}/pre_container.cc
${VOROPP_SOURCE_DIR}/container_prd.cc
# order
# order/ContinuousCoordination.h
# order/ContinuousCoordination.cc
# order/Cubatic.cc
# order/Cubatic.h
# order/HexaticTranslational.cc
# order/HexaticTranslational.h
# order/Nematic.cc
# order/Nematic.h
# order/RotationalAutocorrelation.cc
# order/RotationalAutocorrelation.h
# order/SolidLiquid.cc
# order/SolidLiquid.h
# order/Steinhardt.cc
# order/Steinhardt.h
# order/Wigner3j.cc
# order/Wigner3j.h
order
order/ContinuousCoordination.h
order/ContinuousCoordination.cc
order/Cubatic.cc
order/Cubatic.h
order/HexaticTranslational.cc
order/HexaticTranslational.h
order/Nematic.cc
order/Nematic.h
order/RotationalAutocorrelation.cc
order/RotationalAutocorrelation.h
order/SolidLiquid.cc
order/SolidLiquid.h
order/Steinhardt.cc
order/Steinhardt.h
order/Wigner3j.cc
order/Wigner3j.h
# parallel
parallel/tbb_config.h
parallel/tbb_config.cc
Expand Down Expand Up @@ -173,6 +173,20 @@ 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
order/module-order.cc
order/export-Nematic.cc
order/export-RotationalAutocorrelation.cc
order/export-Steinhardt.cc
order/export-SolidLiquid.cc
order/export-ContinuousCoordination.cc
order/export-Cubatic.cc
order/export-HexaticTranslational.cc)
target_link_libraries(_order PUBLIC freud)
target_set_install_rpath(_order)

# parallel
nanobind_add_module(_parallel parallel/module-parallel.cc)
target_link_libraries(_parallel PUBLIC freud TBB::tbb)
Expand Down Expand Up @@ -201,12 +215,13 @@ set(python_files
errors.py
locality.py
msd.py
order.py
parallel.py
pmft.py
interface.py
plot.py
util.py)
# density.py diffraction.py environment.py order.py)
# cluster.py density.py diffraction.py environment.py interface.py msd.py)

copy_files_to_build("${python_files}" "freud" "*.py")

Expand All @@ -218,7 +233,7 @@ if(SKBUILD)
# install(TARGETS _density DESTINATION freud) install(TARGETS _diffraction
# DESTINATION freud) install(TARGETS _environment DESTINATION freud)
install(TARGETS _locality DESTINATION freud)
# install(TARGETS _order DESTINATION freud)
install(TARGETS _order DESTINATION freud)
install(TARGETS _parallel DESTINATION freud)
install(TARGETS _pmft DESTINATION freud)
install(TARGETS _util DESTINATION freud)
Expand Down
8 changes: 4 additions & 4 deletions freud/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 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.

# density,; diffraction,; environment,; order,
from . import box, cluster, data, interface, locality, msd, parallel, pmft
# cluster,; density,; diffraction,; environment,; interface,; msd,;
from . import box, data, interface, locality, order, parallel, pmft
janbridley marked this conversation as resolved.
Show resolved Hide resolved
from .box import Box
from .locality import AABBQuery, LinkCell, NeighborList
from .parallel import NumThreads, get_num_threads, set_num_threads
Expand All @@ -23,8 +23,8 @@
# "environment",
"interface",
"locality",
"msd",
# "order",
# "msd",
"order",
"parallel",
"pmft",
"Box",
Expand Down
16 changes: 9 additions & 7 deletions freud/locality/NeighborComputeFunctional.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ std::shared_ptr<NeighborList> makeDefaultNlist(const std::shared_ptr<NeighborQue
class NeighborListPerPointIterator : public NeighborPerPointIterator
{
public:
NeighborListPerPointIterator(const NeighborList* nlist, size_t point_index)
NeighborListPerPointIterator(const std::shared_ptr<NeighborList> nlist, size_t point_index)
: NeighborPerPointIterator(point_index), m_nlist(nlist)
{
m_current_index = m_nlist->find_first_index(point_index);
Expand Down Expand Up @@ -76,8 +76,8 @@ class NeighborListPerPointIterator : public NeighborPerPointIterator
}

private:
const NeighborList* m_nlist; //! The NeighborList being iterated over.
size_t m_current_index; //! The row of m_nlist where the iterator is currently located.
const std::shared_ptr<NeighborList> m_nlist; //! The NeighborList being iterated over.
size_t m_current_index; //! The row of m_nlist where the iterator is currently located.
size_t m_returned_point_index {
0xffffffff}; //! The index of the last returned point (i.e. the value of
//! m_nlist.getNeighbors()(m_current_index, 0)). Initialized to an arbitrary sentinel in
Expand Down Expand Up @@ -110,9 +110,10 @@ class NeighborListPerPointIterator : public NeighborPerPointIterator
* input. It should implement iteration logic over the iterator.
*/
template<typename ComputePairType>
void loopOverNeighborsIterator(const NeighborQuery* neighbor_query, const vec3<float>* query_points,
unsigned int n_query_points, QueryArgs qargs, const NeighborList* nlist,
const ComputePairType& cf, bool parallel = true)
void loopOverNeighborsIterator(const std::shared_ptr<NeighborQuery>& neighbor_query,
const vec3<float>* query_points, unsigned int n_query_points, QueryArgs qargs,
const std::shared_ptr<NeighborList>& nlist, const ComputePairType& cf,
bool parallel = true)
{
// check if nlist exists
if (nlist != nullptr)
Expand Down Expand Up @@ -235,7 +236,8 @@ void loopOverNeighbors(const std::shared_ptr<NeighborQuery>& neighbor_query, con
* input. It should implement iteration logic over the iterator.
*/
template<typename ComputePairType>
void loopOverNeighborListIterator(const NeighborList* nlist, const ComputePairType& cf, bool parallel = true)
void loopOverNeighborListIterator(const std::shared_ptr<NeighborList> nlist, const ComputePairType& cf,
bool parallel = true)
{
util::forLoopWrapper(
0, nlist->getNumQueryPoints(),
Expand Down
Loading
Loading