CCP - lect.09 - Introduction to Percolation

15
Computational Physics I Luigi Scorzato Lecture 09: Introduction to Monte Carlo and Percolation

Transcript of CCP - lect.09 - Introduction to Percolation

Computational Physics ILuigi Scorzato

Lecture 09: Introduction to Monte Carlo and Percolation

• Deterministic and Monte Carlo Integration.

• Crude Monte Carlo

• Importance Sampling Monte Carlo

• Example: Percolation

• The deterministic methods to perform integrals that we have seen in the previous lectures scale very bad when for integrands defined on systems in high dimensions.

• This is related to the fact that those methods are designed for d=1 and trivially extended to higher dimensions.

• In particular, if N=Ld is the number of points (i.e. the computational cost of the integration), the estimated error associated to the Trepezoidal rule scale as N-2/d ; the one of the Simpson rule as N-4/d; the one of the m-point gaussian rule as N-(2m-1)/d .

• According to the CLT, the average of random variables in a finite sample of N point differs from its infinit limit value with an error which scales as N-1/2, independently of the dimension. In high dimensions, it is therefore more convenient to sample randomly the points of integration. This leads to the idea of Monte Carlo (MC) integration.

• Another drawback of deterministic rules is that they can be improved only by refining the mesh or going to a higher order, while a MC integration can be improved also by adding a single point.

• Finally, MC integration can deal very easily with irregular domains, where the application of deterministic rules can be very difficult.

Deterministic and Monte Carlo Integration

Algorithm to perform the integral

for n=1:NChoose a random number U uniform in [0,1]x=a + U (b-a);fn = f(x);

end

set:

Crude Monte Carlo

I =b− a

N

N�

n=1

fn

� b

af(x)dx

This method is good for functions f(x) which are not too varying within their domain of integration.

If, instead, f(x) ~ 0 for most of its domain (as it is the case for most cases of multidimensional integration which are of practical interest), the MC algorithm above is still unacceptably inefficient

This algorithm can be easily generalised to multi dimensional and irregular domains of integration.

Exercise: compute the variance of the integral I in the explicit case f(x)= cos(x) (a=0,b=π/2). Compute N necessary to obtain 1% accuracy.

hint:

FN =1N

i

fi

�f� :=1

b − a

� b

af(x)dx =

� b

af(x)µ(x)dx = lim

N→∞

1N

i

fi

σ2N = �(FN − �FN �)2� =

��1N

i

fi − � 1N

i

fi��2�

=

��1N

i

fi − �f��2�

=

=1

N2

i

�(fi − �f�)2� +�

i �=j

�(fi − �f�)(fj − �f�)�

� �� �=0

=1N

��f2� − �f�2

�=

=1N

�� b

af2(x)µ(x)dx − (

� b

af(x)µ(x)dx)2

The result obtained here is a consequence of the Central Limit Theorem. However, this derivation provides a useful alternative point of view.

for n=1:NChoose a random number X with probability distribution g(X);hn = f(X)/g(X);end

The idea is to generate random points in the domain of integration which are not choosen uniformly in the coordinate that we are using, but instead are choosen with higher probability where the function f(x) is significantly different from 0. Of course, the integrand needs to be corrected according to:

Importance sampling Monte Carlo

� b

af(x)dx =

� b

a

f(x)g(x)

[g(x)dx]

Exercise: compute the variance of the integral I in the explicit case f(x)= cos(x) (a=0,b=π/2). and g(x) = a + b x2 . Compute N necessary to obtain 1% accuracy.

Note: we use the notation of Pelissetto. But many text call “importance sampling MC” what we will call “dynamical MC” (see the next lecture)

� b

af(x)dx

I =(b− a)

N

N�

n=1

hn

Algorithm to compute:

set:

I need to choose g(x) such that f(x)/g(x) is as constant as possible and: g(x) ≥ 0;� b

ag(x)dx = 1

Example 1: percolation

• Percolation processes are those in which, the probability p of some random local event is given and leads to the formation of macrscopic paths or clusters which spans the entire system.

• This mechanism plays a fundamental role in such different phenomena as the electrical conductivity of alloys, the spread of epidemic diseases and forest fires, or the productivity of oil fields.

• Let p be the probability of occupation of a single site. We can ask (precise definitions are given later)

- What is the probability Pspan that an infinite cluster forms?- What is the fraction M of occupied sites that belong to the infinite cluster?- What is the average size S of (non infinite) clusters?- What is the correlation length ξ?

• For finite size L of the system, the quantities above vary continuosly from 0 to some maximum, with a growing behaviour when p goes from 0 to 1.

• When L→∞ it turns out that a particular point pc assumes a special role. It is called critical point, that depends on the dimention d of the system.

- Below pc (p < pc ): Pspan=M=0, S(p) and ξ(p) are finite.

- Above pc (p > pc ): Pspan>0, M>0, S(p), ξ(p) diverge.

Percolation: theoryFirst we define precisely everything that can be defined at finite L. Later we add the definitions that make only sense in the limit L→∞ (such as the critical point).

• The system under investigation is described by a set of points in a hypercubic lattice of size L in d dimentions. The number of points is therefore N=Ld

• In each point i we define a variable that can assume the values xi =1 (filled) or 0 (empty).

• A configuration is a particular choice of the values of all xi

• A cluster is a set of connected filled points (an anti-cluster a set of connected empty points).

• A percolating cluster is one that connects two opposite borders (other definitions exists e.g. clusters that connect all 2d borders, but the difference among these is inessential for our discussion).

