Page **1** of **1**

### Injecting any kind of current under adaptive integration

Posted: **Thu Jun 01, 2017 6:19 am**

by **cafischer**

Injecting any kind of current works very well when the time steps are fixed. You can just play a vector of the current into an IClamp. However, when using adaptive integration the best you can do is to turn continuous on and you will have a linear interpolation of your discrete current. But is there also a possibility where I define the current as a function of t so that during the integration always the exact right amount of current will be used?

### Re: Injecting any kind of current under adaptive integration

Posted: **Thu Jun 01, 2017 8:05 am**

by **ted**

General answer: write a mod file that uses a function of time to control the amplitude of the delivered current.

Specific working example: try the code in

https://www.neuron.yale.edu/ftp/ted/neuron/izap.zip. izap.mod defines the Izap class--a point process that delivers a current described by a zap function. The other files in the zip file set up a single compartment model cell with hh that is used to demonstrate Izap.

If you have some other f(t) in mind,

1. copy izap.mod to a new file with a mnemonic name of your choosing

2. edit the new mod file to change the name of the point process class from Izap to something mnemonic

3. change the line in the BREAKPOINT block that calculates the current as a function of time

Code: Select all

`i = amp * sin( 2*PI * (t-del) * (f0 + (f1 - f0)*(t-del)/(2*dur)) * (0.001) )`

to whatever you need.

4. test the result to make sure it works correctly.