[lammps-users] Number of atoms and complex shapes


I am new user of LAMMPS. My question is:

How do you calculate the number of atoms present in a given box or a circle ? For instance, is there a way to calculate the number of atoms in a 20nm Circle? How can i model a complex shape in LAMMPS?

Thanks in advance,



The following URL:



"LAMMPS is designed to be a fast, parallel engine for
molecular dynamics (MD) simulations. As such, LAMMPS
itself provides only a modest amount of functionality
for setting up simulations and analyzing their

I'd recommend doing processes like counting atoms
within a given geometry outside of LAMMPS. You can
tell LAMMPS to dump atomic positions, see:


Then write a pizza.py script,


or your own post-processing code to count how many
atoms are within a 20 nm circle, or whatever geometry
you want.

Similarly, if you want to model a complex shape, it is
best to build the structure using your own pizza.py or
other script, code, or program. Then import it into
LAMMPS and run the MD simulation.


--- Medha Dakshina Murthy peri <[email protected]>

I'd only add that using the region command in its various
flavors you can create reasonably complex geometries,
then fill them with atoms on a lattice using the create_atoms
command. In particular, see the side in/out options for region
and also the union and intersect styles. Also, it's pretty
easy to add a new style, like "murthy-shape" to region, so
long as you can define whether a point x,y,z is inside or
outside it ...