Download it from lammps.sandia.gov
In the terminal write the following:
tar xvf lammps*.tar
This will create a file named: ''lammps-21Nov09'' (The date may change depending of the updates in the website).
It will contain the following files: bench, doc, examples, lib, potentials, src, tools.
christian@christian-laptop:~/lammps/lammps-21Nov09$ cd src
christian@christian-laptop:~/lammps/lammps-21Nov09$ cd MAKE
Before keep going it is necessary to solve some dependencies: build-essential (to compile in C), MPIch (to work in parallel) , FFTW ( to compute long-range interactions), libxaw7 (to compute the movies). In one line code you choose
sudo apt-get install build-essential mpich-bin libmpich1.0-dev fftw2 fftw-dev libxaw7-dev
If you are working in your personal computer you just need
sudo apt-get install build-essential
sudo apt-get install libxaw7-dev
To avoid future problems it will be better installing with the first line code
Now in the MAKE file you will see a lot of makefiles.xxx. Most users think Makefile.linux is the one they should use because they use ''linux.'' If you open the Makefile.linux you will see that it requires MPICH and FFTW. Things that we actually don't need (especially if we are starting the use of lammps). What a Beginner needs to install is Makefile.serial. If you open this file you will see in the first line that it says: no MPICH, no FFTW.
If you read carefully the Makefile.serial, in one line it says:
# MPI library, can be src/STUBS dummy lib.
If you go to STUBS you will find a Makefile, this will create a dummy lib for MPI in accordance to the Makefile.serial. So in the STUBS file you type:
christian@christian-laptop:~/lammps/lammps-21Nov09/src/STUBS$ make clean
Then you go back to src and compile lammps
christian@christian-laptop:~/lammps/lammps-21Nov09/src$ make clean-all
christian@christian-laptop:~/lammps/lammps-21Nov09/src$ make serial
It will work correctly, to verify your installation we will run some examples. First type
You should get:
LAMMPS (7 Jul 2009)
This means you are ok in the installation process, ctrl-C to get out and let's go to the examples file (cd ../examples), Choose any, and get deep in learning the meaning of the codes. Each example has one or more lammps input files.
For instance I will choose ''flow'' (cd flow). It has two in.flow.xxx files. (input files). I will run one of them by typing:
christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ ../../src/lmp_serial < in.flow.couette
Where is the data stored? Check the in.flow.couette file to see where it is. Almost at the end it says:
dump 1 all atom 50 dump.flow
So the data is stored in dump.flow
To finish this test let's visualize the data in a movie. First let's install xmovie
christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ cd ../../tools/
christian@christian-laptop:~/lammps/lammps-21Nov09/tools$ cd xmovie
Now you will be able to visualize your data using xmovie just by typing in the flow directory
christian@christian-laptop:~/lammps/lammps-21Nov09/examples/flow$ ../../tools/xmovie/xmovie -scale dump.flow
This will open the program, maybe your screen will appear black, change the color of your particles and click in Start to watch it.
2. 1. lammps install with makefile for parallel
From : http://ubuntuforums.org/showthread.php?t=1390490
I will tell you how to compile a serial and parallel version of LAMMPS (24Jan10) on Ubuntu 9.10. I don't expect to be making many return trips to this post, since as far as I can tell, everything works smoothly.
A couple disclaimers:
- Nearly everything can be figured out by thoroughly reading the LAMMPS documentation (link). That includes this entire guide!
- Don't forget the mailing list (link). Someone may have already asked your question so be sure to search it (link).
- I am going to assume you are comfortable issuing commands in the terminal.
- I will not deal with the instructions for older versions of LAMMPS or Ubuntu, since they are outdated and correspondingly more complicated.
- I am not responsible if you cannot get LAMMPS to compile.
- These instructions have been only tested to work on 25 January 2010 on a fresh Ubuntu 9.10 (Karmic) installation.
- It is your job to manage multiple MPI implementations if that is an issue on your machine. I assume there is no MPI infrastructure installed and install mpich2.
- The version of LAMMPS changes very rapidly, so just replace lammps-24Jan10 with lammps-(whatever your package release date is) and everything should still work.
- Finally, LAMMPS will probably never be available through apt-get because of very quick release of patches and updates as well as the inability to modify/extend LAMMPS if it were installed by apt-get. That means LAMMPS never gets "installed", and when you call it, the path to the binary must be explicitly given or be found within the $PATH.
Let's start making LAMMPS!
- Enable Universe Repository, if not enabled (link)
- Install required packages to build LAMMPS
You will need superuser privileges to successfully issue:Code:
sudo apt-get install build-essential fftw-dev tcsh mpich2 gfortran
- build-essential is non-negotiable, and you may already have it installed.
- fftw-dev installs developer files for FFTW2 (not FFTW3, which won't work!) at standard locations that ubuntu knows about. It's possible to configure a LAMMPS compilation without any FFT tables, but I won't cover that here.
- tcsh is required so the LAMMPS Makefile system works. Substituting this with the "csh" package probably won't make any difference. (EDIT: As of the 30 Jan 2010 patch, this package is no longer needed).
- mpich2 will install MPICH-2, which can perform compilation of MPI programs linking to native MPI libraries. If only want a serial binary, you may safely leave this package off the list. While there are many other MPI implementations, I am not going to cover them here, though the idea is still the same. MPICH is kind of odd in that it requires a little bit more configuration to make it work, see below for the additional instructions.
- gfortran is required to compile and link against the Fortran libraries MEAM and REAX. If you use a different Fortran compiler, or will not be linking these libraries, it is safe to leave this item off the package list.
- Get LAMMPS
You can do this by going to the LAMMPS WWW site (link) or by issuing the following command in terminalCode:
wget -m -nd http://lammps.sandia.gov/tars/lammps.tar.gz
- Unpack LAMMPS
tar xvzf lammps.tar.gz
- Copy Makefile to lammps-24Jan10/src/MAKE/Makefile.ubuntu
I have attached two files, one for serial and parallel builds. Due to the restrictions of the ubuntuforums.org, I had to give these with a ".txt" extension. When copying the makefile, I highly recommend removing everything from the underscore to the end off the filename (especially including the .txt!).
- Compile LAMMPS
Make sure you are sitting in lammps-24Jan10/src (not the MAKE directory!). You'll need the STUBS library if you're making a serial binaryCode:
# for parallel binaries
# for serial, make STUBS, then LAMMPS
cd STUBS ; make ; cd ..
- Try an example to verify it works
While sitting in the src directory, the first command should run the "crack" example in serial mode. If your computer supports it, the second command should utilize 2 cores and run faster. Remember, even if you compile using the parallel makefile, the first invocation will still work, and is the reason you don't need a separate binary for serial runs.Code:
# change to the examples/crack directory
# for serial or parallel builds
../../lmp_ubuntu < in.crack
# for parallel builds only
mpiexec -np 2 ../../lmp_ubuntu <>
Finally, I note that if you want to build lammps again after a new release or when patches of merged with the trunk, You can simply begin at step 3 and follow to the end. That "wget" command should always give you the latest package as long as the LAMMPS people keep their website they way they have it now.
Finishing the configuration of MPICH2
To finish your MPICH2 installation, you need to make a file at ~/.mpd.conf. The MPICH2 documentation tells you:
A file named .mpd.conf file must be present in the user's home
directory (/etc/mpd.conf if root) with read and write access
only for the user, and must contain at least a line with:
One way to safely create this file is to do the following:
chmod 600 .mpd.conf
and then use an editor to insert a line like
into the file. (Of course use some other secret word than mr45-j9z.)
Last edited by Yoshis88; February 1st, 2010 at 02:02 PM..