//////////////////////////////////////////////////////////////////////////// // // gro // // Copyright (c) 2011-2012 Eric Klavins, University of Washington // For more information, email klavins@uw.edu // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // // include gro z0 := 4.25; zoom (z0); set ( "dt", 0.15 ); set ( "population_max", 40000 ); set_theme ( dark_theme << [ background := "#333333", signals := { { 0,0,0.5 }, { 0,1,0 }, {1,1,0} } ] ); wi := 4000; hi := 3000; set ( "signal_grid_width", wi+100 ); set ( "signal_grid_height", hi+100 ); food := signal ( 0, 0 ); enzyme := signal ( 0.1, 0.04 ); sugar := signal ( 0.1, 0.0 ); reaction ( { food, enzyme }, { sugar, enzyme }, 0.25 ); fun hill x . x / ( 1 + x ); program p() := { gfp := 0; temp := 0; n := 10; true : { temp := get_signal ( sugar ), // get local sugar concentration n := n + 0.1 * ( hill temp ), // eat some sugar by adding it to the internal nutrients absorb_signal ( sugar, 0.2 * ( hill temp ) ), // and deleting it from the environment n := n - 0.1 * ( hill n ), // burn some sugar by removing it from the internal nutrients set ( "ecoli_growth_rate", 0.025 * ( hill n ) ), // and using it to grow } rate ( 0.8*n/volume ) : { gfp := gfp + 1, emit_signal ( enzyme, 0.2 ) } rate ( 0.1 ) : { gfp := gfp - 1 } selected : { message ( 1, tostring({ id, n/volume }) ) } rate ( 0.0001 / ( n + 1.0 ) ) : { die() } }; set_signal_rect ( food, -wi/2, -hi/2, wi/2, hi/2, 10 ); ecoli ( [ x := -wi/3, y := -hi/3, theta := rand(628)/100.0 ], program p() ); ecoli ( [ x := wi/5, y := hi/4, theta := rand(628)/100.0 ], program p() ); ecoli ( [ x := -wi/5, y := hi/7, theta := rand(628)/100.0 ], program p() ); ecoli ( [ x := 0, y := -hi/3, theta := rand(628)/100.0 ], program p() ); ecoli ( [ theta := rand(628)/100.0 ], program p() ); program main() := { t := 0; s := 5-2*dt; n := 0; z := z0; z > 0.25 : { // to zoom r units down in m minutes we need r/m zoom per minute z := z - ((z0-0.25)/700.0)*dt, zoom ( z ) } true : { t := t + dt, s := s + dt } s >= 5.0 : { s := 0, snapshot ( "tmp/" <> tostring(n) <> ".tif" ), n := n + 1 } };