Skip to content

Commit

Permalink
remove charges in composition otherwise not bsonable
Browse files Browse the repository at this point in the history
  • Loading branch information
shyamd committed Jun 26, 2021
1 parent 590c503 commit 2cf79b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions emmet-core/emmet/core/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 2cf79b2

Please sign in to comment.