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

Fixes #1643 : Added modes for StructureData.get_composition #5926

Merged
merged 1 commit into from
Mar 17, 2023

Conversation

kartikeysaran
Copy link
Contributor

This Pull request fixes the issue #1643
Work done : Added an extra parameter type in the get_compostion() function
Type accept 3 values :
0 : returns the default composition
1 : returns the reduced composition
2 : returns the fractional composition

Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @kartikeysaran . I have left a number of comments in the code. In addition to that, whenever you add new functionality, it is good practice to add unit tests so we know it works as intended. For this function, you can add tests to tests/orm/nodes/data/test_structure.py.

aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
@kartikeysaran
Copy link
Contributor Author

Thanks for your contribution @kartikeysaran . I have left a number of comments in the code. In addition to that, whenever you add new functionality, it is good practice to add unit tests so we know it works as intended. For this function, you can add tests to tests/orm/nodes/data/test_structure.py.

Hi @sphuber Thankyou for reviewing my pr, I have made the suggested changes.
Might not be the perfect one but looking forward to learning more from the community :)

Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks @kartikeysaran . The tests were failing. I have suggested some corrections that I think should fix it, but I haven't tested it locally.

aiida/orm/nodes/data/structure.py Outdated Show resolved Hide resolved
tests/orm/nodes/data/test_structure.py Outdated Show resolved Hide resolved
tests/orm/nodes/data/test_structure.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks @kartikeysaran !

@kartikeysaran
Copy link
Contributor Author

kartikeysaran commented Mar 17, 2023

Thanks @kartikeysaran !

@sphuber Thankyou very much for the reviewing my pr, looking forward to learning and contributing more to the community :)

The `mode` argument allows changing the format. It supports the values
`full`, `reduced` and `fractional`:

* `full`: The default, the counts are left unnnormalized.
* `reduced`: Counts are renormalized to the greatest common denominator.
* `fractional`: Counts are renormalized such that the sum equals 1.

The default is `full` which maintains backwards compatibility.
@sphuber sphuber merged commit f71a775 into aiidateam:main Mar 17, 2023
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