Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior for retrieving average volume when not found in database #1045

Open
abhijeetgangan opened this issue Nov 6, 2024 · 3 comments
Open

Comments

@abhijeetgangan
Copy link

The get_average_volume_from_database method returns ZeroDivisionError: division by zero when the composition is not found in the lookup table.

if (avg_vol := get_entry_from_dict(chem_env_key)) is not None:
     vols.append(avg_vol["avg_vol"] * avg_vol["count"])
     counts += avg_vol["count"]

This is because there is no fall back method when the composition isn't found and the counts and vol are both zero. A default would be using something like the Vegard's law where the volumes can be obtained with the single element structures.

Error when using the Composition("Ag50 Nb50"):

get_average_volume_from_database
    return sum(vols) / counts
           ~~~~~~~~~~^~~~~~~~
ZeroDivisionError: division by zero

@esoteric-ephemera
Copy link
Contributor

esoteric-ephemera commented Nov 7, 2024

If you take a look at get_average_volume_from_database, you can see that the default fallback is to use something like Vegard's law. We basically reweight the volume by composition / relative statistical count

For this method to fail, an element would have to be missing from the reference data entirely. What elements have you observed this behavior with?

@abhijeetgangan
Copy link
Author

It happens when using the cached version of the lookup table for Ag and Nb. Both avg_vol["count"] and avg_vol["avg_vol"] return zero.

@esoteric-ephemera
Copy link
Contributor

Are you maybe using an out of date version of the reference data? When I run the following:

from atomate2.common.jobs.mpmorph import _get_average_volumes_file

avg_vols = _get_average_volumes_file()
print(avg_vols[[ce in ("Ag","Nb") for ce in avg_vols["chem_env"]]])

I get non-empty entries:

      chem_env  with_oxi    avg_vol  count source
56326       Nb     False  18.022948     17   icsd
56830       Ag     False  16.986225     25   icsd
66755       Nb     False  18.592124     11     mp
92218       Ag     False  17.766298     14     mp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants