pymatgen.core.ion module

Module containing class to create an ion

class Ion(composition, charge=0.0, properties=None)[source]

Bases: pymatgen.core.composition.Composition, monty.json.MSONable, pymatgen.util.string.Stringify

Basic ion object. It is just a Composition object with an additional variable to store charge. The net charge can either be represented as Mn++, or Mn+2, or Mn[2+]. Note the order of the sign and magnitude in each representation.

Flexible Ion construction, similar to Composition. For more information, please see pymatgen.core.Composition

property alphabetical_formula[source]

Returns a reduced formula string with appended charge

property anonymized_formula[source]

An anonymized formula. Appends charge to the end of anonymized composition


dict with composition, as well as charge

property charge[source]

Charge of the ion

property composition[source]

Composition of ion.

property formula[source]

Returns a formula string, with elements sorted by electronegativity, e.g., Li4 Fe4 P4 O16.

classmethod from_dict(d)[source]

Generates an ion object from a dict created by as_dict().


d – {symbol: amount} dict.

classmethod from_formula(formula: str)pymatgen.core.ion.Ion[source]

Creates Ion from formula.





property reduced_formula[source]

Returns a reduced formula string with appended charge.

to_pretty_string() → str[source]

Pretty string with proper superscripts.

property to_reduced_dict[source]

Returns: dict with element symbol and reduced amount e.g., {“Fe”: 2.0, “O”:3.0}.