Installing LAMMPS on Mac


Installing LAMMPS on Mac

Install LAMMPS on my Mac.

Installing with Homebrew

It’s super easy with Homebrew.

Just run:

Terminal window
brew install lammps

That’s it.

Running LAMMPS

Example files are located at /opt/homebrew/share/lammps/examples, so pick one and try running it.

ex. melt

コマンドファイルは以下。

in.melt
# 3d Lennard-Jones melt
units lj
atom_style atomic
lattice fcc 0.8442
region box block 0 10 0 10 0 10
create_box 1 box
create_atoms 1 box
mass 1 1.0
velocity all create 3.0 87287 loop geom
pair_style lj/cut 2.5
pair_coeff 1 1 1.0 1.0 2.5
neighbor 0.3 bin
neigh_modify every 20 delay 0 check no
#change_box all x scale 2.0 y scale 2.0 z scale 2.0 remap
fix 1 all nve
dump 1 all atom 25 *.dump
dump_modify 1 pad 4
dump 2 all image 25 *.jpg type type &
axes yes 0.8 0.02 view 60 -30
dump_modify 2 pad 4
#dump 3 all movie 25 movie.mpg type type &
# axes yes 0.8 0.02 view 60 -30
#dump_modify 3 pad 3
thermo 50
run 1000

Note: The dump movie command doesn’t work with the Homebrew-installed version. If you want to use it, you’ll need to build from source.

Alternatively, you can quickly create a movie with ffmpeg.

Terminal window
lmp_serial -in in.melt
ls *.jpg | sort | awk '{print "file \x27" $0 "\x27"}' > filelist.txt
ffmpeg -f concat -safe 0 -i filelist.txt -vsync vfr -pix_fmt yuv420p output.mp4
Play

That said, using Ovito to load dump files and create animations gives you more flexibility and better results.

Play

Author

me

Fumito Iriya

Scientist (Ph.D.), Programer, Web Developer, Guitarist, Photographer

more...