Too many groups?

Dear Lammps users.

I’m trying to run a simulation of n copies of a protein with two rigid bodies. I noticed that when I use a high n (90, so 180 groups) the scripts stops running as I define the two groups (as group RB1 id xx:yy ww:zz…). I know the error comes from there because deleting a bunch of the xx:yy makes the input script working, but I’m not getting any log message/error message, the system just produces a blank input and doesn’t run.

Any ideas on what’s the actual problem or how to fix it?

Thanks!

You could begin by sharing a working example of your script, and even better if you remove all unnecessary commands to make it as easy as possible to read and understand.

What do you use the groups for? There is probably a different way to the same thing without using groups.
The number of groups is limited to 32.
https://docs.lammps.org/group.html

Hi! I cannot upload the script, and it’s too big to paste it, so I removed all the charges, bonds and pair info for the example

This is now a non-working script, but removing just a bunch of elements (i.e. the following string “28678:28727 29038:29087 29398:29447 29758:29807 30118:30167 30478:30527 30838:30887 31198:31247 31558:31607 31918:31967 32278:32327”) makes it run

units       real
dimension   3
boundary    p p p
atom_style  full

bond_style  harmonic
dielectric  80.0

#read_data conf_final_kk
read_restart kkconf



group CD1 id 138:224 498:584 858:944 1218:1304 1578:1664 1938:2024 2298:2384 2658:2744 3018:3104 3378:3464 3738:3824 4098:4184 4458:4544 4818:4904 5178:5264 5538:5624 5898:5984 6258:6344 6618:6704 6978:7064 7338:7424 7698:7784 8058:8144 8418:8504 8778:8864 9138:9224 9498:9584 9858:9944 10218:10304 10578:10664 10938:11024 11298:11384 11658:11744 12018:12104 12378:12464 12738:12824 13098:13184 13458:13544 13818:13904 14178:14264 14538:14624 14898:14984 15258:15344 15618:15704 15978:16064 16338:16424 16698:16784 17058:17144 17418:17504 17778:17864 18138:18224 18498:18584 18858:18944 19218:19304 19578:19664 19938:20024 20298:20384 20658:20744 21018:21104 21378:21464 21738:21824 22098:22184 22458:22544 22818:22904 23178:23264 23538:23624 23898:23984 24258:24344 24618:24704 24978:25064 25338:25424 25698:25784 26058:26144 26418:26504 26778:26864 27138:27224 27498:27584 27858:27944 28218:28304 28578:28664 28938:29024 29298:29384 29658:29744 30018:30104 30378:30464 30738:30824 31098:31184 31458:31544 31818:31904 32178:32264


group CD2 id 238:287 598:647 958:1007 1318:1367 1678:1727 2038:2087 2398:2447 2758:2807 3118:3167 3478:3527 3838:3887 4198:4247 4558:4607 4918:4967 5278:5327 5638:5687 5998:6047 6358:6407 6718:6767 7078:7127 7438:7487 7798:7847 8158:8207 8518:8567 8878:8927 9238:9287 9598:9647 9958:10007 10318:10367 10678:10727 11038:11087 11398:11447 11758:11807 12118:12167 12478:12527 12838:12887 13198:13247 13558:13607 13918:13967 14278:14327 14638:14687 14998:15047 15358:15407 15718:15767 16078:16127 16438:16487 16798:16847 17158:17207 17518:17567 17878:17927 18238:18287 18598:18647 18958:19007 19318:19367 19678:19727 20038:20087 20398:20447 20758:20807 21118:21167 21478:21527 21838:21887 22198:22247 22558:22607 22918:22967 23278:23327 23638:23687 23998:24047 24358:24407 24718:24767 25078:25127 25438:25487 25798:25847 26158:26207 26518:26567 26878:26927 27238:27287 27598:27647 27958:28007 28318:28367 28678:28727 29038:29087 29398:29447 29758:29807 30118:30167 30478:30527 30838:30887 31198:31247 31558:31607 31918:31967 32278:32327


