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...

How would COVID bahave in August - few projections

Entering August with COVID by side   Entering in the month of August, COVID is still here by our side. Situation seems grim, worse than earlier, as number of active cases as well as the count of deceased patients are increasing day by day. Yesterday we crossed the mark of 50,000 cases in a day. Closely competing with Brazil with US counts also in range now. On the other side, few other numbers like reduced mortality rate to 2.18%, recovery rate of 64.6% and slightly increased doubling rate of 21 days can reduce the anxiety. My projections of 16.75 lakhs for India might be crossed by coupe of thousands of more cases after today’s count is added. This number would reach to a huge count of 28.5 lakhs by August 15. Maharashtra just doesn’t like competition. Just like what Delhi tried few days back, Andhra Pradesh also managed to cross Maharashtra’s per day count for2 consecutive days. Seems like not a good idea. Maharashtra immediately went to the next zone. The state which w...

Rigorous method to create lib file

Sometimes you totally fail to go ahead with the prepin and frcmod files you have generated from the newly generated PDB file even after you follow the procedure given in previous two posts. And you keep wondering? In such a case you need a more detailed procedure. First take a look at the pdb file. For example: Here is one such pdb file generated from the gabedit that troubled me for some time. --------------- HEADER    PROTEIN COMPND    UNNAMED AUTHOR    GENERATED BY GABEDIT 2.3.8 at Tue Jul 26 16:53:48 2011 ATOM  1      C   C     1       -2.907  -0.997  -0.385  1.00  300.00          C 0.0000   ATOM  2      N   N     1       -2.060  -0.981  -1.189  1.00  300.00 ...