Sassena is a program to get scattering functions for X-Rays and Neutrons from atomistic simulations. If you want to install Sassena, and catdcd to convert gromacs trajectories to dcd NAMD format (and many others), please go to the end of that page. A good idea before starting would be to read the paper describing Sassena  that must be cited if you use this software.


Working with Sassena

First of all you should translate yout gromacs like trajectory file (.trr) to NAMD like trajectory file (.dcd). To do that you might want to use catdcd, writing something like:

  • catdcd -o sample.dcd -trr sample.trr

Catdcd is much more powerfull than a translator: go to the web page to get all his power and listen to some music. It seems that Sassena is able to read directly trr and xtc files... but I didn't manahe to do it (for the moment). Now run Sassena:

Sassena will read the file scatter.xml (look at the test/waterdyn4 examples for the one you need, and rename it). Now just write

  • sassena

and, voilà, you will get a "signal.h5" file with lots of information inside, but how to access??? You can download hdf to have a look at the files, and even export them in a readable ascii data. However I prefer to rescue the ASCII data directly to plot everything in gnuplot. To do that:

  • Download and install netcdf
  • Download and install paste (it was installed in my computer somehow, sorry not to help. This entry was usefull)

So now we have what we need to proceed. First we will extract X (names as qvectors in signal.h5) and extract y (names as fq in signal.h5), and then we paste both files together

  • ncdump signal.h5 -v qvectors> qvectors.dat
  • ncdump signal.h5 -v fq > fq.dat
  • paste qvectors.dat fq.dat > data.dat

 Now we have data.dat with a terrible header and q anddata scattered in different columns... To plot data of correct columns missing the first lines write in gnuplot:

  • plot "data.dat" every ::24 u 1:4 w l

The command every will skeep the first 24 lines. You can also simply erase the first lines of the file using the commands:

  • cat dat.dat | tail -n +24 > data_noheader.dat

(Read this excellent cookbook for managing csv files with command line and understand this last way to remove lines from a file)


You can also use this bash file done by myself... so it might be wrong: use it carefully (knowing what you are doing).

Geting and installing Sassena

The webpage should be working, and it might be an excellent web page, but for the time I needed Sassena it was not working. For this reason I had to ask somebody to help with the installation. I write here his wise advices.

Download the code from github
Unzip the files and then you can install the following packages. If they are already installed no worries... So let the party start:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install build-essential
  • sudo apt-get install cmake
  • sudo apt-get install git
  • sudo apt-get install libfftw3-dev
  • sudo apt-get install openmpi-bin
  • sudo apt-get install liblapack-dev
  • sudo apt-get install gfortran
  • sudo apt-get install libxml2-dev
  • sudo apt-get install libboost-mpi-dev
  • sudo apt-get install libboost-all-dev
  • sudo apt-get install zlib1g-dev
  • sudo apt-get install libhdf5-serial-dev

Now "cd" into the directory where you have sassena (there are folders like "include", "src", ...), and then

  • mkdir compile
  • cd compile
  • cmake ..
  • make -j


Geting and installing catdcd (from trr to dcd)

You can download a binary file ready to use from here. And that's all, put it in the bin folder and good luck!


Many thanks to Sebastian Busch for helping me with this part