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


Python Read.stoc方法代码示例

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


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

示例1: Read

# 需要导入模块: from MolKit import Read [as 别名]
# 或者: from MolKit.Read import stoc [as 别名]
        sys.exit()

    m = Read(filename)[0]
    if verbose: print 'read ', filename
    #validate specified ligand file
    assert hasattr(m, 'torTree'), "specified ligand does not have a torsion tree"
    ndihe = m.parser.keys.count('BRANCH')
    if verbose: print m.name, ' has ', ndihe, ' torsions'

    #1. prepare molecule 
    m.buildBondsByDistance()
    orig_coords = m.allAtoms.coords[:]
    m.allAtoms.addConformation(m.allAtoms.coords)
    coord_index = 1
    origin = m.getCenter()
    m.stoc = StateToCoords(m, origin, 1)
    #build reference dictionary of original bonds
    orig = len(m.allAtoms.bonds[0])
    orig_d = {}
    for a in m.allAtoms: orig_d[a]=set(a.bonds.getAtoms())

    #try a new random state up to ntries times
    # convert trans to space centered on m
    for new_try in range(ntries):
        #reset coords in working slot to original coords for new try
        m.allAtoms.updateCoords(orig_coords, ind=coord_index)
        TRANS = []
        for ind in range(3):
            #do not subtract origin here, i don't understand why not
            #TRANS.append((random.uniform(-1,1)*tscale)-origin[i])
            TRANS.append(random.uniform(-1,1)*tscale)
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:33,代码来源:write_random_state_ligand.py

示例2: StateToCoords

# 需要导入模块: from MolKit import Read [as 别名]
# 或者: from MolKit.Read import stoc [as 别名]
    lig.buildBondsByDistance()
    # add extra slot to ._coords for changing coordinates
    lig.allAtoms.addConformation(lig.allAtoms.coords)
    #?is this necessary
    lig.allAtoms.setConformation(1)
    ntors = lig.ndihe
    length_of_state = 7+lig.ndihe
    # @@ handle to the input ligLines
    ligLines = lig.parser.allLines

    #setup StateToCoords object
    origin = lig.getCenter()
    if use_zero_origin or interim_state:
        origin = [0.,0.,0.]    
    #note: index of _coords to use is always 1
    lig.stoc = StateToCoords(lig, origin, 1)
    outptr = sys.stdout
    if outputfile:
        outptr = open(outputfile, 'w')


    #if SINGLESTATE:
        # eg:
        #"State: 29.303 14.415 23.603 0.5609 0.4518 0.2662 -0.6406 -20.89 -0.65 81.86 -17.36 28.83 -10.80 -23.98 114.21"
        #states = state.split()
        #['State:', '29.303', '14.415', '23.603', '0.5609', '0.4518', '0.2662', '-0.6406', '-20.89', '-0.65', '81.86', '-17.36', '28.83', '-10.80', '-23.98', '114.21']

    if statefile:
        sptr = open(statefile)
        states = sptr.readlines()
        sptr.close()
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:33,代码来源:write_models_from_states.py


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