• The probability that a percolating cluster forms is Pspan =(#configs with a perc. cluster)/(#all configs)

• When a percolating cluster exists, M= (#filled points that belongto the perc. cluster)/(#all filled points).

• The size of a cluster is the number s of its points.

• The number of clusters of size s is denoted Ns. Therefore, the number of points that belong to some cluster of size s is (sNs).

• Note that the probability that a point belongs to some cluster is equal to the probability that a point is filled:

• The average clusters size (where the weight of each cluster is proportional to its size) is defined as S(p):

• Since S(p) will diverge for p> pc, it is also useful to define the average size restricted to non percolating clusters.

p =�

s sNs

N

S(p) =�

s s2Ns�s sNs

S�(p) =��

s s2Ns��s sNs

• The correlation length ξ , is defined in two equivalent (in the thermodyn. limit) ways:

Percolation: theory

�X :=1s

i∈points in a cluster

�xi (center of mass)

R2s :=

1s

i∈points in a cluster

(�xi − �X)2 (av. square dist. from center of mass)

ξ(p)2 :=�

s R2ssNs�

s sNs(av. radius of clusters)

Percolation: MC integrationComputing the quantities defined in the previous slide can be done via Monte Carlo methods.

In fact, we are not interested on e.g. S(p) calculated a single configuration, but on the average over all possible configurations

(where we write S(x1,...,xN ) instead of S(p) to stress that it is a function of the configuration and hence a function of the xi, although such expression is complicated)

{xi}i=1...N

=�

x1=0,1

x2=0,1

...�

xN=0,1

�{xi}i=1...N

S(x1, ..., xN )�

{xi}i=1...N1 note the short notation:

Procedure:

• for k=1 to M

• for i=1 to N=Ld

• extract a random xi(k) =1 with prob p and 0 with prob (1-p)

• end

• compute S(k)(x1(k),...,xN(k)) based on the k-th configuration

• end

• average S(k) over all (k).

Percolation: d=1 exampleIn one dimension a percolating system can be stutied exactly. Unfortunately there is no percolating phase.

The probability to find a cluster of size s is given by the probability to have s subsequent fill (ps) and 2 empty sites at the boundary. If we neglect the boundary effects, the probability for a given site to ne the Left hand extrme of a cluster of size s is ns(p) and hence, the number of such cluster is Ns(p):

Hence for the average cluster Size we get:

S(p) =1 + p

1− p∼ (1− p)−1 ⇒ pc = 1, γ = 1

For the correlation length, consider the following. In order that two points at distance r belong to the same cluster, all the points in between must be filled. This happens with prob ~ pr

g(p) ∼ pr

∼r>>1 e−r/ξ ⇒ ξ ∼ − 1log p

⇒ ν = 0

ns(p) = (1− p) ps (1− p)Ns(p) = (1− p) ps (1− p)L∞�

s=1

sNs = L(1− p)2∞�

s=1

sps = L(1− p)2p∂

∂p(∞�

s=1

ps)

� �� �p

1−p

= Lp

∞�

s=1

s2Ns = L(1− p)2∞�

s=1

s2 ps = L(1− p)2�

p∂

∂p

�2

(∞�

s=1

ps)

� �� �p

1−p

= Lp1 + p

1− p

Percolation: theoryAt p = pc we see a second order phase transition. Here various quantities, among which S(p) and ξ, have singularities. As it is typical of second order phase transitions, the correlation length diverges and also S(p) does. In an infinite lattice (L=∞) we have:

However, simulations are done on finite lattices, and the expressions above get corrected, such that the divergences disappear:

S(p) ∼ t−γ

ξ(p) ∼ t−ν

t :=|p− pc|

pc

But here enters the crucial assumption that turns out to be very predictive in many critical phenomena: ξ and L are the only scales in the system and are homogeneus i.e. if they are both rescaled by the same factor, all quantities are simply rescaled. Therefore the Fʻs can only depend on their ratio. This can be shown within the theory of the

Renormalization Group (that we cannot describe here. See e.g. Cardyʼs “Scaling and Renormalization in Statistical Physics).

That means that I can also write: S(p, L) ∼ Lγ/νF̃S(tL1/ν)S(pc, L) ∼ Lγ/νF̃S(0)

S(p, L) ∼ t−γFS(ξ(t)/L)ξ(p, L) ∼ t−νFξ(ξ(t)/L)

S(p, L) ∼ t−γFS(t, L)ξ(p, L) ∼ t−νFξ(t, L)

which is extremely helpful to analyse MC numerical data.

• Write a code that generate a 2 dimensional lattice in which each site is occupied with probability p.

• Once you have a lattice described by a 2 dimensional array:

field(x,y) =0 (if it is empty) or 1 (if it is filled)

• Search for clusters. Two algorithms are most commonly used:

1. Tree-search:

2. Hoshen-Kopelman

Percolation: simulations

Percolation: simulationsTree-search:

1. for each site

2. if it is filled update the cluster index, put it as first element of a list and proceede, otherwise go back to 1.

3. for each neighbor

4. if it is filled, mark it as belonging to the same cluster and put it on the same list. Go back to 3.

5. When you are done with the neighbors, do the same with the neighbors of the sites on the list

6. When the list is completed, go back to 1.

Percolation: simulationsHoshen-Kopelman

1. for each site (proceeding down, right)

2. if it is not filled, go to 1, otherwise proceed

3. look only at the neighbors up and left. If they are filled, we had assigned them already a cluster number: assume that cluster number also for the present site.

4. If they are both filled, but with different cluster number, define a label that points the higher cluster number to the lower one label(c2)=c1

5. After the loop over all sites is completed, replace the cluster labels pointing to other cluster by the number of the pointed clusters.