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

Change normalized to SphericalHarmonics and SolidHarmonics across all APIs #137

Merged
merged 12 commits into from
Aug 28, 2024

Conversation

frostedoyster
Copy link
Collaborator

This is much more intuitive for the user (at the moment, if they ask for the spherical harmonics, they get something else by default), matches the Julia API, and also seems to be accepted in the field (see e3x API for spherical and solid harmonics)

@frostedoyster frostedoyster requested a review from Luthaf August 18, 2024 21:16
@ceriottm ceriottm self-requested a review August 18, 2024 21:49
@frostedoyster frostedoyster force-pushed the new-api branch 2 times, most recently from 1ca11d3 to 82d6f60 Compare August 19, 2024 08:24
@frostedoyster frostedoyster force-pushed the new-api branch 3 times, most recently from eff52b4 to 4988f8d Compare August 19, 2024 12:39
@frostedoyster
Copy link
Collaborator Author

I can't get torch to work, I think the inheritance torch::CustomClassHolder -> SphericalHarmonics -> SolidHarmonics is breaking the CustomClassHolder mechanics.
Multiple inheritance of SolidHarmonics from SphericalHarmonics and CustomClassHolder doesn't compile (understandably perhaps).
@Luthaf please have a look if and when you can

Copy link

github-actions bot commented Aug 20, 2024

Here is a pre-built version of the code in this pull request: wheels.zip, you can install it locally by unzipping wheels.zip and using pip to install the file matching your system

@frostedoyster frostedoyster marked this pull request as ready for review August 20, 2024 10:06
@frostedoyster
Copy link
Collaborator Author

This would solve #98

@Luthaf
Copy link
Contributor

Luthaf commented Aug 26, 2024

I can't get torch to work, I think the inheritance torch::CustomClassHolder -> SphericalHarmonics -> SolidHarmonics is breaking the CustomClassHolder mechanics.
Multiple inheritance of SolidHarmonics from SphericalHarmonics and CustomClassHolder doesn't compile (understandably perhaps).

Yes, you'll need multiple classes at the Torch API level, one for each calculator.

@frostedoyster
Copy link
Collaborator Author

frostedoyster commented Aug 26, 2024

Thanks, torch should be good. The docs are not ideal for now, but I'm planning to do a thorough docs revision PR after #139 is fixed

examples/pytorch/example.py Outdated Show resolved Hide resolved
Comment on lines +16 to +19
using sphericart_spherical_harmonics_calculator_t = sphericart::SphericalHarmonics<double>;
using sphericart_spherical_harmonics_calculator_f_t = sphericart::SphericalHarmonics<float>;
using sphericart_solid_harmonics_calculator_t = sphericart::SolidHarmonics<double>;
using sphericart_solid_harmonics_calculator_f_t = sphericart::SolidHarmonics<float>;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need separate types here? We could reduce the number of functions by either having a single calculator type, which is initialized to be either SphericalHarmonics or SolidHarmonics, or having two calculator types by a single function that can take both and call the right function on them.

If this is not an issue, we could also keep the two separate, but I feel like we have a lot of functions in the C API for no reason.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that we have a lot of functions (and we would have even more if we wanted to have a CUDA C API for e.g. CuPy). However, I feel like this is in line with the other APIs and the original idea behind this PR was to make the APIs as uniform as possible

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that this is making the API a bit more uniform between C & the other languages, but I fear that this is also making the API really hard to use from pure C. We can decide that we don't care and I'd be fine with it, but otherwise I'd like to revise the C API before a 1.0 release.

This can still be merged for now, and we'll have another look later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks. And yes, let's discuss in person

@frostedoyster frostedoyster requested a review from Luthaf August 28, 2024 06:32
@frostedoyster frostedoyster merged commit f2bcb1a into main Aug 28, 2024
10 checks passed
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.

2 participants