How to build a cubic supercell using icet

Dear all,

When I use icet to build SQS, I find that the shape of the output supercell is often not cube even though the primitive structure is cubic. So the question is what is the best way to get a cubic supercell when building an SQS.

Thanks a lot in advance.

Hi @Ykang_Tan,

If you want an SQS with a specific cell shape, you can use generate_sqs_from_supercells.

Thanks for this tip!
But I don’t know how to set the parameter ‘supercell’ when I use this function. I don’t find any relevant examples.

Hello, Mr Tan
I use my computer (Linux) to practice the “Generate SQS cells for a system with sublattices” item. In the end of script, the result is printing the “cluster vector of generated structure”, and I get 40 numbers of cluster vector, but how can I learn about the coordinate information of the compute 32 sites and which atoms (Au, Cu, Pd, H, X in your example) do those sites represent, respectively.
May I have your import modules as a reference? and my email is [email protected]
Thank u very much!

I will send you my script later and hope this will help you


The supercells argument is a list of ASE Atoms objects with the target cell shape. Here is an example: Special quasirandom structures — icet documentation. If you want a cubic supercell you could do something like

prim = bulk('Au', cubic=True)
supercells = [prim.repeat(2)]

The object returned from generate_sqs is an ASE Atoms object in which coordinates and chemical elements are defined. You probably want to write it to file, something like this:

sqs = generate_sqs(...)
from import write
write('POSCAR', sqs)

or whatever format you prefer (File input and output — ASE documentation).

Thanks, I think I get it.

Thank u for your tips!
And i meet another problem!
When i add “cubic=True” and run the script, the terminal send the error message:
“ValueError: chemical_symbols must have same length as structure. len(chemical_symbols) = 2, len(structure) = 8”
i think that the cubic setting makes the length of structure to 8, and how can i adjust the chemical_symbols to achieve the same value with len(structure).

primitive_structure = bulk('NaCl', cubic=True, crystalstructure='rocksalt', a=3.0)
chemicalSymbols = [['Ta', 'Nb', 'Hf', 'Zr'],['C']]
cs = ClusterSpace(primitive_structure, [6.0,4.0], chemicalSymbols)

target_concentrations = {'A': {'Ta': 0.25, 'Nb': 0.25, 'Hf': 0.25, 'Zr': 0.25},
                         'B': {'C': 1}} 
supercells = [primitive_structure.repeat(4)]
                                                          n_steps=50000 )


You need to have one list of elements for each site in primitive_structure, so something like

chemicalSymbols = [['Ta', 'Nb', 'Hf', 'Zr'] if atom.symbol == 'Na' else ['C']
                   for atom in primitive_structure]

should do.

Note that with the 8 atom primitive structure and repeat(4), your SQS will have 844*4 = 512 atoms, which is large for an SQS with such a simple crystal structure. It may be quite time-consuming to generate.

Thank u!!! Your advice is very helpful to me.