如何正确地将透视图添加到代表分子的Gnuplot 3D连接的点云中? [英] How to Correctly Add Perspective to a Gnuplot 3D connected Point Cloud Representing a Molecule?

查看:89
本文介绍了如何正确地将透视图添加到代表分子的Gnuplot 3D连接的点云中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不认识你们,但是我爱我一些Gnuplot.如果使用得当,该软件将产生精美的图像,其简洁性和清晰度令人着迷,我非常喜欢.

I don't know about you people but I love me some Gnuplot. Properly used, that software produces beautiful images, charming in their simplicity and clarity, that I am very fond of.

没有特别的原因,有一天,我陷入了沉思,我想如果我能创作出具有卡通般魅力和鲜明活力的图片,并将其纳入论文和个人科学期刊,那将会有多好.因此,我们首先进入了一个batshit项目,以对基于gnuplot的分子可视化工具进行编码.

For no particular reason, one day I caught myself thinking how good would it be if I could create pictures of such cartoonish charm and vibrant clarity to go into my papers and personal scientific journal. So went head first into a batshit project to code a gnuplot-based molecule visualizer.

到目前为止,它是为我特定类型的分子量身定制的.基本上形成配体的共价键原子,它们本身通过配位键与某些中心金属离子相互作用.我设法得出了一个很好的工作概念,如下图所示.

So far it is tailor made for my specific type of molecule. Basically covalently bonded atoms that form ligands, which themselves interact with some central metal ions via coordination bonds. I have managed to arrive at a pretty good working concept, pictured down below.

其中的虚线表示与with的金属离子的配位键,颜色为浅青色,实线是原子之间的共价键.红色是氧气,蓝色是氮气,白色是氢气,灰色是碳.到目前为止,一切都很好,看起来很扎实,非常符合我的需求.

In it, the dotted lines denote a coordination bond with a metallic ion of Europium, colored in light cyan, the solid lines are covalent bonds between atoms. Red is oxygen, blue is nitrogen, white is hydrogen and grey is carbon. So far so good, seems pretty solid and very much in line with what I wanted.

那我怎么做,我听到你在问吗?嗯,实际上这很简单.我一次绘制一个图.首先,我绘制虚线的连接方式,如下所示:

So how do I do it, I hear you asking? Well that is pretty simple, actually. I plot things one at a time. First I plot the connectivity pattern of the dotted lines, like so:

然后我画出共价键:

每个步骤都需要一个或多个单独的文件.每个配体的连通性存储在单独的"bondfile"文件中.虚线的连接性模式本身就位于文件中.具有其颜色的原子的位置放置在另一个文件中.每个配体一个,中央金属一个.

Each of the steps requires one or more separate files. The connectivity of each ligand is stored in a separate "bondfile" and the dotted conectivity pattern is in a file all of itself. The positions of the atoms with the color that they have is placed in yet another file. One for each ligand and one for the central metal.

然后,我为金属和每个配体的原子创建了一个单独的文件,其中我说它们是什么颜色.原子放置在黑点上的事实使点周围具有迷人的黑色布局,否则它们没有轮廓线.

Then I have a separate file for the atoms of the metal and of each ligand, where I say what color they are. The fact that the atoms are placed over the black dots is what gives the charming black layout around the points, otherwise they have no contour line.

当您要旋转复合物以获得更好的角度以保存到图片中时,就会出现问题.为了说明问题,我将在单个配体的图片中演示该问题.让我们拿联吡啶(一个带有氮的氮,其中有两个)

The issue arises when you want to rotate the complex to get a better angle to save into the picture. In ordert o illustrate the problem I am going to show it in action with the picture of a single ligand. Let's take the bipyridine (the one with the nitrogens, there are two of them)

所以我认为这是联吡啶的最佳角度:

So here is a bipyridine in what I think is its optimal angle:

现在假设我们沿着下图所示的轴转动联吡啶.

Now suppose we turn the bipyridine along the axis shown in the figure below.

