Skip to content

2D Systems: Current Support & Feature Parity Roadmap ​

ParticleDynamics provides native GPU support for 2D periodic systems across soft matter, active matter, polymers, and custom potentials. Because several high-density biomolecular subsystems (ClusterPairs, 3D Electrostatics, holonomic constraints, and NPT barostats) were engineered for 3D first, this page records exact 2D capabilities in v1.2.0 alongside the tracked 2D feature parity roadmap and concrete codebase touchpoints.


1. What 2D Systems Support in v1.2.0 ​

Everything listed below runs natively on GPU via DeviceEngine CUDA graphs (step!, step_graph!, step_many!, and Workflow.run!) and is covered by test/test_device_engine_2d_gpu.jl, test/test_p1de_custom_potentials_gpu.jl, test/test_io_gsd.jl, and examples/2D_*.jl:

CategorySupported in 2D (v1.2.0)Key APIs / Implementation
Neighbor Lists & Traversal2D dense cell-list ELL (NeighborMatrix), typed StencilNeighborMatrix (mapped to single max-rc ELL), and small-box AllPairsNeighborMatrix; cooperative warp pair traversal (force_lanes auto-selected by engine_settings), 2D ELL control-kernel fusion (Fusion.jl for NVE, single-bath CSVR, and BAOAB/BAOABFast), and spatial_reorder=true (OrderingWorkspace).CellList, NeighborLists.DeviceNeighborWorkspace{T,2}, src/engine/PairTraversal.jl, src/engine/Fusion.jl, src/engine/Ordering.jl
Built-In Short-Range PairsLennard-Jones (:lj, :none / :potential_shift / :force_switch / :potential_switch), WCA (:wca), uniform soft repulsion (:soft_repulsive), per-particle mixed σ (MixedSigmaLJ / MixedSigmaWCA), and per-type PairTable (PairMatrixLJ / PairMatrixWCA / PairMatrixSwitchedLJ).LennardJones, WCA, SoftRepulsive, PairTable, src/engine/PairModels.jl
Custom Pair PotentialsFull 2D AbstractPairPotential support including built-in MorsePotential and screened YukawaPotential (uniform or per-particle charges with sorted_particle_arrays spatial-reorder safety).attach_pair_potential!, MorsePotential, YukawaPotential, src/simulation/ExternalPotential.jl
External Potentials & GPU MLIPsBoth :replace and :additive AbstractExternalPotential modes in 2D, including zero-sync is_device_capturable=true GPU providers (with step_many! batching and provides_virial=true) and host-synced SplitStep providers.ExternalPotentialForce, attach_external_potential!, src/engine/ExternalPotential.jl
Bonded InteractionsLegacy 2D HarmonicBond and FENEBond (BondList) with optional bonded pair exclusions, plus 2D-compatible typed BondedTerms (HarmonicBondForce, FENEBondForce, HarmonicAngleForce, CosineSquaredAngleForce, UreyBradleyAngleForce).src/bonded/, src/workflow/Bonded.jl
Integrators & ThermostatsNVESpec (ConstantVolume), VVSpec (GJF VelocityVerlet), BAOABSpec (BAOAB, BAOABFast), BAOASpec, GSMSpec, CSVRSpec (CSVR, multi-bath), NHCSpec (NoseHooverChain, all 3 propagators), BrownianSpec (EulerHeun), EMSpec (EulerMaruyama), and single/multi-mode ActiveOrnsteinUhlenbeck (OUSpectrum).src/engine/Langevin.jl, CSVR.jl, NHC.jl, Brownian.jl, OUNoise.jl
Energy MinimizationFixed-box 2D FIRE and SteepestDescent minimization respecting FreezeGroup (FREEZE_HOLD), custom pair potentials, and external potentials.minimize!, FIRE, SteepestDescent, src/simulation/Minimization.jl
Restraints, Unwrapping & CollisionsFreezeGroup (FREEZE_HOLD and FREEZE_SPRING harmonic tether), continuous unwrapped_positions (UnwrapFeature), and per-type contact counting (Collisions, CollisionObservable).src/engine/Freeze.jl, Unwrap.jl, CollisionCounting.jl
2D Initial Configuration GeneratorsComplete 2D triangular/hexagonal packing suite in InitGenerators: box_from_phi_2d, hex_random_2d, hex_circle_2d, hex_circle_plus_random_2d, hex_sites_in_box_2d, hex_circle_in_box_2d, hex_slab_coexistence_2d.src/InitGenerators.jl
2D Observables & Dynamic GeometryThermodynamicObservable, BathExchangeObservable, VirialObservable (2D tensor components (:xx, :yy, :xy)), MSDObservable, VACFObservable, CollisionObservable, 2D mechanical_pressure(st) ((2K + tr W)/(2A)), cell_volume(st) (area Lx * Ly), and set_cell_and_positions! for 2D boxes.src/simulation/Virial.jl, Barostats.jl, CellUpdates.jl, src/workflow/observables/
I/O & RestartsFull 2D HOOMD-schema GSDWriter / write_gsd_frame! (configuration/dimensions = 2, 2D positions/velocities/forces/unwrapped/virial), read_gsd_frame! & ParticleSystem(from_gsd=...) restarts, TableWriter, InMemoryWriter, and XYZ/CSV helpers.src/io/gsd/GSDFrameWrite.jl, src/io/RestartIO.jl, src/workflow/writers/

