Rescale velocities¶
This module rescales particle velocities to satisfy a selected constraint, depending on the mode of operation, such that a given target energy \(E_\text{target}\) matches either
the total energy (micro-canonical,
nve
) orthe kinetic energy (
isokinetic
)
of either (a) the whole system or (b) each particle separately.
The rescale operation conserves the direction of velocities, it adjusts only their magnitude. The scaling factor \(\lambda\) is calculated as:
\[\lambda = \sqrt{\frac{E_\text{target} - \alpha E_\text{pot}}{E_\text{kin}}} \,,\]
where \(\alpha = 1\) in the micro-canonical mode (1) and \(\alpha = 0\) in the iso-kinetic mode (2). In case (a), the same factor \(\lambda\) is applied to the whole system (all particles) and the potential and kinetic energies, \(E_\text{pot}\) and \(E_\text{kin}\), are averages over all particles, respectively (before rescaling). In case (b), \(\lambda\) is calculated for each particle separately, using the individual energy values.
- class halmd.mdsim.velocities.rescale(args)¶
Construct rescale module.
- Parameters:
args (table) – keyword arguments
args.particle – instance of
halmd.mdsim.particle
args.target_energy (number) – desired energy value (either total or kinetic energy)
args.mode (string) – mode of operation (
nve
orisokinetic
)args.per_particle (boolean) – perform rescaling per particle (default: false)
If the
mode
of operation isnve
, the target energy refers to the total energy. If the mode isisokinetic
, the target energy refers to the kinetic energy.If the switch
per_particle
is set totrue
, the rescaling is performed for each particle separately, otherwise the same factor is applied to all particles.- set()¶
Rescale particle velocities.
- target_energy¶
Target energy value (assignable)
In
nve
mode, it refers to the total energy (kinetic plus potential parts) whereas it refers to the kinetic energy inisokinetic
mode.