From 2cf79b2077afe08f883cb3444e5ab144d4812286 Mon Sep 17 00:00:00 2001 From: Shyam D Date: Fri, 25 Jun 2021 17:20:01 -0700 Subject: [PATCH] remove charges in composition otherwise not bsonable --- emmet-core/emmet/core/structure.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/emmet-core/emmet/core/structure.py b/emmet-core/emmet/core/structure.py index 0c63437f09..a64cb8656c 100644 --- a/emmet-core/emmet/core/structure.py +++ b/emmet-core/emmet/core/structure.py @@ -85,13 +85,15 @@ def from_composition( if fields is None else fields ) + composition = composition.remove_charges() + elsyms = sorted(set([e.symbol for e in composition.elements])) data = { "elements": elsyms, "nelements": len(elsyms), "composition": composition, - "composition_reduced": composition.reduced_composition, + "composition_reduced": composition.reduced_composition.remove_charges(), "formula_pretty": composition.reduced_formula, "formula_anonymous": composition.anonymized_formula, "chemsys": "-".join(elsyms), @@ -126,7 +128,7 @@ def from_structure( if fields is None else fields ) - comp = structure.composition + comp = structure.composition.remove_charges() elsyms = sorted(set([e.symbol for e in comp.elements])) symmetry = SymmetryData.from_structure(structure)