Problems with generating SQS structure for CuPd

Hi there,

I am new to pymatgen and I have the follow error when trying to execute the SQSTransformation code in pymatgen. Could anyone help me with this?


Interesting problem. If I understand correctly, the Structure class is designed so that it can be used as an iterable sequence, so calling my_structure[1] should return the second PeriodicSite in the structure, identical to my_structure.sites[1]. However at some point here this is getting messed up, and there’s probably a function which is meant to return a site index number but is actually returning the site itself, then that variable is getting used as a Structure index. Without more details it’s hard to say whether the problem is in your code or the underlying pymatgen methods.

Hi, SJ.

Edit it like that:

Before: sqstrans = SQSTransformation(structure, [2,2,2])
After: sqstrans = SQSTransformation([2,2,2])

And retry

If the above doesn’t work, try this

from pymatgen.core.structure import Structure
from pymatgen.core.lattice import Lattice
from pymatgen.transformations.advanced_transformations import SQSTransformation

a = 3.8
lattice = Lattice.cubic(a)
structure = Structure(lattice, [{“Pd”: 0.5, “Cu”: 0.5},{“Pd”: 0.5, “Cu”: 0.5}, {“Pd”: 0.5, “Cu”: 0.5},{“Pd”: 0.5, “Cu”: 0.5}],[[0,0,0], [0.5,0.5,0], [0.5,0,0.5],[0,0.5,0.5]])
sqstrans = SQSTransformation([2,2,2])

Good luck!