Reaction multiplicity silently resolves to 1 when species are attached after first access
まだ誰も着手していません。
評価
調査の方向性
ARCReaction.multiplicity と get_rxn_multiplicity() から開始し、issue の再現手順を使って、species のアタッチ前後のキャッシュ動作を確認します。次に check_multiplicity_parity と Linear TS adapter path を調べます。空の species set が 1 をキャッシュせず、後から species をアタッチすると reaction multiplicity が再計算され、reaction multiplicity の設定時に parity がチェックされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
ARCReaction.multiplicity returns 1 for any reaction whose species are attached after the property is first read, and the wrong value is then cached for the life of the object. Attaching the species afterwards does not correct it.
The derivation itself is fine. get_rxn_multiplicity() opens with
reactants, products = self.get_reactants_and_products()
multiplicity = None
ordered_r_mult_list, ordered_p_mult_list = list(), list()
if len(reactants):
if len(reactants) == 1:
return reactants[0].multiplicity
so a unimolecular reaction returns its reactant's multiplicity, which is right. But when reactants is empty the guarded block is skipped and both ordered lists stay empty, and the first test in the loop below is
if all(m == 1 for m in list_1) and multiplicity is None:
multiplicity = 1 # S + S = S or T
all() over an empty list is vacuously true, so the function returns 1 rather than None. Because the caller caches into self._multiplicity and only recomputes when it is None, a doublet reaction is permanently a singlet.
How to reproduce
r = ARCSpecies(label='R', smiles='[CH2]C(C)CC') # multiplicity 2
p = ARCSpecies(label='P', smiles='CC(C)[CH]C') # multiplicity 2
# species present when the property is first read -> correct
rxn1 = ARCReaction(r_species=[r], p_species=[p])
rxn1.multiplicity # 2
# species attached later -> wrong, and it sticks
rxn2 = ARCReaction(label='R <=> P', reactants=['R'], products=['P'])
rxn2.multiplicity # 1
rxn2.r_species = [r]; rxn2.p_species = [p]
rxn2.multiplicity # still 1
The second form is what an input file produces when a reaction names its species by label:
species:
- {label: R, smiles: '[CH2]C(C)CC'}
- {label: P, smiles: 'CC(C)[CH]C'}
reactions:
- label: R <=> P
reactants: [R]
products: [P]
What it costs
The species themselves are perceived correctly — the log shows multiplicity=2 for both — while the reaction is set to 1, so the TS inherits 1 and Gaussian is handed an impossible specification:
Setting multiplicity of reaction R <=> P to 1
...
The combination of multiplicity 1 and 41 electrons is impossible.
Error termination via Lnk1e in .../l301.exe
ARC does notice, but too late and in the wrong place. The Linear TS adapter raises
Impossible multiplicity for species TS0: the species has 41 electrons, which requires an even
multiplicity, but a multiplicity of 1 was requested. The nearest valid multiplicities are [2].
and that exception is caught, so the run continues, submits the impossible job, exhausts its troubleshooting on it (int=(Acc2E=14), all_attempted) and reports the TS as unconverged. I lost ten transition-state searches this way before opening a Gaussian log; nothing upstream of that log says "multiplicity".
Expected behavior
get_rxn_multiplicity()should returnNonewhen it has no species to reason about, so the property recomputes later instead of caching a guess. Guarding the empty case explicitly would do it — the vacuousall([])is the only reason 1 is reached.- The parity check that already exists (
check_multiplicity_parity) is the right test; it should be applied to the reaction when its multiplicity is set, not only when an adapter happens to build a species. An electron count and a multiplicity of opposite parity is knowable before any job is written.
Installation information
- ARC
main@4d67ad4c - Python 3.14, Linux, PBS, Gaussian 16
- 主要言語
- Python
- スター
- 52
- フォーク
- 25
- 平均マージ
- 2日 3時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ReactionMechanismGenerator/ARC のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
ReactionMechanismGenerator/ARC#1067 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ReactionMechanismGenerator/ARC#1043 ·
-
Level: unify the 'does this level carry meaningful args?' predicate between __str__ and as_dict()オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 3/5 半日 初心者へのやさしさ 55/100
ReactionMechanismGenerator/ARC#1068 ·
ReactionMechanismGenerator/ARC の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
dgunning/edgartools#1853 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
Imbad0202/academic-research-skills#1039 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
openmainframeproject/feilong#980 ·
メンテナーはふだん 5 日以内に返信