Radial Distribution Function Calculator

Analyze local structure in liquids and soft matter. Turn binned neighbor counts into g(r) curves. Choose units, validate inputs, and export results easily today.

Calculator
Single-bin for quick checks, or multi-bin for a full curve.

Used to compute number density ρ = N / V.
Example: 1e-24 m³ is a ~10 nm cube.
Converted internally to m³.
Single-bin inputs
Center of the radial bin.
Thickness of the spherical shell.
Converted internally to meters.
Average count per reference particle in that shell.
Formula used

The radial distribution function g(r) compares the observed neighbor count in a spherical shell to the count expected for a uniform (ideal) distribution:

ρ = N / V
Shell volume = 4π r² Δr
Expected count = ρ · 4π r² Δr
g(r) = n(r) / (ρ · 4π r² Δr)

Here n(r) is the average number of neighbors per reference particle within the shell centered at r with thickness Δr.

How to use this calculator
  1. Enter N and the system volume V.
  2. Select Single-bin for one radius, or Multi-bin for a curve.
  3. Provide r, Δr, and the measured n(r).
  4. Press Submit to compute density, expected count, and g(r).
  5. Use Download CSV or Download PDF for sharing.
Example data table

Illustrative values for a nano-scale simulation box. Use “Load example” to autofill.

NV (m³)Δr (nm)r (nm)n(r)Expectedg(r)
1000 1e-24 0.1 1.0 0.95 ~1.2566 ~0.7563
1000 1e-24 0.1 1.5 1.23 ~2.8274 ~0.4351
1000 1e-24 0.1 2.0 1.05 ~5.0265 ~0.2089

Radial distribution function overview

The radial distribution function, g(r), is a core descriptor of microscopic structure in gases, liquids, colloids, polymers, and soft solids. It measures how particle density varies with distance from a reference particle, relative to an ideal uniform system at the same number density. In experiments, g(r) is often inferred from scattering data, while in simulations it is computed directly by counting neighbors in spherical shells.

What g(r) values mean

A value g(r)=1 indicates no spatial correlation at distance r. Values above 1 represent enhanced probability of finding a neighbor (local ordering), and values below 1 represent depletion. For many simple liquids, g(r) rises from near zero at small r (excluded volume), reaches a strong first peak, then decays toward 1 as r increases.

Typical peak locations and shells

Peaks correspond to coordination shells. For a dense Lennard-Jones–like liquid, a first peak often appears near one particle diameter, while the second peak may sit around twice that distance. The spacing between peaks reflects short‑range packing, and peak heights increase as temperature decreases or density increases.

Number density and normalization

This calculator uses number density ρ = N/V to normalize raw neighbor counts. The expected count in a shell of thickness Δr at radius r is ρ·4πr²Δr. Dividing the observed average count n(r) by this expectation yields g(r), which is dimensionless and comparable across units once N and V are consistent.

Choosing bin width Δr

Smaller Δr improves resolution of sharp peaks but increases noise because fewer pairs contribute per bin. Larger Δr smooths the curve and can hide fine structure. A practical strategy is to start with Δr ≈ 1–5% of the dominant structural length scale (for example, particle diameter), then refine based on statistical stability.

Finite size and cutoffs

In periodic simulations, meaningful r values typically stay below half the smallest box length to reduce artifacts. At large r, limited sampling and boundary effects can cause drift from g(r)→1. Increasing system size, averaging over more frames, and verifying convergence helps produce reliable long‑range behavior.

From g(r) to coordination number

A common derived metric is the coordination number up to a cutoff rc, computed as 4πρ∫0rc g(r) r² dr. Selecting rc at the first minimum after the initial peak estimates the average number of nearest neighbors. Use the multi‑bin output as a starting point for numerical integration in analysis tools.

Interpreting results in practice

Compare curves across conditions: higher density often shifts peaks inward and raises their heights, while higher temperature broadens peaks and reduces ordering. If your curve never approaches 1, revisit density, units, and how n(r) was averaged. Consistent units, sufficient sampling, and a sensible Δr are the main levers for trustworthy g(r) estimates.

FAQs

1) What is the minimum input I need?

You need particle count N, system volume V, a radius r, a bin width Δr, and the measured average neighbor count n(r). The calculator converts units and returns g(r) plus intermediate values.

2) Why does g(r) start near zero at small r?

Most particles cannot overlap, so the probability of finding another particle very close to a reference one is low. This excluded‑volume effect drives g(r) toward zero at sufficiently small distances.

3) What does it mean if g(r) stays above 1 at large r?

It can indicate finite-size artifacts, insufficient averaging, or an incorrect density normalization. Increase sampling, verify V and units, and keep r below half the smallest box length for periodic systems.

4) Should I use single-bin or multi-bin mode?

Use single-bin mode to sanity-check one shell quickly. Use multi-bin mode to compute a table across many radii for plotting a full g(r) curve and for downstream analysis like coordination numbers.

5) How do I pick a good Δr value?

Choose Δr small enough to resolve peaks but large enough to reduce noise. A common starting point is 1–5% of the characteristic particle spacing or diameter, then adjust based on smoothness and stability.

6) Can I compare results across different unit choices?

Yes. g(r) is dimensionless. As long as N, V, r, and Δr are internally consistent, converting units will not change g(r). Differences usually come from inconsistent inputs, not unit selection.

7) Does this calculator compute g(r) from raw coordinates?

No. It converts binned neighbor counts into normalized g(r). Compute n(r) from coordinates using your simulation or analysis tool, then paste the bins here to normalize, export, and report results.

Related Calculators

Boltzmann factor calculatorPartition function calculatorCanonical ensemble calculatorGrand canonical calculatorMicrocanonical entropy calculatorChemical potential calculatorInternal energy calculatorThermal wavelength calculatorMaxwell Boltzmann speedMean speed calculator

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.