Structures and energetics

Molecular dynamics of liquid Al and the radial distribution function

Melt 108 Al atoms with a classical potential, equilibrate the liquid with AOF-DFT and a Langevin thermostat (NVT), and compute the radial distribution function g(r), with a guide to choosing the time step.

Category
Structures and energetics
APIs used
ase.md.langevin.Langevinase.calculators.emt.EMTMaxwellBoltzmannDistributionase.geometry.rdf.get_rdfTrajectorynoisy_precond
Script
liquid_md.py

The structure of liquids and amorphous materials is characterized by the radial distribution function g(r): the probability of finding another atom at a distance r from an atom, relative to a uniform distribution of the same density. Since g(r) is obtained from X-ray and neutron diffraction experiments, calculations can be compared directly with experiment.

This example extends First-principles molecular dynamics to compute g(r) of a liquid. The fcc crystal is melted by NVT molecular dynamics, with the temperature controlled by a Langevin thermostat, and g(r) is computed at 1000 K, slightly above the melting point (933 K).

Procedure

  1. expand a 108-atom cell of fcc Al to the density of the liquid (2.375 g/cm³)
  2. run 500 steps (2 ps) of molecular dynamics at 2000 K with the classical potential EMT, to melt the crystal
  3. lower the thermostat temperature to 1000 K and continue with EMT for 250 steps (1 ps)
  4. switch the calculator to Advance/OF-DFT (AOF-DFT) and equilibrate at 1000 K for 240 steps (0.96 ps)
  5. compute g(r) from the structures of the next 200 steps (0.80 ps) and average it
The stages of the calculation and the temperature. The blue line is the temperature of the thermostat and the orange line the instantaneous temperature of the system (the same run as in "Example output" below). EMT is used up to 3 ps and AOF-DFT afterwards.
The stages of the calculation and the temperature. The blue line is the temperature of the thermostat and the orange line the instantaneous temperature of the system (the same run as in "Example output" below). EMT is used up to 3 ps and AOF-DFT afterwards.

Melting a defect-free crystal by uniform heating takes a few ps even well above the melting point. In this example the melting and cooling stages use 750 steps, more than the AOF-DFT calculation that gives g(r) (440 steps).

The crystal is therefore melted with EMT, a computationally cheap classical potential built into ASE. The EMT liquid differs slightly from the AOF-DFT liquid, so the structure is equilibrated with AOF-DFT after the switch, before g(r) is computed.

The temperature is controlled with a Langevin thermostat, as one possible choice. It keeps the temperature by adding a friction force and a random force to every atom. The temperature approaches the target quickly even when the system is far from equilibrium, as in the melting stage and right after the switch from EMT to AOF-DFT. Other thermostats are mentioned in the Notes.

liquid_md.pyDownload
"""
Advance/OF-DFT example: molecular dynamics of liquid Al with a Langevin
thermostat (NVT) and its radial distribution function g(r).

The crystal is first melted with a cheap classical potential (EMT of ASE). The
liquid is then equilibrated with AOF-DFT at the target temperature, and g(r) is
averaged over the last part of the trajectory.

Copyright (C) 2026 AdvanceSoft Corporation, All rights reserved.
"""

import time

import matplotlib.pyplot as plt
import numpy as np
from ase import units
from ase.build import bulk
from ase.calculators.emt import EMT
from ase.constraints import FixCom
from ase.geometry.rdf import get_rdf
from ase.io import read
from ase.io.trajectory import Trajectory
from ase.md.langevin import Langevin
from ase.md.velocitydistribution import MaxwellBoltzmannDistribution, Stationary

from aofdft.calculator import AOFDFTCalculator

VPS_DIR = "path/to/DFT_DATA19_AS/VPS"  # edit these two paths for your environment
PAO_DIR = "path/to/DFT_DATA19_AS/PAO"

DENSITY  = 2.375  # density of liquid Al near the melting point (g/cm^3)
T_MELT   = 2000   # melting stage (K)
T_TARGET = 1000   # target temperature (K); melting point of Al = 933 K
DT       = 4.0    # time step (fs)
N_MELT   = 500    # EMT:     MD steps at T_MELT   (2 ps)
N_COOL   = 250    # EMT:     MD steps at T_TARGET (1 ps)
N_EQUIL  = 240    # AOF-DFT: MD steps at T_TARGET, not used for g(r)
N_SAMPLE = 200    # AOF-DFT: MD steps at T_TARGET, used for g(r)
INTERVAL = 2      # the trajectory is written every INTERVAL steps
FRICTION = 0.02 / units.fs

