2 Star 0 Fork 0

AlexWang0296/HyPost

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
profetch.py 1.31 KB
一键复制 编辑 原始数据 按行查看 历史
alex0296 提交于 2018-08-28 17:50 . add new
import numpy as np
from numpy import array
from ovito.io import import_file
from ovito.modifiers import SliceModifier
from ovito.modifiers import BinAndReduceModifier
# import file
pipeline = import_file("/PATH/TO/File")
# create list stepstr to save frame output
# file name format: "100.*.lammpstrj"/"100.*.gin"
stepstr = [];
for frame in range(pipeline.source.num_frames):
# slice y
yslice = SliceModifier(normal=(0, 1, 0), slab_width=10)
# slice z
zslice = SliceModifier(normal=(0, 0, 1), slab_width=10)
# apply modifiers to pipeline
pipeline.modifiers.append(yslice)
pipeline.modifiers.append(zslice)
# config BinAndReduceModifier
binmdf = BinAndReduceModifier()
binmdf.bin_count_x = 100
binmdf.bin_count_y = 100
binmdf.property = "c_s_1"
binmdf.direction = BinAndReduceModifier.Direction.Vector_1
binmdf.reduction_operation = BinAndReduceModifier.Operation.Mean
pipeline.modifiers.append(binmdf)
pipeline.compute(frame)
# save frame data to temp list gg
gg = binmdf.bin_data.tolist()
# save all data to list gg
stepstr.append(gg)
print('frame %s of %s complete' %(frame,pipeline.source.num_frames))
# convert list to numpy.array for plot and output
output = array(stepstr)
np.savetxt("processed.txt", output, fmt="%2.3f", delimiter=" ")
print('OVER ! ')
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/alexwang0296/HyPost.git
[email protected]:alexwang0296/HyPost.git
alexwang0296
HyPost
HyPost
master

搜索帮助