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


Python MBAR.computeMultipleExpectations方法代码示例

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


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

示例1: test_mbar_computeMultipleExpectations

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeMultipleExpectations [as 别名]
def test_mbar_computeMultipleExpectations():

    """Can MBAR calculate E(u_kn)??"""

    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')
        eq(N_k, N_k_output)
        mbar = MBAR(u_kn, N_k)
        A = np.zeros([2,len(x_n)])
        A[0,:] = x_n
        A[1,:] = x_n**2
        state = 1
        mu, sigma, covariances = mbar.computeMultipleExpectations(A,u_kn[state,:])
        mu0 = test.analytical_observable(observable = 'position')[state]
        mu1 = test.analytical_observable(observable = 'position^2')[state]
        z = (mu0 - mu[0]) / sigma[0]
        eq(z / z_scale_factor, 0*z, decimal=0)
        z = (mu1 - mu[1]) / sigma[1]
        eq(z / z_scale_factor, 0*z, decimal=0)
开发者ID:jpthompson17,项目名称:pymbar,代码行数:22,代码来源:test_mbar.py

示例2: enumerate

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeMultipleExpectations [as 别名]
  A_kn_all[observe] = A_kn
  A_k_estimated_all[observe] = A_k_estimated
  A_kl_estimated_all[observe] = A_kl_estimated

print "============================================="
print "      Testing computeMultipleExpectations"
print "============================================="

# have to exclude the potential and RMS displacemet for now, not functions of a single state
observables_single = ['position','position^2']  

A_ikn = numpy.zeros([len(observables_single), K, N_k.max()], numpy.float64)
for i,observe in enumerate(observables_single):
  A_ikn[i,:,:] = A_kn_all[observe]
for i in range(K):
  [A_i,dA_ij,Ca_ij] = mbar.computeMultipleExpectations(A_ikn, u_kln[:,i,:], compute_covariance=True)
  print "Averages for state %d" % (i)
  print A_i
  print "Uncertainties for state %d" % (i)
  print dA_ij
  print "Correlation matrix between observables for state %d" % (i)
  print Ca_ij

print "============================================"
print "      Testing computeEntropyAndEnthalpy"
print "============================================"

(Delta_f_ij, dDelta_f_ij, Delta_u_ij, dDelta_u_ij, Delta_s_ij, dDelta_s_ij) = mbar.computeEntropyAndEnthalpy(u_kn = u_kln, verbose = True)
print "Free energies"
print Delta_f_ij
print dDelta_f_ij
开发者ID:BioinformaticsArchive,项目名称:pymbar,代码行数:33,代码来源:harmonic-oscillators.py

示例3: enumerate

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeMultipleExpectations [as 别名]
  # save up the A_k for use in computeMultipleExpectations
  A_kn_all[observe] = A_kn
  A_k_estimated_all[observe] = A_k_estimated

print "============================================="
print "      Testing computeMultipleExpectations"
print "============================================="

# have to exclude the potential and RMS displacemet for now, not functions of a single state
observables_single = ['position','position^2']  

A_ikn = numpy.zeros([len(observables_single), K, N_k.max()], numpy.float64)
for i,observe in enumerate(observables_single):
  A_ikn[i,:,:] = A_kn_all[observe]
for i in range(K):
  [A_i,d2A_ij] = mbar.computeMultipleExpectations(A_ikn, u_kln[:,i,:])
  print "Averages for state %d" % (i)
  print A_i
  print "Correlation matrix between observables for state %d" % (i)
  print d2A_ij

print "============================================"
print "      Testing computeEntropyAndEnthalpy"
print "============================================"

(Delta_f_ij, dDelta_f_ij, Delta_u_ij, dDelta_u_ij, Delta_s_ij, dDelta_s_ij) = mbar.computeEntropyAndEnthalpy(verbose = True)
print "Free energies"
print Delta_f_ij
print dDelta_f_ij
diffs1 = Delta_f_ij - Delta_f_ij_estimated
print "maximum difference between values computed here and in computeFreeEnergies is %g" % (numpy.max(diffs1))
开发者ID:CraftyVisage,项目名称:pymbar-examples,代码行数:33,代码来源:harmonic-oscillators.py

示例4: print

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeMultipleExpectations [as 别名]
  A_kn_all[observe] = A_kn
  A_k_estimated_all[observe] = A_k_estimated
  A_kl_estimated_all[observe] = A_kl_estimated

print("=============================================")
print("      Testing computeMultipleExpectations")
print("=============================================")

# have to exclude the potential and RMS displacemet for now, not functions of a single state
observables_single = ['position','position^2']  

A_ikn = numpy.zeros([len(observables_single), K, N_k.max()], numpy.float64)
for i,observe in enumerate(observables_single):
  A_ikn[i,:,:] = A_kn_all[observe]
for i in range(K):
  results = mbar.computeMultipleExpectations(A_ikn, u_kln[:,i,:], compute_covariance=True)
  A_i = results['mu']
  dA_ij = results['sigma']
  Ca_ij = results['covariances']
  print("Averages for state %d" % (i))
  print(A_i)
  print("Uncertainties for state %d" % (i))
  print(dA_ij)
  print("Correlation matrix between observables for state %d" % (i))
  print(Ca_ij)

print("============================================")
print("      Testing computeEntropyAndEnthalpy")
print("============================================")

results = mbar.computeEntropyAndEnthalpy(u_kn = u_kln, verbose = True)
开发者ID:choderalab,项目名称:pymbar,代码行数:33,代码来源:harmonic-oscillators.py


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