X-Git-Url: https://pd.if.org/git/?p=afpopgen;a=blobdiff_plain;f=sim%2Fsim.c;h=31a78c76bcee832020f25d297f55cceff971d77f;hp=7919300933f8ec045c7deacd6d78cd7d44b22e5e;hb=d4b54d81449d62cacd2048214f36ae997a141625;hpb=3a0dc840c8ea2c4b42a1051768ea43107eedbb1e diff --git a/sim/sim.c b/sim/sim.c index 7919300..31a78c7 100644 --- a/sim/sim.c +++ b/sim/sim.c @@ -15,11 +15,17 @@ void hexlistjson(struct afrhex *map); static void setpop(struct afrhex *map, int hexid, int *pop) { struct afrhex *hex; int i; + int sum = 0; hex = find_hex(map, hexid); for (i=0; i < 2; i++) { hex->freq[i] = pop[i]; + sum += pop[i]; } + if (sum % 2) { + fprintf(stderr, "allele frequency for hex %d not even\n", hexid); + } + hex->pop = sum/2; } static void setpopstr(struct afrhex *map, char *spec) { @@ -123,6 +129,7 @@ int main (int ac, char *av[]) { printf("{"); printf(" \"run\": %d, \"seed\": %d, \"gens\": %d", run, seed, gens); + printf(",\n\"options\": { \"capfactor\": %f }", capfactor); printf(",\n\"gendata\": [\n"); dumpgenjson(map, 0, year);