Export *cif files from materials Ids

Hello

I have some difficulties to use the new API, in particular to find the information to do one task or another.

For instance, i want to export cif files once I found them.
I use this:

        entries = mpr.materials.summary.search(
            formula=phase,
            fields=["material_id", "formula_pretty", "structure", "spacegroup_number"]
        )
        print(f"Found {len(entries)} entries for phase: {phase}")

        for entry in entries:
            material_id = entry.material_id
            structure = mpr.get_structure_by_material_id(material_id)
            formula = entry.formula_pretty
            filename = formula+material_id+".cif"
            structure.to(filename)
            print(f"Saved CIF for {formula} ({material_id}) as {filename}")

I indeed obtain cif files but they contain P1 information for space group, which then does not corrrspond to what expected.
I would be happy to have a bit of help.

Many thanks in advance
Warm regards from Paris.
Guilhem

2 Likes