-
Notifications
You must be signed in to change notification settings - Fork 895
Add Structure.sublattices
and class RandomStructureTransformation
to standard_transformations.py
#3057
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
base: master
Are you sure you want to change the base?
Conversation
…tgen/transformations/standard_transformations.py
Thanks @exenGT, I added a question to the associated issue. |
@janosh All your suggestions have been addressed in my latest commits. |
sublattices
to pymatgen/core/structure.py; adding class RandomStructureTransformation
to pymatgen/transformations/standard_transformations.pyStructure.sublattices
and class RandomStructureTransformation
to standard_transformations.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@exenGT Looking good! Could you add a test in test_standard_transformations.py
?
subl = structure.sublattices | ||
|
||
# fill the sublattice sites with pure-element atoms | ||
self.all_structures = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to store the structures on the transformation instance? might balloon mem usage if people create many of these RandomStructureTransformation
s.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used this syntax because there is an is_one_to_many
property in the class; should it be False
by default? (I see it is True
for other classes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no connection between is_one_to_many
(that part is good) and storing the transformed structures on the transformation instance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you elaborate more on this? I feel I'm not totally understanding. For example, the apply_transformation
method of OrderDisorderedTransformation
returns a list of structures as well (self._all_structures
). What is the issue with this approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain the need to store all structures for later? Why not just return them and let them be garbage collected if they go out of scope in the user's code? Currently they live as long as the Transformation
instance which is not great given structures are notoriously mem hungry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. This feature is here simply because I'm copying what's been written for the other transformations. If you think it's not a good approach, then I can modify it in my code accordingly.
6d162f3
to
84f7832
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #3057 +/- ##
==========================================
- Coverage 74.69% 74.12% -0.57%
==========================================
Files 230 230
Lines 69375 69419 +44
Branches 16154 16163 +9
==========================================
- Hits 51818 51460 -358
- Misses 14490 14923 +433
+ Partials 3067 3036 -31
☔ View full report in Codecov by Sentry. |
…round in apply_transformation() of class RandomStructureTransformation.
…) in class Trajectory.
3c23114
to
36e289c
Compare
9be5122
to
e32fd8f
Compare
d725325
to
dca98be
Compare
e3fbc67
to
41e6d99
Compare
Closes #3049.