Skip to content

Commit

Permalink
Merge pull request #336 from upibhalla/master
Browse files Browse the repository at this point in the history
Fixes to Hsolve and Neuron
  • Loading branch information
dilawar committed Nov 24, 2018
2 parents 189778c + d57fa1d commit 169d0c8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
21 changes: 20 additions & 1 deletion biophysics/Neuron.cpp
Expand Up @@ -1141,10 +1141,29 @@ void Neuron::setChannelDistribution( const Eref& e, vector< string > v )
vector< vector< string > > lines;
if ( parseDistrib( lines, v ) )
{
unsigned int index = 0;
vector< unsigned int > chanIndices;
vector< unsigned int > temp;
channelDistribution_ = v;
// We need to ensure that Ca_concs are created before any channels
// since the channels may want to connect to them.
for ( unsigned int i = 0; i < lines.size(); ++i )
{
vector< string >& temp = lines[i];
Id proto( "/library/" + lines[i][0] );
if ( proto != Id() ) {
if ( proto.element()->cinfo()->isA( "CaConcBase" ) ) {
chanIndices.push_back( i );
} else {
temp.push_back( i );
}
}
}
chanIndices.insert( chanIndices.end(), temp.begin(), temp.end() );
assert( chanIndices.size() == lines.size() );

for ( unsigned int i = 0; i < lines.size(); ++i )
{
vector< string >& temp = lines[chanIndices[i]];
vector< ObjId > elist;
vector< double > val;
buildElist( e, temp, elist, val );
Expand Down
1 change: 1 addition & 0 deletions hsolve/HSolveActive.cpp
Expand Up @@ -63,6 +63,7 @@ void HSolveActive::step( ProcPtr info )
sendValues( info );
sendSpikes( info );

prevExtCurr_ = externalCurrent_;
externalCurrent_.assign( externalCurrent_.size(), 0.0 );
}

Expand Down
1 change: 1 addition & 0 deletions hsolve/HSolveActive.h
Expand Up @@ -119,6 +119,7 @@ class HSolveActive: public HSolvePassive
vector< double > externalCurrent_; ///< External currents from
///< channels that HSolve
///< cannot internalize.
vector< double > prevExtCurr_; ///< Last tick's externalCurrent
vector< double > externalCalcium_; /// calcium from difshells
vector< Id > caConcId_; ///< Used for localIndex-ing.
vector< Id > channelId_; ///< Used for localIndex-ing.
Expand Down
1 change: 1 addition & 0 deletions hsolve/HSolveActiveSetup.cpp
Expand Up @@ -584,6 +584,7 @@ void HSolveActive::readExternalChannels()

//~ externalChannelId_.resize( compartmentId_.size() );
externalCurrent_.resize( 2 * compartmentId_.size(), 0.0 );
prevExtCurr_.resize( externalCurrent_.size(), 0.0 );

//~ for ( unsigned int ic = 0; ic < compartmentId_.size(); ++ic )
//~ HSolveUtils::targets(
Expand Down
2 changes: 2 additions & 0 deletions hsolve/HSolveInterface.cpp
Expand Up @@ -170,6 +170,8 @@ double HSolve::getIm( Id id ) const
for ( ; icurrent < currentBoundary_[ index ]; ++icurrent )
Im += ( icurrent->Ek - V_[ index ] ) * icurrent->Gk;

assert( 2 * index + 1 < externalCurrent_.size() );
Im += prevExtCurr_[2*index+1] - prevExtCurr_[2*index]*V_[index];
return Im;
}

Expand Down

0 comments on commit 169d0c8

Please sign in to comment.