INSTALLATION

phyx requires a few dependencies. Since installation of these dependencies differs on Linux vs. mac,
we've separated the instructions below.

## Linux install ##

1.  Install general dependencies:

    sudo apt-get install git
    sudo apt-get install autotools-dev
    sudo apt-get install autoconf
    sudo apt-get install automake
    sudo apt-get install cmake
    sudo apt-get install libtool
    sudo apt-get install liblapack-dev
    sudo apt-get install libatlas-cpp-0.6-dev

2. Clone the phyx repo (if you haven't already):

    git clone git@github.com:FePhyFoFum/phyx.git

3. Install nlopt dependency (default is C, we need C++; not available from apt-get). Either
obtain from http://ab-initio.mit.edu/wiki/index.php/NLopt#Download_and_installation or use
the copy distributed in the deps directory of phyx. Either way, untar and browse in the
terminal to that directory:

    cd nlopt-2.4.2
    ./configure --with-cxx --without-octave --without-matlab
    make
    sudo make install

4. Install armadillo dependency. Note: it is possible to get from apt-get using:

    sudo apt-get install libarmadillo-dev

but need version >= 5.2. On debian it was necessary to use backports:

    sudo apt-get -t jessie-backports install libarmadillo-dev

If that is not possible, either obtain from http://arma.sourceforge.net/download.html
or use the copy distributed in the deps directory of phyx. Either way, untar and browse in the
terminal to that directory:

    cd armadillo-7.400.2
    ./configure
    make
    sudo make install

5. Finally, install phyx:

    cd phyx/src
    autoconf
    ./configure
    make
If you want to install it so it is available anywhere in your system, do:

    sudo make install

## Mac install ##

Mac has become increasingly difficult to support at the command line with changes every version on
location and standards for compilation tools. In particular, Mac now defaults to clang, and clang does
not support OpenMP and doesn't link to gfortran (both used by phyx). For 10.9, we have found that it
is good to install gcc from HPC (http://hpc.sourceforge.net) or homebrew (http://brew.sh). Instructions
for both are below.

Mac Option 1: install using homebrew

1. Install the homebrew package manager (http://brew.sh/):

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Make sure to get access to science packages:

    brew tap homebrew/science

2. Install gcc (can take a while, but enables use of openmp and fortran):

    brew install --without-multilib gcc

3. Install dependencies:

    brew install git
    brew install --use-gcc automake
    brew install --use-gcc autoconf
    brew install --use-gcc libtool
    brew install --use-gcc cmake
    brew install --use-gcc --c++11 nlopt
    brew install --use-gcc --c++11 armadillo

4. On to phyx. First, clone the repository (if you haven't already):

    git clone git@github.com:FePhyFoFum/phyx.git
    cd phyx/src
    autoconf
    ./configure CXX=/usr/local/bin/g++-6
    make

If you want to install it so it is available anywhere in your system, do:

    sudo make install

Mac Option 2: install using HPC

1. Install gcc and gfortran. Download gcc-6.2-bin.tar.gz or more recent from http://hpc.sourceforge.net/. Install with:

    sudo tar -xvf gcc-6.2-bin.tar -C /

2. Install autoconf from http://ftp.gnu.org/gnu/autoconf/. Get autoconf-latest.tar.gz, then:

    tar -xzf autoconf-latest.tar.gz
    cd autoconf-2.69
    ./configure --prefix=/usr/local/autoconf-2.69
    make
    sudo make install
    ln -s autoconf-2.69 /usr/local/autoconf

3. Install cmake and install Armadillo. Get cmake from https://cmake.org/download/
I got https://cmake.org/files/v3.6/cmake-3.6.2-Darwin-x86_64.tar.gz
Get armadillo from http://arma.sourceforge.net/download.html, get the stable one (alternatively,
use the one distributed in the deps directory). Untar it. Double click the Cmake.app. Click
"Browse source..." and choose the armadillo folder that was created after untaring. Click
"Browse build..." and choose the same folder as browse source. Click "Configure" and then click
"Generate". Go to the terminal and browse to that armadillo folder and type:

    make
    sudo make install
    
4. Install nlopt. Go to http://ab-initio.mit.edu/wiki/index.php/NLopt#Download_and_installation
and download the latest (alternatively, use the one distributed in the deps directory). Untar
and browse in the terminal to that directory:

    ./configure --with-cxx --without-octave --without-matlab
    make
    sudo make install

5. Compile phyx. Now you can go to the src directory of phyx and type:

    autoconf
    ./configure
    make

If you want to install it so it is available anywhere in your system, do:

    sudo make install
