Cavity (or free) volume measurement in LAMMPS


I have a question for measuring cavity volume (or free volume) in the simulation cell.

I have been creating thermosetting polymer network using Lammps. After I created polymer network, I have seen few cavity volumes inside the polymer network. Those sizes may be various from few angstrom^3 to few tenth angstrom^3. I would like to measure cavity size distribution in the simulation cell size of 505050 angstrom^3.

Is it possible to measure the cavity size distribution or any other properties related to cavity sizes in the simulation cell? I guess that new feature of “compute voronoi/atom” could calculate this properties.

Are there any other possible ways to calculate these properties using Lammps?

Best regards,
Changwoon Jang

Cavities are not necessarily well defined in a collection of points in
3d space. The voronoi compute will effectively distribute the cavity
volume across the atoms along the cavity surface.
I've been thinking about vacancy detection using the voronoi compute
and one idea I had was cluster detection of atoms with voronoi volumes
larger than a given threshold. The combined voronoi volume of all
atoms in such clusters minus the threshold volume times the number of
atoms in the cluster could then be taken as the free volume or cavity

1 Like

I have not tried to calculate the volume of the cavities in a 3D polymer but I have worked on methods for finding the holes. I use the methods in Dock for finding potential docking sites. That is find the molecular surface - using Chimera or DMS - and then sphgen to generate a set of spheres which fill the holes. The radius of the hole can be set and in principle you could compute the volume, the problem would come with the space between the polymer and the simulation cell. I was more interested in filling the holes with solvent molecules as a method for building polymer models with embedded solvent.


Dear Gilbert, Daniel,

Thank you for all your comments. I am sure that there is a method to calculate cavity sizes or cavity distribution in a polymer matrix, but lack of knowledge blocks drawing some results.

I found a possible program, VOIDOO package, to calculate some properties related to cavity. I need to figure out that it works for a lammps trajectory file.


Best regards,
Changwoon Jang


maybe psdsolv is worth looking into -
if you provide radii for your particles, this algorithm will compute (relatively fast) a pore size distribution of your system. i had quite good experiences with it and it’s not a big deal to convert a lammps data or dump file into a format suitable for psdsolv.

as for the voronoi tesselation, i think you’d have to tesselate not through the particles, but rather through centers in pores which may be a tricky to find. here something similar was done in 2d: . not sure how transferrable this is to 3d, though.


I would second Nikita's comments on psdsolv. It is a very nice,fast program for finding pore sizes and distributions and it is easy to modify for a variety of input file formats.

Something else to consider is what you really mean by "volume" - just the empty space or the space a solvent molecule can access. The Connolly methods can analytically compute the surface area and volume by rolling a probe sphere around the surface of your molecule, but this raises the question about what you mean by volume because not all space not occupied by an atom of your molecule can be reached by a solvent molecule. If you can come to a decision about this and your system completely fills the simulation volume you could take the difference between the simulation volume and the connolly volume as the cavity space. Chimera includes Michael Sanner's routines for finding the surface and volume but I don't know if you get more than the picture/structure+surface output.

I have been looking at solvent swelling of cross-linked polymers and I found computing the volume of a specific instance of a polymer to be quite difficult conceptually. In the end I could look at the difference in volume of the minimum box that surrounded the polymer (after removing the solvent) as a function of solvent (Ar,EtOH,water, benzene or pyridine). It is surprisingly difficult to compute the volume of a molecule with "holes"


Dear Nikita and Kevin,

I tried to install PSDsolv but I could not. The error is like;

cc1plus: error: unrecognized command line option “-fast”

There is something wrong with my machine.

Instead, I found another program called AVP (Another Void Program). I installed this program and tested it. I think that it works fine now even if I need to play with it more to get accustomed.

AVP can basically set and change an user-defined grid size (default 1.00 unit dependent on a system) and can calculate the size of void voxels.

However, I would like to test PSDsolv program as well for comparing other programs, because someone has used this program with modified lammps dump and data files. That means this program is quite compatible with Lammps anyhow. I sent an email for the code developer.

Anyway, thank you for all your kind comments.

Best regards,
Changwoon Jang


as for the -fast option: just try to remove it in the makefile. it will depend on your compiler what commandline options it will be happy with.

and for the pore volume in general - yes, i guess this is a pretty tricky topic. in particular if you consider that a solvent could swell your polymer, which would alter the effective pore volume. so obviously one would have to know in what state the pore volume is to be computed.

so happy void analysis,


Dear All,

This problem has been solved based on many comments from others.

Thank you for your interest and help.

Best regards,
Changwoon Jang

    This problem has been solved based on many comments from others.

It would be a useful contribution to the list if you quickly wrote
what you ended up doing.

Dear Users,

I am summarizing what I have achieved for calculating pore (cavity) size distribution after running molecular dynamics simulation using Lammps.

There are several programs calculating this property. 1) VOIDOO, 2) AVP (another void program), and 2) PSDsolv, etc.

I have only tested AVP so far. It works fine for me. Nikita Aigner recommended PSDsolv. I guess that this program is also a possible good program. I have installed but not tested it yet.

I am trying to install VOIDOO, but the two program above mentioned might be enough for my system.

Someone also mentioned MSME program,

I hope this short summary of my experience help others.


C.W Jang