Dear users and developers,
I’d like to get spacegroup,magnetic ordering, and total magnetization by using the Materials Project API with this:
from pymatgen.ext.matproj import MPRester
import pandas as pd
from flatten_dict import flatten
fields = [
“ordering”, ‘formula_pretty’, ‘material_id’, “spacegroup”, ‘total_magnetization’
]
with MPRester(“xxx”) as mpr:
docs = mpr.materials.summary.search(elements = [“Ti”],
fields=fields)
flattened = [{
k: v
for k, v in flatten(doc.dict(), reducer=“dot”).items()
if k != “fields_not_requested”
} for doc in docs]
df = pd.DataFrame.from_records(flattened)
df = df.drop(columns=[col for col in df if col not in fields])
df.to_csv(‘Ti.csv’)
However, the csv file got “ordering”, ‘formula_pretty’, ‘material_id’, ‘total_magnetization’, it just doesnot have “spacegroup”
Is there anything wrong? I’ve tried “spacegroup”,“spacegroup_symbol” and “spacegroup.symbol”, but didn’t work.
Please help me with that.
Thanks a lot