14. Related Codes (*)¶
Here we summarize some codes used in stellar dynamics that are similar to NEMO. We only list codes that are (publically) available. SPH/hydro codes are currently not included. See also ASCL to find more codes.
First we start off with some expanded examples on a few specific codes that have a tighter connection to NEMO:
14.1. AMUSE¶
AMUSE (Astrophysical Multipurpose Software Environment) originates some ideas from its predecessors: ACS, StarLab and NEMO, but uses the python language. Another feature of AMUSE is that python is also the glue shell between legacy codes that can orchestrate simulations taking components from different codes, whereas in NEMO legacy codes have a NEMO CLI interface, at best.
For seasoned AMUSE users, here we highlight some differences between the two, and give some examples how to achieve the same task in NEMO and AMUSE.
14.1.1. Differences¶
Shell: NEMO uses a Unix shell, AMUSE uses python (ipython, jupyter, …).
Community Code: Both packages maintain a tight connection to legacy software and community codes. You can find them in $AMUSE/src/amuse/community and $NEMO/usr resp.
Units: NEMO uses dimensionless values, and units are implied. Most programs actually use virial units where G=1, but there are a few programs (e.g. galaxy, nbodyX) that use other units. The units(1NEMO) tries to help you converting. AMUSE (optionally?) attaches units to numbers , using a python trick, e.g.
from amuse.units import units
mass = 1.0 | units.MSun
astropy users might be a bit baffled, since this looks very different. But
m1 = mass.as_astropy_quantity()
will look more familiar. In pure astropy it might look as follows:
from astropy import units as u
m = 1.0 * u.solMass
m2 = m.to(u.kg).value
14.1.2. Examples: Creating a Plummer sphere¶
Here we create a Plummer sphere, in virial units, in NEMO, and display an X-VX projection on the sky in a shell session:
source /opt/nemo/nemo_start.sh
mkplummer p100 100
snapplot p100 xvar=x yvar=vx
or in the style of using pipes this can be a one liner
mkplummer - 100 | snapplot - xvar=x yvar=vx
And in AMUSE the following python session can do something similar:
Todo
figure out the right py-gnuplot
from amuse.units import units
from amuse.units import nbody_system
from amuse.ic.plummer import new_plummer_sphere
convert_nbody = nbody_system.nbody_to_si(100.0 | units.MSun, 1 | units.parsec)
plummer = new_plummer_sphere(1000, convert_nbody)
plotter = Gnuplot.Gnuplot()
plotter.splot(plummer.position.value_in(units.parsec))
The AMUSE manual has some NEMO I/O examples.
14.1.3. Installation¶
For the benefit of NEMO users, AMUSE can usually be installed easily as follows:
pip install amuse
but this can take a while as it finds the right dependencies and needs to compile massive amounts of code. Some of these can easily fail if you don’t have the correct prerequisites (e.g. MPI).
A potentially faster way is to first install the AMUSE frame work and then the selected module(s):
pip install amuse-framework
pip install amuse-seba amuse-brutus
There are many more details in the AMUSE installation manual.
14.2. Martini¶
There is an expanded example in https://teuben.github.io/nemo/examples/eagle.html,
and some supporting notes are in $NEMO/usr/martini
.
It can also be installed with
pip install astromartini
14.3. ClusterTools (*)¶
This python package can also read NEMO (gyrfalcON) files. More on this later.
14.4. ZENO¶
ZENO is Josh Barnes’ version of an earlier version of NEMO that he continues to develop. We also keep a zeno manual page highlighting some differences.
Warning
Adding ZENO to NEMO will result in some programs that have duplicated names.
14.4.1. Installation¶
For the benefit of NEMO users, ZENO can usually be installed as follows:
cd $NEMO/usr/zeno
make zeno
This will currently download two repos: zeno_jeb and zeno_pjt. Pick one by using a symlink to become the official one for the install:
ln -s zeno_pjt zeno
source zeno_start.sh
cd zeno
make -f Zeno
Now various ZENO commands are available:
ls $ZENOPATH/bin
14.5. STARLAB¶
14.5.1. Installation¶
For the benefit of NEMO users, STARLAB can usually be installed as follows:
mknemo starlab
14.5.2. Examples¶
These examples were taken from http://www.sns.ias.edu/~starlab/examples/, but an up-to-date list may be found in the file EXAMPLES in the Starlab distribution. If installed within NEMO, this should be in $NEMO/local/starlab/EXAMPLES.
For details on a specific tool, type
tool-name --help
Create a linked list of 100 equal-mass nodes of unit total mass
makenode -n 100 -m 1
Create a system of 100 nodes with a Salpeter mass spectrum with masses
in the range 0.5 to 10
makenode -n 100 | makemass -f 1 -x -2.35 -l 0.5 -u 10
Create a system of 100 nodes with a mass spectrum and evolve the stars
without dynamics
makenode -n 100 | makemass -f 1 -x -2.35 -l 0.5 -u 10 \
| ...(to come)...
Create a 500-particle Plummer model, with numbered stars, scaled to
standard dynamical units
makeplummer -n 500 -i
Create a 500-particle W0 = 5 King model, with numbered stars, unscaled
makeking -n 500 -w 5 -i -u
Create a 500-particle W0 = 5 King model with a Miller-Scalo mass
spectrum between 0.1 and 20 solar masses, then rescale to unit total mass, total energy -0.25, and virial ratio 0.5 and display the results graphically
makeking -n 500 -w 5 -i -u \
| makemass -F Miller_Scalo -l 0.1 -u 20 \
| scale -m 1 -e -0.25 -q 0.5 \
| xstarplot -l 5 -P .5
Create a 500-particle W0 = 5 King model with a Miller-Scalo mass
spectrum between 0.1 and 20 solar masses, add in a 10 percent 1-10 kT binary population, then rescale to unit total mass, total energy (top-level nodes) -0.25, and virial ratio (top-level nodes) 0.5, and finally verify the results by analyzing the final snapshot
makeking -n 500 -w 5 -i -u \
| makemass -f 2 -l 0.1 -u 20 \
| makesecondary -f 0.1 -l 0.25 \
| scale -m 1 -e -0.25 -q 0.5 \
| makebinary -l 1 -u 10 \
| sys_stats -n
Evolve this model without stellar evolution for 100 dynamical times,
with log output every dynamical time and snapshot output every 10 dynamical times, with a self-consistent tidal field, removing escapers when they are more than two Jacobi radii from the cluster center
makeking -n 500 -w 5 -i -u \
| makemass -f 2 -l 0.1 -u 20 \
| makesecondary -f 0.1 -l 0.25 \
| makebinary -l 1 -u 10 \
| scale -m 1 -e -0.25 -q 0.5 \
| kira -t 100 -d 1 -D 10 -Q -G 2
Create a King model with a power-law mass spectrum and a binary
population, then evolve it with stellar and binary evolution
makeking -n 500 -w 5 -i -u \
| makemass -f 1 -x -2.0 -l 0.1 -u 20 \
| makesecondary -f 0.1 -l 0.1 \
| add_star -Q 0.5 -R 5 \
| scale -M 1 -E -0.25 -Q 0.5 \
| makebinary -f 1 -l 1 -u 1000 -o 2 \
| kira -t 100 -d 1 -D 10 -f 0.3 \
-n 10 -q 0.5 -Q -G 2 -B
Perform a series of 100 3-body scattering experiments involving an
equal-mass circular binary and a double-mass incomer, with impact parameter equal to the binary semimajor axis, relative velocity at infinity half that needed for zero total energy, and all other parameters chosen randomly, and display the results as a movie
scatter3 -m 0.5 -e 0 -M 1 -r 1 -v 0.5 \
-n 100 -C 5 -D 0.1 \
| xstarplot -l 4
Compute cross-sections for interactions between a circular binary with
component masses 0.75 and 0.25 and an incoming star of mass 1 and velocity at infinity 0.1, all stars having radius 0.05 binary semimajor axes
sigma3 -d 100 -m 0.25 -e 0 -M 1 -v 0.1 \
-x 0.05 -y 0.05 -z 0.05
Create a scattering configuration involving a head-on collision
between a circular binary and a stable hierarchical triple, and verify the result
makescat -M 1.5 -r 0 -v 1 -t -a 1 -e 0 \
-p -a 1 -e 0 -p1 -a 0.1 -e 0 \
| flatten | make_tree -D 1 | pretty_print_tree
Create a scattering configuration involving a head-on collision
between a circular binary and a stable hierarchical triple, and integrate it forward in time
scatter -i "-M 1.5 -r 0 -v 1 -t -a 1 -e 0 \
-p -a 1 -e 0 -p1 -a 0.1 -e 0" \
-t 100 -d 1 -v
14.6. Yt¶
yt is a community-developed analysis and visualization toolkit for volumetric data, and handles SnapShot type data.
Warning
using yt will require python3.
More to come. There is a notebook in prep.
14.7. List of Related Codes¶
Todo
this list needs to be annotated and spiced up with links.
- ACS
The Art of Computational Science - How to build a computational lab. In C++ and ruby. With ideas from NEMO and StarLab. | http://www.artcompsci.org/
- agama
Action-based galaxy modeling framework. Also usable via
$NEMO/usr/agama
. | http://ascl.net/1805.008- AMIGA
Adaptive Mesh Investigations of Galaxy Assembly. | http://ascl.net/1007.006
- AMUSE
Astrophysical Multipurpose Software Environment. Also usable via
$NEMO/usr/amuse
. | http://ascl.net/1107.007- arepo
Cosmological magnetohydrodynamical moving-mesh simulation code. | http://ascl.net/1909.010
- bhint
High-precision integrator for stellar systems | https://ascl.net/1206.005
- bonsai
N-body GPU tree-code, in AMUSE. | http://ascl.net/1212.001
- brutus
See also AMUSE
- Catena
Ensemble of stars orbit integration | https://ascl.net/1206.008
- CGS
Collisionless Galactic Simulator. Also usable via NEMO with the runCGS interface. | http://ascl.net/1904.003
- ChaNGa
Charm N-body GrAvity solver | http://ascl.net/1105.005
- clustertools
A Python package with tools for analysing star clusters. | https://github.com/webbjj/clustertools
- DICE
Disk Initial Conditions Environment | https://ascl.net/1607.002
- Fewbody
Numerical toolkit for simulating small-N gravitational dynamics | http://ascl.net/1208.011
- fractal
A parallel high resolution Poisson solver for an arbitrary distribution of particles. | https://github.com/jensvvillumsen/Fractal
- gadgetX
A Code for Cosmological Simulations of Structure Formation. Several versions available, X=1,2,3,4. gadget2 also available via
$NEMO/usr/gadget
. | http://ascl.net/0003.001- Gala
Galactic astronomy and gravitational dynamics. | http://ascl.net/1302.011
- galaxy
N-body simulation software for isolated, collisionless stellar systems. The older version still usable via NEMO with the rungalaxy interface. | http://ascl.net/1904.002
- galpy
Galactic dynamics package (python) | http://ascl.net/1411.008
- GalPot
Galaxy potential code | http://ascl.net/1611.006
- GANDALF
Graphical Astrophysics code for N-body Dynamics And Lagrangian Fluids | http://ascl.net/1602.015
- GENGA
Gravitational ENcounters with Gpu Acceleration | http://ascl.net/1812.014
- Glnemo2
Interactive Visualization 3D Program | http://ascl.net/1110.008
- GraviDy
Gravitational Dynamics. Also usable via NEMO with the rungravidy interface. | http://ascl.net/1902.004
- gsf
galactic structure finder | http://ascl.net/1806.008
- gyrfalcON
Dehnen’s code. Included in NEMO | http://ascl.net/1402.031
- hermite
In AMUSE.
- HiGPUs
Hermite’s N-body integrator running on Graphic Processing Units. Part of AMUSE. | https://ascl.net/1207.002
- HUAYNO
Hierarchically split-Up AstrophYsical N-body sOlver N-body code. Part of AMUSE. | http://ascl.net/2102.019
- Hydra
A Parallel Adaptive Grid Code | http://ascl.net/1103.010
- hnbody
also | http://ascl.net/1201.010
- ICICLE
Initial Conditions for Isolated CoLlisionless systems https://ascl.net/1703.012 | http://ascl.net/1703.012
- identikit
1: A Modeling Tool for Interacting Disk Galaxies. | https://ascl.net/1011.001 2: An Algorithm for Reconstructing Galactic Collisions. | https://ascl.net/1102.011
- InitialConditions
Website with a collection of programs for integrating the equations of motion for N objects, implemented in many languages, from Ada to Swift. | http://www.initialconditions.org/codes
- JSPAM
Interacting galaxies modeller | http://ascl.net/1511.002
- limepy
Lowered Isothermal Model Explorer in PYthon. | https://ascl.net/1710.023
- MARTINI
Mock spatially resolved spectral line observations of simulated galaxies Also usable via
$NEMO/usr/martini
, see example. | http://ascl.net/1911.005- mcluster
Make a plummer. Also usable via NEMO | http://ascl.net/1107.015
- McScatter
Three-Body Scattering with Stellar Evolution | http://ascl.net/1201.001
- mercury
A software package for orbital dynamics. In AMUSE. | http://ascl.net/1209.010
- MYRIAD
N-body code for simulations of star clusters | https://ascl.net/1203.009
- nbodyX
Where X=0,1,2,3,4,5,6,6++,7 Also usable via NEMO with the runbodyX interface. | http://ascl.net/1904.027
- nbody6tt
Tidal tensors in N-body simulations | http://ascl.net/1502.010
- nbodykit
Massively parallel, large-scale structure toolkit | http://ascl.net/1904.027
- nbody6xx
Alias for nbody6++ Also usable via NEMO | http://ascl.net/1502.010
- N-BodyShop
Simulation codes of astrophysical phenomenon with particle methods. (tipsy, changa, gasoline) | https://github.com/N-BodyShop
- nemesis
Another code to document. | http://ascl.net/1010.004
- NEMO
Stellar Dynamics Toolbox. Our current version is 4. | http://ascl.net/1010.051
- NIGO
Numerical Integrator of Galactic Orbits | https://ascl.net/1501.002
- N-MODY
A code for Collisionless N-body Simulations in Modified Newtonian Dynamics | http://ascl.net/1102.001
- octgrav
- partiview
Immersive 4D Interactive Visualization of Large-Scale Simulations | https://ascl.net/1010.073
- PENTACLE
Large-scale particle simulations code for planet formation | http://ascl.net/1811.019
- petar
Another code to document. | http://ascl.net/2007.005
- plumix
another | http://ascl.net/1206.007
- pNbody
A python parallelized N-body reduction toolbox https://ascl.net/1302.004
- pycola
N-body COLA method code | http://ascl.net/1509.007
- pyfalcon
Python interface for gyrfalcON | https://github.com/GalacticDynamics-Oxford/pyfalcon
- pynbody
N-Body/SPH analysis for python. | http://ascl.net/1305.002
- QYMSYM
A GPU-accelerated hybrid symplectic integrator | https://ascl.net/1210.028
- RAMSES
A new N-body and hydrodynamical code | https://ascl.net/1011.007
- Raga
Monte Carlo simulations of gravitational dynamics of non-spherical stellar systems | http://ascl.net/1411.010
- rebound
Multi-purpose N-body code for collisional dynamics | https://ascl.net/1110.016 Also usable via NEMO
- SecularMultiple
Hierarchical multiple system secular evolution model | http://ascl.net/1909.003
- sidm-nbody
Monte Carlo N-body Simulation for Self-Interacting Dark Matter | http://ascl.net/1703.007
- slimplectic
Discrete non-conservative numerical integrator | http://ascl.net/1507.005
- smalln
- smile
orbits? | http://ascl.net/1308.001
- SpaceHub
High precision few-body and large scale N-body simulations | http://ascl.net/2104.025
- SpheCow
Galaxy and dark matter halo dynamical properties | http://ascl.net/2105.007
- Starlab
Also usable via NEMO | https://ascl.net/1010.076
- Swarm-NG
Parallel n-body Integrations | https://ascl.net/1208.012
- Torch
Coupled gas and N-body dynamics simulator | http://ascl.net/2003.014
- TPI
Test Particle Integrator | http://ascl.net/1909.004
- UNSIO
Universal Nbody Snapshot I/O - See examples.
- VINE
A numerical code for simulating astrophysical systems using particles | http://ascl.net/1010.058
- yt
A Multi-Code Analysis Toolkit for Astrophysical Simulation Data | https://ascl.net/1011.022
- ZENO
Barnes version that was derived from NEMO V1. | https://ascl.net/1102.027 Also usable via NEMO , but watch out for duplicate names of programs
A large number of these codes can also be found by searching on ASCL, for example: https://ascl.net/code/search/dynamics and https://ascl.net/code/search/hermite and https://ascl.net/code/search/orbit and https://ascl.net/code/search/nbody. The last time this list was cross-checked was … 16-jul-2021.
14.8. Python¶
Python support in NEMO itself is still rudimentary, though the common
cd $NEMO
pip3 install -e .
will add the nemopy
module to your python environment. Currently only
a simple getparam interface is available.
There are good import and export routines to other N-body formats, through which other toolkits can provide interesting ways to analyze NEMO data. We list a few
yt toolkit: https://yt-project.org/
nobodykit: https://nbodykit.readthedocs.io/
clustep, galstep: https://github.com/elvismello create initial conditions in gadget2 format. ($NEMO/usr/mello)
galanyl: https://bitbucket.org/ngoldbaum/galaxy_analysis pip install galanyl
unsio: pip install python-unsio python-unsiotools ($NEMO/usr/jcl)
agama: https://github.com/GalacticDynamics-Oxford/Agama - pip install agama ($NEMO/usr/agama)
pynbody: https://github.com/pynbody/pynbody
martini: https://github.com/kyleaoman/martini ($NEMO/usr/martini)
galpak: http://galpak3d.univ-lyon1.fr/index.html - pip install galpak
amuse: https://github.com/amusecode - pip install amuse-framework
SnapGadget: https://github.com/regmachado/SnapGadget
14.9. Categories¶
Such a niche list of codes made me wonder what kind of meta-data we could use to categorize such dynamics codes, but then perhaps along the lines of the Unified Astronomy Thesaurus project.
dynamics - nbody, orbit, integrator, sph, hydro, analysis, integrator