Skip to content

About

Causal Dynamical Triangulations built on fast Delaunay triangulation primitives.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

Β 

History

553 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

causal-triangulations

DOI Crates.io Downloads License Docs.rs CI CodeQL zizmor rust-clippy analyze Codecov Audit dependencies OSV-Scanner Gitleaks

Causal Dynamical Triangulations for quantum gravity in Rust, built on fast Delaunay triangulation primitives and composable, adaptable Metropolis-Hastings sampling.

Seven circular slices form a cylinder. Time points up. Blue triangles have a base on the earlier slice and red triangles on the later slice.

Illustration of a 1+1 CDT cylinder. Each spatial slice is a circle (SΒΉ), and the first and last time slices are its two boundaries.

Contents

🌌 Introduction

This library implements Causal Dynamical Triangulations (CDT) in Rust. CDT is a non-perturbative approach to quantum gravity defining the gravitational path integral over causally triangulated spacetimes and evaluating it using Markov Chain Monte Carlo. For an introduction to CDT, see AmbjΓΈrn and Loll (1998), β€œNon-perturbative Lorentzian quantum gravity, causality and topology change”. The library leverages high-performance Delaunay triangulation backends and provides a foundational toolkit for CDT research and exploration.

Use this crate when

Use this crate for 1+1 CDT simulations on strips or tori, with resumable Metropolis-Hastings runs and finite-lattice diagnostics through Rust, the CLI, or notebooks.

API and model scope

See the CDT model for supported geometries, boundary conditions, and initial-size requirements.

Need API entry point
Configure a run prelude::config and CdtConfig::into_validated
Construct and inspect CDT states prelude::triangulation
Evaluate an action prelude::action
Measure profiles and finite-graph observables prelude::observables
Run or resume a simulation prelude::simulation

The API reference describes the latest published crate. For a local API build, see the development guide.

Sampling interfaces

Use MetropolisAlgorithm for embedded strips and tori, including checkpointed runs. For coordinate-independent periodic sampling, use IntrinsicCdtTriangulation with IntrinsicCdtProposal and CdtTarget through Chain::step_delayed. Both interfaces are in prelude::simulation.

✨ Features

  • Alexander/Pachner-style local move proposals with causal constraints
  • Command-line interface, examples, Criterion benchmarks, and CI-aligned validation tooling
  • Cross-platform compatibility: Linux, macOS, Windows
  • Delaunay-built 1+1 CDT strip and periodic toroidal SΒΉΓ—SΒΉ constructors with foliation invariants
  • Focused public preludes for simulation, triangulation, geometry, action, and observables
  • Foliation-aware topology, causality, and simplex-classification validation
  • Notebook-first quickstart for physicists, AI/ML users, and Rust contributors
  • Proposal-before-mutation Metropolis-Hastings simulation with rollback on failed accepted moves
  • Regge action calculation with configurable coupling constants
  • Spatial-vertex input profiles, circular spatial-loop measurements, slab-triangle profiles, and finite-window effective dimensional observables
  • Explicit quadratic triangle-volume fixing and upstream-backed dependence diagnostics; see chain analysis
  • Trace CSV simulation output for external analysis workflows; JSON summary/metadata for CLI/config export
  • Versioned JSON checkpoints for exact MCMC continuation, using Delaunay's Level 4 snapshot with checked geometry and CDT state restoration; see the checkpoint compatibility policy

See CHANGELOG.md for release history and docs/roadmap.md for current direction, near-term candidates, and non-goals.

Feature flags

  • cli (default) provides the cdt simulation binary, the cdt-validation chain runner, CdtConfig::{from_args, try_from_args}, and the validation bundle API in prelude::simulation::validation.
  • slow-tests enables the large toroidal checkpoint stress test.

πŸš€ Quickstart

For Rust library use, run cargo add causal-triangulations to add the published crate. Set default-features = false for a library-only build. This example constructs a torus with four vertices per slice and three time slices.

use causal_triangulations::prelude::errors::CdtResult;
use causal_triangulations::prelude::triangulation::CdtTriangulation;

