Strcutural Analysis

In this tutorial, a PyGran System class is created from a LIGGGHTS trajectory dump file. This class is then used to plot different spatial/structural variables.

In [12]:
# Import PyGran + matplotlib modules
from PyGran import analysis
import matplotlib.pylab as plt

# Create a granular object from a LIGGGHTS dump file
Sys = analysis.System(Particles='traj*.dump')
Out[12]:

Radial distribution function (RDF)

The code below constructs the RDF for the last frame in the system and then plots its using pylab.

In [13]:
# Go to last frame
Sys.goto(-1)

# change unit system to micro
Sys.units('micro')

# Compute the radial distribution function
g, r, _ = Sys.Particles.rdf()

# Plot rdf vs radial distance
plt.plot(r, g, 'o-')
Constructing a cube of length 1579.55825864 and a circumscribed sphere of radius 394.889564659
Resolution chosen is 3.94889564659

Overlap Analysis

The code below constructs a histogram of all the particle-particle overlaps for the last frame in the system.

In [14]:
# Construct a class for nearest neighbor searching
Neigh = analysis.equilibrium.Neighbors(Sys.Particles)

# Extract coordination number for all particles
coon = Neigh.coon()

# Construct + plot histogram of coon over 10 bins
plt.hist(coon)
In [30]:
# Extract the overlaps for all particles
overlaps = Neigh.overlaps[:,0]

# Compute mean radius
radius = Sys.Particles.radius.mean()

# Construct + plot histogram of overlaps over 20 bins
plt.hist(overlaps / radius * 100, bins=20)