nglviewer / ngl

WebGL protein viewer
http://nglviewer.org/ngl/
MIT License
664 stars 169 forks source link

NGL shows white color for this cif #950

Closed hainm closed 10 months ago

hainm commented 1 year ago

Dear all, how are you doing?

One of nglview's users gets issue with color of his cif file (I am attaching here).

image

V4GaSe8.cif.txt

Do you have any suggestion? Thanks PS: nglview issue is here: https://github.com/nglviewer/nglview/issues/1039

ppillot commented 1 year ago

White is the default element color when the element is unrecognized. I have had a look at the parser code for core CIF files (i.e. not mmCIF files) and it appears that the element name is taken from _atom_site_type_symbol without processing. In the case of the file you provided, that means that V3.25+ will be used as element name in lieu of V, and it won't be recognized as a known element further down. The fix shall be easy to make and we may as well infer the formal charge value (though it might be preferable to get it from the _atom_type loop)

hainm commented 1 year ago

Thanks @ppillot

ppillot commented 10 months ago

Fixed:

image