Page 1 of 1

Boltzmann and elementary charge values

Posted: Fri Jan 31, 2025 3:32 am
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?

Re: Boltzmann and elementary charge values

Posted: Fri Jan 31, 2025 2:58 pm
by ted
Are you asking about a statement in a hoc or Python file, or in a mod file?

Re: Boltzmann and elementary charge values

Posted: Sat Feb 01, 2025 8:29 am
by bremen
My bad, I forgot to write that the equation will be used in a MOD file.

Re: Boltzmann and elementary charge values

Posted: Sat Feb 01, 2025 12:06 pm
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

Re: Boltzmann and elementary charge values

Posted: Sat Feb 01, 2025 2:04 pm
by bremen
Thank you.

I have added the two costant as UNITS and the MOD files pass nrnivmodl without issues.

Re: Boltzmann and elementary charge values

Posted: Tue Feb 04, 2025 9:49 am
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.

Re: Boltzmann and elementary charge values

Posted: Wed Feb 05, 2025 5:35 pm
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?