Showing posts with label jmol. Show all posts
Showing posts with label jmol. Show all posts

Sunday, November 22, 2015

Quick way to share interactive molecular structures and animations


Here is a neat trick I learned from @gyges01 on Twitter.  Say you want to share an interactive molecular structure or animation with someone not well versed in structural visualization tools. Here's what you do.

1. Put your file on a server like figshare and copy the link. For example: http://files.figshare.com/1860026/ethen_01oIRC.cml
Unfortunately, a dropbox link, which would have been even easier, does not seem to work. See below

2. Combine this link with "http://chemapps.stolaf.edu/jmol/jmol.php?source=":
http://chemapps.stolaf.edu/jmol/jmol.php?source=http://files.figshare.com/1860026/ethen_01oIRC.cml

3. Email (or Tweet) the link (takes a minute to load) with instructions to start animation: right-click > animation > play

4. You can autostart the animation by uploading a "dummy" xyz file with the commands: http://chemapps.stolaf.edu/jmol/jmol.php?source=http://files.figshare.com/2367420/ethen_test.xyz

ethen_test.xyz looks like this:

1
jmolscript: load http://files.figshare.com/1860026/ethen_01oIRC.cml; animation on; animation mode palindrome;
h 0.0 0.0 0.0

2015.11.23 Update Twitter strikes again: @aminophen found the trick to making this work with Dropbox.  Change https://www.dropbox.com/s/xxx/file?dl=0 to http://dl.dropboxusercontent.com/s/xxx/file.  Example:
https://www.dropbox.com/s/t42dx22mxsioja6/ethen_test.xyz?dl=0 to http://dl.dropboxusercontent.com/s/t42dx22mxsioja6/ethen_test.xyz and use it like before: http://chemapps.stolaf.edu/jmol/jmol.php?source=http://dl.dropboxusercontent.com/s/t42dx22mxsioja6/ethen_test.xyz



This work is licensed under a Creative Commons Attribution 4.0

Saturday, November 22, 2014

Computing a solvent accessible surface area using Jmol


Someone asked me how to compute a surface area of a molecule.  Here's how to compute a solvent accessible surface area using Jmol.

1. Load your molecule into Jmol (File > Open)

2. Open the Script Editor and Output Console (File > Script Editor, etc)

3. Type the following three lines into the Script Editor window and hit run

set solventproberadius 1.2
isosurface solvent
isosurface area set 0

1.2 Å is the probe radius for water solvent.  If you are using another solvent input another value.  It will correspond roughly to the radius of the solvent molecule.

4. The are will be printed out in the Console.  The units are not specified but I'm sure it's Å2 (square Ångstrom)

Friday, December 13, 2013

Illustrating energy states and estimating enthalpy changes




Here are two videos in which I use Jmol and Molecular Workbench to illustrate energy states and MolCalc to estimate enthalpy changes. The videos are part of a series that I am working on.


This work is licensed under a Creative Commons Attribution 4.0 International License.

Saturday, June 15, 2013

Illustrating EFMO fragmentation with Jmol

On Tuesday I am giving a talk and I want to illustrate fragmentation of a protein for the EFMO method.  So I used Jmol to create this movie which I will embed in a Powerpoint slide

The underlying Jmol script is here.  Just paste it in to the Jmol Script Console and record the screen (I used Screenflow, but screencast-o-matic is a free alternative).

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Thursday, September 6, 2012

Peer instruction questions for very basic molecular quantum mechanics

As I mentioned in my previous blog post I this year I made some screencasts of lectures to free up time for peer instruction questions.  Here are the peer instruction questions I used.



This time I tried Socrative for voting, which allows students to type in short answers to questions.  I can then select some of the questions and have students vote on their favorite.  This is what's happening in slide 13 and 23.

You'll notice I also made use of Molecule Calculator, which is introduced here.  Next year I have to remember also to assign the MolCalc intro video.




This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Tuesday, August 14, 2012

The Molecule Calculator



What is MolCalc?
MolCalc is a web interface that allows anyone to build (small*) molecules and estimate** molecular properties such as molecular structure, heats of formation, vibrational frequencies and vibrational modes, and molecular orbitals and orbital energies in a matter of seconds or minutes - depending on the size.  

MolCalc is designed for teaching as opposed to research - specifically for assignments in which students build their own molecules and estimate their own molecular properties.  (**MolCalc is therefore designed to run fast and the estimated molecular properties will not match experimental values exactly, and in some cases be quite different.)  The idea is to have students develop a “chemical intuition” about how molecular structure affects molecular properties, without performing the underlying calculations by hand (which would be near impossible for all but the simplest chemical systems).

