Setting up the simulation environment

To use the provided toolset, you will need the following Python libraries

Optional tools include

Instructions for Aalto Linux (and Mac) workstations

The Linux workstations at Aalto have ASE, NumPy, SciPy and matplotlib already installed. You still need the Pysic library and the custom friction_tools Python module. The easiest way to setup the simulation environment is to use the command line interface. Start by opening the terminal and optionally change the directory to wherever you wish to install the simulation tools (home directory is fine). Then write the commands:

wget http://users.aalto.fi/~asf/teaching/aalto_physics/_downloads/linux_tools.zip
unzip linux_tools.zip

to download and unzip the simulation tools package. The contents of the tools package should now be in folder linux_tools. Change to that directory and check that it contains

  • a folder named ase
  • a folder named pysic
  • the file ash.jar

In addition to Pysic, there is also a newer version of ASE (3.8.1). The last one is a java program for viewing atomic structures (launch it with java -jar ash.jar). You still need the the friction_tools module which you can download using command:

wget http://users.aalto.fi/~asf/teaching/aalto_physics/_downloads/friction_tools.py

If you now have also friction_tools.py file in your simulation tools directory, you are ready to run simulations in that directory. If you would like to access the simulation tools from anywhere and run the actual simulations in a separate directory (not necessary, but a wise move in general), add the path to the simulation tools directory to your $PYTHONPATH environment variable. For instance, if you use zsh shell (default for Aalto workstations), include the command:

export PYTHONPATH=$HOME/path/to/tools:$PYTHONPATH

in the file ~/.zshenv to have this done automatically every time you login or open a new terminal (you need to write that command to your current terminal as well or close it and open a new one to set the environment variable right away).

To check that everything is correctly set up, launch the Python interpreter by writing python in the Terminal. There, import the tools with import friction_tools or, e.g., import friction_tools as ft to access them with the shorthand ft. You should see no errors when doing this. If you also set up the environment variable correctly, you should be able to import the tools in any directory. If you have written a Python script, you can execute it from the terminal with python script.py.

If you prefer graphical user interface for setting things up, you can download the simulation tools package here, linux_tools, and uncompress that to a directory of your choice. Then download the friction_tools.py file and move it to that directory.

If you wish to run the simulations on Aalto Mac workstations, download the Mac version of the tools, mac_tools, and unzip the contents to wherever you want. Then download the friction_tools.py file to that directory.

Note On the Aalto Mac workstations, the command python refers to Apple’s version of Python but the tools have been compiled targeting a separate Python installation from python.org, which is found at /usr/local/bin/python2.7. You may want to create an alias to this version, e.g., alias py="/usr/local/bin/python2.7" (you can put this in ~/.zshenv too). Then simply launch python with py script.py

Instructions for other Linux computers

The setup of the simulation environment is fairly easy on any Linux computer assuming that you have superuser access. First, use the package manager of your Linux distribution to install NumPy, SciPy and matplotlib (and Python, obviously, if it is not installed by default). You can also install ASE this way, if it is available in the repository. On Ubuntu, you can use command:

sudo apt-get install python-numpy python-scipy python-matplot python-ase

Alternatively, you can use a GUI frontend for the package manager, such as Ubuntu Software Center or Synaptic Package Manager. If ASE is not available in the repository of your Linux distribution, follow the instructions on the ASE website.

Now you are still missing Pysic, which is the most complicated part. Note that the Pysic library in the simulation tool packages is precompiled for the architectures found on Aalto workstations. If you wish to run the simulations on your own computer, you need C and Fortran compilers and compile Pysic from source. To install the compilers on Ubuntu, write:

sudo apt-get install gcc gfortran git

or use the GUI frontend (version control tool git is also needed in the next step). I suggest you make a folder sources in your home folder and change to that directory. Then run command:

git clone https://github.com/thynnine/pysic.git

to download the source code of Pysic to folder pysic. Change to that directory now and run:

make serial

If everything goes well, you do not see any errors and there should be a folder pysic inside build. Copy this folder to some directory where you want to set up the simulation tools. Then change to that directory and follow the instructions above starting from the point where friction_tools module is downloaded. Note that the default shell on Ubuntu is bash, and thus you should set the environment variable in file ~/.bashrc.