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 (accions (deleteduplicates 520 (fold (lambda (n ax) 521 (let* ((subcomps ((dis 'componentsubcomps) sys n)) 522 (acc (lookupdef 'accumulatingsubstance subcomps)) 523 (i (and acc (nmodlname (s+ 'i acc)))) 524 (in (and acc (nmodlname (s+ acc 'i)))) 525 (out (and acc (nmodlname (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 (withoutputtofile sfname … … 529 539 (USEION ,(first x) READ ,(third x) WRITE ,(second x)))) 530 540 permions) 541 (foreach (lambda (x) 542 (pp indent+ (RANGE ,(second x)) 543 (USEION ,(first x) READ ,(third x) ", " ,(fourth x) WRITE ,(second x)))) 544 accions) 545 531 546 (pp indent "}") 532 547 … … 562 577 imports) 563 578 (foreach (lambda (x) (pp indent+ ,(second x) ,(third x))) permions) 579 (foreach (lambda (x) (pp indent+ ,(second x) ,(third x) ,(fourth x))) accions) 564 580 (pp indent "}") 565 581 … … 592 608 (lambda (n) 593 609 (let* ((subcomps ((dis 'componentsubcomps) sys n)) 610 (acc (lookupdef 'accumulatingsubstance subcomps)) 594 611 (perm (lookupdef 'permeatingsubstance subcomps)) 595 612 (pore (lookupdef 'pore subcomps)) 596 613 (gate (lookupdef 'gate subcomps)) 597 614 (sts (and gate ((dis 'componentexports) sys gate)))) 598 (and perm pore gate 599 (let* ((i (nmodlname (s+ 'i perm))) 600 (e (nmodlname (s+ 'e perm))) 601 (gmax (car ((dis 'componentexports) sys pore))) 602 (pwrs (map (lambda (n) (statepower 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 (nmodlname (s+ 'i perm))) 617 (e (nmodlname (s+ 'e perm))) 618 (gmax (car ((dis 'componentexports) sys pore))) 619 (pwrs (map (lambda (n) (statepower 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 (nmodlname (s+ 'i acc))) 624 (gmax (car ((dis 'componentexports) sys pore))) 625 (pwrs (map (lambda (n) (statepower 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:nmodltranslator ": invalid ion channel definition " n)) 629 ))) 605 630 ionchs)) 606 631 (ibkts (bucketpartition (lambda (x y) (eq? (car x) (car y))) ieqs)) … … 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 (canonicalizeexpr/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 (canonicalizeexpr/NMODL expr0))) 618 644 (cons (list i expr1) ax)))
Note: See TracChangeset
for help on using the changeset viewer.