使用 Python3 从 PDB 文件得到 PDBQT 文件内容

您可以使用 OpenBabel 软件包中的命令行工具来将 PDB 文件转换为 PDBQT 文件。安装 OpenBabel 后,您可以使用以下命令将 PDB 文件转换为 PDBQT 文件:

babel input.pdb output.pdbqt -xr

其中,'input.pdb' 是您要转换的 PDB 文件的文件名,'output.pdbqt' 是转换后的 PDBQT 文件的文件名。'-xr' 参数指定使用 Gasteiger-Marsili 电荷来为分子中的原子分配荷电状态。

如果您使用的是 Linux 或 macOS 操作系统,也可以使用以下 Python 脚本来调用 OpenBabel 进行转换:

import subprocess

def pdb_to_pdbqt(input_file, output_file):
    command = ['babel', input_file, output_file, '-xr']
    subprocess.call(command)

其中,'input_file' 是您要转换的 PDB 文件的路径,'output_file' 是转换后的 PDBQT 文件的路径。该脚本将调用 OpenBabel 命令行工具并将其输出重定向到 'output_file' 中。

如何使用 Python 将 PDB 文件转换为 PDBQT 文件

原文地址: https://www.cveoy.top/t/topic/nxO0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录