Numerical Notes
Constraint Tolerances and Thermostat Parameters
When using langevin_baoab_constrained!
, the SHAKE and RATTLE solvers enforce distance constraints up to the tolerance specified in DistanceConstraints
.
Interplay with γ
and T
- Larger friction
γ
and higher temperatureT
produce stronger stochastic kicks in the OU step. - This may increase the number of iterations needed for constraint convergence.
- If the solver fails to converge within
maxiter
, consider relaxingtol
slightly.
Mass Variance
Constraints involving very light particles (e.g. hydrogens) can converge more slowly if highly coupled with heavier atoms. This is expected and usually acceptable for simple bond constraints.
Degrees of Freedom and Temperature
The function instantaneous_temperature
uses the full degrees of freedom by default. For constrained systems, users who want diagnostics consistent with statistical mechanics should instead call:
degrees_of_freedom(ps; constraints=cons, remove_com=false)
and use this value in temperature calculations.
Reproducibility
The stochastic step uses the provided RNG. Set a fixed seed (e.g. rng = MersenneTwister(1234)
) in tests or benchmarks for reproducibility.
See also: constraint_residuals
for monitoring how well constraints are satisfied.