Closed janosh closed 1 year ago
I think the fix is just to use el.symbol instead? Most of the time the compatibility is operated on MP entries. Most of which don't come with oxidation state decorated.
Yes, the fix is straightforward. Just baffled that it hasn't come up before.
I'm surprised this didn't come up before. Opening this issue rather than quietly fixing to make sure I'm not missing something. It appears
MaterialsProject2020Compatibility
doesn't currently handle oxidation states.The above correction fails because this line
https://github.com/materialsproject/pymatgen/blob/edd80a85d61d06ec02c183950c5ed8fb7c0ec0bd/pymatgen/entries/compatibility.py#L175
uses the
Element.__str__
(which includes oxidation state e.g.O2-
) rather thansymbol
to match dict keys which are element symbols.
```cif # generated using pymatgen data_LiMnO2 _symmetry_space_group_name_H-M 'P 1' _cell_length_a 2.86877900 _cell_length_b 4.63447500 _cell_length_c 5.83250700 _cell_angle_alpha 90.00000000 _cell_angle_beta 90.00000000 _cell_angle_gamma 90.00000000 _symmetry_Int_Tables_number 1 _chemical_formula_structural LiMnO2 _chemical_formula_sum 'Li2 Mn2 O4' _cell_volume 77.54484024 _cell_formula_units_Z 2 loop_ _symmetry_equiv_pos_site_id _symmetry_equiv_pos_as_xyz 1 'x, y, z' loop_ _atom_type_symbol _atom_type_oxidation_number Li+ 1.0 Mn3+ 3.0 O2- -2.0 loop_ _atom_site_type_symbol _atom_site_label _atom_site_symmetry_multiplicity _atom_site_fract_x _atom_site_fract_y _atom_site_fract_z _atom_site_occupancy Li+ Li0 1 0.50000000 0.50000000 0.37975050 1 Li+ Li1 1 0.00000000 0.00000000 0.62024950 1 Mn3+ Mn2 1 0.50000000 0.50000000 0.86325250 1 Mn3+ Mn3 1 0.00000000 0.00000000 0.13674750 1 O2- O4 1 0.50000000 0.00000000 0.36082450 1 O2- O5 1 0.00000000 0.50000000 0.09851350 1 O2- O6 1 0.50000000 0.00000000 0.90148650 1 O2- O7 1 0.00000000 0.50000000 0.63917550 1 ```o-LiMnO2_unit.cif