-
Notifications
You must be signed in to change notification settings - Fork 66
Dynamically update edge names #511
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,8 @@ def get_site_scene( | |
| legend: Legend | None = None, | ||
| retain_atom_idx: bool = False, | ||
| total_repeat_cell_cnt: int = 1, | ||
| edge_weight_name: str = "bond order", | ||
| edge_weight_unit: str = "", | ||
| ) -> Scene: | ||
| """Get a Scene object for a Site. | ||
|
|
||
|
|
@@ -74,6 +76,8 @@ def get_site_scene( | |
| legend (Legend | None, optional): Defaults to None. | ||
| retain_atom_idx (bool, optional): Defaults to False. | ||
| total_repeat_cell_cnt (int, optional): Defaults to 1. | ||
| edge_weight_name (str, optional): Defaults to "bond order". | ||
| edge_weight_unit (str, optional): Defaults to "". | ||
|
|
||
| Returns: | ||
| Scene: The scene object containing atoms, bonds, polyhedra, magmoms. | ||
|
|
@@ -192,7 +196,11 @@ def get_site_scene( | |
|
|
||
| for idx, connected_site in enumerate(connected_sites): | ||
| if show_bond_order and connected_site.weight is not None: | ||
| name_cyl = f"bond order:{connected_site.weight:.2f}" | ||
| if edge_weight_name is None: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We might want to keep the default behavior unchanged. This is also not ideal, as if you want to show "weight", then it will always be "bond order." Something to think about is using another key-value mapping for better customization
|
||
| edge_weight_name = "bond order" | ||
| name_cyl = f"{edge_weight_name}:{connected_site.weight:.2f}" | ||
| if edge_weight_unit: | ||
| name_cyl += f" ({edge_weight_unit})" | ||
|
|
||
| if show_bond_length and connected_site.dist is not None: | ||
| name_cyl += f"\nbond length:{connected_site.dist:.3f}" | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.