Monte Carlo programs
Here are programs for simulating a 2D ferromagnet with 10 000 Ising spins
(100x100 spin array with periodic boundary conditions). The best strategy
is to download the files to your own account. Make a new folder
(e.g., "Ising"). Then click with the right mouse button on the highlighted
file name, choose the option "save link target as", and then select the
folder you have just made. Here are the three files to be downloaded:
If you use a Linux or Unix machine (e.g., one of those in Room 412), I can
tell how to compile the program. Open a terminal window that would allow you
to work in command mode. Go to the directory where you have downloaded
the programs. Then enter the command:
cc -lm ising2ds.c
This will produce an executable version of the program, and the file will
be named a.out by the operating system (you
will probably also get some messages on the screen - just ignore them).
A good practice is to change the name. If you didn't do that and compiled
another file, then the old "a.out" would be overwritten by a new one. Without
renaming the executable files, you would not be able to have more that one
executable file in the folder.
Renaming can be done using the command "mv" (abreviated "move"):
mv a.out ising2ds.exe
Actually, you don't need to use two separate commands, everything can be
done using a single one:
cc -lm -o ising2ds.exe ising2ds.c
Here what comes after "-o" is the new name that will be given to the executable
file.
When I work with programs, I always give the executable version the same
name as that of the source code, only replacing the extension "c" with
"exe". But you may use any other name you want, for instance:
cc -lm -o drtomisanold.bore ising2ds.c
Once you have both programs compiled, you may run them. To run an executable
file, you simply enter its name preceded by "./":
./ising2ds.exe
(to be continued)