Skip to content

feat(builder): Implement Atom Typing Engine and Topology Builder#6

Merged
TKanX merged 12 commits intomainfrom
feature/5-implement-the-core-engine-for-type-assignment-and-topology-generation
Oct 5, 2025
Merged

feat(builder): Implement Atom Typing Engine and Topology Builder#6
TKanX merged 12 commits intomainfrom
feature/5-implement-the-core-engine-for-type-assignment-and-topology-generation

Conversation

@TKanX
Copy link
Copy Markdown
Member

@TKanX TKanX commented Oct 5, 2025

Summary:

Introduces the core computational engine for DREIDING atom typing and the final builder module for generating a complete MolecularTopology. It includes an iterative, relaxation-based typing engine that applies a prioritized rule set to an annotated molecular graph. After successful typing, a new builder module constructs the final topological representation, including atoms, bonds, angles, and both proper and improper dihedrals.

Changes:

  • Developed the Iterative Atom Typing Engine:

    • Created a TyperEngine (processor::typer) that iteratively applies rules until a stable set of atom types is achieved.
    • The engine uses a relaxation algorithm: it runs multiple rounds, allowing atom types to be updated based on the types of their neighbors, which resolves dependencies (e.g., typing an acidic hydrogen requires its oxygen neighbor to be typed first).
    • Rules are sorted and applied based on priority, ensuring that specific, high-priority rules are matched before general, low-priority ones.
    • Implemented robust error handling for cases where atoms remain untyped, providing diagnostics for debugging rule sets.
  • Implemented the Final Topology Builder:

    • Created a builder module to translate the annotated graph and assigned atom types into the final MolecularTopology output format.
    • Atom & Bond Generation: Directly translates the typed atoms and initial bonds into the final structure.
    • Angle Perception: Implemented an algorithm to systematically find all unique bond angles (i-j-k triplets) from the graph's adjacency list.
    • Proper Dihedral Perception: Developed a graph traversal algorithm to identify all unique proper dihedral angles (i-j-k-l chains).
    • Improper Dihedral Perception: Implemented logic to generate improper dihedrals for planar centers (e.g., SP2 or Resonant atoms with degree 3), which are crucial for maintaining planarity in force fields.
  • Enhanced Test Infrastructure:

    • Added comprehensive unit tests for the topology builder, covering various molecules from simple alkanes to complex aromatic systems like benzene.
    • Developed a test harness (TestMolecule) to simplify the construction of test cases with pre-defined atom properties.
    • Added extensive integration tests for the TyperEngine to validate its logic on molecules requiring iterative relaxation (e.g., acetic acid) and special cases (e.g., diborane).

@TKanX TKanX self-assigned this Oct 5, 2025
Copilot AI review requested due to automatic review settings October 5, 2025 16:40
@TKanX TKanX added the enhancement ✨ New feature or request label Oct 5, 2025
@TKanX TKanX linked an issue Oct 5, 2025 that may be closed by this pull request
31 tasks
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a comprehensive DREIDING atom typing engine and molecular topology builder. The implementation features an iterative relaxation algorithm for atom typing that handles complex molecular dependencies, along with a complete topology generation system that creates atoms, bonds, angles, and dihedral angles from molecular graph data.

  • Developed an iterative TyperEngine with priority-based rule application and relaxation logic
  • Created a complete builder module for generating MolecularTopology with all structural components
  • Added comprehensive test coverage for both typing engine and topology builder functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/processor/typer.rs Implements the core atom typing engine with iterative relaxation algorithm
src/processor/mod.rs Exports new typer functionality and AtomView type
src/lib.rs Updates module visibility and adds builder module
src/builder/mod.rs Complete topology builder with angle and dihedral perception algorithms

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/lib.rs
Comment thread src/builder/mod.rs
@TKanX TKanX merged commit f744d48 into main Oct 5, 2025
2 checks passed
@TKanX TKanX deleted the feature/5-implement-the-core-engine-for-type-assignment-and-topology-generation branch October 5, 2025 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement ✨ New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the Core Engine for Type Assignment and Topology Generation

2 participants