Next: A Practical Example 2: Up: Introducing Hsolve for Single Previous: The 'findsolvefield' command Contents

# A Practical Example 1: `Hsolve` and the `efield` Object

As a first practical example, we show how to use `hsolve` for extracellular field recordings. The `efield` object represents an extracellular field potential recording electrode that uses current sources and their distance from the electrode site to calculate the field potential. The current sources are the compartments that are computed by `hsolve`. If the `RESET` action is called on the `efield` object, it calculates the distances from the compartments to the electrode, and fills in the distance from the source element, that is sending the message, to the destination element, the `efield` element.

1. Create a model of a multi-compartment cell.
2. Create an `efield` element and give it a sensible position. Create messages between the compartments and the `efield` element to have it calculate the extracellular field potential.
3. Create and setup `hsolve`.
4. Reset the simulation and check the simulation schedule with the `showsched` command.
5. Inspect the distances between the compartments and the recording electrode. These distances have been calculated by the `efield` element because of the `reset`.
6. Run a simulation for some time, check that the `efield` is indeed calculating the field potential.

NOTE: In `chanmode` 4 `hsolve` calculates the capacitive current for the field `Im`, not the total membrane current. You can use `chanmode` 4 in this example, but the results will not be what you expect. Nevertheless it is a useful exercise, also check out what changing from `chanmode` 0 to `chanmode` 4 does to the simulation schedule.

NOTE: The scripts for this example allow to switch off `hsolve` and use the compartments to do the computations. What happens if you naively switch from `hsolve` to the compartments and why?

Next: A Practical Example 2: Up: Introducing Hsolve for Single Previous: The 'findsolvefield' command Contents