Source-linked AI summary

freud: A Software Suite for High Throughput Analysis of Particle Simulation Data

Vyas Ramasubramani, Bradley D. Dice, Eric S. Harper, Matthew P. Spellings, Joshua A. Anderson, Sharon C. Glotzer

arXiv:1906.06317v3physics.comp-phcond-mat.mtrl-scics.CE

TL;DR

Simulation analysis needs tools that handle large, diverse coarse-grained datasets without being tied to atomistic trajectory formats. freud addresses this with array-based Python interfaces to parallelized C++ analyses, providing flexible neighbor-centered methods for standard and specialized measurements. Its broad applicability and performance support high-throughput workflows, although environment matching is substantially slower than common structure-identification methods.

  • Problem

    Large simulation datasets and coarse-grained systems require efficient, flexible analysis beyond trajectory- and topology-centered tools designed mainly for atomistic simulations.

  • Method

    freud analyzes numerical arrays through a Python API backed by parallelized C++ routines, with periodic neighbor-finding tools supporting a common suite of analyses.

  • Results

    freud provides standard and specialized particle analyses, including RDFs, PMFTs, local environment characterization, and flexible use across simulation and experimental data.

  • Takeaways & Limitations

    freud supports large-scale, high-throughput analysis and integration with Python workflows while remaining applicable to arbitrary particle-simulation outputs.

  • Takeaways & Limitations

    Environment matching is at least an order of magnitude slower than OVITO’s Polyhedral Template Matching and Common Neighbor Analysis implementations.

Abstract

from arXiv · show

The freud Python package is a powerful library for analyzing simulation data. Written with modern simulation and data analysis workflows in mind, freud provides a Python interface to fast, parallelized C++ routines that run efficiently on laptops, workstations, and supercomputing clusters. The package provides the core tools for finding particle neighbors in periodic systems, and offers a uniform API to a wide variety of methods implemented using these tools. As such, freud users can access standard methods such as the radial distribution function as well as newer, more specialized methods such as the potential of mean force and torque and local crystal environment analysis with equal ease. While many comparable tools place a heavy emphasis on reading and operating on trajectory file formats, freud instead accepts numerical arrays of data directly as inputs. By remaining agnostic to its data source, freud is suitable for analyzing any coarse-grained particle simulation, regardless of the original data representation or simulation method. When used for on-the-fly analysis in conjunction with scriptable simulation software such as HOOMD-blue, freud enables smart simulations that adapt to the current state of the system, allowing users to study phenomena such as nucleation and growth.

PROGRAM SUMMARY

freud provides fast, parallelized particle-system analyses through Python and C++, with broad support for standard, specialized, and machine-learning-oriented methods.

  • freud analyzes coarse-grained, nanoscale, and colloidal particle systems through a Python API backed by parallelized C++ routines.Its array-based interface supports numerical inputs and outputs while scaling analysis to larger systems and real-time use.
  • The library implements fast standard methods, including radial distribution functions and correlation functions.
  • freud includes a reference implementation of the potential of mean force and torque.
  • Novel particle-environment methods include descriptors useful for machine learning.

1. Introduction

Modern simulations generate large, diverse datasets that require efficient, flexible, and usable analysis tools. Existing packages often emphasize atomistic trajectories and topology-specific workflows, while freud accepts generic particle data through numerical arrays.

  • Growing simulation data volumes demand computationally efficient analysis tools, while data diversity demands adaptable workflows.The paper also emphasizes usability for scientists with limited prior computing experience.
  • Many existing analysis packages focus on all-atom, especially biomolecular, simulations and trajectory management.
  • Trajectory-centered topology tools are cumbersome for coarse-grained systems, where nearest neighbors are dynamic and parameter-dependent.In colloidal systems, neighborhood-based relationships cannot be treated as stored chemical bonds.
  • freud introduces an open-source toolkit whose inputs and outputs are numerical arrays without predefined atom or molecule notions.This allows analysis of particle-based data from experiments and simulations regardless of the generating software or method.
  • Its Python API exposes fast C++ methods and analyses including radial distribution and correlation functions.

2. Design

