Electron number?


I’ve been trying to find an effective way to get the total electron number, which is an important parameter in the code I’m writing. I can get the number like so:
from pymatgen.core.structure import Composition
from pymatgen import MPRester
comp = Composition(“LiFeO4”)
elec = comp.total_electrons

via the Composition library
but is there a way I can get this more simply as an API property let’s say?


Hi @thinkbot101,

The solution you proposed is the best way to get this information, it’s not currently available in the API. It should be fast to generate the total electrons with the code you pasted however.

If it’s ok to ask, what’s the usage of this parameter in your code?