Error with polydisperse spheres using lubricate/poly

Hi everyone,

I’m new with LAMMPS so please bear with me.

As part of my master thesis, I’m trying to model the addition of particles into a fluid and deform it with a shear force.
I have created 8 different particles with atom_style sphere inside a cubic boundary, then the output is saved in a file and read by another script which specifies the particle interactions and stress forces. I want to include a pair_style lubricate/poly in the calculation but I get the following error:

ERROR: Pair lubricate requires monodisperse particles (src/COLLOID/pair_lubricate.cpp:548)

According to the LAMMPS documentations on pair_style lubricate:

Style lubricate requires monodisperse spherical particles; style lubricate/poly allows for polydisperse spherical particles.

Since my particles are defined as spheres and I’m using lubricate/poly so I can use multiple particles I don’t understand why I’m getting that error. If I only leave one particle the program runs correctly, so it does not seem to be a problem with my particle definition.

I appreciate any help or advice you can give me.

Thank you!

EDIT: The LAMMPS version I’m using is from March 3 2020 running on Linux (Ubuntu 20.04)
Here is a simplified version of my two files (first I run file 1 and then file 2) with randomized values for confidentiality, (though this part is mostly based on the code from the published paper " Simulating dense non-Brownian suspension rheology using LAMMPS" by Christopher Ness, [2108.04606] Simulating dense non-Brownian suspension rheology using LAMMPS)

# file 1
# SETTINGS
units micro
atom_style sphere
comm_modify mode single vel yes
# GENERATE A CUBIC, PERIODIC SIMULATION BOX
boundary p p p
region reg prism 0 1000 0 1000 0 1000 0 0 0 units box
create_box 4 reg
# GENERATE THE PARTICLES AND SPECIFY THEIR SIZE
create_atoms 1 random 10 123456 NULL
create_atoms 2 random 20 123457 NULL
create_atoms 3 random 30 123458 NULL
create_atoms 4 random 40 123459 NULL

set type 1 diameter 1
set type 2 diameter 2
set type 3 diameter 3
set type 4 diameter 4

set type 1 density 13
set type 2 density 13
set type 3 density 13
set type 4 density 13

# SPECIFY THE PARTICLE-PARTICLE INTERACTION
pair_style granular
pair_coeff * * hooke 10000 0 tangential linear_history 7000 0 0.1
# SPECIFY THE OUTPUTS
thermo 10000
dump id all custom 10000 create.dump id x y z radius
log create.log
# SPECIFY THE TIMESTEP, THE INTEGRATION SCHEME AND RUN
timestep 0.0001
fix 1 all nve/sphere
fix 2 all viscous 1.88 scale 2 2 scale 3 3 scale 4 4 
run 1000000
# WRITE AN OUTPUT FILE
write_data data.file


# file 2
# SETTINGS
units micro
atom_style sphere
comm_modify mode single vel yes
newton off
# READ THE PARTICLE CONFIGURATION
read_data data.file
# SPECIFY THE PARTICLE-PARTICLE INTERACTION
pair_style hybrid/overlay granular lubricate/poly 0.1 1 1 0.001 0.05 1 0
pair_coeff * * granular hooke 10000 0 tangential linear_history 7000 0 0.1
pair_coeff * * lubricate/poly
# pair_coeff * * lubricate/poly 
# DO THE STRESS CALC
compute Temp all temp/profile 1 1 1 xyz 10 10 10
compute str all pressure Temp
# SPECIFY THE OUTPUTS
thermo_style custom time c_str[1] c_str[2] c_str[3] c_str[4] c_str[5] c_str[6]
thermo 10000
thermo_modify format line "%.0f %12.4e %12.4e %12.4e %12.4e %12.4e %12.4e"
dump id all custom 10000 run.dump id x y z radius
log run.log
# SPECIFY THE TIMESTEP, THE INTEGRATION SCHEME AND RUN
timestep 0.0001
fix 1 all nve/sphere
fix 2 all deform 1 xy erate 0.1 remap v
run 3000000

a) please always report your LAMMPS version and platform that you are running on.
b) please provide a minimal input example to reproduce the issue.

Please note that this error message is only possible when using pair style lubricate and not pair style lubricate/poly. So it looks as if LAMMPS is behaving exactly as documented.

Hi,
Thank you for your response!
I have updated my original post to include the version and input information you suggested.
As for the pair style lubricate, in my script I’m using lubricate/poly so I don’t understand why LAMMPS is doing the calculation only with lubricate. Is there any other command I should be adding so lubricate/poly is used? Or maybe a specific package?

Thank you very much for your time

Kind regards

