Tuning the Hybrid Monte Carlo (HMC) updating scheme in ALF. HMC is available for models with continuous auxiliary fields (OP_V%type=3).
Reference: The algorithm is derived in the documentation (PDF), Section on Hybrid Monte Carlo.
Parameters¶
All HMC parameters are set in the &VAR_QMC namelist in the parameters file.
| Parameter | Default | Type | Description |
|---|---|---|---|
HMC | .false. | Logical | Enable HMC updates |
Delta_t_Langevin_HMC | 0.0 | Real | Leap-frog integration step size |
Leapfrog_Steps | 0 | Integer | Number of leap-frog steps per trajectory |
N_HMC_sweeps | 1 | Integer | Number of HMC trajectories between sequential sweeps |
Sequential | .true. | Logical | Keep sequential single-site updates active alongside HMC |
The trajectory length is = Delta_t_Langevin_HMC × Leapfrog_Steps.
Example¶
&VAR_QMC
HMC = .true.
Sequential = .true.
Delta_t_Langevin_HMC = 0.1d0
Leapfrog_Steps = 10
N_HMC_sweeps = 5
NSweep = 100
NBin = 20
Nwrap = 10
/Guidelines¶
Step Size and Acceptance Rate¶
The leap-frog integrator introduces an discretization error in the Hamiltonian. The Metropolis accept/reject step corrects for this, but large errors lead to low acceptance.
Target acceptance rate: ~70–80%.
Check the acceptance rate in the
infofile after a run (Acceptance_HMC).If acceptance is too low: reduce
Delta_t_Langevin_HMC.If acceptance is very high (>95%): you’re being too conservative — increase
Delta_t_Langevin_HMCorLeapfrog_Stepsto explore phase space faster.
Trajectory Length¶
The trajectory length controls how far each HMC proposal moves in configuration space.
Too short: proposals are close to the current state (inefficient, like random walk).
Too long: computational cost per trajectory is high without proportional gain.
A reasonable starting point is .
Combining with Sequential Updates¶
Always keep Sequential = .true. when using HMC. The documentation explicitly warns:
“In order to address potential ergodicity issues it is crucial to integrate both sequential and hybrid molecular dynamics moves, rather than relying solely on hybrid molecular dynamics.”
N_HMC_sweeps controls how many HMC trajectories are performed between sequential sweeps. Increasing this value shifts the balance toward HMC moves.
Mass Matrix (Apply_B_HMC)¶
The HMC Hamiltonian is:
where is a positive-definite mass matrix. It is factored as , with the constraint .
By default, (identity) — the base implementation of Apply_B_HMC in the code is a no-op.
A non-trivial mass matrix can precondition the dynamics:
Assign larger mass to fast modes → they evolve slowly in HMC time.
Assign smaller mass to slow modes → they evolve faster.
This can significantly reduce autocorrelation times.
To use a custom mass matrix, override the Apply_B_HMC subroutine in your Hamiltonian submodule. It receives a force/momentum array and a logical flag ltrans:
ltrans = .false.: apply (used in momentum updates)ltrans = .true.: apply (used in position updates)
Note: No shipped Hamiltonians currently override
Apply_B_HMC. This is an advanced feature for users who understand the mode structure of their model.
Validation¶
The documentation provides a validation benchmark: 6-site Hubbard chain at :
| Method | |
|---|---|
| HMC only | |
| Discrete sequential |
Use small exact-diagonalization benchmarks like this to validate your HMC setup before production runs.
Known Pitfalls¶
HMC requires continuous fields. If any interaction vertex has
OP_V%type ≠ 3, the code will terminate with an error. SetContinuous = .true.in your Hamiltonian namelist (e.g.&VAR_Hubbard).Forgetting to enable HMC. Setting
Delta_t_Langevin_HMCandLeapfrog_StepswithoutHMC = .true.has no effect.Zero defaults. Both
Delta_t_Langevin_HMCandLeapfrog_Stepsdefault to0— you must set both to nonzero values.Langevin vs. HMC. The
Delta_t_Langevin_HMCparameter is shared between Langevin and HMC dynamics. Do not enable both simultaneously unless you understand the interplay.