xtalgrowth: 2-dimensional simulation of crystal growth

xtalgrowth is an X application which simulate crystal growth of 2-dimensional hard spheres. If you execute xtalgrowth, a window opens, hard spheres fall from random positions, and they stacks at the bottom of the window. You can adjust growth conditions with command line options. You will get calculated results as PostScript files from stdout (standard output) in a certification-like form as shown in Fig.1. xtalgrowth is suitable for demonstrations of computer simulations of materials science, for example, in museums or at open campus events.

Usage:

$ xtalgrowth --help
$ xtalgrowth -d 0.033 -c 3
$ xtalgrowth -d 0.033 -c 2
$ xtalgrowth -d 0.015 -c 1
$ xtalgrowth -g 'Mr. Takeshi Nishimatsu' | lpr

Put certification.eps in the current directory to get a certification letter. certification.eps will be used as a title of the certification letter. Name of the guest given with -g option and today's date will also be on the certification letter. The string given with -g option will be also used as a seed for a pseudo random number generator.

If your printer cannot print xtalgrowth's output correctly, pipe it through gs(1) command:

$ xtalgrowth [OPTIONS...] | gs -q -sDEVICE=pswrite -sOutputFile=- -dNOPAUSE -dBATCH - | lpr

If you cannot print xtalgrowth's output correctly with macOS, use lpr with a -l option:

$ xtalgrowth [OPTIONS...] | lpr -l
figures/example.jpg
Fig. 1 Cirtification-like calculated result from xtalgrowth. Guest's name and the date will be in the form.

Contents:

Homepage and DOWNLOAD

Home page of xtalgrowth is http://loto.sourceforge.net/xtalgrowth/ . The latest .tar.gz package (xtalgrowth-X.Y.Z.tar.gz) can be downloaded from http://sourceforge.net/projects/loto/files/xtalgrowth/ .

Compilation and installation

Requirements are

If you have all of them, You can generate src/xtalgrowth with

$ tar xf xtalgrowth-X.Y.Z.tar.gz
$ cd xtalgrowth-X.Y.Z
$ ./configure
$ make

Test the executable

$ cd src
$ ./xtalgrowth --help
$ ./xtalgrowth

If you want to install /usr/local/bin/xtalgrowth,

$ sudo make install
$ make installcheck

For macOS into which XQuartz was installed and popt was installed via MacPorsts, use

$ ./configure CPPFLAGS='-I/opt/X11/include -I/opt/local/include' LDFLAGS='-L/opt/X11/lib -L/opt/local/lib'

to set CPPFLAGS and LDFLAGS.

Calculation conditions and results

Periodic boundary condition is employed for x-direction (width of the box). Collision detection of hard spheres is rough. This computational roughness results in defects of crystals.

It starts from periodic substrates. If diameter is tight, you will not get perfect stacking:

$ xtalgrowth -d 0.033333

You can give the diameter of hard spheres with ration to the box width. Loose diameter and slow falling velocity may result in perfect stacking:

$ xtalgrowth -d 0.033 -v 0.0001

You can change criterion of stacking with -c option from 3 to 1. If -c 3, hard spheres stops falling when it touches 3 other spheres:

$ xtalgrowth -d 0.033 -c 3

If -c 2, hard spheres stops falling when it touches 2 other spheres. Defects will be included in the crystal:

$ xtalgrowth -d 0.033 -c 2

If -c 1, you will get fractal structures (See Reference [1]):

$ xtalgrowth -d 0.01 -c 1

Name of the guest given with -g option will be used in the PostScript file of certification letter from STDOUT. The string given with -g option is also used to generate 2 positive integers by hashpjw.c. Using that two integers as seeds, uni64.c generate pseudo random numbers (See Reference [4,5]):

$ xtalgrowth -g 'Mr. Takeshi Nishimatsu' > takeshi.ps

You will get a help message with a "--help" option

$ xtalgrowth --help

if you compiled with the popt library.

figures/xtals.jpg
Fig. 2. xtalgrowth is executed with 3 kinds of set of options. (a) -c 3 -d 0.033 -v 0.0004, (b) -c 2 -d 0.033 -v 0.0001, and (c) -c 1 -d 0.020 -v 0.0004.

Display

Display this program with real models like Fig.2 and Fig.3.

figures/large.jpg
Fig. 3. Model of 2-dimensional ballistic crystal. BB projectiles (diameter: 6 mm) in a pair of acrylic glasses.
figures/cd.jpg
Fig. 4. BB projectiles in a music CD case. A Japanese 10 yen coin besides.

References

[1] Jean-François Gouyet, Michel Rosso and Bernard Sapoval: "Fractal surfaces and interfaces" in the book of "Fractals and disordered systems" edited by Armin Bunde and Shlomo Havlin, pp. 229-261 (1991), ISBN:0-387-54070-9, Springer-Verlag New York.

[2] Lawrence Bragg and J. F. Nye: "A Dynamical Model of a Crystal Structure", Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, Vol. 190, No. 1023, pp. 474-481 (Sep. 9, 1947). You can get a free PDF of this article from doi:10.1098/rspa.1947.0089.

[3] Lawrence Bragg and W. M. Lomer: "A Dynamical Model of a Crystal Structure. II", Proceedings of the Royal Society of London. Series A, Mathematical and Physical Sciences, Vol. 196, No. 1045, pp. 171-181 (Mar. 22, 1949). You can get a free PDF of this article from doi:10.1098/rspa.1949.0022.

[4] Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman: "Compilers: Principles, Techniques, and Tools" (1986), ISBN:0-201-10088-6, Addison Wesley, a.k.a. the Dragon Book.

[5] George Marsaglia and Wai Wan Tsang: "The 64-bit universal RNG", Statistics & Probability Letters, Vol. 66, pp. 183-187 (15 January 2004), doi:10.1016/j.spl.2003.11.001. Note that a part of code in the bottom of p.186, "y=(8888*x)%65579;" should be replaced by "y=(8888*y)%65579;". Consequently, 5 values of "The correct output" in p.187 are incorrect. See http://sci4um.com/about16220-asc.html .

Source code, author and COPYING

https://github.com/t-nissie/xtalgrowth is the source code repository of xtalgrowth. For example, you can edit this document and create a pull request through https://github.com/t-nissie/xtalgrowth/blob/master/index.en.html .

Author: Takeshi Nishimatsu (t_nissie{at}yahoo.co.jp)

Copyright © 2009-2024 by Takeshi Nishimatsu

xtalgrowth is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. You can copy, modify and redistribute xtalgrowth, but only under the conditions described in the GNU General Public License (the "GPL"). For more detail, see COPYING.

Development

Developers need Autotools.

Developers can:

$ git clone https://github.com/t-nissie/xtalgrowth.git
$ cd xtalgrowth
$ autoreconf -v
$ automake --add-missing
$ autoreconf -v            ###*###
$ ./configure
$ make -j9                 # Do development.
$ make check               # Do some tests.
$ make distclean           # Clean up Makefile, etc.
$ ./configure
$ make distcheck           # Check and make a distribution package, xtalgrowth-X.Y.Z.tar.gz.
                           # Give options in DISTCHECK_CONFIGURE_FLAGS.

$ make clean
$ cmake -G Ninja .         # You can also use CMake.
$ cmake -LA .
$ ninja
$ ninja test

Go back to ###*###, when you edit configure.ac, Makefile.am, src/Makefile.am, etc. "make Makefile" may be enough sometimes. Note that src/CMakeLists.txt is made from src/CMakeLists.txt.in by configure.

Acknowledgements

http://loto.sourceforge.net/xtalgrowth/ is hosted by SourceForge.net Logo .