home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Graphics / VideoEasel / CAMRexx / IsingII.rexx < prev    next >
OS/2 REXX Batch file  |  1995-03-30  |  1KB  |  38 lines

  1. /* Microcannonical Ising Model with energy banks */
  2. /* by an idea of Toffoli, in CAMRexx by THOR */
  3.  
  4. MakeAlgorithm:
  5.    PLANEALGORITHM neumann hvphases
  6. return
  7.  
  8. MakePlane:
  9.    lattice=(horz=vert)
  10.    if phase=1 then   lattice=~lattice
  11.    /* handle only even or odd sublattice */
  12.    if lattice then; do
  13.       bonds=north+south+east+west           /* #bonds for spin down */
  14.       if center then bonds=4-bonds          /* and spin up */
  15.       select
  16.          when bonds=1 & center_=1 then; do /* one bond, energy in the bank */
  17.             new=3-centers                  /* invert our state and the bank */
  18.             SETPLANES new
  19.          end
  20.          when bonds=2 then; do           /* two bonds */
  21.             if plane=0 then; do
  22.                new=~center
  23.                SETPLANE new            /* flip only spin */
  24.             end; else
  25.                SETPLANE center_        /* preserve bank */
  26.          end
  27.          when bonds=3 & center_=0 then; do   /* three bonds, bank empty */
  28.             new=3-centers
  29.             SETPLANES new
  30.          end
  31.          otherwise
  32.             SETPLANES centers
  33.       end /* of select */
  34.    end; else
  35.       SETPLANES centers
  36. return
  37.  
  38.