Skip to content

Inconsistent results of materials query #964

Open
@fxcoudert

Description

@fxcoudert

Python version

3.12.8

Pymatgen version

2025.1.24

Operating system version

macOS 15.2

Current behavior

The following code:

with MPRester(apikey) as mpr:
    mp_data = mpr.materials.summary.search(
        fields=["material_id", "deprecated", "formula_pretty", "nelements", "structure", "theoretical", "symmetry"]
    )
    print("Number of materials found:", len(mp_data))
    print("Database version", mpr.get_database_version())

returns

Number of materials found: 178580
Database version 2024.12.18

Of these, there are 169385 non deprecated materials, as returned by:

> sum(1 for x in mp_data if not x.deprecated)

This is consistent with the number of the web portal. Good. But now, consider this:

with MPRester(apikey) as mpr:
    mp_data = mpr.materials.summary.search(
        deprecated=False,
        fields=["material_id", "deprecated", "formula_pretty", "nelements", "structure", "theoretical", "symmetry"]
    )
    print("Number of materials found:", len(mp_data))
    print("Database version", mpr.get_database_version())

It is exactly the same query, except I ask for all non deprecated by passing deprecated=False. But it now returns:

Number of materials found: 153902
Database version 2024.12.18

Expected Behavior

I expect the two routes to return the same number (and same list) of non deprecated materials.

Minimal example

Relevant files to reproduce this bug

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions