Molecular Dynamics (MD) simulation of a simple harmonic oscillator
This assignment uses the Molecular Dynamics method, which simply consists of discretizing Newton's equations of motion, and then iterating them many times to calculate the trajectory. Write a computer program to perform a Molecular Dynamics (MD) computer simulation of a one-dimensional simple harmonic oscillator (SHO).
![683_1934892d-4b25-446f-934e-4a296e61f8a8.png](https://secure.tutorsglobe.com/CMSImages/683_1934892d-4b25-446f-934e-4a296e61f8a8.png)
[You can take K = 1 in answering the questions.]
Include a plot of the potential energy, including a horizontal line indicating the initial energy. [You will also do Monte Carlo (MC) simulations of the same models later, so remember to make your plots easy to compare.] The program should read in the starting position, the size of the time step, and the number of iterations. It should then print out a histogram of the positions visited during the simulation.
Your program should also print out the initial and final energy as a check on the accuracy of the algorithm. Don't forget to include the kinetic energy in your calculation!
1. For a starting value of x = 1.0. Try various values of the size of the time step to see the effect on the results. What happens when the time step is very small or very large?
2. Choose x = 1.0 and run the program for an appropriate value of dt. Print out histograms of the positions visited. [Later, you will compare them with you results for MC