当前位置: 首页>>代码示例>>Python>>正文


Python Molecule.morphes方法代码示例

本文整理汇总了Python中molecule.Molecule.morphes方法的典型用法代码示例。如果您正苦于以下问题:Python Molecule.morphes方法的具体用法?Python Molecule.morphes怎么用?Python Molecule.morphes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在molecule.Molecule的用法示例。


在下文中一共展示了Molecule.morphes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: read_new_mtp_entry

# 需要导入模块: from molecule import Molecule [as 别名]
# 或者: from molecule.Molecule import morphes [as 别名]
def read_new_mtp_entry( entry, filename = 'mutres.mtp'):

    if not hasattr(filename,"read"):
        lst = open(filename).readlines()
    else:
        lst = filename.readlines()
        
    lst = kickOutComments(lst,';')
    key = '[ '+entry+' ]'
    keyw = ('[ morphes ]', '[ atoms ]','[ impropers ]','[ dihedrals ]',\
            '[ rotations ]','[ coords ]')
    res = []
    for i, line in enumerate(lst):
        if line.startswith(key):
            for line2 in lst[i+1:]:
                if line2.startswith('[') and \
                   line2 not in keyw:
                    break
                else:
                    res.append(line2)

    morphes = {}
    ml = readSection(res,'[ morphes ]','[')
    for i, line in enumerate(ml):
        entr = line.split()
        n0 = entr[0]
        t0 = entr[1]
        n1 = entr[3]
        t1 = entr[4]
        morphes[n0] = {
            't0':t0,
            'n1':n1,
            't1':t1,
            }
    atoms = [] 
    al = readSection(res,'[ atoms ]','[')
    for i, line in enumerate(al):
        entr = line.split()
        name = entr[0]
        atomtype = entr[1]
        q = float(entr[2])
        cgnr = int(entr[3])
        m = float(entr[4])
        atomtypeB = entr[5]
        qB = float(entr[6])
        mB = float(entr[7])
        a = Atom(name = name,id=i+1,\
                 atomtype=atomtype, q = q,\
                 m=m,cgnr=cgnr,atomtypeB=atomtypeB,\
                 qB = qB, mB = mB)
        atoms.append(a)
    mol = Molecule(atoms = atoms, unity = 'nm')
    mol.set_resname(entry)

    coords = readSection(res,'[ coords ]','[')
    coords = parseList('fff',coords)
    for i, atom in enumerate(mol.atoms):
        atom.x = coords[i]
        atom.unity = 'A'
    il = readSection(res,'[ impropers ]','[')
    imps = []
    for line in il:
        imps.append(line.split())
    diheds = []
    dl = readSection(res,'[ dihedrals ]','[')
    for line in dl:
        diheds.append(line.split())
    rl = readSection(res,'[ rotations ]','[')
    rots = []
    for line in rl:
        rots.append(line.split())
    rotdic = {}
    for rot in rots:
        key = rot[0]
        rotdic[key] = rot[1:]

    mol.morphes = morphes
    bonds = []
    return mol, bonds, imps, diheds, rotdic
开发者ID:esguerra,项目名称:pmx,代码行数:81,代码来源:mutdb.py


注:本文中的molecule.Molecule.morphes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。