5
$\begingroup$

Can anyone please show me how to make a supercell with VESTA using a single command line without opening a GUI.

$\endgroup$
5
  • 1
    $\begingroup$ Take a look here, but I am afraid that this is not possible with VESTA. You can use Cif2Cell if you do not mind to install one more package. $\endgroup$
    – Camps
    Oct 10, 2023 at 17:57
  • $\begingroup$ Please let us know if the solution by Camps works for you! $\endgroup$ Oct 10, 2023 at 22:20
  • $\begingroup$ Thank you for the reply, the cif2cell works but the output is neither in cif nor poscar format. $\endgroup$ Oct 11, 2023 at 9:47
  • $\begingroup$ You can use Phonopy to obtain supercell POSCAR file from a cif file: phonopy -d --dim="3 3 3" -c yourFile.cif should make a 3*3*3 supercell if yourFile.cif contains a unit cell cif $\endgroup$ Oct 11, 2023 at 12:41
  • 1
    $\begingroup$ I recommend pymatgen or ASE for this. You can write a small Python script that reads the structure, calls their supercell functions, and writes to a file/stdout if you want to make the supercells with a single command. $\endgroup$
    – kpoint
    Oct 15, 2023 at 7:59

1 Answer 1

3
$\begingroup$

In line with the comments, I'm not sure if you can achieve this in VESTA, but a simple ASE or Pymatgen based script can easily do it. This is the Pymatgen script I use.

from pymatgen.core import Structure
from pymatgen.transformations.standard_transformations import SupercellTransformation
from sys import argv


assert len(argv) in [2, 4, 10]

struc = Structure.from_file('POSCAR')

if len(argv) == 2:
    st = SupercellTransformation.from_scaling_factors(argv[1], argv[1], argv[1])
elif len(argv) == 4:
    st = SupercellTransformation.from_scaling_factors(argv[1], argv[2], argv[3])
elif len(argv) == 10:
    scaling_matrix = [[argv[1], argv[2], argv[3]], [argv[4], argv[5], argv[6]],
                      [argv[7], argv[8], argv[9]]]
    st = SupercellTransformation(scaling_matrix)

super_struc = st.apply_transformation(struc)
super_struc.to('POSCAR_super')

This script assumes that there is a POSCAR file in the current directory and will make the necessary supercell depending on the command line arguments. For example,

  • python script.py 4 will make a $4 \times 4 \times 4$ supercell
  • python script.py 1 2 3 will make a $1 \times 2 \times 3$ supercell
  • you can also just type out all 9 entries of the supercell matrix desired

This can easily be adapted for other file types, and be made an executable to be called conveniently from any directory (see here).

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .