Skip to content

feat: libsmodlyn in rust - #175

Closed
dilawar wants to merge 20 commits into
ssandrews:masterfrom
dilawar:rust-top-down
Closed

dilawar wants to merge 20 commits into
ssandrews:masterfrom
dilawar:rust-top-down

Conversation

@dilawar

@dilawar dilawar commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Dilawar Singh and others added 20 commits September 12, 2026 21:54
libsmoldyn crate:
- Sim owns the simptr (freed on drop, not Clone/Sync), replacing
  MutSimptr/ConstSimptr whose Clone + Drop double-freed.
- SmolError built from smolGetError; notify/warning codes are cleared so
  they don't stick to later calls.
- Bind all of libsmoldyn.h via the cxx bridge, with ErrorCode, MolecState,
  PanelShape, PanelFace, SrfAction, DrawMode, CmptLogic and RevParam as
  extern enums checked against the C++ definitions.
- Methods split by area under sim/: output, molecules, surfaces,
  compartments, reactions, ports, lattices, graphics.
- include/smolrs.h: read-only simstruct accessors (time, dim, bounds,
  species) so Rust never depends on the struct layout.
- run_with(stop, on_step) steps with a stop flag; run() uses
  smolRunSimUntil so it isn't cut short after step().
- build.rs reruns cmake when the C/C++ sources change.

libsmoldyn.cpp fixes:
- smolAddLattice dereferenced sim->latticess before it was allocated.
- smolRunCommand left cmd->cmds NULL, so output commands (molcount)
  segfaulted.

smoldyn CLI: first Ctrl-C stops after the current time step (output files
flushed), second exits immediately; both exit with 130.
@dilawar dilawar closed this Sep 29, 2026
@dilawar

dilawar commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator Author

Opened here by mistake.

@dilawar
dilawar deleted the rust-top-down branch September 29, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant