道家人 发表于 2025-3-24 04:02:07

AF3 Rigid类的from_3_points方法解读

AlphaFold3 rigid_utils 模块Rigid类的 from_3_points 方法主要用来从三个点构建刚体变换 (Rigid transformation),焦点头脑是 Gram-Schmidt 正交化来生成一个局部坐标系。输入为氨基酸残基的主链原子(N, CA, C)的坐标,返回的 Rigid 实例可以把该氨基酸残基原子的全局坐标转换为局部坐标。
源代码:

@staticmethod
    def from_3_points(
      p_neg_x_axis: torch.Tensor,
      origin: torch.Tensor,
      p_xy_plane: torch.Tensor,
      eps: float = 1e-8
    ) -> Rigid:
      """
            Implements algorithm 21. Constructs transformations from sets of 3
            points using the Gram-Schmidt algorithm.

            Args:
                p_neg_x_axis: [*, 3] coordinates
                origin: [*, 3] coordinates used as frame origins
                p_xy_plane: [*, 3] coordinates
                eps: Small epsilon value
            Returns:
                A transformation object of shape [*]
      """
      p_neg_x_axis = torch.unbind(p_neg_x_axis, dim=-1)
      origin = torch.unbind(origin, dim=-1)
      p_xy_plane = torch.unbind(p_xy_plane, dim=-1)

      e0 =
      e1 =

      denom = torch.sqrt(sum((c * c for c in e0)) + eps)
      e0 =
      dot = sum((c1 * c2 for c1, c2 in zip(e0, e1)))
      e1 =
      denom = t
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: AF3 Rigid类的from_3_points方法解读