janosh / pymatviz

A toolkit for visualizations in materials informatics.
https://janosh.github.io/pymatviz
MIT License
144 stars 13 forks source link

[Enhancement] Sunburst plots of coordination numbers and environments #135

Open kaueltzen opened 2 months ago

kaueltzen commented 2 months ago

Hi,

thank you for this amazing repository!

I have code for sunburst plots of coordination number and environment distributions within a dataset and was wondering if you are interested in adding that to pymatviz.

For example, the figure above shows the CN (inner ring) and CE (outer ring) distribution of all elemental carbon structures in the MaterialsProject. The CEs are encoded as in the ChemEnv module of pymatgen.

The code could be structured similar to your spacegroup_sunburst() function and either accept a sequence of coordination environments OR Structure objects and a neighbor determination algorithm and its parameters. In pymatgen, the CEs as encoded above are currently only available from ChemEnv strategies, but I'm working on the inclusion of other neighbor determination algorithms from the localenv module.

Also, this CN and CE sunburst function would have some normalization bool parameter (whether to set the sum of all CEs within a structure to 1 to avoid overrepresentation of larger structures or whether absolute occurrences are counted).

Let me know what you think!

janosh commented 2 months ago

that's a great idea, thanks @kaueltzen! a PR would be much appreciated. would be interesting to plot this figure for the GNoME dataset (CC @esoteric-ephemera 😄)

out of curiosity, what are the 6% zero-coordinated carbons in MP?

kaueltzen commented 2 months ago

Hi @janosh thanks for the quick reply and your interest! It will take some time though as I now first want to finish including and testing other neighbor determination algorithms than the modified Voronoi approach into ChemEnv.

The neighbors were determined with a simple distance-based approach based on the atomic radius and bonds that differ significantly from 2*atomic radius are not considered, like in mp-1056957. Of course one could discuss if another strategy is better suited to depict the bonding situation in this dataset!

janosh commented 1 month ago

@kaueltzen i should mention that draft/WIP PRs are welcome. if you have partial/unpolished code, feel free to open a PR anyways and point out areas that you think need more work. i and perhaps @DanielYang59 would be happy to help 😄

DanielYang59 commented 1 month ago

With pleasure :)