I’m a software engineer with a background in chemical physics and I’m excited to experiment with developing free online educational resources that teach chemical physics, particularly simulation. To that end, I’ve been exploring Scala.js and assorted JavaScript libraries. Here are some of the preliminary resources I’ve developed.

All the initial rough code is available at github.com/matthagy/chem_prog_exp. I apologize for the current lack of documentation.

Chiefly, I’m using Scala.js, which is a framework for writing Scala code that compiles to JavaScript so that we can write Scala that runs in the browser. I like how this allows us to leverage the full power of Scala for developing complex simulations using a clear and concise language with a functional (i.e., mathematical) formalization.

While I don’t know enough JavaScript (and know nothing about TypeScript) to fully comment on the pros/cons of Scala.js, I’ve found Scala.js to be a great language/framework for writing simulations, visualizations, and analyses that run in the browser. You can learn more about my general thoughts on Scala in my post, Initial impressions of Scala from a Java and Python data engineer.

Beyond Scala.js, I’ve also explored several JavaScript libraries related to developing simulations. Three.js has proven to be an excellent 3D rendering library and it has made it easy for me to develop simulation visualizations. Plotly.js makes the development of dynamic and interactive plots effortless; I’ve literally spent less than 15 minutes learning about this library. Lastly, I’ve found the Ace editor to be a robust, browser-based editor that allows me to represent simulation configuration in user-editable JavaScript.

Overall, I’m excited about how easy it has been to develop these simple, rough proof-of-concept simulations. I’m looking forward to developing more interactive and sophisticated simulations in the future as a hobby project. I’m also starting to brush up on my chemical physics knowledge so that I can make these into better educational resources.

I’m even starting to think about how some of these resources could be useful to practitioners; i.e., academic and industrial researchers and engineers. To that end, we’ll need the code to run outside of the browser and I think that should be straightforward if everything is in Scala since Scala primarily runs on the JVM. It might be cool to provide a simple, browser-based interface into simulations that run in the cloud. If I do this, it would be within a non-profit organization since I don’t think there’s much potential for profit margins.

Let me know what you think about this preliminary work and any ideas you have for how this work could evolve. I’m also certainly open to collaboration. You can reach me at matthew.hagy@gmail.com.