#### auto installation of mylammps with git. This script is meant for Rocks Linux cluster.

#/bin/bash

dir=/share/apps/mylammps_git
mkdir $dir
cd $dir
git clone git://git.lammps.org/lammps-ro.git mylammps

dir=/share/apps/mylammps_git/mylammps

libdir=$dir/lib

# atc #
cd $libdir
cd atc
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/atc/Makefile.ytl
make -f Makefile.ytl
rm -f Makefile.lammps
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/atc/Makefile.lammps


# linalg #
cd $libdir
cd linalg
make -f  Makefile.gfortran


# meam #
cd $libdir
cd meam
rm -f Makefile.lammps
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/meam/Makefile.lammps.ytl
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/meam/Makefile.ytl
make -f Makefile.ytl



# poems #
cd $libdir
cd poems
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/poems/Makefile.ytl
make -f Makefile.ytl


# reax #
cd $libdir
cd reax
rm -f Makefile.lammps
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/reax/Makefile.ytl
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/lib/reax/Makefile.lammps.ytl
make -f Makefile.ytl


# colvars #
cd $libdir
cd colvars
make -f Makefile.g++



# VORONOI 
#Note: voro++ must have been installed. For automatic installation of voro++, see 
#http://www2.fizik.usm.my/configrepo/howto/voro++/inst_voro++
cd $dir/src/VORONOI
mv Makefile.lammps Makefile.lammp.orig
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/src/VORONOI/Makefile.lammps


# Now exit /lib 
cd $dir/src/MAKE
wget http://www2.fizik.usm.my/configrepo/howto/mylammps/git/src/MAKE/Makefile.ytl

cd $dir/src/
make yes-all
make no-user-cuda
make no-gpu
make no-user-awpmd
make no-kim
make ytl

### creating link
cd $dir/src
rm -rf lmp_ig
ln -s lmp_ytl lmp_ig
cd /share/apps/local/bin
rm -rf lmp_ig
ln -s $dir/src/lmp_ig .

# place the path /share/apps/local/bin in the .bashrc of home users who wishes to use the executable
