Making Supercells for VASP

I often get questions on how to make supercells for VASP calculations. The problem is typically that you have a structure in a POSCAR file and then want to expand it to a bigger supercell to study e.g. defects. There are many programs available that can perform this task, like PHON and Phonopy, and if you google, you can find many scripts, usually called “vasputil” that can do this task specifically. Many people in your research group have probably written their own program as well.

What I really recommend, however, is to not reinvent the wheel and instead use already available libraries to analyze and work with your ab initio calculations. One such library is the Atomic Simulation Environment (ASE) for Python, which supports many programs, including VASP. With ASE, you can do really cool stuff like making small Python programs which read your VASP input/output and then work on them programmatically. In fact, with ASE, it is almost trivial to make supercells. You can do it with 3 lines of Python code:

cell ="POSCAR")"POSCAR.4x4x4",cell*(4,4,4), label='444supercell',direct=True,sort=True)

The code above reads a POSCAR file in the current working directory, transforms it to a 4x4x4 supercell and writes the results to disk as “POSCAR.4x4x4”. Note that to run this on Triolith, you need to have the ASE module loaded

module load ase/3.6.0

I thought this trick might be useful, so I made a script that can perform this procedure available in the vasptools module on Triolith. The script is called supersize and takes a POSCAR file as the first argument, and the supercell sizing as the second:

$ supersize POSCAR 4x4x4

The output is a new POSCAR file called “POSCAR.4x4x4” containing the supercell repeated 4 times in a,b,c directions.