本文整理汇总了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)
示例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()