Coder Social home page Coder Social logo

chem_demos's Introduction

Chemistry Demos

These Chemistry Demos were developed in the Summer of 2007 as the result of a part-time position under Professor Geissler. It was my first programming job, which I had received after only having completed one semester of CS. Though, the code looks pretty bad by my modern standards, I'm still impressed with the results.

So here they are, my chemistry demos, warts and all.

GIFS BELOW

Running the Demos

Gradle is used to manage the code.

# download the open dependencies as they haven't been published yet
# fixes a bug
make
# display all posible gradle tasks
gradle tasks --all

# compile, create the jar, and execute
gradle spheres:run
gradle inkdrop:run
gradle stretch:run

Currently, the OpenGL native library dependencies are specified to be OSX. If you are trying to run this code on Linux or Windows please update the dependencies in build.gradle.

// TODO Change if necessary.
compile group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: '2.2.4', classifier: 'natives-macosx-universal'
compile group: 'org.jogamp.jogl',    name: 'jogl-all',   version: '2.2.4', classifier: 'natives-macosx-universal'

Sphere Collisions

The demonstration is configurable, but what you see in the animation below is a single sphere with a specified amount of energy, launching into its neighbor spheres, and spreading energy throughout the system. The main thing to note is that the distribution eventually settles into the one predicted. Also, it is pretty addictive to watch all of the collisions.

Another cool thing about this demo is how collisions are being calculated. Typically, collision detection works by updating the positions of the objects and then checking if any overlap has occurred. If there is overlap then the objects' positions are backtracked and then repositioned. The problem with this system is that fast moving objects can potentially move so fast that overlap is never seen. My system works by calculating all of the potential collisions mathematically and keeping the order of these collisions in order by time. The simulation then jumps to the next collision, updates the particles positions, and invalidates other affected collisions.

Sphere Collisions GIF

Inkdrop Dispersion

This demonstration shows how liquid dispersion happens via simple Brownian motion. In the demo you can also see me added additional particles. The visual trace mode is also neat to watch individual particles move about.

Inkdrop Dispersion GIF

Polymer Stretching (BUGGY)

This visualization is intended to show Polymer motion as a spring system. In the image below a piece of the polymer is moving to the right at a fixed velocity and the rest of the Polymer is acting accordingly. It is a bit buggy with fast stretching.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.