freud separates analysis from trajectory formats and organizes methods around particle neighborhoods, enabling flexible data handling and a common, parallelized API.

  • Unlike tools tied to simulation or visualization environments, freud is designed for scriptable integration with other workflows.This addresses the difficulty of using some existing tools outside their sandboxed environments.
  • Each freud analysis is an independent Python class operating directly on NumPy arrays rather than topology-encoding trajectory objects.
  • Array-based inputs allow freud to analyze arbitrary spatial data and pass results between multiple Python tools.The package can also support real-time visualization in OVITO with almost no noticeable performance cost.
  • freud supports data from over 25 trajectory formats while allowing users to modify arrays before analysis.
  • Efficient neighbor finding is a central design pattern because local-neighborhood characterization commonly begins by identifying neighboring particles.
  • A common API presents independent analysis methods, and all methods are accelerated through extensive parallelization.

3. Implementation

freud implements periodic-system handling, neighbor queries, reusable computation objects, and parallel performance strategies through a Python-facing C++ architecture, with an FFT-based MSD implementation in Python.

  • The Box class handles periodicity in arbitrary triclinic boxes, while NeighborQuery supports efficient neighbor finding.
  • NeighborQuery provides bounding-volume-hierarchy and cell-list search algorithms, while NeighborList stores query results for reuse.
  • Compute classes populate attributes after computation and can be configured once for repeated calculations.Histogram-like classes such as RDF and PMFT also support accumulation through reset controls.
  • Most neighbor-dependent methods accept a system and neighbor specification, with NeighborQuery reuse advantageous when performance is critical.
  • Inputs may include boxes, particle arrays, raw tuples, NeighborQuery objects, or simulation frames from external tools.
  • Performance-critical components use thread-parallel C++ implementations exposed through thin Cython bindings.
  • The pure-Python MSD module reduces direct O(N_pN_f^2) computation to O(N_pN_f log(N_f)) using FFTs.NumPy and SciPy provide the underlying fast FFT routines.
  • Parallel calculations distribute work over particles or particle pairs using Intel Threading Building Blocks.

4.1. General Utilities

freud’s general utilities provide periodic neighbor-finding infrastructure using multiple algorithms, reusable neighbor data structures, and Voronoi-based neighborhoods. Its AABBQuery implementation scales better than SciPy’s cKDTree for larger systems while supporting more general box geometries.

  • NeighborQuery standardizes access to neighboring particle pairs, which can be obtained dynamically or stored in NeighborList objects.
  • AABBQuery uses an axis-aligned bounding-box tree, while LinkCell uses linked cell lists; both support distance-cutoff or fixed-neighbor queries.
  • freud’s AABBQuery routines clearly outperform SciPy’s cKDTree as system sizes increase to thousands of points.
  • freud supports general triclinic boxes, whereas SciPy’s cKDTree supports only periodic orthorhombic boxes.
  • NeighborQuery objects interoperate with analysis routines, avoiding unnecessary Python-to-C++ memory transfers and enabling parallel processing of neighbor pairs.
  • The Voronoi class generates particle Voronoi diagrams and returns NeighborList objects usable by other compute classes.

4.2. Analysis Modules

freud’s analysis modules cover standard particle- and phase-analysis tasks, including clustering, density correlations, mean-squared displacement, and diverse order parameters. The package also includes specialized PMFT and environment methods developed within the authors’ group.

  • freud’s modules include clustering with gyration-tensor properties, radial and spatial correlation functions, local-density estimation, and grid interpolation.
  • The order module provides bond-orientational, cubatic, nematic, and solid-liquid order parameters for ordering and phase-transition analysis.
  • The pmft and environment modules implement analysis features developed by the authors’ group that were not yet implemented elsewhere.

4.3. Potentials of Mean Force and Torque

PMFT generalizes the classical potential of mean force to pair configurations involving positional and orientational degrees of freedom, thereby describing directional entropic effects. freud computes PMFTs from configuration histograms, and their scaling is close to that of RDF calculations.

  • The potential of mean force and torque generalizes the classical potential of mean force to quantify directional entropic forces in crowded systems.
  • PMFT is derived by separating pair relative coordinates from the canonical partition function over particle positions and orientations.
  • For hard particles governed only by excluded-volume interactions, the PMFT expression can be simplified.
  • Restricting PMFT coordinates to center-to-center distance recovers the classical PMF and the RDF relation g(r) = e^(-βF12(r)).
  • freud calculates PMFT by histogramming configurations of other particles and taking the negative logarithm of the counts, with multiple frames producing smoother energy surfaces.
  • Steinhardt Q6 and cubatic KΩ4 values distinguish ordering during compression simulations, with Q6 suited to BCC structures and KΩ4 to octahedral systems.
  • PMFT and RDF calculations scale almost identically across many threads, with PMFT’s additional cost arising from local-coordinate and multidimensional-binning operations.
  • Increasing maximum interparticle distance produces the expected quadratic growth in both PMFT and RDF calculation cost.

