Compatibility issue

Having an issue with the compatibility of a compound that I haven’t resolved yet which I figured I’d raise while I continue working on it.

mp-26689’s document shows {“is_compatible”: True}, but when trying to process it using MaterialsProjectCompatibility throws a CompatibilityError, here’s a MWE:

from pymatgen import MPRester
from pymatgen.entries.compatibility import MaterialsProjectCompatibility
from pymatgen.entries.computed_entries import ComputedEntry

# Fetch data
props = ["run_type", "is_hubbard", "pseudo_potential", "elements",
         "hubbards", "potcar_symbols", "oxide_type", "chemsys", "is_compatible",
         "energy", "unit_cell_formula", "task_id", "pretty_formula"]
with MPRester() as mpr:
    data = mpr.query({"task_id": "mp-26689"}, props)[0]
assert data['is_compatible']

# Construct computed entry with params
data["potcar_symbols"] = [
    "%s %s" % (data["pseudo_potential"]["functional"], l)
    for l in data["pseudo_potential"]["labels"]]
ce_data = {"oxide_type": data["oxide_type"]}
entry = ComputedEntry(
    data["unit_cell_formula"], data["energy"], parameters=data,
    data=data, entry_id=data["task_id"])

# Try processing compatibility
compat = MaterialsProjectCompatibility()
# This raises CompatibilityError because U on O is 3.25

This is related to a known issue with U values being permuted when being retrieved via the website… the U shouldn’t be on the O. In other words, the original calculation/task is compatible, but there’s a build error where site attributes get swapped in the structure that gets attached to the material collection.