Posts Tagged ‘Java’

Ten years on: Jmol and WordPress.

Wednesday, May 16th, 2018

Ten years are a long time when it comes to (recent) technologies. The first post on this blog was on the topic of how to present chemistry with three intact dimensions. I had in mind molecular models, molecular isosurfaces and molecular vibrations (arguably a further dimension). Here I reflect on how ten years of progress in technology has required changes and the challenge of how any necessary changes might be kept “under the hood” of this blog.

That first post described how the Java-based applet Jmol could be used to present 3D models and animations. Gradually over this decade, use of the Java technology has become more challenging, largely in an effort to make Web-page security higher. Java was implemented into web browsers via something called Netscape Plugin Application Programming Interface  or NPAPI, dating from around 1995. NPAPI has now been withdrawn from pretty much all modern browsers. Modern replacements are based on JavaScript, and the standard tool for presenting molecular models, Jmol has been totally refactored into JSmol. Now the challenge becomes how to replace Jmol by JSmol, whilst retaining the original Jmol Java-based syntax (as described in the original post). Modern JSmol uses its own improved syntax, but fortunately one can use a syntax converter script Jmol2.js which interprets the old syntax for you. Well, almost all syntax, but not in fact the variation I had used throughout this blog, which took the form:

<img onclick=”jmolApplet([450,450],’load a-data-file;spin 3;’);” src=”static-image-file” width=”450″ /> Click for 3D structure

This design was originally intended to allow browsers which did not have the Java plugin installed to default to a static image, but that clicking on the image would allow browsers that did support Java to replace (in a new window) the static image with a 3D model generated from the contents of a-data-file. The Jmol2.js converter script had not been coded to detect such invocations. Fortunately Angel came to my rescue and wrote a 39 line Javascript file that does just that (my Javascript coding skills do not extend that far!). Thanks Angel!!

In fact I did have to make one unavoidable change, to;

<img onclick=”jmolApplet([450,450],’load a-data-file;spin 3;’,’c1′);” src=”image-file” width=”450″ /> Click for 3D structure

to correct an error present in the original. It manifests when one has more than one such model present in the same document, and this necessitates that each instance has a unique name/identifier (e.g. c1). So now, in the WordPress header for the theme used here (in fact the default theme), the following script requests are added to the top of each page, the third of which is the new script.

<script type=”text/javascript” src=”JSmol.min.js”></script>
<script type=”text/javascript” src=”js/Jmol2.js”></script>
<script type=”text/javascript” src=”JmolAppletNew.js”></script>

The result is e.g.

Click for 3D

Click for 3D structure of GAVFIS

Click for 3D

Click for 3D interaction

This solution unfortunately is also likely to be unstable over the longer term. As standards (and security) evolve, so invocations such as onclick= have become considered “bad practice” (and may even become unsupported). Even more complex procedures will have to be devised to keep up with the changes in web browser behaviour and so I may have to again rescue the 3D models in this blog at some stage! Once upon a time, the expected usable lifetime of e.g. a Scientific Journal (print!) was a very long period (>300 years). Since ~1998 when most journals went online, that lifetime has considerably shortened (or at least requires periodic, very expensive, maintenance). For more ambitious types of content such as the 3D models discussed here, it might be judged to be <10 years, perhaps much less before the maintenance becomes again necessary. Sigh!


At the time of writing, WaterFox is one of the few browsers to still support it. An early issue with using Javascript instead of Java was performance. For some tasks, the former was often 10-50 times slower. Improvements in both hardware and software have now largely eliminated this issue. Thus using Jquery.

Twenty one years of chemistry-related Java apps: RIP Java?

Saturday, June 10th, 2017

In an earlier post, I lamented the modern difficulties in running old instances of Jmol, an example of an application program written in the Java programming language. When I wrote that, I had quite forgotten a treasure trove of links to old Java that I had collected in 1996-7 and then abandoned. Here I browse through a few of the things I found.

