Loading...
Searching...
No Matches
HarmonicBeadCorrection.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
6#pragma once
7#include <cmath>
8#include <stdexcept>
9
10// Exact bead correction of a harmonic ring mode. For u = beta hbar omega the
11// N-bead ring partition function is Z_N = 1/(2 sinh(N asinh(u/(2N)))), so the
12// correction that converts a finite-N harmonic factor to the continuum is
13//
14// ln Z_inf - ln Z_N = ln sinh(N asinh(u/2N)) - ln sinh(u/2).
15//
16// With the phase deficit delta = u/2 - N asinh(u/2N), certified for u/N <= 1/2
17// by bead_correction_bounds.sollya as
18// u^3/(48N^2) - 3u^5/(1280N^4) <= delta <= u^3/(48N^2),
19// the correction is -delta - ln[(1 - exp(-u)) / (1 - exp(-u + 2 delta))],
20// which stays finite for stiff modes at low temperature where sinh overflows.
22
23struct Correction {
24 double logPartitionCorrection = 0; // ln Z_inf - ln Z_N
25 double phaseDeficit = 0; // u/2 - N asinh(u/2N)
26 bool certifiedRegime = false; // u/N <= 1/2
27 double deficitLower = 0, deficitUpper = 0;
28};
29
30inline Correction harmonic(double u, int beads)
31{
32 if (!(u > 0) || !std::isfinite(u) || beads < 1)
33 throw std::invalid_argument(
34 "Positive finite u and at least one bead required");
35 const double N = beads;
36 Correction c;
37 const double phase = N * std::asinh(u / (2 * N));
38 c.phaseDeficit = u / 2 - phase;
39 // ln sinh(a) = a + log1p(-exp(-2a)) - ln 2, stable for large a.
40 const auto logSinh = [](double a) {
41 return a + std::log1p(-std::exp(-2 * a)) - std::log(2.);
42 };
43 c.logPartitionCorrection = logSinh(phase) - logSinh(u / 2);
44 c.certifiedRegime = u / N <= .5;
45 if (c.certifiedRegime) {
46 c.deficitUpper = u * u * u / (48 * N * N);
47 c.deficitLower =
48 c.deficitUpper - 3 * std::pow(u, 5) / (1280 * std::pow(N, 4));
49 }
50 return c;
51}
52} // namespace gpr::quantum::beadcorrection
Correction harmonic(double u, int beads)