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

Aperta
#237 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
16
Fork
8
Merge medio
1h 46m
PR unite (30g)
1

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ReactionMechanismGenerator/T3

Tutte le issue di ReactionMechanismGenerator/T3

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.