Skip to content
Permalink
Browse files

Extended impedance injection location was changed when input impedance

was calculated. Now transfer impedance behavior is same as
with original default non-extended impedance even when requests for
transfer impedance and input impedance are interleaved.
  • Loading branch information...
nrnhines committed Dec 14, 2018
1 parent fb967da commit 50728e66eae4f65697870cf0ed07facc45067a3c
Showing with 30 additions and 12 deletions.
  1. +2 −2 src/nrniv/impedanc.cpp
  2. +26 −8 src/nrniv/nonlinz.cpp
  3. +2 −2 src/nrniv/nonlinz.h
@@ -371,7 +371,7 @@ int Imp::loc(Section* sec, double x){
double Imp::transfer_amp(Section* sec, double x){
check();
int vloc = loc(sec, x);
return nli_ ? nli_->transfer_amp(vloc) : abs(transfer[vloc]);
return nli_ ? nli_->transfer_amp(istim, vloc) : abs(transfer[vloc]);
}

double Imp::input_amp(Section* sec, double x){
@@ -381,7 +381,7 @@ double Imp::input_amp(Section* sec, double x){

double Imp::transfer_phase(Section* sec, double x){
check();
return nli_ ? nli_->transfer_phase(loc(sec, x)) : arg(transfer[loc(sec, x)]);
return nli_ ? nli_->transfer_phase(istim, loc(sec, x)) : arg(transfer[loc(sec, x)]);
}

double Imp::input_phase(Section* sec, double x){
@@ -63,42 +63,60 @@ NonLinImp::~NonLinImp() {
delete rep_;
}
}
double NonLinImp::transfer_amp(int vloc) {
double NonLinImp::transfer_amp(int curloc, int vloc) {
if (nrnmpi_numprocs > 1 && nrnthread_v_transfer_ && curloc != rep_->iloc_) {
hoc_execerror("current injection site change not allowed with both gap junctions and nhost > 1", 0);
}
if (curloc != rep_->iloc_) {
solve(curloc);
}
double x = rep_->rv_[vloc];
double y = rep_->jv_[vloc];
return sqrt(x*x+y*y);
}
double NonLinImp::input_amp(int curloc) {
if (nrnmpi_numprocs > 1 && nrnthread_v_transfer_) {
hoc_execerror("not allowed with both gap junctions and nhost>0", 0);
hoc_execerror("not allowed with both gap junctions and nhost>1", 0);
}
if (curloc != rep_->iloc_) {
solve(curloc);
}
solve(curloc);
if (curloc < 0) { return 0.0; }
double x = rep_->rv_[curloc];
double y = rep_->jv_[curloc];
return sqrt(x*x+y*y);
}
double NonLinImp::transfer_phase(int vloc) {
double NonLinImp::transfer_phase(int curloc, int vloc) {
if (nrnmpi_numprocs > 1 && nrnthread_v_transfer_ && curloc != rep_->iloc_) {
hoc_execerror("current injection site change not allowed with both gap junctions and nhost > 1", 0);
}
if (curloc != rep_->iloc_) {
solve(curloc);
}
double x = rep_->rv_[vloc];
double y = rep_->jv_[vloc];
return atan2(y, x);
}
double NonLinImp::input_phase(int curloc) {
if (nrnmpi_numprocs > 1 && nrnthread_v_transfer_) {
hoc_execerror("not allowed with both gap junctions and nhost>0", 0);
hoc_execerror("not allowed with both gap junctions and nhost>1", 0);
}
if (curloc != rep_->iloc_) {
solve(curloc);
}
solve(curloc);
if (curloc < 0) { return 0.0; }
double x = rep_->rv_[curloc];
double y = rep_->jv_[curloc];
return atan2(y,x);
}
double NonLinImp::ratio_amp(int clmploc, int vloc) {
if (nrnmpi_numprocs > 1 && nrnthread_v_transfer_) {
hoc_execerror("not allowed with both gap junctions and nhost>0", 0);
hoc_execerror("not allowed with both gap junctions and nhost>1", 0);
}
solve(clmploc);
if (clmploc < 0) { return 0.0; }
if (clmploc != rep_->iloc_) {
solve(clmploc);
}
double ax,bx,cx, ay,by,cy,bb;
ax = rep_->rv_[vloc];
ay = rep_->jv_[vloc];
@@ -8,8 +8,8 @@ class NonLinImp {
NonLinImp();
virtual ~NonLinImp();
void compute(double omega, double deltafac, int maxiter);
double transfer_amp(int vloc); // v_node[arg] is the node
double transfer_phase(int vloc);
double transfer_amp(int curloc, int vloc); // v_node[arg] is the node
double transfer_phase(int curloc, int vloc);
double input_amp(int curloc);
double input_phase(int curloc);
double ratio_amp(int clmploc, int vloc);

0 comments on commit 50728e6

Please sign in to comment.
You can’t perform that action at this time.