# lcdm

`lcdm` is the main facade crate for **LambdaCDM-Rust**.  
It provides a single, ergonomic entry point that re-exports the commonly used types and modules and offers a convenient `prelude`.

For full documentation, design notes, equations, and implementation details, see:
https://github.com/Feralthedogg/LambdaCDM-Rust

---

## Install

Add to your `Cargo.toml`:

```toml
[dependencies]
lcdm = "0.1.0"
````

---

## Quick Start

Build a cosmology with the builder API, then create a `Cosmology` model and evaluate background observables:

```rust
use lcdm::prelude::*;

fn main() {
    // Build a flat ΛCDM cosmology.
    let params = CosmoBuilder::new()
        .flat()
        .h(0.7)
        .Omega_b(0.05)
        .Omega_m(0.3)
        .neutrino_effective(3.046, vec![0.0])
        .build()
        .unwrap();

    // Construct the background cosmology model.
    let model = Cosmology::new(params);

    // Compute the dimensionless expansion rate E(z) at z = 1.
    let z = Redshift(1.0);
    let ez = model.e_z(z);
    println!("E(z=1) = {}", ez);

    // Compute the comoving radial distance out to z = 1 (in Mpc).
    let dc = model.comoving_radial_distance(z).unwrap();
    println!("Comoving Distance at z=1: {} Mpc", dc.0);
}
```

---

## Growth (LSS)

Compute the linear growth factor `D(z)` (normalized so `D(0)=1`) and growth rate `f(z)`:

```rust
use lcdm::prelude::*;

fn main() {
    let params = CosmoBuilder::new()
        .flat()
        .h(0.7)
        .Omega_b(0.05)
        .Omega_m(0.3)
        .neutrino_effective(3.046, vec![0.0])
        .build()
        .unwrap();

    let model = Cosmology::new(params);

    let z = Redshift(1.0);
    let d = Growth::calculate_growth_factor(&model, z);
    let f = Growth::calculate_growth_rate(&model, z);

    println!("D(z=1) = {}", d);
    println!("f(z=1) = {}", f);
}
```

---

## Prelude

Import everything typically needed with:

```rust
use lcdm::prelude::*;
```

This includes the builder/model types, common unit newtypes (e.g. `Redshift`, `Mpc`), selected specs (`AccuracyPreset`, `NeutrinoSpec`), and LSS helpers.

---

## Links

* Source & full docs: [https://github.com/Feralthedogg/LambdaCDM-Rust](https://github.com/Feralthedogg/LambdaCDM-Rust)
* Crate: [https://crates.io/crates/lcdm](https://crates.io/crates/lcdm)
