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


Python MBAR.computeEntropyAndEnthalpy方法代码示例

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


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

示例1: test_mbar_computeEntropyAndEnthalpy

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

    """Can MBAR calculate f_k, <u_k> and s_k ??"""

    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)
        f_ij, df_ij, u_ij, du_ij, s_ij, ds_ij = mbar.computeEntropyAndEnthalpy(u_kn)

        fa = test.analytical_free_energies()
        ua = test.analytical_observable('potential energy')
        sa = test.analytical_entropies()

        fa_ij = np.array(np.matrix(fa) - np.matrix(fa).transpose())
        ua_ij = np.array(np.matrix(ua) - np.matrix(ua).transpose())
        sa_ij = np.array(np.matrix(sa) - np.matrix(sa).transpose())

        z = convert_to_differences(f_ij,df_ij,fa)
        eq(z / z_scale_factor, np.zeros(np.shape(z)), decimal=0)
        z = convert_to_differences(u_ij,du_ij,ua)
        eq(z / z_scale_factor, np.zeros(np.shape(z)), decimal=0)
        z = convert_to_differences(s_ij,ds_ij,sa)
        eq(z / z_scale_factor, np.zeros(np.shape(z)), decimal=0)
开发者ID:jpthompson17,项目名称:pymbar,代码行数:27,代码来源:test_mbar.py

示例2: enumerate

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeEntropyAndEnthalpy [as 别名]
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))
if (numpy.max(numpy.abs(diffs1)) > 1.0e-10):
  print "Difference in values from computeFreeEnergies"
  print diffs1
diffs2 = dDelta_f_ij - dDelta_f_ij_estimated
print "maximum difference between uncertainties computed here and in computeFreeEnergies is %g" % (numpy.max(diffs2))
if (numpy.max(numpy.abs(diffs2)) > 1.0e-10):
  print "Difference in expectations from computeFreeEnergies"
  print diffs2

print "Energies"
开发者ID:CraftyVisage,项目名称:pymbar-examples,代码行数:32,代码来源:harmonic-oscillators.py

示例3: print

# 需要导入模块: from pymbar import MBAR [as 别名]
# 或者: from pymbar.MBAR import computeEntropyAndEnthalpy [as 别名]
  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)
Delta_f_ij = results['Delta_f']
dDelta_f_ij = results['dDelta_f']
Delta_u_ij = results['Delta_u']
dDelta_u_ij = results['dDelta_u']
Delta_s_ij = results['Delta_s']
dDelta_s_ij = results['dDelta_s']

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)))
if (numpy.max(numpy.abs(diffs1)) > 1.0e-10):
  print("Difference in values from computeFreeEnergies")
  print(diffs1)
开发者ID:choderalab,项目名称:pymbar,代码行数:33,代码来源:harmonic-oscillators.py


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