Book contents
- Frontmatter
- Contents
- Preface
- Acknowledgment
- 1 Introduction
- 2 Characterization of the SOC State
- 3 Systems Exhibiting SOC
- 4 Computer Models
- 5 The Search for a Formalism
- 6 Is It SOC or Not?
- A Code for the BTW Sandpile
- B Code for the Lattice Gas
- C Code for the Bak-Sneppen Evolution Model
- D Power Spectra and the Correlation Function
- E Statistical Weights in the DDRG
- References
- Index
B - Code for the Lattice Gas
Published online by Cambridge University Press: 05 November 2012
- Frontmatter
- Contents
- Preface
- Acknowledgment
- 1 Introduction
- 2 Characterization of the SOC State
- 3 Systems Exhibiting SOC
- 4 Computer Models
- 5 The Search for a Formalism
- 6 Is It SOC or Not?
- A Code for the BTW Sandpile
- B Code for the Lattice Gas
- C Code for the Bak-Sneppen Evolution Model
- D Power Spectra and the Correlation Function
- E Statistical Weights in the DDRG
- References
- Index
Summary
We discuss here some details of writing a computer code for the dynamics of the lattice gas defined in Section 4.4. The code is not optimized; it is included as a guide and for inspiration only.
The configuration of the particles on the (two-dimensional) lattice is stored in the array n(l: L, 1: L). The elements of this array take the value n(i, j) =1 if the site (i, j) is occupied by a particle; otherwise, n(i, j) =0. The update, as defined in Section 4.4.1, can be coded as sketched below. A complete code of the lattice gas will include an initiation of the array n(i, j), and special attention must be paid to the boundary. Since the lattice is updated simultaneously, we need the array nnew (1: L, 1: L) to store intermediate changes in the particle configuration. We update the lattice by visiting all the empty sites of the lattice. An empty site (i, j) becomes an occupied site if a particle on one of the eight neighbor sites is able to move onto site (i, j). We therefore visit all eight neighbor sites to calculate the forces acting on particles in these sites. We then check if one of these particles has a force pointing toward site (i, j) and is of a magnitude greater than any other force pointing toward site (i, j).
- Type
- Chapter
- Information
- Self-Organized CriticalityEmergent Complex Behavior in Physical and Biological Systems, pp. 134 - 137Publisher: Cambridge University PressPrint publication year: 1998