本文整理汇总了Python中Sire.System.collectStats方法的典型用法代码示例。如果您正苦于以下问题:Python System.collectStats方法的具体用法?Python System.collectStats怎么用?Python System.collectStats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sire.System
的用法示例。
在下文中一共展示了System.collectStats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: System
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import collectStats [as 别名]
system = System()
rdf = RDFMonitor( 0*angstrom, 10*angstrom, 0.05*angstrom )
rdf.add( MolIdx(0) + AtomName("O00"), AtomName("O00") )
rdf2 = RDFMonitor( 0*angstrom, 10*angstrom, 0.05*angstrom )
rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H01") )
rdf2.add( MolIdx(0) + AtomName("O00"), AtomName("H02") )
system.add(cljff)
system.add("O-O RDF", rdf)
system.add("O-H RDF", rdf2)
t.start()
system.collectStats()
ms = t.elapsed()
print("Collecting stats took %d ms" % ms)
rdf = system.monitor( MonitorName("O-O RDF") )
print("\nO-O RDF")
for i in range(0,rdf.nBins()):
print(rdf[i].middle().to(angstrom), rdf[i].value())
rdf = system.monitor( MonitorName("O-H RDF") )
print("\nO-H RDF")
示例2: _pvt_calculateEnergy
# 需要导入模块: from Sire import System [as 别名]
# 或者: from Sire.System import collectStats [as 别名]
def _pvt_calculateEnergy(lamval, verbose):
cljff01 = InterGroupCLJFF("cljff01")
cljff02 = InterGroupCLJFF("cljff02")
cljff01.add( water0, MGIdx(0) )
cljff01.add( water1, MGIdx(1) )
cljff02.add( water0, MGIdx(0) )
cljff02.add( water2, MGIdx(1) )
soft_cljff01 = InterGroupSoftCLJFF("soft_cljff01")
soft_cljff02 = InterGroupSoftCLJFF("soft_cljff02")
soft_cljff01.add( water0, MGIdx(0) )
soft_cljff01.add( water1, MGIdx(1) )
soft_cljff02.add( water0, MGIdx(0) )
soft_cljff02.add( water2, MGIdx(1) )
ref = MoleculeGroup("ref", water0)
group_a = MoleculeGroup("group_a", water1)
group_b = MoleculeGroup("group_b", water2)
dlam = 0.001
lamval_f = lamval + dlam
lam = Symbol("lambda")
lam_f = Symbol("lambda_f")
soft_nrg = (1-lam) * soft_cljff01.components().total(0) + lam * soft_cljff02.components().total(0)
soft_nrg_f = (1-lam_f) * soft_cljff01.components().total(1) + lam_f * soft_cljff02.components().total(1)
de_soft = soft_nrg_f - soft_nrg
nrg = ((1-lam) * cljff01.components().total()) + (lam * cljff02.components().total())
nrg_f = ((1-lam_f) * cljff01.components().total()) + (lam_f * cljff02.components().total())
de = nrg_f - nrg
soft_cljff01.setProperty("alpha0", VariantProperty(lamval))
soft_cljff02.setProperty("alpha0", VariantProperty(1-lamval))
soft_cljff01.setProperty("alpha1", VariantProperty(lamval_f))
soft_cljff02.setProperty("alpha1", VariantProperty(1-lamval_f))
soft_cljff01.setProperty("coulombPower", VariantProperty(0))
soft_cljff01.setProperty("shiftDelta", VariantProperty(1.1))
soft_cljff02.setProperty("coulombPower", VariantProperty(0))
soft_cljff02.setProperty("shiftDelta", VariantProperty(1.1))
sys = System()
sys.add(cljff01)
sys.add(cljff02)
sys.add(soft_cljff01)
sys.add(soft_cljff02)
sys.add(ref)
sys.add(group_a)
sys.add(group_b)
sys.setComponent(lam, lamval)
sys.setComponent(lam_f, lamval_f)
sys.setComponent(sys.totalComponent(), nrg)
sys.setComponent(Symbol("E_{total_f}"), nrg_f)
sys.setComponent(Symbol("dE"), de)
sys.setComponent(Symbol("E_soft_{total}"), soft_nrg)
sys.setComponent(Symbol("E_soft_{total_f}"), soft_nrg_f)
sys.setComponent(Symbol("dE_soft"), de_soft)
nrgmon = FreeEnergyMonitor(ref, group_a, group_b)
soft_nrgmon = FreeEnergyMonitor(ref, group_a, group_b)
soft_nrgmon.setCoulombPower(0)
soft_nrgmon.setShiftDelta(1.1)
sys.add( "nrgmon", nrgmon )
sys.add( "soft_nrgmon", soft_nrgmon)
sys.collectStats()
nrgmon = sys[ MonitorName("nrgmon") ]
dg = nrgmon.freeEnergies()[0].average()
soft_nrgmon = sys[ MonitorName("soft_nrgmon") ]
soft_dg = soft_nrgmon.freeEnergies()[0].average()
sys_dg = sys.energy(Symbol("dE")).value()
sys_soft_dg = sys.energy(Symbol("dE_soft")).value()
if verbose:
print("%s : %s versus %s (should be equal)" % (lamval,dg,sys_dg))
print("%s : %s versus %s (should be equal)" % (lamval,soft_dg,sys_soft_dg))
assert_almost_equal(dg, sys_dg, 5)
assert_almost_equal(soft_dg, sys_soft_dg, 5)