New issues with materialsvirtuallab notebook and cohesive energy

Hi

For my research I am often looking for cohesive energies of compound, which I need to interrogate the API for. In the past I simply launch a notebook using:

https://hub.gke2.mybinder.org/user/materialsvirtuallab-matgenb-yauaypxc/lab/workspaces/auto-B/tree/notebooks/2013-01-01-Getting%20crystal%20structures%20from%20online%20sources.ipynb

I then just modify something for my own purpose and it has always worked fine:

from pymatgen.ext.matproj import MPRester
mpr = MPRester(“insert my ID”)
mpr.get_cohesive_energy(‘mp-6124’, per_atom=True)

Now for some reason as of yesterday I get this issue for cohesive energy

Does anyone know why all of sudden this isn’t working?:


TypeError Traceback (most recent call last)
in
1 # Querying by formula only.
2
----> 3 mpr.get_cohesive_energy(‘mp-6124’, per_atom=True)

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/matproj.py in get_cohesive_energy(self, material_id, per_atom)
1310 Cohesive energy (eV).
1311 “”"
→ 1312 entry = self.get_entry_by_material_id(material_id)
1313 ebulk = entry.energy / entry.composition.get_integer_formula_and_factor()[1]
1314 comp_dict = entry.composition.reduced_composition.as_dict()

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/matproj.py in get_entry_by_material_id(self, material_id, compatible_only, inc_structure, property_data, conventional_unit_cell)
747 inc_structure=inc_structure,
748 property_data=property_data,
→ 749 conventional_unit_cell=conventional_unit_cell,
750 )
751 return data[0]

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/ext/matproj.py in get_entries(self, chemsys_formula_id_criteria, compatible_only, inc_structure, property_data, conventional_unit_cell, sort_by_e_above_hull)
563 with warnings.catch_warnings():
564 warnings.filterwarnings(“ignore”, message=“Failed to guess oxidation states.*”)
→ 565 entries = MaterialsProject2020Compatibility().process_entries(entries, clean=True)
566 if sort_by_e_above_hull:
567 entries = sorted(entries, key=lambda entry: entry.data[“e_above_hull”])

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/entries/compatibility.py in process_entries(self, entries, clean, verbose)
557 processed_entry_list = []
558
→ 559 for entry in PBar(entries, disable=(not verbose)):
560 ignore_entry = False
561 # if clean is True, remove all previous adjustments from the entry

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/util/sequence.py in init(self, total, **kwargs)
36 self.total = total
37 self.done = 0
—> 38 self.report()
39
40 def update(self, amount):

/srv/conda/envs/notebook/lib/python3.7/site-packages/pymatgen/util/sequence.py in report(self)
52 Print progress.
53 “”"
—> 54 print("{} of {} done {:.1%}".format(self.done, self.total, self.done / self.total))
55
56

TypeError: unsupported operand type(s) for /: ‘int’ and ‘list’

I was able to recreate the bug, but only using a notebook running in the matgenb binder hub. I was able to fix the problem by installing the tqdm package, which is used for progress bars:

pip install tqdm

You can run this in terminal, or in Jupyter by using an exclamation point, i.e. !pip install tqdm

Let me know if this works for you?