## run this script as SU to install psi4 in a rocks linux computer cluster.
## psi will be installed in /share/apps/psi4

#! /bin/bash



cd /share/apps/configrepo
wget http://www2.fizik.usm.my/configrepo/howto/psi4/psi4.tar.gz
tar -zxvf psi4.tar.gz
cd psi4.0b5
autoconf

cd madness
autoreconf
cd ..

mkdir obj
cd obj
make clean

rm -rf /tmp/root

../configure --prefix=/share/apps/psi4 --with-cc=icc --with-cxx=icpc --with-fc=ifort --with-incdirs='-I/share/apps/intel/Compiler/11.1/072/include -I/share/apps/intel/Compiler/11.1/072/mkl/include -I/share/apps/mpich2/include' --with-opt='-O2 -static -no-prec-div' --with-libdirs='-L/share/apps/intel/Compiler/11.1/072/lib/intel64 -L/share/apps/intel/Compiler/11.1/072/mkl/lib/em64t' --with-blas='-Wl,--start-group -lmkl_intel_thread -lmkl_core  -lmkl_solver_lp64 -Wl,--end-group -lguide -lpthread' --with-lapack='-Wl,--start-group -lmkl_intel_thread -lmkl_lapack95_lp64 -lmkl_solver_lp64 -Wl,--end-group -lguide -lpthread' 

# -lmkl_lapack -lmkl_def
# --with-lapack=-lmkl_lapack95_lp64
# -I/share/apps/estools/openmpi/1.8.5/intel/include
#-lmkl 
#-L/share/apps/intel/Compiler/11.0/081/lib/intel64 -L/share/apps/intel/Compiler/11.0/081/mkl/lib/em64t
#-I/share/apps/intel/Compiler/11.0/081/include
#-I/share/apps/intel/Compiler/11.0/081/mkl/include
#--with-blas='-Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread  -Wl,--end-group'
#LDFLAGS='-L/export/home/sheng/Desktop/systemtools/Python/Python-2.7.9/'


#../configure --prefix=/share/apps/psi4 --with-blas='-Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -lpthread' --with-cc=icc --with-cxx=icpc --with-fc=ifort --with-lapack=-lmkl_lapack95_lp64 --with-opt='-O2 -static -no-prec-div' --with-max-am-eri=6 --with-incdirs='-I/share/apps/intel/Compiler/11.0/081/mkl/include -I/share/apps/intel/Compiler/11.0/081/include' --with-libdirs='-L/share/apps/intel/Compiler/11.0/081/lib/intel64 -L/share/apps/intel/Compiler/11.0/081/mkl/lib/em64t -L/share/apps/intel/Compiler/11.1/072/mkl/lib/em64t' --with-libs='-liomp5'

#../configure --prefix=/share/apps/psi4 --with-blas='-Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -lpthread' --with-cc=icc --with-cxx=icpc --with-fc=ifort --with-lapack=-lmkl_lapack95_lp64 --with-opt='-O2 -static -no-prec-div' --with-max-am-eri=6 --with-incdirs='-I/share/apps/intel/Compiler/11.0/081/mkl/include -I/share/apps/intel/Compiler/11.0/081/include -L/share/apps/intel/Compiler/11.0/081/lib/intel64 -liomp5' --with-libdirs='-L/share/apps/intel/Compiler/11.0/081/lib/intel64 -I/share/apps/intel/Compiler/11.0/081/include -L/share/apps/intel/Compiler/11.0/081/mkl/lib/em64t' --with-libs='-liomp5'

#../configure --prefix=/share/apps/psi4 --with-blas='-Wl,--start-group -L/share/apps/intel/Compiler/11.0/081/mkl/lib/em64t #-L/share/apps/intel/Compiler/11.0/081/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -lpthread' #--with-lapack=-lmkl_lapack95_lp64 --with-cc=icc --with-cxx=icpc --with-fc=ifort  --with-opt='-O2 -static -no-prec-div' #--with-incdirs='-I/share/apps/intel/Compiler/11.0/081/mkl/include -I/share/apps/intel/Compiler/11.0/081/include' --with-libs='-liomp5'

make 

# -L/share/apps/configrepo/psi4.0b5/boost/boost_1_53_0/stage/lib -liomp5
#cd /share/apps/configrepo/psi4.0b5/boost
#tar -zxvf boost_1_53_0.tar.gz

make tests
chmod +x /share/apps/configrepo/psi4.0b5/bin/mkdirs.sh
chmod +x /share/apps/configrepo/psi4.0b5/bin/installinc.sh
make install