It looks more like your version of LAMMPS has a bug that was since fixed. I can run the second input without an error. Here is the beginning of the output

LAMMPS (24 Mar 2022)
  using 1 OpenMP thread(s) per MPI task
Reading data file ...
  triclinic box = (0 0 0) to (1000 1000 1000) with tilt (0 0 0)
  1 by 1 by 1 MPI processor grid
  reading atoms ...
  100 atoms
  reading velocities ...
  100 velocities
  read_data CPU = 0.001 seconds
  generated 0 of 6 mixed pair_coeff terms from geometric mixing rule
Neighbor list info ...
  update every 1 steps, delay 10 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 4.1
  ghost atom cutoff = 4.1
  binsize = 2.05, bins = 488 488 488
  2 neighbor lists, perpetual/occasional/extra = 2 0 0
  (1) pair granular, perpetual
      attributes: half, newton off, size, history
      pair build: half/size/bin/newtoff
      stencil: full/bin/3d
      bin: standard
  (2) pair lubricate/poly, perpetual
      attributes: full, newton off
      pair build: full/bin/atomonly
      stencil: full/bin/3d
      bin: standard
Setting up Verlet run ...
  Unit style    : micro
  Current step  : 0
  Time step     : 0.0001
Per MPI rank memory allocation (min/avg/max) = 469 | 469 | 469 Mbytes
     Time         c_str[1]       c_str[2]       c_str[3]       c_str[4]       c_str[5]       c_str[6]   
0   0.0000e+00   0.0000e+00   0.0000e+00  -4.6338e-08   0.0000e+00   0.0000e+00
1   1.3972e-09   0.0000e+00   0.0000e+00  -4.6338e-08   0.0000e+00   0.0000e+00

Hi,
Thank you for the response!
I have tried updating my version of LAMMPS to the one from 24 March 2022, both on windows and Linux, and I still get the same error. Could you please point me to your exact version (whether on windows or linux, if it is mac I’m afraid I won’t be able to reproduce it), and maybe the packages, in case it has some influence?
Thanks again.
Kind regards

As I already mentioned, it is not possible with a recent version of LAMMPS (platform doesn’t matter) to get this error message when using the lubricate/poly pair style.
You must be using a different input file (perhaps in a different folder) than what you posted here.

Hi,

Well, I am uninstalled the version of LAMMPS I was using and intsalled the one from the 24th of Mars 2022 and I am using the exact same input files I said in my original message. Could the way I am launching LAMMPS be the root of the problem? I am using the following commands:

For the in.create (file1):
lmp -in in.create -pk omp 8 -sf omp
For the in.run2 (file2):
lmp -in in.run2 -pk omp 4 -sf omp

The in.create works well. The full console output of the in.run2 is the following.

LAMMPS (24 Mar 2022)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
  using 1 OpenMP thread(s) per MPI task
using multi-threaded neighbor list subroutines
set 4 OpenMP thread(s) per MPI task
using multi-threaded neighbor list subroutines
Reading data file ...
  triclinic box = (0 0 0) to (1000 1000 1000) with tilt (0 0 0)
  1 by 1 by 1 MPI processor grid
  reading atoms ...
  100 atoms
  reading velocities ...
  100 velocities
  read_data CPU = 0.006 seconds
ERROR: Pair lubricate requires monodisperse particles (src/COLLOID/pair_lubricate.cpp:549)
Last command: run 3000000

As you can see, the LAMMPS version is the most recent one, yet that error appears.

I’d truly appreciate any advice or input.

Kind regards,

1 Like

Yes, it is. The input will run without enabling the OPENMP package version.
You have found a very old bug in pair style lubricate/poly/omp that went undetected for almost 10 years.

You need to apply the following change:

  diff --git a/src/OPENMP/pair_lubricate_poly_omp.h b/src/OPENMP/pair_lubricate_poly_omp.h
  index 4b783784b4..d88a0f5630 100644
  --- a/src/OPENMP/pair_lubricate_poly_omp.h
  +++ b/src/OPENMP/pair_lubricate_poly_omp.h
  @@ -17,7 +17,7 @@
   
   #ifdef PAIR_CLASS
   // clang-format off
  -PairStyle(lubricate/poly/omp,PairLubricateOMP);
  +PairStyle(lubricate/poly/omp,PairLubricatePolyOMP);
   // clang-format on
   #else
   

and recompile or not use the OpenMP version.

The benefit of using OpenMP parallelization for pair styles like these is limited anyway and requires benchmarking. There is a good chance that your simulations will run faster without.

1 Like

Hi,
Thank you very much for your help!
It seems to be working without the Omp so now I can move on with my research :smile:
Thank you once again!
Kind regards