Skip to main content

Gnuplot to plot histogram

GNUPLOT can be used to generate histograms.
The script below allows one to plot variations in angle from 0° to 180°.
Each histogram box width correspond to 3° (covered here under bw option).
To execute this script; type this in the terminal:


gnuplot histogram.p

You should be in the folder where below script is saved in a file name "histogram.p" and a dat file (here, it is N---H-O.dat) should be present.

histogram.p
------------------
set term gif
set output "angle_N---H-O.gif"
set xrange [0.0:180.0]
set boxwidth 2.0 absolute
set style fill solid 1.0 border -1
set xtics 10
set title "molecule 3.0A Angle N---H-O"
set ylabel "occurance"
set xlabel "angle"
bw = 3   # substitute what you want
bin(x,width)=width*floor(x/width)
plot 'N---H-O.dat' using (bin($2,bw)):(1.0) smooth freq with boxes

------------------

The dat file is an input file with data in the format:
0    23.680344
1    73.766251
2    67.482254
3    52.086418
4    72.886803
5    54.009365
6    36.297497
7    35.184067
8    162.915512
9    52.081470
10    49.975559
11    46.514202
12    45.990093 ..............

Two columns where the second column refers to bond angles. First column here gives molecular dynamics steps.

On execution a gif file (here,angle_N---H-O.gif) will be created which looks something like this:


Comments

Popular posts from this blog

Material Studio - selective molecule movement

So, working with Material Studio is awesome. You get to handle bigger, complicated and even unimaginable system. But I am facing problems in very minute functioning. I recently faced two problems, but managed to resolve on my own. Somehow, tutorials doesn't help in resolving them and you end up doing some exercise on your own to get the solution. Among these, the problem of bringing two molecular structures in one window and then adjusting one molecule by moving it around, while other structure remains untouched, as it is. Actually, this should not be a problem to do. There is a simple way of doing this. Select the molecule to be moved and then there is a symbol (button) to select, which allows you to selectively move that molecule only. This is the same way it can be done in Material studio too.  But among all the dozens of symbols, the new person handling MS, kind of gets lost. So, what he does is check the tutorials, for any help. But the tutorials don't talk about suc...

xleap and ionic systems

An extension of earlier problem in generation of prmtop and inpcrd files follows here. After a long time I had to use xleap to generate parameter and coordinate files for a system comprising of an organic molecule, protonated methanol and Cl atom. Now, organic molecule is not an issue. antechamber tutorial clearly explains how to do that. So, any organic molecule like MEOH is also not a problem. But MEOH2 could be. I have written about how to deal with systems like MEOH2 or extra protonated oxygen systems. But if you want to bring an organic molecule, protonated methanol(MEOH2) and Cl atom together and create parameter and coordinate file for that, it may not be as easy as it appear. Since I had lost touch with xleap for sometime, I totally forgot the small tricks I found to work in xleap. I started working with: * the separate pdb files for each molecular unit. * then create a single pdb file using packmol for the whole system. * create prepin or mol2 file corresponding to combined p...

Generating a structure PDB file using Gabedit

If Gabedit is installed and functioning on your system, type gabedit  in terminal. Gabedit will open and you can find an option "Geometry" in the tool bar. Select "Geometry"--> "Draw" After some trials and playing you will finally learn how to generate a structure. Once your structure is ready, you need to set the atom types and charges. For this click on "M" button in the top left of the "Draw Geometry" window and select options as: M-->"Set"--> "Atom Type & charge using PDB template" Here if you use "Atom Types using connection types", it helps. You can check if the atom type and charge has been set according to the amber requirements by an indirect method. Try to run a quick MM calculation. Run MM calculations by clicking: "M"-->Molecular Mechanics-->optimization It may sometimes end up with a pop up window that suggests that either atom type or charge is not...