A simple example of molecular dynamics

This is a homework of computational nano mechanics. The basic requirement is to use Lagrangian function to describe the motion of particles. In homework, it requires 5 particles. As an enhancement, I rewrote the code with Qt and use GNU Scientific Library(GSL) to finish the task.


The Lagrangian equation of motion describe the particle motion with energy method, the equation is:

\displaystyle \frac{d}{dt}\frac{\partial L}{\partial \dot{x}_k}-\frac{\partial L}{\partial x_k}=0

L is the Lagrangian function of the system, k denotes the degree of freedom.

\displaystyle L = T - U

T is the kinetic energy and U is the potential energy.

Continue reading