-
Notifications
You must be signed in to change notification settings - Fork 15
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
Consistent atoms order #338
Conversation
It seems to work, but I'm still a bit stuck on how. Will give it another reading later. :/ EDIT: Also according to what do we want to sort? The examples I gave in #335 sort alphabetically, but the test gives 'Ca', 'Mg', 'Al'. |
For maximum safety, shouldn't the test be verifying that species get mapped to the desired cartesian positions? |
That sorting also does not make sense to me. I would either sort alphabetically or by atomic number. |
Pull Request Test Coverage Report for Build 1197462116
💛 - Coveralls |
The random ordering of the species was due to this line: self.set_species(list(set(el_object_list))) When you create a set from a list of objects (not symbols) the sorting of the set is random which is why you get the random ordering of the species. My current implementation sorts the species depending on the order of the elements defined and not the alphabetical order. For example, if you define: struct = Atoms(elements=["Ca", "Mg", "Al". "Ca"], positions=<positions>, cell=<cell>)
print(struct.get_chemical_symbols() You would get |
So the order of the original I'd rather like one fixed mapping between symbols and indices, because if I create multiple structures independently and then put them in an interactive job, structure or training container, I don't want to keep track of this order manually. If we sort alphabetically or by atomic number then it's always clear how to make the indices consistent if you add a structure to an existing set of structures. I have a working workaround though, so we can discuss on Monday with everyone. |
Yes.
Yeah let's do that! |
Check in interactive jobs, they solve the same problem. |
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.
This is ok from my end. I might need a method at some point to reorder the indices, but I can add that once I'm there.
pyiron_atomistics/vasp/vasprun.py
Outdated
@@ -644,6 +644,8 @@ def get_initial_structure(self): | |||
el_list = self.vasprun_dict["atominfo"]["species_list"] | |||
cell = self.vasprun_dict["init_structure"]["cell"] | |||
positions = self.vasprun_dict["init_structure"]["positions"] | |||
|
|||
# print("vasprun elements", el_list) |
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.
Nit: remove dead debug print?
minor cleanup
Create a consistent order of the atoms and corresponding indices when creating atoms