Showing posts with label Molecular Workbench. Show all posts
Showing posts with label Molecular Workbench. Show all posts

Sunday, May 9, 2021

Osmosis: We can simulate it, but do we really get it?

Computer simulations are useful for developing conceptual understanding of science ideas that are otherwise obscure. However, there are circumstances that simulations just raise more questions than what they answer. Osmosis is one of those deceptively simple phenomena that turn out to be quite challenging to understand, even if it can be simulated with reasonable clarity.
Figure 1. Osmotic pressure.
(Image from Wikipedia)


Osmosis is a process in which solvent molecules move -- without input of energy -- across a semipermeable membrane (which let only the solvent molecules pass) separating two solutions of different concentrations. A typical explanation is that the solvent molecules "want" to equalize the solute concentrations (or equivalently, the solvent concentrations) on the two sides. As a result, the solutions must build up persistent pressure that causes the liquid level in the left side of the U-shape tube shown in Figure 1 to rise remarkably higher against gravity.

Most people just walk away with this theory. But where exactly does the energy that elevates the liquid come from?

In the U-shape tube, no one exerts any force on the liquid in either side, while the force of gravity keeps the liquid level as low as possible. Somehow, by simply making the membrane in the middle partially permeable to only the solvent, some energy is extracted to do the heavy lifting. This process can be simulated using molecular dynamics as is shown in the YouTube video posted above. The simulation shows that, on average, the middle column eventually maintained a noticeably higher level. Removing the solute (the green particles) returned the liquid levels in the three columns to about the same.

In this simulation, the green particles and the blue particles have comparable chemical affinities, meaning that the blue particles do not particularly favor their kins around. Neither do the green particles. The white particles that represent the membrane molecules have very weak interactions with both blue and green particles.

Here is the link to the simulation (which is a Java applet). Happy New Year!

Wednesday, May 7, 2014

Iranian studies show the effectiveness of Molecular Workbench

A Molecular Workbench virtual experiment used in the Iranian study.
In the May Issue of Journal of Educational and Social Research, published by MCSER (Mediterranean Center of Social and Educational Research) in Rome, researchers from Iran and Malaysia reported that "students who were taught using the Molecular Workbench software performed better in post-tests on five chemistry topics as compared with those who received conventional instruction." This study was conducted in Iranian secondary schools with 70 students. The researchers also reported that "students using the software also found this software useful in the learning of chemistry." Their paper, titled with "Molecular Workbench Software as Computer Assisted Instruction to Aid the Learning of Chemistry", is freely available in this open-access journal. The authors are Elaheh Khoshouie, Ahmad Fauzi Mohd Ayub, and Farhad Mesrinejad, from two universities in Iran and Malaysia, respectively.

This example, once again, demonstrates the power of visualization in science education. Regardless of the culture or religion children may have grown up with, scientific visualization transcends all the man-made barriers to convey science messages to the young minds. In the case of Molecular Workbench, the effect is even more profound because the heart of it has actually been written in the universal language of humanity -- mathematics.

Wednesday, October 9, 2013

Molecular modelers won Nobel Prize in Chemistry

Martin Karplus, Michael Levitt, and Arieh Warshel won the 2013 Nobel Prize For Chemistry today "for the development of multiscale models for complex chemical systems."

The Royal Swedish Academy of Sciences said the three scientists' research in the 1970s has helped scientists develop programs that unveil chemical processes. "The work of Karplus, Levitt and Warshel is ground-breaking in that they managed to make Newton's classical physics work side-by-side with the fundamentally different quantum physics," the academy said. "Previously, chemists had to choose to use either/or." Together with a few earlier Nobel Prizes in quantum chemistry, this award consecrates the field of computational chemistry.

Incidentally, Martin Karplus is my postdoc co-adviser Georgios Archontis's thesis adviser at Harvard. Georgios is one of the earlier contributors to CHARMM, a widely-used package of computational chemistry. CHARMM was the computational tool that I used when working with Georgios almost 15 years ago. In collaboration with Martin, Georgios and I were studying glycogen phosphorylase inhibitors based on a free energy perturbation analysis using CHARMM. In another project with Spyros Skourtis, I wrote a multi-scale simulation program that couples molecular dynamics and quantum dynamics to study electron transfer in proteins and DNA molecules (i.e., use Newton's Equation of Motion to predict the trajectories of atoms, construct the Hamiltonian time series, and solve the time-dependent Schrodinger equation using the Hamiltonian series as the input).

We are thrilled by this news because much of the computational kernels of our Molecular Workbench software was actually inspired by CHARMM. The Molecular Workbench also advocates a multiscale philosophy and pedagogical approach, but for linking concepts at different scales with simulations in order to help students connect the dots and build more unified pictures about science (see the image above).

