This repository contains files which implement a fourth order Runge-Kutta method to solve the system introduced in the paper Minimal model for calcium alternans due to SR release refractoriness
The programs have some dependencies:
- Python: requires numba, os, sys and numpy
- Julia: requires CSV and DataFrames, These two packages are only used to save the results. Of course other methods can be used.
- C: uses cmath and iostream.
To compile the C version I used g++ -o calcium calcium.cc.
The file cark.cc is the file exposing the functions compiled in WASM. This file was compiled using:
emcc cark.cc -o cark.js -sEXPORTED_RUNTIME_METHODS=ccall,cwrap -sEXPORT_ES6 -sMODULARIZE -sMALLOC=dlmalloc -sALLOW_MEMORY_GROWTH=1 -sEXPORTED_FUNCTIONS=_malloc,_free,_I_s,_c_i,_c_r,_rk
The three versions take three arguments:
Thus, to use the programs:
C:
$./calcium 400 500 20 > Ca.datThis redirects the output to Ca.dat, which contains as columns:
Python:
$./caKi.py 400 500 20This produces two files KCa.npy and Kical.npy which contain arrays with the solution and the stimulus. These can be accessed later using something like:
Sn = np.load('KCa.npy');
In = np.load('KIcal.npy');
t= Sn[:,0];
C=Sn[:,1];
q=Sn[:,2];
Julia:
$./ca_rk.jl 400 500 20This will produce a csv file Ca_Results.csv with colums corresponding to
As described in the paper, depending of the relationshp between
The former case show a 2:1 alternating regime. The latter, a regular periodic calcium release regime.

