3D-rendered molecular models on this blog: an update.

So much to do, so little time to do it. That is my excuse at least. Right from my first post on this blog in 2008 I have tried to enhance it using Jmol, a Java-based applet (normally indicated with the caption Click for 3D). This has been pretty stable for some five years now, but a recent spate of security-based releases of the JRE (Java runtime environment) for desktop computers has impacted, the latest of which was released yesterday (Java 7, V 51).  Put simply, when I started, an unsigned applet was fine. Now to run, it can only be a properly signed applet. Fortunately, there are two solutions:

  1. Install such a signed applet, and then invoke it correctly
  2. Replace the use of Java applets with one not dependent on Java. In the last 18 months an amazing effort to do this has resulted in  JSmol, which uses only JavaScript (which has nothing to do with Java despite the name).

I will shortly start the process of implementing solution 2 on this blog. Meanwhile I have started to implement solution 1 (which has the advantage that many of the surfaces I have included here, such as orbitals or NCI analyses, will render very much more quickly than with  JSmol). It involves replacing all instances of

jmolInitialize(‘../Jmol/’,'JmolApplet.jar’);

or

jmolInitialize(‘../Jmol/’,'JmolAppletSigned0.jar’);

with

jmolInitialize(‘../Jmol/’,'JmolAppletSigned.jar’);

I have identified 935 such instances, and am pondering how to automate this. Meanwhile, if you have a particular page which you would like to be processed quickly, do please get in touch.


PS. This is a classic (ugly) hack, but it might save me time. I uploaded JmolAppletSigned.jar V 14.0.5 and renamed it JmolApplet.jar (having moved the old one). Then I made one change to the script that invokes it (Jmol.js), changing the instance of "JmolAppletSigned" : "JmolApplet") + "0.jar"); to "JmolAppletSigned" : "JmolApplet") + ".jar");. Sorry to spill the guts of this blog onto this page, but one does occasionally need to tinker under the hood, and it might be of interest to anyone else trying to do this. Meanwhile, there are instructions here on how to install JSmol.

Tags: ,

5 Responses to “3D-rendered molecular models on this blog: an update.”

  1. > jmolInitialize(‘../Jmol/’,’JmolApplet.jar’);
    > or
    > jmolInitialize(‘../Jmol/’,’JmolAppletSigned0.jar’);
    > with
    > jmolInitialize(‘../Jmol/’,’JmolAppletSigned.jar’);
    > I have identified 935 such instances, and am pondering how to automate this.

    For example such command line:
    perl -i -pe "s|jmolInitialize\(‘\.\./Jmol/’,'JmolApplet(Signed0)?\.jar’\);|jmolInitialize(‘../Jmol/’,'JmolAppletSigned.jar’);|g" mask_for_files__or__filenames_separated_by_space

  2. Henry Rzepa says:

    Alex,

    The above suggestion relates to operation on a file. But the blog in effect runs off a MySQL database, and there is no file per se to execute perl on.

  3. Jeff says:

    UPDATE wp_posts SET post_content = REPLACE (post_content, ‘ jmolInitialize(‘‘../Jmol/’’,’’JmolApplet.jar’’);’, ‘jmolInitialize(‘’../Jmol/’’,’’JmolAppletSigned.jar’’);’

    Ought to do it. Notice the escaped quotes with ”

  4. Henry Rzepa says:

    Thanks Jeff. Just to slightly elaborate. What Jeff is quoting is an SQL database command, done from the command line.

  5. amir says:

    Hi, I used your (old) instructions to create this Tryptamine model as a going away gift to my adviser! Thank you!

    https://www.shapeways.com/model/1623207/gpyout.html?li=aeTabs

Leave a Reply