pub struct Affine3D {
pub rot: Tensor,
pub trans: Tensor,
}Expand description
Per-residue local reference frame: rotation matrix + translation.
rot: (*, 3, 3) — orthonormal rotation matrix, columns are the frame axes.
trans: (*, 3) — CA position in global coordinates.
Fields§
§rot: Tensor§trans: TensorImplementations§
Source§impl Affine3D
impl Affine3D
pub fn new(rot: Tensor, trans: Tensor) -> Self
Sourcepub fn apply_rot(rot: &Tensor, v: &Tensor) -> Result<Tensor>
pub fn apply_rot(rot: &Tensor, v: &Tensor) -> Result<Tensor>
Rotate vectors from local frame to global frame.
rot: (*, 3, 3), v: (*, H, 3) → (*, H, 3).
In row-vector convention: v @ rot^T.
Sourcepub fn apply_rot_inv(rot: &Tensor, v: &Tensor) -> Result<Tensor>
pub fn apply_rot_inv(rot: &Tensor, v: &Tensor) -> Result<Tensor>
Rotate vectors from global frame to local frame (inverse rotation).
rot: (*, 3, 3), v: (*, H, 3) → (*, H, 3).
For orthogonal matrices: inverse = transpose, so v @ rot.
Sourcepub fn apply(&self, v: &Tensor) -> Result<Tensor>
pub fn apply(&self, v: &Tensor) -> Result<Tensor>
Apply full affine transform (rotate + translate) to v of shape (*, H, 3).
Returns (*, H, 3) in global coordinates.
Sourcepub fn build_affine3d_from_coordinates(
coords: &Tensor,
) -> Result<(Self, Tensor)>
pub fn build_affine3d_from_coordinates( coords: &Tensor, ) -> Result<(Self, Tensor)>
Build per-residue local frames from backbone atom coordinates.
coords: (B, L, 3, 3) — atom order is (N, CA, C).
Frame construction follows AlphaFold2/ESM convention (Graham-Schmidt on CA-C and CA-N):
- x-axis: normalized
CA - C - y-axis: normalized component of
N - CAperpendicular to x-axis - z-axis:
x × y - origin: CA position
Returns (Affine3D, mask) where mask (B, L) is true (u8=1) where both
backbone vectors have non-trivial length (atoms are present).
Auto Trait Implementations§
impl Freeze for Affine3D
impl !RefUnwindSafe for Affine3D
impl Send for Affine3D
impl Sync for Affine3D
impl Unpin for Affine3D
impl UnsafeUnpin for Affine3D
impl !UnwindSafe for Affine3D
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more