forked from ybyygu/rust-octree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbench.py
28 lines (22 loc) · 834 Bytes
/
bench.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# TODO [2019-12-15 Sun] 测试benchmark数据 :ATTACH:
# :PROPERTIES:
# :ID: 26fc4bcb-66e3-43aa-93f2-3e154212bd95
# :END:
# [[file:~/Workspace/Programming/gchemol-rs/octree/octree.note::*[2019-12-15 Sun] 测试benchmark数据][[2019-12-15 Sun] 测试benchmark数据:1]]
import ase.io
import numpy as np
def load_pts(filename):
return ase.io.read(filename).positions
test_file_path="examples/data/3wu2.xyz"
points = load_pts(test_file_path)
def get_ckdtree(pts):
import scipy.spatial as spatial
tree = spatial.cKDTree(pts, leafsize=64)
return tree
def test_ckdtree(pts, tree, cutoff):
x = tree.query_ball_point(pts, cutoff)
return x
def run_test():
tree = get_ckdtree(points)
test_ckdtree(points, tree, cutoff=5)
# [2019-12-15 Sun] 测试benchmark数据:1 ends here