We are glad to be part of the "Karplus genealogy tree," as Georgios put it when replying my congratulatory email. We hope that through our grassroots work in education, the power of molecular simulation from the top of the scientific research pyramid will enlighten millions of students and ignite their interest and curiosity in science.

Wednesday, August 28, 2013

Modeling the hydrophobic effect of a polymer

There are many concepts in biochemistry that are not as simple as they appear to be. These are things that tend to confuse you if you mull over them. Over the years, I have found osmosis such a thing. Another such thing is hydrophobicity. (As a physicist, I love these puzzles!)

Figure 1: More "polar" solvent on the right.
In our NSF-funded Constructive Chemistry project with Bowling Green State University, Prof. Andrew Torelli and I have identified that the hydrophobic effect may be one of the concepts that would benefit the most from a constructionism approach, which requires students to think more deeply as they must construct a sequence of simulations that explain the origin of this elusive effect. Most students can tell you that hydrophobicity is "water-hating" as their textbooks simply have so written. But this layman's term itself is not accurate and might lend itself to a misconception as if there existed some kind of repulsive force between a solute molecule and the solvent molecules that makes them "hate" each other. An explanation of the hydrophobic effect involves quite a few fundamental concepts such as intermolecular potential and entropy that are cornerstones of chemistry. We would like to see if students can develop a deeper and more coherent understanding while challenged to use these concepts to create an explanatory simulation using our Molecular Workbench software.

Andrew and I spent a couple of weeks doing research and designing simulations to figure out how to make such a complex modeling challenge realistic for his biochemistry students to do. This blog post summarizes our initial findings.

Figure 2. The radii of gyration of the two polymers.
First we decided that we would like to set this challenge on the stage of protein folding. There are few problems in biochemistry that are more fundamental than protein folding. So this would be a good brain teaser that could stimulate student interest. But protein folding is such a complex problem. So we would like to start with a simple 2D polymer that is made of identical monomers. This polymer is just a chain of Lennard-Jones particles linked by elastic bonds. The repulsion core of the Lennard-Jones potential models the excluded volume of each monomer and the elastic bonds link them together as a chain. There is no force that maintains the angles of the chain. So the particles can rotate freely. This model is very rough, but it is already an order of magnitude better than the ideal chain, which assumes a polymer as a random walk and neglects any kind of interactions among monomers.

Figure 3. Identical solvents (weakly polar).
Next we need a solvent model. For simplicity, each solvent molecule is represented by a Lennard-Jones particle. Again, this is a very rough model for water as solvent as it neglects the angular dependence of hydrogen bonds among water molecules. A better 2D model for water is the Mercedes-Benz model, so called because its three-arm model for hydrogen bonding resembles the Mercedes-Benz logo. We will probably include this hydrogen bonding model in our simulation engine in the future, but for now, the angular effect may be secondary for the purpose of this modeling project.

As with themselves, the polymer and solvent molecules interact with each other through a Lennard-Jones potential. Now, the question is: Are these interactions we have in hands sufficient to model the hydrophobic effect? In other words, can the nature of hydrophobicity be explained by using this simple picture of interactions? Would Occam's razor be good in this case? I feel that this is a crucial key to our Constructive Chemistry project: If a knowledge system can be reduced to only a handful of rules students can learn, master, and apply in a short time without being too frustrated, the chance of succeeding in guiding them towards learning through construction-based inquiry and discovery would be much higher. Think about all those successful products out there: LEGO, Minecraft, Algodoo, and so on. Many of them share a striking similarity: They are all based on a set of simple building blocks and rules that even young children can quickly learn and use to construct meaningful objects. Yet, from the simplicity rises extremely complex systems and phenomena. We want to learn from their tremendous successes and invent the overdue equivalents for chemistry and biology. The Constructive Chemistry project should pave the road for that vision.
Figure 4. Identical solvents (strongly polar).

Back to modeling the hydrophobic effect: Does our simple-minded model work? To answer this question, we must be able to investigate the effect of each factor. To do so, we set up two compartments separated by a barrier in the middle. Then we put a 24-bead polymer chain into one of them and then copy it to another. In order for them not to move to the edges or corners of the simulation box (if they stay near the edges then they are not fully solvated), we pin their centers down using an elastic constraint. Next we will put different types of solvent particles into the two compartments. We also use some scripts to keep the temperatures on both sides identical all the time and export the radii of gyration of the two polymers to a graph. The radius of gyration of a polymer approximately describes its dimension.

