【调剂】北京石油化工学院2024年16个专业接受调剂
查看: 1429  |  回复: 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的回帖
简单回复
2020-09-16 14:37   回复  
cnzs(金币+1): 谢谢参与
1 发自小木虫IOS客户端
psylhh3楼
2020-09-17 17:32   回复  
cnzs(金币+1): 谢谢参与
相关版块跳转 我要订阅楼主 cnzs 的主题更新
提示: 如果您在30分钟内回复过其他散金贴,则可能无法领取此贴金币
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[论文投稿] Chemical Engineering Journal投稿3周了,一直显示With editor状态。这是送审了吗? 10+4 yifeng11 2024-04-20 10/500 2024-04-25 02:14 by yifeng11
[教师之家] 召集青年编委 +3 bergersci 2024-04-22 6/300 2024-04-24 23:44 by 麦克阿??
[论文投稿] Nature一直在编辑手里,考虑好几天了,是悬了吗 +7 彩虹初见 2024-04-24 7/350 2024-04-24 22:31 by 陈晨2016
[考研] 博士生招生!! +5 2458827884 2024-04-19 5/250 2024-04-24 22:28 by 不懂的风清
[基金申请] 两类问题算是白选了~ +6 jurkat.1640 2024-04-23 10/500 2024-04-24 21:18 by lucky_my2010
[论文投稿] 研二光催化6月底四篇二区什么水平 5+4 wjtab 2024-04-22 10/500 2024-04-24 19:37 by luckyeheng
[硕博家园] 聊天 +9 暮色恋伊人 2024-04-22 10/500 2024-04-24 19:34 by liubai000
[考博] 取博导收留 5+3 zzb777888 2024-04-20 7/350 2024-04-24 19:02 by zxl_1105
[考博] 求博导 +4 好okjh 2024-04-21 5/250 2024-04-24 18:18 by zxl_1105
[硕博家园] 中科院力学所招聘联合培养硕士研究生1-2名 +3 1880778986 2024-04-18 5/250 2024-04-24 15:24 by Totorop
[教师之家] 期末给学生划重点都是什么话术啊 +15 luokereng 2024-04-20 17/850 2024-04-24 13:15 by zxdno1
[教师之家] 大家访学都是怎么找的啊? +3 luokereng 2024-04-22 3/150 2024-04-24 11:40 by xuechenli
[教师之家] 找工作过程中碰到好多人问南京某新换校长211的政策,规定如下 +15 ZHONGWU_U 2024-04-21 17/850 2024-04-24 05:12 by juta256
[公派出国] 東京大学 应用化学专业柳田研究室 招收修士/博士生 +5 蝶梦123 2024-04-19 5/250 2024-04-23 22:40 by 90472jvvh
[教师之家] 河海大学常州校区新进的讲师待遇如何?考核要求如何? +3 德国小球迷 2024-04-19 18/900 2024-04-22 19:23 by ZHONGWU_U
[论文投稿] 编辑是选国外的好还是国内的好。 +8 lizhengke06 2024-04-20 8/400 2024-04-22 08:58 by cuiyunjian
[论文投稿] 催稿后秒拒 +9 lizhengke06 2024-04-19 11/550 2024-04-21 22:29 by ggjjyyy
[硕博家园] 材料工程,二本硕士,值得读吗 +3 简风23 2024-04-20 6/300 2024-04-21 12:19 by 简风23
[考研] 考研英语带学 +6 choice666 2024-04-18 6/300 2024-04-19 17:46 by charles-c
[论文投稿] SCI 评审意见回复 模板 15+3 Kilig0317 2024-04-18 4/200 2024-04-19 08:46 by bobvan
信息提示
请填处理意见