This HTML automatically generated with rman for NEMO
Table of Contents

Description

AMUSE is the Astrophysical MUltipurpose Software Environment. With it, you can simulate many astrophysical systems.

The user interacts with AMUSE in python, so there is currently no amuse command, though one could imagine

ipython --profile=amuse

instead you will want to import this module (see example below) in your python code and go from there. Internally many components in AMUSE are legacy codes (C,C++,Fortran) running at fantastic speeds.

An example is shown below, and within NEMO there the script amuse_convert.py can be used to convert between different snapshot formats, as long as the format is supported by AMUSE. See also unsio(3NEMO) for another approach to such snapshot conversion.

Examples

Here is an example snippet of AMUSE python code creating a Plummer sphere in nbody units and writing the resulting snapshot as a table, much like mkplummer(1NEMO) ,

from amuse.units import nbody_system
from amuse.ic.plummer import new_plummer_model
from amuse.io import write_set_to_file

stars = new_plummer_model(10)

write_set_to_file(stars, ’plummer.txt’, format=’txt’)

This table has mass, radius, velocity and position, one star per row. Notice velocity comes before position! Thus the following NEMO command will convert it to a standard snapshot(5NEMO) file:

nbody=$(tabcols plummer.txt | wc -l)
tabcols plummer.txt | tabtos - plummer.snap block1=mass,skip,vx,vy,vz,x,y,z nbody=$nbody

Here is a more NEMO like example, running from the (shell) commandline. If AMUSE is properly installed, the first example creates a Plummer model in memory, the second example creates a text file, of which the first particle is displayed as the 3rd line in this table:

amuse_convert.py
amuse_convert.py -o plummer.txt

head -3 plummer.txt
#mass radius vx vy vz x y z #mass length length * time**-1 length * time**-1 length * time**-1 length length length 0.0078125 0.0 -0.256557735045 0.0863119421344 -0.0484937398944 -0.609540735858 -0.854122523728 0.736476012616

Bugs

The follow round trip exercise on the txt format causes an error:

fmt=txt amuse_convert.py -o junk1 -O $fmt -n 100 amuse_convert.py -i junk1 -I $fmt -o junk2 -O $fmt amuse.io.base.IoException: IO exception: Number of values on line ’0.01 0.0 -0.319149817818 0.911387278048 0.00131274766207 -1.22528821614 -0.310636170602 0.0257190619401’ is 8, expected 0

formats like csv, amuse-txt, tsf, dyn all seem to work.

Install

Within NEMO the command

mknemo amuse

will get you started on the install. Note there is a user release that does not need NEMO, which can be a set of pip install. A developer release is recommended with NEMO, the start of which will likely look as follows:

cd $NEMO/local/amuse
./setup develop amuse-framework
./setup develop amuse-bhtree


The AMUSE bhtree code should be the same as the original program bhtree(1NEMO) in NEMO, allowing for a closer comparison.

Snapshot

As described in the help (-h) of amuse_convert.py, the following formats are supported by AMUSE:
amuse        HDF5 file
amuse-txt    text files with AMUSE header format
csv        comma separated files
dyn        Starlab binary structured file
gadget        Gadget binary data file
hdf5        HDF5 file
nemo        NEMO binary structured file
starlab        Starlab binary structured file
tsf        NEMO binary structured file
txt        text file containing a table of values separated by a predefined
vts        text file containing a table of values separated by a predefined character
vtu        text file containing a table of values separated by a predefined character

Files


$NEMO/src/scripts/mknemo.d/amuse - example install script (can be run via
mknemo)
$NEMO/local/amuse - root of source code after install
$NEMO/src/scripts/python/amuse_convert.py - also copied to $NEMOBIN during
install

Ads


@ads 2013A&A...557A..84P
@ads  2013CoPhC.184..456P 

See Also

nemo(1NEMO) , zeno(1NEMO) , starlab(1NEMO) , bhtree(1NEMO)


https://www.amusecode.org/

History


25-may-2025    man page and amuse_convert.py written (MODEST25-SPZ)    PJT
27-mar-2025    overhauled installation method        PJT


Table of Contents