Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Implement Core Domain Models for Molecular Representation #3

@TKanX

Description

@TKanX

Description:

Implement the core domain models that will represent all molecular structures within the new system. These data structures, residing in the crates/scream-core/src/core/models/ module, must be designed with Rust's principles of safety, ownership, and data-oriented design in mind. They will be intentionally "pure" and decoupled from I/O formats and force field specifics, serving as the universal language for all other components of the library. This implementation will replace the large, monolithic SCREAM_ATOM class and related structures from the legacy codebase with a clean, modular, and type-safe hierarchy. The successful completion of this task will provide the essential building blocks upon which the I/O, force field, and energy calculation modules will be built.

Tasks:

  • Finalize models Module Structure:

    • Confirm the file structure within crates/scream-core/src/core/models/ (atom.rs, residue.rs, chain.rs, topology.rs, system.rs).
    • Set up the mod.rs file to correctly declare and organize the sub-modules.
  • Implement Atom and Element Structures (atom.rs):

    • Define a type-safe Element enum with a from_str constructor for parsing.
    • Implement the core Atom struct containing index, serial, name, coords (using nalgebra::Point3<f64>), and element.
    • Write unit tests to verify Atom creation and basic property access.
  • Implement Residue Structure (residue.rs):

    • Implement the Residue struct to hold ResidueId, name, and a Vec<usize> of atom_indices.
    • Implement a HashMap<String, usize> for fast, by-name lookup of atom indices within the residue.
    • Write unit tests for Residue creation and atom lookup functionality.
  • Implement Chain Structure (chain.rs):

    • Implement the Chain struct to hold a char ID and an ordered Vec<Residue>.
    • Implement a HashMap<ResidueId, usize> for fast lookup of residues within the chain.
    • Write unit tests for Chain creation and residue access.
  • Implement Topology Data Structures (topology.rs):

    • Define the BondOrder enum (Single, Double, etc.).
    • Implement the Bond struct using global usize atom indices and a BondOrder.
    • Write unit tests to verify Bond creation.
  • Implement MolecularSystem Top-Level Container (system.rs):

    • Implement the MolecularSystem struct as the primary owner of a flat Vec<Atom>, a Vec<Chain>, and a Vec<Bond>.
    • Implement a MolecularSystemBuilder to facilitate safe and consistent construction of the system from its components.
    • Write integration tests to verify the construction of a simple, multi-atom MolecularSystem.

Metadata

Metadata

Assignees

Labels

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions