Git Product home page Git Product logo

Comments (7)

nrnhines avatar nrnhines commented on May 30, 2024 1

So

DERIVATIVE states { 
  if (enable) {  
    m' = (1.0 - m) * 0.1
  }
}

translates to correct c syntax.

from nrn.

nrnhines avatar nrnhines commented on May 30, 2024

I will try to fix that , but it still won't be a valid model unless the states block is written

DERIVATIVE states   {
    if (enable == 1) {
      m' = (mInf-m)/mTau
      h' = (hInf-h)/hTau
    }else{
      m' = 0
      h' = 0
    }
}

from nrn.

nrnhines avatar nrnhines commented on May 30, 2024

There does not seem to be any easy way to fix this internally. I recommend you use the style

DERIVATIVE states   {
  LOCAL mt, ht
    if (enable == 1) {
      mt = 1/mTau
      ht = 1/hTau
    }else{
      mt = 0
      ht = 0
    }
    m' = (mInf-m)*mt
    h' = (hInf-h)*ht
}

from nrn.

pramodk avatar pramodk commented on May 30, 2024

Hi Michael,

This was asked by Giuseppe for structural plasticity simulation. What we would like to do is:

  • there are lot of potential synapses in structural circuit
  • there is a flag (range variable) that indicate whether synapse is active or not
  • depending on flag, we want to completely skip execution of DERIVATIVE and BREAKPOINT block to reduce computation cost

Is there any way to achieve this? The suggestion you mentioned above wouldn't solve computational cost.

from nrn.

nrnhines avatar nrnhines commented on May 30, 2024

The following removes most of the computational cost of the cnexp method but at the cost of disallowing
cvode for the model. You may wish to introduce an if statement to surround the i=m*v in the BREAKPOINT to set i=0.

NEURON {
  SUFFIX temp
  NONSPECIFIC_CURRENT i
  RANGE enable
}

PARAMETER {
  enable = 1
}

ASSIGNED {
  v
  i
}

STATE {
  m
}

INITIAL {
  m = 0
}

BREAKPOINT {
  SOLVE proc
  i = m*v
}
 
PROCEDURE proc() {
  if (enable) {   
    SOLVE states METHOD cnexp
  }     
}

DERIVATIVE states {   
  m' = (1.0 - m) * 0.1
}

from nrn.

brunomaga avatar brunomaga commented on May 30, 2024
  1. Is it possible to have a fix that does not disable CVODE?

  2. I believe Giuseppe mentioned that changing all mod files with an if statement wouldnt be ideal because whoever would take over after his departure wouldn't understand the rationale.

from nrn.

nrnhines avatar nrnhines commented on May 30, 2024

A fix is pushed for missing trailing tokens (when they exist) when _ode_matsol%d functions are generateed

from nrn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.