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

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

Returns a reduced formula string with appended charge

property anonymized_formula

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

as_dict()[source]
Returns

dict with composition, as well as charge

property charge

Charge of the ion

property composition

Composition of ion.

property 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.

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

Creates Ion from formula.

Parameters

formula

Returns

Ion

property reduced_formula

Returns a reduced formula string with appended charge.

property to_reduced_dict

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