# Improving Speed at the Heart of Molecular Workbench

At the heart of Molecular Workbench’s modeling of atomic interactions is a profoundly important but fundamentally simple concept:

At close distances, atoms attract each other until they get so close that they repel.

Here’s a demo of that concept: two atoms interacting. Drag the green atom to various locations near and far from the purple atom and watch what happens as the two atoms approach each other and move apart. (If you’re wondering why the atom slows down and stops, the answer is that we apply an artificial damping force to the green atom in order to make it easier for you to “grab” it and play with it.)

This concept is called intermolecular attraction. Molecular Workbench (MW) uses an approximate formula for calculating the intermolecular potential that was originally proposed by John Lennard-Jones (in 1924!) and is now called the “Lennard-Jones potential” or L-J for short.

Here you see the L-J potential as a graph. The horizontal axis shows distance between two atoms, the vertical axis is the net intermolecular energy, with regions of negative slope indicating that the resulting force is repulsive, and regions of positive slope indicating attraction. This graph shows that these atoms will attract to each other if they are more than 2.3 radii apart, but begin to repel sharply at distances less than that value as shown by the steep rise in the curve.

This interaction is not just a fundamental concept in physics and chemistry. It also is quite central to the MW simulation engine. We typically do this calculation tens or hundreds of thousands times per second, especially when we have many atoms interacting, such as here:

If you study our code, going deeper and deeper, you’ll peel away layers of the coding onion, until you get to the very center of this model, which calculates the L-J force between just one pair of atoms. (Did we mention that the reason the L-J approximation is used is that it’s considered relatively fast to calculate?) It does this for each of the many pairs of interacting atoms, repeating over and over, with each time-tick of our simulation.

As it turns out, the L-J formula is still computationally demanding, requiring calculating 6th and 12th powers. (That’s the theory. In practice, the form that is most convenient for our code happens to use the 8th and 14th powers. That also speeds things up–but we’ll save that for another blog post.) So when we’re looking for ways to make our code run faster and our model run better, the L-J calculation is a prime place to look!

In our first pass at improving speed (in MW Classic), we converted the 6th and 12th power calculations to simpler repetitive multiplications:

X2 = X * X

X3 = X2 * X

X6 = X3 * X3

X12 = X6 * X6

That gave us just 4 multiplication tasks, instead of 16 (X6 has 5 multiplications, X12 has 11).  This reduced the calculation demand to 25%. The model ran faster and smoother.

Recently, we tried another method to improve speed: using a look-up table, with pre-calculated values. We computed the L-J values for each element type for dozens of typical interatomic distances and put them into a table. We thought this would save computational time because the software could simply look up the values in the table without any multiplication.

We tested the two methods (multiplication vs. look-up table) over many iterations and found that the look-up table was slower! As we investigated further, we saw that accessing the look-up table had its own overhead in terms of use of cache memory and data transfer. This was evidence of a trend in improving computer speeds over the past few years: computation speeds improve at a faster rate than memory access speeds. They both are faster, but computation (i.e., all that multiplying we have to do) has gotten the improvement edge.

So, after this testing, we went back to the efficient multiplication approach. This illustrates our basic approach: creative thinking validated by empirical data.

We will continue to develop and test creative ways to speed the software and improve the user experience, especially as we move to support a greater variety of learning activities and computer platforms.

# Flexible textbooks

We’re in the midst of a remarkable transition in education – a change that will give teachers more flexibility in the resources they use in their classroom.

The growing role of digital textbooks is gaining momentum. Major publishers are not just converting their textbooks to digital format, they’re also reconceptualizing them, adding a more diverse array of embedded interactives and providing states and districts with the option to pick and choose sections to meet local educational goals.

Think about this for a moment.

We are used to the monolithic textbook package – a basal textbook, lab manuals, CDs and other ancillaries. Each major publisher offers its package. States and districts decide which publisher’s package to purchase. End of story.

But that world is changing. A district might choose several chapters from one publisher and other chapters from a second publisher. From a third publisher, they might select a lab manual that is especially engaging for their students. And they might select multiple online resources to extend student learning.

From the teacher’s perspective, this is potentially liberating. Instead of working through the standard textbook and its aligned support materials, teachers have a richer set of options. They can select resources based on personal expertise, knowledge of their students, teaching style and familiarity with the growing array of digital interactives.

How does Molecular Workbench fit in? MW helps students understand fundamental principles of physics, chemistry and biology, yet it hasn’t always been clear how to fit this into the classroom, as it might seem a diversion from the flow of the textbook.

With a more flexible approach to teaching and learning, science teachers will be able to easily integrate the power of atomic and molecular simulations into their classrooms. This will not be an aberration, but the new norm.

