ReactionMechanismGenerator / ReactionMechanismGenerator/ARC
ARCSpecies does not show atom labels for the mol object if it was generated from a `species_dict`
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 51
- Forks
- 25
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 15
Description
Describe the bug
ARCSpecies does not show atom labels for the mol object if it was generated from a species_dict
How to reproduce
>>> from arc.species import ARCSpecies
>>> spc = ARCSpecies(label="fail", smiles="CC")
>>> for index, atom in enumerate(spc.mol.atoms):
... atom.label = str(index)
...
>>> new_spc = ARCSpecies(species_dict=spc.as_dict())
>>> print([atom.label for atom in new_spc.mol.atoms])
['', '', '', '', '', '', '', '']
even though the species_dict does have atom labels:
'mol': {'atoms': [{'element': {'number': 6, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '0',
'lone_pairs': 0,
'id': -27544,
'props': {'inRing': False},
'atomtype': 'Cs',
'edges': {-27543: 1.0, -27542: 1.0, -27541: 1.0, -27540: 1.0}},
{'element': {'number': 6, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '1',
'lone_pairs': 0,
'id': -27543,
'props': {'inRing': False},
'atomtype': 'Cs',
'edges': {-27544: 1.0, -27539: 1.0, -27538: 1.0, -27537: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '2',
'lone_pairs': 0,
'id': -27542,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27544: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '3',
'lone_pairs': 0,
'id': -27541,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27544: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '4',
'lone_pairs': 0,
'id': -27540,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27544: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '5',
'lone_pairs': 0,
'id': -27539,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27543: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '6',
'lone_pairs': 0,
'id': -27538,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27543: 1.0}},
{'element': {'number': 1, 'isotope': -1},
'radical_electrons': 0,
'charge': 0,
'label': '7',
'lone_pairs': 0,
'id': -27537,
'props': {'inRing': False},
'atomtype': 'H',
'edges': {-27543: 1.0}}],
(see the 'labels' on the atom list)
Expected behavior
return the same labels.
Additional context
Accurate parsing of the species object is important for restarts and for testing, as they help to avoid obsolete callings of other functions while performing tests, which may cause unrelated failures.
😄
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the arc.species ARCSpecies initialization path that handles species_dict and reconstructs mol.atoms, then reproduce the example using ARCSpecies.as_dict(). Confirm that the reconstructed atom labels match the labels in species_dict and verify the same behavior with a focused test or rerun of the provided example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100