| 查看: 4935 | 回复: 12 | ||
| 当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖 | ||
gtssongchi木虫 (小有名气)
|
[求助]
ovito中打开python脚本错误已有3人参与
|
|
|
大家好,用ovito计算voronoi多面体时,按照手册采用的python脚本计算。手册上脚本如下 # Import OVITO modules. from ovito.io import * from ovito.modifiers import * # Import NumPy module. import numpy # Load a simulation snapshot of a Cu-Zr metallic glass. node = import_file("../data/CuZr_metallic_glass.dump.gz" ![]() # Set atomic radii (required for polydisperse Voronoi tessellation). atypes = node.source.particle_properties.particle_type.type_list atypes[0].radius = 1.35 # Cu atomic radius (atom type 1 in input file) atypes[1].radius = 1.55 # Zr atomic radius (atom type 2 in input file) # Set up the Voronoi analysis modifier. voro = VoronoiAnalysisModifier( compute_indices = True, use_radii = True, edge_count = 6, # Length after which Voronoi index vectors are truncated edge_threshold = 0.1 ) node.modifiers.append(voro) # Let OVITO compute the results. node.compute() # Make sure we did not lose information due to truncated Voronoi index vectors. if voro.max_face_order > voro.edge_count: print("Warning: Maximum face order in Voronoi tessellation is {0}, " "but computed Voronoi indices are truncated after {1} entries. " "You should consider increasing the 'edge_count' parameter to {0}." .format(voro.max_face_order, voro.edge_count)) # Note that it would be possible to automatically increase the 'edge_count' # parameter to 'max_face_order' here and recompute the Voronoi tessellation: # voro.edge_count = voro.max_face_order # node.compute() # Access computed Voronoi indices as NumPy array. # This is an (N)x(edge_count) array. voro_indices = node.output.particle_properties['Voronoi Index'].array # This helper function takes a two-dimensional array and computes a frequency # histogram of the data rows using some NumPy magic. # It returns two arrays (of equal length): # 1. The list of unique data rows from the input array # 2. The number of occurences of each unique row # Both arrays are sorted in descending order such that the most frequent rows # are listed first. def row_histogram(a): ca = numpy.ascontiguousarray(a).view([('', a.dtype)] * a.shape[1]) unique, indices, inverse = numpy.unique(ca, return_index=True, return_inverse=True) counts = numpy.bincount(inverse) sort_indices = numpy.argsort(counts)[::-1] return (a[indices[sort_indices]], counts[sort_indices]) # Compute frequency histogram. unique_indices, counts = row_histogram(voro_indices) # Print the ten most frequent histogram entries. for i in range(10): print("%s\t%i\t(%.1f %%)" % (tuple(unique_indices), counts, 100.0*float(counts)/len(voro_indices))) 我只是将其中的文件路径改变了。在运行时却提示如下错误: Traceback (most recent call last): File "/home/csong/ovito.py", line 2, in <module> from ovito.io import * ImportError: No module named 'ovito.io'; 'ovito' is not a package ERROR: Failed to initialize Python interpreter. 请问这是什么原因呢? |
» 猜你喜欢
请问哪里可以有青B申请的本子可以借鉴一下。
已经有4人回复
真诚求助:手里的省社科项目结项要求主持人一篇中文核心,有什么渠道能发核心吗
已经有6人回复
孩子确诊有中度注意力缺陷
已经有14人回复
三甲基碘化亚砜的氧化反应
已经有4人回复
请问下大家为什么这个铃木偶联几乎不反应呢
已经有5人回复
请问有评职称,把科研教学业绩算分排序的高校吗
已经有5人回复
2025冷门绝学什么时候出结果
已经有3人回复
天津工业大学郑柳春团队欢迎化学化工、高分子化学或有机合成方向的博士生和硕士生加入
已经有4人回复
康复大学泰山学者周祺惠团队招收博士研究生
已经有6人回复
AI论文写作工具:是科研加速器还是学术作弊器?
已经有3人回复
6楼2019-05-10 10:13:19
abinitio
版主 (著名写手)
- 模拟EPI: 2
- 应助: 221 (大学生)
- 贵宾: 0.093
- 金币: 7365.2
- 散金: 3917
- 红花: 57
- 帖子: 1317
- 在线: 485.2小时
- 虫号: 368545
- 注册: 2007-05-11
- 性别: GG
- 专业: 凝聚态物性I:结构、力学和
- 管辖: 分子模拟
2楼2017-11-15 15:58:03
gtssongchi
木虫 (小有名气)
- 应助: 3 (幼儿园)
- 金币: 4373.1
- 散金: 136
- 红花: 2
- 帖子: 157
- 在线: 99.5小时
- 虫号: 1137504
- 注册: 2010-11-02
- 性别: GG
- 专业: 凝聚态物性 II :电子结构
3楼2017-11-15 19:16:03

4楼2018-07-05 19:37:49














回复此楼