Primitive cell - any way to access?

There doesn’t seem to be any way to access primitive cells on Materials Project anymore. e.g. see:

  1. Web display –> conventional cell. There is an option to switch the cell to primitive cell but the atom positions are not updated. The number of atoms in the cell is also not updated, so the information displayed is inconsistent.
  2. Download options –> the crystal viewer gives 6 download options, ALL of them are the conventional cell.

Yes, as far as I know, MP doesn’t have a way to download the prim cell via GUI.
I typically rely on the following two ways to access the prim cell:

  1. Use mp-api (check the attached code below)
  2. use phonopy’s CLI to convert the conventional cell to prim cell using the following command –> phonopy --symmetry

Code to get the prim cell using mp-api:

from mp_api.client import MPRester
from pymatgen.io.vasp import Poscar
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer

API_KEY = "YOUR_API_KEY"

mpid = "mp-149"

with MPRester(API_KEY) as mpr:
        # Get the structure (this is already primitive by default)
        structure = mpr.get_structure_by_material_id(mpid)

# Write Primitive POSCAR
prim_poscar = Poscar(structure)
prim_poscar.write_file("POSCAR_prim")

# Convert to conventional standard cell
sga = SpacegroupAnalyzer(structure)
conv_structure = sga.get_conventional_standard_structure()

# Write Conventional POSCAR
conv_poscar = Poscar(conv_structure)
conv_poscar.write_file("POSCAR_conv")
1 Like

Thanks @hrushi_s - to clarify, I am familiar with using the API … this more of a note to the MP team to restore primitive cell display and download options on the web page.

2 Likes

@Min-Hsueh_Chiu just tagging you so you’re aware of this

1 Like

A few other notes:

  1. Awhile back the primitive cell display was the default on the web page, and there was no way to display the conventional cell. I am OK with the default view now being the conventional cell, but there should also be a way to show the primitive cell. The display of primitive cell lattice vectors only is not a good solution because the atom positions / atom count is now actually wrong.

  2. For the export of Crystal Toolkit, I believe the previous behavior was:
    i. CIF (symmetrized) = conventional
    ii. CIF –> primitive
    iii. POSCAR –> primitive
    iv. Prismatic –> I don’t know
    vi. VASP Input Set –> primitive

Not everything necessarily needs to change back, I don’t have strong opinions. However, at the very least option (ii) should say “CIF (primitive)” and return the primitive cell to distinguish it from option (i).

1 Like

@Anubhav_Jain Thanks for the report and suggestions!

@hrushi_s Thanks for providing an alternative method for downloading prim cell!

  1. Displaying the atom positions according to the unit cell has been disabled due to the report being brittle, but I am working on displaying the correct atom positions.
  2. The export behavior has been fixed and will be included in the next deployment. The downloaded data will match the selected unit cell type and be exported in the desired file format.

We’ve updated our website and plan to release the changes in the next deployment (likely in about two weeks).

In the crystal visualizer section, users can switch between different unit cell types and download the structure in their preferred file format.

In the Crystal Structure table section, the displayed data is independent of the visualizer. To avoid confusion, we’ve renamed “Atomic Position” to “Wyckoff Position.” The corresponding Wyckoff positions will update according to the selected unit cell in this section.

Great, thank you!

1 Like