rng = np.random.default_rng(1)  # fixed random numbers, to make the run reproducible

# 3x3x3 conventional fcc cells = 108 atoms, scaled to the liquid density
atoms = bulk("Al", "fcc", a=4.05, cubic=True).repeat((3, 3, 3))
volume = atoms.get_masses().sum() / units.mol / DENSITY * 1e24  # Angstrom^3
atoms.set_cell(atoms.cell * (volume / atoms.get_volume()) ** (1 / 3), scale_atoms=True)
atoms.set_constraint(FixCom())  # keeps the centre of mass at rest during the MD
print(f"{len(atoms)} atoms, cell = {atoms.cell[0, 0]:.3f} Angstrom", flush=True)


def msd(reference):
    """Mean square displacement from the reference positions (Angstrom^2)."""
    return ((atoms.get_positions() - reference) ** 2).sum(axis=1).mean()


# 1) melt the crystal with EMT, then cool the liquid down to the target temperature
atoms.calc = EMT()
MaxwellBoltzmannDistribution(atoms, temperature_K=T_MELT, rng=rng)
Stationary(atoms)
dyn = Langevin(atoms, timestep=DT * units.fs, temperature_K=T_MELT, friction=FRICTION,
               fixcm=False, rng=rng)
start = atoms.get_positions()
dyn.run(N_MELT)
dyn.set_temperature(temperature_K=T_TARGET)
dyn.run(N_COOL)
print(f"EMT:     {(N_MELT + N_COOL) * DT / 1000:.2f} ps, T = {atoms.get_temperature():.0f} K, "
      f"mean square displacement = {msd(start):.1f} Angstrom^2", flush=True)

# 2) switch to AOF-DFT: equilibration and sampling at the target temperature
atoms.calc = AOFDFTCalculator(
    console      = False,
    logging_file = "al_liquid.log",
    kin_type     = "AS26",
    kin_model    = "Crystal26",
    vps_dir      = VPS_DIR,
    pao_dir      = PAO_DIR,
)

dyn  = Langevin(atoms, timestep=DT * units.fs, temperature_K=T_TARGET, friction=FRICTION,
                fixcm=False, rng=rng)
traj = Trajectory("al_liquid.traj", "w", atoms)
dyn.attach(traj.write, interval=INTERVAL)

t0 = time.perf_counter()


def report():
    e_pot = atoms.get_potential_energy() / len(atoms)
    print(f"step {dyn.nsteps:4d}  T = {atoms.get_temperature():7.1f} K  "
          f"E_pot = {e_pot:.4f} eV/atom  ({time.perf_counter() - t0:6.0f} s)", flush=True)


dyn.attach(report, interval=10)
start = atoms.get_positions()
dyn.run(N_EQUIL + N_SAMPLE)
traj.close()
print(f"AOF-DFT: {(N_EQUIL + N_SAMPLE) * DT / 1000:.2f} ps, T = {atoms.get_temperature():.0f} K, "
      f"mean square displacement = {msd(start):.1f} Angstrom^2", flush=True)

# 3) g(r) from the trajectory, without the equilibration part
R_MAX, N_BINS = 6.0, 120
frames = read("al_liquid.traj", index=f"{N_EQUIL // INTERVAL + 1}:")
rdfs   = [get_rdf(frame, R_MAX, N_BINS) for frame in frames]
g_r    = np.mean([rdf for rdf, _ in rdfs], axis=0)
r      = rdfs[0][1]
i_peak = int(np.argmax(g_r))
print(f"First peak of g(r): r = {r[i_peak]:.2f} Angstrom, g = {g_r[i_peak]:.2f} "
      f"({len(frames)} snapshots)")

np.savetxt("al_liquid_rdf.dat", np.c_[r, g_r], header="r (Angstrom)  g(r)")
fig, ax = plt.subplots(figsize=(6.0, 4.0))
ax.plot(r, g_r)
ax.axhline(1.0, color="gray", linestyle="--", linewidth=0.8)
ax.set_xlabel("r (Å)")
ax.set_ylabel("g(r)")
ax.set_xlim(0, R_MAX)
fig.tight_layout()
fig.savefig("al_liquid_rdf.png", dpi=150)
print("Saved al_liquid_rdf.png")

