|
occ
|
Rigid body molecular dynamics integrator. More...
#include <rigid_body_dynamics.h>
Classes | |
| struct | Config |
| Configuration for MD simulations. More... | |
Static Public Member Functions | |
| static void | velocity_verlet_step (std::vector< RigidBodyState > &molecules, double dt) |
| Perform one velocity Verlet integration step. | |
| static void | compute_forces_torques (std::vector< RigidBodyState > &molecules) |
| Compute forces and torques on all molecules (S-function engine) | |
| static double | compute_forces_torques_cartesian (std::vector< RigidBodyState > &molecules) |
| Compute forces and torques using Cartesian T-tensor engine. | |
| static void | update_positions (std::vector< RigidBodyState > &molecules, double dt) |
| Update positions using current velocities (half-step) | |
| static void | update_velocities (std::vector< RigidBodyState > &molecules, double dt, bool first_half) |
| Update velocities using forces (half-step) | |
| static void | update_orientations_quaternion (std::vector< RigidBodyState > &molecules, double dt) |
| Update orientations using quaternion integration. | |
| static void | update_angular_velocities (std::vector< RigidBodyState > &molecules, double dt, bool first_half) |
| Update angular velocities using torques (half-step) | |
| static double | compute_kinetic_energy (const std::vector< RigidBodyState > &molecules) |
| Compute total kinetic energy of system. | |
| static double | compute_potential_energy (const std::vector< RigidBodyState > &molecules) |
| Compute total potential energy of system (S-function engine) | |
| static double | compute_potential_energy_cartesian (const std::vector< RigidBodyState > &molecules) |
| Compute total potential energy using Cartesian engine. | |
| static double | compute_total_energy (const std::vector< RigidBodyState > &molecules) |
| Compute total energy (kinetic + potential) | |
| static Vec3 | compute_linear_momentum (const std::vector< RigidBodyState > &molecules) |
| Compute total linear momentum of system. | |
| static Vec3 | compute_angular_momentum (const std::vector< RigidBodyState > &molecules) |
| Compute total angular momentum of system. | |
| static void | normalize_quaternions (std::vector< RigidBodyState > &molecules) |
| Normalize all quaternions in the system. | |
Rigid body molecular dynamics integrator.
This class implements the velocity Verlet algorithm for rigid body dynamics, integrating both translational and rotational equations of motion.
The quaternion-based formulation avoids gimbal lock and provides numerical stability for arbitrary rotations.
|
static |
Compute total angular momentum of system.
| molecules | Vector of rigid bodies |
|
static |
Compute forces and torques on all molecules (S-function engine)
Calculates pairwise multipole interactions and updates force/torque on each molecule using the S-function/Euler-angle-based engine.
| molecules | Vector of rigid body states |
|
static |
Compute forces and torques using Cartesian T-tensor engine.
Calculates pairwise multipole interactions using the Cartesian engine, which computes energy, forces, and torques in a single pass per pair. Supports multi-site molecules.
This is generally faster than compute_forces_torques() since:
| molecules | Vector of rigid body states |
|
static |
Compute total kinetic energy of system.
| molecules | Vector of rigid bodies |
|
static |
Compute total linear momentum of system.
| molecules | Vector of rigid bodies |
|
static |
Compute total potential energy of system (S-function engine)
| molecules | Vector of rigid bodies |
|
static |
Compute total potential energy using Cartesian engine.
Faster than compute_potential_energy() for multi-site molecules.
| molecules | Vector of rigid bodies |
|
static |
Compute total energy (kinetic + potential)
| molecules | Vector of rigid bodies |
|
static |
Normalize all quaternions in the system.
Call this periodically to prevent numerical drift from unit quaternion constraint.
| molecules | Vector of rigid bodies |
|
static |
Update angular velocities using torques (half-step)
Integrates Euler's equation in body frame: dL/dt = tau - omega x L
| molecules | Vector of rigid bodies |
| dt | Timestep |
| first_half | If true, do first half-step; if false, do second half-step |
|
static |
Update orientations using quaternion integration.
Integrates quaternion using angular velocity in body frame: dq/dt = (1/2) * q * omega_quat
| molecules | Vector of rigid bodies |
| dt | Timestep |
|
static |
Update positions using current velocities (half-step)
r(t+dt) = r(t) + v(t)*dt + (1/2)*a(t)*dt^2
| molecules | Vector of rigid bodies |
| dt | Timestep |
|
static |
Update velocities using forces (half-step)
v(t+dt) = v(t) + (1/2)*[a(t) + a(t+dt)]*dt
| molecules | Vector of rigid bodies |
| dt | Timestep |
| first_half | If true, do first half-step; if false, do second half-step |
|
static |
Perform one velocity Verlet integration step.
This integrates both translational and rotational degrees of freedom using the velocity Verlet algorithm:
| molecules | Vector of rigid body states to integrate |
| dt | Timestep in femtoseconds |