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
//! DMRG scalar-energy bindings.
//!
//! Thin safe wrappers around the v0.10.0 stable-ABI entries
//! `moonlab_dmrg_tfim_energy` and `moonlab_dmrg_heisenberg_energy`.
//!
//! For workflows that need the MPS handle, sweep history, or per-bond
//! truncation history, use [`crate::tdvp`] (TDVP) or drop to the
//! `moonlab-sys` FFI directly.
use moonlab_sys as ffi;
/// DMRG ground-state energy of the 1D transverse-field Ising model
/// `H = -sum_i Z_i Z_{i+1} - g sum_i X_i` (J = 1).
///
/// # Arguments
///
/// * `num_sites` - Chain length (>= 2).
/// * `g` - Transverse field ratio h/J. Critical point at g = 1.
/// * `max_bond_dim` - DMRG truncation cap.
/// * `num_sweeps` - Number of two-site DMRG sweeps.
///
/// Returns `f64::INFINITY` (mapped from `DBL_MAX`) on parameter errors;
/// otherwise the converged ground-state energy.
/// DMRG ground-state energy of the 1D XXZ chain with longitudinal field
/// `H = J sum_i (X_i X_{i+1} + Y_i Y_{i+1} + Delta Z_i Z_{i+1})
/// - h sum_i Z_i`.
///
/// # Arguments
///
/// * `num_sites` - Chain length (>= 2).
/// * `j` - Exchange coupling.
/// * `delta` - XXZ anisotropy. `delta = 1` is isotropic Heisenberg.
/// * `h` - Longitudinal field.
/// * `max_bond_dim` - DMRG truncation cap.
/// * `num_sweeps` - Number of two-site DMRG sweeps.
///
/// Returns `f64::INFINITY` (mapped from `DBL_MAX`) on parameter errors;
/// otherwise the converged ground-state energy.