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

Nanobind port: Order module #1281

merged 94 commits into from
Nov 8, 2024

Conversation

janbridley
Copy link
Contributor

@janbridley janbridley commented Sep 11, 2024

Description

Work toward converting the code to nano bind. Currently, the freud/order/nematic has been 100% translated (with tests passing).

Notes for reviewers:

SolidLiquid previously allowed passing non-integer solid_threshold values, which seem to have been cast into unsigned ints in the python->c translation. I'm not sure what the "ideal" behavior for this is, but in the interest of not modifying tests (which do supply an incorrect value) I have added some handling on the python side to floor the value and raise a warning.

TODOs:

  • Nematic
  • ContinuousCoordination
  • Cubatic
  • Hexatic @seoulfood
  • Steinhardt
    • Translation complete
    • Compiles
    • Export properties to python
  • RotationalAutocorrelation
  • SolidLiquid (blocked by clusters module)
    • c++ layer
    • python layer
  • Final pass to clean up everything

How Has This Been Tested?

No tests have been modified to ensure the user-facing behavior remains constant.

Screenshots

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds or improves functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation improvement (updates to user guides, docstrings, or developer docs)

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • All new and existing tests passed.
  • I have updated the credits.
  • I have updated the Changelog.

@janbridley janbridley changed the title Update order/Nematic Nanobind port: Order module Sep 11, 2024
@janbridley janbridley self-assigned this Sep 11, 2024
freud/__init__.py Outdated Show resolved Hide resolved
@janbridley janbridley marked this pull request as ready for review November 5, 2024 17:13
Copy link
Member

@joaander joaander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

I have made many suggestions for improvement. I pushed some changes directly that were not practical (or possible) to suggest on GitHub.

freud/order.py Outdated Show resolved Hide resolved
freud/order.py Outdated
@@ -206,58 +175,54 @@ def compute(self, orientations):
Args:
orientations (:math:`\left(N_{particles}, 3 \right)` :class:`numpy.ndarray`):
Orientation vectors for which to calculate the order parameter.
""" # noqa: E501
""" # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should either increase the line length or reformat the docstrings to fit in the chosen length. noqa: E501 is commonly used throughout freud, so I opened #1292 to track work on this in a future PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been fixed in the current PR. Other examples can be addressed in a later pass over the Nanobind branch: it should be possible to resolve all cases, but it's hard to know until we try.

freud/order.py Outdated Show resolved Hide resolved
freud/order.py Outdated Show resolved Hide resolved
freud/order.py Outdated Show resolved Hide resolved
freud/order/Steinhardt.cc Outdated Show resolved Hide resolved
freud/order/Steinhardt.cc Outdated Show resolved Hide resolved
freud/order/Steinhardt.h Outdated Show resolved Hide resolved
freud/order/Wigner3j.cc Outdated Show resolved Hide resolved
freud/order/Wigner3j.h Outdated Show resolved Hide resolved
@janbridley
Copy link
Contributor Author

Thanks for those fixes - I knew it must be possible to use std::copy in Cubatic.cc, but couldn't find the solution

janbridley and others added 10 commits November 5, 2024 12:31
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Co-authored-by: Joshua A. Anderson <joaander@umich.edu>
Copy link
Member

@joaander joaander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@joaander joaander merged commit 2157905 into nanobind Nov 8, 2024
33 checks passed
@joaander joaander deleted the nanobind-order branch November 8, 2024 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants