Error When Using Function to Determine Oxidation States of Structures

I am relatively new to using the API and I am struggling with the get_oxi_state_decorated_structure() function. The image below shows my code and the error associated with it. I looked at the source code and I assume that my structure is in the incorrect format for this function. Despite this I am still unsure about what particular format I need to use and how to reformat the Structure from the MPDataDoc. A similar error occur when using get_cn(), where, despite the site number being defined, will not return coordination information. Any help would be appreciated. Thank you.

You need to instantiate the BVAnalyzer. It’s a simple fix to your code:

from mp_api.client import MPRester
from pymatgen.analysis.bond_valence import BVAnalyzer as BVA

with MPRester(API_KEY) as mpr:
    structure = mpr.get_structure_by_material_id("mp-123")

Main difference is calling BVA() rather than BV in your code.

Thread closed due to inactivity, please open a new thread to address related issues.