 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.

Hi @Ykang_Tan,

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

@magnusrahm,
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!

@BAI,
I will send you my script later and hope this will help you

@Ykang_Tan

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)]

@BAI
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 ase.io import write
write('POSCAR', sqs)

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

@magnusrahm
Thanks, I think I get it.

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)

print(cs)

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

@BAI
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.

@magnusrahm