This change will take a few years to fully play out, but it is a welcome transition away from the dominance of the standard, one-size-fits-all textbook and towards freedom to use a robust set of resources – including Molecular Workbench.

# A Window on Your Educational Soul

Music playlists are windows to the soul (or so the general wisdom goes). Your taste in music, including your personal favorites, reveals much about your personality, your lifestyle and your values. So too your favorite websites.

Do you bookmark your favorite websites in categories or sequence the most important ones first? Have hundreds of favorites? Or a top ten list? However you manage them, your Web, music and other playlists are an essential part of keeping your technical life efficient and effective.

Such a “playlist mentality” is becoming increasingly clear in education. And the teachers we’ve interviewed have requested personal playlists of Molecular Workbench activities and models.

Needless to say, each teacher has his or her own style of teaching, manifested in how they use MW. Some use it mostly for classroom demos, others focus more on direct student use. Some use MW just a few times during the year, others almost weekly. Some use it during class time, others assign MW activities for homework.

Teachers also vary in how they sequence topics during the year. One chemistry teacher might teach organic chemistry late in the year as a synthesis while another might teach it earlier as a way to whet the appetite and spark questions.

The MW development team confronted this diversity challenge (and opportunity) early on. It was clear we could not create, for example, a single master flow of MW activities for high school chemistry. Instead, we need to support differences among teachers by providing a rich variety of activities. Teachers can select, adapt and integrate models and activities into their own style and classroom flow.

As we’ve been documenting in videos and articles, we are now creating a Web-based Molecular Workbench system, which will give teachers more flexibility in how they select and sequence the activities. At the simplest level, they’ll be able to use standard browser tools to bookmark their favorites, organizing them in whatever flow they want. And our teacher interviews have pushed us even further in thinking about design.

Our goal is to include the ability for teachers to store personal MW playlists – with even more information than you get in a bookmark, such as level of difficulty and duration of activity. Teachers will be able to provide playlists to students or share them with colleagues.

We still have to work out the details, but we’ve heard from teachers and high on their wish list is a personal playlist with lots of flexibility to meet their needs and style. That’s the best way to make sure MW is effective and widely used!

# Embedding Next-Generation Molecular Workbench

The next-generation Molecular Workbench has a fundamental feature that is both simple and profound: MW models will be embeddable directly in Web pages. This simple statement means that anyone will be able to integrate these scientifically accurate models into their own work—without having to launch a separate application. Teachers will embed MW models and activities into their own Web pages. Textbook publishers will embed them in new e-books.  There is much room for creativity and partnerships here.

The significance of this advance struck me at a recent conference on educational technology sponsored by the Software & Information Industry Association. Many creative people and companies attended, from large publishers to innovative startups. Throughout the presentations and conversations, I envisioned ways these potential partners might use MW to enhance their products and services.

Ron Dunn, CEO of Cengage, gave a keynote describing their new digital textbooks and aligned homework helpers and other digital resources. He pointed out that 35% of their sales are “digitally driven,” and that technology is essential to their future. Other major publishers echoed those messages. When publishers embed Molecular Workbench models and activities throughout their e-books as a consistent modeling environment, students will be able to investigate fundamental principles of chemistry, physics and biology more deeply than the simple animations and videos now so typical in e-books.

SmartScience is a startup, developing supplemental science education activities. Their idea to link videos of science phenomena with corresponding graphing tools is clever. For example, in a time-lapse video of rising and falling tides, students mark the ocean height and automatically see their data in a graph in order to understand both the scientific phenomena and the graph output. Augmenting reality is great, and we love the idea of integrating videos of physical, chemical and biological processes at the macroscopic scale with MW models to show what happens at the microscopic scale.

Karen Cator, Director of the Office of Educational Technology at the U.S. Department of Education, discussed a new framework for evaluating the effectiveness of educational technology projects. Software can monitor how students work their way through online problems, providing teachers with deeper insights on student learning, especially in terms of scientific thinking and problem-solving skills. Teachers can focus on students’ higher-level thinking skills, and provide useful, real-time feedback to identify strengths, progress and areas in need of help. We agree whole-heartedly and have been working on ways to capture student data in real time and provide feedback loops for teachers. Our next-generation Molecular Workbench will record what students do as they explore the models and make that information available to teachers and researchers.

Partnerships with creative teachers, publishers, and software developers will help us ignite large-scale improvements in teaching and learning through technology. That’s our mission and our goal for Molecular Workbench. Thanks to Google funding, we’re working to increase access to the incredibly powerful next-generation Molecular Workbench.