Saturday, April 26, 2008

Of Physics, computers and Linux

As any other occupation, computational physics has its tools. It's commonly said that doing theoretical physics research doesn't require a big budget, you just need a pen a lots of paper sheets! Well, you actually also need access to books, journals and --- in these times --- you do the messy algebra in a computer.

For me, it's been a lot of fun doing computational physics. In a way, it is a subare of theoretical physics. What you do amounts to solve physics problems by implementing numerical algorithms in the computer. The kind of problems that you solve involve very complicated equations for which no general analytic solution is known. These problems range from solving quantum mechanical equations for molecular structures to protein folding simulations to fluid dynamics, global climate, galaxy formation and many, many more.

My particular area of action is numerical relativity. We solve Einstein's general relativity equations to find out the behavior of the immensely strong gravitational fields produced in the collision of stellar objects such as black holes and neutron stars. General relativity predicts that in such collision events, huge amounts of energy are radiated away in the form of gravitational waves. Simulating such scenarios has proved to be an enormous challenge in computational physics.

So what are the tools that computational scientists around the world use in their cutting edge research? The answer is very simple. They use a few applications that come with any standard distribution of Linux. Yes, Linux user, in your laptop or desktop you have the same basic tools as any other computational scientist.

Based on my own experience in the numerical relativity field, I've compiled a list of the applications I use in my everyday research. They come with your favorite Linux distro [1] and if they don't, they available for free on the web. Let's start.

  • Linux terminal A little window where you type all sorts of commands. Some that I find myself typing all the time are:

  • ssh It allows you to connect the a remote computer and work (in a terminal) as if you were physically in front of it.

  • rsync The best way of copying large amounts of data between two computers. It encrypts the data and copies only what is different. Ideal for making periodic backups.

  • cvs, svn, darcs, git These are all versioning systems. If you develop your own code it keeps track of all the changes, making possible to go back to a previous version if you screw it up. It happens!

  • latex. The best way of preparing documents and presentations. You can write equations and tables without touching the mouse. It numerates chapters, sections, subsections, figures, tables, lists and equations automatically. If you have to insert a figure or table it corrects all the numbering sequence and also the references to them. It handles the bibliography in the same way and generates the index automatically too! What else could you possibly ask?

  • gnuplot Excellent for doing curve fitting, 2D and 3D plots. It's command-based and you can also make scripts with it, automatizing the generation of new graphs when you have new data. This substitutes the spread-sheet sort of graphs.

You also need some coding tools:

  • Text editor The most used are emacs and vi. Personally, I stick to emacs.

  • GNU compiler For your C, C++ or fortran code.

  • Parallel computing libraries OpenMP to make your code run in all the cores of your machine. MPI to make your code run in different computers at the same time. This is how high performance computing is done.

  • Perl or shell scripting To handle small repetitive tasks.

I think this covers most of it. Give or take depending on specific problems and specific people :) [2]

I could also include the chat application. It's very useful for asking small questions or some advice. You can always go to the chat logs if you forget a little detail.

Summarizing, any person with the inclination for science or engineering has all the needed tools to transform his/her computer from a fancy typewriter to a full fleshed computational work-station.

Needless to say, this is another nice trait of the Linux operative system.


[1] Some people also use Macs.
[2] Packages like Mathematica and Matlab are also very useful but they are not free.

Post a Comment