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

in-place modifications might struggle with colors and radii #522

Closed
PythonFZ opened this issue Jun 25, 2024 · 0 comments · Fixed by #524
Closed

in-place modifications might struggle with colors and radii #522

PythonFZ opened this issue Jun 25, 2024 · 0 comments · Fixed by #524

Comments

@PythonFZ
Copy link
Member

If you change species and positions of an Atoms in place, the colors and radii might not be correct.

ZnDraw/zndraw/utils.py

Lines 104 to 121 in 884741e

if "colors" not in obj.arrays:
arrays["colors"] = [rgb2hex(jmol_colors[number]) for number in numbers]
else:
arrays["colors"] = (
obj.arrays["colors"].tolist()
if isinstance(obj.arrays["colors"], np.ndarray)
else obj.arrays["colors"]
)
if "radii" not in obj.arrays:
# arrays["radii"] = [covalent_radii[number] for number in numbers]
arrays["radii"] = [get_scaled_radii()[number] for number in numbers]
else:
arrays["radii"] = (
obj.arrays["radii"].tolist()
if isinstance(obj.arrays["radii"], np.ndarray)
else obj.arrays["radii"]
)

  • How should we handle this? If the length mismatches, just recompute all?
@PythonFZ PythonFZ linked a pull request Jun 26, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant