Hi @itq. Injecting an external current into a neuron with an electrode is actually something that is done quite commonly in experiments (the technical term is “current clamp”). To inject such a current, you include it in the equations. This is what is done in the HH model you linked to:
# The model
eqs = Equations('''
dv/dt = (gl*(El-v) - g_na*(m*m*m)*h*(v-ENa) - g_kd*(n*n*n*n)*(v-EK) + I)/Cm : volt
# ...
I : amp
''')
group = NeuronGroup(...)
group.v = El
group.I = '0.7*nA * i / num_neurons'
The I
is an injected current that is set to a value between 0 and 0.7nA, linearly spaced based on the index i
of each neuron.
Now, your model is formulated slightly differently for simplicity, basically things are divided by gl
from the HH equations. In your case, you’d therefore indeed “add a constant voltage” to the neuron, which physics-wise is a bit odd to say, but it’ll do
You can either do:
v_ext = 1*mV # external input
eqs = '''
dv/dt = (v_0 - v + g + v_ext) / t_mbr : volt (unless refractory)
dg/dt = -g / tau : volt (unless refractory)
rfc : second
'''
for the same input to all neurons, or:
eqs = '''
dv/dt = (v_0 - v + g + v_ext) / t_mbr : volt (unless refractory)
dg/dt = -g / tau : volt (unless refractory)
rfc : second
v_ext : volt (constant)
'''
...
neu.v_ext = ... # one value for each neuron
to have a different input into each neuron.
Hope that helps!