2. Future 2D Feature Parity Roadmap ​

The five items below track every 3D-only subsystem that is intentionally deferred in v1.2.0, with exact architectural touchpoints and engineering scope so future contributors can implement each item cleanly without rediscovering the codebase.

Roadmap 1: 2D NPT Barostats (Area Coupling & 2D Virial) ​

  • Goal: Enable GPU-resident DeviceCRescale (StochasticCellRescaling) and DeviceMonteCarloBarostat (MonteCarloBarostatSpec / MonteCarloBarostat) in 2D with area-coupling modes :isotropic (uniform Lx, Ly), :x (fixed Ly), and :y (fixed Lx), using the exact 2D virial pressure P = (2K + W_xx + W_yy) / (2A) and 2D Metropolis acceptance factor (N_units + 1) ln(A'/A) (or N_units ln(A'/A) for uniform ΔA proposals).

  • What Already Exists: cell_volume(st) returns area A = Lx * Ly (src/simulation/CellUpdates.jl), mechanical_pressure(st) already evaluates (2K + tr W) / (2A) (src/simulation/Barostats.jl), virial_components(st) returns (:xx, :yy, :xy) (src/simulation/Virial.jl), and _scale_coords_kernel! is already parameterized on Val{D}.

  • Exact Touchpoints:

    • src/simulation/Barostats.jl — Relax _is_3d(st) in _check_barostat_state; add 2D area-proposal volume/area scaling and :x/:y mode validation.

    • src/engine/barostat/BarostatTypes.jl — Parameterize DeviceCRescale / DeviceMonteCarloBarostat reference box and scale factors for D = 2 (2-component ws.geom lengths, 2-axis GEOMETRY_SHRINK check).

    • src/engine/barostat/CRescale.jl, VirialKernels.jl, MCKernels.jl, MCScaleKernels.jl, MCFallback.jl — Add Val{2} branches summing virial[:, 1] + virial[:, 2] (2D trace), 2D sqrt(A'/A) isotropic scaling (s_x = s_y = exp(η/2)), and 2D st.box2 sync in sync_device_box!.

    • src/engine/state/EngineSupport.jl & EngineBuild.jl — Relax st.rz !== nothing && st.box3 !== nothing in _pressure_control_reason and _capture_engine.

    • src/workflow/Barostats.jl — Relax length(sim.system.box) == 3 in _validate_barostat_dynamics and allow :x/:y in _normalize_barostat_mode.

  • Estimated Effort: Medium (1-2 weeks; ELL 2D path is clean since DeviceCRescale and DeviceMonteCarloBarostat already support 3D :ell).

Roadmap 2: 2D Cooperative ELL Builder & Subdivided Cells (sub > 1) ​

  • Status: 2D ELL control-kernel fusion (Fusion.jl) is complete (supporting 2D NVE, single-bath CSVR, and BAOAB/BAOABFast with fused prefix + suffix graphs, delivering +25% throughput on 2D WCA).

  • Remaining Goal: Bring the remaining 3D high-density ELL rebuild speedups to 2D simulations:

    1. 2D cooperative ELL row builder (build_lanes ∈ {2, 4, 8, 16}) scanning the 9-cell (or (2S+1)^2 subdivided) stencil in lockstep with group-masked ballots.

    2. 2D subdivided cells (cell_sub = 2) for dense 2D colloidal/active-matter disks with long neighbor rows.

  • Exact Touchpoints:

    • src/engine/Builder.jl — Add _cooperative_rows2_kernel! (9-cell unrolled S1=true and general Sx, Sy stencil for sub > 1) mirroring _cooperative_rows3_kernel!.

    • src/neighbors/DeviceNeighborKernels.jl & DeviceNeighborTypes.jl — Support sub > 1 cell sizing and 2D stencil reach in _device_finish_rebuild!.

    • src/engine/state/EngineSupport.jl (engine_settings) — Calibrate 2D (size_class, density_class) entries in ENGINE_SETTINGS once _cooperative_rows2_kernel! is active.

  • Estimated Effort: Small–Medium (3–5 days; straightforward mirror of the existing 3D cooperative builder).

Roadmap 3: 2D Holonomic Constraints (Rigid Dimers, Polygons & Chains) ​

  • Goal: Extend ConstraintClusters so 2D active/passive rigid molecules (dumbbells/dimers k=1, rigid triangles/polygons, and constrained 2D chains) run with exact Float64 SHAKE/RATTLE and instantaneous 2D constraint virials.

  • Exact Touchpoints:

    • src/constraints/clusters/StarSolvers.jl, StarKernels.jl, GeneralKernels.jl, Workspace.jl, Launch.jl — Parameterize coordinates/velocities/MIC over Val{D} (2D drops z registers and halves SMEM atom footprint for general clusters) and subtract n_constraints from 2D kinetic DOF 2N.

    • src/simulation/ConstraintClusterCoupling.jl — Relax 3D checks on attach_constraint_clusters! and compute 2D kinetic_dof(st) (2N - n_constraints) and 2D constraint_virial_trace.

    • src/engine/ConstraintClustersFeature.jl & src/engine/state/Fingerprint.jl — Support D = 2 in after_position! / after_kick! and _constraint_dof_per_bath.

    • src/workflow/Integrator.jl — Allow ConstraintClusterSpec on 2D ParticleSystems.

  • Estimated Effort: Medium (1-2 weeks; star/general algebraic solvers are already dimension-agnostic dot products).

Roadmap 4: 2D Long-Range & Screened Electrostatics (2D Ewald/PME & Screened Coulomb) ​

  • Goal:

    1. Short-range screened Coulomb (2D Yukawa / DLVO): Available via YukawaPotential (AbstractPairPotential) on 2D :ell; future work adds a dedicated workflow descriptor (Yukawa force in src/workflow/Forces.jl) and multi-type screening matrices.

    2. True 2D periodic / 2D-slab long-range electrostatics (for charged colloids on a plane 1/r with 2D periodicity, or 3D boxes with Yeh-Berkowitz slab correction / 2D spectral Ewald): 2D R2C/C2R CompactFFT and 2D prolate/B-spline mesh spread/gather with the exact 2D Fourier kernel 2π / |k| (or erfc slab kernel).

  • Exact Touchpoints:

    • src/electrostatics/Spec.jl, Splits.jl, Solver.jl — Add ElectrostaticsSpec2D (or boundary=:slab_2d / mesh::NTuple{2,Int}) and 2D reciprocal splitting functions.

    • src/electrostatics/fft/ — Reuse XYEvenKernels.jl / XYOddKernels.jl (which ALREADY implement fused 2D XY R2C/C2R SMEM FFTs!) directly as standalone 2D FFT + spectral solve kernels.

    • src/electrostatics/mesh/ — Add 2D P x P SMEM spread and gather kernels (SpreadSmem.jl, GatherSmem.jl).

    • src/engine/PairModels.jl (ChargedPairs), src/engine/run/GraphCapture.jl (ell_mesh_graph), src/workflow/Forces.jl — Lift 3D-only guards in _ell_charged_ok and compile_forces.

  • Estimated Effort: Large (3-5 weeks for full 2D periodic & 3D-slab Ewald/ESP with independent Float64 CPU reference validation; Small, 2-3 days, for adding a workflow YukawaForce wrapper around existing YukawaPotential).

Roadmap 5: 2D-Native ClusterPairs / Newton-3 Tile Engine ​

  • Goal: Build a 2D-native Newton-3 tile engine (e.g., 8-disk clusters grouped into 64-disk super-clusters via 2D x-columns and y-bins, 3x3 9-shift periodic image encoding instead of 27-shift 3D, and 2D (x, y, q, pad) packed LDG.128 tiles) to deliver maximum throughput for large (N >= 10^5), high-density 2D soft-matter, glassy, and active-matter parameter sweeps.

  • Why Separate from 3D ClusterPairs: 3D ClusterPairs (src/clusterpairs/) assumes 3D (x, y) columns + z bins, 2x2x2 octants, 5-bit 27-shift encoding (0..26 + sentinel 27), and 3-component force accumulators (fx, fy, fz). A 2D-native path halves AABB/coordinate bandwidth, halves force-scatter traffic ((fx, fy) only), reduces periodic shifts to 0..8 (4 bits), and eliminates all z register pressure in the inner 8x8 tile loop.

  • Exact Touchpoints:

    • src/clusterpairs/ — New 2D list builder/pruner (ListCluster2D, ListBuild2D, ListPrune2D) and 2D Newton-3 pair kernel (PairKernelsF32_2D), reusing Primitives.jl, DeviceScan.jl, and Fixed64ForceMatrix (SlotPackScatter.jl).

    • src/simulation/ClusterCoupling.jl & src/engine/state/EngineSupport.jl (cluster_supported) — Dispatch :cluster backend for D == 2 once validated.

    • src/engine/run/RunTypes.jl (line 65) — Relax D == 3 gate on cluster !== nothing.

  • Estimated Effort: Large (4-6 weeks; recommended after Roadmap 1 and Roadmap 2, since 2D ELL fusion + cooperative builder already closes most of the gap for small-to-medium N).

ParticleDynamics v1.2.0 · GPU-native molecular dynamics in pure Julia · MIT License