fn main() -> CdtResult<()> {
    let tri = CdtTriangulation::from_toroidal_cdt(4, 3)?;
    assert_eq!(tri.vertex_count(), 12);
    tri.validate_topology()?;
    tri.validate_foliation()?;
    Ok(())
}

From a repository checkout, follow prerequisite setup, then run a small seeded simulation:

just run -- --vertices-per-slice 4 --timeslices 5 --steps 100 \
  --thermalization-steps 10 --measurement-frequency 10 --seed 105 --simulate \
  --output-csv target/quickstart/trace.csv --output-json target/quickstart/summary.json
just  # Discover every public command, its arguments, and its purpose

This creates a 20-vertex open-boundary strip, attempts 100 Metropolis proposals, and writes one CSV trace row per step plus JSON measurements and final mesh. Parent directories are created automatically. Accepted volume-changing moves can change the final size.

For interactive exploration:

just notebook-setup
just notebook

The quickstart notebook runs the cdt engine and plots its CSV/JSON outputs. Rust 1.100.0 or newer is required; repository tooling and notebooks use the declared uv environment. See CLI workflows for scriptable runs and cluster workflows for Slurm and Open OnDemand.

Checkpointing

CdtMcmcCheckpoint stores the embedded geometry, chain state and both random number generators needed to resume a run. Serializing a standalone CdtTriangulation2D saves the geometry alone. See the checkpoint compatibility policy for the format and restoration checks.

use causal_triangulations::prelude::simulation::*;

fn main() -> CdtResult<()> {
    let checkpoint = MetropolisAlgorithm::new(
        MetropolisConfig::new(1.0, 1, 0, 1)?.with_seed(13),
        ActionConfig::default(),
    )
    .run_to_checkpoint(CdtTriangulation::from_cdt_strip(4, 3)?)?;
    let json = checkpoint.to_json()?;
    let restored = CdtMcmcCheckpoint::from_json(&json)?;
    assert_eq!(CdtMcmcCheckpoint::FORMAT_VERSION, 5);
    assert_eq!(restored.current_step().get(), 1);
    Ok(())
}

πŸ§ͺ Scientific Basis

The scientific basis owns action calibration, ensemble and volume behavior, Hilbert order for embedded proposal sites, validation limits, and downstream analysis responsibilities. Move semantics and detailed-balance notes live in the move guide and the sampler guide.

Finite-volume validation

All four tori passed the independent fixed-volume validation. I computed the exact distribution of labeled spatial loop lengths from AmbjΓΈrn and Loll’s 1998 transfer matrix and compared it with 32 fresh intrinsic 1+1 CDT chains, eight per torus. The chains recorded 17,203,373 visits to the target volumes in 72,351,744 scheduled measurements.

Time slices Triangles Profiles visited / admissible 95% upper bound on total-variation distance Moments passing
4 32 35 / 35 0.00946 14 / 14
4 40 165 / 165 0.02656 14 / 14
4 48 455 / 455 0.02936 14 / 14
8 64 6,435 / 6,435 0.01876 44 / 44

All four distance bounds met the 0.05 limit. All 86 labeled means, variances, and covariances met their point tolerances and their joint 95% intervals covered the exact values. At 64 triangles the covariance of slices 2 and 3 was βˆ’0.039590 against βˆ’0.039838 exact, a 0.62% error within the 5% limit. From a repository checkout, run cargo bench --locked --bench finite_volume to collect all 32 chains with the published seeds and score them against the transfer-matrix prediction. Compare assessment/report.json in the printed output directory with the published results. To collect a chain with a seed of your choice and verify its raw measurements, follow the external validation guide.

πŸ—Ί Documentation Map

