#! /bin/bash # This script installs mylammps automatically in an invidual user's home directory. It is specially designed to work for Ubuntu. It should theoretically work for Ubuntu of other version. ## It is assumed that fftw3 and mpich2 are already properly installed # This script will create a folder mylamps in ~/ (home directory of current user). # Choose either scp from www2 (not current version) or git (current/latest version) or wget. By default, wget is used. # Make sure you have git installed, or yum install git.x86_64 as root, if you wish to download with git clone (instead of scp) ######### begin downloading ########################### cd ~/ # Use either Option 1 or Option 2, but not both to download the mylammps. By default, Option 2 is used. Option 2 is faster but it does not contains the lastest version of mylammps. Option 1 is slower but it downloads directly the latest version from the source in the web. ## Option 1. Uncomment if want to use this option. # git clone http://git.icms.temple.edu/lammps-ro.git mylammps ## End of Option 1 ## Option 2. Default option. wget -r -l1 --no-parent -A.tar.gz http://www2.fizik.usm.my/configrepo/howto/mylammps/ cp www2.fizik.usm.my/configrepo/howto/mylammps/*.tar.gz . mv lammps-* mylammps.tar.gz tar -zxvf mylammps.tar.gz mv lammps-* mylammps rm -rf www2.fizik.usm.my mylammps.tar.gz #mkdir mylammps ## End of Option 2 ####### begin installation #################################################### # atc # cd ~/mylammps cd lib cd atc wget http://www2.fizik.usm.my/configrepo/howto/mylammps/Makefile.g++.atc.ubuntu mv Makefile.g++ Makefile.g++.bk cp Makefile.g++.atc.ubuntu Makefile.g++ make -f Makefile.g++ # linalg # cd ~/mylammps/lib cd linalg make -f Makefile.gfortran # mean # cd ~/mylammps/lib cd meam wget http://www2.fizik.usm.my/configrepo/howto/mylammps/Makefile.lammps.ubuntu mv Makefile.lammps Makefile.lammps.orig mv Makefile.lammps.ubuntu Makefile.lammps make -f Makefile.gfortran # reax # cd ~/mylammps/lib cd reax wget http://www2.fizik.usm.my/configrepo/howto/mylammps/Makefile.lammps.ubuntu mv Makefile.lammps Makefile.lammps.orig mv Makefile.lammps.ubuntu Makefile.lammps make -f Makefile.gfortran # peom # cd ~/mylammps/lib cd poems make -f Makefile.g++ # Now exit /lib cd ~/mylammps/src/MAKE wget http://www2.fizik.usm.my/configrepo/howto/mylammps/Makefile.g++.src.MAKE.ubuntu cp Makefile.g++ Makefile.g++.bk cp Makefile.g++.src.MAKE.ubuntu Makefile.g++ cd ~/mylammps/src/ make yes-all make no-user-cuda make no-gpu make no-user-awpmd make no-kim make g++ ### Post-installation #### ### Add the following aliases into ~/.bashrc echo 'alias mmpiexec="/opt/mpich2/gnu/bin/mpiexec"' >> ~/.bashrc echo 'alias lg++="~/mylammps/src/lmp_g++"' >> ~/.bashrc ### End of Post-installation #### # To run an mylammps calclation, you must prepare an input file named as 'in.XXXX'. For example, to run the calculation 'colloid', which is kept in the folder ~/mylammps/examples/in.colloid, issue the command: # 'mmpiexec -f ~/hosts -np NP lg++ < ~/mylammps/examples/in.colloid' # where NP = number of processors, NP = 1, 2, 3, ... # Note that the executable 'mmpiexec', 'lg++' must be ready before issuing the above command. 'mmpiexec' and 'lg++' are aliases that are to be defined in ~/.bashrc. # Nota also that to run lammps in mpi mode, a ~/hosts file must be created. It should contain the list of nodes to be used to run a lammps calculation, e.g., #anicca.usm.my #compute-0-0 #compute-0-1 #compute-0-2 # ... # Alternatively, you can also specify the node's using their private IP addresses, e.g., # 10.1.1.1 # 10.1.255.245 # 10.1.255.246 # 10.1.255.247 # ... # To check the private IP address of the nodes, just issue the command '/sbin/ifconfig' # How to set the number of 'NP': # anicca.usm.my, is a Rocks 5.4.3 cluster comprised of 30 nodes, where each node contains 4 cores. So the total number of cores available is 4 x 30. If the list as appear in ~/hosts contains only 20 nodes, then NP = 20 x 4 = 80 is the optimal number to use. If NP is set to be more than 80, non-optimal mpi performance may result. To run only a calculation in a single machine, set NP = 4, and list only 1 node in ~/hosts.