This is a computational chemistry question. I've recently been using the Materials Project API to get VASP input data, that I've been processing. The POSCAR format is as so, for those who do not know: POSCAR

Scaling Factor
Lattice Vector A
Lattice Vector B
Lattice Vector C
etc (Not relevant to question)

On a few rare cases, i get Lattice vectors with negative values in them:

0.872808 2.468674 1.511748
-2.623232 -0.003400 4.543571
1.745616 -2.468674 0.000000

which displays fine using VESTA. Using pymatgen I converted it to a CIF file, which says:

_cell_length_a   3.02349597
_cell_length_b   5.24646459
_cell_length_c   3.02349568

and looks identical to the POSCAR file. However, I do not understand where these values come. For example, Lattice vector A: 0.872808+abs(-2.623232)+1.745616 != 3.02349597.

Seeing as VESTA displays it correctly, and pymatgen converts it correctly, I feel like it is just a concept that I do not understand. I tried googling but found nothing helpful. How do I convert from the given lattice vectors with negative values to absolute values as shown in the CIF format? What is the math behind this?


Use Vector Magnitude/Pythagoras Theorem: sqrt(LatvA[0]^2 + LatvA1^2 + LatvA[2]^2) = 3.02349597

  • $\begingroup$ Ever heard about Pythagorean theorem? Also, vector $\vec a$ is the first row, not first column. Also, welcome to Chem.SE. $\endgroup$ May 31, 2016 at 15:56
  • $\begingroup$ @IvanNeretin Of course..... but that doesn't answer the question. $\endgroup$ May 31, 2016 at 15:59
  • $\begingroup$ The data in your $3\times3$ table are the coordinates of certain vectors. To get the length of a vector from its coordinates, use the said theorem. $\endgroup$ May 31, 2016 at 16:02