[lammps-users] Installing additional packages using Homebrew on Mac

Dear Lammps users,

LAMMPS version: 29 Oct 2020 (installed via Homebrew)

OS: macOS 10.14.6

I have recently installed LAMMPS on a Mac using Homebrew, however I have been unable to find any indication on how to install additional packages.

For example, I am trying to run a script in which I use angle style cosine/shift (https://docs.lammps.org/angle_cosine_shift.html), which needs the MOLECULE package, and I get the following error message:

LAMMPS (29 Oct 2020)

ERROR: Unrecognized angle style ‘cosine/shift’ is part of the USER-MISC package which is not enabled in this LAMMPS binary. (…/force.cpp:467)

Last command: angle_style cosine/shift

I don’t understand why the USER-MISC package is demanded instead of the MOLECULE one, but anyway to try and fix this I need to know how to install additional packages via Homebrew…

If anyone has any insight or had similar problems please let me know.

Thank you!

Best regards,


That is really a question for the homebrew folks. The LAMMPS developers have no control over their tool and settings.

Please also note that the online documentation reflects the latest patch version, not the stable version and that we did some reorganization of packages recently where USER-MISC was eliminated.

Dear Axel,

Thanks for the clarification regarding USER-MISC. I had missed that one.

I was finally able to solve the issue with Homebrew.

I understand that the issue I had was not with LAMMPS itself, and thus I shouldn’t have posted about it here, however I’ll post the solution in case someone may find it useful (please forgive me!)

The solution is pretty simple and consists in modifying the code of the homebrew formula (https://github.com/Homebrew/homebrew-core/blob/1bb76f57a241550e6cafa4bd5c432cea5f60a315/Formula/lammps.rb):

$ brew remove lammps

$ brew edit lammps

The lammps formula code will be opened in your default text editor. Add the packages you need as in the following example:

%w[serial mpi].each do |variant|
cd “src” do
system “make”, “clean-all”
system “make”, “yes-standard”
system “make”, “yes-molecule”
system “make”, “yes-rigid”
system “make”, “yes-user-misc”

Note that by default, the formula only contains “yes-standard”

Now reinstall, forcing to build from source (NB: this will take time):

$ brew reinstall --build-from-source

Best regards,