Tagged: scientific computing

Apple for science

For my research, Mac offers a nice compromise between the functionality of Windows and the power of Linux.  Chemistry comfort software like Chemdraw, Endnote, Mendeley, MS Office and LaTEX are all available. For scientific computing, there are a few quirks that you need to get around:

(i) Where is .bashrc? It hides in /etc/bashrc. For a splash of colour, add export TERM=xterm-color to your .bash_profile.

(ii) Package managers: no Yum, but Macports and Fink work well.

(iii) How to hide folders from Finder? Away from the command line, some folders really should remain hidden from view. One good example is the ‘Microsoft_User_Data’ folder. Solution: SetFile -a V [folder]

(iv) Free useful applications? Mendeley (references); Vesta (visualisation); Inkscape (vector art); Gimp (bitmap art); Open Babel (structure conversion);  GeoGebra (geometric fun); Texmaker (LaTex GUI).

(v) Free C and Fortran compilers? You would expect to have standard compilers installed by default. Well no, but fortunately the good people at Mac HPC and Mac Research are there to help. First you need to install XCode (from the AppStore, or directly from here), and for the newer versions you need to install the command line tools add-on separately. This sets up a basic gcc compiler. Binaries for the latest versions of gcc/gfortran are available here. Be sure to download both binaries, and remember to add the path to your shell: export PATH=/usr/local/bin:$PATH

(vi) Materials modelling codes (FHI-AIMS, VASP, GULP)? For GULP, an OSX binary is available. Once gfortran is installed, you can download and compile standard Unix distributions of GotoBLAS and LAPACK. For FHI-AIMS, the makefile is straightforward, and the binary runs perfectly:

FC = gfortran -m64
FFLAGS = -O2 -ffree-line-length-none
ARCH = arch_generic.f90
LAPACKBLAS = /progs/lapack-3.2.1/lapack_LINUX.a /progs/GotoBLAS2/libgoto2-r1.13.a

For VASP 5, the following gives a serial binary that works quite well:

FC = gfortran -m64
OFLAG  = -O2
FFLAGS = -ffree-form -ffree-line-length-none
BLAS = /progs/GotoBLAS2/libgoto2-r1.13.a
LAPACK = /progs/lapack-3.2.1/lapack_LINUX.a

In my experience OpenMPI works well, with efficient use of four cores on i7 iMacs, and as expected for the premium price, the Intel fortran compiler (and MKL libraries) result in a significant (~20%) performance boost.  Unfortunately, no non-commercial version of ifort is available for Macs.