Trajectory analysis
TrajectoryAnalysis accepts an ordered list of Atomli structures. It provides
aligned RMSD, RMSF, unwrapped mean-squared displacement, velocity correlations,
VDOS, RDFs, contacts, hydrogen bonds, torsion distributions, and diffusion fits.
The elapsed time between saved frames is part of the input.
A short g-xTB water trajectory
Section titled “A short g-xTB water trajectory”g-xTB water NVE trajectory with energy conservation and aligned RMSD
This isolated-water calculation uses analytical g-xTB forces, a relaxed starting geometry, a 300 K velocity initialization, and 500 steps of Velocity Verlet at 0.25 fs. Initial center-of-mass translation and rotation are removed. Frames are saved every two steps, so the analysis interval is 0.50 fs. The plotted RMSD removes rigid molecular motion; the energy panel records total-energy changes.
Trajectory · Samples, RMSD, RMSF, and VACF · Generation script
from atomli.analysis import TrajectoryAnalysisfrom atomli.io import read
frames = read("water-nve.extxyz", ":")analysis = TrajectoryAnalysis(frames, timestep_fs=.5)rmsd = analysis.rmsd(align=True) # angstromrmsf = analysis.rmsf(align=True) # one value per atom, angstromvacf = analysis.vacf() # normalized correlation; times_fsThe record contains a 125 fs trajectory. It can check integration and local vibrational motion. It is too short to establish a thermal ensemble or a converged spectrum, and an isolated molecule does not define bulk diffusion.
Geometry and torsional populations
Section titled “Geometry and torsional populations”from atomli.analysis import GeometryAnalysis
geometry = GeometryAnalysis(frames)bonds = geometry.get_bonds("O", "H")bond_lengths = geometry.get_values(bonds)For a flexible-molecule trajectory, supply the intended torsion explicitly:
# ethanol_frames must preserve the C–C–O–H atom order used in the conformer guide.ethanol = TrajectoryAnalysis(ethanol_frames, timestep_fs=saved_frame_interval_fs)torsion = ethanol.dihedral_distribution(0, 1, 2, 3, bins=72)contacts = ethanol.contacts(cutoff=3.5)hydrogen_bonds = ethanol.hydrogen_bonds()Contacts and hydrogen bonds use geometric cutoffs. Retain distance and angle criteria with populations or lifetimes. A set of optimized conformers has no time ordering and should be analyzed with the conformer ensemble API, not treated as an MD run.
Periodic transport and structure
Section titled “Periodic transport and structure”liquid = TrajectoryAnalysis(liquid_frames, timestep_fs=saved_frame_interval_fs)msd = liquid.msd()rdf = liquid.rdf(rmax=5.0, nbins=100, elements=("O", "O"))diffusion = liquid.diffusion_coefficient(segments=4, ignore_n_frames=100)These calls apply to a suitably equilibrated periodic liquid trajectory. Choose an RDF cutoff appropriate to the cell. Unwrapping requires successive frame displacements small enough to resolve periodic crossings. For diffusion, select a diffusive fitting interval, report uncertainty across independent segments or replicas, and consider finite-cell corrections. The water demo above does not satisfy those conditions.
Correlation spectra
Section titled “Correlation spectra”vacf() requires velocities in the saved frames. vdos() transforms the native
velocity correlation and returns a frequency axis in cm⁻¹. Preserve velocities,
frame spacing, equilibration, windowing, and trajectory length with a spectrum.
A velocity-derived VDOS has different statistical and physical assumptions
from an analytical harmonic Hessian.