Visualisation of crystal vibrations with Blender.
Visualisation is a powerful tool for the study of vibrations in the solid state. "Semi-automatic" animations have been generated for scientific publications, where they provide insight to spectroscopic observations.[1,2] (Images 1, 2.) In order to make this type of imagery more accessible, and add some visual interest to ajjackson's PhD thesis, a more convenient and automatic toolchain is desirable.
A presentation outlining some features and implementation details is available online.
.ascii
files. These can be generated with Phonopy. The format was originally specified for v_sim, a useful program and one of the only tools available for visualising non-Gamma-point phonons.Development is in progress and hosted on Github. Please use the issue tracker for feature requests, bug reports and more general questions. For more information about the structure and goals of this project see the relevant section in the official documentation.
The simplest way to get up and running is
git clone git@github.com:ajjackson/ascii-phonons
python-imaging-tk
. Mac OSX and Windows Python distributions tend to include Tkinter, but it may be necessary to also install a PIL implementation such as Pillow.For those who would prefer to avoid working through the Python API, a command-line wrapper scripts/ascii-phonons and a graphical user intergace scripts/ascii-phonons-gui are available. Call the script with
ascii-phonons -h
for information about the numerous command-line arguments, or take a look at the online documentation.
If working on Mac OS X, you may need to specify the path to your Blender binary, which is tucked away in a .app package, using the -b
flag.
However, the script assumes you have Blender installed in a folder called "Blender" in the root Applications folder, and should find your binary in this case.
A typical call to the wrapper script would be something like:
ascii-phonons /path/to/my/phonons.ascii -m 5 --static --vectors -o pretty
which should write a static image pretty.png, illustrating mode 5 with arrows. To generate an animation, try
ascii-phonons /path/to/my/phonons.ascii -m 1 --gif -o pretty
which will use Imagemagick to generate pretty.gif.
The --montage
flag implements the tiled output; try something like
ascii-phonons /path/to/my/phonons.ascii --static --vectors --montage -o pretty
to generate a static image. Note that, while smaller images are rendered, this can take some time if your system has a large number of phonon modes.
When you are comfortable that the code works for you, the GUI (ascii-phonons-gui) offers an easy way to experiment with different settings and features.
The "File" menu of the GUI allows you to save your settings to a .conf file, and to combine your settings with other .conf files including colour schemes.
To use the resulting file with the CLI, use the --config
flag.
ascii-phonons /path/to/my/phonons.ascii --config my_amazing.conf
Note that information about input and output files is contained within the .conf file, but that scripts/ascii-phonons always requires a .ascii file to be provided at the command line.
The default atomic radii are the covalent radii from Cordero et al (2008). The eigenvectors may be scaled by the square root of the relative atomic mass; the atomic mass data is from Coursey et al. (2015). (This is usually unnecessary as Phonopy applies this scaling when generating the .ascii file.)
Work on this package began while ajjackon was a PhD student funded by EPSRC through the Center for Sustainable Chemical Technologies (grant no. EP/G03768X/1) at the University of Bath. Further work to fix bugs and improve the documentation and useability has taken place as a Research Assistant in the same research group, while funded by the ERC (project 277757).
GNU GPL v3
Use at your own risk. This project is not affiliated with Blender, Phonopy or v_sim.