Published online by Cambridge University Press: 05 November 2012
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).
To save this book to your Kindle, first ensure [email protected] is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.
Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.
Find out more about the Kindle Personal Document Service.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.
To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.