Posts Tagged ‘Bob Hanson’

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

Full-colour 3D printing of molecular models and orbitals (wavefunctions).

Sunday, August 18th, 2013

We have been experimenting with full-colour 3D printing of molecular objects. I thought I might here share some of our observations. Firstly, I list the software used:

  1. Crystal structures as sources of ball&stick models (e.g. the CCDC database).
  2. Gaussian style cube files for sources of wavefunctions.
  3. There are plenty of other sources of course, in fact any file type which is supported by ..
  4. Jmol 13.3 (the app, not the applet) to render the above.
  5. And www.shapeways.com who provide the full colour 3D printing service.

My first attempt was to 3D print a molecular orbital; in fact the one shown in this post. To be printable, a 3D object must be fully connected, in other words not contain any disconnected components. To ensure this is true for a molecular orbital, one has to select a very low isosurface threshold; 0.005 au in this case. The orbital is computed as a Gaussian cube, and converted to a .wrl file as follows

  1. Start the Jmol.app.
  2. In the console, enter e.g. 
    isosurface sign color yellow green cutoff 0.005 "144.cub"
    (where 144.cub is the Gaussian cube file). Then
  3. write model.wrl
    to write out a VRML (.wrl) file. 
  4. Create an account at Shapeways, go to “make your own” and upload the .wrl file. After about five minutes, it should appear under “my models“, looking something like below:
    674x501_1187965_1110725_1372769635
  5. Select “full color sandstone” as the material and see what the quoted price is. For the above it was €3.25. It is actually quite tricky to anticipate what physical size this represents, but upon printing and receiving it by post, it turned out to be about 2 cm in size! I should point out that it takes a day or so for  Shapeways to confirm that the model has been sent to manufacturing (it is perfectly possible that it may be rejected at this stage because it cannot be manufactured for whatever reason).
  6. The thing now is to get the model to scale. To do this, a scale-factor has to be applied to the VRML file, which is easier said than done. Fortunately (thanks Bob Hanson!) this can be applied at the Jmol stage, and after step 2 above in the Jmol console, apply the command:
    set exportScale 8.0
    to scale up by 8-fold, before writing out the .wrl file. You know it has worked when the size is given as cm: 13.228 w x 13.288 d x 2.786 h and the price goes up to €69. I will assume (I have not printed at this scale yet) that it is less than 13 cm across, but something big enough to hand around a group of people. I should mention that we tried a variety of ways of scaling the model using programs such as Blender, but they all proved unreliable. You can of course also set the colours in the command above.
  7. It is possible to set the scale larger than 8, but say at 10-fold the materials available to you reduce significantly. Full-colour sandstone is no longer available, and you can only print in a single colour (the materials by the way include stainless steel, for €5700.71). 
  8. The resulting model is made from gypsum with a polymer binder. I have not had the courage yet to test how robust it is by breaking one of the models; I suspect it might be fairly fragile. Time will tell.
  9. I also tried a ball&stick. The molecule selected has been described in another post and is saved by converting the .cif file to .pdb (using in my case the program Mercury). This helps normalise the bond types, producing:
    674x501_1281157_1219584_1376822682
  10. In this case, converting the crystal coordinates via Jmol to .wrl required a scaling factor of 10.0 in this instance to produce a model costed as €24.53. It is very much a matter of adjusting the exportscale against the resulting printing price to get the desired result (by trial and error, but perhaps there is a more systematic way of doing this?). One of my colleagues (Paul) has had this sort of thing printed to about 25cm in size for about this price, and the model seems reasonably robust to physical handling. It may also benefit by fine-tuning of the bond radius; thicker would clearly be stronger.

If anyone reading this post has their own experience of 3D colour printing of chemical models, do please post comments here. And I dare say that in a few years time, students will simply press the “3D print” button on the tablet they are using to view lecture notes to get a copy. Mind you, I am somewhat ambivalent about such a process, having spent the last twenty years trying to discourage students from using the “2D print” button on their computer. Will I eventually come to adopt the same attitude to 3D print (if you click on the MO image above, you will get a virtual 3D model instead of a physical one). 


The width of a bond can be set using the Jmol command: set bondRadiusMilliAngstroms 300

Non covalent interactions in the Sharpless transition state for asymmetric epoxidation.

Wednesday, December 19th, 2012

The Sharpless epoxidation of an allylic alcohol had a big impact on synthetic chemistry when it was introduced in the 1980s, and led the way for the discovery (design?) of many new asymmetric catalytic systems. Each achieves its chiral magic by control of the geometry at the transition state for the reaction, and the stabilizations (or destabilizations) that occur at that geometry. These in turn can originate from factors such as stereoelectronic control or simply by the overall sum of many small attractions and repulsions we call dispersion interactions. Here I take an initial look at these for the binuclear transition state shown schematically below.