By keeping everything else but one factor identical in the two compartments, we can investigate exactly what is responsible for the hydrophobic effect for the polymers (or its relative importance). Our hypothesis at this point is that the hydrophobic effect would be more pronounced if the solvent-solvent interaction is stronger. To test this, we set the Lennard-Jones attraction between solvent B (right) particles to be three times stronger than that between solvent A particles, while keeping everything else such as mass and size exactly the same. Figure 1 shows a series of snapshots taken from a nanosecond-long simulation (this model has 550 particles in total, but on my Lenovo X230 tablet it runs speedily). The results show that the polymer on the right folds into a hairpin-like conformation with its two freely-moving terminals pointing outwards from the solvent, suggesting that it attempts to leave the solvent (but cannot because it is pinned down). And this conformation and location last for a long time (in fact most of the time during the simulated nanosecond). In comparison, the polymer on the left has no stable conformation or location -- it is randomly stretched in the solvent most of the time and does not prefer any specific location. I think this is the evidence for the hydrophobic effect in two senses: 1) The polymer attempts to separate from the solvent; and 2) the polymer curls up to make room for more contacts among the solvent particles (this is related to the so-called hydrophobic collapse in the study of protein folding). The second can be further visualized by comparing the radii of gyration (Figure 2), which consistently differ by 2-3 angstroms.

Note that we did not introduce any special interaction between the polymers and the solvent particles of either type. The interaction between the polymer with a solvent particle is exactly the same in both compartments. The only difference is the solvent-solvent interaction. The difference in the simulation results for the two polymers is all because it is energetically more favorable for the solvent particles in the right compartment to stay closer. After numerous collisions (this is sometimes called entropy-driven), the hairpin conformation emerges as the winner for the polymer on the right.
Figure 5: Higher temperatures.

To make sure that there is no mistake, we ran another simulation in which the two solvents were set to be identically weak-polar. Figure 3 shows that there was no clear formation of a stable conformation for either polymer in a nanosecond-long simulation. Neither polymer curled up.

Next we set the two solvents to be identically strong-polar. Figure 4 shows that the two polymers both ended up in a hairpin conformation in a nanosecond-long simulation.

Another test is to raise the temperature but keep the solvent-solvent interaction in the right compartment three times stronger than that in the left compartment. Can the polymer on the right keep its hairpin conformation when heated? Negative, as shown in Figure 5. This actually is related to denaturation, a process in which a protein loses its stable conformation due to heat (or other external stimuli).

These simulations suggest that our simple-minded model might be able to explain the hydrophobic effect and allow students to explore a variety of variables and concepts that are of fundamental importance in biochemistry. Our next steps are to transfer the modeling work we have done to something students can also do. To accomplish this goal, we will have to figure out how to scaffold the modeling steps to provide some guidance.

Sunday, June 30, 2013

First research paper using the Molecular Workbench submitted to arXiv

Credit: M. Rendi, A.S. Suprijadi, & S. Viridi
Researchers from Institut Teknologi Bandung, Indonesia recently submitted a paper "Modeling Of Blood Vessel Constriction In 2-D Case Using Molecular Dynamics Method" to arXiv (an open e-print repository), in which they claimed: "Blood vessel constriction is simulated with particle-based method using a molecular dynamics authoring software known as Molecular Workbench. Blood flow and vessel wall, the only components considered in constructing a blood vessel, are all represented in particle form with interaction potentials: Lennard-Jones potential, push-pull spring potential, and bending spring potential. Influence of medium or blood plasma is accommodated in plasma viscosity through Stokes drag force. It has been observed that pressure p is increased as constriction c is increased. Leakage of blood vessel starts at 80 % constriction, which shows existence of maximum pressure that can be overcome by vessel wall."

This blog article is not to endorse their paper but to use this example to illustrate the point that a piece of simulation software that was originally intended to be an educational tool can turn out to be also useful to scientists. If you are a teacher, don't you want your students to have such a tool that assumes no boundary to what they can do? The science education community has published numerous papers about how to teach students think and act like a scientist, but much less has been done to actually empower them with tools they can realistically use.

Thursday, January 17, 2013

Constructive chemistry funded by the National Science Foundation

One of the most effective pedagogies in science education is to challenge students to design and construct something that performs a function, solves a problem, or proves a hypothesis. Learning by design is a very compelling way of engaging students to learn science profoundly. Given the extensive incorporation and emphasis of engineering design across disciplines in the Next Generation Science Standards, design-based learning will only grow more important in US science education.

The problem, however, is that many science concepts are related to things that are too small, too big, too complex, too expensive, or too dangerous to be built in the classroom realistically. (If you are a LEGO fan, you may argue that LEGO can be used to build anything, but most LEGO models simulate the appearance but not the function -- a LEGO bike probably cannot roll and LEGO molecules probably do not assemble themselves. To scientists and engineers, functions are all that matters.)

Three approaches of using science models.
A good solution is to have students design computer models that work in cyberspace. This virtualization allows students to take on any design challenge without regard to the expense, hazard, and scale of the challenge. If the computer modeling environment is supported by computational science derived from fundamental laws, it will have the predictive power that permits anyone to design and test any model that falls within the range governed by the laws. Software systems that provide user interfaces for designing, constructing, testing, and evaluating solutions iteratively can potentially become powerful learning systems as they create an abundance of opportunities to motivate students to learn and apply the pertinent science concepts actively. This is the vision of "Constructive Science" that I had dreamed about almost four years ago. This constructive approach opens up a much larger learning space that can result in deeper and broader learning--beyond simply observing and interacting with existing science simulations that were created to assist teaching and learning.

