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 group members (MAM-2015)
Model was written in NetLogo 5.2.0 • Viewed 340 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[voltage-gate voltage-inactivate voltage-close direction gate state selectivity]

to setup
  clear-all
  reset-ticks
  
  ask patches [set pcolor black]
  
  ;;; Constants
  set physical-repel-distance .5
  set ionic-interaction-distance 3
  set physical-repel-force -.3
  set ionic-interaction-force .1
  set temperature 20
  
  ;;; Ionic sizes proportionate  
  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 * 3.0
  make-ions "ext" "na" ext-conc-sodium * 3.0
  make-ions "ext" "ca" ext-conc-calcium * 3.0
  make-ions "ext" "cl" ext-conc-chlorine * 3.0
  make-ions "int" "k" int-conc-potassium * 3.0
  make-ions "int" "na" int-conc-sodium * 3.0
  make-ions "int" "ca" int-conc-calcium * 3.0
  make-ions "int" "cl" int-conc-chlorine * 3.0
 
 
  ;; Update membrane potential
  update-membrane-potential
  tick
end 

;; Moves cells, updates potential and states, sweeps cell

to go
  tick
  update-membrane-potential
  update-vg-channel-states
  sweep-cell
  ask turtles[
    move
  ]
end 
  
  
;; Turtle
;;;moves turtles

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

;; Turtle  
;;;; Moves away from turtles that are nearly touching. Simulates collision

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 with [location = [location] of myself]
  if too-near != nobody 
  [
    face too-near
    fd physical-repel-force
    if ([pcolor] of patch-here) != color and ([pcolor] of patch-here) != black
    [
      bk physical-repel-force
    ]
  ]
end 

;;Turtle
;;; Picks in range ion and reacts accordingly
;;; Excerts force on other ion

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


;; Turtle
;;;; Patches pull in turtles. Simulates ionic gradient. Increases permeability of cell

to patches-pull
  let membrane one-of patches in-radius 3 with [pcolor = [color] of myself]
  if membrane != nobody
  [
    face membrane
    fd 1    
  ]
end 

;;Turtles
;;;;Goes through membrane if selectivity parameters match, turtle is on neighbor, and patch state is open

to membrane-pass
  ;; Select all transmembrane patchesb
  let membrane ([neighbors] of patch-here) with [pcolor mod 10 = 6]
  
  if any? membrane
  [
    let chosen one-of membrane with [selectivity = [classifier] of myself or (selectivity = "none")]
    if chosen != nobody
    [
      face patch-at 0 0 
      ifelse location = "ext"
      [
        if ([direction] of chosen) = "in" and ([state] of chosen) = "open"
        [
          set location "int"
          fd 2
        ]
      ]
      [
        if ([direction] of chosen) = "out" and ([state] of chosen) = "open"
        [
          set location "ext"
          bk 2 
        ]
      ]
    ]
  ]
end 
  
;; turtle
;;;; Moves randomly to the cell membrane

to random-move
  face patch-at 0 0
  right random 180
  left random 180
  let temp -.7
  if location = "ext"
  [
    set temp .7
  ]
  fd temp
  if ([pcolor] of patch-here) != color and ([pcolor] of patch-here) != black
  [
    bk temp
  ]
end 

;;Takes cells that 'hopped' membrane without going through channel and places them on their side

to sweep-cell
 ;; Check for cells that 'hopped' membrane
 ask turtles[
   ifelse location = "ext"
   [
     if (distancexy 0 0) < cell-radius - 1
     [
       setxy 0 0 
       right random 360
       forward cell-radius + 3 + random(10)
     ]
   ] 
   [
     if (distancexy 0 0) > cell-radius + 1
     [
       setxy 0 0 
       right random 360
       forward random cell-radius 
     ]
   ]
 ]
end 

;; Draws cell membrane and assigns channels to patches.

