Saturday, April 23, 2011

Building AmberTools 1.5 on a 10.5.x or 10.6.x with gcc/gfortran 4.3

I'll be using BASH environment in my examples here. Although I am a die-hard TCSH fan, I also speak BASH. I envision this document is for first time users who are somehow macports savvy. To learn more about macports, see http://guide.macports.org/ .

10.5.x / 10.6.x

Macports gcc45 is a set of stable compilers that you should be trying first. You are also advised to unset MKL_HOME since MKL gives some bad results for certain tests.

Supposed that you downloaded the source code of AmberTools 1.5 with your web-browser, the normal place of the source code archive file was saved is probably your own Downloads folder. ( ~/Downloads )

Now uncompress the archive and put it into the /opt directory. The reason that I chose this path is that I can always remove the whole contents of /opt folder without interfering your daily operations with your Macintosh.

 $ tar jxvf ~/Download/AmberTools-1.5.tar.bz2 -C /opt

Set up the environment variable, if these variables have already been set in your ~/.bashrc file, please just verify the values of variable and modify accordingly, and then open a new terminal session.

        $ export AMBERHOME=/opt/amber11
        $ export PATH="$AMBERHOME/bin:$PATH"
        $ export MPI_HOME=$AMBERHOME
        $ unset MKL_HOME
        (note: "unset" doesn't work on CSH, please use "unsetenv" instead)
        $ echo 'export AMBERHOME=/opt/amber11' >> ~/.bashrc
        $ echo 'export PATH="$AMBERHOME/bin:$PATH"' >> ~/.bashrc
        $ echo 'export MPI_HOME=$AMBERHOME' >> ~/.bashrc
        $ cd /opt/amber11/AmberTools/src

Configure for building serial amber

        $ ./configure -macAccelerate gnu

Build the serial AT15

        $ make

Test the serial build

        $ cd ../test

Clean the file after the serial build is finished.

        $ cd ../src
        $ make clean

Download the openmpi source code from open-mpi.org

        $ cd ~/Downloads
        $ curl -O http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.3.tar.bz2

Uncompress this source archive

        $ cd /opt/amber11/AmberTools/src
        $ tar jxvf ~/Downloads/openmpi-1.4.3.tar.bz2

Build amber's own openmpi

        $ ./configure_openmpi
( If you use TCSH/CSH as your login shell, you'd need to run "rehash" command before continue following procedures. )

Configure parallel ambertools

        $ ./configure -mpi -macAccelerate gnu

Build some parallel components of ambertools

        $ make

Test parallel set

        $ cd ../test
        $ export DO_PARALLEL='mpirun -np 2'
        $ ./test_at_parallel.sh

Friday, April 22, 2011

Building AmberTools 1.5 on a 10.4.x Tiger with gcc/gfortran 4.3

I'll be using BASH environment in my examples here although I am a die-hard TCSH fan, I also speak BASH. I envision this document is for first time users who are somehow macports savvy. To learn more about macports, see http://guide.macports.org/ .

The only reason that I am writing something for 10.4.x is that I have a intel-cpu 10.4.x box and "because I can". A very important limit of 10.4.x is that you can only build a gcc/gfortran as new as gcc43. So for a macports user like me, I just do "sudo port install gcc43 gcc_select". (After using macports with different compilers for a while, many people should be able to appreciate how handy gcc_select is...)

Supposed that you downloaded the source code of AmberTools 1.5 with your web-browser, the normal place of the source code archive file was saved is probably your own Downloads folder. ( ~/Downloads )

Now uncompress the archive and put it into the /opt directory. The reason that I chose this path is that I can always remove the whole contents of /opt folder without interfering your daily operations with your Macintosh.

        $ tar jxvf ~/Download/AmberTools-1.5.tar.bz2 -C /opt

SERIAL AmberTools

Add "#include <unistd.h>" to AmberTools/src/ptraj/trajectory.c

        $ cd /opt/amber11/AmberTools/src/ptraj
        $ curl -O http://mjhsieh.github.com/a15_trajectory.patch
        $ patch -p0 < a15_trajectory.patch
Somehow my macports gcc43 doesn't understand off_t inside ptraj/trajectory.c. The situation is quite weird, since off_t is a posix standard, meaning that it should be a default everywhere. (updated: unistd.h is not included in ANSI standard.) Anyway, doing this doesn't hurt. (Updated: The reason that I didn't put this in the source tree was that I don't think 10.4.x tiger is a popular OS of choice for a Mac.)

Set up the environment variable, if these variables have already been set in your .bashrc file, please just verify the values of variable and modify accordingly, and then open a new terminal session.

        $ export AMBERHOME=/opt/amber11
        $ export PATH="$AMBERHOME/bin:$PATH"
        $ export MPI_HOME=$AMBERHOME
        $ echo 'export AMBERHOME=/opt/amber11' >> ~/.bashrc
        $ echo 'export PATH="$AMBERHOME/bin:$PATH"' >> ~/.bashrc
        $ echo 'export MPI_HOME=$AMBERHOME' >> ~/.bashrc
        $ cd /opt/amber11/AmberTools/src
For ambertools with xLEaP, we used default setting.
        $ ./configure gnu
For ambertools without xLEaP, generally good for 10.4.x, since many people probably didn't install the developers' tools with X11 option activated.
        $ ./configure -noX11 gnu

Build the serial AT15

        $ make
(cheering after it finished without problems)

Test the serial build

        $ cd ../test
        $ ./test_at_serial.sh
(cheering after it finished without problems)

Clean the file after the serial build is finished.

        $ cd ../src
        $ make clean

PARALLEL AmberTools

Download the openmpi source code from open-mpi.org
        $ cd ~/Downloads
        $ curl -O http://www.open-mpi.org/software/ompi/v1.4/downloads/openmpi-1.4.3.tar.bz2

Uncompress this source archive

        $ cd /opt/amber11/AmberTools/src
        $ tar jxvf ~/Downloads/openmpi-1.4.3.tar.bz2

Build amber's own openmpi

        $ ./configure_openmpi
(cheering after it finished without problems)

Configure parallel ambertools

        $ ./configure -mpi gnu

Build some parallel components of ambertools

        $ make
(cheering after it finished without problems)

Test

        $ cd ../test
        $ export DO_PARALLEL='mpirun -np 2'
        $ ./test_at_parallel.sh
There you have it!

Monday, April 18, 2011

AmberTools 1.5, the Intel compilers, and the Intel Math Kernel Library (MKL)

We're pleased to announce the release of AmberTools 1.5, now available from the Amber website.

It includes several new packages:

  • MMPBSA.py, a much-expanded program for energetic analyses of trajectories
  • amberlite, a simplified interface for mm-pbsa analyses of protein-ligand interactions
  • MCPB, a platform for developing parameters for active sites of metalloproteins
  • cpptraj, an expanded trajectory analysis program
  • mdgx, a coding platform for explicit-solvent MD simulations
  • updates to GAFF (general Amber force field) and to the RNA force fields
You may install AmberTools 1.5 on top of an existing Amber 11 / AmberTools 1.4 installation. For instructions, please see the web site.

There are two traps I've discovered during the testing phase, related to AmberTools 1.5, the Mac, and the Intel compilers.

The first is that, if you're using the Intel compilers, it matters what version of the GNU compilers (gcc, etc.) you've selected. That's because parts of the code use the c++0x version of the C++ standard, and the version of the C++ header files becomes important. If you use the MacPorts GCC 4.4 or 4.5, you'll get ugly errors like this:

/opt/local/include/gcc44/c++/bits/stringfwd.h(67): error: identifier "char16_t" is undefined
    template<> struct char_traits<char16_t>;
                                  ^

/opt/local/include/gcc44/c++/bits/stringfwd.h(68): error: identifier "char32_t" is undefined
    template<> struct char_traits<char32_t>;                                   ^
The solution, if you get such errors, is to use the command sudo gcc_select, and choose a version of the GNU compilers that came with the XCode development tools. This will present the Intel compilers with a compatible version of the C and C++ headers.

A second problem is that some parts of Amber give bad results with the Intel MKL libraries. The solution here is simple: Don't use them. Make sure that the environment variables MKLROOT and MKL_HOME are unset (note: If they are set, the Amber configuration script will attempt to use an MKL in the location they point to). Instead, configure AmberTools with the –macAccelerate switch.