nglviewer / nglview

Jupyter widget to interactively view molecular structures and trajectories
http://nglviewer.org/nglview/latest/
Other
788 stars 132 forks source link

Change to different model in multimodel PDB file #1058

Closed mverissi closed 1 year ago

mverissi commented 1 year ago

Dear developers,

I have a multimodel pdb file generated from a geometry optimization of a molecule and I would like to visualize it using nglview much in the same way as one can do in PyMol. In PyMol, once a multimodel PDB file is loaded, you can switch between the different models through buttons that appear in the lower left of the PyMol window. Is there any way of doing this with nglview without generating a trajectory file such as Gromacs' xtc?

With the multimodel file name already set in the variable multi_pdb_file, I tried

import nglview as nv

view = nv.show_structure_file(multi_pdb_file, gui=True, default=True)
view.center()
view._remote_call('setSize', target='Widget', args=['','600px'])

view

but there is no way to switch, for example, from model 1 to model 2 apart from adding code that explicitly loads that model, in which case the widget has to be reloaded. I would like to avoid this because this distracts me from seeing the (small) changes in geometry from one model to the next (or previous).

Best,

Marcos

mverissi commented 1 year ago

I'm so sorry - I just saw that this shouldn' t be posted here. Moving the question to the appropriate place, but I don' t know how to delete an issue request :(