sg-s / xolotl

A MATLAB neuron simulator. Very fast (written in C++). Flexible (fully object oriented). Immediate (live manipulation in MATLAB). Comes with a powerful parameter optimizer. Get started ➡️
https://go.brandeis.edu/xolotl
GNU General Public License v3.0
43 stars 8 forks source link

Struggling with inhibitory synapses #578

Closed AlexSonneborn closed 2 years ago

AlexSonneborn commented 2 years ago

Please go through the following steps before you file an issue that documents a problem or a potential bug and please check each item as you do so:

Information

Please provide the following information:

Operating System

Windows 10

Output of "version" command in MATLAB

'9.11.0.1769968 (R2021b)'

Output of "mex.getCompilerConfigurations('C++')" in MATLAB

ans =

CompilerConfiguration with properties:

         Name: 'MinGW64 Compiler (C++)'
 Manufacturer: 'GNU'
     Language: 'C++'
      Version: '6.3.0'
     Location: 'C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset'
    ShortName: 'mingw64-g++'
     Priority: 'E'
      Details: [1×1 mex.CompilerConfigurationDetails]
   LinkerName: 'C:\ProgramData\MATLAB\SupportPackages\R2021b\3P.instrset\mingw_w64.instrset\bin\g++'
LinkerVersion: ''
       MexOpt: 'C:\Users\sonnebor\AppData\Roaming\MathWorks\MATLAB\R2021b\mex_C++_win64.xml'

Bug reports

Please replace this section with:

What you were trying to do (include code to reproduce error)

I am trying to make an inhibitory synapse

What you expected to happen

I expected whenever the inhibitory cell fired to have a brief hyperpolarization in my mPFC pyramidal cell (below).

What actually happened

I pasted the error and my code below. The 5th to last line is the one that is causing the issue. If I just comment this line out, everything works fine.

Error using mex
C:\Users\sonnebor\AppData\Local\Temp\1\mex_2263249688272427_58116\X_c76349b260203eda05b19936eaa74757.obj:X_c76349b260203eda05b19936eaa74757.cpp:(.rdata$_ZTV10Inhibitory[_ZTV10Inhibitory]+0x38):
undefined reference to `Inhibitory::getCurrent(double)'
collect2.exe: error: ld returned 1 exit status

Error in xolotl/compile (line 64)
    mex('-silent',ipath,mexBridge_name,'-outdir',filelib.cachePath('xolotl'))

Error in xolotl/integrate (line 113)
    self.compile;

Error in xolotl/plot (line 150)
[V, Ca, ~, currents] = self.integrate;

Error in FirstXolotl (line 35)
x.plot

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

x = xolotl;

% Adding different neurons
x.add('compartment','CLA','A', .05);
x.add('compartment','mPFCinter','A', .025);
x.add('compartment','mPFCPyr1','A', .05);

x.approx_channels = 0;
x.stochastic_channels = 0;

% Adding in 
x.CLA.add('liu/NaV', 'gbar', 1000, 'E', 30);
x.CLA.add('liu/Kd', 'gbar', 300, 'E', -80);
x.CLA.add('turrigiano/ASlow');
x.CLA.add('traub/Kahp');
x.CLA.add('hill/HCurrent');
x.CLA.add('Leak', 'gbar', .1);

x.mPFCinter.add('liu/NaV', 'gbar', 1000, 'E', 30);
x.mPFCinter.add('liu/Kd', 'gbar', 300, 'E', -70);
x.mPFCinter.add('Leak', 'gbar', .1);

x.mPFCPyr1.add('liu/NaV', 'gbar', 1000, 'E', 30);
x.mPFCPyr1.add('liu/Kd', 'gbar', 300, 'E', -80);
x.mPFCPyr1.add('Leak', 'gbar', .1);
x.mPFCPyr1.add('hill/HCurrent');

% Adding some synapses between neurons
x.connect('CLA','mPFCinter','borgers/AMPA', 'gmax', 30);
x.connect('CLA','mPFCinter','borgers/NMDA', 'gmax', 30);
x.connect('mPFCinter','mPFCPyr1','cymbalyuk/Inhibitory','gmax',40);

x.t_end = 1000; %ms
x.I_ext = [randn(x.t_end/x.sim_dt,1) randn(x.t_end/x.sim_dt,1) randn(x.t_end/x.sim_dt,1)];
x.plot

xlim([0 1])
AlexSonneborn commented 2 years ago

By the way, this is a super awesome tool. Thanks for making it.

sg-s commented 2 years ago

hello, are you trying to make your own custom synapse?

if so, please also paste in the C++ code in your .hpp file.

if you're using a built-in synapse, please point to the problematic synapse

AlexSonneborn commented 2 years ago

I am just trying to add in this pre-made inhibitory synapse:

x.connect('mPFCinter','mPFCPyr1','cymbalyuk/Inhibitory','gmax',40);

and I get this error

C:\Users\sonnebor\AppData\Local\Temp\1\mex_2263249688272427_58116\X_c76349b260203eda05b19936eaa74757.obj:X_c76349b260203eda05b19936eaa74757.cpp:(.rdata$_ZTV10Inhibitory[_ZTV10Inhibitory]+0x38): undefined reference to `Inhibitory::getCurrent(double)' collect2.exe: error: ld returned 1 exit status

sg-s commented 2 years ago

aah, my bad. let me take a look and make a patch.

rolsonjames94 commented 2 years ago

I have also been having this problem, thank you :)

sg-s commented 2 years ago

hi @rolsonjames94 and @AlexSonneborn, I think it's fixed. this synapse had an errant redeclaration of the getCurrent method, but it was never redefined.

I've pushed a patch that fixes it. (all I did was delete the line that declared getCurrent in cymbalyuk/Inhibitory.hpp.

If you installed via git, please do a git pull and you should be good to go.

If you installed via the toolbox, the simplest thing for you to do is to replicate the fix -- go to that file and comment out the getCurrent declaration.

Let me know if this solves your problem, and if so, please close the issue

rolsonjames94 commented 2 years ago

Thank you so much that worked. You are insanely fast and this program is amazing, looking forward to using it more!!

AlexSonneborn commented 2 years ago

Thanks! I think I can just do this for the soplata GABAergic one as well? It is line 42 in that script.

sg-s commented 2 years ago

oof, you are absolutely right, yes, you can. I'll fix those in other synapses where I can find them and push this patch

AlexSonneborn commented 2 years ago

I actually also had another question. It is not immediately obvious if there is a way to inject current only for part of a simulation. Is there a way to do this?

sg-s commented 2 years ago

Yes, please see:

https://xolotl.readthedocs.io/en/master/how-to/inject-current/#inject-a-time-varying-current-into-a-compartment