Thermostats¶
This section describes the thermostats used in Cavity HOOMD for temperature control of both molecular and photonic degrees of freedom.
Overview¶
Thermostats maintain system temperature by coupling to an external heat bath. For cavity simulations, we need thermostats for:
Molecular degrees of freedom: Control molecular temperature
Photonic degrees of freedom: Represent cavity dissipation
Cavity HOOMD supports three main thermostats:
Bussi-Donadio-Parrinello (Bussi): Stochastic velocity rescaling
Langevin: Friction and random force
None: Microcanonical (NVE) ensemble
Bussi-Donadio-Parrinello Thermostat¶
Theory¶
The Bussi thermostat [Bussi2007] generates correct canonical ensemble statistics through stochastic velocity rescaling.
Algorithm:
At each step, rescale velocities by factor \(\alpha\):
where \(\alpha\) is chosen to drive kinetic energy toward target value while preserving canonical distribution.
Kinetic energy evolution:
Where:
\(K(t)\): Current kinetic energy
\(K_{\text{target}} = \frac{1}{2}N_f k_B T\): Target kinetic energy
\(N_f\): Number of degrees of freedom
\(\tau\): Coupling time constant
\(R\): Gaussian random variable
Properties:
Exact canonical ensemble
Fast equilibration
Minimal perturbation to dynamics
Works for small systems
Detailed Derivation¶
The Bussi-Parrinello thermostat is derived by analyzing standard Langevin dynamics where each particle experiences independent friction and noise:
where \(\boldsymbol{\eta}_i(t)\) are independent white noise processes with \(\langle\boldsymbol{\eta}_i(t)\boldsymbol{\eta}_j(t')\rangle = \boldsymbol{\delta}_{ij}\delta(t-t')\).
Energy Evolution:
Calculating the time derivative of total energy \(H(t)\) using the Ito chain rule and summing over all noise terms yields:
where \(\bar{K} = \frac{3}{2}Nk_BT\), \(\tau_\mathrm{b} = (2\gamma_\mathrm{b})^{-1}\), and \(\eta(t)\) is a single global white noise emerging from the sum of \(3N\) independent noise terms.
Key Observation:
Only the total kinetic energy \(K\) appears in the energy evolution. We can design an alternative stochastic force \(\mathbf{G}_i\) that depends globally on \(K\) and reproduces the same rate of energy exchange while minimizing perturbations to individual particle trajectories.
Minimizing Disturbance:
Quantify the disturbance on kinetic energy as:
and minimize it subject to the constraint that \(\dot{H}(t)\) matches the Langevin result. Geometrically, the constraint forces \(\mathbf{G}_i\) to be parallel to each momentum vector:
where the scalar functions \(\gamma_K\) and \(D_K\) depend on the total kinetic energy \(K\) and are determined by matching the energy evolution:
Enforcing equality with the Langevin energy equation gives:
Equations of Motion:
Physical Interpretation:
This thermostat samples the canonical ensemble exactly while preserving short-time velocity autocorrelation functions, which are critical for maintaining correct microscopic dynamics in supercooled liquids. For a single degree of freedom (\(N=1\)), it reduces to standard Langevin dynamics, whereas in many-particle systems, the global coupling reduces dynamical artifacts from bath coupling.
Parameters¶
Coupling time τ:
Typical values:
τ = 0.1 ps: Very strong coupling (fast equilibration)
τ = 1.0 ps: Standard (recommended)
τ = 10 ps: Weak coupling (near NVE)
Choosing τ:
Fast equilibration: τ ~ 0.1-1.0 ps
Dynamics studies: τ ~ 1-10 ps
Near-NVE: τ > 10 ps
Usage in Cavity HOOMD¶
For molecules:
from hoomd.bussi_reservoir import BussiReservoir
bussi = BussiReservoir(
kT=0.01, # Temperature in reduced units (100 K)
tau=1.0 # Coupling time in ps
)
molecular_filter = hoomd.filter.Type(['O', 'N'])
integrator.methods.append(
hoomd.md.methods.ConstantVolume(
filter=molecular_filter,
thermostat=bussi
)
)
For cavity:
cavity_filter = hoomd.filter.Type(['Cavity'])
integrator.methods.append(
hoomd.md.methods.ConstantVolume(
filter=cavity_filter,
thermostat=bussi
)
)
Langevin Thermostat¶
Theory¶
The Langevin equation adds friction and random force:
Where:
\(\vec{F}\): Deterministic force
\(\gamma\): Friction coefficient
\(\vec{F}_{\text{random}}\): Random force satisfying fluctuation-dissipation theorem
Fluctuation-dissipation:
Integration schemes:
Various algorithms exist (BBK, BAOAB, etc.). HOOMD uses optimized schemes.
Caldeira-Leggett Cavity Bath Model¶
Even in high-quality optical cavities, photons are lost due to radiative losses through imperfect mirrors. We model this dissipation through coupling with a thermal electromagnetic environment outside the cavity.
Bath Hamiltonian:
Following the Caldeira-Leggett approach, couple the cavity mode coordinate \(q_\mathrm{c}\) (frequency \(\omega_\mathrm{c}\), unit mass) linearly to a continuum of bath oscillators:
where \((x_b, p_b)\) are bath oscillator coordinates with frequencies \(\omega_b\) and coupling constants \(c_b\).
Generalized Langevin Equation:
Integrating out the bath degrees of freedom yields:
where the memory kernel and noise correlation are related through the spectral density:
with the friction kernel and noise correlations:
Markovian Limit:
In the Ohmic, Markovian limit where \(J(\omega) \approx \gamma_\mathrm{c}\omega\) with a high-frequency cutoff, the memory kernel becomes instantaneous, \(G(t) \approx 2\gamma_\mathrm{c}\delta(t)\), yielding standard Langevin dynamics.
Cavity Lifetime:
The lifetime of the cavity \(\tau_\mathrm{c}\) is related to the damping rate through \(\gamma_\mathrm{c} = 1/(2\tau_\mathrm{c})\). When coupling is turned on, \(q_\mathrm{c} \to q_\mathrm{c} + \lambda\mu_\alpha/\omega_\mathrm{c}\), the damping and noise statistics remain unchanged while the deterministic force acquires the coupling term.
Physical Interpretation:
This model captures the essential physics of cavity dissipation: photons leak out through mirrors, and thermal photons leak in from the environment. The balance between these processes maintains the cavity at temperature \(T\).
Parameters¶
Friction coefficient γ:
where τ is the damping timescale.
Typical values:
γ = 0.1 ps⁻¹: Weak damping (near NVE)
γ = 1.0 ps⁻¹: Moderate damping
γ = 10 ps⁻¹: Strong damping (overdamped)
Physical interpretation:
τ = 1/γ is the momentum relaxation time
After time τ, velocity correlation decays to e⁻¹ ≈ 37%
Usage in Cavity HOOMD¶
For molecules:
molecular_filter = hoomd.filter.Type(['O', 'N'])
langevin = hoomd.md.methods.Langevin(
filter=molecular_filter,
kT=0.01, # Temperature
default_gamma=1.0 # Friction coefficient
)
integrator.methods.append(langevin)
For cavity (represents dissipation):
cavity_filter = hoomd.filter.Type(['Cavity'])
cavity_langevin = hoomd.md.methods.Langevin(
filter=cavity_filter,
kT=0.01,
default_gamma=0.1 # Lower γ for cavity
)
integrator.methods.append(cavity_langevin)
Physical meaning for cavity:
γ_cavity represents photon loss rate (cavity linewidth κ).
Microcanonical (NVE) Ensemble¶
Theory¶
Without thermostat, total energy is conserved:
Equations of motion:
Standard Hamiltonian dynamics with energy-conserving integrator (Velocity Verlet).
Properties:
✓ Exact energy conservation (within numerical precision)
✓ Deterministic dynamics
✓ No artificial damping
✗ Temperature may drift if not initialized properly
✗ No temperature control
Usage in Cavity HOOMD¶
Setup:
Don’t add any thermostat. Just use ConstantVolume with no thermostat parameter:
all_particles = hoomd.filter.All()
integrator.methods.append(
hoomd.md.methods.ConstantVolume(filter=all_particles)
)
When to use:
Energy conservation tests
Short-time dynamics (< 10 ps)
Microcanonical ensemble studies
Validating implementation
Hybrid Thermostat Strategies¶
Molecular + Cavity Combinations¶
Different thermostat combinations serve different purposes:
1. Bussi (molecules) + Langevin (cavity) [Recommended]
--molecular-bath bussi --cavity-bath langevin
Rationale:
Molecules: Canonical ensemble, fast equilibration
Cavity: Physical dissipation (represents photon loss)
Use for: Most production simulations
2. Bussi (molecules) + Bussi (cavity)
--molecular-bath bussi --cavity-bath bussi
Rationale:
Both subsystems in canonical ensemble
Useful for equilibrium thermodynamics
Use for: Studying equilibrium properties
3. None (molecules) + None (cavity)
--molecular-bath none --cavity-bath none
Rationale:
Pure NVE dynamics
No energy exchange with bath
Total energy conserved
Use for: Energy conservation testing, short-time dynamics
4. Langevin (molecules) + Langevin (cavity)
--molecular-bath langevin --cavity-bath langevin
Rationale:
Both damped and stochastic
Strongly dissipative
Use for: High-friction systems, overdamped dynamics
Energy Flow Considerations¶
With thermostats:
where \(P_{\text{thermostat}}\) is power injected/removed by thermostat.
Energy balance:
Thermostats maintain temperature by absorbing/injecting energy
Total energy NOT conserved (as expected for canonical ensemble)
Temperature IS controlled
Monitoring:
Track both energy and temperature to ensure proper thermostat function.
Temperature Measurement¶
Kinetic Temperature Definition¶
Standard definition:
Where \(N_f\) is number of degrees of freedom.
For molecules:
For cavity:
where \(N_\lambda\) is number of polarizations.
Equipartition Check¶
At equilibrium:
Each quadratic degree of freedom should have energy \(\frac{1}{2}k_B T\).
Check:
Deviation > 5% indicates:
Non-equilibrium state
Thermostat malfunction
Insufficient equilibration time
Equilibration Protocol¶
Standard Procedure¶
1. Initial configuration (t=0):
Generate or load initial positions
Assign velocities from Maxwell-Boltzmann distribution at target T
2. Equilibration phase (0 < t < t_eq):
Use strong thermostat (Bussi with τ=0.1-1.0 ps)
Monitor temperature, energy, pressure
Run until properties stabilize (typically 10-100 ps)
3. Production phase (t > t_eq):
Switch to production thermostat settings
Begin data collection
Run for desired simulation time
Equilibration Checks¶
Temperature stability:
Energy fluctuations:
Should match expected fluctuations for canonical ensemble.
Autocorrelation:
Check that observables decorrelate:
as \(t \to \infty\).
Special Considerations for Cavity Systems¶
Cavity Lifetime¶
Physical cavity lifetime:
where κ is photon loss rate.
Langevin thermostat maps:
Typical experimental values:
High-Q cavity: κ ~ 0.01 ps⁻¹ (τ ~ 100 ps)
Medium-Q: κ ~ 0.1 ps⁻¹ (τ ~ 10 ps)
Low-Q: κ ~ 1.0 ps⁻¹ (τ ~ 1 ps)
Thermalization Timescales¶
Molecular thermalization:
Cavity thermalization:
Energy exchange time:
Hierarchy:
Typically \(\tau_{\text{exchange}} < \tau_{\text{mol}} < \tau_{\text{cavity}}\)
Next Sections¶
Continue to:
Energy Conservation for energy analysis with thermostats
Strong Coupling for polariton dynamics
Running Simulations for practical thermostat selection
Bussi, D. Donadio, and M. Parrinello, J. Chem. Phys. 126, 014101 (2007)