patrickfuller / imolecule Goto Github PK
View Code? Open in Web Editor NEWAn embeddable webGL molecule viewer and file format converter.
Home Page: http://patrickfuller.github.io/imolecule/
License: MIT License
An embeddable webGL molecule viewer and file format converter.
Home Page: http://patrickfuller.github.io/imolecule/
License: MIT License
When run on windows, the process fails and spits out a looped error.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Python27\lib\multiprocessing\forking.py", line 380, in main
assert main_name not in sys.modules, main_name
AssertionError: __main__
prepare(preparation_data)
File "C:\Python27\lib\multiprocessing\forking.py", line 488, in prepare
assert main_name not in sys.modules, main_name
From this stackoverflow, it looks like multiprocessing on windows fails when you use relative imports. A weird bug, but an easy fix.
I'm happy to create the skeleton for a travis/conda build system if you can turn on travis for this repo and generate a binstar key.
Hi,
I cannot see the molecule (latest IPython git, self-compiled openbabel, Python 3).
I get two errors in console about vertexShader and fragmentShader being not defined from THREE.Material.
It seems that only ten visualizations will display at once. e.g. when I display 15 structures, the screen is blank for the first 5. How do I overcome this limitation?
Hi,
I have to load .xyz files and wondered how to achieve that in HTML using JS.
Any help would be appreciated.
Since imolecule takes only .json in draw
method.
The merged-geometry branch is a huge performance boost on larger molecules (ref). I ended up not implementing it because I wasn't concerned with performance at the time. Might be worth dusting off.
Recently I switched from jupyter notebook to jupyter lab and I found imolecule
not working.
In a jupyter lab notebook, imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
yields no error nor output. However, in the bowser (chrome) inspection console, the browser reports that JupyterLab does not execute inline JavaScript in HTML output
.
If I use jupyter notebook, everything is fine.
If I visualize a .xyz file, the bonds are inferred from distances between atoms. Is there a way I can modify the bonding rules?
i.e. change the cutoff distance between atom x and y beyond which a bond is declared to be present.
Some of the atoms that should be bonded are not.
I'd like to make changes to imolecule.js (trying to correct the other issue I raised), but couldn't find a way to regenerate the imolecule.min.js correctly…
I'm getting a 404
when running the imolecule
nbextension:
[W 10:47:15.960 NotebookApp] 404 GET /nbextensionsimolecule.min.js?v=20150729104512 (127.0.0.1)
0.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?kernel_name=python2
I believe this has to do with the following line in the notebook.py file:
local_path = os.path.join("nbextensions", filename)
While running it on windows, the local_path
is joined using \\
instead of /
and that might be causing the message and actually never loading the local imolecule.min.js
library.
In my attempt to replicate the examples/mof.html
, my MOF is rotated at a very awkward angle when I first open it. Is it easy to change the default view, through an up vector and view vector? First, for the example in examples/mof.html
. Second, in the IPython Notebook, this would be nice too. Such as:
imolecule.draw("IRMOF-1.cif", show_save=True, up_vector=[1, 0, 0], view_vector=[0, 1, 0])
For users that don't have webGL, we should have a functional fallback (even if its slower). three.js supports a couple of backends, so falling back to CSS3 or SVG should be simple enough.
I tried this a while back in the svg branch - may be worth looking in to.
I've noticed that in a notebook with many imolecule output cells, both Safari and Chrome fail to render all the cells, some of them throw the following error:
I've also noticed that when I develop a notebook and create a lot of imolecule output cells, the browser eventually starts throwing
WARNING: Too many active WebGL contexts. Oldest context will be lost.
I've found that this may be solved by keeping only a single renderer for different scene, but I don't know whether it would be possible to keep a single shared rendered for all imolecule outputs.
This is an excellent and much needed tool, thank you!
Is there a way to save a snapshot of the molecule as e.g. a .png file, such as:
molecule = imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
molecule.savefig("mymolecule.png", format="png")
Further, a way to host this interactive viewer on a website? e.g. some .html code to copy and paste into Jekyll?
Make this usable through pip and conda.
Biggest issue here is that this requires making open babel installable through pip and conda. imolecule install should be dead simple after that.
Hey Pat, I'm trying to use imolecule in another project and would need to make some small tweaks. I'll file a PR for them later but was curious about the choice to name the folder containing the package python
instead of the more standard imolecule
?
This prevents me from running python setup.py develop
which is how I normally install packages I want to fiddle with. How do you do this locally?
For the record, just changing the name of the folder and adjusting the entry in setup.py
fixes this issue for me but I may just not be using it the same way that you are.
This is the relatively obvious output in case you're curious:
$ python setup.py develop
Traceback (most recent call last):
File "setup.py", line 2, in <module>
from python import __version__
File "/Users/ctk3b/imolecule/python/__init__.py", line 1, in <module>
from imolecule.notebook import draw, generate, to_json
ImportError: No module named 'imolecule'
Hi, i'm trying to use see how imolecules works in jupyter but i keep getting the following error when trying to follow you example:
import imolecule
imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-2-c19f0d58009f> in <module>()
----> 1 import imolecule
2 imolecule.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
/usr/local/lib/python2.7/site-packages/imolecule/__init__.py in <module>()
----> 1 from imolecule.notebook import draw, generate, to_json # noqa
2
3 __title__ = 'imolecule'
4 __version__ = '0.1.13'
5 __author__ = 'Patrick Fuller'
/usr/local/lib/python2.7/site-packages/imolecule/notebook.py in <module>()
5 from IPython.display import HTML, display
6
----> 7 import imolecule.json_formatter as json
8 from imolecule import format_converter
9
AttributeError: 'module' object has no attribute 'json_formatter'
Python2.7 has been installed using home brew along with Swig and jupyter. Python dependences; ipython, pybel and openbabel have all been installed using pip2.
I have uninstalled and re-installed but that doesn't appear to work - any ideas?
Cheers,
Ollie
While attempting to draw() a smile, I get this error message:
`AttributeError Traceback (most recent call last)
in ()
----> 1 import imolecule as i
2 i.draw("CC1(C(N2C(S1)C(C2=O)NC(=O)CC3=CC=CC=C3)C(=O)O)C")
~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/init.py in ()
----> 1 from imolecule.notebook import draw, generate, to_json # noqa
2
3 title = 'imolecule'
4 version = '0.1.13'
5 author = 'Patrick Fuller'
~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/notebook.py in ()
6
7 from . import json_formatter as json
----> 8 from . import format_converter
9
10 file_path = os.path.normpath(os.path.dirname(file))
~/anaconda2/envs/python35/lib/python3.5/site-packages/imolecule/format_converter.py in ()
10 try:
11 import pybel
---> 12 ob = pybel.ob
13 table = ob.OBElementTable()
14 has_ob = True
AttributeError: module 'pybel' has no attribute 'ob'`
I can't seem to find a reference to pybel.ob... Is this a mistake?
@patrickfuller would you be opposed to slightly modifying the parameters of "unknown" elements?
This is somewhat specific to our application but we sometimes want to look at particles that are not chemical elements and when these are completely black, they have no shading so are very hard to distinguish in 3D. Additionally, they are currently bigger than common atoms like carbon and oxygen.
Would you be opposed to tweaking the aesthetics to something that is smaller (~0.3-0.5) and a color that distinguishes particles nicely in 3D (perhaps a grey tone or perhaps even something more obnoxious to show "hey this is unknown"?)
Importing imolecule in IPython 4 (Jupyter) generates following warning:
ShimWarning: The
IPython.html
package has been deprecated. You should import fromnotebook
instead.IPython.html.widgets
has moved toipywidgets
.
"IPython.html.widgets
has moved toipywidgets
.", ShimWarning)
P.S. Great project, thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.