RuleWorld / nfsim

A general-purpose, stochastic, biochemical reaction simulator for large reaction networks
http://michaelsneddon.net/nfsim/
MIT License
14 stars 9 forks source link

nesting of if-then-else statements in global functions #38

Open wshlavacek opened 4 months ago

wshlavacek commented 4 months ago

The level of nesting of if-then-else statements allowed in NFsim is different than in BioNetGen. It seems that 50 levels deep is the max, whereas deeper nesting is possible in BioNetGen. This causes problems when switching from the ODE solver simulation method to the NFsim simulation method. There is probably a setting for the max level of nesting in the NFsim code. Could this setting be modified for consistency with BioNetGen? Below is an example of a function definition that involves nested if-then-else statements.

Data_DailyCases()=if(t<=38,0,\ if(t<=39,1,\ if(t<=40,0,\ if(t<=41,1,\ if(t<=42,9,\ if(t<=43,11,\ if(t<=44,22,\ if(t<=45,45,\ if(t<=46,17,\ if(t<=47,36,\ if(t<=48,31,\ if(t<=49,44,\ if(t<=50,109,\ if(t<=51,95,\ if(t<=52,189,\ if(t<=53,122,\ if(t<=54,218,\ if(t<=55,425,\ if(t<=56,1012,\ if(t<=57,1774,\ if(t<=58,2952,\ if(t<=59,3258,\ if(t<=60,4817,\ if(t<=61,5711,\ if(t<=62,4805,\ if(t<=63,7413,\ if(t<=64,5941,\ if(t<=65,5688,\ if(t<=66,8771,\ if(t<=67,6266,\ if(t<=68,7721,\ if(t<=69,8707,\ if(t<=70,8153,\ if(t<=71,8996,\ if(t<=72,10329,\ if(t<=73,12274,\ if(t<=74,8122,\ if(t<=75,9304,\ if(t<=76,8314,\ if(t<=77,9568,\ if(t<=78,10765,\ if(t<=79,10794,\ if(t<=80,10160,\ if(t<=81,8435,\ if(t<=82,6548,\ if(t<=83,7402,\ if(t<=84,11755,\ if(t<=85,8631,\ if(t<=86,7532,\ if(t<=87,7249,\ if(t<=88,6199,\ if(t<=89,4867,\ if(t<=90,4324,\ if(t<=91,5659,\ if(t<=92,6341,\ if(t<=93,8286,\ if(t<=94,10683,\ if(t<=95,6013,\ if(t<=96,4077,\ if(t<=97,3285,\ if(t<=98,4718,\ if(t<=99,4702,\ if(t<=100,3879,\ if(t<=101,4559,\ if(t<=102,3699,\ if(t<=103,2524,\ if(t<=104,2302,\ if(t<=105,2746,\ if(t<=106,3526,\ if(t<=107,2873,\ if(t<=108,2715,\ if(t<=109,2138,\ if(t<=110,1610,\ if(t<=111,1438,\ if(t<=112,2123,\ if(t<=113,2364,\ if(t<=114,2759,\ if(t<=115,2185,\ if(t<=116,1901,\ if(t<=117,1241,\ if(t<=118,1479,\ if(t<=119,1478,\ if(t<=120,2078,\ 0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

jrfaeder commented 4 months ago

Hi Bill,

We will look into implementing the change you are requesting to ensure compatibility between BNG and NFsim models. In the meantime, the fuctionality you are looking to implement can be obtained by using a time-dependent function (TFUN) in NFsim. See here for more details.

wshlavacek commented 4 months ago

Thanks Jim!Sent from my iPhoneOn Apr 30, 2024, at 12:39 PM, Jim Faeder @.***> wrote: Hi Bill, We will look into implementing the change you are requesting to ensure compatibility between BNG and NFsim models. In the meantime, the fuctionality you are looking to implement can be obtained by using a time-dependent function (TFUN) in NFsim. See here for more details.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

wshlavacek commented 4 months ago

I’m trying to use the TFUN feature.Is there a working example available somewhere? I don’t see info about the format of the DAT fileSent from my iPhoneOn Apr 30, 2024, at 12:39 PM, Jim Faeder @.***> wrote: Hi Bill, We will look into implementing the change you are requesting to ensure compatibility between BNG and NFsim models. In the meantime, the fuctionality you are looking to implement can be obtained by using a time-dependent function (TFUN) in NFsim. See here for more details.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

jrfaeder commented 4 months ago

Additional detail and a link to an example .dat file are here.

jrfaeder commented 4 months ago

There is a full example in the Validate folder of the bng2 subdirectory: https://github.com/RuleWorld/bionetgen/blob/master/bng2/Validate/test_tfun.bngl

wshlavacek commented 4 months ago

I'm getting an error when I try to run the TFUN example - details are below. I get the same error message when trying to run my own test: Error preparing function NAME_OF_FUNCTION in class GlobalFunction!! File doesn't look like it exists Quitting Any ideas on what's going on? --Bill

BNGL file:

begin model

begin parameters

k_t 2

end parameters

begin molecule types

A()

B()

C()

D()

dummy()

end molecule types

begin species

A() 1000

B() 1000

C() 1000

D() 1000

end species

begin observables

Molecules A A()

Molecules B B()

Molecules C C()

Molecules D D()

Molecules dum dummy()

end observables

begin functions

mctr = dum/1e4

various tests on TFUN

k1 = TFUN(mctr,'test.dat')

k2 = (TFUN(mctr, "test.dat")/1e1)

k3 = (TFUN(mctr, "test.dat")/k_t)

k4 = (TFUN(mctr, "test.dat")/mctr)

end functions

begin reaction rules

dummy: 0 -> dummy() 1e4

Ad: A() -> 0 k1

Bd: B() -> 0 k2

Cd: C() -> 0 k3

Dd: D() -> 0 k4

end reaction rules

end model

simulate({method=>"nf",t_end=>20,n_steps=>1000,print_functions=>1,param=>"-v -gml 1000000"})

DAT file (located in the same folder as the BNGL file):

1.000000000000000000e+01 1.000000000000000000e+00

2.000000000000000000e+01 2.000000000000000000e+00

3.000000000000000000e+01 3.000000000000000000e+00

4.000000000000000000e+01 4.000000000000000000e+00

5.000000000000000000e+01 5.000000000000000000e+00

6.000000000000000000e+01 6.000000000000000000e+00

7.000000000000000000e+01 7.000000000000000000e+00

8.000000000000000000e+01 8.000000000000000000e+00

9.000000000000000000e+01 9.000000000000000000e+00

LOG file:

BioNetGen version 2.8.4

Reading from file /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/test_tfun.bngl (level 0)

Read 1 parameters.

Read 5 molecule types.

Read 4 species.

Read 5 observable(s).

Read 5 functions.

Read 5 reaction rule(s).

ACTION: simulate( method=>"nf" )

NetworkFree simulation using nf

ACTION: simulate_nf( )

Wrote model in xml format to /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.xml.

Running NFsim on pn2300722.lanl.gov

full command: /Users/hlavacek/Simulations/BioNetGen-2.8.4/bin/NFsim -xml /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.xml -o /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.gdat -sim 20 -oSteps 1000 -cb -seed 324496329 -ogf -ss /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.species -v -gml 1000000

[simulation PID is: 61266]

starting NFsim v1.2.2...

Seeding random number generator with: 324496329

Trying to read xml model specification file:

'/Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.xml'

read was successful... beginning parse...

Creating system: test_tfun

Reading parameter list...

Identified parameter: k_t Value:2

Identified parameter: _rateLaw1 Value:10000

Reading list of MoleculeTypes...

Reading and Creating MoleculeType: A()

Reading and Creating MoleculeType: B()

Reading and Creating MoleculeType: C()

Reading and Creating MoleculeType: D()

Reading and Creating MoleculeType: dummy()

Reading list of Species...

Creating 1000 instances of the Species: S1

Including Molecule of type: A with local id: S1_M1

Creating 1000 instances of the Species: S2

Including Molecule of type: B with local id: S2_M1

Creating 1000 instances of the Species: S3

Including Molecule of type: C with local id: S3_M1

Creating 1000 instances of the Species: S4

Including Molecule of type: D with local id: S4_M1

Reading list of Observables...

Creating Observable: 'A' of type: 'Molecules'

Including Molecule of type: A with local id: O1_P1_M1

=> Final processed pattern: A()

Creating Observable: 'B' of type: 'Molecules'

Including Molecule of type: B with local id: O2_P1_M1

=> Final processed pattern: B()

Creating Observable: 'C' of type: 'Molecules'

Including Molecule of type: C with local id: O3_P1_M1

=> Final processed pattern: C()

Creating Observable: 'D' of type: 'Molecules'

Including Molecule of type: D with local id: O4_P1_M1

=> Final processed pattern: D()

Creating Observable: 'dum' of type: 'Molecules'

Including Molecule of type: dummy with local id: O5_P1_M1

=> Final processed pattern: dummy()

Reading list of Functions...

Reading Function: mctr()

= dum/1e4

Reference: Observable dum

Reading Function: k1()

= TFUNVAL__

Reference: Constant TFUNVAL__

Reference: Function mctr

Error preparing function k1 in class GlobalFunction!!

File doesn't look like it exists

Quitting.

SpeciesLabel max molecule threshold set to 20.

WARNING: Species with more than 20 molecules will be labeled with the Quasi method.

readNFspecies::Reading from file /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.species

ABORT: Couldn't read from file /Users/hlavacek/Simulations/RuleBender-workspace/NFsim_TFUN_test/results/test_tfun/2024-05-06_14-31-20/test_tfun.species: No such file or directory

at line 49

On Tue, Apr 30, 2024 at 7:05 PM Jim Faeder @.***> wrote:

There is a full example in the Validate folder of the bng2 subdirectory: https://github.com/RuleWorld/bionetgen/blob/master/bng2/Validate/test_tfun.bngl

— Reply to this email directly, view it on GitHub https://github.com/RuleWorld/nfsim/issues/38#issuecomment-2087795934, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETOR5ZYHWVHIKKHEQW6FSLZAA5W5AVCNFSM6AAAAABHAWG34SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBXG44TKOJTGQ . You are receiving this because you authored the thread.Message ID: @.***>

wshlavacek commented 4 months ago

So... I haven't been able to get TFUN to work but even if it did work, it doesn't seem to be a good solution to my problem. Recall that I am using nested if-then-else statements to define a function. I'd like this function to work regardless of whether I am using method=>"ode" or method=>"nf" and the problem is that NFsim and BioNetGen have different max nesting depths. My function works with BioNetGen but not NFsim. I have more than 50 nested if-then-else statements in my function. This is OK with BioNetGen but NFsim does not allow more than 50.

On Tue, Apr 30, 2024 at 12:39 PM Jim Faeder @.***> wrote:

Hi Bill,

We will look into implementing the change you are requesting to ensure compatibility between BNG and NFsim models. In the meantime, the fuctionality you are looking to implement can be obtained by using a time-dependent function (TFUN) in NFsim. See here https://github.com/RuleWorld/nfsim/releases/tag/v1.2.0 for more details.

— Reply to this email directly, view it on GitHub https://github.com/RuleWorld/nfsim/issues/38#issuecomment-2086510194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETOR5YY5H2WDQPGVE2PMFLY77QPHAVCNFSM6AAAAABHAWG34SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBWGUYTAMJZGQ . You are receiving this because you authored the thread.Message ID: @.***>

jrfaeder commented 4 months ago

We agree that this should work in NFsim and are still working toward a fix. If you could email me the model that is causing the NFsim failure, that would expedite the process.

wshlavacek commented 4 months ago

I get the error with the example model file in the BNG distribution, which is in the validate subfolder, I think I only moved the BNGL and DAT file to my local workspace folder and modified the DAT file path accordingly in the TFUN lineSent from my iPhoneOn May 7, 2024, at 8:03 AM, Jim Faeder @.***> wrote: We agree that this should work in NFsim and are still working toward a fix. If you could email me the model that is causing the NFsim failure, that would expedite the process.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

jrfaeder commented 4 months ago

I was referring to the model with nested if's. For the TFUN model, please make sure you are using the latest BioNetGen distribution.

wshlavacek commented 4 months ago

I have version 2.8.4 for the distribution, which includes version 1.2.2 for NFsimThat’s current? I’ll try to get the BNGL file to you soonSent from my iPhoneOn May 7, 2024, at 10:06 AM, Jim Faeder @.***> wrote: I was referring to the model with nested if's. For the TFUN model, please make sure you are using the latest BioNetGen distribution.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

wshlavacek commented 4 months ago

begin model

example of NFsim error caused by too deep nesting of if-then-else

statements in function definition

begin parameters

end parameters

begin molecule types

V()

counter()

end molecule types

begin seed species

V() 0

counter() 0

end seed species

begin observables

Molecules t counter()

Molecules V V()

end observables

begin functions

CASE 1: constant rate

v_rate()=1e-6

CASE 2: variable rate defined in terms of nested if-then-else statements

v_rate()=if(t<=297,1e-6,if(t<=298,1.12314383e-05,if(t<=299,9.94451901e-06,if (t<=300,4.74735912e-05,if(t<=301,2.11759573e-05,if(t<=302,0,if(t <=303,8.68001985e-05,if(t<=304,3.62421529e-05,if(t<=305,8.93918412e-05,if(t <=306,0.000146015146,if(t<=307,0.00010497702,if(t<=308,7.94473222e-05,if(t <=309,6.05025646e-05,if(t<=310,0.000364352105,if(t<=311,0.000201739564,if(t <=312,0.000357759509,if(t<=313,0.000269842203,if(t<=314,0.000257166618,if(t <=315,0.000470011593,if(t<=316,0.000451941228,if(t<=317,0.000253944211,if(t <=318,0.0006239742879999999,if(t<=319,0.00066809744,if(t <=320,0.000499101616,if(t<=321,0.000321104073,if(t<=322,0.000519506807,if(t <=323,0.000424076528,if(t<=324,0.000449397629,if(t<=325,0.000884025501,if(t <=326,0.000654416186,if(t<=327,0.00064374717,if(t<=328,0.000789273122,if(t <=329,0.000803543557,if(t<=330,0.000638530434,if(t<=331,0.00100160898,if(t <=332,0.000993807258,if(t<=333,0.00124114925,if(t<=334,0.00123426412,if(t <=335,0.00141321826,if(t<=336,0.00118332628,if(t<=337,0.00109470055,if(t <=338,0.00125019427,if(t<=339,0.00135455371,if(t<=340,0.0019431852,if(t <=341,0.00205543168,if(t<=342,0.00197207562,if(t<=343,0.0022614449,if(t <=344,0.00211490243,if(t<=345,0.00210695833,if(t<=346,0.00249495193,if(t <=347,0.00234941068,if(t<=348,0.00226462926,if(t<=349,0.00192793935,if(t <=350,0.002307822,if(t<=351,0.00177314607,if(t<=352,0.00204756246,if(t <=353,0.00223537455,if(t<=354,0.00265125171,if(t<=355,0.00215845046,if(t <=356,0.00219770402,if(t<=357,0.00178428238,if(t<=358,0.00184590186,if(t <=359,0.0018605743,if(t<=360,0.00184659497,if(t<=361,0.00229017668,if(t <=362,0.00253196493,if(t<=363,0.00239098899,if(t<=364,0.00211185421,if(t <=365,0.00219407719,if(t<=366,0.00212246707,if(t<=367,0.00269861999,if(t <=368,0.00266277044,if(t<=369,0.0022864101,if(t<=370,0.00238106143,if(t <=371,0.00288706782,if(t<=372,0.00241887213,if(t<=373,0.00264944029,if(t <=374,0.00283053906,if(t<=375,0.00324595184,if(t<=376,0.00288717874,if(t <=377,0.00276439946,if(t<=378,0.00244384282,if(t<=379,0.00233597338,if(t <=380,0.00279352064,if(t<=381,0.00286037951,if(t<=382,0.00328170603,if(t <=383,0.002822949,if(t<=384,0.00278954494,if(t<=385,0.00312619711,if(t <=386,0.00324124337,if(t<=387,0.00365400495,if(t<=388,0.00402022148,if(t <=389,0.00451327855,if(t<=390,0.00463343495,if(t<=391,0.00361972256,if(t <=392,0.00421404306,if(t<=393,0.00450737728,if(t<=394,0.00385689985,if(t <=395,0.00706347035,if(t<=396,0.00548992622,if(t<=397,0.00561269851,if(t <=398,0.00565157042,if(t<=399,0.00465943143,if(t<=400,0.00360607661,if(t <=401,0.00424833829,if(t<=402,0.00506165543,if(t<=403,0.00554584679,if(t <=404,0.00567074572,if(t<=405,0.00521791533,if(t<=406,0.00511027778,if(t <=407,0.00463445002,if(t<=408,0.0048334687,if(t<=409,0.00495195688,if(t <=410,0.00549367799,if(t<=411,0.00563900702,if(t<=412,0.00467717288,if(t <=413,0.00464379518,if(t<=414,0.00459904476,if(t<=415,0.00454237307,if(t <=416,0.00500574242,if(t<=417,0.00531713904,if(t<=418,0.00561133477,if(t <=419,0.00533865191,if(t<=420,0.00495078846,if(t<=421,0.00463678844,if(t <=422,0.00473844747,if(t<=423,0.0054393895,if(t<=424,0.00545525246,if(t <=425,0.00541193326,if(t<=426,0.00509452208,if(t<=427,0.00660187229,if(t <=428,0.00417453135,if(t<=429,0.00467057068,if(t<=430,0.00516133914,if(t <=431,0.00579060434,if(t<=432,0.00527368183,if(t<=433,0.0046510559,if(t <=434,0.00430932033,if(t<=435,0.00469632041,if(t<=436,0.00451319727,if(t <=437,0.00525834823,if(t<=438,0.00514407899,if(t<=439,0.00424489032,if(t <=440,0.00338261955,if(t<=441,0.0038480963,if(t<=442,0.00292950561,if(t <=443,0.00356221514,if(t<=444,0.00426978001,if(t<=445,0.00498272013,if(t <=446,0.00406037155,if(t<=447,0.00385850101,if(t<=448,0.00311324383,if(t <=449,0.00287080426,if(t<=450,0.00249969302,if(t<=451,0.00303688666,if(t <=452,0.00373753143,if(t<=453,0.00334610566,if(t<=454,0.00271933283,if(t <=455,0.00249564984,if(t<=456,0.00211065932,if(t<=457,0.0026296495,if(t <=458,0.002927413,if(t<=459,0.00348787669,if(t<=460,0.00360563614,if(t <=461,0.00305593177,if(t<=462,0.0029747901,if(t<=463,0.00313546965,if(t <=464,0.00427331421,if(t<=465,0.00367859101,if(t<=466,0.0038757078,if(t <=467,0.00345077,if(t<=468,0.00294496232,if(t<=469,0.00280944761,if(t <=470,0.00320988109,if(t<=471,0.00327554366,if(t<=472,0.00291552997,if(t <=473,0.00379463693,if(t<=474,0.00296006542,if(t<=475,0.00296144959,if(t <=476,0.00226444315,if(t<=477,0.00222587449,if(t<=478,0.00208900522,if(t <=479,0.00235789914,if(t<=480,0.0023527227,if(t<=481,0.00225757636,if(t <=482,0.00156006694,if(t<=483,0.00200007592,if(t<=484,0.00177305229,if(t <=485,0.00132721137,if(t<=486,0.0016157386,if(t<=487,0.00160173321,if(t <=488,0.00161771581,if(t<=489,0.00120030271,if(t<=490,0.00106073605,if(t <=491,0.00109226802,if(t<=492,0.0009426437350000001,if(t<=493,0.00129775163, if(t<=494,0.00148914411,if(t<=495,0.00126664783,if(t<=496,0.00111729785,if(t <=497,0.000928262283,if(t<=498,0.00100128739,if(t<=499,0.000862123754,if(t <=500,0.00143578505,if(t<=501,0.00159369446,if(t<=502,0.001236268,if(t <=503,0.0010974177,if(t<=504,0.00116777929,if(t<=505,0.00129901145,if(t <=506,0.00143993669,if(t<=507,0.00137057727,if(t<=508,0.00129378217,if(t <=509,0.00105560763,if(t<=510,0.00076959134,if(t<=511,0.00100224246,if(t <=512,0.00126489835,if(t<=513,0.000839568459,if(t<=514,0.00104061086,if(t <=515,0.0012489978,if(t<=516,0.000909710251,if(t<=517,0.00106807397,if(t <=518,0.00092042926,if(t<=519,0.000568671374,if(t<=520,0.00107534612,if(t <=521,0.000977098888,if(t<=522,0.0011913604,if(t<=523,0.0020660573,if(t <=524,0.000776079056,if(t<=525,0.0009384054229999999,if(t <=526,0.0007691787249999999,if(t<=527,0.0008221690370000001,if(t <=528,0.000977691101,if(t<=529,0.00120703073,if(t<=530,0.00115212883,if(t <=531,0.0009606733930000001,if(t<=532,0.00093316483,if(t <=533,0.0007720669550000001,if(t<=534,0.00120225262,if(t<=535,0.0011870245, if(t<=536,0.00108866938,if(t<=537,0.0009816442539999999,if(t <=538,0.0013641676,if(t<=539,0.000946980045,if(t<=540,0.0009865161470000001, if(t<=541,0.00106015651,if(t<=542,0.0011457813,if(t<=543,0.00126624345,if(t <=544,0.00136449029,if(t<=545,0.00102888928,if(t<=546,0.000864759508,if(t <=547,0.0011350614,if(t<=548,0.00094079968,if(t<=549,0.00106408062,if(t <=550,0.00155375609,if(t<=551,0.000838952779,if(t<=552,0.00106263742,if(t <=553,0.00118428894,if(t<=554,0.000855891218,if(t<=555,0.000815682206,if(t <=556,0.00102089848,if(t<=557,0.00110255282,if(t<=558,0.00113035448,if(t <=559,0.00102012975,if(t<=560,0.00110705653,if(t<=561,0.000705581016,if(t <=562,0.000993763855,if(t<=563,0.00118845612,if(t<=564,0.00117255526,if(t <=565,0.000896920008,if(t<=566,0.00116252977,if(t <=567,0.0009774145669999999,if(t<=568,0.000774332103,if(t <=569,0.00102867561,if(t<=570,0.000824192259,if(t<=571,0.000945787156,if(t <=572,0.000867970103,if(t<=573,0.000975609124,if(t <=574,0.0009400845809999999,if(t<=575,0.000798736412,if(t <=576,0.000715158278,if(t<=577,0.000796893693,if(t<=578,0.000646695582,if(t <=579,0.000983652225,if(t<=580,0.000844168204,if(t<=581,0.000706883968,if(t <=582,0.00075490277,if(t<=583,0.000968707132,if(t<=584,0.000823652744,if(t <=585,0.000913533955,if(t<=586,0.000758321971,if(t<=587,0.000722756758,if(t <=588,0.000708912186,if(t<=589,0.000814718917,if(t<=590,0.000692181581,if(t <=591,0.000874866316,if(t<=592,0.000687077945,if(t<=593,0.00101249691,if(t <=594,0.000789045455,if(t<=595,0.000773614795,if(t<=596,0.000526705332,if(t <=597,0.000706965066,if(t<=598,0.000903633251,if(t<=599,0.000590024411,if(t <=600,0.000936203932,if(t<=601,0.000607883075,if(t<=602,0.000564723531,if(t <=603,0.000724888451,if(t<=604,0.00068726425,if(t<=605,0.000555183276,if(t <=606,0.000856091978,if(t<=607,0.000576251369,if(t <=608,0.0009014603059999999,if(t<=609,0.000536780404,if(t <=610,0.0006876480990000001,if(t<=611,0.000371006631,if(t <=612,0.000692669203,if(t<=613,0.00083516197,if(t<=614,0.00038463401,if(t <=615,0.000800101713,if(t<=616,0.000375803641,if(t <=617,0.0006264554589999999,if(t<=618,0.000526031526,if(t <=619,0.000499368607,if(t<=620,0.000428305584,if(t<=621,0.000909464485,if(t <=622,0.000351236661,if(t<=623,0.000566571376,if(t<=624,0.000429427975,if(t <=625,0.000499533864,if(t<=626,0.000526757148,if(t<=627,0.000225809721,if(t <=628,0.0005403013610000001,if(t<=629,0.000240458659,if(t <=630,0.000516079477,if(t<=631,0.000660882077,if(t<=632,0.000566899036,if(t <=633,0.00115467547,if(t<=634,0.000633427116,if(t<=635,0.000518385602,if(t <=636,0.000749428245,if(t<=637,0.000913122119,if(t<=638,0.000786391348,if(t <=639,0.0012730781,if(t<=640,0.00129256234,if(t<=641,0.00115637457,if(t <=642,0.00102572807,if(t<=643,0.00105539285,if(t<=644,0.00119078863,if(t <=645,0.000732476407,if(t<=646,0.0011368034,if(t<=647,0.00143053847,if(t <=648,0.000947157648,if(t <=649,0.00133587678,0)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))

end functions

begin reaction rules

timer

0->counter() 1

0->V() 1e4*v_rate()

end reaction rules

end model

begin actions

saveConcentrations()

generate_network({overwrite=>1})

simulate({suffix=>"ODE",method=>"ode",t_start=>0,t_end=>1000,n_steps=>1000, print_functions=>1}) # works for cases 1 and 2

resetConcentrations()

simulate({suffix=>"NF",method=>"nf",t_start=>0,t_end=>1000,n_steps=>1000, print_functions=>1}) # works for case 1, fails for case 2

end actions

On Tue, May 7, 2024 at 10:06 AM Jim Faeder @.***> wrote:

I was referring to the model with nested if's. For the TFUN model, please make sure you are using the latest BioNetGen distribution.

— Reply to this email directly, view it on GitHub https://github.com/RuleWorld/nfsim/issues/38#issuecomment-2098812963, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETOR565PDBION3TXKZOMZTZBD3ZBAVCNFSM6AAAAABHAWG34SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOJYHAYTEOJWGM . You are receiving this because you authored the thread.Message ID: @.***>

jrfaeder commented 4 months ago

Our initial tests showed the NFsim is able to read in the nested if function from the xml file using muParser, but then crashes when checking that the function has been correctly defined. In looking through the code, we discovered that NFsim is using an older version of the muParser code (1.30) than the bionetgen Network3 code (2.2.4). We will investigate whether updating to a more recent version of muParser (either 2.2.4 or 2.3.4 (the latest)) enables the function to work correctly in NFsim.