openfold.utils.geometry.vector

Vec3Array Class.

Classes

Vec3Array(x, y, z)

Functions

cross(vector1, vector2)

dihedral_angle(a, b, c, d)

Computes torsion angle for a quadruple of points.

dot(vector1, vector2)

euclidean_distance(vec1, vec2[, epsilon])

Computes euclidean distance between 'vec1' and 'vec2'.

norm(vector[, epsilon])

normalized(vector[, epsilon])

square_euclidean_distance(vec1, vec2[, epsilon])

Computes square of euclidean distance between 'vec1' and 'vec2'.

class Vec3Array(x: 'torch.Tensor', y: 'torch.Tensor', z: 'torch.Tensor')
Parameters:
classmethod cat(vecs, dim)
Parameters:
Return type:

Vec3Array

clone()
Return type:

Vec3Array

cross(other)

Compute cross product between ‘self’ and ‘other’.

Parameters:

other (Vec3Array)

Return type:

Vec3Array

dot(other)

Compute dot product between ‘self’ and ‘other’.

Parameters:

other (Vec3Array)

Return type:

float | Tensor

classmethod from_array(tensor)
map_tensor_fn(fn)
Return type:

Vec3Array

norm(epsilon=1e-06)

Compute Norm of Vec3Array, clipped to epsilon.

Parameters:

epsilon (float)

Return type:

float | Tensor

norm2()
normalized(epsilon=1e-06)

Return unit vector with optional clipping.

Parameters:

epsilon (float)

Return type:

Vec3Array

reshape(new_shape)
Return type:

Vec3Array

sum(dim)
Parameters:

dim (int)

Return type:

Vec3Array

to_tensor()
Return type:

Tensor

unsqueeze(dim)
Parameters:

dim (int)

classmethod zeros(shape, device='cpu')

Return Vec3Array corresponding to zeros of given shape.

property shape
x: Tensor
y: Tensor
z: Tensor
cross(vector1, vector2)
Parameters:
Return type:

float | Tensor

dihedral_angle(a, b, c, d)

Computes torsion angle for a quadruple of points.

For points (a, b, c, d), this is the angle between the planes defined by points (a, b, c) and (b, c, d). It is also known as the dihedral angle.

Parameters:
  • a (Vec3Array) – A Vec3Array of coordinates.

  • b (Vec3Array) – A Vec3Array of coordinates.

  • c (Vec3Array) – A Vec3Array of coordinates.

  • d (Vec3Array) – A Vec3Array of coordinates.

Returns:

[-pi, pi].

Return type:

A tensor of angles in radians

dot(vector1, vector2)
Parameters:
Return type:

float | Tensor

euclidean_distance(vec1, vec2, epsilon=1e-06)

Computes euclidean distance between ‘vec1’ and ‘vec2’.

Parameters:
  • vec1 (Vec3Array) – Vec3Array to compute euclidean distance to

  • vec2 (Vec3Array) – Vec3Array to compute euclidean distance from, should be broadcast compatible with ‘vec1’

  • epsilon (float) – distance is clipped from below to be at least epsilon

Returns:

Array of euclidean distances; shape will be result of broadcasting ‘vec1’ and ‘vec2’

Return type:

float | Tensor

norm(vector, epsilon=1e-06)
Parameters:
Return type:

float | Tensor

normalized(vector, epsilon=1e-06)
Parameters:
Return type:

Vec3Array

square_euclidean_distance(vec1, vec2, epsilon=1e-06)

Computes square of euclidean distance between ‘vec1’ and ‘vec2’.

Parameters:
  • vec1 (Vec3Array) – Vec3Array to compute distance to

  • vec2 (Vec3Array) – Vec3Array to compute distance from, should be broadcast compatible with ‘vec1’

  • epsilon (float) – distance is clipped from below to be at least epsilon

Returns:

Array of square euclidean distances; shape will be result of broadcasting ‘vec1’ and ‘vec2’

Return type:

float | Tensor