Homework1

# Homework1 - Homework#1(page 1 of 2 Simple MD code with...

This preview shows pages 1–2. Sign up to view the full content.

MSE 4270/6270: Introduction to Atomistic Simulations, Leonid Zhigilei Homework #1 (page 1 of 2) Simple MD code with Velocity Verlet algorithm Write the simplest possible one-dimensional molecular dynamics code for two particles connected by a spring (Force = k(x 2 -x 1 -x 0 )) where ' x=x 2 -x 1 is the distance between particles, x 0 is the equilibrium length of the spring. Your code can have the following structure: Define the parameters of the system (k, x 0 , m 1 , m 2 ), initial coordinates and velocities of the particles in the system (x 1 0 , x 2 0 , v 1 0 , v 2 0 ), initial time = 0, time of the simulation, and timestep of integration, ' t. Calculate initial force F init = k(x 2 0 - x 1 0 - x 0 ) F old = F init , x 1 old = x 1 0 , x 2 old = x 2 0 , v 1 old = v 1 0 , v 2 old = v 2 0 Time loop: 1. Calculate position at the current time x 1 new = x 1 old + ' t v 1 old + ' t 2 F old /2m 1 x 2 new = x 2 old + ' t v 2 old - ' t 2 F old /2m 2 2. Calculate new forces F new = k(x 2 new - x 1 new - x 0 ) 3. Calculate new velocities v 1 new = v 1 old + ' t(F old + F new )/2m 1 v 2 new = v 2 old - ' t(F old + F new )/2m 2 4. Copy new variables to old ones (actually, you do not need to store the values

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern