Compile Tachyon with libpng in LINUX/macos for VMD rendering

Hello World!

This post is inspired by a blog from https://ourphysics.org/wiki/index.php/How_to_make_images_for_publication_using_VMD. They mentioned that one cannot render good quality png figure with the default VMD tachyon. However, they didn't give a fool-proof tutorial about the compilation. So I decided to write down what I did for the recompilation.

Step 1. Download the source code and untar it

wget http://jedi.ks.uiuc.edu/~johns/raytracer/files/0.98.9/tachyon-0.98.9.tar.gz
tar xvfz tachyon-0.98.9.tar.gz

Step 2. Change the compilation setting to use png library

enter the folder "unix" . Then edit the file "Make-config" and change the lines that define USEPNG, PNGINC and PNGLIB

cd tachyon/unix
vi Make-config

Example for linux users

USEPNG= -DUSEPNG
PNGINC= -I/usr/local/include
PNGLIB= -L/usr/local/lib -lpng –lz

For macos users:

USEPNG= -DUSEPNG
PNGINC= -I/usr/X11/include
PNGLIB= -L/usr/X11/lib -lpng –lz 

Step 3. Compile Tachyon

Save the change and compile

make linux-64

or for macos users

make macosx-x86-thr

Step 4. Replace the default Tachyon in VMD software folder

for linux users:

cp $(dirname $(dirname $(which vmd)))/tachyon_LINUXAMD64 $(dirname $(dirname $(which vmd)))/tachyon_LINUXAMD64_origin
cp ../compile/linux-64/tachyon $(dirname $(dirname $(which vmd)))/tachyon_LINUXAMD64

for mac users

cp /Applications/VMD\ 1.9.3.app/Contents/vmd/ tachyon_MACOSXX86 /Applications/VMD\ 1.9.3.app/Contents/vmd/ tachyon_MACOSXX86_origin
cp ../compile/macosx-x86-thr/tachyon /Applications/VMD\ 1.9.3.app/Contents/vmd/ tachyon_MACOSXX86 

Step 5. Testing!

And now you can use the new tachyon to render png file. Just change "-format TARGA -o %s.tga" to "-format PNG -o %s.png"

See also: Tutorial