Visualisation




Really nice presentation, especially for working with big peptides - http://www.deshawresearch.com/DesmondMDUserGroup/Desmond%202%202%20Tutorial%20Workshop.pdf - the exact file is not available any longer.

Molekel

I have tested the Molekel (http://molekel.cscs.ch/wiki/pmwiki.php/ReferenceGuide/Introduction).
Advantages: for the first sight I could not found some noticeable advantages comparing to programs that we use already. But the program gallery gallery promises a lot...at least for surface representations.
Disadvantages:
  • transparent solid surface has non-transparent part(grid data surface for water molecule);
  • working with two different molecules is really complicated (there is no option like "reset view");
  • requires a lot processor time (in my case it was ~80% of a processor time; this value weakly depends on the number of displaying atoms or surfaces);
  • representation of proteins is not flexible (3AG1.pdb);



Compare VMD and Maestro


Property
VMD
Maestro
comments
visualization
+
+
both support a number of file formats and convert one format to another
Building a molecule
-
+
VMD supports a reparing of a molecule
Scripting
+ (TCL/python)
+ (MCL/Python)
both: scripting with Python requires knowleges of build-in language. There is a log of executed commands in maestro
PDB loading
+
+

Analysis tools
+
+

Trajectory analysis
+/-
+/-
There are some tools for trajectory analysis in both programs, but one needs to check up their workability and in the case of Maestro they are not the tools we use.
Representation stacking
+
+/-
Representations stacking, material's set, fine representation settings are presented in VMD much better. Nevertheless Maestro is much easy in atom selection.
*.pdb trajectories
+
-
By default
working with one frame from a trajectory
-
+
VMD downloads the whole trajectory at once. Advantage: VMD is much faster than Maestro in trajectory analysis. Disadvantage: VMD can not work with trajectory file(s) larger than the operative memory available.
Working with GROMACS trajectory files
+
-

Working with Desmond trajectory files
+
+



SMILES representation


http://en.wikipedia.org/wiki/Simplified_molecular_input_line_entry_specification

At the page you can find an examples of SMILES representation and a lot of useful links


Gallery


Anastasia

Vitamine B12. Learning activity (VMD)
Vitamine B12. Learning activity (Maestro)

Volodya

B12 VMD

Kathleen

Branched Alkanes. Learning activity.(VMD)


VMD and Maestro picture resolution


First of all I would like to make clear what is "resolution". Resolution is a number of pixels (colored dots) PER INCH.

Now the problem itself. We want to save a nice molecular picture with some predefined resolution.
1) We use VMD for visualization.
By default VMD saves pictures with resolution 72 dpi. If it is not enough:
-- File --> Render --> Render using - Tachyon. Generated file is text file *.dat. It has line: Resolution XXX YYY. Attention! This resolution is jast a size of the picture, not a real resolution. We should multiply both numbers with the same multiplication factor and rewrite them.
    • / /opt/local/vmd-1.8.7beta5/lib/vmd/tachyon_LINUXAMD64 *.dat -res XXX*m YYY*m -format TARGA -o *.tga
Now we have a big picture with small resolution. Next step: see at 3) Common steps.

NB: the alternative way
One may also just write in the rendering window (File --> Render --> Render using - Tachyon -> rendering command):
add -res XXX YYY, where XXX,YYY are the size of the image

To change resolution it is not obligatory to use InfanView.
Resolution could be changed in gimp: Image->Scale image)

2) We use Maestro for visualization. The default resolution for pictures in Maestro is 92dpi. The "resolution" it requires while saving the workspace view is the final picture size. We can have the picture as big as we want in one touch.
Next step: see 3) Common steps.

3)
See also 1), the last two lines

Common steps.
Despite the fact that output picture format of VMD and Maestro are different, the final steps to reach small picture with high resolution are the same for both programs.
--Open the picture with InfanView.
(-- press "i" key - you will see the picture informations, including resolution (the resolution information is not all the time shows up for *.tga pictures))
--Image --> Resize/rescale. DPI - required resolution, Size - required size. One can get best results if the final size of the image does not exceed the initial size of the image in pixels.

Remark: it seems, that one can also use a gimp to rescale the image:
menu: image->scale imange

Note: Using VMD be prepared to see another colour depths and material transparency at the final pictures.