How can I use MolCalc in teaching?
Just like a pocket calculator or a symbolic math program (such as Mathematica or MAPLE), MolCalc allows one to assign “higher level” chemical problems that are not practically possible to solve otherwise.  

For example, one might now ask students to compute the effect of a substituent on a particular vibration, and then rationalize the effect using molecular orbitals.  Or one might ask more open ended questions such as “build a molecule with an unusually long C-C single bond”.

How does MolCalc work?
In the Molecule Editor page the molecular structure is build using Jmol and energy minimized using the UFF force field as implemented in Jmol.

In the Molecule Calculator page the structure is re-optimized at the PM3 level of theory for a maximum of 50 steps.  This structure is then used to compute the heat of formation or vibrational frequencies at the PM3 level of theory, or the molecular orbitals using the RHF/STO-3G level of theory.  These calculations are performed with the GAMESS program. OpenBabel is used to manage input files and coordinate files.

*MolCalc 1.0 allows calculations on (closed shell) molecules with only doubly occupied molecular orbitals and with less than 11 non-hydrogen atoms.

Can I modify and/or install MolCalc on my own server?
Yes, MolCalc is distributed through github under the GPL license (

). You must obtain a copy of the GAMESS code separately from http://www.msg.ameslab.gov/gamess/download.html

The interface code uses PHP5, jQuery, HTML5, and CSS3 and is very modular.  It therefore quite easy to add new capabilities to MolCalc.


What if I find a bug in MolCalc?
Please report it here.
Who is involved with MolCalc?
MolCalc 1.0 is written by Jimmy Charnley Kromann based on an idea by Jan Jensen. Toke Fritzemeier wrote an early prototype.  The Molecule Editor was inspired, in part, by the Virtual Molecular Modeling Kit.

The development of MolCalc is supported by the University of Copenhagen through the Education at its Best initiative (Den gode uddannelse).


Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.  

Sunday, April 15, 2012

Virtual Molecular Modeling Kit



I recently came across a very interesting resource called the Virtual Molecular Modeling Kit.  It looks like it can do an awful lots of things and I have only scratched the surface myself.

Very commendably, the authors Otis Rothenberger and Thomas Newton, have created a set of instructional videos.  The video below highlights the fact Jmol 12.2 and later versions now have a molecular editor, which I somehow had completely missed.



These, and related sites such as this one and this one, are examples of what I call chemical calculators.  In analogy with conventional calculators, they allow effortless computations for certain quantities that, before, we would have to laboriously compute by hand, or approximate, or memorize.

Students are no longer required to manually compute square roots or take logarithms.  We now have these calculators that can compute dipole moments, electrostatic potentials and orbitals, with roughly the same effort it takes to use a calculator.  Perhaps we should stop requiring students to memorize nomenclature and perform trivial computations and start teaching them how to solve more interesting chemical problems using these tools. 

Friday, February 24, 2012

Saturday, May 14, 2011

Molecular modeling and peer instruction

Last Tuesday I had my first go at using peer instruction.  Peer instruction is a fancy term for a relatively simple process:

1. Put up a multiple choice question
2. Ask the students to come up with an answer without talking to each other. Give them 2-3 minutes.
3. Have a vote (more on how below)
4. If 80 % or more get the right answer, show the right answer, give a short explanation, and move on.
5. If less than 80 % get the right answer, ask the students to discuss it with their neighbor. Give them 3-5 minutes.
6. Have another vote.
7. Give them the right answer and explain it.

Voting using Polleverywhere.com

The screencast (best viewed in full-screen mode) shows how I use the website Polleverywhere.com for the voting.  It requires the students to have access to a browser, so I ask them to bring a smartphone or a laptop to class.  It is also possible to submit votes by SMS, but Polleverywhere only provides a British phone number for Europe, so this gets pricey in Denmark.

The free version of Polleverywhere.com can register up to 30 votes.  For larger classes your department needs to buy a six or 12 month subscription, the latter is about $900.  You just create an account on the site, create your poll, and you are ready to go. 

All my questions have four options labelled A, B, C, and D, so I just create one poll per course.  The example in the screencast is used in a course called KemiF1, so the codes for the options are kemif1A - kemif1D.  You do need to create completely unique codes.  The site assigns you numerical codes by default, so you can also just use those.  The website with the question is here.  Option D is "don't know".  It is important to have that option so that everyone casts a vote every time.