group     nonrigid subtract all CD1 CD2


special_bonds fene
neighbor  3.5 multi




neigh_modify  exclude molecule/intra CD1 
neigh_modify  exclude molecule/intra CD2
neigh_modify  every 10 delay 0

comm_style    tiled
timestep      0.10



velocity      nonrigid create 310 594211

fix           fxnve   nonrigid nve
fix           fxnverigid1 CD1 rigid/nvt molecule temp 310 310 5000.0
fix           fxnverigid2 CD2 rigid/nvt molecule temp 310 310 5000.0
fix           fxlange nonrigid langevin               310 310 5000.0 32784

fix           fxbal  all balance 1000 1.05 rcb

compute densidad all chunk/atom bin/1d z lower 1
fix 3 all ave/chunk 500000 1 500000 densidad density/mass file density.profile

dump          1 all custom 100000 result.lammpstrj id mol type q xu yu zu 
dump_modify   1 sort id


thermo        10
thermo_style  custom step pe temp press ke lx ly lz pzz  spcpu density 
thermo_modify flush yes

write_data conf_final_kk

restart      10000 restart.tmp


run  60000

I’m defining only 3 groups (+ all which I use to define a group so not sure if that counts as 1). The problem comes from the number of elements inside the group, for which I couldn’t find any information about the limit.

As I said, putting less atoms in the group makes the script run again.

You can see a short example on my other reply

What is your LAMMMPS version and what platform are you running on?
There is no problem for me to run your input with the current development version (after replacing the read_restart command with some commands to create a box and a sufficient number of atoms).

I don’t understand your fix rigid commands. You are using both groups and molecule IDs to define rigid bodies. That is redundant and a single fix rigid command should do, either based on the group or the molecule IDs, and is much more efficient since fix rigid requires collective operations.
If based on molecule ID, you may want to use fix rigid/small instead. Please see the documentation for fix rigid for a detailed discussion.

I’m running 29Sept2021, with Intel-MPI. I will try with the new developmental versions.

Regarding the groups, I use them to easily define the non-rigid, on which I run the nve (and an NVT on the rigid bodies). I will look up fix rigid and try to come up with a more elegant solution.

That version works for me as well.

What is your exact command line?

mpirun -ppn $mpi_tasks_per_node -np $np /home/jh2366/lammps-29Sep2021/src/lmp_mpi < lammps.in > log.out

You can always upload your files to some website (Dropbox, Google Drive, MS One Drive, etc.) and provide a link.

Please also note that inputs using restart files are difficult to test/debug since restarts are platform and version specific because they are binary files.

Try to not use I/O redirection but the “-in” flag to read your input.

The support for I/O redirection is a legacy feature inherited from the time when LAMMPS was written in Fortran (which at that time didn’t have a portable way of determining command line flags). It should have been removed a long time ago, since it needlessly complicates the code and causes all kinds of problems. Particularly with MPI this is rather nasty because the MPI library needs to replicate the stdin stream to all MPI ranks, which may sometimes be limited by buffer sizes. When reading from a file, there is no such issue since the file will be opened and read on every MPI rank locally.

You also may be suffering from a case of “premature optimization”, have you verified that recursive bisectioning and multi-cutoff neighboring (how different are your cutoffs?) and communication are actually beneficial. It is particularly strange to see those in combination with using fix rigid multiple times, which does print a warning in that case because it does affect parallelization negatively.

It was exactly that! Running it with the -in instead works. I assume it overloads the system because of what you mention. Good to know because I just recently moved to Lammps from NAMD, and I didn’t know it was a legacy way of writing.

Thanks for your time!

It is mentioned in the documentation: 4.1. Basics of running LAMMPS — LAMMPS documentation

1 Like

One simple way to create groups based on indices could be to use gromacs-style index files: group2ndx command — LAMMPS documentation
This feature was originally conceived for use with the colvars library but is generic.