How to run LAMMPS on Mac

1. INSTALL

  • Install Homebrew https://brew.sh/
  • Install LAMMPS by Terminal (or Cakebrew) https://lammps.sandia.gov/doc/Install_mac.html

How to run LAMMPS on Mac
Info of LAMMPS in Cakebrew (The default path for LAMMPS is: /usr/local/Cellar/lammps/)

2. RUN

Let’s try with an example file: a colloid case in ~/examples/.

  • Type the following command In Terminal.
cd /usr/local/Cellar/lammps/YOUR VERSION NUMBER/share/lammps/examples/colloid
   /usr/local/Cellar/lammps/YOUR VERSION NUMBER/bin/lmp_serial -in in.colloid

The visualization movie could be obtained here (lammps.org).

How to run LAMMPS on Mac
One frame of the movie (Colloids put in a background solvent of Lennard-Jones particles)

LAMMPS Installation

Installation in windows 

Installation in Ubuntu and other LINUX systems

2. Follow the instruction given for the installation.

Installation in Mac

1. Go to Brew and install Homebrew.

2. Open terminal and go to home directory.

3. Type brew install lammps and press enter. Make sure that you have stable internet connection while doing this. As you will see LAMMPS will get installed.

4. Visit https://lammps.sandia.gov/doc/Install_mac.html for further details on installation.

Running LAMMPS in Windows

1. Open command prompt 

2. Go to the directory where you have your input script by using "cd" command in command prompt 

3. Type "lmp_serial.exe

Running LAMMPS in Linux and Mac

1. Open terminal 

2. Go to "LAMMPS_test_run" folder by using "cd" command in the terminal 

3. Type "lmp_serial -in inputscript.in" and press enter (replace "inputscript.in" with input file name. Your input file can be in ".in" or ".txt" format).

So these are the steps for installation and running of LAMMPS. If you have any difficulty do mention in comment session or contact me through E-Mail.

It’s very easy to start molecular dynamics (MD) on Mac.

Contents

  • 1 Molecular Dynamics
  • 2 LAMMPS
  • 3 Install LAMMPS on Mac
    • 3.1 Install Homebrew
    • 3.2 Install LAMMPS
  • 4 Start LAMMPS

Molecular Dynamics

Molecular dynamics (MD) is a computer simulation method for studying the physical movements of atoms and molecules.

Wikipedia

We can simulate the energy or motion of atoms by molecular dynamics (MD). An atom is too small to see it directly. However, we can observe an atom, its motion, reaction and so on, via MD. Recently, we can use MD very easily.

LAMMPS is a molecular dynamics software and is free. We can use Lammps.

Large-scale Atomic/Molecular Massively Parallel Simulator (LAMMPS) is a molecular dynamics program from Sandia National Laboratories. LAMMPS makes use of Message Passing Interface (MPI) for parallel communication and is free and open-source software, distributed under the terms of the GNU General Public License.

Wikipedia

lammps.sandia.gov

 

LAMMPS Molecular Dynamics Simulator

https://lammps.sandia.gov

LAMMPS home page

Install LAMMPS on Mac

For Mac, installation of LAMMPS is very easy.

(If you have not installed Homebrew, install Homebrew first.

Install Homebrew

Homebrew is a free and open-source software package management system.

Paste the following code in a macOS Terminal prompt.

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now Homebrew is installed. Very easy!

Install LAMMPS

Lammps can be installed using homebrew with the following code.

brew install lammps

Now LAMMPS is installed in you computer.

Start LAMMPS

You can find the examples in “/usr/local/opt/lammps/share/lammps/examples/”. Here, we try to run “crack”. Go to “crack” directory.

cd /usr/local/opt/lammps/share/lammps/examples/crack

Modify “in.crack” file as follwing. (Delete “#” on line 69 to 71)

# 2d LJ crack simulation

dimension	2
boundary	s s p

atom_style	atomic
neighbor	0.3 bin
neigh_modify	delay 5

# create geometry

lattice		hex 0.93
region		box block 0 100 0 40 -0.25 0.25
create_box	5 box
create_atoms	1 box

mass		1 1.0
mass		2 1.0
mass		3 1.0
mass		4 1.0
mass		5 1.0

# LJ potentials

pair_style	lj/cut 2.5
pair_coeff	* * 1.0 1.0 2.5

# define groups

region	        1 block INF INF INF 1.25 INF INF
group		lower region 1
region		2 block INF INF 38.75 INF INF INF
group		upper region 2
group		boundary union lower upper
group		mobile subtract all boundary

region		leftupper block INF 20 20 INF INF INF
region		leftlower block INF 20 INF 20 INF INF
group		leftupper region leftupper
group		leftlower region leftlower

set		group leftupper type 2
set		group leftlower type 3
set		group lower type 4
set		group upper type 5

# initial velocities

compute	  	new mobile temp
velocity	mobile create 0.01 887723 temp new
velocity	upper set 0.0 0.3 0.0
velocity	mobile ramp vy 0.0 0.3 y 1.25 38.75 sum yes

# fixes

fix		1 all nve
fix		2 boundary setforce NULL 0.0 0.0

# run

timestep	0.003
thermo		200
thermo_modify	temp new

neigh_modify	exclude type 2 3

#dump		1 all atom 500 dump.crack

dump		2 all image 250 image.*.jpg type type &
		zoom 1.6 adiam 1.5
dump_modify	2 pad 4

#dump		3 all movie 250 movie.mpg type type &
#		zoom 1.6 adiam 1.5
#dump_modify	3 pad 4

run		5000

After modification, run lammps with the following code.

lmp_serial -in in.crack

After the short calculation, you can find the jpeg files.

open image.*
How to run LAMMPS on Mac

Congratulations! You can success to run MD with LAMMPS.

Post navigation

How do you execute LAMMPS?

Get a command prompt by going to Start->Run… , then typing “cmd”..
Move to the directory where you have your input script, (e.g. by typing: cd “Documents”)..
At the command prompt, type “lmp -in in. file”, where in. file is the name of your LAMMPS input script..

How do I run LAMMPS on cluster?

Run LAMMPS on the Cluster.
Use module avail lammps to see all available versions of LAMMPS on the cluster..
To load LAMMPS in your PBS script: module load lammps/22Aug18 . ... .
To run LAMMPS: In your PBS script, put all the lines to execute LAMMPS after the module load lines that load LAMMPS..

Where is LAMMPS located?

The source files of the LAMMPS code are found in two directories of the distribution: src and lib . Most of the code is written in C++ but there are small a number of files in several other languages like C, Fortran, Shell script, or Python. The core of the code is located in the src folder and its sub-directories.

How do I run a LAMMPS script in Linux?

You normally run the LAMMPS command in the directory where your input script is located. That is also where output files are produced by default, unless you provide specific other paths in your input script or on the command line. As in some of the examples above, the LAMMPS executable itself can be placed elsewhere.