/users/rlr/Courses/ICPSR-02/Handouts/copy-models.txt ---------------------------------------------------- This describes how to establish a copy of a Swarm model in your own directory space, so you can, say, change it as you wish, or at the least, look at the source for it. For instance, to make a copy of the Tipping2 model: First make a directory to hold the model, e.g., make it under your home directory: cd ~ mkdir Tipping2 cd Tipping2 Next, copy in the source files for the program: cp /users/rlr/SwarmStuff/CSCS-Demos/Tipping2/*.h . cp /users/rlr/SwarmStuff/CSCS-Demos/Tipping2/*.m . cp /users/rlr/SwarmStuff/CSCS-Demos/Tipping2/Makefile . NB: the dot character (.) at the end of each of the above copy commands is necessary: the dot tells it to copy the specified files to the current directory. So for example, the first command says copy all the files in the directory /users/rlr/SwarmStuff/CSCS-Demos/Tipping2/ that end in the characters ".h" to the current directory. After you have done the copies, you can see the files you have in your current directory (i.e., in Tipping2/): ll You should see something like: -rw-r--r-- 1 rlr car 2667 Jul 24 17:34 Agent.h -rw-r--r-- 1 rlr car 12153 Jul 24 17:34 Agent.m -rw-r--r-- 1 rlr car 659 Jul 24 17:34 BatchSwarm.h -rw-r--r-- 1 rlr car 3405 Jul 24 17:34 BatchSwarm.m -rw-r--r-- 1 rlr car 1650 Jul 24 17:34 main.m -rw-r--r-- 1 rlr car 2377 Jul 24 17:34 Makefile -rw-r--r-- 1 rlr car 2105 Jul 24 17:34 ModelSwarm.h -rw-r--r-- 1 rlr car 16746 Jul 24 17:34 ModelSwarm.m -rw-r--r-- 1 rlr car 1467 Jul 24 17:34 ObserverSwarm.h -rw-r--r-- 1 rlr car 20577 Jul 24 17:34 ObserverSwarm.m -rw-r--r-- 1 rlr car 515 Jul 24 17:34 Parameters.h -rw-r--r-- 1 rlr car 5553 Jul 24 17:34 Parameters.m Those are the "source" files (i.e., the human readable files) for the Tipping2 model. You can use an editor (e.g. emacs) to look at (or change) them, e.g., emacs Agent.m & At any rate, now to make a version of the program that you can run, type make That (linux) command reads the file Makefile, which contains instructions on how to compile and link your runnable program. A bunch of compile and link commands should go by, and there should be no lines that look like error or warning messages. Assuming that is so, you should have this in your directory: -rw-r--r-- 1 rlr car 2667 Jul 24 17:34 Agent.h -rw-r--r-- 1 rlr car 12153 Jul 24 17:34 Agent.m -rw-r--r-- 1 rlr car 16492 Jul 24 17:36 Agent.o -rw-r--r-- 1 rlr car 659 Jul 24 17:34 BatchSwarm.h -rw-r--r-- 1 rlr car 3405 Jul 24 17:34 BatchSwarm.m -rw-r--r-- 1 rlr car 8372 Jul 24 17:36 BatchSwarm.o -rw-r--r-- 1 rlr car 1650 Jul 24 17:34 main.m -rw-r--r-- 1 rlr car 4164 Jul 24 17:36 main.o -rw-r--r-- 1 rlr car 2377 Jul 24 17:34 Makefile -rw-r--r-- 1 rlr car 2105 Jul 24 17:34 ModelSwarm.h -rw-r--r-- 1 rlr car 16746 Jul 24 17:34 ModelSwarm.m -rw-r--r-- 1 rlr car 35028 Jul 24 17:36 ModelSwarm.o -rw-r--r-- 1 rlr car 1467 Jul 24 17:34 ObserverSwarm.h -rw-r--r-- 1 rlr car 20577 Jul 24 17:34 ObserverSwarm.m -rw-r--r-- 1 rlr car 41936 Jul 24 17:36 ObserverSwarm.o -rw-r--r-- 1 rlr car 515 Jul 24 17:34 Parameters.h -rw-r--r-- 1 rlr car 5553 Jul 24 17:34 Parameters.m -rw-r--r-- 1 rlr car 14128 Jul 24 17:36 Parameters.o -rwxr-xr-x 1 rlr car 6418 Jul 24 17:36 tipping Notice all the files that end in .o, as well as the file "tipping". Those .o files are called "object" files...they are compiled versions of the correspondingly named *.m/.h files. The file "tipping" is the the file you can actually run! You know that you can run it because of the "x"s in the columns on the left---they say "people can execute (run) this file". So to run this version of this program: ./tipping & The ./ at the start means "run the version in the current directory". --------------- The process is similar for establishing copies of other Swarm programs. You can see (some of) the models we have at CSCS by entering: ll /users/rlr/SwarmStuff/CSCS-Demos/ Most of those are up-to-date, though we can't guarantee it! -----------------------------------------------------------------------