Hi, is there a way to use an mpquery or a similar command to get all the battery materials in the battery explorer (note, I want to do this without inputting any battid or formulas as in the answer using mpr.get_battery_data = get_battery_data(compound))
Sure. Try mpr._make_request('/battery/all_ids')
to get a list of battid
s.
Thanks! Is there also a comparable request to get all the ids (mp and mvc) from the materials explorer? I tried to extrapolate the batteryid request but no success.
I was trying to get all the sodium ion batteries from the battery explorer, by doing this:
get_battery_id = API._make_request(‘/battery/all_ids’)
print(f"Battery Id: {get_battery_id}")
criteria = {
‘elements’:{‘$in’:get_battery_id},
‘elements’:{‘$in’:[“Na”]}
}
I did not get the data I wanted. Maybe there’s something wrong with the criteria.
please refer to the replies to this forum question for guidance on how to retrieve the battery data through our new API.
HTH
Patrick
Hi @tschaume
I already solve the problem:
all_bat_ids_list = (mpr._make_request(‘/battery/all_ids’))
all_battery_dataframe = pd.DataFrame([])
for batt_id in all_bat_ids_list:
if (batt_id.contains(‘_Na’)):
result_bat_id = pd.DataFrame(mpr.get_battery_data(batt_id))
adj_pairs = result_bat_id['adj_pairs']
adj_pairs_list = list(adj_pairs)
in_list = pd.DataFrame(list(adj_pairs_list[0]))
max_d_vol = pd.DataFrame(in_list['max_delta_volume'])
result_bat_id['Max Delta Volume'] = max_d_vol
all_battery_dataframe = all_battery_dataframe.append(result_bat_id)
all_battery_dataframe.rename(columns = {'battid':'Battery ID',
'reduced_cell_formula':'Reduced Cell Formula',
'average_voltage':'Average Voltage (V)',
'min_voltage':'Min Voltage (V)',
'max_voltage':'Max Voltage (V)',
'nsteps':'Number of Steps',
'min_instability':'Min Instability',
'capacity_grav':'Gravimetric Capacity (units)',
'capacity_vol':'Volumetric Capacity',
'working_ion':'Working Ion',
'min_frac':'Min Fraction',
'max_frac':'Max Fraction',
'reduced_cell_composition':'Reduced Cell Composition',
'framework':'Framework',
'adj_pairs':'Adjacent Pairs',
'spacegroup':'Spacegroup',
'energy_grav':'Gravemetric Energy (units)',
'energy_vol':'Volumetric Energy',
'numsites':'Number of Sites',
'type':'Type'}, inplace = True)
clean_battery_df = all_battery_dataframe.set_index('Battery ID')
return clean_battery_df
As I am working only with Na ion batteries materials development, I took the data from it, and process to predict the highest gravimetric energy and capacity.