openmm / openmm_workshops

31 stars 9 forks source link

nglview does not work in Colab #11

Open sef43 opened 1 year ago

sef43 commented 1 year ago

The nglview package does not work when running the notebooks in Colab. It would be great to have it working so people can quickly visualize the molecules/trajectories directly in the jupyter notebook.

jmichel80 commented 1 year ago

could py3Dmol be a viable alternative?

sef43 commented 1 year ago

Using a fix suggested by Toni from here: https://github.com/CCPBioSim/CCP5_Simulation_of_BioMolecules/blob/main/5_Analysis_DR_clustering/3_clustering.ipynb

mamba install ipywidgets=7.6.0 and

# enable third party jupyter widgets
from google.colab import output
output.enable_custom_widget_manager()

allows nglview to display molecules correctly. However, the trajectory player does not work. It just shows the first frame and will not play the trajectory. This seems to be a know issue with colab and nglview. See here: https://github.com/nglviewer/nglview/issues/995 and here: https://github.com/googlecolab/colabtools/issues/2853

sef43 commented 1 year ago

py3Dmol looks like it is based around showing a single frame not a playable trajectory. It can be used to show a trajectory animation but it will not be interactive and the boilerplate code it somewhat substantial.