Choosing the time step

The cost of molecular dynamics is set by the number of steps and by the number of SCF iterations per step. A longer time step needs fewer steps, but it has two side effects.

  • The error of the time integration grows. If the step is too long, atoms come too close to each other and the run becomes unstable.
  • The structure changes more in one step. Each SCF calculation starts from the density matrix of the previous step, so it needs more iterations to converge.

Both effects are measured in a short test before the production run. A thermostat hides the integration error, so the test uses VelocityVerlet (NVE) without a thermostat. Starting from the same structure and velocities, the same length of time is simulated with different time steps.

python
import re

import numpy as np
from ase import units
from ase.io import read
from ase.md.verlet import VelocityVerlet

from aofdft.calculator import AOFDFTCalculator

ROW     = re.compile(r"^\s*(\d+) \|")  # a row of the SCF table in the log file
T_TOTAL = 96.0                         # length of each run (fs)

start = read("start.traj")  # positions and momenta at the test temperature

for dt in (2.0, 3.0, 4.0, 6.0):
    log_file = f"nve_{dt:.0f}fs.log"
    atoms = start.copy()
    atoms.calc = AOFDFTCalculator(
        console      = False,
        logging_file = log_file,
        kin_type     = "AS26",
        kin_model    = "Crystal26",
        vps_dir      = VPS_DIR,
        pao_dir      = PAO_DIR,
    )
    e_tot = []
    dyn = VelocityVerlet(atoms, timestep=dt * units.fs)
    dyn.attach(lambda: e_tot.append(atoms.get_total_energy() / len(atoms)), interval=1)
    dyn.run(round(T_TOTAL / dt))

    n_iter = []  # SCF iterations of each MD step
    for line in open(log_file):
        row = ROW.match(line)
        if row is not None:
            if row.group(1) == "1":
                n_iter.append(0)
            n_iter[-1] += 1
    e_tot = (np.array(e_tot) - e_tot[0]) * 1000
    print(f"{dt:.0f} fs: E_tot range = {e_tot.max() - e_tot.min():.2f} meV/atom, "
          f"SCF iterations = {np.mean(n_iter[1:]):.1f} per step, {sum(n_iter[1:])} in total")

Start from a structure and velocities at the temperature of the production run or higher. The atoms move faster at a higher temperature, which makes the test more demanding. The table and figure below were obtained from a 108-atom Al structure heated to 2000 K with AOF-DFT.

Time step2 fs3 fs4 fs6 fs
Range of the total energy (meV/atom)2.642.843.053.73
Largest difference from the 2 fs run (meV/atom)—0.330.350.91
SCF iterations (mean per step)25.829.330.836.1
SCF iterations (total for 96 fs)1237936739578
NVE test with different time steps. Top: change of the total energy. Bottom: number of SCF iterations per step.
NVE test with different time steps. Top: change of the total energy. Bottom: number of SCF iterations per step.

The results show the following.

  • The total energy varies by about 3 meV/atom with almost the same shape for every time step. When a preconditioner is applied to stabilize the SCF calculation (noisy_precond="damping" in the default settings), the total energy changes. This is not an integration error and does not depend on the time step. The total energy therefore varies in NVE as well, in the same way for every time step.
  • The integration error is judged from the difference to the run with the shortest step, 2 fs. The difference is about 0.3 meV/atom for 3 fs and 4 fs, and grows to 0.9 meV/atom for 6 fs.
  • Going from 2 fs to 4 fs increases the SCF iterations per step by about 20%. The number of steps is halved, so the total number of iterations for the same simulated time drops to about 60%. With 6 fs it is about 50%.
  • The number of SCF iterations also depends strongly on the structure. Within the 2 fs test it ranges from 16 to 46. Leave a margin when estimating the computing time.
  • The SCF converged at every step for every time step, and the shortest interatomic distance was 2.2 Angstrom in all runs.

This example therefore uses 4 fs. Up to 4 fs the integration error hardly grows, and the cost is about 60% of that with 2 fs. With 6 fs the cost drops further, but only a little, and the error is about 2.6 times that of 4 fs.

In molecular dynamics with a thermostat, a long time step can shift the distribution of the sampled structures. This was checked with EMT, which is fast: liquid Al at 1000 K was simulated for 20 ps each with time steps of 1, 2, 4 and 6 fs. The mean temperature, the mean potential energy and the height of the first peak of g(r) agreed within the statistical errors. For example, the mean temperature is 1004 ± 5 K with 1 fs and 1002 ± 2 K with 4 fs.