Draw molecule in Matlab


To draw a molecule one may use the script plot_mol2.
To generate appropriate input from the pdb file one may use pdb2xyzAtomname and prepare_plot_mol_input.
For more information read the comments in the scripts



Example:
Let we have a file A1_nab.pdb.

By typing the following we may plot the molecule:

% convert pdb 2 coordinates data and atomname data
!./pdb2xyzAtomname A1_nab.pdb A1.coors A1.atomname

% prepare input for the plot_mol2:
[XYZ,Sigma,Color]=prepare_plot_mol_input('A1.coors','A1.atomname',1);

% draw the molecule
shl=plot_mol2(XYZ,Sigma,Color,10)

%add lightinh
camlight left
camlight right


Plot volume 3D data in Matlab


Frolov version (3D-RISM distribution)


With the following scripts one can plot a 3D distribution function around a molecule.

You need: *.pdb file, a *.dx file, a *.dat file. dx - 3D correlation function from NAB 3D RISM. Use: dx2dat.py to convert the *.dx file into *.dat file. pdb - the output of NAB !!!

The molecule is represented by VdW representation. The atom types are taken from the PDB file. Note: atom name must contain element name and digits only (e.g C11 is a carbon, Cl2 is a chlorine, CC1 is not a carbon). The colors and size of atoms are assigned automatically.

The 3D distribution is represented as a number of || slices which are transparent. Now the colorscheme is: 0 - black, 1 - blue, 2 - white. The scale is over [0 - 2]. If you put more then 2, then the solvation shells will be not so distinguishable.

NOTE!!! To plot a 3D distribution it is better to recalculate the 3D RISM with smaller box size (buffer) = 6 - 8 Angstroem.

Please, READ THE COMMENTS INSIDE THE FILES:

, ,, , , , ,


Diclof_5.png
Figure. Example distribution.
The following data files were used:
,

= Alternative version



protein3.png
Variant 1
protein5.png
Variant 2


Mentioned below representation is similar to Frolov's, but it uses different transparency to show the density.
The script to plot 3D distribution is *transpSlice*
it takes 3D distibution, grid and color map and plot the 3D data.
Auxilarly functions are:
prepareToSlice - convert column data to 3D distribution
waterCMap - create colormap




To draw the molecule inside the distribution one may use plot_mol2 function.
To prepare input for this function one can use prepare_plot_mol_input function.
This function take XYZ and atomnames and assign colors and radii.
There is antother pyhon script - pdb2xyzAtomname, which converts pdb to separate XYZ and atomname files, which then can be used by the prepare_plot_mol_input



Also, there is a useful script which plots the colormap:




EXAMPLE:

download the protein 3D data (zipped, g_A_O.zip) and grid data (x.dat y.dat z.dat)
See above how to create one-column 3D data from the amber output (previous section)


start commands in matlab:

% unzip 3D data
!unzip g_A_O.zip

% Download grid data

gridX=load('x.dat');
gridY=load('y.dat');
gridZ=load('z.dat');

% load 3D data in one-column format
g_o = load('g_A_O.txt');

%convert data to the 3D format
[g3D_o,GX,GY,GZ,X,Y,Z]=prepareToSlice(g_o,gridX,gridY,gridZ,{'z','y','x'});

%convert pdb to the XYZ and Atomname
!./pdb2xyzAtomname A1_nab.pdb A1.xyz A1.atomname

%prepare data for the plot_mol2 function
[XYZ,Sigma,Color]=prepare_plot_mol_input('A1.xyz','A1.atomname',1,AtomData);

%create water cmap and amap
[cmap,amap]=waterCmap;