This dream got a shot in the arm today by a small grant awarded by the National Science Foundation. This TUES Type-1 grant will support a collaboration with Bowling Green State University and Dakota County Technical College to pilot test the idea of "Constructive Chemistry" at the college level. Choosing chemistry as a test bed to explore this Constructive Science approach is most appropriate, as chemistry is all about atoms and molecules that are just too small to make any design-based learning option other than computational modeling viable. Decades of research in computational chemistry has developed the computational power needed to make the science right. We believe that using these computational methods should yield chemistry simulations that are sufficiently authentic for teaching and learning.

Wednesday, October 24, 2012

Molecular Workbench downloaded over one million times

I checked our Web log today and the statistics showed that the Molecular Workbench software (Java version) has been downloaded for 1,014,439 times since 2005. This number doesn't include those instances in which MW is embedded in other software or run as an applet. And the number doesn't include the 30+ employees of the Concord Consortium who could conceivably inflate the data a bit.

While I can't say this number translates into a million people (on the other hand teachers tend to have multiple students working together in front of one computer), this is still a significant number that forms a substantial international user base, indicating that the need for this kind of simulation is probably not a false one.

We are often scrutinized by funders whether their investments would turn out worthy. The story of MW suggests a potential weakness in the typical cost-effectiveness analysis based on the initial investment. Federal funding for a project may take a long time to pay back. And the impact tends to accelerate after a critical mass is reached. I bet that the two-million milestone will be reached much sooner than the seven years it took for the first million.

Sunday, September 23, 2012

A Visual Approach to Nanotechnology Education

A hypothetical nano sorting machine.
The International Journal of Engineering Education published our paper "A Visual Approach to Nanotechnology Education." The paper presents a systematic approach based on scientific visualization to teaching and learning concepts in nanoscience and nanotechnology. Five types of mathematical models are used to generate visual, interactive simulations that provide a powerful software environment for experiential learning through virtual experimentation. These five types, which are implemented in the Molecular Workbench software, are:
  • All-atom molecular dynamics
  • Coarse-grained molecular dynamics
  • Gay-Berne molecular dynamics
  • Soft-body biomolecular dynamics
  • Quantum dynamics (including real space and imaginary space)
The nanotechnology content areas covered by this approach are discussed. These areas include notoriously difficult subjects such as statistical mechanics and quantum mechanics.

A Gay-Berne model of molecular self-assembly.
A variety of instructional strategies for effective use of these simulations are discussed. These inquiry-based strategies cover use in lecture, student-centered exploration, and student model construction.

Preliminary results from a pilot study at the college level, which was conducted by Dr. Hee-Sun Lee at Department of Physics, University of California Santa Cruz, demonstrated the potential of this approach for improving nanotechnology learning.

Wednesday, July 18, 2012

Molecular Workbench used at University of Ottawa Medical School to teach molecular simulations

The Molecular Workbench software has been widely used in middle and high schools. It is relatively unknown that many colleges and universities around the world use it in their classrooms as well.

Recently, the software was used in the Summer School in the Systems Biology of Neurodegenerative Disease offered by the Ottawa Institute of Systems Biology. Students in this Summer School learned about the basics of molecular dynamics simulations using tools including our "intuitive" Molecular Workbench. They then applied their new knowledge to either model and simulate bilayer membranes made of various lipid species or strictly model a lipid using three different approaches.

For the Molecular Workbench, we have developed a set of unique simulation techniques that can render a dynamic cartoon view of biomolecular processes that are usually too complicated to show all the fine details (see the images to the right for a cartoonized simulation of micelle formation in water and oil, respectively). This capability turns what used to be static illustrations in a biology textbook dynamic and interactive and provide opportunities of exploration to students. This is the key why the coarse-grain modeling techniques developed for MW based on soft body dynamics and particle dynamics looks so promising for the current wave of digitization of chemistry and biology textbooks.

Friday, November 18, 2011

Soft body dynamics in the Molecular Workbench

For a long time, some of my colleagues joked about my work on the Molecular Workbench as some trick to randomize "bouncing balls in a box." Part of their impressions came from the overly demonstrated gas simulations that are conveniently linked to some widely taught physical science concepts.

To do justice to the Molecular Workbench, I intend to write a series of blog posts that show the unknown facts about what it is capable of doing. This series is not to defend the work I have done. It is more about digging the potential of computational science and see what favor it can do for science education.

My plain answer to my colleagues' comment is that: "It is something in a box, but not just bouncing balls." One of the things it does more than bouncing balls is its capacity in soft body dynamics.