sharpless-binuclear

The NCI method was described recently[1] as a method for probing the non-covalent electron density in a molecule. It does this by cleverly filtering out the covalent density via computing a first derivative of the density ρ(r) called the reduced density gradient and taking the band of values appropriate for non-covalent densities. By inspecting the Laplacian of these densities at any point in space, the region can be characterised as attractive, repulsive or neutral. Visually, this information can be transformed into isosurfaces which are colour coded depending on whether the region is attractive (=blue to green) or repulsive (yellow to red). In the previous post, it turned out that the attractive contributions to the dispersion energies differed for the two diasteromeric transition states (in the conformations calculated) by about 2.6 kcal/mol. Shown below are the two NCI surfaces for these which allow one to get some insight into where this overall contribution might come from (together with weak hydrogen bonds and other non-covalent contributions).

(R)-diastereomer. NCI surfaces

(R)-diastereomer. Click for NCI surfaces

(S)-diastereomer.  Click for  NCI surfaces.

(S)-diastereomer. Click for NCI surfaces.

Yes, it is a very complex diagram, and you really do need to study it by obtaining the 3D model and rotating it around to explore the 3D space. I would note that it is possible to integrate the NCI function (see [2] for an example and leading references) and hence try to obtain further insights. I highlight just one here;  the terminal  =CH2 of the allyl alcohol points into empty space for  (R), but folds back to interact with the catalyst for  (S). 

Finally, in case you are asking how do I obtain an NCI surface, I have created a little web site where you can submit a computed (or indeed experimental) electron density cube for processing using Jmol. Give it a go and see how it works (and thanks to  Julia  Contreras-Garcia and  Bob Hanson for putting this together).

