24小时热门版块排行榜    

查看: 2728  |  回复: 3
【有奖交流】积极回复本帖子,参与交流,就有机会分得作者 cnzs 的 7 个金币 ,回帖就立即获得 1 个金币,每人有 1 次机会
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

cnzs

铁虫 (初入文坛)


[交流] VASP数据使用ovito官网脚本分析voronio

1.能不能用ovito处理AIMD的XDATCAR文件?
2.如果可以为什么我用官网提供的Python脚本只能得出第一个离子步的数据?
3.有没有大佬可以帮忙改进一下Python脚本?
# Import OVITO modules.
from ovito.io import *
from ovito.modifiers import *
from ovito.pipeline import *

# Import NumPy module.
import numpy

# Load a simulation snapshot of a Cu-Zr metallic glass.
pipeline = import_file("D:/ovito/400/XDATCAR",multiple_frames = True)

# Set atomic radii (required for polydisperse Voronoi tessellation).
atom_types = pipeline.source.data.particles['Particle Type'].types
atom_types[0].radius = 1.28  #  atomic radius (atom type 1 in input file)
atom_types[1].radius = 1.55  #  atomic radius (atom type 2 in input file)


# Set up the Voronoi analysis modifier.
voro = VoronoiAnalysisModifier(
    compute_indices = True,
    use_radii = True,
    edge_threshold = 0.1
)
pipeline.modifiers.append(voro)

# Let OVITO compute the results.
data = pipeline.compute()

# Access computed Voronoi indices.
# This is an (N) x (M) array, where M is the maximum face order.
voro_indices = data.particles['Voronoi Index']

# 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)))


result:
(0, 0, 0, 2, 8, 4, 0, 0)           11        (5.5 %)
(0, 0, 0, 3, 6, 4, 0, 0)                7        (3.5 %)
(0, 0, 0, 0, 12, 0, 0, 0)        6        (3.0 %)
(0, 0, 0, 1, 10, 3, 0, 0)        5        (2.5 %)
(0, 0, 0, 2, 8, 1, 0, 0)                5        (2.5 %)
(0, 0, 0, 4, 6, 4, 0, 0)              5        (2.5 %)
(0, 0, 0, 2, 8, 5, 0, 0)          5        (2.5 %)
(0, 0, 0, 1, 10, 2, 0, 0)        5        (2.5 %)
(0, 0, 0, 2, 8, 0, 0, 0)         4        (2.0 %)
(0, 0, 0, 4, 4, 6, 0, 0)         3        (1.5 %)
回复此楼

» 猜你喜欢

» 抢金币啦!回帖就可以得到:

查看全部散金贴

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

小火柴123

新虫 (正式写手)


★
cnzs(金币+1): 谢谢参与
请问楼主解决了吗?
4楼2022-06-22 14:07:45
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 4 个回答
简单回复
2020-09-16 14:37   回复  
cnzs(金币+1): 谢谢参与
1 发自小木虫IOS客户端
提示: 如果您在30分钟内回复过其他散金贴,则可能无法领取此贴金币
普通表情 龙 兔 虎 猫 高级回复 (可上传附件)
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +4 mzU8LdVQMwOf 2026-11-26 4/200 2026-11-26 23:10 by J9NGDvAaPB9L
[考博] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +4 1VHV9UkX7sid 2026-11-26 7/350 2026-11-26 23:03 by 9TqLDMgchvGU
[博后之家] 售一区SCI文章T0P,我:8O.551.O54,科目全,可十急 +3 1VHV9UkX7sid 2026-11-26 4/200 2026-11-26 22:57 by N80hyqiqCeT2
[教师之家] 售SCI一区T0P文章,我:8.O.55.1.O.5.4,科目全,可+急 +3 1VHV9UkX7sid 2026-11-26 4/200 2026-11-26 22:56 by N80hyqiqCeT2
[博后之家] 售SCI一区T0P文章,我:8O.55.1.O.54,科目全,可伽急 +4 1VHV9UkX7sid 2026-11-26 6/300 2026-11-26 22:52 by N80hyqiqCeT2
[教师之家] 售SCI一区文章,我:8.O.55.1.O.54,科目齐全,可伽急 +4 1VHV9UkX7sid 2026-11-26 4/200 2026-11-26 22:48 by N80hyqiqCeT2
[论文投稿] 售SCI一区文章,我:8.O.551.O.5.4,科目全,可伽急 +4 1VHV9UkX7sid 2026-11-26 6/300 2026-11-26 22:46 by N80hyqiqCeT2
[公派出国] 售SCI一区T0P文章,我:8O.55.1.O.5.4,科目齐全,可+急 +5 1VHV9UkX7sid 2026-11-26 9/450 2026-11-26 22:45 by N80hyqiqCeT2
[考博] 售SCI文章,我:8O5.5.1.O.54,科目齐全,可+急 +3 1VHV9UkX7sid 2026-11-26 4/200 2026-11-26 22:41 by N80hyqiqCeT2
[基金申请] 售SCI一区T0P文章,我:8.O.55.1.O54,科目全,可伽急 +4 1VHV9UkX7sid 2026-11-26 10/500 2026-11-26 22:41 by N80hyqiqCeT2
[论文投稿] 售SCI一区文章,我:8O5.5.1.O5.4,科目全,可伽急 +3 1VHV9UkX7sid 2026-11-26 7/350 2026-11-26 22:37 by N80hyqiqCeT2
[硕博家园] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 1VHV9UkX7sid 2026-11-26 7/350 2026-11-26 22:35 by N80hyqiqCeT2
[找工作] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +4 1VHV9UkX7sid 2026-11-26 6/300 2026-11-26 21:39 by N80hyqiqCeT2
[找工作] 售SCI文章,我:8O.5.5.1O.54,科目全,可十急 +3 1VHV9UkX7sid 2026-11-26 3/150 2026-11-26 21:29 by N80hyqiqCeT2
[考博] 申博求助 10+3 charles.ww 2026-11-24 6/300 2026-11-26 21:27 by 13961805515
[考研] 售SCI-T0P文章,我:8O.5.5.1.O.54,科目齐全,可+急 +3 1VHV9UkX7sid 2026-11-26 3/150 2026-11-26 21:13 by N80hyqiqCeT2
[考博] ⚽求2027博士自荐 求材料/催化/绿色化学/环境 方向博导 +3 Hutao6 2026-11-23 5/250 2026-11-26 20:29 by greychen00
[考博] 27博士申请自荐-材料 +4 kipmo 2026-11-22 6/300 2026-11-26 20:17 by greychen00
[教师之家] 凡是私自破坏我们组规则的研究生,必须赶走 +6 苏东坡二世 2026-11-20 7/350 2026-11-26 17:42 by beefly
[硕博家园] 博士申请求助 +3 nico77 2026-11-21 3/150 2026-11-26 16:18 by 13961805515
信息提示
请填处理意见