Table of Contents


scfm - N-body integrator using the self-consistent field method




scfm is a code to evolve self-gravitating systems using a self-consistent field approach. This version has been optimized for supercomputers and is fully vectorized. The code is written in standard FORTRAN, although some CRAY-specific vector intrinsic routines have been used.

The computational system of units is determined by the input data. No explicit assumtions about the value of the gravitational constant have been made; it is read in as a parameter. Particles are not required to have identical masses.


Two files (both in ascii) determine the input parameters and input condition, and must be present at the start of the program.

The first one is the input parameter file with the name SCFPAR. It contains, line by line, the input parameters for this run. In the table below the values for the benchmark input parameter file are given in square brackets:

     Comment      Private comment. (cannot be a null string)
     headline      Identification string for the run (max 50 char) [test]
     nsteps        Number of timesteps [100]
     noutbod       Output system state (file SNAPxxx) once every noutbod steps
     noutlog       Output logfile data (file SCFMLOG) once every noutlog steps
     dtime         Integration timestep [0.01]
     gravconst    Gravitional Constant [1]
     selfgrav       [.TRUE.]
     inptcoef       [.FALSE.]
     outpcoef          [.FALSE.]
     zeroodd       [.FALSE.]
     zeroeven       [.FALSE.]
     fixacc       [.FALSE.]
Note that the first line is a redundant comment not used by the program, but needs to be present.

The second file has to be named SCFBI, and contains the input bodies. The first line must contain the number of bodies, and the time of this snapshot, followed by

Output files created are SNAPxxx, which contains all the requested (see noutbod) output snapshots, one for each requested output time in ascii ntmpv(5NEMO) format.

which contains a log (see noutlog) of the run and SCFBO, which contains a binary (machine dependable) dump of the last snapshot. Note that these output files must not be present when the program is to be run. (ANSI FORTRAN)

To avoid excessive overhead, noutlog should be larger than 1, typically ~ 10, depending on total number of steps though.


A shell script runscfm is available to ease running this program slightly, and also prevents you from running two versions of scfm in the same directory. Script usage:

runscfm input_snapshot output_snapshot pars_file

The input_snapshot and output_snapshot are now in snapshot(5NEMO) format, whereas the pars_file is in the format described in the previous PARAMETERS section.


Preparing an input dataset for scfm can be done as follows:
    snapprint in=i.snap options=m,x,y,z,vx,vy,vz header=t >

Converting output tables made by scfm into snapshot(5NEMO) can be done as follows:

tabtos out=o.snap header=nbody,time block1=mass,pos,vel


May need another version of second.f on some systems. See also the source code directory of treecode3.


Timings are from 1000 integration steps.
machine     cpu    N-body
US-140         143"    1000
US-140         269"    2000
US-140         611"    4000
US-140        1072"    8000
US-140           ....    16000
US-2               380    8000


Lars Hernquist


SCFPAR                        input parameters (ascii)
SCFBI                        input bodies (ascii)
SCFLOG                        output logfile
SCFOUT                        output something (’termfile’)
SCFELxxx                      output something (1/body)
SNAPxxx                      output bodies
SCFICOEF                     input coefficients file
SCFOCOEF                     output coefficients file
~/usr/lars/scfm/            original LARS version
~/src/nbody/evolve/scfm/         original LARS version


Some timings for the standard benchmark (100 timesteps, 1024 particles):
Pentium-333    6.93"
Pentium-500    4.58
Pentium-933     2.76    
Ultra-10/300    9.64    (g77 -O)
        7.20    (f77 -O)
        7.33    (f77 -fast)

See Also

runscfm(1NEMO) , snapshot(5NEMO) , snapprint(1NEMO) , ntmpv(5NEMO)

Hernquist, L. & Ostriker, J. (1992) A Self-Constistent Field Method for Galactic Dynamics, ApJ. 386, 375.


1-jan-91    V1 Public release created    Lars Hernquist (@UCB)
7-jul-97    integrated in NEMO/usr tree             PJT
20-jan-98    integrated in NEMO/src tree              PJT
18-dec-99    fixed some Makefile bugs, added bench timings    PJT

Table of Contents