Distance

class hoomd.md.constrain.Distance(tolerance=0.001)

Bases: Constraint

Constrain pairwise particle distances.

Parameters:

tolerance (float) – Relative tolerance for constraint violation warnings.

Distance applies forces between particles that constrain the distances between particles to specific values. The algorithm implemented is described in:

  1. M. Yoneya, H. J. C. Berendsen, and K. Hirasawa, “A Non-Iterative Matrix Method for Constraint Molecular Dynamics Simulations,” Molecular Simulation, vol. 13, no. 6, pp. 395–405, 1994.

  2. M. Yoneya, “A Generalized Non-iterative Matrix Method for Constraint Molecular Dynamics Simulations,” Journal of Computational Physics, vol. 172, no. 1, pp. 188–197, Sep. 2001.

Each distance constraint takes the form:

\[\chi_{ij}(r) = \mathrm{minimum\_image}(\vec{r}_j - \vec{r}_i)^2 - d_{ij}^2 = 0\]

Where \(i\) and \(j\) are the the particle tags in the constraint_group and \(d_{ij}\) is the constraint distance as given by the system state.

The method sets the second derivative of the Lagrange multipliers with respect to time to zero, such that both the distance constraints and their time derivatives are conserved within the accuracy of the Velocity Verlet scheme (\(O(\delta t^2)\). It solves the corresponding linear system of equations to determine the force. The constraints are satisfied at \(t + 2 \delta t\), so the scheme is self-correcting and avoids drifts.

Add an instance of Distance to the integrator constraints list hoomd.md.Integrator.constraints to apply the force during the simulation.

Warning

In MPI simulations, it is an error when molecules defined by constraints extend over more than half the local domain size because all particles connected through constraints will be communicated between ranks as ghost particles.

Note

tolerance sets the tolerance to detect constraint violations and issue a warning message. It does not influence the computation of the constraint force.


Members inherited from AutotunedObject:

property kernel_parameters

Kernel parameters. Read more...

property is_tuning_complete

Check if kernel parameter tuning is complete. Read more...

tune_kernel_parameters()

Start tuning kernel parameters. Read more...


Members inherited from Force:

additional_energy

Additional energy term. Read more...

additional_virial

Additional virial tensor term \(W_\mathrm{additional}\). Read more...

cpu_local_force_arrays

Local force arrays on the CPU. Read more...

energies

Energy contribution \(U_i\) from each particle. Read more...

energy

The potential energy \(U\) of the system from this force. Read more...

forces

The force \(\vec{F}_i\) applied to each particle. Read more...

gpu_local_force_arrays

Local force arrays on the GPU. Read more...

torques

The torque \(\vec{\tau}_i\) applied to each particle. Read more...

virials

Virial tensor contribution \(W_i\) from each particle. Read more...


Members defined in Distance:

tolerance

Relative tolerance for constraint violation warnings.

Type:

float