Wrong structures with new API/db

Hey @gornit, keep in mind that the representation of a crystal is nonunique. The particular cells for both bcc Fe and Co that you identified are neither a primitive cell nor the conventional cell (the primitive cell is also nonunique, e.g., you could choose the Wigner-Seitz cell over one that’s easiest to write down by hand).

Also important: the cell presented by MP can contain any number of repeat units in a “non-standard” representation of the cell. We do not show a unit cell nor the conventional cell by default.

To see this, try the following:

from mp_api.client import MPRester

with MPRester("your_api_key") as mpr:
    summary_docs = mpr.materials.summary.search(material_ids=["mp-13","mp-90"])

mp_structures = {
    str(doc.material_id): doc.structure
    for doc in sorted(summary_docs, key = lambda sdoc: sdoc.material_id)
} # get structures indexed by MPID and sort in ascending order

conventional_cells = {
    mpid : structure.to_conventional()
    for mpid, structure in mp_structures.items()
}

primitive_cells = {
    mpid : structure.get_primitive_structure()
    for mpid, structure in conventional_cells.items()
}

When you print conventional_cells, you see clear bcc structures:

{'mp-13': Structure Summary
 Lattice
     abc : 2.863035498949916 2.863035498949916 2.863035498949916
  angles : 90.0 90.0 90.0
  volume : 23.468222587900303
       A : 2.863035498949916 0.0 1.75310362981713e-16
       B : -1.75310362981713e-16 2.863035498949916 1.75310362981713e-16
       C : 0.0 0.0 2.863035498949916
     pbc : True True True
 PeriodicSite: Fe (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]
 PeriodicSite: Fe (1.432, 1.432, 1.432) [0.5, 0.5, 0.5],
 'mp-90': Structure Summary
 Lattice
     abc : 2.968899355116029 2.968899355116029 2.968899355116029
  angles : 90.0 90.0 90.0
  volume : 26.16895775704032
       A : 2.968899355116029 0.0 1.817926546116743e-16
       B : -1.817926546116743e-16 2.968899355116029 1.817926546116743e-16
       C : 0.0 0.0 2.968899355116029
     pbc : True True True
 PeriodicSite: Cr (0.0, 0.0, 0.0) [0.0, 0.0, 0.0]
 PeriodicSite: Cr (1.484, 1.484, 1.484) [0.5, 0.5, 0.5]}

(The various 1e-16 values are rounding errors, you can safely treat these as zero.)

The same goes for primitive_cells. You can confirm this by getting the space group of any of the structures:

mp_structures["mp-13"].get_space_group_info()
>>> ('Im-3m', 229)
conventional_cells["mp-13"].get_space_group_info()
>>> ('Im-3m', 229)
primitive_cells["mp-13"].get_space_group_info()
>>> ('Im-3m', 229)
1 Like