Changeset 11638 in project for release/3/oru/nmodl.scm
- Timestamp:
- 08/14/08 06:20:31 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
release/3/oru/nmodl.scm
r11603 r11638 516 516 (if perm (cons `(,perm ,i ,e ,erev) ax) ax))) 517 517 (list) ionchs) 518 (lambda (x y) (eq? (car x) (car y)))) 519 )) 518 (lambda (x y) (eq? (car x) (car y))))) 519 (acc-ions (delete-duplicates 520 (fold (lambda (n ax) 521 (let* ((subcomps ((dis 'component-subcomps) sys n)) 522 (acc (lookup-def 'accumulating-substance subcomps)) 523 (i (and acc (nmodl-name (s+ 'i acc)))) 524 (in (and acc (nmodl-name (s+ acc 'i)))) 525 (out (and acc (nmodl-name (s+ acc 'o))))) 526 (if acc (cons `(,acc ,i ,in ,out) ax) ax))) 527 (list) ionchs) 528 (lambda (x y) (eq? (car x) (car y))))) 529 ) 520 530 521 531 (with-output-to-file sfname … … 529 539 (USEION ,(first x) READ ,(third x) WRITE ,(second x)))) 530 540 perm-ions) 541 (for-each (lambda (x) 542 (pp indent+ (RANGE ,(second x)) 543 (USEION ,(first x) READ ,(third x) ", " ,(fourth x) WRITE ,(second x)))) 544 acc-ions) 545 531 546 (pp indent "}") 532 547 … … 562 577 imports) 563 578 (for-each (lambda (x) (pp indent+ ,(second x) ,(third x))) perm-ions) 579 (for-each (lambda (x) (pp indent+ ,(second x) ,(third x) ,(fourth x))) acc-ions) 564 580 (pp indent "}") 565 581 … … 592 608 (lambda (n) 593 609 (let* ((subcomps ((dis 'component-subcomps) sys n)) 610 (acc (lookup-def 'accumulating-substance subcomps)) 594 611 (perm (lookup-def 'permeating-substance subcomps)) 595 612 (pore (lookup-def 'pore subcomps)) 596 613 (gate (lookup-def 'gate subcomps)) 597 614 (sts (and gate ((dis 'component-exports) sys gate)))) 598 (and perm pore gate 599 (let* ((i (nmodl-name (s+ 'i perm))) 600 (e (nmodl-name (s+ 'e perm))) 601 (gmax (car ((dis 'component-exports) sys pore))) 602 (pwrs (map (lambda (n) (state-power sys n)) sts)) 603 (gion `(* ,gmax . ,(map (lambda (st pwr) `(pow ,st ,pwr)) sts pwrs)))) 604 (list i e gion))))) 615 (cond ((and perm pore gate) 616 (let* ((i (nmodl-name (s+ 'i perm))) 617 (e (nmodl-name (s+ 'e perm))) 618 (gmax (car ((dis 'component-exports) sys pore))) 619 (pwrs (map (lambda (n) (state-power sys n)) sts)) 620 (gion `(* ,gmax . ,(map (lambda (st pwr) `(pow ,st ,pwr)) sts pwrs)))) 621 (list i e gion))) 622 ((and acc pore gate) 623 (let* ((i (nmodl-name (s+ 'i acc))) 624 (gmax (car ((dis 'component-exports) sys pore))) 625 (pwrs (map (lambda (n) (state-power sys n)) sts)) 626 (gion `(* ,gmax . ,(map (lambda (st pwr) `(pow ,st ,pwr)) sts pwrs)))) 627 (list i #f gion))) 628 (else (oru:error 'oru:nmodl-translator ": invalid ion channel definition " n)) 629 ))) 605 630 ionchs)) 606 631 (i-bkts (bucket-partition (lambda (x y) (eq? (car x) (car y))) i-eqs)) … … 608 633 (match b 609 634 ((and ps ((i e gion) . rst)) 610 (let* ((sum `(* ,(sum (map third ps)) (- v ,e))) 635 (let* ((sum (if e `(* ,(sum (map third ps)) (- v ,e)) 636 (sum (map third ps)))) 611 637 (sum0 (rhsexpr sum)) 612 638 (sum1 (canonicalize-expr/NMODL sum0))) … … 614 640 615 641 ((i e gion) 616 (let* ((expr0 (rhsexpr `(* ,gion (- v ,e))))642 (let* ((expr0 (rhsexpr (if e `(* ,gion (- v ,e)) gion))) 617 643 (expr1 (canonicalize-expr/NMODL expr0))) 618 644 (cons (list i expr1) ax)))
Note: See TracChangeset
for help on using the changeset viewer.