[d6730e]: / asv_bench / benchmarks / spatial.py

Download this file

35 lines (25 with data), 1.1 kB

 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
29
30
31
32
33
34
import os
import oddt
from oddt.spatial import distance
test_data_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')
class BenchDistance(object):
"""Spatial functions"""
def setup(self):
self.mols = list(oddt.toolkit.readfile('sdf', '%s/tests/data/dude/xiap/actives_docked.sdf' % test_data_dir))[:10]
self.protein = list(oddt.toolkit.readfile('pdb', '%s/tests/data/dude/xiap/receptor_rdkit.pdb' % test_data_dir))[0]
def time_distance_protein(self):
distance(self.protein.coords, self.protein.coords)
def peakmem_distance_protein(self):
distance(self.protein.coords, self.protein.coords)
def time_distance_mol(self):
for mol in self.mols:
distance(mol.coords, mol.coords)
def peakmem_distance_mol(self):
for mol in self.mols:
distance(mol.coords, mol.coords)
def time_distance_complex(self):
for mol in self.mols:
distance(mol.coords, self.protein.coords)
def peakmem_distance_complex(self):
for mol in self.mols:
distance(mol.coords, self.protein.coords)