Download as pdf or txt
Download as pdf or txt
You are on page 1of 10

( ) ( )

KMC: why time increment is ∆ = =− ?

Key ideas: 1) we track events, not time.


2) the frequency of an event is associated to its probability

-The probability f, of some event occurring in a differential time dt is =


-The probability that NO event takes place is =1− =1−

-Let’s consider the probability of no event taking place over ∆ + .


(∆ )
Taylor expansion in dt, first order: ∆ + = ∆ +
yields
Since ∩ = + = ∆ + = ∆
(∆ ) yields (∆ )
∆ = ∆ + = −1
(∆ )
(∆ )
Since g(dt)-1 = -R dt, we have =− .
(∆ )
(∆
Now, = − . This equation admits the solution ∆ = − (∆ )

-We don’t know exactly (∆ ). It is a probability, and therefore it is restricted to 0,1 . It


can be replaced by another stochastic variable with the same average properties. The
random number s plays this role. Thus,
( )
∆ =−
More complicated KMC algorithms
Metropolis MC

1 More complicated KMC


algorithms
Changing the number of
particles
Applying KMC to “daily
life” simulations

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Algorithms with changing number of particles

Simulate using Kinetic Monte Carlo code written in octave a 1D


random walk with the following conditions:
There are no particles in the beginning, but particles are
created during the simulation at x = 0 with a constant rate of
100 particles created per second.
The created particles can ”diffuse” by random walk with the
same probability (50%) to the left or to the right. The rate
for each existing particle to ”jump” left or right is 500 times
per second. The length they ”jump” in each jump is δ = 1.

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Code

nuCreate = 100;
lMigrate = 500;
N=0; else
t=0; #migrate
endTime=1; select = ceil(rand*N);
while(t < endTime) if(rand < .5)
R(1) = nuCreate; x(select) = x(select) + 1;
R(2) = R(1) + N*lMigrate; else
t = t - log(rand)/R(2); x(select) = x(select) -1;
select = rand*R(2); end
if(select < R(1)) end
#create end
N=N+1;
x(N) = 0;

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Solutions
Overall
The total number of particle should be bigger as time increases.

100
30 t=1
t=1 t=2
t=2 50
25
Number of particles

20 0

Position
15 -50

10
-100
5
-150
0 0 20 40 60 80 100 120 140 160 180 200
-15 -10 -5 0 5 10 15 Particle number
Length

Figure 2: Distribution of particles at t=1


Figure 1: Histograms for t=1 and
and t=2
t=2
Simulation in Materials Engineering: Atomistic Modeling
More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Simulating “market”
The cellular shop
This is the story of a shop that sells cellular phones. Every day, the
owner of the shop is buying 20 new cellular phones and puts them
on sale on top of the existing ones, if any. Such owner has seen
that he manages to sell the fourth part of all the cellular phones he
has every day. The first day, he has no phones at all.

Conditions
We can simulate this with KMC. We will take t = 300 days.
Buying: a fixed average rate of 20 a day (i.e., one every 1/20
of a day)
Selling: a fourth part of the stock is sold every day in average.
(i.e., if there are 12 phones, 3 are sold, if there are 20, 5 are
sold, etc.)
Every phone costs the owner 70, and is sold at 75.
Simulation in Materials Engineering: Atomistic Modeling
More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

What to simulate

What do we want to simulate?


The total number of phones sold.
The total quantity earned as time passes.

What else can we infer from the simulation?


The needed initial investment
The variations of quantities with changing parameters and
frecuencies.

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Code

while(t < endtime)


%How many of each R(1) = 0 + nuA;
A = 0; R(2) = R(1) + A*Ar;
% Total money select = rand*R(2);
money = 0; t = t - log(rand)/R(2);
%Constant rates of decay %buy cell
Ar = .25; if(select < R(1))
nuA = 20; A = A + 1;
day=1; money = money - 70;
t=0; else
endtime = 300; A = A - 1;
fid = fopen("phones.txt", "w"); money = money + 75;
end

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Code (Cont.)

printf("%f %d %d %u\n", t, A, money, day);

if(t>day)
fprintf(fid, "%f %d %d\n", t, A, money);
day = day+1;
daily=0;
end
end
fclose(fid);

Simulation in Materials Engineering: Atomistic Modeling


More complicated KMC algorithms Changing the number of particles
Metropolis MC Applying KMC to “daily life” simulations

Solutions
Expecting...
We expect to have loses the first days.

25000
Earnings
Number of phones in stock
20000
120
Realistic Simulation
Theoretical value 15000
100
10000
80 5000 2000
1000
60 0 0
-1000
-5000 -2000
40 -3000
-4000
-10000 -5000
20 -6000
-15000 0 10 20 30 40 50 60 70
0 0 50 100 150 200 250 300
0 50 100 150 200 250 300

Figure 4: Total earnings


Figure 3: Phones in stock
Simulation in Materials Engineering: Atomistic Modeling

You might also like