The documentation index maps user, scientific, and contributor guides.

  • CDT Spacetime Visualization notebook β€” example 1+1 CDT mesh visualization generator
  • CLI Examples β€” command-line usage and output workflows
  • Code Organization β€” module layout, backend boundaries, and architecture notes
  • Example Scripts β€” maintained shell workflows for simulations, sweeps, and timing checks
  • Foliation β€” time labels, spacelike/timelike classification, causality validation, and toroidal time handling
  • HPC Notebook Workflows β€” Slurm, Open OnDemand, and cluster cache setup
  • Metropolis β€” proposal-before-mutation ordering, detailed balance, trace semantics, and sampler/backend boundaries
  • Moves β€” CDT local move semantics, proposal ratios, rollback behavior, and action calibration
  • Polars Analysis Caches notebook β€” local Parquet caches and diagnostic plots for debugging CDT CSV/JSON outputs
  • Quickstart notebook β€” notebook-first local 1+1 CDT run, parameter meanings, output files, and troubleshooting
  • References β€” physics, numerical, and computational-geometry citations
  • Roadmap β€” near-term work, higher-dimensional topology tracks, and non-goals
  • Scientific Basis β€” CDT scope, validated invariants, current ensemble, and interpretation boundaries

🧩 Ecosystem

This crate is part of a broader Rust ecosystem for computational geometry and simulation:

  • delaunay β€” geometric primitives and triangulations
  • la-stack β€” interval and exact arithmetic for assigning CDT time slices, bounding actions, and checking tolerances
  • markov-chain-monte-carlo β€” composable MCMC traits, including plan-before-commit proposals for CDT move ordering

See geometry and sampling responsibilities for the boundaries between these crates.

πŸ“ˆ Benchmarking

The full performance report lists the measured workloads and their confidence intervals. To compare Criterion timings before and after a change on the same host, follow the local baseline procedure.

Run: ee9641e993073a8313a4ab0622e1d23a65ff576549124e4739815c317e31275c. Statistic: median. Unit: ns. Confidence level: 95%.

  • Current: current phase, v0.2.0 working-tree snapshot based on commit ce3756b4e98378f542e087cf767cf231f71b4203; measured source SHA-256 89304ecf1d7af0f8f668a56db9fffa3f0db2816d06bf43c73998e17baed602c4.
Case Current
State-dependent Metropolis proposal 2.74786e+07
[2.74416e+07, 2.75304e+07]

Intervals are recorded marginal timing intervals; ratios are point estimates, with no ratio intervals or significance claims. Time reduction is 100 Γ— (numerator βˆ’ denominator) / numerator; positive means less denominator time.

Selection coverage:

See benches/README.md for benchmark details and docs/BENCHMARKING.md for comprehensive performance testing workflow documentation.

πŸ›£ Roadmap

The high-level roadmap, including 1+1 maturity work, future 2+1 and 3+1 CDT topology tracks, observables, dual/Voronoi geometry, visualization, and non-goals, lives in docs/roadmap.md.

🀝 Contributing

See CONTRIBUTING.md for the full contributor guide: project layout, development workflow, code style, testing, documentation layout, performance/benchmarking, and release support. Community expectations live in CODE_OF_CONDUCT.md. AI assistants should follow AGENTS.md.

The contributor guide owns setup, checks, fixes, tests, security scans, and PR preparation.

πŸ“š Citation

If you use this software in academic work or downstream research software, cite the Zenodo DOI and include the software metadata from CITATION.cff.

@software{getchell_causal_triangulations,
  author = {Adam Getchell},
  title = {causal-triangulations: A Causal Dynamical Triangulation library for quantum gravity research},
  doi = {10.5281/zenodo.20513228},
  url = {https://github.com/acgetchell/causal-triangulations}
}

For release-specific fields such as version, release date, and ORCID, prefer CITATION.cff.

πŸ”Ž References

For a comprehensive list of academic references and bibliographic citations used throughout the library, see REFERENCES.md.

This includes foundational work on:

  • Causal Dynamical Triangulations theory
  • Monte Carlo methods in quantum gravity
  • Computational geometry and Delaunay triangulations
  • Discrete approaches to general relativity

πŸ€– AI Agents

AI coding assistants should read AGENTS.md before proposing or applying changes. See CONTRIBUTING.md for the repository's AI-assisted development note.

πŸ“œ License

This project is licensed under the BSD 3-Clause License.


About

Causal Dynamical Triangulations built on fast Delaunay triangulation primitives.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages