pymatgen.core.ion module

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

Bases: monty.json.MSONable

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

alphabetical_formula

Returns a reduced formula string with appended charge

anonymized_formula

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

as_dict()[source]
Returns:dict with composition, as well as charge
charge

Charge of the ion

composition

Return composition object

formula

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().

Parameters:d – {symbol: amount} dict.
static from_formula(formula)[source]
reduced_formula

Returns a reduced formula string with appended charge.

to_reduced_dict

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