How to get the charge of an inorganic compound

I have a list of crystal structures and I use pymatgen “Structure” to read each crystal and I use the charge property function to get the charge of the crystal. But I thought I always get the zero for each crystal.

Did I do something incorrect in this manner? Because obviously, some are not charge neural. For example some materials have three metal elements in the formulas.


Can anybody show me an example code for calculating chrage?

Charge is a property you give the structure object, not something intrinsic to a specific structure. It might have preferred charge states, but these require DFT calculations to find the relative energy orderings.

Just because a compound has 3 metal ions doesn’t mean it’s not charge neutral. There are plenty of known metallic compounds with multiple metallic elements such as the binary inter-metallics.

Thanks. I think I knew how to do this.