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:
| Category | Supported in 2D (v1.2.0) | Key APIs / Implementation |
|---|---|---|
| Neighbor Lists & Traversal | 2D 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 Pairs | Lennard-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 Potentials | Full 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 MLIPs | Both :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 Interactions | Legacy 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 & Thermostats | NVESpec (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 Minimization | Fixed-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 & Collisions | FreezeGroup (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 Generators | Complete 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 Geometry | ThermodynamicObservable, 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 & Restarts | Full 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) andDeviceMonteCarloBarostat(MonteCarloBarostatSpec/MonteCarloBarostat) in 2D with area-coupling modes:isotropic(uniformLx, Ly),:x(fixedLy), and:y(fixedLx), using the exact 2D virial pressureP = (2K + W_xx + W_yy) / (2A)and 2D Metropolis acceptance factor(N_units + 1) ln(A'/A)(orN_units ln(A'/A)for uniformΔAproposals).What Already Exists:
cell_volume(st)returns areaA = 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 onVal{D}.Exact Touchpoints:
src/simulation/Barostats.jl— Relax_is_3d(st)in_check_barostat_state; add 2D area-proposal volume/area scaling and:x/:ymode validation.src/engine/barostat/BarostatTypes.jl— ParameterizeDeviceCRescale/DeviceMonteCarloBarostatreference box and scale factors forD = 2(2-componentws.geomlengths, 2-axisGEOMETRY_SHRINKcheck).src/engine/barostat/CRescale.jl,VirialKernels.jl,MCKernels.jl,MCScaleKernels.jl,MCFallback.jl— AddVal{2}branches summingvirial[:, 1] + virial[:, 2](2D trace), 2Dsqrt(A'/A)isotropic scaling (s_x = s_y = exp(η/2)), and 2Dst.box2sync insync_device_box!.src/engine/state/EngineSupport.jl&EngineBuild.jl— Relaxst.rz !== nothing && st.box3 !== nothingin_pressure_control_reasonand_capture_engine.src/workflow/Barostats.jl— Relaxlength(sim.system.box) == 3in_validate_barostat_dynamicsand allow:x/:yin_normalize_barostat_mode.
Estimated Effort: Medium (1-2 weeks; ELL 2D path is clean since
DeviceCRescaleandDeviceMonteCarloBarostatalready 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:
2D cooperative ELL row builder (
build_lanes ∈ {2, 4, 8, 16}) scanning the 9-cell (or(2S+1)^2subdivided) stencil in lockstep with group-masked ballots.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 unrolledS1=trueand generalSx, Systencil forsub > 1) mirroring_cooperative_rows3_kernel!.src/neighbors/DeviceNeighborKernels.jl&DeviceNeighborTypes.jl— Supportsub > 1cell sizing and 2D stencil reach in_device_finish_rebuild!.src/engine/state/EngineSupport.jl(engine_settings) — Calibrate 2D(size_class, density_class)entries inENGINE_SETTINGSonce_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
ConstraintClustersso 2D active/passive rigid molecules (dumbbells/dimersk=1, rigid triangles/polygons, and constrained 2D chains) run with exactFloat64SHAKE/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 overVal{D}(2D dropszregisters and halves SMEM atom footprint for general clusters) and subtractn_constraintsfrom 2D kinetic DOF2N.src/simulation/ConstraintClusterCoupling.jl— Relax 3D checks onattach_constraint_clusters!and compute 2Dkinetic_dof(st)(2N - n_constraints) and 2Dconstraint_virial_trace.src/engine/ConstraintClustersFeature.jl&src/engine/state/Fingerprint.jl— SupportD = 2inafter_position!/after_kick!and_constraint_dof_per_bath.src/workflow/Integrator.jl— AllowConstraintClusterSpecon 2DParticleSystems.
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:
Short-range screened Coulomb (2D Yukawa / DLVO): Available via
YukawaPotential(AbstractPairPotential) on 2D:ell; future work adds a dedicated workflow descriptor (Yukawaforce insrc/workflow/Forces.jl) and multi-type screening matrices.True 2D periodic / 2D-slab long-range electrostatics (for charged colloids on a plane
1/rwith 2D periodicity, or 3D boxes with Yeh-Berkowitz slab correction / 2D spectral Ewald): 2D R2C/C2RCompactFFTand 2D prolate/B-spline mesh spread/gather with the exact 2D Fourier kernel2π / |k|(orerfcslab kernel).
Exact Touchpoints:
src/electrostatics/Spec.jl,Splits.jl,Solver.jl— AddElectrostaticsSpec2D(orboundary=:slab_2d/mesh::NTuple{2,Int}) and 2D reciprocal splitting functions.src/electrostatics/fft/— ReuseXYEvenKernels.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 2DP x PSMEM 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_okandcompile_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
YukawaForcewrapper around existingYukawaPotential).
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,
3x39-shift periodic image encoding instead of 27-shift 3D, and 2D(x, y, q, pad)packedLDG.128tiles) 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: 3DClusterPairs(src/clusterpairs/) assumes 3D(x, y)columns +zbins,2x2x2octants, 5-bit 27-shift encoding (0..26+ sentinel27), 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 to0..8(4 bits), and eliminates allzregister 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), reusingPrimitives.jl,DeviceScan.jl, andFixed64ForceMatrix(SlotPackScatter.jl).src/simulation/ClusterCoupling.jl&src/engine/state/EngineSupport.jl(cluster_supported) — Dispatch:clusterbackend forD == 2once validated.src/engine/run/RunTypes.jl(line 65) — RelaxD == 3gate oncluster !== 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).