nglview icon indicating copy to clipboard operation
nglview copied to clipboard

get ase structure from view

Open dou-du opened this issue 4 years ago • 3 comments

I am wondering it is possible to get molecular structure or coordinates easily from view. For example:

from ase.build import molecule
import nglview as nv

view = nv.show_ase(molecule('H2O'))

Now, how can I get elements and coordinates information back from view ? I see that view.get_state() contains the elements and coordinates information. But it is not easy to use. Is there any other good way to do it ? Thanks.

dou-du avatar Jul 01 '20 13:07 dou-du

hi @dou-du, why don't you use molecule('H2O') directly?

hainm avatar Jul 01 '20 14:07 hainm

hi @hainm Actually, I want to write function to render high quality image by using Pov-Ray. I am thinking about to integrate it with Nglview. For instance, call it by view.render_by_povray(). I would also like to make pull request for this function. So, I need the elements and their coordinates. Thanks.

dou-du avatar Jul 01 '20 14:07 dou-du

I see. Unfortunately, there is no direct and clean way to get the information. Let me think a bit. Cheers.

hainm avatar Jul 01 '20 15:07 hainm