torchcor

GPU-accelerated cardiac electrophysiology simulation in PyTorch.

torchcor solves large-scale cardiac electrophysiology on the GPU — from the full monodomain reaction-diffusion model to the fast reaction-eikonal model and body-surface ECGs — with a library of biophysical ionic cell models and a finite-element core that runs on CUDA or CPU.

pip install torchcor

What’s inside

🫀 Monodomain

The full reaction-diffusion reference model: implicit FEM diffusion + explicit ionic update, on millions of nodes.

Monodomain simulation
⚡ Reaction-Eikonal

Fast activation times from an eikonal solver, with the action potentials filled in — a fraction of monodomain cost.

Reaction-Eikonal model
📈 ECGs & electrograms

Body-surface 12-lead ECGs from the transmembrane voltage via a reciprocal lead-field solver.

ECGs and electrograms (lead field)
🧬 Ionic models

Phenomenological and biophysical human atrial / ventricular cell models.

Ionic models

Why torchcor

  • GPU-native. Everything — FEM assembly, the conjugate-gradient solves, the ionic ODEs, the eikonal sweeps — runs as vectorised PyTorch on the GPU.

  • Whole-heart scale. Designed for million-node meshes (atria, ventricles, heart-torso).

  • From timing to ECG. Activation maps, full transmembrane voltage, and body-surface potentials, in one library.