Fix the problem when have negative number of points (Fix #273)#282
Merged
FanwangM merged 4 commits intotheochem:masterfrom Dec 8, 2025
Merged
Fix the problem when have negative number of points (Fix #273)#282FanwangM merged 4 commits intotheochem:masterfrom
FanwangM merged 4 commits intotheochem:masterfrom
Conversation
Closed
There was a problem hiding this comment.
Pull request overview
This PR fixes the handling of cube files with negative point numbers, which according to the Gaussian cube file format specification indicates that coordinates are in Bohr units rather than Angstroms. The implementation detects the unit system based on the sign of the shape values and adds this information to the returned metadata.
- Adds logic to detect coordinate units (Bohr vs Angstrom) based on negative shape values
- Takes absolute values of shape parameters to handle negative numbers correctly
- Includes unit information in the returned cube_data dictionary
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
marco-2023
reviewed
Dec 8, 2025
Collaborator
marco-2023
left a comment
There was a problem hiding this comment.
@FanwangM Looks good to me. I think this follows Gaussian’s description:
"If N1<0 the input cube coordinates are assumed to be in Bohr, otherwise, they are interpreted as Angstroms."
marco-2023
approved these changes
Dec 8, 2025
Contributor
Author
|
Thanks! @marco-2023 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the number of points is negative, it indicates the coordinate units are Bohr instead of Angstroms, https://gaussian.com/cubegen/. Therefore, I added this to the metadata and fixed the cube generation.