-
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
new get_primitive_cell() is not working anymore in some cases #1161
Comments
Unfortunately, this is not possible as the ASE atoms class does not have |
We dont define the indices through the ASE atoms class. We define it subsequently. The problem is how we define it: doing it explicitly: new_structure.indices[: len(indices)] = indices (indices we take from ase) (working) vs. doing it with structuretoolkit.common.helper.set_indices(). I tested by changing the code locally as follows:
and it is working. |
Yes, the pyiron Atoms class has indices as defined in https://github.com/pyiron/pyiron_atomistics/blob/main/pyiron_atomistics/atomistics/structure/atoms.py#L208 but the structuretoolkit is purely based on the ASE Atoms class. So for the functionality to be usable with the ASE Atoms class we have to rewrite the function. |
I was able to fix the structuretoolkit command with pyiron/structuretoolkit#57 now you can use:
This returns the right structure:
Unfortunately, there is still something wrong with the compatibility of the pyiron Atoms class and the ASE Atoms class. My assumption is that this is also related to #981 as discussed in https://github.com/orgs/pyiron/discussions/191 |
In combination with pyiron/structuretoolkit#58 the example can be written even more elegantly:
|
Thank you very much, Jan, for your quick help.
-> Fe4O6 However, weirdly, when I do this:
-> Fe10 Positions and lattice vectors are correct. It is only the symbols that are wrong. Anyway, I can work with it as it is for the moment. Thanks, again! |
I haven't read the full discussion yet, but I have used this snippet in the past import spglib
from ase import Atoms
cell, scaled_positions, numbers = spglib.standardize_cell(structure)
structure = Atoms(scaled_positions=scaled_positions, cell=cell, numbers=numbers, pbc=structure.pbc)
structure = pr.create.structure.from_ase(structure) without issue, though I suppose you'll have to add any custom tag arrays defined on the original structure manually. That should be straightforward by looping through |
Before migration to structuretoolkit get primitive cell had this form:
Now it has this form:
Now the difference and the problem in the new_structure = set_indices(structure=new_structure, indices=indices) (new)
vs new_structure.indices[: len(indices)] = indices (old).
I will try to explain what is the problem:
Now if the structure objects is composed of one atom type, the function will work, lets say:
Fe
Fe
Fe
Fe
if you have two types but they are arranged in alternating fashion the function will also work:, lets say:
Fe
O
Fe
O
The problem will start arising for structures (imported from cif files) when you have two types let's say Fe and O that are not equal in number and arranged in a block fashion and not alternating. For example, in my case, In the conventional cell, i have 12 Fe folllowed by 18 O atoms in the following fashion:
Fe
Fe...12x
O
O... 18x
and I know that the primitive cell will be made of 4 Fe atoms followed by 6 Oxygen atoms.
I explain the problem here on that example from the code:
The problem in this case is that you are passing a structure of one species type (Fe10) and two indices with two types to set indices, which confuses set_indices() function.
The return of set_indices will be {0: 'Fe'} in this case
Here is a code to reproduce the problem and attached in the cif file (just change the format from .txt to .cif (github wont upload cif files))
fe2o3_conv_strucs.9000139.txt
I can try to make a pull request by reverting back to the old code, otherwise, I am not sure how the code should look like.
The text was updated successfully, but these errors were encountered: