Controlling the number of points calculated by gmx saxs

GROMACS version: 2022
GROMACS modification: No

Greetings! I have a quick question about the analysis tool gmx saxs.

I’ve generated an equilibrated MD trajectory for a system which I also actually possess. I decided to calculate SAXS for it and compare that to my real scattering data. I notice that the tool controls which q-values to start and stop at, but I can’t see anything in the documentation about controlling the step or rather the number of points between start and stop in order to get control over the SAXS resolution. Does this tool only do a fixed number of points, or is there another option for controlling how highly resolved to make the SAXS output? I can certainly focus in on regions of q-space I care about, but since a quick search of the forum turned up no answers to this question, I thought I would ask.

Thanks!
Greg Smith
Department of Physics, University of Colorado

Hi Greg,

I can not tell you much about the gmx saxs module. As I did my SAXS calculations based on MD simulations I used the SWAXS tool from Chen and Hub (Theoretical Biophysics - Jochen Hub). It is a modified GROMACS version and you have full control over all the parameters (including the SAXS resolution). Maybe you want to give it a try!

Cheers,
Marius

Hi Marius,

Thanks! I will try this.

Greg

Just thought I would follow-up on this topic briefly.

I tried hard to use this gromacs-swaxs tool, but found it to be somewhat confounding. I’m not a genius with operating programs and unless the tutorials are pretty well spelled out, I don’t learn them very easily. For the tutorials available for gromacs-swaxs, several steps were mired by breakage in the program and I was never able to get it to function for even a 1D saxs/waxs calculation.

However, one of my advisors was able to provide me with access to a code written by one of my old labmates that can calculate 3D structure factors from a gromacs .gro structure and a .trr trajectory. This python code produced a 2D saxs pattern that can be easily circularly averaged to 1D and generates a 3D structure factor that you can take cuts through however you wish (if you can use numpy in python). Except for one file (radii.txt) that needs to be updated to reflect force-field atom types in order for the program to operate properly, it was really very straightforward and fast to use. Since it turned out to be a useful shortcut for me and since it’s on github, I will link it here so that other people who run up against this challenge can know about it.

The code is at:
MD-structure-factor

Greg

Dear @ggsmith123

Hi,

I faced a similar problem. I would like to calculate the structure factor for a polymer system. As I read your text I decided to use your suggested python code. I installed it successfully. But, could you please tell me a brief procedure for providing input files and how to run it? Actually, I don’t know, exactly, how to run. Do I have to copy main_gromacs.py into my Gromacs test directory? I have to run it on Linux where my original Gromacs files exist.

Thanks a lot
MJ

Aside of the above suggestions, you could also use our lab code “trjSAXS” to compute the SAXS profile of your protein. It is very simple to use and need only xtc and pdb files.

It needs

  • trajectory of your complete system (protein/water and ions) in a xtc format
  • a trajectory of the water box and the ions (w/o the protein)
  • a PDB of your system.

HTH

1 Like

Hi MJ,

When I set up for it, I ran it in Linux. Most of the instructions at github were pretty accurate; I set up a python 3.6.8 environment for it using venv and then added the dependencies as listed on github…

pip install --upgrade pip                                                   
pip install cython                                                          
pip install vtk                                                             
pip install pandas                                                          
pip install -r requirements.txt

To run it properly after that, as mentioned, I altered the ‘radii.txt’ file with the force field atom type names for the field I was using. ‘radii.txt’ sets Bohr radii for each of the atom types and the script throws a python dictionary key error if the names aren’t set properly.

Then in order to run the script, you need a .trr trajectory and .gro geometry of your system, both having the same name (eg. your_name.trr and your_name.gro) . All of this will be done in the directory where the script is located since the script just looks in its own directory for the files and then deposits its output back in the same directory. To run the script, I just ran it as a script with a single flag:

./main_gromacs.py -i your_name

At that point, it executed, produced two compressed numpy arrays and then made a bunch of thumb-nail plots. All of these files end up in the home directory of the script, so you have to move them later. I haven’t had a chance to dig around in the numpy array containing the structure factor myself yet because the thumbnail plot was enough for the precision I wanted at that moment, but it can be further manipulated.

It was pretty easy. That’s all I needed to do. Hope this helps!

Greg

Thank you very much Stephane.

Dear Greg

I installed it correctly and I used it. Thanks again. But, I have one question. I would like to obtain the structural factor of just polymer backbone (not a mix of polymer and water). How can I select just polymer? and how to choose begin and end frame?

Thanks a lot
MJ

Hi MJ,

I haven’t tried to do anything quite like that. I really don’t need to separate the water from the solute in my system (my actual SAXS contains both). At the very least, if you have the right .trr and .gro, this script will just stupidly analyze it.

Gromacs has a bunch of analysis capabilities that might help getting to that .trr and .gro. I know that you can define start and stop frames in gmx trjconv and that you can index using an input .ndx file to specify subgroups in your simulation. You might try doing some processing there before you go to calculate the structure factor.

I hope that helps!
Greg

Dear Greg

Thanks again for your help. I tried Gromacs SAXS tools but the plot was not like as I expected.

Thanks a lot,

MJ