0.3 arx session - #100
Merged
Merged
Conversation
Introduces scaffold code for upcoming reaction workflow features: a new `ReactionProgression` processor module with a configurable `MAX_LOOP` constant and placeholder `reaction_progression` method, plus an `index_based_functional_groups_detector` placeholder in `FunctionalGroupsDetector`. These changes establish integration points without altering current behavior yet.
Introduce a new `species_pool.py` module with a `PoolSpecies` dataclass to represent reaction pool entries, including monomer flags, SMILES, RDKit molecule objects, and template atom indices. Add `_populate_mols(pool)` to build RDKit molecules from monomer SMILES and initialize `template_idxes` from atom indices, centralizing species preparation logic for downstream reaction processing.
Expand `PoolSpecies` docstring to list its key attributes, and clarify `_populate_mols` documentation to note that it fills both `mol` and `template_idxes` for monomer species derived from SMILES.
unit tests for input parser
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Adding input tests
Rename AutoREACTER/test_input_parser.py to tests/test_input_parser.py (100% similarity — no content changes). This is a pure file move to consolidate tests under the tests/ directory for clearer project structure.
…-job-deploy [WIP] Fix failing GitHub Actions job for deploy to GitHub Pages
- Add fg_1_indexes and fg_2_indexes fields to FunctionalGroupInfo for storing matched atom indices - Expand functional group library with epoxy-amine polymerization entries (diepoxy, primary amine, secondary amine) with improved SMARTS and documentation - Update reaction_rules.json with required_fgs field for epoxy_polymerization - Add _add_progessive_chemistries stub in detected_chemistry_filter.py - Add warning_asci.py with ASCII warning banner for reaction progression beta loop
Copy loop monomer roles before extending them, and strip atom maps/isotopes from product molecules before sanitizing or generating SMILES.
Improve `DeduplicationDetector` clarity and consistency by tightening docstrings, reorganizing helper sections, and cleaning formatting. Functional updates include initializing pair caches for both comparison groups, clearing the RDKit pair cache at the start of each `compare_graphs_mol` pass, and extracting index-source mapping logic into a dedicated helper for clearer validation and error messages.
Add a dedicated `ZeroActiveReactionsError` in reaction preparation and fail after building reaction metadata when none of the reactions include activity stats. This makes empty or invalid datasets surface as an explicit AutoREACTER error instead of continuing silently.
Clarify `ReactionProgression.progress_reaction_process` with a more focused docstring and explicit typing for the working reaction lists. The loop now counts active reactions from the current session state, deduplicates in-place without extra logging, and returns through `_store_reactions(...)` as soon as the break condition is met so the final reaction set is persisted consistently.
Update reaction progression to keep the session’s final deduplicated reaction list instead of extending it with newly generated reactions. Deduplication now clears the full comparison cache per pass, drops repeated references to the same ReactionMetadata object without disabling it, and compares relabeled product graphs in reactant index space. The change also refreshes inline documentation around progression flow and product handling.
Silences leftover print statements in functional group detection, reaction deduplication, and reaction progression. Also clears a few functional group library comments that were only carrying debug-style guidance.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request expands AutoREACTER’s chemistry/reaction-search capabilities by introducing index-scoped functional-group detection and iterative reaction progression, and by extending the built-in libraries to cover epoxy–amine polymerization (including progressive amine additions to epoxides).
Changes:
- Add index-based functional-group and reaction detection to support iterative “reaction progression” workflows.
- Extend functional-group and reaction libraries for epoxy–amine polyaddition chemistry.
- Add graph-based reaction deduplication and supporting examples/tests/docs updates.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_input_parser.py | Adds unit tests covering input parsing/validation behaviors. |
| test.ipynb | Adds a development notebook for progressive chemistry experimentation. |
| README.md | Updates project status/version and points example invocation to examples/example_1.py. |
| examples/test_glycine.json | Adds an example JSON input (currently epoxy/glycine naming mismatch). |
| examples/test_epoxy.json | Adds an epoxy/amine example JSON input. |
| AutoREACTER/reaction_preparation/reaction_processor/warning_asci.py | Adds a warning banner helper for the progression loop. |
| AutoREACTER/reaction_preparation/reaction_processor/reaction_progression.py | Introduces the iterative reaction-progression loop coordinating FG detection → reaction detection → preparation → deduplication. |
| AutoREACTER/reaction_preparation/reaction_processor/prepare_reactions.py | Extends preparation to support progression/forced-index handling and adds a “no active reactions” error. |
| AutoREACTER/reaction_preparation/reaction_processor/fragment_comparison.py | Removes an old commented placeholder module. |
| AutoREACTER/reaction_preparation/ff_wrapper/lunar_client/config.py | Changes LUNAR root configuration (currently hard-coded). |
| AutoREACTER/reaction_preparation/ff_wrapper/foyer_client/foyer_api_wrapper.py | Updates docstrings to correctly describe the Foyer wrapper. |
| AutoREACTER/reaction_preparation/ff_wrapper/ff_wrapper.py | Cleans up unused imports. |
| AutoREACTER/reaction_preparation/deduplication_detector.py | Adds NetworkX/RDKit/LAMMPS graph-based deduplication. |
| AutoREACTER/detectors/reactions_library.py | Adds epoxy–amine polyaddition reaction SMARTS entries. |
| AutoREACTER/detectors/reaction_detector.py | Adds index-based reaction detection over MonomerRole lists with loop-aware skipping rules. |
| AutoREACTER/detectors/functional_groups_library.py | Adds epoxy/amine functional group definitions (e.g., diepoxides, primary/secondary amines). |
| AutoREACTER/detectors/functional_groups_detector.py | Adds index-based FG detection output (incl. matched atom indices) and extends MonomerRole to carry loop/template/index info. |
| AutoREACTER/cache.py | Modifies staging-dir handling (currently removes per-run uniqueness). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces new functionality for index-based detection of functional groups and reactions, and extends the chemistry covered to include epoxy-amine polymerization. The main changes add support for identifying functional groups and possible reactions based on atom indices, and update the functional groups and reactions libraries to handle epoxy-related chemistry.
Index-based detection and role assignment:
index_based_functional_groups_detectorand_detect_functional_groups_by_indexmethods tofunctional_groups_detector.pyfor detecting functional groups that overlap with specified atom indices, enabling more granular control for downstream reaction detection.MonomerRoleandFunctionalGroupInfodataclasses to include atom index information (fg_1_indexes,fg_2_indexes,indexes_in_template) and additional state flags (is_monomer,is_looped,rdkit_mol). [1] [2]Epoxy-amine polymerization support:
di_epoxy_monomer,primary_amine_monomer, andsecondary_amine_monomer, with appropriate SMARTS patterns and documentation.Index-based reaction detection:
index_based_reaction_detectortoreaction_detector.py, enabling reaction detection based on lists of monomer roles with index-specific functional group assignments, supporting both homo- and co-polymerization logic with looped-state tracking.Codebase maintenance:
ff_wrapper.pyandfunctional_groups_detector.pyfor improved clarity and maintainability. [1] [2]These changes collectively enable the system to support more complex polymerization scenarios, especially for epoxy-amine chemistry, and provide finer control over which functional groups and atoms are considered in reaction detection.