T3Reaction.from_dict cannot read back its own as_dict output once r_species is populated

オープン
#237 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

Start by reading T3Reaction.as_dict and T3Reaction.from_dict, then compare the serialized species fields and family fields with the arguments accepted by ARCReaction.init. Reproduce both failures using the examples in the issue and check the existing round-trip tests. Done means deserializing the output with either report_family setting succeeds when reactant and product species are attached.

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

説明

T3Reaction.from_dict(reaction.as_dict()) raises in both report_family modes once the reaction carries r_species/p_species, so restoring a reactions.yml written by T3 does not work against current ARC.

Measured at T3 official/main 0bd0edc2 against ARC official/main bfaf50237, in t3_env:

r = T3Reaction(label='H + CH4 <=> H2 + CH3', reactants=['H','CH4'], products=['H2','CH3'], t3_index=1)
r.r_species = [T3Species(label='H', smiles='[H]'), T3Species(label='CH4', smiles='C')]
r.p_species = [T3Species(label='H2', smiles='[H][H]'), T3Species(label='CH3', smiles='[CH3]')]
T3Reaction.from_dict(r.as_dict(report_family=True))
# TypeError: ARCReaction.__init__() got an unexpected keyword argument 'family_source'
T3Reaction.from_dict(r.as_dict(report_family=False))
# AttributeError: 'dict' object has no attribute 'label'

Two separate causes:

  1. report_family=True (the default) writes family_source, which ARCReaction.__init__ does not accept.
  2. report_family=False leaves the serialised r_species/p_species dicts in the payload, and they reach __init__ as dicts where objects are expected.

With no species attached the round-trip succeeds, which is why the existing tests do not catch it: they exercise the thin shape.

Scope note: found while reviewing an unrelated change to T3Species/T3Reaction serialisation. It is pre-existing on main and is not caused by that change, which is why it is filed separately rather than fixed there.

主要言語
Python
スター
16
フォーク
8
平均マージ
1時間 46分
マージ済み PR(30日)
1

環境構築

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

はじめの一歩

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

ReactionMechanismGenerator/T3 のほかの issue

ReactionMechanismGenerator/T3 の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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