to draw-cell
  let i 0
  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 green + 1        
          set selectivity "k"
          set voltage-gate 20
          set voltage-close -60
          set voltage-inactivate Nobody
          set gate ">"
          set state "closed"
          set direction "out"
        ]
      ]
      
      ;; Voltage-gated sodium channel
      if abs (random 100 - k-channel-density) < na-channel-density
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor violet + 1
            set selectivity "na"
            set voltage-gate (-60 + random(2))
            set voltage-close voltage-gate
            set voltage-inactivate (20)
            set gate ">"
            set state "closed"
            set direction "in"
          ]
        ] 
      ]
      
      ;; Voltage-gated l calcium channel
      if abs random (100 - k-channel-density - na-channel-density) < l-ca-channel-density 
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor orange + 1
            set selectivity "ca" 
            set voltage-gate 5 + random(10)
            set voltage-inactivate Nobody
            set voltage-close Nobody
            set gate ">"
            set state "closed"
            set direction "in"
          ]
        ] 
      ]
      
      ;; Voltage-gated t calcium channel
      if abs random (100 - k-channel-density - na-channel-density - l-ca-channel-density) < t-ca-channel-density
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor orange + 1
            set selectivity "ca" 
            set voltage-gate -20
            set voltage-inactivate Nobody
            set voltage-close -20
            set gate ">"
            set state "closed"
            set direction "in"
          ]
        ] 
      ]      
      
      ;; Leak K Channel
      if abs random (100 - k-channel-density - na-channel-density - l-ca-channel-density - t-ca-channel-density) < leak-k-channel-density
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor green + 1
            set selectivity "k" 
            set voltage-gate Nobody
            set voltage-inactivate Nobody
            set voltage-close Nobody
            set gate ">"
            set state "open"
            set direction "out"
          ]
        ] 
      ] 
      
      ;; Inward Rectifying (Nephron cells)
      if random (100 - k-channel-density - na-channel-density - l-ca-channel-density - t-ca-channel-density - leak-k-channel-density) < inward-k-channel-density
      [
        ask membrane_pot
        [
          if pcolor = white 
          [
            set pcolor green + 1
            set selectivity "k" 
            set voltage-gate -65 + random(10)
            set voltage-inactivate Nobody
            set voltage-close -50 + random(10)
            set gate "<"
            set state "closed"
            set direction "in"
          ]
        ] 
      ]   
    ]
    set i (i + 1)
  ]
end 

;;Creates ions with location classifiers and number of ions

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 green
        set size k-size
      ]
      [
        ifelse class = "na"
        [
          set charge 1
          set color violet
          set size na-size
        ]
        [
          ifelse class = "ca"
          [
            set charge 2
            set color orange
            set size ca-size
          ]
          [
            set charge -1
            set color yellow
            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 green
        set size k-size
      ]
      [
        ifelse class = "na"
        [
          set charge 1
          set color violet
          set size na-size
        ]
        [
          ifelse class = "ca"
          [
            set charge 2
            set color orange
            set size ca-size
          ]
          [
            set charge -1
            set color yellow
            set size cl-size
          ]   
        ]   
      ]
    ]
  ]
end 

;; Changes patch states (open, closed, inactive) basded on voltage gating properties

to update-vg-channel-states
  carefully
  [
    ask patches with [pcolor != black][
      if pcolor mod 10 = 6 and (voltage-gate != Nobody)
      [
        ifelse gate = ">"
        [
          if state = "closed"
          [
            if membrane-potential > voltage-gate
            [
              set state "open"  
            ]    
          ]
          if state = "open"
          [
            if membrane-potential < voltage-close
            [
              set state "closed"
            ]
            if voltage-inactivate != Nobody
            [
              ;let prob abs (voltage-inactivate - membrane-potential)
              ;if random (prob * 100) < 1 [set state "inactive"]
              if membrane-potential > voltage-inactivate[set state "inactive"]
              
            ]
          ]
          
          if state = "inactive"
          [
            if membrane-potential < voltage-close
            [
              set state "closed"
            ]
          ]
        ] 
        
        ;; Else
        [
          if state = "closed"
          [
            if membrane-potential < voltage-gate
            [
              set state "open"  
            ]    
          ]
          if state = "open"
          [
            if membrane-potential > voltage-close
            [
              set state "closed"
            ]
            if voltage-inactivate != Nobody
            [
              let prob abs (voltage-inactivate - membrane-potential)
              if membrane-potential > voltage-inactivate[set state "inactive"]
            ]
          ]
          
          if state = "inactive"
          [
            
            if membrane-potential > voltage-close
            [
              set state "closed"
            ]
          ]
        ] 
      ]
    ]
  ]
  [
    ;;None
  ]
end 


;; Calculates membrane potential

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-in + Na-in + (2 * Ca-in) + Cl-out) / (K-out + Na-out + (2 * Ca-out) + Cl-in))))
  ]
  [
    set membrane-potential "error"
  ]
end 
  
  

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

Attached files

File Type Description Last updated
BrendanFrick_June1_v3.txt word Progress Report 3 almost 9 years ago, by Brendan Frick Download
BrendanFrick_May18.docx word Progress Report 1 almost 9 years ago, by Brendan Frick Download
BrendanFrick_May25_v2.txt word Progress Report 2 almost 9 years ago, by Brendan Frick Download
NetLogo Neuron Model.pptx powerpoint Poster Slam almost 9 years ago, by Brendan Frick Download
Neuron Model.png preview Preview for 'Neuron Model' almost 9 years ago, by Brendan Frick Download
Neuron-BrendanFrick.pdf pdf Report almost 9 years ago, by Brendan Frick Download
Neuron.pptx powerpoint Poster almost 9 years ago, by Brendan Frick Download
Proposal.docx word Proposal almost 9 years ago, by Brendan Frick Download

This model does not have any ancestors.

This model does not have any descendants.