本文整理汇总了Python中MDAnalysis.Universe.make_state_mask方法的典型用法代码示例。如果您正苦于以下问题:Python Universe.make_state_mask方法的具体用法?Python Universe.make_state_mask怎么用?Python Universe.make_state_mask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDAnalysis.Universe
的用法示例。
在下文中一共展示了Universe.make_state_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from MDAnalysis import Universe [as 别名]
# 或者: from MDAnalysis.Universe import make_state_mask [as 别名]
#.........这里部分代码省略.........
if(self.plot_output is None):
plt.ion()
#set-up plots for 16/9 screen
plot_w = ceil(sqrt(len(self.tar_forces)) * 4 / 3.)
plot_h = ceil(plot_w * 9. / 16.)
for i in range(len(self.tar_forces)):
self.tar_forces[i].plot(plt.subplot(plot_w, plot_h, i+1))
if(self.plot_output is None):
plt.show()
plt.ioff()
def _plot_forces(self):
for f in self.tar_forces:
f.update_plot()
plt.draw()
def _save_plot(self):
plt.tight_layout()
#don't fail on saving the plot
try:
plt.savefig(self.plot_output)
except IOError:
print 'failed to save plot'
return
def add_and_type_states(self, force, state_function, state_names):
if(type(self.u) != CGUniverse):
raise ValueError("Must use CGUniverse for states")
masks = self.u.make_state_mask(state_function, len(state_names))
for i in range(len(state_names)):
for j in range(i,len(state_names)):
f = force.clone_force()
f.specialize_states(masks[i],
masks[j],
state_names[i],
state_names[j])
self.add_tar_force(f)
def add_and_type_pair(self, force):
types = []
for a in self.u.atoms:
if(not a.type in types):
types.append(a.type)
for i in range(len(types)):
for j in range(i,len(types)):
if(force.category.pair_exists(self.u, 'type %s' % types[i], 'type %s' % types[j])):
f = force.clone_force()
f.specialize_types(types[i], types[j])
self.add_tar_force(f)
def _sample_ts(self):
self.u.trajectory.rewind()
index = random.randint(0,len(self.u.trajectory) - 1)
[self.u.trajectory.next() for x in range(index)]
return index
def _setup(self):