3.4.7. 自定义分子显示(OLEX2使用手册)
原文如下:
Customising molecular display
Olex2 provides a number of tools to customise the graphical display for picture production. Some of the customisation is described above the Colour fragments uniformly section. All graphical objects in Olex2 belong to groups. The default atom groups are groups by element type, the next, more detailed group is by atom name and the final group, which Olex2 can create automatically also include the symmetry generating the atom, thus containing a single, unique atom. It is very similar with bonds. Currently existing groups and their usage can be listed using ‘lstgo’ command. Opening a different file or using ‘default’ command clears the groups’ customisation. Typical use of the groups by atom name is for packing – customisation to atoms or bonds done in the asymmetric unit will be also included into any packing of the molecules.
Any of the Olex2 graphical objects consists of ‘primitives’. These can be added or removed to the object thus changing its appearance. Primitives are a part of the group into which the atoms or bond belong and therefore undergo the same convention as the material group’s properties. There are a few commands which allow operating on groups, their primitives and primitive material:
Mask - changes the primitives available in the group. The command can be applied to a selection or a named group. For example ‘mask C-C 0’ will make C-C bonds invisible; ‘mask C-C 256’ will render C-C bonds a stippled cone. The numeric value is a bitmask for the primitives to enable.
GetMaterial – returns material properties of a named primitive. For example ‘echo GetMaterial(N.Sphere)
SetMaterial – sets material of a named primitive to the given material string value. For example it can be used to copy material of one primitive onto the other like “SetMaterial ‘destination primitive name’ ‘material string’” where ‘material string’ can be a call to GetMaterial
Individualise – creates a more specialised group
Collectivise – joins a specialised group with the parent group (reverts effects of the ‘individualise’). Note that if no argument provided (and the selection is clear) all previous group operations are undone an only default groups remain (same as ‘clear style’).
There are two dialogs available to control groups, their primitives and primitive material. The dialogs are accessible through the object context menu ‘Graphics->Draw style’ and ‘Graphics->Primitives’. The Bond and Atom primitives dialogs are shown in Figure 3. View of the bond primitives. and Figure 4. View of the atom primitives.


The ‘Material properties’ dialog is shown in Figure 5. View of the atom material properties dialog.

It is possible to group graphical objects (such as atoms or labels). Each of the grops can then be assigned different visual properties.
For example, you may want to change the label colour of some (but not all) labels in the picture. You can achieve this by selecting the labels you want to collect in a group call ‘red_labels’ and typing
>>name collection red_label
You can then Right-Click on one of the labels in this group and select ‘Draw Style’. Any graphic properties you set here will apply to all labels in this group.
Alternatively, you can get the same dialoge box by typing:
>>editmaterial red_label
When you ‘fuse’ the structure, or refine again, the label colour is lost. But the properties of the ‘red_label’ collection is remembered, so if you need to re-make an image, you just need to add the objects to the relevant collection again.
You can use this technique to make the label colour of Atom Labels different from the Bond Labels.
译文如下:
3.4.7. 自定义分子显示
Olex2为图像生成提供了一系列的工具用于自定义图形显示。前面“3.4.4. 对片段均匀着色”部分已经列举了部分。Olex2中的所有图形都属于组合。默认的原子组合按照原子类型分组,下一个更详细的组合按照原子名称分组,而Olex2可以自动创建的最后一个组合也包括生成原子的对称性,因此包含一个仅有的唯一的原子。这与键非常相似。可以使用“lstgo”指令列出当前存在的组合及其用法。打开不同的的文件或使用“default”指令可以清除组合自定义设置。按原子名称分组的典型用法是堆积——在不对称单元中完成的对于原子或键的自定义设置也将应用于堆积出来的任意分子。
任何Olex2图形对称均包含“primitives(基元)”。这些可以添加到对象中或从对象中删除从而更改其外观。Primitives(基元)是原子或键所属的组合的一部分,因此与组合的材料属性具有相同的协议。以下为数个允许对组合的基元和基元材质进行操作的指令:
Mask:更改组合中可用的基元。该指令可应用于选定或指定的组合。例如,“mask C-C 0”将使得C-C键不可见;“mask C-C 256”将使C-C键呈点状圆柱体。数值为要启用的基元的位掩码。
GetMaterial:返回指定基元的材质属性。例如“echo GetMaterial(N.Sphere)”。
SetMaterial:将指定基元的材质设置为给定的材质字符串值。例如,它可以用于将一个基元的材质复制到另一个基元上,如“SetMaterial 'destination primitive name' 'material string'”,其中“material string”可以是对GetMaterial的调用。
Individualise:创建一个更特殊的组合
Collectivise:使特殊组合成为母体组合(还原“individualise”的效果)。请注意,若未提供任何参数(且选择已清除),则所有之前的组合操作都将撤销,只保留默认组合(同“clear style”)。
有两个对话框可用于控制组合的基元和基元材质。对话框可以通过对象右键菜单“Graphics > Draw style”和“Graphics > Primitives”访问。




也可以对图形对象进行组合操作(就像原子或键)。然后可以为每个组合分配不同的视觉属性。
例如,你可能想要更改图片中的某些(不是所有)标签的颜色。你可以通过以下操作实现此功能,选择你想要分入名为“red_label”组合的标签并键入:
>>name collection red_label
然后你可以在该组合中的其中一个标签上单击鼠标右键并选择“Draw style”。此处进行的任何图形属性设置将应用于所有属于该组合的标签。
或者,获取相同对话框你可以键入:
>>editmaterial red_label
当你使用“fuse”指令回到不对称单元或者再次精修,则上述操作设置的颜色将消失。但“red_label”集合的属性已经记录下来,所以如果你想重新绘制一张图片,你只需要再次将对象添加到相关集合即可。
你可以使用此技术将原子标签和键标签设置为不同的颜色。
辅助视频如下:
3.4.7-自定义分子显示
https://www.bilibili.com/video/BV1uy4y1e7E8
公众号文章链接:
https://mp.weixin.qq.com/s?__biz=MzU0NjkzMTM1MQ==&mid=2247485336&idx=5&sn=f60fd2dc5ca5ad5bb1c488480c105b92&chksm=fb575060cc20d9764f7c11fdfd13bcdb56c21ae84196a003d212faa429c119befcc3087959e5&token=1126004319&lang=zh_CN#rd
