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".
更加方便的是,直接创建 右键快捷动作
打开分子
-
步骤 1:打开
Automator
软件,⌘ + N
新建文件,选择Quick Action
; -
步骤 2:左侧动作库中选择
Run Shell Script
,拖拽到右侧工作流中; -
步骤 3:设置动作:
- 接收来自文件夹的数据,并作为 shell 的传入数据;
- Shell 中填入:
/usr/local/bin/pymol "$@"
-
步骤 4:保存为 pymol;
-
使用:右键点击需要打开的分子文件,选择
服务
,选择pymol
; -
快捷动作在系统里的存储位置为
~/Library/Services/
。 -
PyMol 中文版入门教程
-
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 创建质量或者几何中心:
-
下载 Center of Mass 脚本;
-
把
center_of_mass.py
脚本拖拽到pymol
安装文件夹下的Lib
子文件夹中:- For Mac users,in your
Applicaiton
folder,findMacPyMOL.app
; - Show Content;
- Put the
center_of_mass.py
file under the following path:
/pymol/modules/pymol/center_of_mass.py
; - For Mac users,in your
-
Input
import center_of_mass
and return; -
select the relevant atoms, and input
com sele,state=1
; -
Change the color, name of the object.
图片中 label 的设置:
- 设置 label 字体大小:set label_size, n (n 为任一数字)
- 设置 label 字体:set label_font, n (n 为任一数字)
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