Neuron Model

Neuron Model preview image

1 collaborator

Default-person Brendan Frick (Author)

Tags

(This model has yet to be categorized with any tags)
Model group MAM-2015 | Visible to everyone | Changeable by the author
Model was written in NetLogo 5.2.0 • Viewed 288 times • Downloaded 27 times • Run 0 times
Download the 'Neuron Model' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [ions ion]

globals [
  cell-radius 
  k-size 
  na-size 
  ca-size 
  cl-size 
  physical-repel-distance 
  physical-repel-force
  ionic-interaction-distance
  ionic-interaction-force
  concentration-gradient
  temperature
  membrane-potential
  ]

ions-own[charge classifier location]

patches-own[equilibrium selectivity]

to setup
  clear-all
  reset-ticks
  
  ask patches [set pcolor black]
  
  ;; Constants
  set physical-repel-distance 1
  set ionic-interaction-distance 5
  set physical-repel-force -.3
  set ionic-interaction-force .25
  set temperature 20
  
  set k-size (1.38 / 2)
  set na-size (1.02 / 2)
  set ca-size (1 / 2)
  set cl-size (1.81 / 2)
  
  ;; Draw cell
  set cell-radius 30
  draw-cell
  
  ;; Draw ions
  make-ions "ext" "k" ext-conc-potassium
  make-ions "ext" "na" ext-conc-sodium
  make-ions "ext" "ca" ext-conc-calcium 
  make-ions "ext" "cl" ext-conc-chlorine
  make-ions "int" "k" int-conc-potassium
  make-ions "int" "na" int-conc-sodium
  make-ions "int" "ca" int-conc-calcium
  make-ions "int" "cl" int-conc-chlorine
 
  update-membrane-potential
end 

to go
  tick
  update-membrane-potential
  ask turtles[
    move
  ]
end 

to move
  ionic-attract-repel
  physical-repulsion
  membrane-pass
  random-move
end 

to physical-repulsion
  ; Select a random neighbor that is too close and move away from it
  let too-near one-of other turtles in-radius physical-repel-distance
  if too-near != nobody 
  [
    face too-near
    fd physical-repel-force
    if ([pcolor] of patch-here) = white
    [
      bk physical-repel-force
    ]
  ]
end 

to ionic-attract-repel
  ; Select a random neighbor and interact with it
  let near one-of other ions in-radius ionic-interaction-distance
  if near != nobody
  [
    face near
    fd ionic-interaction-force * (charge * (0 - ([charge] of near)))
  
    if ([pcolor] of patch-here = white)
    [
      bk ionic-interaction-force * (charge * (0 - ([charge] of near)))
    ]
  ]
end 

to membrane-pass
  ;; Select all transmembrane patches
  let membrane ([neighbors] of patch-here) with [pcolor mod 10 = 6]
  
  if any? membrane
  [
    let chosen one-of membrane with [selectivity = [classifier] of myself]
    if chosen != nobody
    [
      face patch-at 0 0 
      ifelse location = "ext"
      [
        set location "int"
        fd 2]
      [
       set location "ext"
       bk 2]
    ]
  ]
end 

to random-move
  right random 360
  fd .125
  if ([pcolor] of patch-here = white)
  [
    bk .125
  ]
end 

to draw-cell
  let i 0 
  let rad 10
  while [i < 720]
  [
    let membrane_pot (patches with [(abs pxcor = (floor (abs ((cell-radius + 1) * (cos(i / 2)))))) and (abs pycor = (floor (abs ((cell-radius + 1) * (sin(i / 2)))))) or (abs pxcor = (ceiling (abs (cell-radius * (cos(i / 2)))))) and (abs pycor = (ceiling (abs (cell-radius * (sin(i / 2))))))])
    if membrane_pot != Nobody
    [
      ask membrane_pot
      [
        set pcolor white
      ] 
      
      ;; Voltage-gated potassium channel
      if (random 100) < k-channel-density
      [
        ask membrane_pot
        [
          set pcolor red + 1        
          set selectivity "k"
        ]
      ]
      
      ;; Voltage-gated sodium channel
      if (random 100 - k-channel-density) < na-channel-density
      [
        ask membrane_pot
        [
          set pcolor orange + 1
          set selectivity "na"
        ] 
      
      ]
      
      ;; Voltage-gated caclium channel
      if random (100 - k-channel-density - na-channel-density) < ca-channel-density
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor brown + 1
            set selectivity "ca" 
          ]
        ] 
      ]    
    ]
    set i (i + 1)
  ]
end 

to make-ions[loc class conc]
  ifelse loc = "ext"
  [
    create-ions(conc)
    [
      right random 360
      forward (cell-radius + 3 + random(10))
      set shape "circle"
      
      set classifier class
      set location loc
      
      ifelse class = "k"
      [
        set charge 1
        set color red
        set size k-size
      ]
      [
        ifelse class = "na"
        [
          set charge 1
          set color orange
          set size na-size
        ]
        [
          ifelse class = "ca"
          [
            set charge 2
            set color brown
            set size ca-size
          ]
          [
            set charge -1
            set color green
            set size cl-size      
          ]   
        ]   
      ]
    ]
  ]
  [
    create-ions(conc)
    [
      right random 360
      forward random cell-radius
      set shape "circle"
      
      set classifier class
      set location loc
      
      ifelse class = "k"
      [
        set charge 1
        set color red
        set size k-size
      ]
      [
        ifelse class = "na"
        [
          set charge 1
          set color orange
          set size na-size
        ]
        [
          ifelse class = "ca"
          [
            set charge 2
            set color brown
            set size ca-size
          ]
          [
            set charge -1
            set color green
            set size cl-size
          ]   
        ]   
      ]
    ]
  ]
end 

to update-membrane-potential
  let K-out count turtles with [classifier = "k" and location = "ext"]
  let K-in count turtles with [classifier = "k" and location = "int"]
  let Na-out count turtles with [classifier = "na" and location = "ext"]
  let Na-in count turtles with [classifier = "na" and location = "int"]
  let Ca-out count turtles with [classifier = "ca" and location = "ext"]
  let Ca-in count turtles with [classifier = "ca" and location = "int"]
  let Cl-out count turtles with [classifier = "cl" and location = "ext"]
  let Cl-in count turtles with [classifier = "cl" and location = "int"]
 
  ;;(8.314 * (273.15 + temperature) / 96485)
  carefully 
  [
    set membrane-potential (65 * (ln ( (K-out + Na-out + (2 * Ca-out) + Cl-in) / (K-in + Na-in + (2 * Ca-in) - Cl-out))))
  ]
  [
    set membrane-potential "error"
  ]
end 
  
  

There is only one version of this model, created over 9 years ago by Brendan Frick.

Attached files

File Type Description Last updated
Neuron Model.png preview Preview for 'Neuron Model' over 9 years ago, by Brendan Frick Download

This model does not have any ancestors.

This model does not have any descendants.