用mdtraj计算二面角

2024-05-15 02:20:03 发布

您现在位置:Python中文网/ 问答频道 /正文

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'.

这是什么原因造成的


Tags: importnumpymatplotlibasnppltmdfile

热门问题