The appropriate time step depends on the elements and the temperature. The fastest lattice vibration of Al has a period of about 100 fs, and 4 fs is 1/25 of it. Systems with light elements vibrate faster and need a shorter time step. Repeat the test when the system changes.

Example output

Results with v1.0.0 (Crystal26). The FFT grid is 132×132×132.

text
108 atoms, cell = 12.677 Angstrom
EMT:     3.00 ps, T = 944 K, mean square displacement = 9.0 Angstrom^2
step    0  T =   944.4 K  E_pot = -66.6931 eV/atom  (   999 s)
step   10  T =  1076.9 K  E_pot = -66.7473 eV/atom  (  4090 s)
step   20  T =   974.2 K  E_pot = -66.7587 eV/atom  (  6771 s)
step   30  T =   980.5 K  E_pot = -66.7594 eV/atom  (  9762 s)
...
step  420  T =   941.9 K  E_pot = -66.7826 eV/atom  (115318 s)
step  430  T =   978.7 K  E_pot = -66.7927 eV/atom  (117535 s)
step  440  T =   869.1 K  E_pot = -66.8054 eV/atom  (120007 s)
AOF-DFT: 1.76 ps, T = 869 K, mean square displacement = 2.0 Angstrom^2
First peak of g(r): r = 2.78 Angstrom, g = 3.18 (100 snapshots)
Saved al_liquid_rdf.png

The first SCF calculation needed 55 iterations; the later steps needed 20.2 iterations on average (11 to 34), and all of them converged.

This calculation was run as two jobs of 220 steps each (see "Running the calculation in several jobs" below). The output above joins the two parts; the elapsed times after step 220 are converted to totals from the start.

In the first 10 steps after the switch to AOF-DFT, the potential energy drops by 54 meV/atom and the temperature rises by about 130 K. A structure that is stable with EMT is a high-energy structure for AOF-DFT. The thermostat removes the excess energy.

The temperature in the last line (869 K) is the instantaneous value at the last step. For 108 atoms the instantaneous temperature fluctuates with a standard deviation of about 80 K (√(2/3N) times the target temperature).

Running the calculation in several jobs

Molecular dynamics runs many steps in a row, so on a machine that limits the run time of a job, one job may not be enough. Molecular dynamics can be continued from the structure and momenta saved in the trajectory file, so the calculation is then split into several jobs.

In the first job, reduce the number of steps in dyn.run(N_EQUIL + N_SAMPLE) of the script to a value that fits into the time limit. The time per step can be estimated from a short calculation such as the time step test. The calculation above used 220 steps. Leave a margin, because the number of SCF iterations depends on the structure. The following script continues the calculation in the later jobs.

python
import numpy as np
from ase import units
from ase.io import read
from ase.io.trajectory import Trajectory
from ase.md.langevin import Langevin

from aofdft.calculator import AOFDFTCalculator

# VPS_DIR, PAO_DIR, T_TARGET, DT, N_EQUIL, N_SAMPLE, INTERVAL, FRICTION: as in the script above

n_done = (len(Trajectory("al_liquid.traj")) - 1) * INTERVAL  # MD steps saved so far
atoms  = read("al_liquid.traj", index=-1)                    # positions, momenta, cell and constraint

atoms.calc = AOFDFTCalculator(
    console      = False,
    logging_file = f"al_liquid_{n_done}.log",
    kin_type     = "AS26",
    kin_model    = "Crystal26",
    vps_dir      = VPS_DIR,
    pao_dir      = PAO_DIR,
)

rng  = np.random.default_rng(2)  # a new seed for each restart
dyn  = Langevin(atoms, timestep=DT * units.fs, temperature_K=T_TARGET, friction=FRICTION,
                fixcm=False, rng=rng)
traj = Trajectory("al_liquid.traj", "a", atoms)  # append to the existing trajectory


def write_frame():
    if dyn.nsteps > 0:  # the starting structure is already in the file
        traj.write()


