Explore BrainMass
Share

Molecular Dynamics MATLAB Code

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Write the simplest possible one-dimensional "molecular dynamics code" for two particles?
I use MATLAB, so I want a MATLAB code for molecular dynamics or velocity verlet algorithm code.
I need to determinate x1, x2 and v1, v2 in different times.

Some websites may help you:
[http://www.nada.kth.se/~tomaso/miklab2007/lab2_4h1725.pdf]
http://utkstair.org/clausius/docs/che548/pdf/md_sim.pdf

I don't have experience in MATLAB, so this so difficult for me.
I tried reading about it, but I became more puzzled.

Someone help me please.

© BrainMass Inc. brainmass.com October 16, 2018, 11:12 pm ad1c9bdddf
https://brainmass.com/physics/velocity/molecular-dynamics-matlab-code-515533

Attachments

Solution Preview

I will assume a baseline knowledge of programming concepts such as functions, variables, loops, etc. If you need some explanation of these I can help in another post. Otherwise, I will explain the attached MATLAB code where it is necessary to understand how MATLAB differs from C++ or some other programming language.

The code is based off the equation on the pdf.

In MATLAB, there is no necessity to declare the type of the variable. MATLAB internally keeps track of it. Thus, to declare a variable you simply declare it.

Example,

x = ...

Solution Summary

The expert examines the molecular dynamics MATLAB Code

$2.19
Similar Posting

Velocity Algorithm Code

Write the simplest possible one-dimensional "molecular dynamics code" for two particles. I used matlab, so i need matlab code for molecular dynamics or velocity verlet algorithm code. I need to determine x1, x2 and v1, v2 in different time steps.

I have the following 15 values for x1, x2 and v1,v2 in graphs:

M = 1.0
dt = 0.0001
x1(t=0)=1.0
x2(t=0)=-1.0
v1(t=0)=0.0
v2(t=0)=0.0
r=2^(1/6)=1.122
limited r=0.01
U(r=2)=4[2^(-12)-2^(-6)]<0

x1(t+1)=x1(t)+dt*v1(t)+(dt)^2*0.5*f1(t)
v1(t+1)=v1(t)+dt*[f1(t+1)+f1(t)]*0.5

x2(t+1)=x2(t)+dt*v2(t)+(dt)^2*0.5*f2(t)
v2(t+1)=v2(t)+dt*[f2(t+1)+f2(t)]*0.5

f1(t)=(x1(t)-x2(t))[48 r^(-14) - 24 r^(-8)]
f2(t)=(x2(t)-x1(t))[48 r^(-14) - 24 r^(-8)]

I need the code. Also, I need graphs that show the motion of two particles, specifically, when x1=1.0 and x1=-1.0, and another graph when v1=0.0 and v2 =0.0. Also, graph when 0.5*(v1(t)^2) + 0.5*(v2(t)^2) and 0.5*(v1(t)^2) + 0.5*(v2(t)^2)+U(r).

View Full Posting Details