Soft body dynamics is a subject that focuses on visually realistic physical simulations of the motion of soft bodies (or deformable objects). Why is "soft body" important? The answer is that most biological systems are soft--at the macroscopic level or at the microscopic level. Without the biomechanical flexibility of human body, we would be quite different.Without the biomolecular flexibility of cells, there probably would not be life (e.g., it would not be possible for molecules to move in and out cells).

In many cases when we model microscopic interactions, we don't really need to know how every atom in the system is doing, not only because tracking every single atom in a huge biomolecule is nearly impossible but also it is not necessary to know those details for a basic understanding. Scientists often need to simplify a complex system in order to be able to focus on important aspects. The need is even more so in teaching--the cognitive load for students should be minimized in order to effectively convey the conceptual picture in a short time.

So an interesting question is how flexible biological objects can be simulated in a meaningful way. One approach is to model a soft body as a network of particles connected by elastic constraints (linear, angular, or torsional). This is often known as the mass-spring model in the computer graphics community. In the case of a 2D model, these discrete particles are placed along the edge of a 2D object. In the case of a 3D model, these particles are placed on the surface mesh of a 3D object. Physical interactions among soft bodies are then made possible by giving these particles properties such as a stiff repulsive core, an attractive force, or an electric charge. This allows many interesting phenomena to be modeled, such as self-assembly, docking, and so on.


The above animation shows a box with bouncing balls and swimming "worms," produced by the Molecular Workbench. Does the dynamics of these long soft bodies show some kind of "wormy" behavior that is clearly not that of bouncy balls?

In fact, the mass-spring model implemented in the Molecular Workbench has a number of applications in artificial life ranging from digital fish to digital cells. See this page for a nice summary.

Tuesday, September 27, 2011

An online gas lab simulation

Go to simulation.
You probably know the Ideal Gas Law well. An ideal gas is a hypothetical gas made of randomly moving particles that do not have a volume and do not interact with one another. Have your students ever asked questions such as "What about non-ideal gases? How good is the Ideal Gas Law for real gases?" I don't know about other people's experience, but I myself was intrigued by those questions when I learned the gas laws. Unfortunately, I couldn't go too deeply in trying to answer them because just thinking about the complexity of the motion and interaction quickly intimidated me.

Before computer simulation was widely accessible, you probably would have to pull out the Van der Waals Equation and pray that doing the math would do the trick.

Now, there is a good way to teach this. Using an online molecular dynamics simulation--made using the Molecular Workbench software, investigating non-ideal gases is a piece of cake. This simulation uses a pair of gas containers side by side and allows the user to explore how six variables affect the volume of  a gas: temperature, pressure, number of particles, particle mass, particle size, and particle attraction. It basically covers all the variables in the Van der Waals equation--without saying them explicitly. And there is a variable that is not included in the Van der Waals equation. The simulation reveals exactly why it is not there.

Saturday, September 24, 2011

An online simulation for studying states of matter

Go to the simulation
Have you wondered why some light elements form solids at room temperature whereas some heavy elements form liquids (e.g., mercury) or gases (e.g., radon) at room temperature? Many people tend to associate "heavy" with "solid." But that is not true.

Using an online 3D molecular dynamics simulation--made using the Molecular Workbench software, you can investigate if or how atomic mass, atomic size, interatomic attraction, and temperature affect the formation of a phase. This investigation allows for deeper exploration about what determines a phase.

Java is required to run this simulation in your browser as an applet.

Sunday, July 24, 2011

Theo Jansen's mechanism

Go to the simulation
Theo Jansen is a Dutch artist and kinetic sculptor who builds large works that resemble skeletons of animals that are able to walk using the wind on the beach. His works are a fusion of art and engineering.

Theo Jansen's famous mechanism can be simulated by using the Molecular Workbench software. Shown in this blog post is a screenshot of the simulation. You can click the link below the screenshot to watch the simulation.

Thursday, June 23, 2011

The Molecular Workbench wins a SPORE Award from the Science Magazine

The Science Magazine announced that the Molecular Workbench software has won a SPORE Award. The Science Prize for Online Resources in Education (SPORE) has been established by the American Association for the Advancement of Science to "encourage innovation and excellence in education, as well as to encourage the use of high-quality on-line resources by students, teachers, and the public."

Read our essay published in the Science Magazine.

Here is the AAAS announcement.

Thursday, April 21, 2011

"Mega" Molecular Workbench applets

The Molecular Workbench software allows developers to create interlinked simulations. This allows many simulations in just one applet, which I call a "mega" applet. The following example, which provides simulations of physical phenomena at different scales, shows how this works.

 

Here is another example of molecular dynamics simulations of pressure conveyance in different settings through fluids:


A Molecular Workbench "mega" applet provides rich user experiences similar to Web 2.0, which can be designed using the software's authoring system. This is similar to Macromedia's Flash software.

