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

Calculate forces and torques on rigid bodies from multipole interactions. More...

#include <torque.h>

Static Public Member Functions

static TorqueResult compute_torque (const occ::dma::Mult &mult1, const Vec3 &pos1, const Vec3 &euler1, const occ::dma::Mult &mult2, const Vec3 &pos2, const Vec3 &euler2, int which_molecule=1)
 Compute forces and torques on a molecule from multipole interaction.
 
static TorqueResult compute_torque_analytical (const occ::dma::Mult &mult1_body, const Vec3 &pos1, const Vec3 &euler1, const occ::dma::Mult &mult2_body, const Vec3 &pos2, const Vec3 &euler2, int which_molecule=1)
 Compute forces and torques using analytical derivatives.
 
static TorqueResult compute_torque_finite_diff (const occ::dma::Mult &mult1_body, const Vec3 &pos1, const Vec3 &euler1, const occ::dma::Mult &mult2_body, const Vec3 &pos2, const Vec3 &euler2, int which_molecule=1, double delta=1e-6)
 Compute torque using finite differences (for validation)
 
static Vec3 euler_to_body_torque (const Vec3 &torque_euler, const Vec3 &euler)
 Convert Euler angle derivatives to body-frame torque.
 
static Vec3 euler_to_space_torque (const Vec3 &torque_euler, const Vec3 &euler)
 Convert Euler angle derivatives to space-frame torque.
 

Detailed Description

Calculate forces and torques on rigid bodies from multipole interactions.

This class provides methods to compute forces and torques acting on molecules due to multipole-multipole interactions. It supports both finite-difference and analytical approaches (when available).

Member Function Documentation

◆ compute_torque()

static TorqueResult occ::mults::TorqueCalculation::compute_torque ( const occ::dma::Mult mult1,
const Vec3 pos1,
const Vec3 euler1,
const occ::dma::Mult mult2,
const Vec3 pos2,
const Vec3 euler2,
int  which_molecule = 1 
)
static

Compute forces and torques on a molecule from multipole interaction.

Parameters
mult1First multipole (body frame)
pos1Position of first molecule
euler1Euler angles of first molecule [alpha, beta, gamma]
mult2Second multipole (body frame)
pos2Position of second molecule
euler2Euler angles of second molecule [alpha, beta, gamma]
which_moleculeWhich molecule to compute torque for (1 or 2)
Returns
TorqueResult containing force and torques in various representations

◆ compute_torque_analytical()

static TorqueResult occ::mults::TorqueCalculation::compute_torque_analytical ( const occ::dma::Mult mult1_body,
const Vec3 pos1,
const Vec3 euler1,
const occ::dma::Mult mult2_body,
const Vec3 pos2,
const Vec3 euler2,
int  which_molecule = 1 
)
static

Compute forces and torques using analytical derivatives.

Uses S-function derivatives and derivative transformation matrices to compute exact forces and torques. This is much faster than finite differences (no extra energy evaluations needed).

Parameters
mult1_bodyFirst multipole in body frame
pos1Position of first molecule
euler1Euler angles of first molecule [alpha, beta, gamma]
mult2_bodySecond multipole in body frame
pos2Position of second molecule
euler2Euler angles of second molecule [alpha, beta, gamma]
which_moleculeWhich molecule to compute torque for (1 or 2)
Returns
TorqueResult with analytical forces and torques

◆ compute_torque_finite_diff()

static TorqueResult occ::mults::TorqueCalculation::compute_torque_finite_diff ( const occ::dma::Mult mult1_body,
const Vec3 pos1,
const Vec3 euler1,
const occ::dma::Mult mult2_body,
const Vec3 pos2,
const Vec3 euler2,
int  which_molecule = 1,
double  delta = 1e-6 
)
static

Compute torque using finite differences (for validation)

Computes torques by numerically differentiating the energy with respect to Euler angles and positions. This is slower but more general than analytical methods.

Parameters
mult1_bodyFirst multipole in body frame
pos1Position of first molecule
euler1Euler angles of first molecule [alpha, beta, gamma]
mult2_bodySecond multipole in body frame
pos2Position of second molecule
euler2Euler angles of second molecule [alpha, beta, gamma]
which_moleculeWhich molecule to compute torque for (1 or 2)
deltaStep size for finite differences (default: 1e-6)
Returns
TorqueResult with finite-difference torques

◆ euler_to_body_torque()

static Vec3 occ::mults::TorqueCalculation::euler_to_body_torque ( const Vec3 torque_euler,
const Vec3 euler 
)
static

Convert Euler angle derivatives to body-frame torque.

Given torques with respect to Euler angles (dE/dalpha, dE/dbeta, dE/dgamma), convert to torque in the body-fixed frame using the Euler Jacobian transpose.

Relationship: tau_body = J^T * tau_euler

Parameters
torque_eulerTorque w.r.t. Euler angles
eulerEuler angles [alpha, beta, gamma]
Returns
Torque in body-fixed frame

◆ euler_to_space_torque()

static Vec3 occ::mults::TorqueCalculation::euler_to_space_torque ( const Vec3 torque_euler,
const Vec3 euler 
)
static

Convert Euler angle derivatives to space-frame torque.

Parameters
torque_eulerTorque w.r.t. Euler angles
eulerEuler angles [alpha, beta, gamma]
Returns
Torque in space-fixed (lab) frame

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