XiaO

PyMOL 的安装、球棍模型设置与图片输出

XiaO / 2020-05-13


安装 PyMol

使用 Homebrew 安装 PyMol 2.5

brew install pymol

在终端启动 PyMol

pymol

为 PyMol 添加图形启动界面

* Step 1: Open the `Automator` app. Create a new document and select "Application";
* Step 2: Left under "Actions Library" select "Utilities" and "Run Shell Script";
* Step 3: Choose "/bin/bash" as a shell;
* Step 4: Paste the following: `/usr/local/bin/pymol -M`. Change the path to pymol (`which pymol`) if necessary;
* Step 5: Save the application ("File > Save") to the Desktop and name it "pymol".

更加方便的是,直接创建 右键快捷动作 打开分子

PyMol 设置球棍模型

set stick_ball, off # 关闭其自带的球棍模型
set ray_opaque_background, off # 设置透明背景
show sticks # 显示球棍模型的棍
show spheres # 显示球棍模型的球

set stick_radius,0.15 # 设置棍的半径
set sphere_scale,0.2 # 设置球的缩放比例

set valence, on # 显示双键
set valence_mode, 0 # 双键显示模式,0 中心;1 内部
set valence_size, 0.1 # 双键的距离 default: 0.06 range 0 - ~0.5 

最终统一设置如下

set stick_ball, off
set ray_opaque_background, off
show sticks
show spheres
set stick_radius,0.15 
set sphere_scale,0.2 
set valence, on
set valence_mode, 0 
set valence_size, 0.1 

PyMol 所有的设置都可以在 Setting —> Edit All… 中找到并进行编辑。

高分辨率图片输出

png filename[, width[, height[, dpi[, ray[, quiet]]]]]

例如,保存图片为 test.png~/Library/Mobile Documents/com~apple~CloudDocs/Science/DSDS/Molecular 3D Structures/ 文件夹,设置宽度为 10 in,分辨率为 600 dpi

png ~/Library/Mobile Documents/com~apple~CloudDocs/Science/DSDS/Molecular 3D Structures/test.png, width=10 in, dpi=600, ray=1

ray 576,576   # 8inch * 72 dpi;
ray 800,800   # 8inch * 100 dpi;
ray 2400,2400 # 8inch * 300 dpi;

Mac 下,用 Pymol 创建质量或者几何中心:

图片中 label 的设置

set label_font, 8
set label_shadow_mode, 0
set label_size, 20

set label_color, color-name, selection
set label_color, black

制作动画:

mset 1, 180
util.mroll 1, 180, 1
set ray_trace_frames, 1
set cache_frames, 0