occ
Loading...
Searching...
No Matches
occ::mults::RigidBodyDynamics Class Reference

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.
 

Detailed Description

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.

Member Function Documentation

◆ compute_angular_momentum()

static Vec3 occ::mults::RigidBodyDynamics::compute_angular_momentum ( const std::vector< RigidBodyState > &  molecules)
static

Compute total angular momentum of system.

Parameters
moleculesVector of rigid bodies
Returns
Total angular momentum vector (in space frame)

◆ compute_forces_torques()

static void occ::mults::RigidBodyDynamics::compute_forces_torques ( std::vector< RigidBodyState > &  molecules)
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.

Parameters
moleculesVector of rigid body states

◆ compute_forces_torques_cartesian()

static double occ::mults::RigidBodyDynamics::compute_forces_torques_cartesian ( std::vector< RigidBodyState > &  molecules)
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:

  • One call per pair (not two)
  • No Euler angle conversion
  • SIMD-batched T-tensor computation
Parameters
moleculesVector of rigid body states
Returns
Total potential energy

◆ compute_kinetic_energy()

static double occ::mults::RigidBodyDynamics::compute_kinetic_energy ( const std::vector< RigidBodyState > &  molecules)
static

Compute total kinetic energy of system.

Parameters
moleculesVector of rigid bodies
Returns
Total kinetic energy (translational + rotational)

◆ compute_linear_momentum()

static Vec3 occ::mults::RigidBodyDynamics::compute_linear_momentum ( const std::vector< RigidBodyState > &  molecules)
static

Compute total linear momentum of system.

Parameters
moleculesVector of rigid bodies
Returns
Total linear momentum vector

◆ compute_potential_energy()

static double occ::mults::RigidBodyDynamics::compute_potential_energy ( const std::vector< RigidBodyState > &  molecules)
static

Compute total potential energy of system (S-function engine)

Parameters
moleculesVector of rigid bodies
Returns
Total potential energy (sum of all pairwise interactions)

◆ compute_potential_energy_cartesian()

static double occ::mults::RigidBodyDynamics::compute_potential_energy_cartesian ( const std::vector< RigidBodyState > &  molecules)
static

Compute total potential energy using Cartesian engine.

Faster than compute_potential_energy() for multi-site molecules.

Parameters
moleculesVector of rigid bodies
Returns
Total potential energy (sum of all pairwise interactions)

◆ compute_total_energy()

static double occ::mults::RigidBodyDynamics::compute_total_energy ( const std::vector< RigidBodyState > &  molecules)
static

Compute total energy (kinetic + potential)

Parameters
moleculesVector of rigid bodies
Returns
Total energy

◆ normalize_quaternions()

static void occ::mults::RigidBodyDynamics::normalize_quaternions ( std::vector< RigidBodyState > &  molecules)
static

Normalize all quaternions in the system.

Call this periodically to prevent numerical drift from unit quaternion constraint.

Parameters
moleculesVector of rigid bodies

◆ update_angular_velocities()

static void occ::mults::RigidBodyDynamics::update_angular_velocities ( std::vector< RigidBodyState > &  molecules,
double  dt,
bool  first_half 
)
static

Update angular velocities using torques (half-step)

Integrates Euler's equation in body frame: dL/dt = tau - omega x L

Parameters
moleculesVector of rigid bodies
dtTimestep
first_halfIf true, do first half-step; if false, do second half-step

◆ update_orientations_quaternion()

static void occ::mults::RigidBodyDynamics::update_orientations_quaternion ( std::vector< RigidBodyState > &  molecules,
double  dt 
)
static

Update orientations using quaternion integration.

Integrates quaternion using angular velocity in body frame: dq/dt = (1/2) * q * omega_quat

Parameters
moleculesVector of rigid bodies
dtTimestep

◆ update_positions()

static void occ::mults::RigidBodyDynamics::update_positions ( std::vector< RigidBodyState > &  molecules,
double  dt 
)
static

Update positions using current velocities (half-step)

r(t+dt) = r(t) + v(t)*dt + (1/2)*a(t)*dt^2

Parameters
moleculesVector of rigid bodies
dtTimestep

◆ update_velocities()

static void occ::mults::RigidBodyDynamics::update_velocities ( std::vector< RigidBodyState > &  molecules,
double  dt,
bool  first_half 
)
static

Update velocities using forces (half-step)

v(t+dt) = v(t) + (1/2)*[a(t) + a(t+dt)]*dt

Parameters
moleculesVector of rigid bodies
dtTimestep
first_halfIf true, do first half-step; if false, do second half-step

◆ velocity_verlet_step()

static void occ::mults::RigidBodyDynamics::velocity_verlet_step ( std::vector< RigidBodyState > &  molecules,
double  dt 
)
static

Perform one velocity Verlet integration step.

This integrates both translational and rotational degrees of freedom using the velocity Verlet algorithm:

  1. Update positions and orientations using current velocities
  2. Compute new forces and torques
  3. Update velocities using average of old and new forces/torques
Parameters
moleculesVector of rigid body states to integrate
dtTimestep in femtoseconds

The documentation for this class was generated from the following file: