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:
is the Lagrangian function of the system, denotes the degree of freedom.
is the kinetic energy and is the potential energy.