Skip to content

Implement a Composable Command-Line Interface (CLI) #9

@TKanX

Description

@TKanX

Description:

This task represents the evolution of dreid-forge from a core library into a versatile command-line utility for DREIDING force field parameterization. The objective is to build a user-friendly CLI that exposes the parameterization engine through two primary workflows: bio for biomolecular structures (PDB/mmCIF) and chem for small molecules (MOL2/SDF).

The implementation will introduce a new binary target at src/bin/dreidforge.rs, organized into a modular architecture under src/bin/cli/. The CLI will utilize clap for robust argument parsing, anyhow for top-level error handling, and indicatif for progress feedback during parameterization. The I/O layer must abstract away file vs. stdin/stdout differences, enabling seamless integration with existing computational chemistry workflows.

Tasks:

  • Phase 1: Project Scaffolding

    • Add CLI dependencies to Cargo.toml: clap, anyhow, indicatif, is-terminal.
    • Define the binary target: [[bin]] name = "dreidforge" path = "src/bin/dreidforge.rs".
    • Create the module structure: src/bin/cli/mod.rs.
    • Implement the root Cli struct with global arguments:
      • -i, --input: Input path (defaults to stdin if missing).
      • -o, --output: Output path(s) (defaults to stdout if missing).
      • --out-format: Force output format.
      • -q, --quiet: Suppress progress output.
  • Phase 2: I/O Abstraction Layer

    • Implement format inference from file extensions.
    • Handle file opening vs. stdin/stdout for streams.
    • Support multiple output targets with paired formats.
    • Implement LAMMPS dual-file output (.data + .in.settings).
  • Phase 3: Subcommand Implementation

    • Bio (cli/bio.rs):
      • Structure preparation: --no-water, --no-ions, --no-hetero, --keep, --remove.
      • Protonation: --no-protonate, --ph, --his (hid/hie/random/network).
      • Solvation: --solvate, --solv-margin, --cation, --anion.
      • Topology building with --hetero-template and --ss-cutoff.
    • Chem (cli/chem.rs):
      • Direct parameterization of small molecules.
      • Support MOL2 and SDF input formats.
    • Shared Forge Options:
      • Charge method: --charge (none/qeq) with QEq solver options.
      • Potential types: --bond, --angle, --vdw.
      • Custom parameters: --params, --rules.
  • Phase 4: User Interface Polish

    • Implement ASCII art banner for branding.
    • Add braille spinner progress indicators.
    • Render result tables (parameters, atom types, chain breakdown).
    • Display timing information and success footer.
  • Phase 5: Testing and Documentation

    • Verify stdin/stdout piping works correctly.
    • Verify round-trip format conversion.
    • Ensure non-zero exit codes and readable error messages.
    • Update README with CLI usage examples.

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions