SSEPCompact.py

From Werner KRAUTH

(Difference between revisions)
Jump to: navigation, search
Revision as of 16:52, 10 June 2024
Werner (Talk | contribs)

← Previous diff
Revision as of 23:09, 10 June 2024
Werner (Talk | contribs)
(Python program)
Next diff →
Line 7: Line 7:
==Python program== ==Python program==
- 
import math import math
import random import random
Line 13: Line 12:
alpha = 0.5 alpha = 0.5
prefactor = 1.0 prefactor = 1.0
- NPart = 64; NSites = 2 * NPart+ NPart = 100; NSites = 2 * NPart
NIter = int(prefactor * NPart ** exponent * math.log(NPart)) NIter = int(prefactor * NPart ** exponent * math.log(NPart))
- NStrob = NIter // 40+ NStrob = NIter // 400
Conf = [1] * NPart + [0] * (NSites - NPart) Conf = [1] * NPart + [0] * (NSites - NPart)
Active = random.randint (0, NSites - 1) Active = random.randint (0, NSites - 1)
Line 25: Line 24:
for iter in range(NIter): for iter in range(NIter):
Active = random.randint (0, NSites - 1) Active = random.randint (0, NSites - 1)
- while Conf[Active] != 1: Active = random.randint(0, NSites - 1)+ while Conf[Active] != 1:
 + Active = random.randint(0, NSites - 1)
Step = random.choice([-1,1]) Step = random.choice([-1,1])
NewActive = (Active + Step) % NSites NewActive = (Active + Step) % NSites
- if Conf[NewActive] == 0: Conf[Active], Conf[NewActive] = 0, 1+ if Conf[NewActive] == 0:
- PP = '|'+ Conf[Active], Conf[NewActive] = 0, 1
- for k in range(NSites):+ if iter % NStrob == 0:
- if Conf[k] == 0: PP += ' '+ PP = ''
- else: PP += '|'+ for k in range(NSites):
- PP += '|'+ if Conf[k] == 0: PP += ' '
- if iter % NStrob == 0: print(PP)+ else: PP += 'X'
 + print('|' + PP + '|')
print('-' * (NSites + 2)) print('-' * (NSites + 2))
Text = 'Total time = ' + str(prefactor) + ' * N ^ ' + str(exponent) + ' * log N' Text = 'Total time = ' + str(prefactor) + ' * N ^ ' + str(exponent) + ' * log N'
print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2)) print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2))
-This example program performs a large number of iterations of the Monte Carlo algorithm for the Symmetric Simple Exclusion Process, and plots 40 lines of output over the entire simulation time. + 
 +This example program performs a large number of iterations of the Monte Carlo algorithm for the Symmetric Simple Exclusion Process, and plots 40 lines of output over the entire simulation time.
==Output== ==Output==

Revision as of 23:09, 10 June 2024

Contents

Context

This page is part of my 2024 Beg Rohu Lectures on "The second Markov chain revolution" at the Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).

Introduction

My Lecture 3 is concerned with the Symmetric Simple Exclusion Process (SSEP), treated here, and its liftings, the TASEP (totally asymmetric simple exclusion process) and the lifted TASEP. All these dynamical systems carry the word "Process" in their descriptions because they are usually described in continuous time. Here, we rather use a formulation in discrete time, where at each time step t=0,1,2,..., a single move is attempted. In fact, each move consists in the choice of a random particle and the choice of a random direction. The SSEP is a local diffusive Markov chain, and it has very slow dynamics: it takes N^3 log N steps to get it from a compact initial state into equilibrium.

Python program

import math
import random
exponent = 3.0
alpha = 0.5
prefactor = 1.0
NPart = 100; NSites = 2 * NPart
NIter = int(prefactor * NPart ** exponent * math.log(NPart))
NStrob = NIter // 400
Conf = [1] * NPart + [0] * (NSites - NPart)
Active = random.randint (0, NSites - 1)
while Conf[Active] != 1:
    Active = random.randint(0, NSites - 1)
