This is a simple molecular dynamics demo. It assembles the
molecule in 2D structure and simulate the interactions between
atoms by calculating the electrostatic repulsion and the tension
of the electronic cloud as a spring-mass model.
It's not using any fancy algorithm nor has a nice graphical interface, it's only to try out some basic animations and a few vector operations.
The main purpose of this program is to show how important graphical interfaces are to debug physical simulations. One of the features is to show the forces in different colours (with legend) and see the strength and direction of each one and which ones are "as expected" and which aren't.
As this simulation is not using any differential solution, the forces grow and grow until the atom becomes unstable and break apart. Some Runge-Kutta is required to push the realism further.
The code is available for download at here: molecular_dynamics.tar.gz. (Last updated 2008-07-21)
To compile simply run "make". You need the glut library to show the graphics. If you add a DEBUG=[1-3] on your make command you'll see a huge output of all internal variables. Beware of the I/O when looping in debug mode.
It gets a hardcoded molecule (C3H5) and simulate. Press U to update a frame when stopped or L to loop through several frames per second. (Press L again to stop). ESC or Q quit the program.
|Rengolin||This page was created using Vim|