Skip to content
Lars Pastewka edited this page Oct 22, 2015 · 1 revision

Welcome to the matscipy wiki! This page currently contains random code examples.

Radial distribution function
import numpy as np
from matscipy.neighbours import neighbour_list
rdf_cutoff = 5.0
rdf_nbins = 100

# Compute neighbor list and histogram of distances
r = neighbour_list('d', a, cutoff=rdf_cutoff)
rdf, bin_edges = np.histogram(r, bins=rdf_nbins, range=(0, rdf_cutoff))

# Normalize by bin volume and total number of atoms
rdf = rdf / (len(a) * 4*pi/3 * (bin_edges[1:]**3-bin_edges[:-1]**3))

# Normalize by density
rdf /= len(a)/a.get_volume()
bin_centers = (bin_edges[1:]+bin_edges[:-1])/2

# RDF is no win bin_centers, rdf
pylab.plot(bin_centers, rdf)
Clone this wiki locally