nbody requires a reasonably new C++ compiler (currently, I have tested it only with g++ on Digital UNIX V4.0), which support 64 bit integer (as long). You may be able to change the source code to support 32-bit platform, but I have never tried.
Standard Makefile for nbody assumes that PGPLOT is available. It's easy to edit Makefile so that you can run nbody without PGPLOT.
In Komaba astrophysics computer network, you can find the most recent version of nbody as
~makino/src/C++tree/export.tar.gzYou can just copy it to your local directory.
It's also available at my Web cite
http://grape.c.u-tokyo.ac.jp/~makino/softwares/C++tree/
First go to the directory to which yo install nbody . Then extract the files from the tar file you've got.
Then, you may need to edit the Makefile according to your need. The default Makefile is designed for Digital UNIX platform with GRAPE-4 installed, and it looks like
PGPLOT_DIR = /usr/local/pgplot5.2 #PGPLOT_DIR = /data6/makino/PDS/pgplot_linux/pgplot PGINCLUDE = -I$(PGPLOT_DIR) CFLAGS = $(FLOAT_OPTIONS) -DREAL=double -O4 -ffast-math -funroll-loops # Add -DNOGRAPHICS for installation without PGPLOT CPPFLAGS = -DNOGRAPHICS -DTREE $(PGINCLUDE) -pg $(FLOAT_OPTIONS) -O4 -ffast-math -funroll-loops PGLIB = -L$(PGPLOT_DIR) -g3 -O4 -lcpgplot -lpgplot -lX11 -lUfor -lfor -lFutil -lm -lprof1 -lpdf G4LIB = -L/usr6/kawai/pub/lib -lg4a -lrt -lm H3LIB = -L/usr2/makino/src/harp3board -lharp3 -lrt -lm LIBOBJS = pgetopt.o gravity.o BHtree.o second.o LIBOBJSG4 = pgetopt.o gravity_g4.o BHtree_g4.o second.o EXPORT_FILES = BHtree.h nbody_particle.h vector.h \ BHtree.C gravity.C nbody.C pgetopt.C\ second.c \ Makefile nbody_guide.tex\ samplein sampleparm samplelog samplelog_g4 export: export.tar.gz ls -al export.tar.gz export.tar.gz: $(EXPORT_FILES) tar cvf export.tar $(EXPORT_FILES) gzip export.tar gravity.o : gravity.C nbody_particle.h g++ $(CPPFLAGS) -c gravity.C gravity_g4.o : gravity.C nbody_particle.h g++ -DHARP3 $(CPPFLAGS) -c gravity.C mv gravity.o gravity_g4.o nbody.o : nbody.C nbody_particle.h g++ -c $(CPPFLAGS) nbody.C nbody : nbody.C nbody_particle.h $(LIBOBJS) g++ -DEVOLVE $(CPPFLAGS) -o nbody nbody.C $(LIBOBJS) nbody_g4 : nbody.C nbody_particle.h $(LIBOBJSG4) g++ -DEVOLVE $(CPPFLAGS) -o nbody_g4 nbody.C $(LIBOBJSG4) $(PGLIB) $(G4LIB) nbody_h3 : nbody.C nbody_particle.h $(LIBOBJSG4) g++ -DEVOLVE $(CPPFLAGS) -o nbody_h3 nbody.C $(LIBOBJSG4) $(H3LIB) BHtree.o : BHtree.C nbody_particle.h BHtree.h g++ $(CPPFLAGS) -c BHtree.C BHtree_g4.o : BHtree.C nbody_particle.h BHtree.h g++ -DHARP3 $(CPPFLAGS) -c BHtree.C mv BHtree.o BHtree_g4.o pgetopt.o : pgetopt.C g++ $(CPPFLAGS) -c pgetopt.C samplelog: sampleparm nbody nbody < sampleparm > samplelog samplelog_g4: sampleparm nbody_g4 nbody_g4 < sampleparm > samplelog_g4
If you do not have PGPLOT, add -DNOGRAPHICS to CPPFLAGS. If you have one, specify the installed directory at PGPLOT_DIR.
If you have GRAPE-4, check G4LIB so that it points to the right directory. In addition, target name for HARP-3 (GRAPE-4 with Turbochannel driver) version ( nbody_h3) is also provided. This one uses H3LIB instead of G4LIB. To use this one in Komaba, change PGPLOT_DIR to /usr/local/pgplot or specify -NOGRAPHICS in CPPFLAGS
To compile nbody , just type
make nbodyor, for GRAPE-4 version,
make nbody_g4If you've met by an error message, well, good luck! Please let me know how you fixed the problem.