Sunday, February 14, 2010

MW applets and MWScript-JavaScript interactions


Now that you can publish a Molecular Workbench simulation as an applet and embed it on your web page, you may be wondering how you can control it and get data in and out. It may be interesting for web developers who would like to link an existing Flash animation with a molecular dynamics simulation in MW. For example, when the visitor clicks something in the Flash animation, a molecular dynamics simulation will pop out to show the molecular mechanism of what is going on underneath.

With MW, this can now be done using MWScript and JavaScript. MWScript is a scripting language used in MW to support modelers and animators to design simulations. The model builders in MW do have some simple GUI for building models and designing simulations, but their functionality is limited (as with any GUI). Syntactically, MWScript is a cousin of JmolScript, which supports scripting with the popular Jmol molecular viewer. So anyone who is already familiar with JmolScript may find it easy.

Before we talk about scripting, let me show you how to set up an MW applet on your web page. If you just want to show an existing MW simulation from mw2.concord.org (which hosts MW) on your web page, just embed the following applet code within the body of your HTML file:

<applet id="applet_id"
archive="http://mw2.concord.org/public/lib/mwapplet.jar" 
code="org.concord.modeler.MwApplet" codebase="http://mw2.concord.org/public/" 
width="100%" height="500"> <param name="permissions" value="all-permissions"/> 
<param name="script" value=
"page:0:import http://mw2.concord.org/public/student/classic/motion/undershotwaterwheel.cml"/>
</applet>
In the above example, I have randomly chosen an existing simulation from MW to show how this works. If you want to show other simulations, just replace "http://mw2.concord.org/public/student/classic/motion/undershotwaterwheel.cml" with whatever else.

This following shows the embedded MW applet specified by the above code:





