Created
January 13, 2021 21:17
-
-
Save doble-d/c51dcbecc586f469d3e47cd936dad7fd to your computer and use it in GitHub Desktop.
Goldman-Hodgkin-Katz equation in dart lang.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:math' as math; | |
// Temperatures should be in Kelvin | |
// pK, pNa, and pCl refer to the permeability. (e.g. If the channels for Na are closed, Na permeability is 0 (zero)) | |
// Everything In or Out is in mM | |
// Membrane potential (voltage) is returned as mV | |
double ghkCalculator(double temperature, | |
double pK, double pNa, double pCl, | |
double kIn, double kOut, | |
double naIn, double naOut, | |
double clIn, double clOut) { | |
const double universalGasConstant = 8.314; | |
const double faradayConstant = 96485.0; | |
double voltage; | |
voltage = ((universalGasConstant * temperature) / faradayConstant) * math.log(((pK*kOut) + (pNa*naOut) + (pCl*clIn)) / ((pK*kIn) + (pNa*naIn) + (pCl*clOut))); | |
return voltage / 1e-3; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment