For background, I have never used VASP before and have limited knowledge of how the software works. I am working on a program for the automation of structural creation for 2D materials. I am more of a computer scientist then a computational chemist and someone else is employing all my programs for their VASP optimizations and band width calculations.

Currently, my program takes in coordinates for metal centers, organic linkers, etc... and, along with some other user defined parameters, writes a .xyz file for the desired periodic structure. The coordinates from my program are extracted and another program (that I did not write) uses them to write a POSCAR file. However, when the periodic structure is visualized in VESTA with the unit cell vertices, the structure is not centered in the unit cell. At this point, I was asked to make a series of geometrical transformations to the original file in order to get the structure to the desired location.

I proposed that we adjust the lattice vectors/parameters to center it based off of the periodic structure coordinates as opposed to using the same lattice parameters and transforming each structure individually, as the former might be more efficient. However, I was told that this is not possible.

Here is my question

Is it possible to define the vertices of the unit cell around the structural coordinates?

If the situation or question is unclear, I can try and explain it better with diagrams or pictures, however, I apologize in advance as my knowledge in this subject is very limited.


I did not make these in VASP or VESTA but just made some pictures in Microsoft word to represent the situation as I don't have access to my lab computer right now. Hopefully this makes the question more clear.

enter image description here

It initially looks like this when the structure and unit cell vertices are rendered in VESTA. Then, after essentially doing guess and check transformations with the original .xyz file, the structure is transformed to look like this.

enter image description here

So instead of transforming the initial structure, is it possible to change the origin of the basis set for the unit cell vertices (i.e. move the box down and center it based off of the initial molecular coordinates provide.

  • 2
    $\begingroup$ Kindly provide input file or image for better illustration. $\endgroup$ Nov 30, 2021 at 8:29

1 Answer 1


There some very important points to address here.

In a periodical structure, the atom coordinates and the cell parameters are not randomly selected. The crystal structure (atom positions, cell parameters, spacial group) are determined by X ray/neutron crystallographic using single crystal or powders. The atoms are placed in the so called Wyckoff positions. These are special position that, after applying symmetry operations, you reproduce the crystal periodicity.

A second point here is that the XYZ file format doesn't have information about crystal periodicity. This imply that if you start with a file with this information (like CIF file, for example), when you convert it, the periodic information is lost.

The only justification to put the atom coordinates centered in the cell is if you are using non-periodic system (like molecules) and wants/needs to use periodic design software (like VASP) to run the calculations. In this case, you can just do something like this:

  • Calculate the minimum/maximum for each coordinate, for example $X_{min}$ and $X_{max}$.
  • Calculate the distance between this two extremes $d_X = X_{max} - X_{min}$. This will give you an idea of the size of the cell in the $x$ direction.
  • For molecular systems (non periodical by nature), you will need to add some vacuum space in each direction in order to avoid image interaction (a molecule from one cell interacting with the molecule of all other neighbor cells). Now you have full length for $x$ direction, $d_a$.
  • Change the $X$ coordinates of atoms, moving them to the center of the cell (you already know the lower/higher $X$ values, so, you can add/subtract the vacuum layer size).
  • When creating the POSCAR, use the modified XYZ and the $d_a$ calculated before.
  • $\begingroup$ thank you for answering my question and clearing up some of the inadequacy's in my knowledge. Just to be clear, molecular systems, such as the one I edited into my question, are considered non-periodic? $\endgroup$
    – user1441
    Nov 30, 2021 at 18:19
  • 1
    $\begingroup$ In theory, a periodic system will extend from $-\infty$ to $\infty$ in three directions $X,Y,Z$. It occupies the whole space starting from the unit cell and after applying the symmetry operation. A molecular system doesn't have periodicity, it occupies a limited region in space. The issue here is that you can use a software designed for periodic system to calculate non-periodic (isolated/molecular system): using the trick of using fake periodic system: you create a big unit cell and add the molecule to the center of it. Some software are clever enough to identify the system as molecular. $\endgroup$
    – Camps
    Nov 30, 2021 at 22:37

You must log in to answer this question.