This is very easy to do. But it has a limitation. Suppose you have created an MW simulation of your own and the name of the main file is "simulation.cml" (an MW simulation has other files associated with it as well). Now you have to upload the files to the Web. If you use its URL in the embedding code, the MW applet will not load it. Because of a good security reason, an applet is allowed to read files from only the same code base where the Java executable is located (in this case, http://mw2.concord.org/public/lib/mwapplet.jar).

To avoid this problem, you would want to have your own code base instead of using mw2.concord.org. First, you download the jar file: mwapplet.jar to the same folder where "simulation.cml" and the HTML file sit. Second, change the embedding code to:
<applet id="applet_id" archive="mwapplet.jar" 
code="org.concord.modeler.MwApplet"  codebase="http://mw2.concord.org/public/"
width="100%" height="450"> <param name="permissions" value="all-permissions"/> <param name="script"
value="page:0:import simulation.cml"/>
</applet>
Having done these, you just need to make sure to also upload "mwapplet.jar" to the same web folder where "simulation.cml" has been uploaded to.

If you have done these and succeeded in getting an MW applet to work properly, let's see how to get it to work with JavaScript as well. First, download this file: mw.js to the same folder. Second, put the following script declaration in the header of your HTML file:

<script type="text/javascript" src="mw.js"></script>
The MW applet is now ready to interact with JavaScript. The applet works offline as well, so you can conveniently test your JavaScript before deploying the whole thing to the Internet, by just double-clicking on the HTML file and see how it works.

There are currently three types of interactions between MWScript and JavaScript.
  • Use JavaScript to send MWScript to control an MW applet
  • Use JavaScript to feed data to an MW applet
  • Use JavaScript to get data out of an MW applet
The runScript(id, script) method in mw.js can be used to send MWScript to an MW applet with the specified ID. An MW applet is an MW page that can have multiple models, though in practice you would only use one model per applet. To specify which model you would like to send the MWScript, you have to following the following protocol:

[model type]:[index or UID of model]:[script body]

For instance, mw2d:1:run instructs the first model within the MW applet to run. You can pass a variable from JavaScript to MWScript by concatenating the variable with a script command. For example, var temp = 300; runScript("applet_id", "mw2d:1:set temperature " + temp) sets the temperature of the system to be 300 K.

The get command in MWScript was specifically designed to fetch data out of an MW applet. For instance, you can get the temperature by using the following code: var temp = runScript("applet_id", "mw2d:1:get %temperature");.

This page demonstrates all these three types of interactions with one applet. It is inconvenient for me to mix code in this blog as it interferes with the blog's setup. When you go to that page, you can view the page source to see the JavaScript code. If you have Firebug, it can also be used to view the code easily.

For more information about MWScript, go to http://mw.concord.org to launch the standalone application and check out the "Script" section in the User's Manual.

Saturday, January 30, 2010

Publishing Molecular Workbench simulations as applets

For a while I have been asked whether or not an MW simulation can be made to run directly within a browser page instead of a pop-up window. Several collaborators would like to deploy MW simulations within their web portals or delivery systems. For them, embedding a simulation within a web page is desirable. The current way of using the Java Web Start to launch an MW simulation sometimes irritates users as it can appear to be yet another kind of annoying pop-ups.

So I did some work in the past week to make it possible for users to save an MW page as an applet, which can then be deployed anywhere without having to rely on my company's server. This is always good for the integrity of a web site, as no serious web developer wants to depend on other people's servers to be up and running forever.

Here are some demos:








This new mechanism of publishing MW simulations provides an option for people who want to integrate MW simulations with their web applications, if they don't mind the relatively slow loading speed.

Friday, June 26, 2009

What is in a Molecular Workbench simulation?

The Molecular Workbench (MW) software offers salient interactive simulations of electrons, atoms, and molecules that explain many phenomena from the microscopic level. What exactly is in a simulation that makes it a better teaching tool than a text book illustration?

Let's start with a real world example. Imagine a closed glass bottle with some liquid at the bottom. There are a number of things about such a system that most of us have noticed since we were a kid. When we rotate the bottle, the liquid will always flow to fill the lowest part. When the liquid comes to rest, its surface levels off.

Now let's heat it up. As the temperature increases, evaporation accelerates. Eventually, all liquid molecules are evaporated and the liquid vanishes--we end up with a gas that fills the entire bottle. The gas molecules are evenly distributed inside the bottle, no matter how we rotate it. Suppose the bottle is expandable. The gas molecules will fill the entire volume of it, no matter how large it becomes (the gas just gets more diluted).

These are the things we know about the difference between a gas and a liquid from everyday life. Now, let's see how a simple MW simulation can model all these facts. On the right is an animation of a liquid in a box made from an MW simulation (click this link to run it; you will need Java 5.0+). In order for the simulation to run fast enough on an ordinary computer, the liquid includes just 256 molecules. This is not a lot to be called a liquid, but it is enough to demonstrate the phenomena. In addition, a super-strong gravitational field is applied to accelerate the gravitational effect (you might have heard from someone that the gravitational effect is not important at the atomic level, but that is because the gravity on the surface of the Earth is too weak).

A theoretical physicist would celebrate the simulation as the triumph of theoretical physics. The fact that a computational model can describe such a variety of natural phenomena means that they have been deciphered by science.

As an ordinary user, you may not know much about what is under the hood--in fact, most of the time, you should not have to care. You may be wondering what advantages a computer simulation has, compared with just giving students a bottle of water and asking them to flip and boil it. If you are a hands-on person, you may, on the contrary, prefer giving students a bottle of water. So what is the big deal of a simulation for you?

There are a few things that the computer simulation can do for you but a bottle of water cannot. First, the simulation is literally an atomic explanation of what happens when you play with a bottle of water. The very fact that a macroscopic phenomenon can be explained with a picture of a few hundred atoms is a very important insight in science. People have probably known how water in a bottle behaves thousands of years before, but an atomic perspective was not firmly established until 100 years ago.

Second, the simulation provides an "atomic microscope" that allows users to "zoom" into the atomic world easily because we can control it in many ways that are not realizable with a bottle of water. For example, we can navigate an "atomic camera" inside the system, or attach it to an atom. What would it look like if we could be shrunk to an atomic size and take a "space walk" or just "ride on an atom" inside a gas (the image on the right shows a screenshot in which atoms appear to run down to your face)? Kids are motivated by this kind of adventure experience, which can be supported very well by a computer simulation.

Another advantage of a computer simulation is that it can be easily embedded into an electronic textbook (which recently becomes the trend due to budget crises in many states in the US). Obviously, embedding a bottle of water into an electronic textbook is much harder, if not impossible at all (I would never say that is impossible). With the support of this kind of interactive simulation, future textbooks will not be just some readable things. They will be playable delights.

Saturday, March 28, 2009

Smart molecules: next generation molecular visualization

A significant part of chemistry education is about teaching molecular structures. Before computers were widely available, many teachers used physical ball-and-stick models in the classroom. Using physical models has limitations--the variety of the molecules we can make is limited and the molecules cannot have too many atoms. When computers were powerful enough to support 3D video gaming, chemistry educators realized that they could be used to show any kind of molecules on the computer screen and there was essentially no limitation to the molecular structures that one wished to show. This method of computer-aided teaching is now commonly known as molecular visualization and is widely adopted by chemistry teachers in teaching about molecules.

There are now many molecular visualization tools freely available for education, such as Jmol, PyMOL, QuteMol, and Visual Molecular Dynamics, to name a few. All of these tools present wonderful graphics for showing molecules in 3D. When a student uses such a tool to learn a molecule's structure, he or she usually rotates the molecule to see it from different angles, zooms in and out to view different levels of details, and sometimes turns on different representations of the molecule to identify some recognizable patterns (such as a structural motif of a biomolecule like the famous DNA double helix and an electrostatic surface of a polar molecule like a water molecule).

It is our hope that through manipulating and observing these virtual molecules students will gain a lot of information about them and be able to apply the knowledge and learn to think like a chemist. There are, however, some reasonable doubts that this expected learning would spontaneously occur once students are given these tools. We observed in the classroom that there were a number of students who did not accomplish the learning goal even though they were fascinated by beautiful visualizations of molecules and played with them tirelessly. Most materials do provide instructions and background readings, but they seem to be not very effective. In the absence of an instructor nearby to explain to them what they are seeing on the screen, many students may leave the activity with no science learning accomplished.

The problem, in my opinion, partly lies in that most of these tools only present a passive learning experience. By passive I mean the molecule does not actually give any feedback to the student while he or she is interacting with it.

In the game world, a well-designed game presents an active experience to the user. While the user is playing a game, he constantly receives feedback from the system that attracts his attention and he is always facing a challenge that he must meet to accomplish his goals.

What can we learn from games? A lot. The first thing is: imagine the molecule can respond to the student's actions. For example, the student pilots a microscopic spaceship into the molecule with a mission to fight some toxic molecules (such as carbon monoxide) and he has to carefully avoid running into vicious traps from strongly polar sites that want to catch his ship. His ship is equipped with a laser gun that can break a chemical bond and destroy an evil molecule. During his journey, he will encounter a number of puzzles and challenges that he must solve to win the game. For instance, he must maneuver his ship through a narrow passage inside a molecule in order to get to an active reaction site.

By adding these additional functionalities to a molecular visualization tool to make the molecule actively interact with the user (in addition to just passively rendering a view), we may be able to increase the learning opportunities for students. We call this idea the Smart Molecules, which is based on our NSF-funded Molecular Rover Project.

A smart molecule can also be thought of as an interactive tutor built into a visualization tool. For example, depending on where the ship is, the molecule can act like a flight controller to instruct the student where to pilot the ship. It can give hints to the user while navigating. It can provide more munition or fuel once the supplies on the ship are running low. Science lessons can be embedded into the environment to be called up for help if needed.

The Smart Molecules represents a revolutionary step forward for the use of molecular visualization tools in education. It would be interesting to see if this technology will help students learn molecular structures better in the classroom. Stay tuned.

Thursday, March 19, 2009

Constructive science in the classroom


"Imagination is more important than knowledge." --- Albert Einstein
Science should be taught as a verb, not only as a noun. Doing science is a compelling and effective way to learn. It is through the process of exploration, creation, and invention that theories are applied, ideas are tested, and knowledge is synthesized and upgraded. This post showcases some interesting simulations recently created by students using the Molecular Workbench software and proves the feasibility of using the constructionist approach to teach science more effectively.

The image on the left is a screenshot of a student's simulation about how a ball that has a density lower than that of water keeps afloat in a bucket being filled up by rain. The dynamic simulation shows how buoyancy works with an amicable setup of clouds, rain, a ball, and a bucket. The simulation and the note made by the student (not presented here due to privacy issues) clearly show that the student had learned not only the modeling tool but also the science during the construction process, because the simulation produces the emergent behavior exactly intended and explained by the student.

The second image is a screenshot of a student's simulation about the gas laws. Designing something that violates a physics law is often very motivational to students. Students are inspired to use their creativity to come up with every imaginable possibility of violation. This student designed a subtle situation in which all atoms in one container move only in the direction perpendicular to the piston and atoms in another container move in both the perpendicular and the parallel direction with an initial setup that guarantees the equipartition of the kinetic energy in each direction. The simulation shows that the volume of the gas in the right container is approximately half of that of the gas in the left container. Is the Ideal Gas Law broken? We leave this question to you.

The third image is a screenshot of a simulation of a salt crystal and water a student created using the 3D Molecular Simulator. It shows that the student knew what a crystal structure is and how dissolving occurs. Considering the complexity of constructing a 3D model (over a 2D one), this student's work is quite impressive. The fourth image is a screenshot of a simulation of photosynthesis created by another student, which shows the student's understanding of this complex biological process and her efforts in modeling it.

A common challenge in using a general-purpose modeling tool in the classroom is that it may take students longer time than teachers are willing to spend in the classroom to make something pertinent to the learning goals. Tempted by the versatility of the tool, some students even tend to "drift" away from the learning goals. To help students focus on learning science, the Molecular Workbench software permits instructors to design scaffolded construction activities while engaging students to build simulations. This is a unique and important feature of the software that will facilitate the wide adoption of this pedagogy.

From the point of view of assessment, the richness of information expressed in these simulations has much to offer to research and evaluation about using computer simulations in the classroom. As a Chinese proverb says: "A picture is worth a thousand words," a simulation may be worth much more than a thousand words for the assessment of student learning. Ultimately, the most reliable and relevant assessment of educational simulations should use simulations themselves as the data sources. The only way to make this assessment work is to engage students to make their own simulations.