Vectorized dihedrals return NaN for a zero-length bond vector instead of raising

オープン 初心者向け
#1,139 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python

調査の方向性

arc/species/vectors.py の calculate_dihedral_angles() を読み、ゼロベクトルの処理を calculate_dihedral_angle() と比較してください。2つの原子が一致するケースのテストを追加し、共線の場合を処理する前に VectorsError が発生することを確認してください。ゼロ長の結合ベクトルがスカラー関数と同じエラーを発生させれば完了です。

索引モデルが issue の本文から書いたものです。

説明

calculate_dihedral_angles() (arc/species/vectors.py, added in #1106) classifies a torsion as collinear when either cross product is shorter than tol, and returns NaN for it. Two coincident consecutive atoms give a zero-length bond vector, so both cross products vanish and the torsion is returned as NaN, as if the atoms were merely collinear. The scalar calculate_dihedral_angle() raises VectorsError('Input vectors must be non-zero.') for the same input.

The callers are in arc/species/optical_isomers.py (lines 665 and 804 at 3ee094352), where a NaN torsion counts as uninformative. A geometry with coincident atoms is malformed, so this hides the fault rather than changing a result for a valid geometry.

Fix: check v1, v2 and v3 for zero length (below tol) before the collinear test, and raise VectorsError as the scalar function does. Add a test with two coincident atoms.

Found by Copilot on #1055 (review comment 4728719409), where the code arrives through the stack merge.

主要言語
Python
スター
55
フォーク
26
平均マージ
3日 3時間
マージ済み PR(30日)
8

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ReactionMechanismGenerator/ARC のほかの issue

ReactionMechanismGenerator/ARC の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。