Skip to content

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

@abhijeetgangan

Description

@abhijeetgangan

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions