CompSciHW10

Intro. Scientific Computing, HW10 - Due Friday, April 22.

1) Write a complete code to simulate the Lennard-Jones gas in a 2D periodic box  with box length L = 14 and n=100 particles.  Start them off on a 10x10 grid   with Gaussian distributed velocities.  Ignore units and assume beta = m = 1.   The Hamiltonian is given by H = sum_j m v_j^2/2 + 1/2 sum_{i != j} u_ij^2 - u_ij   where u_ij = |x_i - x_j|**-6   The force on each particle, i, is therefore   F_i = sum_{j != i} 6 (x_i - x_j) / |x_i - x_j|^2 ( 2 u_ij^2 - u_ij )

2) Run the simulation for 100 steps, and create a plot showing the locations of the atoms  every 10 steps.

3) For every timestep, calculate the kinetic and potential energies. What do you observe   about the behavior of the potential energy?

4) Make a plot of the total energy vs. time for your 100 step simulation. Overlay these plots   for several different values of the numerical timestep, dt.

Hints:

A code that allows you to visualize your (steps x atoms x 2) trajectory is shown below: