Getting conventional unit cell instead of primitive

I see in the API documentation that one can obtain cif or structure for a group of materials queried. However, both these give the primitive unit cell of materials. Is there a way to get the conventional unit cell parameters like a, b, c, alpha, beta, gamma since the Miller index notation is generally based on the conventional unit cell. In other words, is there an API implementation for the get_conventional_standard_structure that appears just below the structure when one opens a material in materials project website?

Also, is the Miller index notation used under the section Substrates based on the conventional unit cell?

Hi Ahmad,

I don’t know whether there’s a way to get the conventional cell structure directly using the API, but pymatgen can determine the conventional cell using its interface to spglib in the SpacegroupAnalyzer class. The snippet below gets the conventional structure:

from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
from pymatgen import MPRester

structure = mpr.get_structure_by_material_id("mp-149")

sga = SpacegroupAnalyzer(structure)
conventional_structure = sga.get_conventional_standard_structure()

The substrate analyzer (and the surface data for metals) does indeed use miller index corresponding to the conventional cell, rather than the primitive.


Thank you, Joseph for the method.

I have one more important question. I was wondering if the calculated elastic tensor components that I get from the MP database are based on the conventional cell lattice vectors. For example, is the component C11 of the elastic tensor based on stretching x-direction of the conventional lattice (1st row of the matrix obtained using conventional_structure.lattice.matrix), and similarly for the other components.

EDIT (Jan 2): In the paper it is mentioned in Table 1 row 2 that elastic_tensor is based on the IEEE format but elastic_tensor_original is based on the poscar file. Since the calculations in that paper were based on the conventional cell, can I assume when I download elasticity data from the materials project API, the elastic_tensor_original is based on the conventional cell of the downloaded primitive cell (converted using pymatgen).

Thanks for your time.

Yes, the “elastic_tensor_original” is derived from the conventional cell converted from the primitive cell, exactly as you’ve said. There’s a bit more information in the calculations guide as well.

Just FYI, In the coming months this may be changing (we may be switching to a rotated version of the primitive cell, rather than the conventional cell, since it seems that the primary issue in the conventional/primitive discrepancy is actually the implicit change of the cartesian basis vectors, and thus inequivalent deformations). If it does, we’ll likely be providing the explicit structure used for the elastic computation in the data to avoid any ambiguity.

1 Like

Hi Ahmad,

If you are using the MPRester to access the MAPI, the get_entries() and other related methods now have an optional boolean parameter called conventional_unit_cell (False by default). Setting it to True will return a ComputedStructureEntry with the conventional unit cell instead of the primitive cell.