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.

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., though the latter has some supporting script in $NEMO/src/scripts/mknemo.d

  • Units: NEMO uses dimensionless values, and units are implied. Most programs actually use virial units (a.k.a N-body units, or Henon 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

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.

Installation

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.