现在问题出现了.因为实际上应该在后平面中的一些原子实际上在整个事物的前面,这表明gnuplot实际上没有透视图.或者,至少,它确实具有,但是我使用不正确.

Now the problem shows up. Because some atoms that should be in the behind plane are in fact in front of the entire thing, revealing that gnuplot actually don't have perspective. Or, at the very least, that it indeed have but I am using it incorrectly.

到目前为止,一切都很好.我没想到它会自动地具有视角,因为这并不是它最初的目的.但是,这意味着gnuplot"splot"不符合要求.进行了一些伪造的3D绘图,并且空间中点的实际相对位置关系不大.

So far so good. I didn't expect it to have perspective automagically since this is not what it was originally made for. However, that means that gnuplot "splot" does a somewhat fake 3D plotting and that the actual relative positions of the points in space matters little.

所以我的问题是,对于所有人gnuplot/有远见的专家:是否有办法巧妙地规避此限制?

So my question is, for all of you gnuplot/perspective savants out there:Is there a way to cleverly circumvent this limitation?

我对 any 方法感兴趣,但是只要它在gnuplot本身的限制内可行,就可以涉及到它.

I am interested in any method, however involved it may be as long as it is feasible within the limitations of gnuplot itself.

推荐答案

嘿.我是一个分子图形学的专家,自1970年代的研究生时代起就开始编写查看器和可视化工具.你知道吗?我真的不喜欢在分子图形学中使用透视图.如此之多,我将gnuplot中的缺失称为功能而不是限制.

Heh. I'm a molecular graphics wonk myself, having written viewers and visualization tools since grad student days in the 1970s. And you know what? I really dislike the use of perspective in molecular graphics. So much so that I'll call the absence in gnuplot a feature rather than a limitation.

gnuplot集合中有一个演示molecule.dem,显示了简单的分子图形.它在gnuplot(5.3)的开发版本中效果更好,在这里您可以对原子使用带有圆圈"而不是带有点"的绘图样式.在这里,您去了:

There is demo molecule.dem in the gnuplot collection showing simple molecular graphics. It works better in the development version of gnuplot (5.3), where you can use plotting style "with circles" rather than "with points" for the atoms. Here you go:

set title "GM1 pentasaccharide ball-and-stick representation"

set hidden3d
set border 0
unset tics
unset key
set title offset 0, screen -0.85
set view equal xyz
set view 348, 163, 1.64872, 1.14

set style fill transparent solid 0.9 border -1
atomcolor(name) = name[1:1] eq "O" ? 0xdd2222 : name [1:1] eq "N" ? 0x4444ff : 0x888888

splot 'GM1_sugar.pdb' using 6:7:8:(0.6):(atomcolor(strcol(3))) with circles fc rgb var, \
      'GM1_bonds.r3d' using 1:2:3:($5-$1):($6-$2):($7-$3) with vectors nohead lw 3 lc "black"

注意:

  • 直接从PDB文件读取原子位置
  • 原子名称产生原子着色(灰色代表碳,蓝色代表氮,等等)
  • 键是通过Raster3D分子图形软件包中的"bonds"实用程序从相同的PDB文件生成的.
  • 前面的原子对后面原子的遮挡是由"set hidden3d"处理的.
  • 键的封闭性不太令人满意,因为线段一直绘制到原子中心,而从视觉上看,终止于原子的投影球面会更好.
  • 通过使原子部分透明,进一步帮助了视觉上的深度印象.
  • The atom positions are read directly from a PDB file
  • Atom coloring is generated from the atom name (gray for carbon, blue for nitrogen, etc)
  • The bonds were generated from the same PDB file by the "bonds" utility in the Raster3D molecular graphics package
  • Occlusion of the atoms in back by the ones in front is handled by "set hidden3d"
  • Occlusion of the bonds is less satisfactory because the line segment is drawn all the way to the atom center whereas visually it would look better to terminate at the projected spherical surface of the atom.
  • Visual impression of depth is further helped by making the atoms partially transparent.

这篇关于如何正确地将透视图添加到代表分子的Gnuplot 3D连接的点云中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