# Average of x,y,z

Dear Lammps users ,

I do annealing NVT simulation and I want to calculate the average x y z of a part of my system .

Can you please let me know how I can do that ?

Best,
Saeed.

What is average x y.z ??

Steve

Dear Steve ,

Let’s imagine in NVT simulation we have two clusters from two different molecules .
Now I want to calculate one of these clusters density , How can i do that ?

Best,
Saeed.

Density is complicated because you have to define for yourself what the edge of a cluster is. Once you have that you can simply count the molecules in the clusters and divide that by the cluster volume/area.

Dear Stefan,

you mean if i want to calculate the density of a part of my system in NVT i have to define the edge of that part and then count the molecules.
But How can i define it ? by “variable” and “group” command ?

No, I mean that you have to come up with some idea of what constitutes the edge, physics-wise. That is the real difficulty. Once you have that, you can start thinking of ways to have LAMMPS calculate the density from that information.

Since this sounds like a question about post-processing simulation data I would suggest starting here: https://link.springer.com/article/10.1007%2Fs11837-013-0827-5 Many of these tools described are available in OVITO (ovito.org) . Specifically, try this:

-Load LAMMPS Data/Dump file

-Use expression select to look at one molecule type

-Construct surface mesh around those molecules

-Use the calculated volume of the enclosed space by the mesh to calculate density

This works by using a probe ‘atom’ of some user defined radius to define a surface plaquette. Then move the probe ‘atom’ around until the space is enclosed. For more details check out the linked paper.

-Mitch

No, I mean that you have to come up with some idea of what constitutes the
edge, physics-wise. That is the real difficulty. Once you have that, you
can start thinking of ways to have LAMMPS calculate the density from that
information.

​technically speaking the "volume" of a nano particles is an ill defined
property. at the length scale, you can tell the difference between atom
cores (points) and electrons (almost nothing), so that ​you have to make
some estimate of the volume/radius of individual atoms. all of these have
adjustable parameters which in turn may cause significant errors, if chosen
badly; some also have systematic errors, too.

​there are several possible approaches:
- the VMD volmap tool has an occupancy mode.​ that is, it generates a 3-d
grid of voxels, and then loops over all atoms and flags all voxels within a
given radius form each atom as occupied. the sum of the voxels is the
volume. this is particularly effective for large objects and unusually
shaped objects with possibly enclosed vacuums or other complications.
- there are also in VMD interfaces to programs called SURF or MSMS, which
are meant to measure the surface area of proteins and use a "probe" to
determine the surface area (and implicitly also the volume). it may be
possible to tweak the settings for other setups.
- for nanoparticles that are solid and cut from a lattice, it may be
sufficient to determine the "lattice constant" of the inner atoms and
compare this to a bulk system (where the density is known)
- www.qhull.org is a flexible tool for determining enclosing surfaces and
volumes through triangulation.
- compute voronoi/atom can be used if the clusters/nanoparticles are in a
homogeneous solvent, so that the voronoi cells on the surface have
meaningful volumes

regardless of these, one always has to consider the errors incurred from
the approximations in those various approaches and thus not over-interpret
the results. as mentioned before, you simply cannot treat nanoscale objects
like macroscopic objects, as volume is ill defined at this length scale.

axel.

Dear all,