4.4. Local Environments

The environment module offers local- and global-order analyses, including BOODs, PMFTs, spherical-harmonic descriptors, and environment matching. These methods characterize ordering, particle configurations, nucleation, and local structural variations with differing computational costs.

  • Bond-Orientational Order Diagrams: BOODs project neighbor-bond vectors onto a sphere, revealing n-fold local ordering as n peaks.They can use local particle coordinates to reduce misidentification across multiple grains and support plastic-crystal analysis.
  • Potential of Mean Force and Torque: PMFTs encode the probability of relative particle positions and orientations, with wells identifying preferred configurations.The displayed examples integrate out rotational degrees of freedom and show wells aligned with large polyhedron facets.
  • Spherical Harmonic Descriptors: Spherical-harmonic representations support order parameters and descriptors for identifying solid-like particles during crystallite nucleation and growth.The associated example uses descriptors with a feedforward artificial neural network.
  • Environment Matching: EnvironmentCluster performs point-set registration on each particle’s nearest-neighbor environment to identify and cluster similar local motifs.Unlike system-averaged descriptors, it emphasizes local information and can distinguish structures such as stacking faults.
  • Environment Matching: Direct pairwise motif comparison makes environment matching at least an order of magnitude slower than common structure-identification methods.Its greater cost accompanies structure inference without prior candidate knowledge and fine-grained stacking-fault identification.

4.5. Data Generation and Plotting

freud.data supports teaching and testing by generating arbitrary or common crystal systems, while plotting methods provide rapid visualization of computed analyses.

  • Data Generation: The UnitCell class represents arbitrary unit cells from user-provided box vectors and basis positions.It also generates common face-centered cubic, body-centered cubic, and simple cubic structures.
  • Plotting: Many analysis modules provide plot() methods and automatic IPython PNG representations for rapid visualization.Compute objects can render through Matplotlib when returned as the final expression in a code cell.

5. Examples

The examples show freud working with simulation data from LAMMPS, HOOMD-blue, GROMACS, and Python-based workflows. They demonstrate trajectory analysis, on-the-fly computation, visualization, and custom local-structure analysis.

  • RDF and MSD from LAMMPS simulation: freud computes RDF and MSD quantities from LAMMPS data represented as numerical arrays, with periodicity handled by its analysis methods.The workflow reads particle counts, box information, positions, and image data from a custom dump format.
  • RDF and MSD from LAMMPS simulation: LAMMPS-derived RDF results can be plotted with Matplotlib using freud’s bin centers and RDF values.The example shifts coordinates for consistency with freud’s origin-centered coordinate system without affecting analyses.
  • On-the-fly analysis with HOOMD-blue: freud can accumulate RDF data and log order parameters during HOOMD-blue simulations without storing the entire trajectory.This supports averaging over many frames while avoiding unreasonably large trajectory files.
  • Analyzing Atomistic Trajectories from GROMACS: The GROMACS example uses MDTraj to read an XTC trajectory and freud to compute an RDF for selected oxygen atoms.Python-based subsetting can reproduce customized selections that standard trajectory tools may not handle for coarse-grained systems.
  • Common Neighbor Analysis: Common Neighbor Analysis can be implemented in Python by combining freud NeighborList data with NetworkX local graphs.The example finds common neighbors, constructs neighborhood graphs, and assigns identifiers based on bonding and graph features.

6. Conclusion

freud is a high-performance, flexible Python library for analyzing particle simulations, especially coarse-grained systems. Its data-source-agnostic design supports periodic-system workflows across molecular dynamics and Monte Carlo.

  • Its high-performance C++ back end supports large-scale, high-throughput simulation analysis through a compact Python API.
  • The API is designed to integrate with other tools, including machine-learning workflows, and supports prototyping analyses directly in Python.
  • freud targets coarse-grained particle simulations while remaining general enough for any particle-based system.
  • freud makes no assumptions about input data types or system topology, accepting arbitrary simulation outputs based on user-defined topologies.
  • For materials scientists, chemical engineers, and physicists using molecular dynamics or Monte Carlo, freud simplifies periodic-system analysis without atomistic-specific complexity.
Loading 1906.06317v3…