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

Avoid black sphere in structure viewer #637

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

superstar54
Copy link
Member

@superstar54 superstar54 commented Oct 8, 2024

Fix #633 .
In the case of a structure with only one atom, the structure viewer shows a black sphere. As shown below:
Screenshot from 2024-10-08 13-35-31

This could be because of the overlap between the atoms and the control of the viewer. This PR implements a quick solution by shifting the center of the control in z direction by 1. Now the viewer shows:
Screenshot from 2024-10-08 13-32-03

@superstar54 superstar54 linked an issue Oct 8, 2024 that may be closed by this pull request
@superstar54
Copy link
Member Author

The failed test is related to the query of the Crystallography Open Database, thus it is not related to this PR.

@danielhollas
Copy link
Contributor

Just wondering, is this a bug that should be reported upstream? I.e. is this an nglview problem?

@superstar54
Copy link
Member Author

Just wondering, is this a bug that should be reported upstream? I.e. is this an nglview problem?

I am not sure if it is a bug or not. The problem is that we call the center method after drawing the atoms and bonds. If we use the default setting, the nglview shows the correct atoms, but the view is not centered.
Anyway, I opened an issue and waited for other's options.

Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 83.43%. Comparing base (152c2bb) to head (3ee8fcb).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
aiidalab_widgets_base/viewers.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #637      +/-   ##
==========================================
- Coverage   83.50%   83.43%   -0.07%     
==========================================
  Files          17       17              
  Lines        3546     3550       +4     
==========================================
+ Hits         2961     2962       +1     
- Misses        585      588       +3     
Flag Coverage Δ
python-3.11 83.43% <25.00%> (-0.07%) ⬇️
python-3.9 83.47% <25.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@danielhollas danielhollas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a particularly pretty workaround, but if it works let's ship it :-)

@superstar54 superstar54 merged commit 1f400bc into aiidalab:master Oct 21, 2024
11 checks passed
@superstar54 superstar54 deleted the fix/633/fix_black_sphere branch October 21, 2024 17:05
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 this pull request may close these issues.

black sphere for a primitive cell with single atom
2 participants