C C There are a total of 3 entries in the algebraic variable array. C There are a total of 2 entries in each of the rate and state variable arrays. C There are a total of 10 entries in the constant variable array. C C C VOI is time in component environment (ms). C ALGBRC(1) is J_stim in component J_stim (per_ms). C CONSTS(1) is IstimStart in component J_stim (ms). C CONSTS(2) is IstimEnd in component J_stim (ms). C CONSTS(3) is IstimAmplitude in component J_stim (per_ms). C CONSTS(4) is IstimPeriod in component J_stim (ms). C CONSTS(5) is IstimPulseDuration in component J_stim (ms). C STATES(1) is Vm in component membrane (dimensionless). C ALGBRC(2) is J_in in component J_in (per_ms). C ALGBRC(3) is J_out in component J_out (per_ms). C CONSTS(6) is tau_in in component J_in (ms). C STATES(2) is h in component J_in_h_gate (dimensionless). C CONSTS(7) is tau_open in component J_in_h_gate (ms). C CONSTS(8) is tau_close in component J_in_h_gate (ms). C CONSTS(9) is V_gate in component J_in_h_gate (dimensionless). C CONSTS(10) is tau_out in component J_out (ms). C RATES(1) is d/dt Vm in component membrane (dimensionless). C RATES(2) is d/dt h in component J_in_h_gate (dimensionless). C SUBROUTINE initConsts(CONSTS, RATES, STATES) REAL CONSTS(*), RATES(*), STATES(*) CONSTS(1) = 0 CONSTS(2) = 50000 CONSTS(3) = 0.2 CONSTS(4) = 500 CONSTS(5) = 1 STATES(1) = 0.00000820413566106744 CONSTS(6) = 0.3 STATES(2) = 0.8789655121804799 CONSTS(7) = 120.0 CONSTS(8) = 150.0 CONSTS(9) = 0.13 CONSTS(10) = 6.0 RETURN END SUBROUTINE computeRates(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) RATES(2) = TERNRY(STATES(1).LT.CONSTS(9), (1.00000 - STATES(2))/CONSTS(7), - STATES(2)/CONSTS(8)) ALGBRC(1) = TERNRY(VOI.GE.CONSTS(1).AND.VOI.LE.CONSTS(2).AND.(VOI - CONSTS(1)) - INT((VOI - CONSTS(1))/CONSTS(4))*CONSTS(4).LE.CONSTS(5), CONSTS(3), 0.00000) ALGBRC(2) = ( STATES(2)*( STATES(1) ** 2.00000*(1.00000 - STATES(1))))/CONSTS(6) ALGBRC(3) = - (STATES(1)/CONSTS(10)) RATES(1) = ALGBRC(2)+ALGBRC(3)+ALGBRC(1) RETURN END SUBROUTINE computeVariables(VOI, CONSTS, RATES, STATES, ALGBRC) REAL VOI, CONSTS(*), RATES(*), STATES(*), ALGBRC(*) ALGBRC(1) = TERNRY(VOI.GE.CONSTS(1).AND.VOI.LE.CONSTS(2).AND.(VOI - CONSTS(1)) - INT((VOI - CONSTS(1))/CONSTS(4))*CONSTS(4).LE.CONSTS(5), CONSTS(3), 0.00000) ALGBRC(2) = ( STATES(2)*( STATES(1) ** 2.00000*(1.00000 - STATES(1))))/CONSTS(6) ALGBRC(3) = - (STATES(1)/CONSTS(10)) RETURN END REAL FUNCTION TERNRY(TEST, VALA, VALB) LOGICAL TEST REAL VALA, VALB IF (TEST) THEN TERNRY = VALA ELSE TERNRY = VALB ENDIF RETURN END