dyn.attach(write_frame, interval=INTERVAL)
dyn.run(N_EQUIL + N_SAMPLE - n_done)
traj.close()
  • read("al_liquid.traj", index=-1) reads the last structure of the trajectory file. The positions, momenta and cell are restored, and so is the constraint (FixCom).
  • Opening the trajectory file with "a" (append) adds the new structures to the same file. The structure at the restart is already in the file, so only the first write is skipped. When all steps are done, g(r) is computed as in part 3) of the original script.
  • A job that was stopped by the time limit can be continued with the same script, because the number of finished steps is taken from the number of structures in the trajectory file. Only the steps after the last saved structure (at most one step here) are lost.
  • The density matrix is not saved, so the SCF calculation of the first step after a restart starts from the initial state. In the calculation above it needed 57 iterations (about 20 per step afterwards).
  • Use a different seed for the random numbers of the thermostat at every restart. With the same seed, the random numbers of the previous job are repeated. Different random numbers do not change the statistical properties of the structures.
  • The sequence of random numbers can also be made the same as in a single run: save the state of the random number generator at the end of a job with json.dump(rng.bit_generator.state, f) and restore it at the restart with rng.bit_generator.state = json.load(f). In the calculation above, the thermostat continues the random numbers of the first job.

Checking the equilibration

Which steps to use for the average of g(r) after the switch to AOF-DFT is decided from the course of the potential energy. The trajectory file also stores the energy of each structure, so averages over blocks can be computed.

python
import numpy as np
from ase.io import read

frames = read("al_liquid.traj", index=":")
e_pot  = np.array([frame.get_potential_energy() / len(frame) for frame in frames])
temp   = np.array([frame.get_temperature() for frame in frames])

BLOCK = 40  # frames per block (the trajectory holds every 2nd step: 80 MD steps)
for i in range(1, len(frames), BLOCK):
    j = min(i + BLOCK, len(frames))
    print(f"steps {2 * i:3d}-{2 * (j - 1):3d}: T = {temp[i:j].mean():5.0f} K, "
          f"E_pot - E_pot(0) = {(e_pot[i:j].mean() - e_pot[0]) * 1000:6.1f} meV/atom")

The table shows the averages over blocks of 80 steps. The change of E_pot is the potential energy relative to its value at the switch to AOF-DFT (step 0), and T is the temperature. The last column is the temperature when the run is continued with EMT and the same random numbers.

StepsChange of E_pot (meV/atom)T (K)T with EMT (K)
2–80−711025977
82–160−8210431027
162–240−9710541056
242–320−107967959
322–400−111915933
402–440−104984954
  • The potential energy keeps decreasing until about step 240 and then stays near −105 meV/atom. Its slope over steps 242 to 440 is −1 meV/atom/ps. The first 240 steps are therefore treated as equilibration, and the remaining 200 steps are used for the average of g(r).
  • If the equilibration is too short, the average includes a part in which the potential energy is still decreasing. Over steps 62 to 220, for example, the slope is −45 meV/atom/ps.
  • The block averages of the temperature vary between 915 K and 1054 K. The mean temperature over the part averaged for g(r) (steps 242 to 440) is 950 K, 50 K below the thermostat temperature. The mean over all 440 AOF-DFT steps is 1000 K.
  • This deviation is a statistical fluctuation caused by the random numbers of the thermostat. As the last column of the table shows, the temperature changes in almost the same way when the run is continued with EMT and the same random numbers; its mean over steps 242 to 440 is then 948 K. In a 60 ps EMT run with other random numbers, the means over parts of 0.8 ps scatter with a standard deviation of 17 K. The deviation here is about three times as large, which is a rare case.
  • The potential energy also follows the temperature. In the EMT liquid, a mean temperature that is 100 K lower gives a mean potential energy that is about 10 meV/atom lower. The values after step 240 include the effect of the low temperature.

In molecular dynamics of about 1 ps, even the mean temperature keeps an uncertainty of a few tens of K. Quantities that are sensitive to the temperature need a longer run.

Radial distribution function

