Problem applying Lennard jones equation for large scale
Afficher commentaires plus anciens
Hi,
I am working on a project which is based on lennard jones potential. I'm trying to make a simulation for two points (or particles) but it doesn't work correctly. In my view, I think it's because this model is used to work with particles instead of large-scale problems. What could I do?
I consider that one particle is without moving.
You can see below the code. Thanks a million

clc
close all
clear all
epsilon = 5;
sigma = 2;
% initial position of A and B particles
a = [2 3];
b = [2 8];
% List of forces
f_list = zeros(30,1);
for k = 1:30
% unit vector
ba = a-b;
dab = norm(b-a);
unit_vector = ba /dab;
% force as negative gradient of lennard jones potential
f = 4*epsilon*((12*(sigma^12)/dab^13)-(6*(sigma^6)/dab^7));
f_list(k,:)= f;
force = unit_vector * f;
% new position
a = a + 0.1 * force;
scatter(a(1),a(2));
hold on
scatter(b(1),b(2));
pause(0.1)
end
1 commentaire
Cristian Garcia Milan
le 14 Juil 2019
Can you say me what is your exatc problem? I see that you are adding the force multiply by 0.1 to the position and I think it should be to the velocity and the velocity shjould be added to the position.
Réponses (0)
Catégories
En savoir plus sur Programming dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!