Appendix: The OLAMI–FEDER–CHRISTENSEN Model in C
Published online by Cambridge University Press: 05 September 2012
Summary
Most computational physicists try to strike a balance between a number of conflicting objectives. Ideally, a model is quickly implemented, easy to maintain, readily extensible, fast and demands very little memory. A few general rules can help to get closer to that ideal. Well written code that uses proper indentation, comments and symmetries (see for example PUSH and POP below), helps to avoid bugs and improves maintainability. Howmuch tweaking and tuning can be done without spoiling readability and maintainability of the code is a matter of taste and experience. Sometimes an obfuscated implementation of an obscure algorithm makes all the difference. Yet, many optimisations have apparent limits where any reduction of interdependence and any improvement of data capture is compensated by an equal increase in computational complexity and thus runtime. Often a radical rethink is necessary to overcome such an ostensible limit of maximum information per CPU time, as examplified by the Swendsen-Wang algorithm (Swendsen and Wang, 1987) for the Ising Model, which represents a paradigmatic change from the classic Metropolis algorithm (Metropolis, Rosenbluth, Rosenbluth, et al., 1953).
Nevertheless, one should not underestimate the amount of real time as well as CPU time that can be saved by opting for a slightly less powerful code in favour of one that is more stable and correct from the start. On the same account, it usually pays to follow up even a little hunch that something is not working correctly.
- Type
- Chapter
- Information
- Self-Organised CriticalityTheory, Models and Characterisation, pp. 357 - 390Publisher: Cambridge University PressPrint publication year: 2012