首页 > 解决方案 > 使用 mdtraj 计算二面角

问题描述

import numpy as np
import mdtraj as md
import matplotlib.pyplot as plt
import nglview as ngl

traj0 = md.iterload('xtc_file', chunk=1000, top='pdb_file')

def xyz_gen(traj):
    for chunk in traj:
        yield chunk.xyz

dihedrals = md.compute_dihedrals(traj0, indices)        

一切运行良好,但是当我尝试执行最后一步时,我得到:

AttributeError: 'generator' object has no attribute 'xyz'.

这是什么原因造成的?

标签: python

解决方案


推荐阅读