# tlbr.bngl
# Trivalent ligand - bivalent receptor model [Peaking Params]
#
# Theoretical model was published and analyzed in:
#   B Goldstein and AS Perelson.
#   "Equilibrium theory for the clustering of bivalent cell surface receptors by trivalent ligands".
#   Biophysical Journal 45, 1109–1123 (1984).
#
# Rule-based adaptation appeard as part of:
#   MW Sneddon, JR Faeder, and T Emonet.
#   "Efficient modeling, simulation and coarse-graining of biological complexity with NFsim".
#   Nature Methods 8, 177–183 (2011).
setOption("SpeciesLabel","HNauty")
begin model
begin parameters
    # constants
    NA  6.0221e23             # Avogadro's number
    # experimental conditions
    cell_density  1e9         # cells per liter
    Rec_cell      3e5         # receptors per cell
    Lig_conc      8.3e-9      # initial ligand concentration, M
    # simulation scale
    f    0.001                # fraction of simulated cell     
    Vol  (1/cell_density)*f   # reactor volume
  	# initial species count
	Lig_tot  Lig_conc*NA*Vol
	Rec_tot  Rec_cell*f
    # equillibrium constants
    K1       0.1084e9         # free binding equillibrium constant, /M
    K2       33.72e9          # crosslinking equillibrium constant, /M
    # kinetic parameters
    koff     0.01             # unbinding rate, /s
    kp1      K1*koff          # Free binding rate constant, /M/s
	kp2      K2*koff          # Crosslinking rate constant, /M/s
end parameters
begin molecule types
    R(l,l)
    L(r,r,r)
end molecule types
begin seed species
    R(l,l)     Rec_tot
    L(r,r,r)   Lig_tot
end seed species
begin observables
	Species    Rfree      R(l,l)
	Species    Lfree      L(r,r,r)
    Molecules  Ropen      R(l)
    Molecules  Lopen      L(r)
    Species    Rsingle    R==1
    Species    Rclusters  R>=2
	Molecules  LRmotif    L(r!0).R(l!0)
    Molecules  RLRmotif   R(l!0).L(r!0,r!1).R(l!1)
	Molecules  Rtot       R()
	Molecules  Ltot       L()
end observables
begin reaction rules
	R(l!1).L(r!1)         ->  R(l) + L(r)            koff
	L(r,r,r)      + R(l)  ->  L(r!1,r,r).R(l!1)      kp1/NA/Vol
	L(r,r,r!+)    + R(l)  ->  L(r!1,r,r!+).R(l!1)    kp2/NA/Vol
	L(r,r!+,r!+)  + R(l)  ->  L(r!1,r!+,r!+).R(l!1)  kp2/NA/Vol
end reaction rules
end model