I thought it would be cool for the students to see the votes coming in live, but they felt it biased their vote too much, so it is better to leave the question up as they vote, and show the results when the vote is done.  You can monitor the progress on the vote on another device such as a smartphone or iPad.

Why use peer instruction?
Much has been written about peer instruction (just google it), but I find the two videos posted here especially informative.  And think about this: if you lecture on organic chemistry and less than 80 % of your students understand what you mean when you draw a hexagon, is there really any point in going on to more complicated material?


Peer instruction and molecular modeling
The real challenge when using peer instruction is to come up with good questions and I think molecular modeling and visualization can contribute a lot here.  For example, the spinning models in the example  reinforces the fact that cyclohexane is not planar.  Note that the students can go to the page and interact with each model as they mull their options.

I will show more examples of using molecular modeling and peer instruction in future posts.

Monday, May 9, 2011

Interactive chemistry ebooks: interactive figures

Here is version 2 of my ebook mockup page (see here for a description of version 1).  Actually there are two versions: one using Jmol and one for the iPad.

The Jmol version is how I would like the page to look.  The static figures are replaced with interactive Jmol versions embedded right in the page, and the figure captions contain links (denoted by ">>") to larger version of the figures on a separate page, that also contain extra features such as animations (Figure 3.1) or overlays (Figure 3.2).  An alternative design would have been to keep the static images, but insert links to the larger figures.  I think I like the current look better.  But for pages with more figures loading-time could become an issue with Jmol.

The iPad version is what is currently possible for the iPad with ChemDoodle Web Components.  We are waiting for two things to happen: 1) WebGL in Mobile Safari, which will allow real 3D representations of the molecules, and 2) Implementation of contours and surface maps in ChemDoodle Web Components.

For the iPad version I generated the necessary ChemDoodle Web Component HTML code using the ChemDoodle software package, as I show in this screencast.  The mol2 file I start with is generated with Avogadro.

ChemDoodle costs $60, and normally I restrict this blog to free software, but I am making an exception here because I think iChemlabs deserves to be supported since they made ChemDoodle Web Components open source.  Furthermore, since I have access to the source code I could probably figure out the format for the HTML code, if I wasn't so lazy.

Related blog-posts:
Interactive chemistry ebooks: highlight and annotate
Interactive chemistry ebooks: let us start now!
ChemDoodling: now in 3D, but not (yet) on the iPad
ChemDoodling on the iPad and the future of interactive chemistry text books
iPad: even 3D molecules that can be viewed from any angle

Monday, April 4, 2011

A Jmol atom picker

On this page you can find a simple example of how to identify atoms in a Jmol molecule.  My idea is to use it to create interactive practice problems for identifying chiral centers and things like that.  But I haven't really had time to pursue it, and for a while I even forgot the link to the page. So, I'll throw it up here so I know where it is, and perhaps someone else can make use of it too. 

