Creating a spherical void


I have asystem containing water molecules, and I would like to create some atoms in a spherical structure after creating a spherical void in the water molecules, I had earlier tried the delete_atoms and delete_bonds commands but I was unsuccesful.

Is there anyway to do this other than these commands ? Is it possible to use other packages like packmol and create the system?

Thanks and Regards,


What do you mean, unsuccessful? I think that using delete_atoms on a spherical region should work. Did you get an error message?


I'm guessing that the delete atoms command would cut most of the
molecules into fragments. He wants to throw away water molecules
who's center-of-mass (or oxygen atom, etc.) lie in a specific region.

Packmol can definitely generate the coordinates for this system, but
not the topology information. You would then need to load these
coordinates with topotools/VMD or moltemplate, and create a LAMMPS
data file (input file). If I'm not mistaken, Packmol currently
requires you to specify in advance the number of water molecules you
need (which you can estimate using volume & density arguments).

I'm curious to know how other people handle this problem (using VMD
and topotools) for example.


My mistake for not reading the doc page carefully.
It looks like you can delete entire molecules using the "delete_atoms":

"For style region, all atoms in the region volume are deleted.
Additional atoms can be deleted if they are in a molecule for which
one or more atoms were deleted within the region; see the mol keyword
discussion below. "

Deepak, did you try doing this? (Did you remember to assign a unique
molecule-id number to each water molecule?)
Sorry for not being helpful in my last postl.

Hi LAMMPS developers

In the manual the syntax for “fix gravity” is mentioned as: fix ID group gravity style magnitude args

But from the Examples, I think it should be as this one: fix ID group gravity magnitude style args

Am I right or I’m missing something?

You're right. Just an error in the 'syntax' line. In fact, the arguments are explained in the correct order. It's just that one line that's wrong.

hello lammps users and Steve

here is a minor bug report (typo in error message):
"delete_atoms" syntax errors are reported as an illegal "delete_bonds" commands:

Thanks for the email, I had tried the delete_atoms command, and I end up
with an error :
" ERROR: Illegal delete_bonds command (delete_atoms.cpp:358)"

----- end of delete_atoms.cpp -----

void DeleteAtoms::options(int narg, char **arg)
  compress_flag = 1;

  int iarg = 0;
  while (iarg < narg) {
    if (strcmp(arg[iarg],"compress") == 0) {
      if (iarg+2 > narg) error->all(FLERR,"Illegal delete_bonds command");
      if (strcmp(arg[iarg+1],"yes") == 0) compress_flag = 1;
      else if (strcmp(arg[iarg+1],"no") == 0) compress_flag = 0;
      else error->all(FLERR,"Illegal delete_bonds command");
      iarg += 2;
    } else error->all(FLERR,"Illegal delete_bonds command");


...Also, it looks like the DeleteAtoms::options() member function does
not accept "mol" as a keyword. (It only accepts "compress".) The
docs say either "compress" or "mol" are valid keywords. (Perhaps I am
looking at the wrong function?)

That would explain Deepak's problem.
Deepak, how are you invoking "delete_atoms"?
(Can you post the line from the input script where you are invoking
"delete atoms"?)



“region 2 sphere {xcenter} {ycenter} {zcenter} {radius} units box
region sphere sphere {xcenter} {ycenter} {zcenter} {radiusa} units box
group cntr region sphere
#delete_bonds group cntr
delete_atoms region sphere mol yes”

Here is the part of the input script.

Thanks and Regards,


Fixed it - thanks


The current version accepts both
keywords, in options(). And uses
the mol_flag setting to delete entire

If something is not working as per
the doc page, let us know.


Fixed the error messages - thanks


Dear Deepak

There was a recent change in the LAMMPS source code (since May) which
fixes your problem. Please download the newest version of LAMMPS and
try again.


If you are using windows binaries, the latest ones are here:

   Steve Plimpton wrote:
The current version accepts both
keywords, in options(). And uses
the mol_flag setting to delete entire

Oops. it looks like were were both using an older copy of the source
code. (My apologies.)