Index: /experiments/frams/foraminifera/data/scripts/foraminifera.expdef
===================================================================
--- /experiments/frams/foraminifera/data/scripts/foraminifera.expdef	(revision 474)
+++ /experiments/frams/foraminifera/data/scripts/foraminifera.expdef	(revision 475)
@@ -84,5 +84,5 @@
 	//time
 	ExpParams.secPerStep = 60;
-	ExpParams.foramSpeedMmPerMin = 0.1;
+	ExpParams.foramSpeedMmPerMin = 0.05;
 	movePerStep = getMovePerStep();
 
@@ -100,6 +100,6 @@
 	//morphology
 	dir_change = 30000;
-	ExpParams.zone1_range = micronsToFrams(3000);
-	ExpParams.zone2_range = micronsToFrams(6000);
+	ExpParams.zone1_range = micronsToFrams(1000);
+	ExpParams.zone2_range = micronsToFrams(3000);
 	init_chambers();
 	ExpParams.chamber_proculus_haplo = micronsToFrams(50);
@@ -112,5 +112,5 @@
 		for (var i = 0; i < chambers[0].size; i++)
 		{
-			max_chamber_energ[j].add(((Math.pow(getProperty(j, "chamber_proculus"),3) + Math.pow(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference"),3))*(i+1))/2);
+			max_chamber_energ[j].add(((energyFromVolume(getProperty(j, "chamber_proculus")) + energyFromVolume(getProperty(j, "chamber_proculus") + (i) * getProperty(j, "chamber_difference")))*(i+1))/2);
 		}                                  
 	}
@@ -132,5 +132,5 @@
 	//nutrients
 	ExpParams.nutrientsize = micronsToFrams(10);
-	ExpParams.energy_nut = 100 * Math.pow(ExpParams.nutrientsize, 3);
+	ExpParams.energy_nut = 100 * energyFromVolume(ExpParams.nutrientsize);
 	ExpParams.nutrientPop = 1;
 	ExpParams.feedrate = 100;
@@ -141,4 +141,9 @@
 
 @include "standard_placement.inc"
+
+function energyFromVolume(radius)
+{
+	return 4.0/3.0*Math.pi*Math.pow(radius,3);
+}
 
 function getMovePerStep()
@@ -258,5 +263,6 @@
 function setForamMeta(cr, gen)
 {
-	cr.idleen = (ExpParams.e_meta * max_chamber_energ[gen][Math.min(lastChamberNum(cr), max_chamber_energ[gen].size-1)])*ExpParams.secPerStep;
+	//cr.idleen = (ExpParams.e_meta * max_chamber_energ[gen][Math.min(lastChamberNum(cr), max_chamber_energ[gen].size-1)])*ExpParams.secPerStep;
+	cr.idleen = (ExpParams.e_meta * cr.energy)*ExpParams.secPerStep;
 }
 
@@ -384,5 +390,6 @@
 	if (cr.user2["hibernated"] == 0)
 	{
-		cr.energy_m += (ExpParams.energy_move * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep;
+		//cr.energy_m += (ExpParams.energy_move * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep;
+		cr.energy_m += (ExpParams.energy_move * cr.energy)*ExpParams.secPerStep;
 	}
 }
@@ -457,5 +464,6 @@
 	else
 	{
-		cr.idleen = (ExpParams.energy_hib * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep; //hibernate
+		//cr.idleen = (ExpParams.energy_hib * max_chamber_energ[cr.user2["gen"]][Math.min(lastChamberNum(cr), (max_chamber_energ[cr.user2["gen"]].size)-1)])*ExpParams.secPerStep; //hibernate
+		cr.idleen = (ExpParams.energy_hib * cr.energy)*ExpParams.secPerStep; //hibernate
 	}
 	cr.user2["hibernated"] = 1 - cr.user2["hibernated"];
@@ -496,5 +504,5 @@
 function deathConditions(cr)
 {
-	if ((cr.energy <= ExpParams.e_death_level) || (Math.rnd01 < ExpParams.hunted_prob))
+	if ((cr.energy <= getProperty(cr.user2["species"],"e_death_level")) || (Math.rnd01 < ExpParams.hunted_prob))
 		return 1;
 	else
@@ -781,4 +789,16 @@
 
 prop:
+id:e_death_level_haplo
+name:Minimal level of energy to sustain life of haploid
+type:f 0 20 4
+group:Foraminifera
+
+prop:
+id:e_death_level_diplo
+name:Minimal level of energy to sustain life of diploid
+type:f 0 20 0.25
+group:Foraminifera
+
+prop:
 id:energy_hib
 name:Energy used for hibernation during one step
@@ -820,10 +840,4 @@
 name:Mutation probability
 type:f 0 1 0
-group:Foraminifera
-
-prop:
-id:e_death_level
-name:Minimal level of energy to sustain life
-type:f 0 20 0
 group:Foraminifera
 