Radial distribution function g(r) of liquid Al from AOF-DFT. The thermostat temperature is 1000 K; the average is over 100 structures (0.80 ps).
Radial distribution function g(r) of liquid Al from AOF-DFT. The thermostat temperature is 1000 K; the average is over 100 structures (0.80 ps).
  • The first peak is at r = 2.78 Angstrom, with a height of 3.18.
  • After the first peak, g(r) falls to about 0.5 near 3.8 Angstrom. A broad second peak with a height of about 1.3 lies between 5.0 and 5.4 Angstrom.
  • An fcc crystal would show a sharp peak at the second-neighbour distance (4.23 Angstrom at this density). Here there is no peak, and g(r) is about 0.6. This is the g(r) of a liquid, without long-range order.
  • The EMT liquid at the same density has a first peak of about 2.5 (1000 K, average over 20 ps). The AOF-DFT liquid has more uniform interatomic distances than the EMT liquid. This difference in structure is why the potential energy decreases after the switch.
  • When the averaged part is split into two halves, the height of the first peak stays at 3.2, and g(r) differs by 0.2 at most.
  • Averaging over steps 62 to 220 instead, where the mean temperature was 1051 K, gives a first peak of 3.06. Given the fluctuation of the temperature, the height of the first peak is uncertain by about 0.1.

Checking that the crystal has melted

Whether the crystal has melted can be checked with the mean square displacement (the mean of the squared displacements from the initial positions). The script prints it at the end of the EMT stage and of the AOF-DFT stage. ASE's molecular dynamics does not wrap the atoms back into the cell, so the differences of the coordinates are the displacements.

  • In a solid the atoms only vibrate around their lattice sites, and the mean square displacement levels off at a small value. When this system was only heated to 2000 K for 200 fs with AOF-DFT, it levelled off at about 0.4 Ų and the crystal did not melt.
  • In a liquid the atoms diffuse, so the mean square displacement keeps growing with time. At the end of the EMT stage it is 9.0 Ų. This is about the square of the nearest-neighbour distance (2.99 Angstrom): on average, an atom has moved to the position of a neighbour.
  • In the AOF-DFT stage the mean square displacement is measured from the positions at the switch to AOF-DFT. It keeps growing: 0.44 Ų after 0.24 ps, 1.36 Ų after 0.96 ps and 2.02 Ų after 1.76 ps. This is similar to the run continued with EMT and the same random numbers (2.2 Ų after 1.76 ps), so the system remains liquid after the switch to AOF-DFT.

Notes

  • The cell volume is fixed at the experimental density of the liquid (NVT).
  • EMT is used only to prepare a disordered starting structure. It supports only a few elements, such as Al, Cu, Ag, Au, Ni, Pd and Pt. For other systems, use another classical potential or start from randomly placed atoms.
  • FixCom is a constraint that fixes the centre of mass of the system. The Langevin thermostat applies random forces to the atoms, so without the constraint the centre of mass slowly moves. Langevin also has the argument fixcm for this purpose, but it is deprecated since ASE 3.28. Here fixcm=False is combined with FixCom.
  • When the conservation of the total energy matters, set noisy_precond="2/3", a preconditioner that does not affect the low-frequency components, or noisy_precond=None (no preconditioning) in AOFDFTCalculator. The preconditioner setting also changes the value of the total energy, so use the same setting in all calculations whose energies are compared.
  • friction=0.02 / units.fs in Langevin is a rather strong setting (relaxation time 50 fs). The temperature approaches the target quickly, but the motion of the atoms is strongly perturbed. For dynamical quantities such as the diffusion coefficient, use a smaller value or switch to VelocityVerlet (NVE) after the equilibration.
  • Besides the Langevin thermostat, ASE provides other thermostats such as the Nosé-Hoover chain (ase.md.nose_hoover_chain.NoseHooverChainNVT) and the method of Bussi (ase.md.bussi.Bussi). Structural averages such as g(r) are taken from the same distribution at the given temperature, whichever thermostat is used.
  • dyn.set_temperature(temperature_K=T_TARGET) changes the thermostat temperature while keeping the same dyn.
  • The random seed is fixed with np.random.default_rng(1), so the initial velocities and the random numbers of the thermostat are the same in every run.
  • The Trajectory stores the positions and momenta every 2 steps. g(r) is computed from this trajectory, so the number of steps discarded as equilibration can be changed without repeating the molecular dynamics. For continuing a run, see "Running the calculation in several jobs".
  • rmax of get_rdf(atoms, rmax, nbins) must not exceed half the width of the cell (otherwise an error is raised). Here the cell edge is 12.68 Angstrom, so 6.0 Angstrom is used.
  • g(r) is an average over many structures. Structures from consecutive steps are similar to each other, so a smooth g(r) needs a long run. The 100 structures (0.80 ps) averaged here are enough to see the positions and approximate heights of the peaks, but not for a quantitative comparison with experiment.