# Question: consider the simplest onedimensional problem of molecular dynamics where two...

###### Question details

Consider the simplest one-dimensional problem of molecular dynamics where two particles of mass m1 and m2 are interacting via a harmonic spring. The potential reads in this case V = (k/2)(x2 −x1 −a) 2 , where k is the spring constant and a is the equilibrium length of the spring. Solve the Newtonian equations of motions numerically by means of the Velocity-Verlet algorithm. Check that (respectively assess how accurately) the total energy stays constant. Compare for this test also the results for the single- and double-precision representation of floating point numbers. As reasonable parameters you may choose m1 = m2 = 1, k = 1, a = 1, initial values x1 = 1, x2 = 3, v1 = 1, v2 = 1, and n = 10 000 iterations with time step dt = 0.001