本文整理匯總了Python中MMTK.Trajectory.Trajectory.variables方法的典型用法代碼示例。如果您正苦於以下問題:Python Trajectory.variables方法的具體用法?Python Trajectory.variables怎麽用?Python Trajectory.variables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MMTK.Trajectory.Trajectory
的用法示例。
在下文中一共展示了Trajectory.variables方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: sqrt
# 需要導入模塊: from MMTK.Trajectory import Trajectory [as 別名]
# 或者: from MMTK.Trajectory.Trajectory import variables [as 別名]
x2 += a2.beadPositions()[bead][x] * a2.mass()
y2 += a2.beadPositions()[bead][y] * a2.mass()
z2 += a2.beadPositions()[bead][z] * a2.mass()
return sqrt(((x1/m1) - (x2/m2))**2 + ((y1/m1) - (y2/m2))**2 + ((z1/m1) - (z2/m2))**2)
####################################################################################################################################################################
print '.....Performing Analysis........................................................'
#Read in trajectory from file
trajectory = Trajectory(None, dir + '//' + dir + '_prod.nc')
#Output the variables stored in the trajectory
print 'The available variables in the trajectory are:', trajectory.variables()
universe = trajectory.universe
natoms = universe.numberOfAtoms()
P = universe[0].atomList()[0].numberOfPoints()
print 'There are', natoms, 'atoms and', P, 'beads per atom present in the trajectory'
#Output files to write centre of masses to.
com_out = open(dir + '//' + dir + '_centroid_com_distance.txt','w')
bead_com_out = open(dir + '//' + dir + '_bead_com_distance.txt','w')
for step in trajectory:
#set the configuration to each new step
universe.setConfiguration(step['configuration'])
for object1 in universe.objectList():
for object2 in universe.objectList():