1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! # Path Integral Monte Carlo (PIMC) for Quantum Statistical Mechanics
//!
//! This module implements the Path Integral Monte Carlo method, which evaluates
//! quantum-statistical partition functions and observables by representing each
//! particle as a **ring polymer** of `M` imaginary-time beads.
//!
//! ## Background
//!
//! The quantum partition function at inverse temperature `β = 1/(k_B T)` can be
//! written as a path integral (Feynman 1953):
//!
//! ```text
//! Z = ∫ D[r(τ)] exp(−S[r] / ħ)
//! ```
//!
//! where the imaginary-time action is
//!
//! ```text
//! S = ∫₀^β dτ [ (m/2)|ṙ|² + V(r) ]
//! ```
//!
//! Discretising into `M` slices of width `τ = β/M` gives the **primitive
//! approximation** used here.
//!
//! ## Modules
//!
//! | Module | Contents |
//! |--------|----------|
//! | [`config`] | [`PimcConfig`], [`PimcResult`] |
//! | [`paths`] | [`RingPolymer`] ring-polymer paths + Lévy bridge |
//! | [`moves`] | [`SingleBeadMove`], [`CenterOfMassMove`], [`BisectionMove`], [`PimcMove`] |
//! | [`estimators`] | [`EnergyEstimator`] (thermodynamic estimator) |
//! | [`simulator`] | [`PimcSimulator`] main driver |
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use scirs2_integrate::pimc::{
//! config::PimcConfig,
//! simulator::PimcSimulator,
//! };
//!
//! // 1-D quantum harmonic oscillator (ω = 1, ħ = 1, m = 1)
//! // Ground-state energy = ħω/2 = 0.5
//! let cfg = PimcConfig {
//! n_slices: 64,
//! beta: 10.0, // low temperature → ground state
//! n_steps: 10_000,
//! n_thermalize: 1_000,
//! max_displacement: 0.3,
//! seed: 42,
//! ..Default::default()
//! };
//!
//! let mut sim = PimcSimulator::new(
//! cfg,
//! Box::new(|r: &[f64]| 0.5 * r[0] * r[0]),
//! ).unwrap();
//!
//! let result = sim.run().unwrap();
//! println!("Ground-state energy ≈ {:.4}", result.energy_mean);
//! // Expect ~ 0.5
//! ```
// ── Re-exports ────────────────────────────────────────────────────────────────
pub use ;
pub use EnergyEstimator;
pub use ;
pub use RingPolymer;
pub use PimcSimulator;