本文整理汇总了Python中FUNC.norm方法的典型用法代码示例。如果您正苦于以下问题:Python FUNC.norm方法的具体用法?Python FUNC.norm怎么用?Python FUNC.norm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FUNC
的用法示例。
在下文中一共展示了FUNC.norm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: pdbBoxString
# 需要导入模块: import FUNC [as 别名]
# 或者: from FUNC import norm [as 别名]
def pdbBoxString(box):
# Box vectors
u, v, w = box[0:3], box[3:6], box[6:9]
# Box vector lengths
nu, nv, nw = [math.sqrt(FUNC.norm2(i)) for i in (u, v, w)]
# Box vector angles
alpha = nv*nw == 0 and 90 or math.acos(FUNC.cos_angle(v, w))/d2r
beta = nu*nw == 0 and 90 or math.acos(FUNC.cos_angle(u, w))/d2r
gamma = nu*nv == 0 and 90 or math.acos(FUNC.cos_angle(u, v))/d2r
return pdbBoxLine % (10*FUNC.norm(u), 10*FUNC.norm(v), 10*FUNC.norm(w), alpha, beta, gamma)
示例2: add_dummy
# 需要导入模块: import FUNC [as 别名]
# 或者: from FUNC import norm [as 别名]
def add_dummy(beads, dist=0.11, n=2):
# Generate a random vector in a sphere of -1 to +1, to add to the bead position
v = [random.random()*2.-1, random.random()*2.-1, random.random()*2.-1]
# Calculated the length of the vector and divide by the final distance of the dummy bead
norm_v = FUNC.norm(v)/dist
# Resize the vector
vn = [i/norm_v for i in v]
# m sets the direction of the added vector, currently only works when adding one or two beads.
m = 1
for j in range(n):
newName = 'SCD'
newBead = (newName, tuple([i+(m*j) for i, j in zip(beads[-1][1], vn)]), beads[-1][2])
beads.append(newBead)
m *= -2
return beads