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.

## Concept

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.

Since the derivative of with respect to is the force

the Lagrangian equation of motion uses another way to illustrate the Newton’s second law.

## Single particle example

For a single particle in a chamber, two degree of freedom , the kinetic energy is:

is the degree of freedom. denotes the mass of the particle.

The potential energy of the particle in a chamber is expressed as:

Here the exponent function is used to describe the repulsion from the chamber wall. when the distance close to zero, the repulsion potential will be much large and prevent the particle penetrating the chamber wall. The Lagrangian function and equations are:

and for each degree of freedom:

For this example, we take the following parameters:

The initial conditions are:

Using Mathematica (FF01Y5.nb) to plot the trajectory or use this script (YR29Q8.nb) to plot the animation:

## Lennard-Jones potential function

Lennard-Jones potential function is almost the world-famous potential function in nano mechanics. It describes the interaction between atoms. The function was proposed through quantum perturbation theory in which the attraction should follow a relation. It combines the attraction and repulsion together.

where: denotes the depth of the energy well, and denotes the equilibrium spacing of atoms.

Take , the result is shown below:

As mentioned before, the derivative of with respect to is the force. The force from Lennard-Jones interaction is simply get the derivative of :

The equilibrium distance between two atoms is the position .

## Two particles example

If two particles are put into the chamber, Lennard-Jones potential should be considered in calculation. Here, I try to use GNU Scientific Library(GSL) to solve the problem in three dimension.

The *Explicit 4th order (classical) **Runge-Kutta**(RK4) *method is chosen for this problem. Two particles are denoted as and respectively. The Lagrangian function is ( denotes the degree of freedom):

and denotes the repulsive potential from the chamber wall, the equations of them are similar to **Single particle example**. Here, I just analyze the Lanner-Jones potential:

For the derivative with respect to and :

With these two equations, we can simply calculate the motion of these two particles: