MAGEMin installation (C-library)
Linux

C and Fortran Compilers
Using either gcc or clang to compile MAGEMin is up to you as the runtime performances are similar. However, in the event you want to modify MAGEMin for your own use, I would advise that you compile MAGEMin with clang as the error handling system is more strict, which will save you from unexpected segmentation faults.
sudo apt-get install gcc
sudo apt-get install clang
sudo apt-get install gfortranOpen MPI (Message Passing Interface)
sudo apt-get install openmpi-bin libopenmpi-devNote
mpich can equally be used.
LAPACKE (C version of the Fortran LAPACK library)
sudo apt-get install liblapacke-devNLopt (Non-Linear Optimization Library)
First, cmake must be installed on your machine:
sudo apt-get install cmakeThen NLopt can be installed using:
sudo apt-get install libnlopt-devAlternatively, NLopt can be downloaded and installed manually:
git clone https://github.com/stevengj/nlopt.git
cd nlopt
mkdir build
cd build
cmake ..
make
sudo make installMAGEMin
Choose the C compiler in the first line of the Makefile by commenting out one:
#CC=gcc
CC=clangMake sure the Open MPI paths for libraries and include directory in Makefile are correct. By default, the paths to Open MPI are the following:
LIBS += (...) -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi
INC = (...) -I/usr/lib/x86_64-linux-gnu/openmpi/include/Depending on the machine on which you want to install MAGEMin, you might need to manually specify the paths to NLopt libraries and include directory too:
LIBS += (...) --L/local/home/kwak/nlopt_install/install/lib -lnlopt
INC = (...) -I/local/home/kwak/nlopt_install/install/includeIf you are using Lockless memory allocator, add the following flag in the Makefile:
LIBS += (...) -lllallocThen compile MAGEMin:
make clean; make all;Note
By default, the optimization flag -O3 and debugging flag -g are used.
To test if MAGEMin compilation was successful, you can check the version of MAGEMin by running:
./MAGEMin --versionmacOS

The installation details for macOS use Homebrew. However, the libraries can also be installed using MacPorts.
C and Fortran Compilers
Using either gcc or clang to compile MAGEMin is up to you as the runtime performances are similar. However, in the event you want to modify MAGEMin for your own use, I would advise that you compile MAGEMin with clang as the error handling system is more strict, which will save you from unexpected segmentation faults.
brew install llvm
brew install gccNote
gcc package comes with gcc, g++, and gfortran.
MPICH (Message Passing Interface)
brew install mpichNote
openmpi can equally be used.
LAPACKE (C version of the Fortran LAPACK library, should now be included in the LAPACK libraries)
brew install lapackIf the lapacke libraries are not included, you can download the LAPACK package from Netlib that includes it.
NLopt (Non-Linear Optimization Library)
NLopt can be installed using:
brew install nloptMAGEMin
Choose the C compiler in the first line of the Makefile by commenting out one:
#CC=gcc
CC=clangMake sure the MPICH paths for libraries and include directory in the Makefile are correct, for instance:
LIBS += (...) /opt/homebrew/lib/libmpich.dylib
INC = (...) -I/opt/homebrew/includeDo the same for LAPACKE:
LIBS += (...) /opt/homebrew/opt/lapack/lib/liblapacke.dylib
INC += (...) -I/opt/homebrew/opt/lapack/includeAnd NLopt:
LIBS += (...) /opt/homebrew/lib/libnlopt.dylibWhich should give:
LIBS = -lm -framework Accelerate /opt/homebrew/opt/lapack/lib/liblapacke.dylib /opt/homebrew/lib/libnlopt.dylib /opt/homebrew/lib/libmpich.dylib
INC = -I/opt/homebrew/opt/lapack/include -I/opt/homebrew/includeNote
This setup is provided by default in the Makefile for macOS. As long as you installed every package using Homebrew, you should be able to install MAGEMin without modifying these entries.
If you decided to use openmpi instead of mpich, your Makefile should look like:
LIBS = -lm -framework Accelerate /opt/homebrew/opt/lapack/lib/liblapacke.dylib /opt/homebrew/opt/nlopt/lib/libnlopt.dylib /opt/homebrew/opt/openmpi/lib/libmpi.dylib
INC = -I/opt/homebrew/opt/openmpi/include/ -I/opt/homebrew/opt/lapack/include -I/usr/local/include -I/opt/homebrew/opt/nlopt/include/Then simply enter the MAGEMin directory and compile MAGEMin as:
make clean; make all;Note
By default, the optimization flag -O3 and debugging flag -g are used.
To test if MAGEMin compilation was successful, you can check the version of MAGEMin by running:
./MAGEMin --version