The collection is at DOI: 10.14469/hpc/2657. Here I track down how some of them are doing 20+ years on.

  1. Formula-To-Mass-To-Formula (f2m2f), which was started in August 1996 and was written by Guillaume Cottenceau, a french undergraduate student visiting London and who wanted to learn to program. I suggested he try Java, and as I recollect sent him out to the business park west of London where Sun Microsystems had an office to learn how to do so (they had only released the development kit a few months earlier!). The applet he wrote still works (being unsigned, you have to jump through a few hoops to allow it to run (but be quick, not many browsers will still let you do so!). The applet also has a benchmark feature. Running the heavy bench now takes ~ 0.4s on a laptop.  I cannot be sure,  but I seem to remember that this one took ~20 seconds back in 1997. 
  2. Guillaume then returned to Paris to finish the above off, but also managed to find the time a year later to produce Jspec, a visualiser for NMR and MS. Darek Bogdal was visiting from Poland in August 1997(8?) and he incorporated these tools into a general spectral display and problem solving resource, which also still mostly works (with no curation!). The bit that does not work depended on the Chime plugin, now long gone and of course replaced in large measure by Jmol and now JSmol. 
  3. Here is an equation setter. The original site has long gone, but I had copied the classes over and it also (mostly) works!
  4. This dates from 1997 by Wyn Locke and Alan Tongue and uses JavaScript plus the spectral viewer to communicate with Chime. All done much better by many others since of course.

That said, many of the other links at DOI: 10.14469/hpc/2657 no longer work. In truth I am slightly surprised a few still do! 

Quite possibly these screen shots may be the only visual images that can be created in the very near future, as all but very specialised web browsers drop “plug-in” (aka Java) support. So perhaps it will be RIP Java, at least for the in-browser frame mode (but certainly not for the stand-alone application mode).

Curating a nine year old journal FAIR data table.

Monday, May 29th, 2017

As the Internet and its Web-components age, so early pages start to decay as technology moves on. A few posts ago, I talked about the maintenance of a relatively simple page first hosted some 21 years ago. In my notes on the curation, I wrote the phrase “Less successful was the attempt to include buttons which could be used to annotate the structures with highlights. These buttons no longer work and will have to be entirely replaced in the future at some stage.” Well, that time has now come, for a rather more crucial page associated with a journal article published more recently in 2009.[1]

The story started a few days ago when I was contacted by the learned society publisher of that article, noting they were “just checking our updated HTML view and wanted to test some of our old exceptions“. I should perhaps explain what this refers to. The standard journal production procedures involve receiving a Word document from authors and turning that into XML markup for the internal production processes. For some years now, I have found such passive (i.e. printable only) Word content unsatisfactory for expressing what is now called FAIR (Findable, accessible, inter-operable and re-usable) data. Instead, I would create another XML expression (using HTML), which I described as Interactive Tables and then ask the publisher to host it and add that as a further link to the final published article. I have found that learned society publishers have not been unwilling to create an “exception” to their standard production workflows (the purely commercial publishers rather less so!). That exceptional link is http://www.rsc.org/suppdata/cp/b8/b810301a/Table/Table1.html but it has now “fallen foul of the java deprecation“. 

Back in 2008 when the table was first created, I used the Java-based Jmol program to add the interactive component. That page, when loaded, now responds with the message:

This I must emphasise is nothing to do with the publisher, it is the Jmol certificate that has been revoked. That of itself requires explanation. Java is a powerful language which needs to be “sandboxed” to ensure system safety. But commands can be created which can access local file stores and write files out there (including potentially dangerous ones). So it started to become the practise to sign the Java code with the developer certificate to ensure provenance for the code. These certificates are time-expired and around 2015 the time came to renew it. Normally, when such a certificate is renewed, the old one is allowed to continue operation. On this occasion the agency renewing the certificate did not do this but revoked the old one instead (Certificate has been revoked, reason: CESSATION_OF_OPERATION, revocation date: Thu Oct 15 23:11:18 BST 2015). So all instances of Jmol with the old certificate now give the above error message. 

The solution in this case is easy; the old Jmol code (as JmolAppletSigned.jar) is simply replaced with the new version for which the certificate is again valid. But simply doing that alone would merely have postponed the problem; Java is now indeed deprecated for many publishers, which is a warning that it will be prohibited at some stage in the future.‡ So time to bite the bullet and remove the dependency on Java-Jmol, replacing it with JSmol which uses only JavaScript.

Changing published content is in general not allowed; one instead must publish a corrigendum. But in this instance, it is not the content that needs changing but the style of its presentation (following the principle of the Web of a clear-cut separation of style and content). So I set out to update the style of presentation, but I was keen to document the procedures used. I did this by commenting out non-functional parts of the style components of my original HTML document (as <!– comment –>) and adding new ones. I describe the changes I made below.

  1. The old HTML contained the following initialisation code: jmolInitialize(".","JmolAppletSigned.jar");jmolSetLogLevel('0'); which was commented out.
  2. New scripts to initialize instead JSmol were added, such as:
    <script src="JSmol.min.js" type="text/javascript"> </script>
  3. I added further scripts to set up controls to add interactivity.
  4. The now deprecated buttons had been invoked using a Jmol instance:  jmolButton('load "7-c2-h-020.jvxl";isosurface "" opaque; zoom 120;',"rho(r) H")
  5. which was replaced by the JSmol equivalent, but this time to produce a hyperlink rather than a button (to allow the greek ρ to appear, which it could not on a button): <a href="javascript:show_jmol_window();Jmol.script(jmolApplet0,'load 7-c2-020.jvxl;isosurface &quot;&quot; translucent;spin 3;')">ρ(r)</a>,
  6. Some more changes were made to another component of the table, the links to the data repository. Originally, these quoted a form of persistent identifier known as a Handle; 10042/to-800. Since the data was deposited in 2008, the data repository has licensed further functionality to add DataCite DOIs to each entry. For this entry,  10.14469/ch/775. Why? Well, the original Handle registration had very little (chemically) useful registered metadata, whereas DataCite allows far richer content. So an extra column was added to the table to indicate these alternate identifiers for the data.
  7. We are now at the stage of preparing to replace the Java applet at the publishers site with the Javascript version, along with the amended HTML file. The above link, as I write this post, still invokes the old Java, but hopefully it will shortly change to function again as a fully interactive table.
  8. I should say that the whole process, including finding a solution and implementing it took 3-4 hours work, of which the major part was the analysis rather than its implementation.

It might be interesting to speculate how long the curated table will last before it too needs further curation. There are some specifics in the files which might be a cause for worry, namely the so-called JVXL isosurfaces which are displayed. These are currently only supported by Jmol/JSmol. They were originally deployed because iso-surfaces tend to be quite large datafiles and JVXL used a remarkably efficient compression algorithm (“marching cubes”) which reduces their size ten-fold or more. Should JSmol itself become non-operational at some time in the (hopefully) far future (which we take to be ~10 years!) then a replacement for the display of JVXL will need to be found. But the chances are that the table itself will decay “gracefully”, with the HTML components likely to outlive most of the other features. The data repository quoted above has itself now been available for ~12 years and it too is expected to survive in some form for perhaps another 10. Beyond that period, no-one really knows what will still remain. 

You may well ask why the traditional journal model of using paper to print articles and which has survived some 350 years now, is being replaced by one which struggles to survive 10 years without expensive curation. Obviously, a 3D interactive display is not possible on paper. But one also hears that publishers are increasingly dropping printed versions entirely. One presumes that the XML content will be assiduously preserved, but re-working (transforming, as in XSLT) any particular flavour of XML into another publishers systems is also likely to be expensive. Perhaps in the future the preservation of 100% of all currently published journals will indeed become too expensive and we might see some of the less important ones vanishing for ever?


Nowadays it is necessary to configure your system or Web browser to allow even signed valid Java applets to operate. Thus in the Safari browser (which still allows Java to operate, other popular browsers such as Chrome and Firefox have recently removed this ability), one has to go to preferences/security/plugin-settings/Java, enter the URL of the site hosting the applet and set it to either “ask” (when a prompt will always appear asking if you want to accept the applet) or “on” when it will always do so. How much longer this option will remain in this browser is uncertain.

In the area of chemistry, an early pioneer was the Internet Journal of Chemistry, where the presentation of the content took full advantage of Web-technologies and was on-line only. It no longer operates and the articles it hosted are gone.

References

  1. H.S. Rzepa, "Wormholes in chemical space connecting torus knot and torus link π-electron density topologies", Phys. Chem. Chem. Phys., vol. 11, pp. 1340-1345, 2009. https://doi.org/10.1039/b810301a

The conformation of enols: revealed and explained.

Thursday, April 6th, 2017

Enols are simple compounds with an OH group as a substituent on a C=C double bond and with a very distinct conformational preference for the OH group. Here I take a look at this preference as revealed by crystal structures, with the theoretical explanation.

First, a search of the Cambridge structure database (CDS), using the search query shown below (DOI: 10.14469/hpc/2429)


The first search (no errors, no disorder, R < 0.05) is unconstrained in the sense that the HO group is free to hydrogen bond itself. The syn conformer has the torsion of 0° and it has a distinct preponderance over the anti isomer (180°). There is the first hint that the most probable C=C distance for the syn isomer may be longer than that for the anti, but this is not yet entirely convincing.
To try to make it so, a constrained search is now performed, in which only structures where the HO group has no contact (hydrogen bonding) interaction are included. This is achieved using a “Boolean” search;

The number of hits approximately halves, but the proportion of syn examples increases considerably. There is an interesting double “hot-spot” distribution, which amplifies the lengthening of the C=C bond compared to the anti orientation.

The next constraint added is that the data collection must be <100K (to reduce thermal noise) which reduces the hits considerably but now shows the lengthening of the C=C bond for the syn isomer very clearly.

A final plot is of the C=C length vs the C-O length (no temperature, but HO interaction constraint). If there were no correlation, the distribution would be ~circular. In fact it clearly shows that as the C=C bond lengthens, the C-O bond contracts.

Now for some calculations (ωB97XD/Def2-TZVPP, DOI: 10.14469/hpc/2429) which reveal the following:

  1. The free energy of the syn isomer is 1.2 kcal/mol lower than that of the syn. The effect is small, and hence easily masked by other interactions such as hydrogen bonding to the OH group. Hence the reason why removing such interactions from the search above increased the syn population compared to anti.
  2. The syn C=C bond length (1.325Å) is longer than the anti (1.322Å). 
  3. The syn isomer has one unique σO-Lp*C-C NBO orbital interaction (below) with a value of E(2) 7.7 kcal/mol, which is absent in the anti form. As it happens, a πO*C=C interaction is present in both forms but is also stronger in the syn isomer (E(2)= 46.8 vs 44.2 kcal/mol).
    unoccupied NBO, σ*C-C
    Occupied NBO, σO-Lp
  4. The overlap of the filled σO-Lp with the empty σ*C-C orbital is shown below (blue overlaps with purple, red overlaps with orange).

    To view the overlap in rotatable 3D, click on any of the colour diagrams above.

It is nice to see how experiment (crystal structures) and theory (the calculation of geometries and orbital interactions) can quickly and simply be reconciled. Both these searches and the calculations can be done in just one day of “laboratory time” and I think it would make for an interesting undergraduate chemistry lab experiment.


This visualisation uses Java. Increasingly this browser plugin is becoming more onerous to activate (because of increased security) and some browsers do not support it at all. The macOS Safari browser is one that still does, but you do have to allow it via the security permissions.


Revisiting (and maintaining) a twenty year old web page. Mauveine: The First Industrial Organic Fine-Chemical.

Thursday, February 2nd, 2017

Almost exactly 20 years ago, I started what can be regarded as the precursor to this blog. As part of a celebration of this anniversary, I revisited the page to see whether any of it had withstood the test of time. Here I recount what I discovered.

The site itself is at www.ch.ic.ac.uk/motm/perkin.html  and has the title “Mauveine: The First Industrial Organic Fine-Chemical” It was an application of an earlier experiment[1] to which we gave the title “Hyperactive Molecules and the World-Wide-Web Information System“. The term hyperactive was supposed to be a play on hyperlinking to the active 3D models of molecules built using their 3D coordinates. The word has another, more negative, association with food additives such as tartrazine – which can induce hyperactivity in children – and we soon discontinued the association. This page was cast as a story about a molecule local to me in two contexts; the first being that the discoverer of mauveine, W. H. Perkin, had been a student at what is now the chemistry department at Imperial College. The second was the realization that where we lived in west London was just down the road from Perkin’s manufacturing factory. Armed with (one of the first) digital cameras, a Kodak DC25, I took some pictures of the location and added them later to the web page. The page also included two sets of 3D coordinates for mauveine itself and alizarin, another dyestuff associated with the factory. These were “activated” using HTML to make use of the then very new Chime browser plugin; hence the term hyperactive molecule.

This first effort, written in December 1995, soon needed revision in several ways. I note that I had maintained the site in 1998, 2001, 2004 and 2006. This took the form of three postscripts to add further chemical context and more recent developments and in replacing the original Chime code for Java code to support the new Jmol software (Chime itself had been discontinued, probably around 2001 or possibly 2004). With the passage of a further ten years, I now noticed that the hyperactive molecules were no longer working; the original Jmol applet was no longer considered secure by modern browsers and hence deactivated. So I replaced this old code with the latest version (14.7.5 as JmolAppletSigned.jar) and this simple fix has restored the functionality. The coordinates themselves were invoked using the HTML applet tag, which amazingly still works (the applet tag had replaced an earlier one, which I think might have been embed?).  A modern invocation would be by using e.g. the JSmol Javascript based tool and so perhaps at some stage this code will indeed need further revision when the Java-based applet is permanently disabled.

You may also notice that the 3D coordinates are obtained from an XML document, where they are encoded using CML (chemical markup language[2]), which is another expression from the family that HTML itself comes from. That form may well last rather longer than earlier formats – still commonly used now – such as .pdb or .mol (for an MDL molfile). 

Less successful was the attempt to include buttons which could be used to annotate the structures with highlights. These buttons no longer work and will have to be entirely replaced in the future at some stage.

The final part of the maintenance (which I had probably also done with the earlier versions) was to re-validate the HTML code. Checking that a web page has valid HTML was always a behind-the-scenes activity which I remember doing when constructing the ECTOC conferences also back in 1995 and doing so probably does prolong the longevity of a web page. This requires “tools-of-the-trade” and I use now (and indeed did also back in 1995 or so) an industrial strength HTML editor called BBedit. To this is added an HTML validation tool, the installation of which is described at https://wiki.ch.ic.ac.uk/wiki/index.php?title=It:html5 I re-ran this again and so this 2017 version should be valid for a little while longer at least. The page itself now has not just a URL but a persistent version called a DOI (digital object identifier), which is 10.14469/hpc/2133[3]. In theory at least, even if the web server hosting the page itself becomes defunct, the page could – if moved – be found simply from its DOI. The present URL-based hyperlink of course is tied to the server and would not work if the server stopped serving.

To complete this revisitation, I can add here a recent result. Back in 1995, I had obtained the 3D coordinates of mauveine using molecular modelling software (MOPAC) together with a 2D structure drawing package (ChemDraw) because no crystal structure was available. Well, in 2015 such structures were finally published.[4] Twenty years on from the original “hyperactive” models, their crystal structures can be obtained from their assigned DOI, much in the same manner as is done for journal articles: Try DOI: 10.5517/CC1JLGK4[5] or DOI: 10.5517/CC1JLGL5[6].

At some stage, web archaeology might become a fashionable pursuit. Twenty year old Web pages are actually not that common and it would be of interest to chart their gradual decay as security becomes more important and standards evolve and mature. One might hope that at the age of 100, they could still be readable (or certainly rescuable). During this period, the technology used to display 3D models within a web page has certainly changed considerably and may well still do so in the future. Perhaps I will revisit this page in 2037 to see how things have changed!


The old code can still be seen at www.ch.ic.ac.uk/motm/perkin-old.html

It should really be postscript 4.

References

  1. O. Casher, G.K. Chandramohan, M.J. Hargreaves, C. Leach, P. Murray-Rust, H.S. Rzepa, R. Sayle, and B.J. Whitaker, "Hyperactive molecules and the World-Wide-Web information system", Journal of the Chemical Society, Perkin Transactions 2, pp. 7, 1995. https://doi.org/10.1039/p29950000007
  2. P. Murray-Rust, and H.S. Rzepa, "Chemical Markup, XML, and the Worldwide Web. 1. Basic Principles", Journal of Chemical Information and Computer Sciences, vol. 39, pp. 928-942, 1999. https://doi.org/10.1021/ci990052b
  3. H. Rzepa, "Molecule of the month: Mauveine.", Imperial College London, 2017. https://doi.org/10.14469/hpc/2133
  4. M.J. Plater, W.T.A. Harrison, and H.S. Rzepa, "Syntheses and Structures of Pseudo-Mauveine Picrate and 3-Phenylamino-5-(2-Methylphenyl)-7-Amino-8-Methylphenazinium Picrate Ethanol Mono-Solvate: The First Crystal Structures of a Mauveine Chromophore and a Synthetic Derivative", Journal of Chemical Research, vol. 39, pp. 711-718, 2015. https://doi.org/10.3184/174751915x14474318419130
  5. Plater, M. John., Harrison, William T. A.., and Rzepa, Henry S.., "CCDC 1417926: Experimental Crystal Structure Determination", 2016. https://doi.org/10.5517/cc1jlgk4
  6. Plater, M. John., Harrison, William T. A.., and Rzepa, Henry S.., "CCDC 1417927: Experimental Crystal Structure Determination", 2016. https://doi.org/10.5517/cc1jlgl5

The smallest C-C-C angle?

Monday, October 31st, 2016

Is asking a question such as “what is the smallest angle subtended at a chain of three connected 4-coordinate carbon atoms” just seeking another chemical record, or could it unearth interesting chemistry?

A simple search of the Cambridge structure database for a chain of three carbons, each bearing four substituents (sp3 hybridized in normal paralance) reveals the following distribution:

ccc

The value 60° is of course a three-membered cyclopropane ring. The tail of the distribution is very small, and there are a few small outliers with values of < 54°. Most of the time such outliers are in fact simple errors, but here we see that they are in fact semibullvalenes, of the type shown below, with the small angle subtended at the central of the three carbon atoms coloured in red.

cazfue

In this diagram I have added my own semantic interpretation of what is going on. Let me itemise this:

  • These molecules can undergo very rapid [3,3] sigmatropic rearrangements, shifting a σ-bond away from the 3-ring to create another such ring.
  • This process elongates one of the C-C bonds and of neccessity this reduces the angle at the associated carbon.
  • I have drawn two types of arrow connecting the two structures. The first is an equilibrium arrow, which implies a transition state connecting the two species. This transition state will have equal bond lengths for the forming/breaking C-C bond, and the transition state will have a rate constant which is slower than the time taken for one molecular vibration (~10-15s)
  • It is also possible however that the second arrow is the correct one, and this implies an electronic resonance rather than a nuclear motion. This would have a rate constant comensurate with electron dynamics (~10-18 s) rather than nuclear vibrations.

What does x-ray crystallography measure? Well the diffraction of photons by electrons. In order to obtain a diffraction pattern, enough photons have to be diffracted to be measured, and even with most modern instruments this still takes minutes or hours. During this period, all the various nuclear positions encountered as a result of vibrations or equilibria are sampled. So if the rate constant for the [3,3] sigmatropic rearrangement is fast, x-ray diffraction will measure the average of the two sets of nuclear positions, which can be distinguished only with some difficulty (if at all) from the structure implied instead by electronic resonance.

If the equilibrium arrow applies, then the small angles of <54° are merely the average of the normal value for a 3-membered ring and a smaller value for a structure where one of the C-C bonds has been removed. In my opening sentence, I noted that the three carbon carbon atoms had to be connected in a chain. This is no longer true; the goalposts have been moved (a lot)!

If its an electron resonance, then the three carbon atoms are still connected, albeit one of the two C-C bonds is no longer a single bond but rather weaker and hence longer. The goalposts have merely been slightly shifted!

A calculation (B3LYP/Def2-TZVPP+D3 dispersion, doi: 10.14469/hpc/1850, [1]) of the structure KUZFUE [2] shows the C2-symmetric species shown below, with an elongated C-C bond and hence a reduced C-C-C angle, as being a true minimum (a resonance) rather than a transition state (an equilibrium). The vibration which shortens one C-C bond and lengthens the other has the real calculated wavenumber 244 cm-1. But the boundary between the two possibilities (often referred to as the boundary between a single and a double minimum in a potential energy surface) is notoriously difficult to capture using calculations.

cazfue

How could experiment definitively settle the issue? Well, the SLAC beam is a unique instrument. Its source of X-rays is so intense that you can get an analysable diffraction pattern from a crystal on a timescale so short that during this period no nuclear motions occur (not even vibrations). Those nuclear positions capture the true equilibrium positions of the atoms in the molecule. Now, how does one get beam time on the SLAC?


Click on the image above to see an animation of this normal mode. If you are running the macOS Safari browser, make sure Preferences/Security/Plug-in settings/Java has the site ch.ic.ac.uk or ch.imperial.ac.uk set to on. If you do not do this, the somewhat unhelpful message You do not have Java applets enabled in your web browser, or your browser is blocking this applet. will appear. Note also that new system installations might tend to switch these settings to off.

References

  1. H. Rzepa, "CAZFUE", 2016. https://doi.org/10.14469/hpc/1850
  2. L.M. Jackman, A. Benesi, A. Mayer, H. Quast, E.M. Peters, K. Peters, and H.G. Von Schnering, "The Cope rearrangement of 1,5-dimethylsemibullvalene-2,6- and 3,7-dicarbonitriles in the solid state", Journal of the American Chemical Society, vol. 111, pp. 1512-1513, 1989. https://doi.org/10.1021/ja00186a064

How many water molecules does it take to ionise HCl?

Saturday, February 14th, 2015

According to Guggemos, Slavicek and Kresin, about 5-6![1]. This is one of those simple ideas, which is probably quite tough to do experimentally. It involved blasting water vapour through a pinhole, adding HCl and measuring the dipole-moment induced deflection by an electric field. They found “evidence for a noticeable rise in the dipole moment occurring at n56“.

Modelling the structures takes little time. So here are some ωB97XD/6-311++G(2d,2p) gas phase models. I state at the outset that these are not dynamic-stochastic models, averaged over many conformations, but a static picture of individual poses. As usual, click on individual images to obtain an interactive 3D model (Java required).

n=1.[2] Dipole moment 3.7D

hcl+1h2o

n=2.[3] Dipole moment 2.4D. Note how the O…H bond becomes shorter.

hcl+2h2o

n=3.[4] Dipole moment 2.5D. Note how the key O..H bond is contracting rapidly, as are the other H-bond interactions. This is the cyclic polarisation effect, where each bond influences the others. We are starting to approach the formation of H3O+ and Cl!

hcl+3h2o

n=4.[5] Dipole moment 2.3 D, We have two ways to add the next water molecule, firstly to try to stabilise the H3O+. Nope.

hcl+4h2o

n=4,[5] Dipole moment 1.1 D. Better by solvating the Cl! The proton originally attached to the Cl is now starting its transfer to the water to form that hydronium cation, but the dipole moment is not yet large.

hcl+4h2o1

n=5.[6] Dipole moment 4.7D. The ionisation is almost complete and the dipole moment is on the increase.

5

n=6.[7] The dipole moment is up to 8.2D and the three H-O bonds of the hydronium cation are almost all equal in length.

6

A cautionary observation though. The isomer below for n=6[8] is lower in energy by ΔG -1.2 kcal/mol, and its dipole moment is only 2.5D! The charges (summed onto heavy atoms) show the chloride to have -0.88 and the hydronium cation +0.88, so it is a true ion-pair, despite its dipole moment.

6a

So these calculations do indeed appear to confirm that 5-6 water molecules are required to ionise HCl. But it does raise the interesting issue that even for n=6, there are poses for the assembly which have low dipole moments. Clearly of course the observed dipole moment is a dynamic average over many conformations of similar energy but the prediction that some of these may have low dipole moments should be noted.


If you right-click in the 3D model area, you can bring down a list of vibrational modes for each complex from the first item of the pop-up menu that appears (labelled model). You might wish to e.g. explore how the H-Cl stretch vibration changes as the ionisation increases.


References

  1. N. Guggemos, P. Slavíček, and V.V. Kresin, "Electric Dipole Moments of Nanosolvated Acid Molecules in Water Clusters", Physical Review Letters, vol. 114, 2015. https://doi.org/10.1103/physrevlett.114.043401
  2. H.S. Rzepa, "H 3 Cl 1 O 1", 2015. https://doi.org/10.14469/ch/189758
  3. H.S. Rzepa, "H 5 Cl 1 O 2", 2015. https://doi.org/10.14469/ch/189760
  4. H.S. Rzepa, "H 7 Cl 1 O 3", 2015. https://doi.org/10.14469/ch/189759
  5. H.S. Rzepa, "H 9 Cl 1 O 4", 2015. https://doi.org/10.14469/ch/189763
  6. H.S. Rzepa, "H 11 Cl 1 O 5", 2015. https://doi.org/10.14469/ch/189756
  7. H.S. Rzepa, "H 13 Cl 1 O 6", 2015. https://doi.org/10.14469/ch/189761
  8. H.S. Rzepa, "H 13 Cl 1 O 6", 2015. https://doi.org/10.14469/ch/189764

Blasts from the past. A personal Web presence: 1993-1996.

Saturday, November 1st, 2014

Egon Willighagen recently gave a presentation at the RSC entitled “The Web – what is the issue” where he laments how little uptake of web technologies as a “channel for communication of scientific knowledge and data” there is in chemistry after twenty years or more. It caused me to ponder what we were doing with the web twenty years ago. Our HTTP server started in August 1993, and to my knowledge very little content there has been deleted (it’s mostly now just hidden). So here are some ancient pages which whilst certainly not examples of how it should be done nowadays, give an interesting historical perspective. In truth, there is not much stuff that is older out there!

  1. This page was written in May 1994 as a journal article, although it did have to be then converted into a Word document to actually be submitted.[1] Because it introduced hyperlinks to a chemical audience, we wanted to illustrate these in the article itself! Hence permission was obtained from the RSC for an HTML version to be “self-archived” on our own servers where the hyperlinks were supposed to work (an early example of Open Access publishing!). I say supposed because quite a few of them have now “decayed”. We were aware of course that this might happen, but back in 1994, no-one knew how quickly this would happen. What is interesting is that the HTML itself (written by hand then) has survived pretty well! I will leave you to decide how much the message itself has decayed.
  2. This HTML actually predates the above; it was written around November 1993 and represented the very first lecture notes I converted into this form (on the topic of NMR spectroscopy). A noteworthy aspect is the scarce use of colour images. At the start of 1994, the bandwidth available on our campus was pretty limited (the switches were 10 Mbps only) and a request went out to reduce the bit-depth of any colour images to 4-bits to help conserve that bandwidth! I rather doubt anyone took much notice however, and the policy was forgotten just a few months later.
  3. In 1996, I had two visitors to the group, Guillaume Cottenceau, a french undergraduate student, and Darek Bogdal, a Polish researcher who wanted to learn some HTML. Together they produced this, which was an interactive tutorial to accompany the NMR lecture notes previously mentioned. These pages introduce the Java applet (yes, it was very new in 1996), which Guillaume had written and which Darek then made use of. And hey, what do you know, the applet still works (although you might have to coerce your browser into accepting an unsigned applet).
  4. Here is a programming course that I had been running with Bryan Levitt for a few years, now recast into HTML web pages some time in 1994-5. This particular project I still hold dear, since it expanded upon the NMR lectures by getting the students to synthesize a FID (free induction decay) using the program they wrote, and then perform a Fourier Transform on it. I even encouraged students to present their results in HTML (I cannot now remember how many did). This link is to the computing facilities we offered students in 1994 for this project, ah those were the times! In 1996, the programming course was replaced by one on chemical information technologies, and here students were most certainly expected to write HTML. Some of the best examples are still available. And to illustrate how things happen in cycles, that course itself is now gone to be replaced by, yes, a programming course (but using Python, and not the original Fortran).
  5. In tracking down the materials for the programming course described above, I re-discovered something far older. It is linked here and is (some of) the Fortran source code I wrote as a PhD student in 1974 1972. So I will indulge in a short digression. My Ph.D. involved measuring rate constants, and the accepted method for analysing the raw kinetic data was using graph paper. For first order rate behaviour, this required one to measure a value at time=∞, which is supposed to be measured after ten half-lives. I was too impatient to wait that long, and worked out that a non-linear least squares analysis did not require the time=∞ value; indeed this value could be predicted accurately from the earlier measurements. So in 1974, I wrote this code to do this; no graph paper for me! Also for good measure is a least squares analysis of the Eyring equation. And you get proper standard deviations for your errors. In retrospect I should have commercialised this work, but in 1974, almost no-one paid money for software! What a change since then. I must try recompiling this code to see if it still works! And for good measure, here is a Huckel MO program I wrote in 1984 or earlier (I did compile this recently and found it works) and here is a little program for visualising atomic orbitals.
  6. In January 1994, I was asked to create a web page for the WATOC organisation. This certainly predated the web sites for e.g. the RSC, the ACS, indeed famous sites such as the BBC and Tesco (a large supermarket chain) which only started up in mid 1994. The WATOC site itself moved a few years ago.
  7. This is one of those wonderfully naive things I started in 1994, and which did not last long (in my hands). Nowadays, the concept lives on as MOOCs. Note again the almost complete expiry of the hyperlinks.
  8. This is a project we also started in 1994, Virtual reality[2],[3]. The idea was that if HTML was text-markup, VRML was going to be 3D markup. VRML itself never quite caught on, but it is having a new life as a 3D printing language!
  9. And by 1995, I felt confident enough in my ability to (edit) HTML, that we started a virtual conference in organic chemistry (we did four of them in the end). I remember the first one involved contributors sending me a Word version of their poster, and I did all the work in converting it into HTML. Such virtual conferences still run, but in truth most participants still prefer to travel long distances to go drink a beer with their chums, rather than hack HTML.

I am going to stop now, since this is far too much wallowing in the past. But at least all this stuff is not (yet) lost to posterity.

References

  1. H.S. Rzepa, B.J. Whitaker, and M.J. Winter, "Chemical applications of the World-Wide-Web system", Journal of the Chemical Society, Chemical Communications, pp. 1907, 1994. https://doi.org/10.1039/c39940001907
  2. O. Casher, and H.S. Rzepa, "Chemical collaboratories using World-Wide Web servers and EyeChem-based viewers", Journal of Molecular Graphics, vol. 13, pp. 268-270, 1995. https://doi.org/10.1016/0263-7855(95)00053-4
  3. O. Casher, C. Leach, C.S. Page, and H.S. Rzepa, "Advanced VRML based chemistry applications: a 3D molecular hyperglossary", Journal of Molecular Structure: THEOCHEM, vol. 368, pp. 49-55, 1996. https://doi.org/10.1016/s0166-1280(96)90535-7

Electronic notebooks: a peek into the future?

Tuesday, September 16th, 2014

ELNs (electronic laboratory notebooks) have been around for a long time in chemistry, largely of course due to the needs of the pharmaceutical industries. We did our first extensive evaluation probably at least 15 years ago, and nowadays there are many on the commercial market, with a few more coming from opensource communities. Here I thought I would bring to your attention the potential of an interesting new entrant from the open community.

My very first post on this blog six years ago related to incorporation of the Jmol molecular viewer into posts, and it has been a feature of many since. A little more than two years ago, Jmol was recast into JSmol. This had become possible because JavaScript engines built into modern web browsers were finally getting the sort of performance needed to display molecules (years and years ago, lets say ~1990, such display required very fancy hardware kit such as Silicon Graphics workstations). Around the same time, another well-established Java-based molecule sketcher, JME (Java molecular editor) also became JavaScript based. My own interest in this sort of Web-based behaviour actually crystallised last December, when I decided to refactor my own lecture notes into a tablet-friendly format using JSmol, with some questions directed at the  formidably excellent Jmol discussion list. One of these related to how students might annotate such lecture notes with chemical sketches and store the results for future study or revision. Otis Rothenberger starting exploring various mechanisms for such local storage (using Web browsers), and in the last month or so has found a way of exploiting something called  HTML5 local storage, which allows the sort of capacity needed.  These three technologies have now come together on Otis’ site, which you can now view as CheMagic Notebook (this might be a .com site, but I believe the concept is very much open).

NBTogether with the Virtual model kit (VMK, itself now part of JSmol) this combination is starting to resemble a very interesting mechanism for creating an immersive lecture note environment, almost you might say a lecture note ecosystem. I would argue that for the first 30 years of the digital document era, most people preparing lecture notes became mesmerised (distracted?) by the need to print the outcomes with complete fidelity. It is only recently that the focus has turned to “beyond the PDF” (or beyond the PPT) and much richer mechanisms. So now we have lecture notes morphing into an ecosystem where:

  1. the objects themselves can be interactive (3D models, spectra, animations etc)
  2. or reference further models and associated data held in digital repositories
  3. or built from scratch in response to stimulation from peers, tutorials, workshops or lectures (using eg VMK or JME)
  4. and such annotations in effect themselves can be spliced into the student’s own copy of these notes,
  5. with the whole being regarded as a running notebook created from the initial seed of a lecturer’s materials augmented by the student’s own annotations.

I have focused here on where I started, i.e. refactoring my own lecture notes. But the above concepts could easily morph into eg a research project notebook, a rebundling into smaller segments which are themselves published into digital repositories (and there assigned their own persistent digital object identifiers) and ultimately further morphing into scholarly articles submitted to say a journal. These could represent a continuum, not discrete (and non-communicating) objects.

So will “lecture notes” actually start to change from their conventional (printable) form into something related to the above? Well, I have not addressed the largest hurdle preventing this; giving the content creators (i.e. the lecturers) the training, skills and most importantly the motivation to start to venture down this pathway. Otis has shown it should be technically possible. Come back and revisit this post in ten years time to see what actually did happen!

 

 

 

 

Test of JSmol in WordPress: the background story.

Sunday, June 8th, 2014

A word of explanation about this test page for experimenting with JSmol. Many moons ago I posted about how to include a generated 3D molecular model in a blog post, and have used that method on many posts here ever since. It relied on Java as the underlying software (first introduced in 1996), or almost 20 years ago. Like most software technologies, much has changed, and Java itself (as a compiled language) has had to move to improve its underlying security. In the last year, the Java code itself (in this case Jmol) has needed to be digitally signed in a standard manner, and this meant that many an old site that used unsigned older versions has started to throw up increasingly alarming messages.

To continue to experience the intended effect of eg Jmol, the user in turn has had to increasingly accept or tinker with their local Java settings; this has indeed become increasingly intrusive. And less experienced users often do not wish to engage with any of this activity. About two years ago, the Jmol community started having concerted discussions about what to do regarding Java, and they also started to converge with other developers and communities about a solution based on Javascript (which despite the name operates in an entirely different way from Java). Some of this early activity I tried to capture in a datument written during the summer of 2012[1]. The magnitude of the problem was considerable, how to refactor tens of thousands of Java-Code into JavaScript. The story of how this miracle was accomplished must be written by people like Bob Hanson and Takanori Nakane and perhaps some day they will. However, inserting all this wonderful technology into eg a WordPress blog still needed doing, and this task was undertaken by Jim Hu (and there are many others that are part of this effort, they all need to be thanked).

I volunteered to test, but so that Jim could see the effects of this testing, this (public) test page was created. Behind the scenes, the bugs have been winkled out, although much still remains to be done. This page will no doubt continue to evolve as this is done, and when it all works, I will no doubt add a postscript. So keep watching this space. It has two examples, each of which should produce a box with a molecule, as per this page.

  1. [jsmol pdb=’1PRC’ caption=’Load 1PRC’ commands=” id=’a1′ debug=’true’]
  2. [jsmol caption=’Load local file’ fileurl=’http://rzepa.net/blog/wp-content/uploads/2014/06/test2.pdb’ id=’a2′ commands=’=spacefill 23%;wireframe 0.15;color cpk;’ debug=’true’]

References

  1. H.S. Rzepa, "Chemical datuments as scientific enablers", Journal of Cheminformatics, vol. 5, 2013. https://doi.org/10.1186/1758-2946-5-6