本文整理汇总了Python中pymbar.MBAR.computeOverlap方法的典型用法代码示例。如果您正苦于以下问题:Python MBAR.computeOverlap方法的具体用法?Python MBAR.computeOverlap怎么用?Python MBAR.computeOverlap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymbar.MBAR
的用法示例。
在下文中一共展示了MBAR.computeOverlap方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mbar_computeOverlap
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeOverlap [as 别名]
def test_mbar_computeOverlap():
# tests with identical states, which gives analytical results.
d = len(N_k)
even_O_k = 2.0*np.ones(d)
even_K_k = 0.5*np.ones(d)
even_N_k = 100*np.ones(d)
name, test = generate_ho(O_k = even_O_k, K_k = even_K_k)
x_n, u_kn, N_k_output, s_n = test.sample(even_N_k, mode='u_kn')
mbar = MBAR(u_kn, even_N_k)
overlap_scalar, eigenval, O = mbar.computeOverlap()
reference_matrix = np.matrix((1.0/d)*np.ones([d,d]))
reference_eigenvalues = np.zeros(d)
reference_eigenvalues[0] = 1.0
reference_scalar = np.float64(1.0)
eq(O, reference_matrix, decimal=precision)
eq(eigenval, reference_eigenvalues, decimal=precision)
eq(overlap_scalar, reference_scalar, decimal=precision)
# test of more straightforward examples
for system_generator in system_generators:
name, test = system_generator()
x_n, u_kn, N_k_output, s_n = test.sample(N_k, mode='u_kn')
mbar = MBAR(u_kn, N_k)
overlap_scalar, eigenval, O = mbar.computeOverlap()
# rows of matrix should sum to one
sumrows = np.array(np.sum(O,axis=1))
eq(sumrows, np.ones(np.shape(sumrows)), decimal=precision)
eq(eigenval[0], np.float64(1.0), decimal=precision)
示例2: range
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeOverlap [as 别名]
print "Analytical estimator of %s is" % (observe)
print A_k_analytical[observe][nth]
print "MBAR estimator of the %s is" % (observe)
print A_k_estimated
print "MBAR estimators differ by X standard deviations"
stdevs = numpy.abs(A_k_error/dA_k_estimated)
print stdevs
print "============================================"
print " Testing computeOverlap "
print "============================================"
O, O_i, O_ij = mbar.computeOverlap()
print "Overlap matrix output"
print O_ij
for k in range(K):
print "Sum of row %d is %f (should be 1)," % (k,numpy.sum(O_ij[k,:])),
if (numpy.abs(numpy.sum(O_ij[k,:])-1)<1.0e-10):
print "looks like it is."
else:
print "but it's not."
print "Overlap eigenvalue output"
print O_i
示例3: range
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeOverlap [as 别名]
print "Analytical estimator of %s is" % (observe)
print A_k_analytical[observe][nth]
print "MBAR estimator of the %s is" % (observe)
print A_k_estimated
print "MBAR estimators differ by X standard deviations"
stdevs = numpy.abs(A_k_error/dA_k_estimated)
print stdevs
print "============================================"
print " Testing computeOverlap "
print "============================================"
O_ij = mbar.computeOverlap(output='matrix')
print "Overlap matrix output"
print O_ij
for k in range(K):
print "Sum of row %d is %f (should be 1)," % (k,numpy.sum(O_ij[k,:])),
if (numpy.abs(numpy.sum(O_ij[k,:])-1)<1.0e-10):
print "looks like it is."
else:
print "but it's not."
O_i = mbar.computeOverlap(output='eigenvalues')
print "Overlap eigenvalue output"
print O_i
O = mbar.computeOverlap(output='scalar')
print "Overlap scalar output"
示例4: print
# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeOverlap [as 别名]
print("Analytical estimator of %s is" % (observe))
print(A_k_analytical[observe][nth])
print("MBAR estimator of the %s is" % (observe))
print(A_k_estimated)
print("MBAR estimators differ by X standard deviations")
stdevs = numpy.abs(A_k_error/dA_k_estimated)
print(stdevs)
print("============================================")
print(" Testing computeOverlap ")
print("============================================")
results = mbar.computeOverlap()
O = results['scalar']
O_i = results['eigenvalues']
O_ij = results['matrix']
print("Overlap matrix output")
print(O_ij)
for k in range(K):
print("Sum of row %d is %f (should be 1)," % (k,numpy.sum(O_ij[k,:])), end=' ')
if (numpy.abs(numpy.sum(O_ij[k,:])-1)<1.0e-10):
print("looks like it is.")
else:
print("but it's not.")
print("Overlap eigenvalue output")