Boltzmann and elementary charge values

NMODL and the Channel Builder.
Post Reply
bremen
Posts: 52
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Boltzmann and elementary charge values

Post by bremen »

Hi.

I would need some help to translate an equation, I found on a paper, into the correct NEURON equivalent.

This equation controls the forward transition between two states in a markov chain.

Code: Select all

alpha = ao exp(eo zada E/kT)
ao is an integer calculate by the authors, eo is the elementary charge, zada is an integer calculate by the authors, E is the voltage, k is the Boltzmann constant, T is the absolute temperature.

I can "simply" replace the elementary charge and the Boltzmann constast with their actual values or is there a better way?
ted
Site Admin
Posts: 6381
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Boltzmann and elementary charge values

Post by ted »

Are you asking about a statement in a hoc or Python file, or in a mod file?
bremen
Posts: 52
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Re: Boltzmann and elementary charge values

Post by bremen »

My bad, I forgot to write that the equation will be used in a MOD file.
ted
Site Admin
Posts: 6381
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Boltzmann and elementary charge values

Post by ted »

Regardless of the programming language, it is generally not a good idea to embed magic numbers (numerical constants) in code. Instead, it is best to use a variable whose value will not be changed during a simulation. In NMODL you could define a symbolic constant by declaring its name and assigning a numeric value to it, with appropriate units, in a CONSTANT block. However, the recommended practice is to do this in the UNITS block. For examples, see
https://nrn.readthedocs.io/en/8.2.6/pyt ... nmodl.html
bremen
Posts: 52
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Re: Boltzmann and elementary charge values

Post by bremen »

Thank you.

I have added the two costant as UNITS and the MOD files pass nrnivmodl without issues.
bremen
Posts: 52
Joined: Mon Apr 24, 2017 8:15 am
Location: Italy

Re: Boltzmann and elementary charge values

Post by bremen »

Hi.

For nrnivmodl was ok but for modlunit is not and the voltage clamp showed that too.

Code: Select all

alpha = 50exp(e * 1.2 * v/(boltzmann *(273.15 + celsius)))
The previous expression needs the conversion factor (1000)
My issue is where i have to apply the conversion factor. If I simply multiply everything for 1000 it goes even worse.
ted
Site Admin
Posts: 6381
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Boltzmann and elementary charge values

Post by ted »

To give specific advice, I'll have to reproduce the error for myself. Can you email the mod file in question to ted dot carnevale at yale dot edu?
Post Reply