############################################################ # Sample input file which illustrates use of 'sm' # macros to animate nbody simulations. # # See on-line (postscript) documentation for more # information on the 'sm' ("supermongo") plotting package. # # Assuming this file is named 'smin' and lives in the # current working directory, then use: # # % sm # : input smin # # to start 'sm' and run this demonstration. Note: The # file 'output' containing the nbody output must also # reside in the working directory. ############################################################ ############################################################ # Input macro definitions for nbody "animation" ############################################################ input "/usr/local/lib/sm/macro/nbody" ############################################################ # Modify any of these variables prior to invoking 'animnbody' # NB_SYMBOL_EXPAND -> Scale factor for symbols # NB_SYMBOL_COLOR -> Initial drawing color # NB_SYMBOL_ERASE_COLOR -> "Erasing" color # NB_SYMBOL_TYPE -> Argument to PTYPE macro which # determines marker type (see 'sm' # documentation) # # Default definitions: Particles initially drawn as filled # white squares, then drawn as filled red squares, with # scale factor or 2. # # define NB_SYMBOL_EXPAND 2 # define NB_SYMBOL_COLOR white # define NB_SYMBOL_ERASE_COLOR red # define NB_SYMBOL_TYPE "4 3" ############################################################ ############################################################ # Macro 'readnbody' takes a single argument: the name of # a formatted file containing nbody data in the format # # - # | # | # . ---> Block repeated 'nt' times # . | # . | # - # # where 'np' and 'nt' are, respectively, the number of # and the number of time levels of data stored in the file ############################################################ readnbody output ############################################################ # Macro 'animbody' takes a single argument: the number # of 'ticks' to "idle" before moving onto the next time # step. Larger values slow the animation down. Adjust # to taste. ############################################################ animnbody 100 ############################################################ # Redo animation with green markers which are actually # erased after each time step. ############################################################ define NB_SYMBOL_COLOR green define NB_SYMBOL_ERASE_COLOR black animnbody 100