Azzera filtri
Azzera filtri

Molecular Dynamics Monte Carlo Algoritm

2 visualizzazioni (ultimi 30 giorni)
Tamir Suliman
Tamir Suliman il 25 Nov 2016
So we have a single atom with a potential energy of E(x) = Kc*x^2 where x is the atom coordinate and kc=1 develop a monte carlo algorithm MC which computes the average energy at Temperature T from 0.1 to 1.0 increment of 0.1 and assuming Kb=1
Set maximum position displacement during MC move to dx=10. Also, set at each temperature the initial coordinate value x to 100. If MC code works correctly, then E ≈ T/2. The deviation of from the theoretical result T/2 should not exceed 10%. Present the results as a plot vs T and as a table.
Include in the table the number of MC steps performed to obtain at each T. Compute the acceptance rate at each temperature and investigate its dependence on temperature.
The code i developed so far can some one review it on the light of the question and add their feedback
if true
clc;clear
n=100;
x=rand(n,1);
gav=zeros(n,3);
gavvar=NaN(n,3);
gav(1,2)=x(1,1)^2;
for i=2:n
gav(i,2)=0.1*sum(x(1:i).^2)/i;
gavvar(i,2)=0.1*var(x(1:i).^2);
figure(1);
plot(gav(:,2));
hold on
figure(2)
plot(gavvar(:,2));
grid on
end

Risposte (0)

Categorie

Scopri di più su Biological Physics in Help Center e File Exchange

Prodotti

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by