-
Notifications
You must be signed in to change notification settings - Fork 25
element_pair_rdfs
plots radial distribution functions (RDFs) for element pairs in a structure
#203
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
element_pair_rdfs
plots radial distribution functions (RDFs) for element pairs in a structure
slightly more elaborate example from matminer.datasets import load_dataset
import pymatviz as pmv
from pymatviz.enums import Key
pmv.set_plotly_template("pymatviz_white")
df_phonons = load_dataset("matbench_phonons")
# get the 2 largest structures
df_phonons[Key.n_sites] = df_phonons[Key.structure].apply(len)
# plot element-pair RDFs for each structure
for struct in df_phonons.nlargest(2, Key.n_sites)[Key.structure]:
fig = pmv.element_pair_rdfs(struct, n_bins=100, cutoff=10)
formula = struct.formula
fig.layout.title.update(text=f"Pairwise RDFs - {formula}", x=0.5, y=0.98)
fig.layout.margin = dict(l=40, r=0, t=50, b=0)
fig.show()
pmv.save_fig(fig, f"element-pair-rdfs-{formula.replace(' ', '')}.svg") |
janosh
added a commit
that referenced
this pull request
Sep 20, 2024
* `element_pair_rdfs` plots radial distribution functions (RDFs) for element pairs in a structure (#203) * improve set_plotly_template auto-complete with Literal type * add element_pair_rdfs(structure) -> go.Figure in new pymatviz/rdf.py module * add tests/test_rdf.py * remove ase.Atoms conversion to avoid new pkg dep * show element_pair_rdfs examples in readme * should have used save_and_compress_svg * fix rds svg path --------- Co-authored-by: Janosh Riebesell <[email protected]>
janosh
added a commit
that referenced
this pull request
Mar 28, 2025
…ement pairs in a structure (#203) * improve set_plotly_template auto-complete with Literal type * add element_pair_rdfs(structure) -> go.Figure in new pymatviz/rdf.py module * add tests/test_rdf.py * remove ase.Atoms conversion to avoid new pkg dep * show element_pair_rdfs examples in readme * should have used save_and_compress_svg
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
minimal example