Autodesk / notebook-molecular-visualization

2D and 3D molecular visualization in Jupyter notebooks using 3DMol.js and D3.js
http://moldesign.bionano.autodesk.com
Apache License 2.0
75 stars 21 forks source link

Orbitals not showing up #38

Open avirshup opened 7 years ago

avirshup commented 7 years ago

This is in the most recent master fb2eee08faca347444dc7bbf85de2d8792ccd6f2 and also MDT. You'll also need to check out the visualization_json branch of MDT, or this will throw an exception because of some bad JSON.

To reproduce:

mol = mdt.from_name('benzene')
mol.set_energy_model(mdt.models.CASSCF, active_electrons=6,
                       active_orbitals=6, state_average=6, basis='sto-3g')
mol.calculate()
mol.draw_orbitals()

Then select an orbital from the dropdown list. This produces: image

But we'd expect orbitals: image

(the UI changes are from upgrading to ipywidgets 6.0beta. Once that project is fully stabilized, we should probably make sure the UI layouts are reasonable)

justinmc commented 7 years ago

This one is really mysterious... It seems that observing changes in the Select ipywidget isn't working. It might be a bug in the beta version of ipywidgets. I'm looking into it...

avirshup commented 7 years ago

The select widgets have always been a little finicky in my experience. It's very weird that it changed to a dropdown, since you can see a different kind of dropdown right above it. You might check if changing it to a ipywidgets.Dropdown would get it working.

EDIT: And yeah, I'm like 70% sure that orbitals were working before upgrading to ipywidgets 6

justinmc commented 7 years ago

That did it. I think it looks and works fine so here's a PR: https://github.com/Autodesk/molecular-design-toolkit/pull/118

justinmc commented 7 years ago

Closing this as https://github.com/Autodesk/molecular-design-toolkit/pull/118 was merged. Also for the record it looks like the ipywidgets people have now fixed the original problem here: https://github.com/ipython/ipywidgets/pull/879. I was unable to confirm though.