Text = 'Periodic SSEP, N= ' + str(NPart) + ', L= ' + str(NSites)
print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2))
print('-' * (NSites + 2))
for iter in range(NIter):
    Active = random.randint (0, NSites - 1)
    while Conf[Active] != 1:
        Active = random.randint(0, NSites - 1)
    Step = random.choice([-1,1])
    NewActive = (Active + Step) % NSites
    if Conf[NewActive] == 0:
       Conf[Active], Conf[NewActive] = 0, 1
    if iter % NStrob == 0:
        PP = 
        for k in range(NSites):
            if Conf[k] == 0: PP += ' '
            else: PP += 'X'
        print('|' + PP + '|')
print('-' * (NSites + 2))
Text = 'Total time = ' + str(prefactor) +  ' *  N ^ ' + str(exponent) + ' * log N'
print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2))


This example program performs a large number of iterations of the Monte Carlo algorithm for the Symmetric Simple Exclusion Process, and plots 40 lines of output over the entire simulation time.

Output

Here is output of the above Python program with, for simplicity, N=32, L=64 and only 20 configurations over the length of the simulation.

The initial configuration is compact. Clearly, the simulation has not run long enough to forget its initial state, and it would be necessary to increase the simulation time from N^2 log N to N^3 log N. In our simplified setting, the logarithm is difficult to see, but better analysis tools readily extract it from the numerical data.

                    Periodic SSEP, N= 32, L= 64
------------------------------------------------------------------
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                                |
|XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX  X                             |
| XXXXXXXXXXXXXXXXXXXXXXXXXXXXX  X    X                         X|
| X XXXXXXXXXXXXXXXXXXXXXXXXXXX    X    X                     X X|
|  X XXXXXXXXXXXXXXXXXXXXXX X XXX X        X                XX  X|
|X   XXXXXXXXXXXXXXXXXXXXX XXX X  XX      X               X  X X |
|X XXX XXXXXXXXXXXXXXXXXXXX XX   X   X X X               X X     |
|  XXXX XXXXXXXXXXXXXXXXXXXX X    X   XX  X           X    X    X|
| XXXXXX XXXXXXXXXXXXXXXXXX  X   X  X X  X X         X      X    |
|  XXXXXXXX XXXXXXXXXXXXXXX X   X   X   XX X              XX    X|
| XXXXXXX XXXXXXXXXXXXX XXXX  X X XX         XX            X X   |
| XXXX XXXXXXXXXXXXXX XXXXX X  XXXX        X  X          X X     |
|X XX XXXXXXXXXXXX XXXXXXX X XX XX X     X X               XX    |
|X  XXXX XXXXXXXXXX XXXX XXXX XXX  X     X X               X   XX|
| XXX XXXXXXXXXXX XXXXXXXXX X  X X   X X X X                 X  X|
|X XXX XXXXXXXXXXX XXXX XXXXX X   X X   XX X                   XX|
| XXXXX XXXXXXXXX X XXXXXXXXX  X  X   XXX     X                XX|
|XXXX XXXXXXXXXXXX X XXXXX XX X  XX  X  X  XX                   X|
|XXXX XXXXXXXXX XXXXXXXX XX X  XX X  X   XX   X                 X|
|XXXXXX XXXXXX XXXXXXXXXXX X  X  X X  XX   X    X              X |
|X XXXXXX XX XXXXXXXXXXXXX XX  X  X X  X   X  X              X  X|
------------------------------------------------------------------
                Total time = 1.0 *  N ^ 2.0 * log N


Further Information

  • The mixing behavior of the SSEP t_mix \sim N^3 log N has been computed by Lacoin (2016, 2017) (see references).
  • The relaxation time of the SSEP is t_rel \sim N^3 (without the logarithm). It is thus asymptotically smaller than the mixing time, leading to the cutoff phenomenon.

References

Personal tools