References

  1. E.R. Johnson, S. Keinan, P. Mori-Sánchez, J. Contreras-García, A.J. Cohen, and W. Yang, "Revealing Noncovalent Interactions", Journal of the American Chemical Society, vol. 132, pp. 6498-6506, 2010. https://doi.org/10.1021/ja100936w
  2. J.L. Arbour, H.S. Rzepa, J. Contreras‐García, L.A. Adrio, E.M. Barreiro, and K.K.(. Hii, "Silver‐Catalysed Enantioselective Addition of OH and NH Bonds to Allenes: A New Model for Stereoselectivity Based on Noncovalent Interactions", Chemistry – A European Journal, vol. 18, pp. 11317-11324, 2012. https://doi.org/10.1002/chem.201200547

“Text” Books in a (higher) education environment.

Friday, May 18th, 2012

Text books (is this a misnomer, much like “papers” are in journals?) in a higher-educational chemistry environment, I feel, are at a cross-roads. What happens next?

Faced with the ever-increasing costs of course texts, the department where I teach introduced a book-bundle about five years ago. The bundle included all the recommended texts for an appreciable discount over individual purchase. In their first week at Uni, students were encouraged to acquire the bundle. As it happened, I met them for a tutorial shortly after this acquisition. The bundle weighed some 9 kg, and came shrink-wrapped into a strapless plastic sheath, posing a rather slippery and weighty challenge for the student to get back to their residency. A few months later, I asked the students how they were getting on reading their newly acquired texts. You must appreciate that it does take a few months for students to start getting “street-wise” about their uni experience. One savvy student recounted they had learnt that if one did not remove the plastic outer layer from the bundle, it would retain much of its resale value to the next generation of incoming students.

Now, I will not mention the publisher of this particular bundle, but its cost is in the region of £50 per text. And for some students, the 1500 or so pages of each volume remain largely unread. Rarely if ever do I see these texts brought into tutorials, and I expect the margins remain blank, un-annotated with any questions or notes (it affects the resale value if you do that). Which is a stark contrast to how the students nowadays annotate their lecture note hand-outs often (but not invariably) issued to them at the start of a lecture. I also observe that increasingly my tutorials are effectively annotated by the students attending (2-4 pages of notes can be taken during a 50 minute discussion. The unit can be declared as pages, since this is also done on paper).

Despite these trends, pedagogic usage of tablet devices such as Kindles and iPads remains relatively low. It is a chicken-and-egg situation. The aforementioned book bundle is not available for these devices, and if it were, then in the current business model, it would be DRM (digital-rights-management) protected to prevent resale, and would also probably retain (if not exceed) the cost of the printed version. Hardly attractive to a student. The lecture notes we distribute (as printed handouts) do indeed come as PDF versions which can be placed on a mobile tablet, but this advantage alone has not sufficed to promote rapid uptake of tablet here. Few materials are specifically optimised to take advantage of the unique features of a tablet, and so the printed lecture notes are considered acceptable. Perhaps this comes to the core of what such tablets are supposed to be. Are they devices for “content consumption”, or should we also expect them to be capable of “content creation”? Lecture (and tutorial) annotation is of course content creation (or perhaps augmentation). 

I might also take a look at the situation from the point of view of the textbook author. Unless you are a big name, you might expect to redeem about 10% royalties from one of the traditional publishers of academic texts. It might take you a year or so to write it, and you would expect to issue a further edition five years down the line if the book is successful. Two generations ago, every academic might be expected to write at least one book. I suspect that aspect has reduced nowadays; authors can hardly be encouraged to write if they think there is a prospect that the shrink-wrapping might not even be removed! If you are intending to write a text about, lets say stereochemistry, you also have to accept the 2D limitations of a printed book, or the inability to say animate a reaction path.

Where are these thoughts leading? Well, I do have to give an explicit example; Steve Jobs’ vision of the educational text-book, re-invented along the lines of what he famously introduced for music distribution. There, he recognised that the (presumed illegal) sharing of music via download sites that preceded the iTunes store was not a sustainable model. The $.99 download was conspicuously cheaper than the price of a physical music CD (excepting classical music, which did become absurdly cheap in this form), and a compromise on sharing stipulated only on devices owned by you rather than more widely amongst your friends. The same model was introduced for the iBook store. Here, the author of an eBook (I am no longer calling it a textbook) can if they wish retain 70% of whatever income it generates (it can also be free of course). The unit price was a fraction of the traditional paper-based book, low enough that the DRM-imposed inability to resell it was less of an issue.

What are the downsides of moving on from paper?

  1. Well, unlike a paper book which is instantly useable, the reader has to purchase a device. This device can cost more than the book bundle referred to above, although at its cheapest, the device is actually only about half the cost of the book bundle. And one might expect that device to last only 2-4 years before it becomes obsolete.
  2. It can be lost or damaged, although unlike a paper book, the online content can be readily restored at zero cost .
  3. If you purchase an eBook for one (proprietary) device, you cannot transfer it to another such device (say Kindle to iPad or vice versa), although if the content is free, that would not matter.
  4. Authors of such texts will have to retrain themselves to produce ebooks; it is not just a matter of using a standard word processor any more. I suspect writing/imaging/styling/scripting/widgeting (a verb for this collective process is needed; how about to flow?) an ebook takes a lot longer than word processing a text-book.
  5. You might have to consider the ongoing cost of using an ebook. By this I mean the data-plan that you might need in place to download components which are not actually part of the book (see below).

The upsides? Well, rather than my producing a list at this point, you might want to take a look at the first two examples below, both created by Bob Hanson, and think about how such inclusion in an ebook might enhance it:

  1. A device-sensitive page for display (try this out on an iPad or Android tablet; the Kindle might be more of a challenge).
  2. A page for building and minimising a molecular model
  3. This example is included, since it belongs to a chemistry text book, but actually would exist on a mobile device in functional form, if not actually a component of an ebook.

So an ebook becomes an environment where you can download a model from public databases, and annotate it with properties etc. Or you could use your ebook to build a model from scratch, then minimise its (molecular mechanics) energy, to say explore conformational analysis in the context of a chapter on the topic.

Well, at the start I posed the question what happens next? The two above examples give possible answers. An equally interesting question might then be who makes it happen? Will that be the evolutionary role of the traditional publishing houses? Will a new generation of skilful author capable of “flowing” an ebook emerge? Will students instead favour retaining their dependency on paper? Watch this space.

"Text" Books in a (higher) education environment.

Friday, May 18th, 2012

Text books (is this a misnomer, much like “papers” are in journals?) in a higher-educational chemistry environment, I feel, are at a cross-roads. What happens next?

Faced with the ever-increasing costs of course texts, the department where I teach introduced a book-bundle about five years ago. The bundle included all the recommended texts for an appreciable discount over individual purchase. In their first week at Uni, students were encouraged to acquire the bundle. As it happened, I met them for a tutorial shortly after this acquisition. The bundle weighed some 9 kg, and came shrink-wrapped into a strapless plastic sheath, posing a rather slippery and weighty challenge for the student to get back to their residency. A few months later, I asked the students how they were getting on reading their newly acquired texts. You must appreciate that it does take a few months for students to start getting “street-wise” about their uni experience. One savvy student recounted they had learnt that if one did not remove the plastic outer layer from the bundle, it would retain much of its resale value to the next generation of incoming students.

Now, I will not mention the publisher of this particular bundle, but its cost is in the region of £50 per text. And for some students, the 1500 or so pages of each volume remain largely unread. Rarely if ever do I see these texts brought into tutorials, and I expect the margins remain blank, un-annotated with any questions or notes (it affects the resale value if you do that). Which is a stark contrast to how the students nowadays annotate their lecture note hand-outs often (but not invariably) issued to them at the start of a lecture. I also observe that increasingly my tutorials are effectively annotated by the students attending (2-4 pages of notes can be taken during a 50 minute discussion. The unit can be declared as pages, since this is also done on paper).

Despite these trends, pedagogic usage of tablet devices such as Kindles and iPads remains relatively low. It is a chicken-and-egg situation. The aforementioned book bundle is not available for these devices, and if it were, then in the current business model, it would be DRM (digital-rights-management) protected to prevent resale, and would also probably retain (if not exceed) the cost of the printed version. Hardly attractive to a student. The lecture notes we distribute (as printed handouts) do indeed come as PDF versions which can be placed on a mobile tablet, but this advantage alone has not sufficed to promote rapid uptake of tablet here. Few materials are specifically optimised to take advantage of the unique features of a tablet, and so the printed lecture notes are considered acceptable. Perhaps this comes to the core of what such tablets are supposed to be. Are they devices for “content consumption”, or should we also expect them to be capable of “content creation”? Lecture (and tutorial) annotation is of course content creation (or perhaps augmentation). 

I might also take a look at the situation from the point of view of the textbook author. Unless you are a big name, you might expect to redeem about 10% royalties from one of the traditional publishers of academic texts. It might take you a year or so to write it, and you would expect to issue a further edition five years down the line if the book is successful. Two generations ago, every academic might be expected to write at least one book. I suspect that aspect has reduced nowadays; authors can hardly be encouraged to write if they think there is a prospect that the shrink-wrapping might not even be removed! If you are intending to write a text about, lets say stereochemistry, you also have to accept the 2D limitations of a printed book, or the inability to say animate a reaction path.

Where are these thoughts leading? Well, I do have to give an explicit example; Steve Jobs’ vision of the educational text-book, re-invented along the lines of what he famously introduced for music distribution. There, he recognised that the (presumed illegal) sharing of music via download sites that preceded the iTunes store was not a sustainable model. The $.99 download was conspicuously cheaper than the price of a physical music CD (excepting classical music, which did become absurdly cheap in this form), and a compromise on sharing stipulated only on devices owned by you rather than more widely amongst your friends. The same model was introduced for the iBook store. Here, the author of an eBook (I am no longer calling it a textbook) can if they wish retain 70% of whatever income it generates (it can also be free of course). The unit price was a fraction of the traditional paper-based book, low enough that the DRM-imposed inability to resell it was less of an issue.

What are the downsides of moving on from paper?

  1. Well, unlike a paper book which is instantly useable, the reader has to purchase a device. This device can cost more than the book bundle referred to above, although at its cheapest, the device is actually only about half the cost of the book bundle. And one might expect that device to last only 2-4 years before it becomes obsolete.
  2. It can be lost or damaged, although unlike a paper book, the online content can be readily restored at zero cost .
  3. If you purchase an eBook for one (proprietary) device, you cannot transfer it to another such device (say Kindle to iPad or vice versa), although if the content is free, that would not matter.
  4. Authors of such texts will have to retrain themselves to produce ebooks; it is not just a matter of using a standard word processor any more. I suspect writing/imaging/styling/scripting/widgeting (a verb for this collective process is needed; how about to flow?) an ebook takes a lot longer than word processing a text-book.
  5. You might have to consider the ongoing cost of using an ebook. By this I mean the data-plan that you might need in place to download components which are not actually part of the book (see below).

The upsides? Well, rather than my producing a list at this point, you might want to take a look at the first two examples below, both created by Bob Hanson, and think about how such inclusion in an ebook might enhance it:

  1. A device-sensitive page for display (try this out on an iPad or Android tablet; the Kindle might be more of a challenge).
  2. A page for building and minimising a molecular model
  3. This example is included, since it belongs to a chemistry text book, but actually would exist on a mobile device in functional form, if not actually a component of an ebook.

So an ebook becomes an environment where you can download a model from public databases, and annotate it with properties etc. Or you could use your ebook to build a model from scratch, then minimise its (molecular mechanics) energy, to say explore conformational analysis in the context of a chapter on the topic.

Well, at the start I posed the question what happens next? The two above examples give possible answers. An equally interesting question might then be who makes it happen? Will that be the evolutionary role of the traditional publishing houses? Will a new generation of skilful author capable of “flowing” an ebook emerge? Will students instead favour retaining their dependency on paper? Watch this space.