ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
rotation.hpp File Reference

This file contains all subroutines required to process rotational motion. More...

#include "config/config.hpp"
#include "Particle.hpp"
#include "ParticleRange.hpp"
#include <utils/Vector.hpp>
#include <utils/mask.hpp>
#include <utils/math/quaternion.hpp>
#include <utils/matrix.hpp>
#include <utils/quaternion.hpp>
#include <cassert>
#include <cmath>
#include <limits>
#include <utility>
+ Include dependency graph for rotation.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void propagate_omega_quat_particle (Particle &p, double time_step)
 Propagate angular velocities and update quaternions on a particle.
 
void convert_torque_propagate_omega (Particle &p, double time_step)
 
void convert_initial_torques (const ParticleRange &particles)
 Convert torques to the body-fixed frame before the integration loop.
 
Utils::Vector3d convert_vector_body_to_space (const Particle &p, const Utils::Vector3d &vec)
 
Utils::Vector3d convert_vector_space_to_body (const Particle &p, const Utils::Vector3d &v)
 
template<class T >
auto convert_body_to_space (const Utils::Quaternion< double > &quat, const Utils::Matrix< T, 3, 3 > &A)
 Transform matrix from body- to space-fixed frame.
 
template<class T >
auto convert_body_to_space (const Particle &p, const Utils::Matrix< T, 3, 3 > &A)
 Transform matrix from body- to space-fixed frame.
 
std::pair< Utils::Quaternion< double >, double > convert_dip_to_quat (const Utils::Vector3d &dip)
 convert a dipole moment to quaternions and dipolar strength

 
Utils::Quaternion< double > local_rotate_particle_body (Particle const &p, const Utils::Vector3d &axis_body_frame, const double phi)
 Rotate the particle p around the body-frame defined NORMALIZED axis aBodyFrame by amount phi.
 
void local_rotate_particle (Particle &p, const Utils::Vector3d &axis_space_frame, const double phi)
 Rotate the particle p around the NORMALIZED axis aSpaceFrame by amount phi.
 
void convert_torque_to_body_frame_apply_fix (Particle &p)
 

Detailed Description

This file contains all subroutines required to process rotational motion.

Definition in file rotation.hpp.

Function Documentation

◆ convert_body_to_space() [1/2]

template<class T >
auto convert_body_to_space ( const Particle p,
const Utils::Matrix< T, 3, 3 > &  A 
)

Transform matrix from body- to space-fixed frame.

Template Parameters
TScalar type
Parameters
pParticle transforming from.
AMatrix representation in body-fixed coordinates.
Returns
Matrix representation in space-fixed coordinates.

Definition at line 100 of file rotation.hpp.

References convert_body_to_space(), and Particle::quat().

◆ convert_body_to_space() [2/2]

template<class T >
auto convert_body_to_space ( const Utils::Quaternion< double > &  quat,
const Utils::Matrix< T, 3, 3 > &  A 
)

Transform matrix from body- to space-fixed frame.

Given a linear map represented by \( A \in \mathbb{R}^{3 \times 3}\) in the body-fixed frame, this returns the matrix \( A \in \mathbb{R}^{3 \times 3}\) representing the map in the space-fixed frame. They are related by the map between the space-fixed and body-fixed frame \(O\) like

\[ A' = O A O^T. \]

Template Parameters
TScalar type
Parameters
quatquaternion to transform from, i.e. the rotation that transforms space- to body-fixed frame.
AMatrix representation in body-fixed coordinates.
Returns
Matrix representation in space-fixed coordinates.

Definition at line 86 of file rotation.hpp.

References Utils::Matrix< T, Rows, Cols >::transposed().

Referenced by convert_body_to_space(), and Thermostat::handle_particle_anisotropy().

◆ convert_dip_to_quat()

std::pair< Utils::Quaternion< double >, double > convert_dip_to_quat ( const Utils::Vector3d dip)
inline

convert a dipole moment to quaternions and dipolar strength

Definition at line 108 of file rotation.hpp.

References Utils::convert_director_to_quaternion(), and Utils::Vector< T, N >::norm().

Referenced by ScriptInterface::Particles::ParticleHandle::ParticleHandle().

◆ convert_initial_torques()

void convert_initial_torques ( const ParticleRange particles)

Convert torques to the body-fixed frame before the integration loop.

Definition at line 188 of file rotation.cpp.

References convert_torque_to_body_frame_apply_fix().

Referenced by System::System::integrate().

◆ convert_torque_propagate_omega()

void convert_torque_propagate_omega ( Particle p,
double  time_step 
)

◆ convert_torque_to_body_frame_apply_fix()

void convert_torque_to_body_frame_apply_fix ( Particle p)
inline

◆ convert_vector_body_to_space()

◆ convert_vector_space_to_body()

◆ local_rotate_particle()

void local_rotate_particle ( Particle p,
const Utils::Vector3d axis_space_frame,
const double  phi 
)
inline

◆ local_rotate_particle_body()

Utils::Quaternion< double > local_rotate_particle_body ( Particle const &  p,
const Utils::Vector3d axis_body_frame,
const double  phi 
)
inline

Rotate the particle p around the body-frame defined NORMALIZED axis aBodyFrame by amount phi.

Definition at line 119 of file rotation.hpp.

References Particle::can_rotate(), Particle::quat(), and Particle::rotation().

Referenced by bd_drag_rot(), bd_random_walk_rot(), and local_rotate_particle().

◆ propagate_omega_quat_particle()

void propagate_omega_quat_particle ( Particle p,
double  time_step 
)

Propagate angular velocities and update quaternions on a particle.

Propagate angular velocities and update quaternions on a particle.

Please note that ESPResSo uses scalar-first notation for quaternions, while [32] uses scalar-last notation.

For very high angular velocities (e.g. if the product of time_step with the largest component of p.omega() is superior to ~2.0) and for time_step superior or equal to unity, the calculation might fail.

Todo:
implement for fixed_coord_flag

Definition at line 125 of file rotation.cpp.

References Particle::can_rotate(), define_Qdd(), Utils::Quaternion< T >::identity(), Utils::mask(), Particle::omega(), Particle::quat(), and Particle::rotation().

Referenced by velocity_verlet_rotator_1().