to run ./hoscr (number of generations to breed) (Random #seed) Example ./hoscr 20 2 integrates 20 generations with a random number seed of 2. This is a sample code for integrating ordinary differential equations using Adams-Bashforth formulae with adaptive step size and order. All compilable code here is written in Fortran 90. For assistance with running this code, contact the author, Daniel Steck, at . This code is provided as-is, without warranty; you should thoroughly test it before trusting it. This code is free for non-commercial use. This is version 1.0 of this integrator. ************************************************************************ The contents of this directory are: README: this file odeab90.f90: the file containing the integrator module hoscr.f90: this driver is designed to evaluate a master equation to find a best fit solution using a genetic algorithm globals.f90: defines global variables to be shared by multiple routines odeab_support.f90: integrator support module, defining the equations of motion for the problem, and interface stuff for odeab90. random_pl.f90: portable random number generator (see below) utilities.f90: general-use utilities (hoscr uses 's2r' to convert strings to real numbers and 's2i' for integers) Makefile: makefile for test1.f90, this tells the 'make' utility what to do ************************************************************************ To modify this code to solve other problems, you will want to concentrate on 'hoscr.f90' and 'odeab_support.f90'. Read the extensive comments in the source files to see what is going on. ************************************************************************ NOTE: this integrator is written by me and has not been tested by a large user community for many years. It is a sophisticated Adams- Bashforth code with adaptive step size and adaptive integration order. It should be high-quality and efficient, but there is always the possiblity for finding a bug. Normally, I would recommend a production-quality integrator such as ODEPACK, but I am building this example around this integrator so you can have a portable, self-contained code. This is particularly important in this course since we don't have a specific "home" cluster. ************************************************************************ NOTE: this example is the same as the simpler 'odesample', but with two differences. First, a random-number generator is involved. I have included my own generator library here. Fortran 90 has one built in to the language, but the problem is you don't know what generator the compiler is using (the one I have included is quite sophisticated). Further, if you port from one computer to another, the same run will in general be different on different computers; however, if you use my library, which is coded in integer arithmetic, the results will be exactly the same on any platform. This is a useful way to test your code on a new machine-- verify that it gives identical results as on a 'trusted' machine. The random numbers are used to reset the trajectory to its initial condition with a constant probability per unit time. The other difference is a facility for averaging many different stochastic trajectories together before output. Each trajectory is a separate run of the integrator, and the results are stored in a summation array. Another approach is to evolve all the trajectories in parallel, and average/output them on the fly. The former approach has the disadvantage of artificially limiting the length of the simulation, but the latter is inefficient for this particular ODE solver (there is a lot of overhead in restarting the integrator). Ultimately, this ODE solver is overkill for this problem, but we'll use it anyway. ************************************************************************ To try this out: download the source tarball, by using "download as" in your browser or by using wget: wget where is the location of the source tarball odesample.tgz, something like wget atomoptics.uoregon.edu/~dsteck/teaching/07spring/phys686/randsample.tgz Now unpack it: tar xvzf odesample.tgz Now compile it like you did for odesample. Try running it: ./hoscr You should have gotten usage info. Try a simulation with a single trajectory: ./hoscr 1 10 .001 10 1 if you plot it, you should see the jumps. Now try averaging a few: ./hoscr 1 10 .001 10 100 The oscillations should look damped now. ************************************************************************