%chnage amap (for better representation)
amap=[(0:0.01:0.2)' ;ones(100,1)*0.2 ];


% --------------------------


% %% VARIANT 1: (SLOW)
figure
h=transpSlice(GX,GY,GZ,g3D_o,cmap,amap,1,5,1,1,1)
campos([80 80 110])

hold on
% draw the molecule
shl=plot_mol2(XYZ,Sigma,Color,10)
set(h,'FaceLighting','none')

%save results to file
print -dtiff -r300 variant1.tiff

% -----------------------------------

% %% VARIANT 2: (FASTER)
h =transpSlice(GX,GY,GZ,g3D_o,cmap,amap,0.9,7,1,1,30)
campos([80 40 80])

hold on
% draw the molecule
shl=plot_mol2(XYZ,Sigma,Color,10)
set(h,'FaceLighting','none')

%save results to file
print -dtiff -r300 variant2.tiff



% draw the colormap:
figure, h=drawLegend(cmap,amap,0.9,7,0.2,100,0,7);


Sergiievskyi version: another volumetric data


If you have a 3D distribution in the one-column format, you may also use the functions prepareToSlice and fullSlice2 (see below).
The function prepareToSlice takes the distribution in one column format and convert it to the matlab-slice understandable format.
The grids in x,y,z directions should be uniform, but not necessarily - monotonically increasing.
Data in the vector may stored in different formats (which is determined by the fastest-changing, middle changing and the slowest changing dimension)
fullSlice2 uses slice function to draw the distribution.

Below there are files prepareToSlice, fullSlice2 ,

Example:

You may download the diclofenac distribution in the one-column z-y-x format here :
Dimensions of this file are: Nx=72, Ny=Nz=60.
Grid step in all directions dRx=dRy=dRz = 0.3

To plot this distribution use such commands:

g=load('g_diclofenac.txt');
[g3D,GX,GY,GZ,X,Y,Z]=prepareToSlice(g,(1:72)*0.3,(1:60)*0.3,(1:60)*0.3,{'z','y','x'});
fullSlice2(g3D,X,Y,Z,GX,GY,GZ,5);


Visualize the most probable position of binding molecules


binding3_text_small.png
Most probable positions of binded molecules. With blue color are shown regions, where local water density is 3.5 times larger that the bulk density


To visualize positions of the most probable binding molecules one may use algorithm, proposed in the paper:

Imai,Oda,Kovalenko,Hirata,Kidera, JACS. 2009, 131, 12430–12440

The data which you need:
Pdb file, generated by the 3DRISM.
dx files with 3D density distributions, generated by 3DRISM.
And coordinates of the solvent molecule.

We will demonstrate how to build binding molecules on example.
Let we have a protein A1_nab.pdb


Let we have dx-outputs from the 3DRISM g_A.O.1.dx.zip, g_A.H1.1.dx.zip


We will do everything in MATLAB

Step 1
Uncompress the 3D distributions

!unzip g_A.O.1.dx.zip
!unzip g_A.H1.1.dx.zip


Step 2
Convert dx files to the one-column format.You can use the dx2dat.py:

!./dx2dat.py g_A.O.1.dx > g_A_O.txt
!./dx2dat.py g_A.H1.1.dx > g_A_H.txt

% additionally the files x.dat, y.dat z.dat will be generated, where the grid points are stored

Step 3
Load files to matlab:

gridX=load('x.dat');
gridY=load('y.dat');
gridZ=load('z.dat');

g_o = load('g_A_O.txt');
g_h = load('g_A_H.txt');

Step 4
Convert one-column data to the 3D matlab array.
You will need script prepareToSlice

[g3D_o,GX,GY,GZ,X,Y,Z]=prepareToSlice(g_o,gridX,gridY,gridZ,{'z','y','x'});
[g3D_h,GX,GY,GZ,X,Y,Z]=prepareToSlice(g_h,gridX,gridY,gridZ,{'z','y','x'});

Step 5
Clear unnecessary arrays (to prevent memory overflow)

clear g_o
clear g_h

Step 6
Create cell array with site distributions. There are 3 sites (O, H1,H2)

g3D = cell(3,1);

g3D{1} = g3D_o; % O
g3D{2} = g3D_h; % H1
g3D{3} = g3D_h; % H2

Step 7
Clear unnecessary arrays (to prevent memory overflow)

clear g3D_o
clear g3D_h

Step 8
Load coordinates of the water molecule. You will need a file water.XYZ:

XYZ = load('water.XYZ');

Step 9
Calculate the most probable orientations of the molecule and the probabilities of this orientations:
You will need to use the script getBestRotations
which uses auxiliary scripts: ,

NB: script will work a long time

dR = GX(2)-GX(1);
dAng = pi/12;
[Gmax,PsiMax,ThetaMax,PhiMax] = getBestRotations(g3D,XYZ,dR,dAng);


Step 10 (optional)
Save the best rotations to files

Gmax0 = Gmax(:);
PsiMax0 = PsiMax(:);
ThetaMax0 = ThetaMax(:);
PhiMax0 = PhiMax(:);

save Gmax.txt Gmax0 -ASCII -double
save PsiMax.txt PsiMax0 -ASCII -double
save PhiMax.txt PhiMax0 -ASCII -double
save ThetaMax.txt ThetaMax0 -ASCII -double

clear Gmax0
clear PsiMax0
clear ThetaMax0
clear PhiMax0

Step 11
Save the molecule positions to file. You will need the script createBindingMoleculesXYZ:


MinDist=2; % minimal distance between the molecules
tres=25; % treshold: the minimal product of site-RDF which will be shown

createBindingMoleculesXYZ(GX,GY,GZ,Gmax,PsiMax,ThetaMax,PhiMax,tres,load('water.XYZ'),{'O','H','H'},'binding.xyz',MinDist)


Step 12
Save the maximal distribution to the *.dx file
You will need the script G3DtoDX

G3DtoDX(GX,GY,GZ,Gmax,'Gmax.dx');

Vizualize the protein using vmd
You will need the script reder to prepare the vmd input:
After the running vmd it will load the files A1_nab.pdb, Gmax.dx and binding.xyz.
You will need to change represenations...


%prepare vmd input
!./render > render.vmd

%run vmd
!./vmd render.vmd





Plots in Matlab


The following functions are aimed to plot regular plots in Matlab with "human-friendly" layout (big letters, different linestyles,etc.). The are very simple:

Usage example (in Matlab):
    • CF_3(x1,y1,x2,y2,x3,y3);

Then, you probably will want to change the axes labels, axes limits, legend etc. Can use f.e.:
    • CF_3(x1,y1,x2,y2,x3,y3);xlim([0.2 1]); ylim([-3 3]); xlabel([r [nm]]); ylabel('u_{LJ}(r) [kJ/mol]'); legend('Na-Na','I-I','Na-I'); title('Geometric Mixing Rules');

Put the following files into a directory, a set the Matlab path to the directory:
    • path(path,'/WHATEVER/AT/WHATEVER')

, , ,,

u_LJ_jorgensen2005_OPLS.png
Figure. Example plot.

Hope it is useful.



Xmgrace on supercomputers

General info

Xmgrace is a program for scientific visualization. It is used by default in Gromacs f.e. This tool is very convenient to use from a command line.

Example usage:
    • xmgrace -nxy rdf_10_i_i_bulk* -legend load

This will plot the data from all the files rdf_10_i_i_bulk*.

Scripting xmgrace

  • One also may type the xmgrace commands in a file and then run it:
    • xmgrace -nosafe -legend load -batch xmgrace.batch

The example batch file:

The picture is displayed on the screen and saved in a file.

  • Example of the data manipulation in xmgrace. The following script creates an additional plot based on the data of the provided arrays
    • xmgrace -nosafe -batch benchmark.xmgr

,
benchmark.png
Figure. Example xmgrace plot. Parallel scalability of Gromacs 4.5.1 on Juropa. ~ 25000 particles. (27 NaI ion pairs in 1600 NMP).


VMD must know

  1. PBC (periodic boundary conditions)
Visualization of the box frame:
  • package require pbctools
  • pbc box


  1. Calculate center of geometry of a selection "name C"

set s1 [ atomselect top "name C" ]
set sx [eval "vecadd [$s1 get x]"] ; set xcom [expr $sx / [ $s1 num ]]
set sy [eval "vecadd [$s1 get y]"] ; set ycom [expr $sy / [ $s1 num ]]
set sz [eval "vecadd [$s1 get z]"] ; set zcom [expr $sz / [ $s1 num ]]

Nice plots in ocave: eplot (octave-epstk)


There is a package octave-epstk, which provides the possibility to plot nice plots in octave.
The package is available in ubuntu repositories.
Also, you may visit the developers web-page:

http://www.epstk.de/

You may find examples in files edemo1.m ... edemo9.m, distibuted with the package\
The only disadvantage I found:
The size of the page does not change (even if you change appropriate parameters).
This might be a problem for inserting the picture into the tex.
Thus, I provide the simple script to correct the page size in the output eps file:



Please, find the example of using the eplot (epstk library) below:





RDFs_o.png