| Crates.io | synapse-models |
| lib.rs | synapse-models |
| version | 0.1.0 |
| created_at | 2025-11-10 21:27:43.392621+00 |
| updated_at | 2025-11-10 21:27:43.392621+00 |
| description | Biophysical synapse models for neural simulations with short-term plasticity |
| homepage | |
| repository | https://github.com/Yatrogenesis/cortexia-workspace |
| max_upload_size | |
| id | 1926228 |
| size | 159,824 |
A comprehensive Rust library for modeling synaptic dynamics in computational neuroscience. This library provides detailed biophysical models of synaptic transmission, plasticity, and network dynamics.
Add to your Cargo.toml:
[dependencies]
synapse-models = "0.1.0"
use synapse_models::Synapse;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create an excitatory synapse
let mut synapse = Synapse::excitatory(1.0, 1.0)?;
// Presynaptic spike
synapse.presynaptic_spike(0.0)?;
// Simulate for 10 ms
for t in 0..100 {
let time = t as f64 * 0.1;
synapse.update(time, -65.0, 0.1)?;
println!("t={:.1} ms, g={:.4} nS", time, synapse.conductance());
}
Ok(())
}
use synapse_models::Synapse;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut synapse = Synapse::excitatory(0.5, 1.0)?;
let initial_weight = synapse.weight;
// Pre before post (10 ms) → potentiation
synapse.presynaptic_spike(0.0)?;
synapse.postsynaptic_spike(10.0)?;
println!("Weight change: {:.6}", synapse.weight - initial_weight);
// Output: Weight change: 0.006065 (potentiation)
Ok(())
}
use synapse_models::{SynapticNetwork, Synapse};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a network with 10 neurons
let mut network = SynapticNetwork::new(10);
// Add connections
for i in 0..9 {
let syn = Synapse::excitatory(1.0, 2.0)?;
network.add_connection(i, i + 1, syn)?;
}
// Spike from first neuron
network.spike(0)?;
// Simulate
let voltages = vec![-65.0; 10];
for _ in 0..100 {
network.update(&voltages, 0.1)?;
}
// Get synaptic current to neuron 5
let current = network.get_synaptic_current(5)?;
println!("Current to neuron 5: {:.2} pA", current);
Ok(())
}
All parameters are based on experimental data:
First-order binding:
dR/dt = α[NT](1-R) - βR
where R is open probability, [NT] is neurotransmitter concentration.
Jahr & Stevens (1990):
B(V) = 1 / (1 + [Mg²⁺]/3.57 * exp(-0.062*V))
dx/dt = (1-x)/τ_rec - U*x*δ(t-t_spike)
du/dt = (U₀-u)/τ_facil + U₀(1-u)δ(t-t_spike)
Δw = A+ * exp(-Δt/τ+) for Δt > 0 (potentiation)
Δw = -A- * exp(Δt/τ-) for Δt < 0 (depression)
Run the examples:
# Basic synapse simulation
cargo run --example basic_synapse
# Network simulation
cargo run --example network_simulation
Run the comprehensive test suite:
cargo test --package synapse-models
All 68 tests cover:
synapse-models/
├── src/
│ ├── lib.rs # Main library with documentation
│ ├── error.rs # Error types
│ ├── neurotransmitter.rs # Neurotransmitter dynamics
│ ├── receptor.rs # Receptor models
│ ├── vesicle.rs # Vesicle pool dynamics
│ ├── calcium.rs # Calcium dynamics
│ ├── plasticity.rs # Learning rules
│ ├── synapse.rs # Complete synapse model
│ └── network.rs # Network-level dynamics
├── examples/ # Example programs
└── tests/ # Integration tests
Tsodyks & Markram (1997) - Short-term synaptic plasticity model
Bi & Poo (1998) - STDP experimental characterization
Jahr & Stevens (1990) - NMDA Mg²⁺ block
Bienenstock et al. (1982) - BCM theory
This library is part of the CORTEXIA computational neuroscience toolkit. Contributions are welcome!
MIT OR Apache-2.0
If you use this library in your research, please cite:
@software{synapse_models,
title = {Synapse Models: A Comprehensive Rust Library for Synaptic Dynamics},
author = {Molina Burgos, Francisco and Claude-CORTEXIA},
year = {2024},
url = {https://github.com/cortexia/synapse-models}
}
This library implements models from numerous experimental and theoretical studies in neuroscience. We thank the researchers whose work made this possible.