LAMMPS needs GRANULAR package, but already located in /path/to/lammps/src

I’m on the latest stable version on LAMMPS (2AUG2023) and running a job. When I call for an action in the script using

pair_style gran/hooke/history

When LAMMPS reaches this line, I get the following error:

ERROR: Unrecognized pair style ‘gran/hooke/history’ is part of the GRANULAR package which is not enabled in this LAMMPS binary. (src/force.cpp:271)

I looked in ~/path/to/my/lammps/src , and I see the GRANULAR package sitting in there. Am I missing something to call for the GRANULAR package? The LAMMPS documentation says it should already be included in the library.

What LAMMPS documentation says where.

The fact that you have the GRANULAR folder with the sources, does not mean it is included in the binary.

Please see the manual: 3.6. Include packages in build — LAMMPS documentation

Thanks for the reply! The package is included:

– <<< Build configuration >>>
LAMMPS Version: 20230802
Operating System: Darwin
CMake Version: 3.28.1
Build type: RelWithDebInfo
Install path: /Users/me/.local
Generator: Unix Makefiles using /usr/bin/make
– Enabled packages: BODY;GRANULAR

But it still gives the message

What is the output of ./lmp -h

Large-scale Atomic/Molecular Massively Parallel Simulator - 2 Aug 2023 - Update 2

Usage example: ./lmp -var t 300 -echo screen -in in.alloy

List of command line options supported by this LAMMPS executable:

-echo none/screen/log/both : echoing of input script (-e)
-help : print this help message (-h)
-in none/filename : read input from file or stdin (default) (-i)
-kokkos on/off … : turn KOKKOS mode on or off (-k)
-log none/filename : where to send log output (-l)
-mdi ‘’ : pass flags to the MolSSI Driver Interface
-mpicolor color : which exe in a multi-exe mpirun cmd (-m)
-cite : select citation reminder style (-c)
-nocite : disable citation reminder (-nc)
-nonbuf : disable screen/logfile buffering (-nb)
-package style … : invoke package command (-pk)
-partition size1 size2 … : assign partition sizes (-p)
-plog basename : basename for partition logs (-pl)
-pscreen basename : basename for partition screens (-ps)
-restart2data rfile dfile … : convert restart to data file (-r2data)
-restart2dump rfile dgroup dstyle dfile …
: convert restart to dump file (-r2dump)
-reorder topology-specs : processor reordering (-r)
-screen none/filename : where to send screen output (-sc)
-skiprun : skip loops in run and minimize (-sr)
-suffix gpu/intel/opt/omp : style suffix to apply (-sf)
-var varname value : set index style variable (-v)

OS: Darwin 23.1.0 arm64

Compiler: Clang C++ Apple LLVM 15.0.0 (clang-1500.0.40.1) with OpenMP not enabled
C++ standard: C++11
MPI v3.1: Open MPI v5.0.0, package: Open MPI [email protected] Distribution, ident: 5.0.0, repo rev: v5.0.0, Oct 26, 2023

Accelerator configuration:

Active compile time flags:

-DLAMMPS_GZIP
-DLAMMPS_PNG
-DLAMMPS_JPEG
-DLAMMPS_FFMPEG
-DLAMMPS_SMALLBIG
sizeof(smallint): 32-bit
sizeof(imageint): 32-bit
sizeof(tagint): 32-bit
sizeof(bigint): 64-bit

Available compression formats:

Extension: .gz Command: gzip
Extension: .bz2 Command: bzip2
Extension: .zst Command: zstd
Extension: .xz Command: xz
Extension: .lzma Command: xz
Extension: .lz4 Command: lz4

Installed packages:

List of individual style options included in this LAMMPS executable

  • Atom styles:

atomic body charge ellipsoid hybrid
line sphere tri

  • Integrate styles:

respa verlet

  • Minimize styles:

cg fire/old fire hftn quickmin
sd

  • Pair styles:

born buck buck/coul/cut coul/cut coul/debye
coul/dsf coul/wolf reax mesont/tpm hybrid
hybrid/overlay hybrid/scaled lj/cut lj/cut/coul/cut lj/expand
morse soft table yukawa zbl
zero

  • Bond styles:

hybrid zero

  • Angle styles:

hybrid zero

  • Dihedral styles:

hybrid zero

  • Improper styles:

hybrid zero

  • KSpace styles:

  • Fix styles

adapt addforce ave/atom ave/chunk ave/correlate
ave/grid ave/histo ave/histo/weight ave/time
aveforce balance box/relax deform deposit
ave/spatial ave/spatial/sphere lb/pc
lb/rigid/pc/sphere client/md dt/reset efield
enforce2d evaporate external gravity halt
heat indent langevin lineforce momentum
move nph nph/sphere npt npt/sphere
nve nve/limit nve/noforce nve/sphere nvt
nvt/sllod nvt/sphere pair planeforce press/berendsen
print property/atom recenter restrain setforce
spring spring/chunk spring/self store/force store/state
temp/berendsen temp/rescale thermal/conductivity vector
viscous wall/harmonic wall/lj1043 wall/lj126 wall/lj93
wall/morse wall/reflect wall/region wall/table

  • Compute styles:

aggregate/atom angle angle/local angmom/chunk bond
bond/local centro/atom centroid/stress/atom chunk/atom
chunk/spread/atom cluster/atom cna/atom com
com/chunk coord/atom count/type mesont dihedral
dihedral/local dipole dipole/chunk displace/atom erotate/sphere
erotate/sphere/atom fragment/atom global/atom group/group
gyration gyration/chunk heat/flux improper improper/local
inertia/chunk ke ke/atom msd msd/chunk
omega/chunk orientorder/atom pair pair/local
pe pe/atom pressure property/atom property/chunk
property/grid property/local rdf reduce reduce/chunk
reduce/region slice stress/atom temp temp/chunk
temp/com temp/deform temp/partial temp/profile temp/ramp
temp/region temp/sphere torque/chunk vacf vcm/chunk

  • Region styles:

block cone cylinder ellipsoid intersect
plane prism sphere union

  • Dump styles:

atom cfg custom grid grid/vtk
image local movie xyz

  • Command styles

angle_write balance change_box create_atoms create_bonds
create_box delete_atoms delete_bonds box kim_init
kim_interactions kim_param kim_property kim_query
reset_ids reset_atom_ids reset_mol_ids message server
dihedral_write displace_atoms info minimize read_data
read_dump read_restart replicate rerun run
set velocity write_coeff write_data write_dump
write_restart

If you look at this line, you have no installed packages. You need to include them before compiling LAMMPS (be it with make or with cmake).

Thank you! I found that if I make a completely new build, and use

mkdir build; cd build # create and use a build directory
cmake …/cmake -D PKG_BODY=on . # configuration reading CMake scripts from …/cmake
cmake --build -D PKG_BODY=on .

it works.

1 Like