Crate synapse_models

Crate synapse_models 

Source
Expand description

§Synapse Models Library

A comprehensive Rust library for modeling synaptic dynamics in computational neuroscience.

§Overview

This library provides detailed biophysical models of synaptic transmission including:

  • Neurotransmitter dynamics: Multiple neurotransmitter types (glutamate, GABA, dopamine, etc.) with realistic release and clearance kinetics
  • Receptor models: Detailed kinetic models for ionotropic (AMPA, NMDA, GABA-A) and metabotropic (GABA-B, mGluR) receptors
  • Vesicle pool dynamics: Tsodyks-Markram model for short-term depression and facilitation
  • Calcium dynamics: Pre- and postsynaptic calcium with buffering, stores, and CICR
  • Plasticity rules: STDP, BCM, Oja’s rule, Hebbian learning, homeostatic plasticity
  • Network models: Support for chemical synapses, gap junctions, ephaptic coupling, and neuromodulation

§Features

  • Biologically accurate parameters based on experimental data
  • Efficient numerical integration using exponential Euler methods
  • Thread-safe design for parallel simulations
  • Comprehensive test coverage
  • Extensive documentation with neuroscience background

§Example: Basic Synaptic Transmission

use synapse_models::synapse::Synapse;

// Create an excitatory synapse
let mut synapse = Synapse::excitatory(1.0, 1.0)?;

// Presynaptic spike at t=0
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)?;

    // Get postsynaptic current
    let current = synapse.current(-65.0);
}

§Example: STDP Learning

use synapse_models::synapse::Synapse;

let mut synapse = Synapse::excitatory(0.5, 1.0)?;

let initial_weight = synapse.weight;

// Pre before post -> potentiation
synapse.presynaptic_spike(0.0)?;
synapse.postsynaptic_spike(10.0)?;

assert!(synapse.weight > initial_weight);

§Example: Network Simulation

use synapse_models::network::SynapticNetwork;
use synapse_models::synapse::Synapse;

// Create a network with 10 neurons
let mut network = SynapticNetwork::new(10);

// Add excitatory connections
for i in 0..9 {
    let syn = Synapse::excitatory(1.0, 1.0)?;
    network.add_connection(i, i + 1, syn)?;
}

// Spike from first neuron
network.spike(0)?;

// Update network
let voltages = vec![-65.0; 10];
network.update(&voltages, 0.1)?;

§Biophysical Background

§Synaptic Transmission

Synaptic transmission involves multiple steps:

  1. Action potential arrival triggers voltage-gated calcium channels
  2. Calcium influx causes vesicle fusion and neurotransmitter release
  3. Neurotransmitter diffusion across the synaptic cleft (~20 nm)
  4. Receptor binding opens ion channels or activates second messengers
  5. Postsynaptic current flows, changing membrane potential
  6. Neurotransmitter clearance by reuptake or degradation

§Short-Term Plasticity

Short-term plasticity operates on timescales of milliseconds to seconds:

  • Depression: Depletion of readily releasable vesicle pool
  • Facilitation: Residual calcium enhances release probability
  • Modeled by Tsodyks-Markram equations

§Long-Term Plasticity

Long-term plasticity underlies learning and memory:

  • STDP: Spike timing-dependent modification (±20-40 ms window)
  • LTP/LTD: Long-term potentiation/depression
  • Requires postsynaptic calcium elevation
  • CaMKII activation → LTP, calcineurin activation → LTD

§Mathematical Models

§Receptor Kinetics

First-order binding scheme:

dR/dt = α[NT](1-R) - βR

where R is open probability, [NT] is neurotransmitter concentration, α is binding rate, β is unbinding rate.

§NMDA Voltage Dependence

Mg²⁺ block (Jahr & Stevens, 1990):

B(V) = 1 / (1 + [Mg²⁺]/3.57 * exp(-0.062*V))

§Tsodyks-Markram Model

dx/dt = (1-x)/τ_rec - U*x*δ(t-t_spike)
du/dt = (U₀-u)/τ_facil + U₀(1-u)δ(t-t_spike)

§STDP Window

Δw = A₊ exp(-Δt/τ₊)     for Δt > 0 (potentiation)
Δw = -A₋ exp(Δt/τ₋)     for Δt < 0 (depression)

§Performance Considerations

  • Uses exponential Euler integration for numerical stability
  • Sparse network representation for efficiency
  • Minimal allocations in update loops
  • Thread-safe for parallel neuron updates

§References

  • Tsodyks & Markram (1997). The neural code between neocortical pyramidal neurons depends on neurotransmitter release probability.
  • Bi & Poo (1998). Synaptic modifications in cultured hippocampal neurons: dependence on spike timing, synaptic strength, and postsynaptic cell type.
  • Jahr & Stevens (1990). Voltage dependence of NMDA-activated macroscopic conductances predicted by single-channel kinetics.
  • Bienenstock et al. (1982). Theory for the development of neuron selectivity: orientation specificity and binocular interaction in visual cortex.

Re-exports§

pub use error::Result;
pub use error::SynapseError;
pub use synapse::Synapse;
pub use synapse::SynapseBuilder;
pub use synapse::SynapseType;
pub use network::SynapticNetwork;
pub use network::NetworkStats;

Modules§

calcium
Calcium dynamics in pre- and postsynaptic compartments.
error
Error types for synapse models library.
network
Network-level synaptic dynamics.
neurotransmitter
Neurotransmitter types and their biophysical properties.
plasticity
Synaptic plasticity rules for learning and memory.
receptor
Receptor dynamics and kinetic models.
synapse
Complete synapse model integrating all components.
vesicle
Vesicle pool dynamics and neurotransmitter release mechanisms.

Constants§

VERSION
Library version.