Molecular Dynamics Monte Carlo Algoritm

1 回表示 (過去 30 日間)
Tamir Suliman
Tamir Suliman 2016 年 11 月 25 日
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

回答 (0 件)

カテゴリ

Help Center および File ExchangeNumerical Integration and Differential Equations についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by