How to generate defects (atom exchanges) using pymatgen

Hello everybody!

I usually use pymatgen to substitute atoms in a structure for other atoms (i.e. 25% subtitution of Mn by Ni in LiMn2O4 generating the different structures of LiMn1.5Ni0.5O4). This time I would like to exchange atoms in one structure (i.e. In LiMn1.5Ni0.5O4 put a percentage of Ni in tetrahedral position and Li in octahedral position, while normally they are the other way around).

Does anybody know how to do it?



Is it possible to use the SubstitutionTransformation for this? It seems like you could just feed it a dictionary of the form {“Li": {“Li”: 0.5, “Ni”: 0.5}}, “Ni”: {“Li”: 0.5, “Ni”: 0.5}}. I haven’t tried this myself, but looking at the code I don’t see an obvious reason why it would fail.

1 Like

I will try it today and let you know! Thanks!

After many trial i get a syntax error using:
subtrans = SubstitutionTransformation({“Li”: {“Li”: 8./8, “Ni”: 8./20}}, “Ni”: {“Li”: 8./8, “Ni”: 8./20}})
subtrans = SubstitutionTransformation({“Li”: {“Li”: 0.5, “Ni”: 0.5}}, “Ni”: {“Li”: 0.5, “Ni”: 0.5}})
I also tried to add the charge to the atoms like:
subtrans = SubstitutionTransformation({“Li+”: {“Li”: 8./8, “Ni”: 8./20}}, “Ni3+”: {“Li”: 8./8, “Ni”: 8./20}})

Any idea?

What is the syntax error message/traceback?

Input In [11]
subtrans = SubstitutionTransformation({“Li”: {“Li”: 8./8, “Ni”: 8./20}}, “Ni”: {“Li”: 8./8, “Ni”: 8./20}})
SyntaxError: invalid syntax


Ah, the brackets are mismatched in the example I gave you, sorry about that. Try {“Li": {“Li”: 0.5, “Ni”: 0.5}, “Ni”: {“Li”: 0.5, “Ni”: 0.5}}, it might work better.

1 Like

It seems to work now! Thank you so much! You helped me to save a lot of time!