You can see the whole code on the page (right-click, "view page source", but the main new thing here is the

jmolGetPropertyAsArray

function. The code is basically and extract of this page, written by Angel Herraez (thanks, Angel, for pointing me to that page).

Sunday, January 30, 2011

Jean-Claude Bradley's links to e-resources for organic chemistry


An interesting e-resource page for undergraduate organic chemistry compiled by open science pioneer Jean-Claude Bradley.

I haven't gone through all the links yet, but my favorite so far is the chirality relationships exercise (number 10 on the list), where Jmol is used to ask chirality-related questions (NB: I could get this to load properly in Safari, but not Firefox or Chrome). 

I think this mirrors the "mental rotations", that experienced organic chemists do to answer such questions, quite accurately.  I'm not an experienced organic chemist, so I hope I didn't make too many mistakes in the screencast.

Thursday, October 7, 2010

Nobel reactions

You may have heard this already: this years Nobel prize in chemistry went to Richard F. Heck, Ei-ichi Negishi, and Akira Suzuki "for palladium-catalyzed cross couplings in organic synthesis".  Like last year, molecular modeling and animation is here to bring the science behind the prize to life.  This time, through the very excellent Chemtube3D (a Molecular Modeling Basics favorite) and its page on on organopalladium chemistry.

Saturday, October 2, 2010

Illustrating energy states


Here is a screencast showing 2 simulations I made to illustrate energy states (often also called microstates).  Open any book on statistical mechanics and you'll see a formula like this (for the Boltzmann distribution),
and, perhaps, a figure much like this.
But what are these "energy states" and ε's exactly? Hopefully the screencast and associated simulations, which you can find here and here, will help make this clearer.

About the simulations
If you want to play around with the HCl simulation, note that you have to reload the page if you want to change the translational motion.  This simulation is made with Jmol.  The molecular dynamics simulation of butane is made with Molecular Workbench.

Wednesday, March 31, 2010

Canonical and localized molecular orbitals


Figure 4.10. 0.045 au isosurfaces of the four valence canonical MOs of NH3 computed using B3LYP/6-31G(d). A value of 0.045 au is chosen because it results in a 0.002 au isodensity surface when squared.
From Molecular Modeling Basics CRC Press, May 2010.
Click on the picture for an interactive version

According to Valence Shell Electron Pair Repulsion (VSEPR) theory many bond angles involving elements such as C, N, and O are close to 109.5o because the four valence electron pairs that surround these atoms adopt a tetrahedral geometry to minimize repulsion. In the case of CH4 the H-C-H angle is exactly 109.5o because the repulsion between the four electron pairs in the C-H bonds are identical. NH3 has a lone pair that is fatter than a bond near the nucleus, so the lone pair-bond repulsion is slightly larger than the bond-bond repulsion. This results in a H-N-H angle of 107o, slightly smaller than 109.5o.

However, this is far from obvious when looking at the four valence MOs of NH3 (Figure 4.10) computed using B3LYP/6-31G(d). The reason is that that MOs are not unique, and that these MOs (which lead to a diagonal Fock matrix and are known as canonical MOs) are not the MOs where the electron pair repulsion is a minimum. Algorithms have been implemented that find a new set of MOs (localized MOs or LMOs) that represent a linear combination of canonical MOs for which the MO–MO repulsion is a minimum (Figure 4.11).


Figure 4.11. 0.045 au isosurfaces of the four valence localized MOs of NH3 computed using B3LYP/6-31G(d). There are three N–H bond LMOs [(a)–(c)] and one lone pair LMO [(d)].
From Molecular Modeling Basics CRC Press, May 2010.
Click on the picture for an interactive version

LMOs for which the inter-orbital repulsion is a minimum are called energy localized orbitals or Edmiston-Ruedenberg orbitals. Other popular choices are Foster-Boys and Pipek-Mezey LMOs, which use different localization criteria.

Using MacMolPlt
The screencast below shows how to compute Ruedenberg LMOs for ammonia using GAMESS (local=ruednbrg in the $contrl group), and how to display the LMOs, as well as the canonical MOs, in MacMolPlt. I also show how to identify the HOMO and LUMO canonical MOs in MacMolPlt.

Note that I specify a geometry optimization in the GAMESS input file. GAMESS will only compute the LMOs for the optimized geometry.




Using Jmol
I use Jmol for the interactive figures and the scripts can be found here and here. Unlike the density and electrostatic potential, Jmol can generate its own grid data, so to display MO number 2 you simply use "mo 2" in the script. I use
mo 2; mo cutoff 0.045; mo fill nomesh; mo translucent 0.2
to make it a little prettier.

Jmol cannot find the MOs in a GAMESS geometry optimization file, and Jmol only stores the LMOs if present. So to display the canonical MOs with Jmol you need a single point energy calculation (output file) and to display the LMOs with Jmol you need a single point energy calculation with local=ruednberg added (output file).

Wednesday, December 30, 2009

Quick and dirty electrostatic potential maps


In a previous post I showed how to compute an electrostatic potential map superimposed on the 0.002 isodensity surface of a molecule based on data computed using quantum chemical methods such as RHF/6-31G(d).

Previous posts (such as this one) have demonstrated that the van der Waals surface is a reasonable substitute for the 0.002 isodensity surface. Similarly, the electrostatic potential due to atomic charges can be a reasonable substitute for the electrostatic potential due to the electronic density.

The screencast above shows how to make such electrostatic potential maps using Avogadro and Jmol.

Avogadro uses an empirical method to determine the atomic charges (an integral part of the MMFF force field). It is possible to change the surface using the so-called "Iso Value" but I could not find any documentation on how that actually works. An Iso Value of 0 seems to correspond to the van der Waals sphere surface. It is currently not possible to alter the color range as far as I can see.

Jmol is not able to determine the charges, but the information can be transferred from Avogadro by saving a mol2 file. The electrostatic potential option in the Jmol menu corresponds to the following set of commands (as far as I can determine):
isosurface solvent color range -0.05 0.05 map mep
color isosurface translucent 0.5
and this set of commands can thus be used to control the color range and the nature of the surface. The default surface is a solvent accessible surface, which is slightly larger than the van der Waals surface.

A static and interactive version of the Avogadro and Jmol electrostatic potential map, respectively, can be found here.

Electrostatic potential map made with Avogadro
Click on the picture for an interactive version made with Jmol

Related blogpost: The polarity and solvation option in MolCalc

Sunday, December 27, 2009

Electrostatic potential maps reloaded

Here is an interactive version of a figure I described in a previous post. Click on the picture to load it. Remember it's Jmol so you can rotate it and zoom as you like (Mac users: this works best with Safari).
Figure 3.4. The RHF/6-31G(d) electrostatic potential of water.
Click on the picture for an interactive version

The Jmol animation loads a file (fig3-2-2.xyz), which you can access by right-clicking on the Jmol animation once you have loaded it (as described in a previous post). This file also contains all the necessary commands.

Figure 3.4.c is the most common depiction of electrostatic potential maps and the Jmol general syntax for the command for this is
isosurface 0.002 "density.cube.gz" color range -0.05 0.05 "potential.cube.gz"
The screencast below shows how I made the cube files that contain the electron density and electrostatic potential information using MacMolPlt. The first part is identical to the screencast in a previous post on obtaining the electron density cube file.

The program I used to convert the MacMolPlt file to a cube was written by Jonathan Gutow and can be download here.

I start by loading the RHF/6-31G(d) optimized geometry I computed for a previous post, and reorienting. The orientation makes it easier to define the plotting plane for the contour plots.

Saturday, December 26, 2009

Wishlist

Christmas is only 363 days away. It's never to early to start working on a new wish list.



Sunday, November 29, 2009

Electron density reloaded

Here is an interactive version of a figure I described in a previous post. Click on the picture to load it. Remember it's Jmol so you can rotate it and zoom as you like (Mac users: this works best with Safari).
Figure 3.1. The RHF/6-31G(d) electron density of water.
Click on the picture for an interactive version

The Jmol animation loads this file (h2oprinc.xyz), which looks like this
3
jmolscript: script "http://propka.ki.ku.dk/~jhjensen/h2odensity.spt"
O -0.0000 0.0643 0.0000
H -0.7541 -0.5091 0.0000
H 0.7541 -0.5091 0.0000
and which, in turn, loads a script (h2odensity.spt), which looks like this
isosurface planex plane {0 0 0 0} contour 20 color absolute 0.002 0.05 "http://propka.ki.ku.dk/~jhjensen/h2oprinc.cube.gz"
delay 3
spin y 20
delay 10
spin off
isosurface planey plane {1 0 0 0} contour 20 color absolute 0.002 0.05 "http://propka.ki.ku.dk/~jhjensen/h2oprinc.cube.gz"
spin y 20
delay 10
spin off
isosurface planez plane {0 1 0 0} contour 20 color absolute 0.002 0.05 "http://propka.ki.ku.dk/~jhjensen/h2oprinc.cube.gz"
spin x 40
delay 10
spin off
isosurface threed 0.002 "http://propka.ki.ku.dk/~jhjensen/h2oprinc.cube.gz"
color isosurface red ; color isosurface translucent 0.15
spin y 20
delay 10
spin off
color isosurface red ; color isosurface translucent 0.5
select all; spacefill 100 %babel
spin y 20
delay 10
spin off
The screencast below shows how I made the cube file that contains the electron density information using MacMolPlt. The program I used to convert the MacMolPlt file to a cube was written by Jonathan Gutow and can be download here. In the screencast I mistakenly named the cube file h2odensity.cube.gz, but that's easy to change.

I start by loading the RHF/6-31G(d) optimized geometry I computed for a previous post, and reorienting. The orientation makes it easier to define the plotting plane for the contour plots.

Sunday, October 18, 2009

Proteopedia


Proteopedia is just what the name suggests: a wikipedia for proteins. What makes it specific to proteins is the integration of Jmol for animated and interactive figures. It has a long list of pre-made entries ready for use in a lecture and, like a real wiki, you can add content as well.

A lot of the features are explained using a set of very nice screencast. The screencast above is simply a recording of the first 2 minutes of the first video (protopedia does not offer a way to embed the videos) narrated by Eran Hodis.