After publishing my last article about OPSIN I was interested in using HTML5 techniques to display chemical compounds and found a nice library: ChemDoodle.
With ChemDoodle it’s very easy to display a molecule. Just download the libs and import them to your HTML code:
To display a compound you need its representation as MOL file, include it in less than 10 lines:
Here is a sample with caffeine:
If your browser is able to display WebGL you should see a stick-model. Use your mouse to interact.
Very easy to use! Of course you can load the MOL data from a file, but that is beyond the scope of this article.
I am having troubles displaying the molecule. javascript works fine for me, but I cannot see the mol either in wordpress or in a reglar html file I have build adhoc. Maybe I need to change the permissions for the ChemDoodleWeb files, maybe…
I think it’s an OpenGL issue. Even if WebGL seems to just use JavaScript you also need to have OpenGL installed. The OpenGL wiki might help you with the installation.
I found the problem. It was just an issue of the order in calling the ChemDoodleWeb libs. It is fixed now and it works perfect. I’ll be implementing some molecules in my web. Thanks for your nice post.
3 comments
I am having troubles displaying the molecule. javascript works fine for me, but I cannot see the mol either in wordpress or in a reglar html file I have build adhoc. Maybe I need to change the permissions for the ChemDoodleWeb files, maybe…
Test page
I think it’s an OpenGL issue. Even if WebGL seems to just use JavaScript you also need to have OpenGL installed. The OpenGL wiki might help you with the installation.
Hi Martin,
I found the problem. It was just an issue of the order in calling the ChemDoodleWeb libs. It is fixed now and it works perfect. I’ll be implementing some molecules in my web. Thanks for your nice post.
Jordi